Merge branch 'JAL-1013_pca_rna_dna' into develop
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 15 Jun 2012 08:58:07 +0000 (09:58 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 15 Jun 2012 08:58:07 +0000 (09:58 +0100)
858 files changed:
.classpath
.externalToolBuilders/Jalview Release indices [Builder].launch
.project
FEATURETODO [new file with mode: 0644]
THIRDPARTYLIBS
build.xml
doc/AddingGroovySupport.html
doc/JalviewRNASupport.html [new file with mode: 0644]
doc/building.html
doc/developing.html
doc/index.html
doc/newdmobj.html
examples/RF00031_folded.stk [new file with mode: 0644]
examples/appletParameters.html
examples/applets.html
help/help.jhm
help/helpTOC.xml
help/html/calculations/consensus.html
help/html/calculations/conservation.html
help/html/calculations/pairwise.html
help/html/calculations/pca.html
help/html/calculations/quality.html
help/html/calculations/recoverInputdata.html
help/html/calculations/redundancy.html
help/html/calculations/sorting.html
help/html/calculations/structureconsensus.html [new file with mode: 0755]
help/html/calculations/tree.html
help/html/calculations/treeviewer.html
help/html/colourSchemes/abovePID.html
help/html/colourSchemes/annotationColouring.html
help/html/colourSchemes/blosum.html
help/html/colourSchemes/buried.html
help/html/colourSchemes/clustal.html
help/html/colourSchemes/conservation.html
help/html/colourSchemes/helix.html
help/html/colourSchemes/hydrophobic.html
help/html/colourSchemes/index.html
help/html/colourSchemes/nucleotide.html
help/html/colourSchemes/pid.html
help/html/colourSchemes/purinepyrimidine.html [new file with mode: 0644]
help/html/colourSchemes/rnahelicesColouring.html [new file with mode: 0644]
help/html/colourSchemes/rnahelicescoloring.png [new file with mode: 0644]
help/html/colourSchemes/strand.html
help/html/colourSchemes/taylor.html
help/html/colourSchemes/textcolour.html
help/html/colourSchemes/turn.html
help/html/colourSchemes/user.html
help/html/colourSchemes/zappo.html
help/html/editing/index.html
help/html/features/annotation.html
help/html/features/annotationsFormat.html
help/html/features/clarguments.html
help/html/features/codingfeatures.html
help/html/features/commandline.html
help/html/features/creatinFeatures.html
help/html/features/cursorMode.html
help/html/features/dasfeatures.html
help/html/features/dassettings.html
help/html/features/editingFeatures.html
help/html/features/featuresFormat.html
help/html/features/featureschemes.html
help/html/features/featuresettings.html
help/html/features/groovy.html
help/html/features/hiddenRegions.html
help/html/features/jalarchive.html
help/html/features/jmol.html
help/html/features/multipleViews.html
help/html/features/newkeystrokes.html
help/html/features/overview.html
help/html/features/pdbviewer.html
help/html/features/preferences.html
help/html/features/search.html
help/html/features/seqfeatures.html
help/html/features/seqfetch.html
help/html/features/seqmappings.html
help/html/features/varna.html [new file with mode: 0644]
help/html/features/viewingpdbs.html
help/html/features/wrap.html
help/html/index.html
help/html/io/export.html
help/html/io/fileformats.html
help/html/io/index.html
help/html/io/modellerpir.html
help/html/jalviewjnlp.html
help/html/keys.html
help/html/memory.html
help/html/menus/alignmentMenu.html
help/html/menus/alwannotations.html
help/html/menus/alwcalculate.html
help/html/menus/alwcolour.html
help/html/menus/alwedit.html
help/html/menus/alwfile.html
help/html/menus/alwformat.html
help/html/menus/alwselect.html
help/html/menus/alwview.html
help/html/menus/desktopMenu.html
help/html/menus/index.html
help/html/menus/popupMenu.html
help/html/menus/wsmenu.html
help/html/misc/aaproperties.html
help/html/misc/aminoAcids.html
help/html/misc/geneticCode.html
help/html/na/index.html [new file with mode: 0644]
help/html/privacy.html
help/html/releases.html
help/html/vamsas/index.html
help/html/webServices/JABAWS.html
help/html/webServices/dbreffetcher.html
help/html/webServices/index.html
help/html/webServices/jnet.html
help/html/webServices/msaclient.html
help/html/webServices/shmr.html
help/html/webServices/urllinks.html
help/html/webServices/webServicesParams.html
help/html/webServices/webServicesPrefs.html
help/html/whatsNew.html
jalview-jalopy.xml
lib/VARNAv3-9-dev.jar [new file with mode: 0644]
lib/castor-1.1-cycle-xml.jar
lib/jaxrpc.jar
lib/jdas-1.0.4.jar [new file with mode: 0644]
lib/log4j-1.2.8.jar
lib/min-jaba-client-2.0.jar [new file with mode: 0644]
lib/min-jaba-client.jar [deleted file]
lib/saaj.jar
lib/spring-core-3.0.5.RELEASE.jar [new file with mode: 0644]
lib/spring-web-3.0.5.RELEASE.jar [new file with mode: 0644]
nbbuild.xml
nbproject/project.properties
nbproject/project.xml
resources/authors.props [new file with mode: 0644]
resources/embl_mapping.xml
resources/uniprot_mapping.xml
schemas/JalviewUserColours.xsd
schemas/JalviewWsParamSet.xsd
schemas/castor-mapping.xsd
schemas/jalview.xsd
schemas/jalviewJvV1.xsd
schemas/vamsas.xsd
schemas/vamsasJvV1.xsd
src/MCview/AppletPDBCanvas.java
src/MCview/AppletPDBViewer.java
src/MCview/Atom.java
src/MCview/Bond.java
src/MCview/MCMatrix.java
src/MCview/PDBCanvas.java
src/MCview/PDBChain.java
src/MCview/PDBViewer.java
src/MCview/PDBfile.java
src/MCview/Residue.java
src/MCview/Zsort.java
src/ext/vamsas/IRegistry.java
src/ext/vamsas/IRegistryService.java
src/ext/vamsas/IRegistryServiceLocator.java
src/ext/vamsas/Jpred.java
src/ext/vamsas/JpredService.java
src/ext/vamsas/JpredServiceLocator.java
src/ext/vamsas/JpredSoapBindingStub.java
src/ext/vamsas/MuscleWS.java
src/ext/vamsas/MuscleWSService.java
src/ext/vamsas/MuscleWSServiceLocator.java
src/ext/vamsas/MuscleWSSoapBindingStub.java
src/ext/vamsas/RegistryServiceSoapBindingStub.java
src/ext/vamsas/SeqSearchI.java
src/ext/vamsas/SeqSearchServiceLocator.java
src/ext/vamsas/SeqSearchServiceService.java
src/ext/vamsas/SeqSearchServiceSoapBindingStub.java
src/ext/vamsas/ServiceHandle.java
src/ext/vamsas/ServiceHandles.java
src/jalview/analysis/AAFrequency.java
src/jalview/analysis/AlignSeq.java
src/jalview/analysis/AlignmentSorter.java
src/jalview/analysis/Conservation.java
src/jalview/analysis/CrossRef.java
src/jalview/analysis/Dna.java
src/jalview/analysis/Finder.java
src/jalview/analysis/Grouping.java
src/jalview/analysis/NJTree.java
src/jalview/analysis/PCA.java
src/jalview/analysis/ParseProperties.java
src/jalview/analysis/Rna.java [new file with mode: 0644]
src/jalview/analysis/SeqsetUtils.java
src/jalview/analysis/SequenceIdMatcher.java
src/jalview/analysis/StructureFrequency.java [new file with mode: 0644]
src/jalview/analysis/WUSSParseException.java [new file with mode: 0644]
src/jalview/api/AlignCalcManagerI.java [new file with mode: 0644]
src/jalview/api/AlignCalcWorkerI.java [new file with mode: 0644]
src/jalview/api/AlignViewportI.java [new file with mode: 0644]
src/jalview/api/AlignmentViewPanel.java
src/jalview/api/FeatureRenderer.java
src/jalview/api/OOMHandlerI.java [new file with mode: 0644]
src/jalview/api/SequenceRenderer.java
src/jalview/api/SequenceStructureBinding.java
src/jalview/api/StructureSelectionManagerProvider.java
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/AlignViewport.java
src/jalview/appletgui/AlignmentPanel.java
src/jalview/appletgui/AnnotationColourChooser.java
src/jalview/appletgui/AnnotationLabels.java
src/jalview/appletgui/AnnotationPanel.java
src/jalview/appletgui/AppletJmol.java
src/jalview/appletgui/AppletJmolBinding.java
src/jalview/appletgui/CutAndPasteTransfer.java
src/jalview/appletgui/EditNameDialog.java
src/jalview/appletgui/EmbmenuFrame.java
src/jalview/appletgui/ExtJmol.java
src/jalview/appletgui/FeatureColourChooser.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/FeatureSettings.java
src/jalview/appletgui/Finder.java
src/jalview/appletgui/FontChooser.java
src/jalview/appletgui/IdCanvas.java
src/jalview/appletgui/IdPanel.java
src/jalview/appletgui/IdwidthAdjuster.java
src/jalview/appletgui/JVDialog.java
src/jalview/appletgui/OverviewPanel.java
src/jalview/appletgui/PCAPanel.java
src/jalview/appletgui/PaintRefresher.java
src/jalview/appletgui/PairwiseAlignPanel.java
src/jalview/appletgui/RedundancyPanel.java
src/jalview/appletgui/RotatableCanvas.java
src/jalview/appletgui/ScalePanel.java
src/jalview/appletgui/SeqCanvas.java
src/jalview/appletgui/SeqPanel.java
src/jalview/appletgui/SequenceRenderer.java
src/jalview/appletgui/SliderPanel.java
src/jalview/appletgui/Tooltip.java
src/jalview/appletgui/TreeCanvas.java
src/jalview/appletgui/TreePanel.java
src/jalview/appletgui/UserDefinedColours.java
src/jalview/bin/Cache.java
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewLite.java
src/jalview/bin/JalviewLiteURLRetrieve.java
src/jalview/binding/Alignment.java
src/jalview/binding/Annotation.java
src/jalview/binding/AnnotationElement.java
src/jalview/binding/Colour.java
src/jalview/binding/Feature.java
src/jalview/binding/FeatureSettings.java
src/jalview/binding/Features.java
src/jalview/binding/JGroup.java
src/jalview/binding/JSeq.java
src/jalview/binding/JalviewModel.java
src/jalview/binding/JalviewModelSequence.java
src/jalview/binding/JalviewUserColours.java
src/jalview/binding/Pdbentry.java
src/jalview/binding/PdbentryItem.java
src/jalview/binding/Pdbids.java
src/jalview/binding/Property.java
src/jalview/binding/Sequence.java
src/jalview/binding/SequenceSet.java
src/jalview/binding/SequenceType.java
src/jalview/binding/Setting.java
src/jalview/binding/Tree.java
src/jalview/binding/UserColourScheme.java
src/jalview/binding/UserColours.java
src/jalview/binding/VAMSAS.java
src/jalview/binding/VamsasModel.java
src/jalview/binding/Viewport.java
src/jalview/commands/ChangeCaseCommand.java
src/jalview/commands/CommandI.java
src/jalview/commands/EditCommand.java
src/jalview/commands/OrderCommand.java
src/jalview/commands/RemoveGapColCommand.java
src/jalview/commands/RemoveGapsCommand.java
src/jalview/commands/SlideSequencesCommand.java
src/jalview/commands/TrimRegionCommand.java
src/jalview/datamodel/AlignedCodonFrame.java
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/datamodel/AlignmentI.java
src/jalview/datamodel/AlignmentOrder.java
src/jalview/datamodel/AlignmentView.java
src/jalview/datamodel/AnnotatedCollectionI.java [new file with mode: 0644]
src/jalview/datamodel/Annotation.java
src/jalview/datamodel/BinaryNode.java
src/jalview/datamodel/BinarySequence.java
src/jalview/datamodel/CigarArray.java
src/jalview/datamodel/CigarBase.java
src/jalview/datamodel/CigarCigar.java
src/jalview/datamodel/CigarSimple.java
src/jalview/datamodel/ColumnSelection.java
src/jalview/datamodel/DBRefEntry.java
src/jalview/datamodel/DBRefSource.java
src/jalview/datamodel/FeatureProperties.java
src/jalview/datamodel/GraphLine.java
src/jalview/datamodel/HiddenSequences.java
src/jalview/datamodel/Mapping.java
src/jalview/datamodel/NodeTransformI.java
src/jalview/datamodel/PDBEntry.java
src/jalview/datamodel/Provenance.java
src/jalview/datamodel/ProvenanceEntry.java
src/jalview/datamodel/SearchResults.java
src/jalview/datamodel/SeqCigar.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceCollectionI.java [new file with mode: 0644]
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/SequenceGroup.java
src/jalview/datamodel/SequenceI.java
src/jalview/datamodel/SequenceNode.java
src/jalview/datamodel/SequencePoint.java
src/jalview/datamodel/UniprotEntry.java
src/jalview/datamodel/UniprotFile.java
src/jalview/datamodel/UniprotProteinName.java
src/jalview/datamodel/UniprotSequence.java
src/jalview/datamodel/xdb/embl/BasePosition.java
src/jalview/datamodel/xdb/embl/EmblEntry.java
src/jalview/datamodel/xdb/embl/EmblError.java
src/jalview/datamodel/xdb/embl/EmblFeature.java
src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java
src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java
src/jalview/datamodel/xdb/embl/EmblFile.java
src/jalview/datamodel/xdb/embl/EmblSequence.java
src/jalview/datamodel/xdb/embl/Qualifier.java
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/ext/jmol/JmolCommands.java
src/jalview/ext/varna/JalviewVarnaBinding.java [new file with mode: 0644]
src/jalview/ext/varna/VarnaCommands.java [new file with mode: 0644]
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationColourChooser.java
src/jalview/gui/AnnotationExporter.java
src/jalview/gui/AnnotationLabels.java
src/jalview/gui/AnnotationPanel.java
src/jalview/gui/AppJmol.java
src/jalview/gui/AppJmolBinding.java
src/jalview/gui/AppVarna.java [new file with mode: 0644]
src/jalview/gui/AppVarnaBinding.java [new file with mode: 0644]
src/jalview/gui/AssociatePdbFileWithSeq.java
src/jalview/gui/BlogReader.java
src/jalview/gui/ConservationThread.java [deleted file]
src/jalview/gui/Console.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/DasSourceBrowser.java
src/jalview/gui/Desktop.java
src/jalview/gui/EPSOptions.java
src/jalview/gui/EditNameDialog.java
src/jalview/gui/FeatureColourChooser.java
src/jalview/gui/FeatureRenderer.java
src/jalview/gui/FeatureSettings.java
src/jalview/gui/Finder.java
src/jalview/gui/FontChooser.java
src/jalview/gui/IProgressIndicator.java
src/jalview/gui/IProgressIndicatorHandler.java
src/jalview/gui/IdCanvas.java
src/jalview/gui/IdPanel.java
src/jalview/gui/IdwidthAdjuster.java
src/jalview/gui/JDatabaseTree.java [new file with mode: 0644]
src/jalview/gui/Jalview2XML.java
src/jalview/gui/Jalview2XML_V1.java
src/jalview/gui/JalviewAppender.java
src/jalview/gui/JalviewChangeSupport.java
src/jalview/gui/JalviewDialog.java
src/jalview/gui/JvSwingUtils.java
src/jalview/gui/OOMWarning.java
src/jalview/gui/OptsAndParamsPage.java
src/jalview/gui/OptsParametersContainerI.java
src/jalview/gui/OverviewPanel.java
src/jalview/gui/PCAPanel.java
src/jalview/gui/PaintRefresher.java
src/jalview/gui/PairwiseAlignPanel.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/Preferences.java
src/jalview/gui/PromptUserConfig.java
src/jalview/gui/RedundancyPanel.java
src/jalview/gui/RestInputParamEditDialog.java
src/jalview/gui/RestServiceEditorPane.java
src/jalview/gui/RotatableCanvas.java
src/jalview/gui/ScalePanel.java
src/jalview/gui/ScriptWindow.java
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java
src/jalview/gui/SequenceFetcher.java
src/jalview/gui/SequenceRenderer.java
src/jalview/gui/SliderPanel.java
src/jalview/gui/SplashScreen.java
src/jalview/gui/TextColourChooser.java
src/jalview/gui/TreeCanvas.java
src/jalview/gui/TreePanel.java
src/jalview/gui/UserDefinedColours.java
src/jalview/gui/UserQuestionnaireCheck.java
src/jalview/gui/VamsasApplication.java
src/jalview/gui/ViewSelectionMenu.java
src/jalview/gui/WebserviceInfo.java
src/jalview/gui/WsJobParameters.java
src/jalview/gui/WsParamSetManager.java
src/jalview/gui/WsPreferences.java
src/jalview/io/AMSAFile.java
src/jalview/io/AlignFile.java
src/jalview/io/AlignmentProperties.java
src/jalview/io/AnnotationFile.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/BLCFile.java
src/jalview/io/ClansFile.java
src/jalview/io/ClustalFile.java
src/jalview/io/DBRefFile.java
src/jalview/io/FastaFile.java
src/jalview/io/FeaturesFile.java
src/jalview/io/FileLoader.java
src/jalview/io/FileParse.java
src/jalview/io/FormatAdapter.java
src/jalview/io/HTMLOutput.java
src/jalview/io/IdentifyFile.java
src/jalview/io/JPredFile.java
src/jalview/io/JalviewFileChooser.java
src/jalview/io/JalviewFileFilter.java
src/jalview/io/JalviewFileView.java
src/jalview/io/JnetAnnotationMaker.java
src/jalview/io/MSFfile.java
src/jalview/io/MatrixFile.java
src/jalview/io/ModellerDescription.java
src/jalview/io/NewickFile.java
src/jalview/io/PIRFile.java
src/jalview/io/PfamFile.java
src/jalview/io/PileUpfile.java
src/jalview/io/SimpleBlastFile.java
src/jalview/io/StockholmFile.java
src/jalview/io/TCoffeeScoreFile.java [new file with mode: 0644]
src/jalview/io/VamsasAppDatastore.java
src/jalview/io/WSWUBlastClient.java
src/jalview/io/packed/DataProvider.java
src/jalview/io/packed/JalviewDataset.java
src/jalview/io/packed/ParsePackedSet.java
src/jalview/io/packed/SimpleDataProvider.java
src/jalview/io/vamsas/Datasetsequence.java
src/jalview/io/vamsas/DatastoreItem.java
src/jalview/io/vamsas/DatastoreRegistry.java
src/jalview/io/vamsas/Dbref.java
src/jalview/io/vamsas/LocalDocSyncObject.java
src/jalview/io/vamsas/Rangetype.java
src/jalview/io/vamsas/Sequencefeature.java
src/jalview/io/vamsas/Sequencemapping.java
src/jalview/io/vamsas/Tree.java
src/jalview/javascript/JSFunctionExec.java
src/jalview/javascript/JalviewLiteJsApi.java
src/jalview/javascript/JsCallBack.java
src/jalview/javascript/JsSelectionSender.java
src/jalview/javascript/MouseOverListener.java
src/jalview/javascript/MouseOverStructureListener.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GAlignmentPanel.java
src/jalview/jbgui/GCutAndPasteTransfer.java
src/jalview/jbgui/GDasSourceBrowser.java
src/jalview/jbgui/GDesktop.java
src/jalview/jbgui/GFinder.java
src/jalview/jbgui/GFontChooser.java
src/jalview/jbgui/GPCAPanel.java
src/jalview/jbgui/GPairwiseAlignPanel.java
src/jalview/jbgui/GPreferences.java
src/jalview/jbgui/GRestInputParamEditDialog.java
src/jalview/jbgui/GRestServiceEditorPane.java
src/jalview/jbgui/GRnaStructureViewer.java [new file with mode: 0644]
src/jalview/jbgui/GSequenceLink.java
src/jalview/jbgui/GSliderPanel.java
src/jalview/jbgui/GStructureViewer.java
src/jalview/jbgui/GTreePanel.java
src/jalview/jbgui/GUserDefinedColours.java
src/jalview/jbgui/GWebserviceInfo.java
src/jalview/jbgui/GWsPreferences.java
src/jalview/math/Matrix.java
src/jalview/math/RotatableMatrix.java
src/jalview/renderer/AnnotationRenderer.java [new file with mode: 0644]
src/jalview/renderer/AwtRenderPanelI.java [new file with mode: 0644]
src/jalview/schemabinding/version2/.castor.cdr
src/jalview/schemabinding/version2/AlcodMap.java
src/jalview/schemabinding/version2/Alcodon.java
src/jalview/schemabinding/version2/AlcodonFrame.java
src/jalview/schemabinding/version2/Annotation.java
src/jalview/schemabinding/version2/AnnotationColours.java
src/jalview/schemabinding/version2/AnnotationElement.java
src/jalview/schemabinding/version2/Colour.java
src/jalview/schemabinding/version2/DBRef.java
src/jalview/schemabinding/version2/Feature.java
src/jalview/schemabinding/version2/FeatureSettings.java
src/jalview/schemabinding/version2/Features.java
src/jalview/schemabinding/version2/Group.java
src/jalview/schemabinding/version2/HiddenColumns.java
src/jalview/schemabinding/version2/JGroup.java
src/jalview/schemabinding/version2/JSeq.java
src/jalview/schemabinding/version2/JalviewModel.java
src/jalview/schemabinding/version2/JalviewModelSequence.java
src/jalview/schemabinding/version2/JalviewUserColours.java
src/jalview/schemabinding/version2/MapListFrom.java
src/jalview/schemabinding/version2/MapListTo.java
src/jalview/schemabinding/version2/MapListType.java
src/jalview/schemabinding/version2/Mapping.java
src/jalview/schemabinding/version2/MappingChoice.java
src/jalview/schemabinding/version2/OtherData.java
src/jalview/schemabinding/version2/Pdbentry.java
src/jalview/schemabinding/version2/PdbentryItem.java
src/jalview/schemabinding/version2/Pdbids.java
src/jalview/schemabinding/version2/Property.java
src/jalview/schemabinding/version2/Sequence.java
src/jalview/schemabinding/version2/SequenceSet.java
src/jalview/schemabinding/version2/SequenceSetProperties.java
src/jalview/schemabinding/version2/SequenceType.java
src/jalview/schemabinding/version2/Setting.java
src/jalview/schemabinding/version2/StructureState.java
src/jalview/schemabinding/version2/ThresholdLine.java
src/jalview/schemabinding/version2/Tree.java
src/jalview/schemabinding/version2/UserColourScheme.java
src/jalview/schemabinding/version2/UserColours.java
src/jalview/schemabinding/version2/VAMSAS.java
src/jalview/schemabinding/version2/VamsasModel.java
src/jalview/schemabinding/version2/Viewport.java
src/jalview/schemabinding/version2/WebServiceParameterSet.java
src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java
src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java
src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java
src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java
src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java
src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java
src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java
src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java
src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java
src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java
src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java
src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java
src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java
src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java
src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java
src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java
src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java
src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java
src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java
src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java
src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java
src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java
src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java
src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java
src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java
src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java
src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java
src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java
src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java
src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java
src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java
src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java
src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java
src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java
src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java
src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java
src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java
src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java
src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java
src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java
src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java
src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java
src/jalview/schemes/AnnotationColourGradient.java
src/jalview/schemes/Blosum62ColourScheme.java
src/jalview/schemes/BuriedColourScheme.java
src/jalview/schemes/ClustalxColourScheme.java
src/jalview/schemes/ColourSchemeI.java
src/jalview/schemes/ColourSchemeProperty.java
src/jalview/schemes/Consensus.java
src/jalview/schemes/CovariationColourScheme.java [new file with mode: 0644]
src/jalview/schemes/GraduatedColor.java
src/jalview/schemes/HelixColourScheme.java
src/jalview/schemes/HydrophobicColourScheme.java
src/jalview/schemes/NucleotideColourScheme.java
src/jalview/schemes/PIDColourScheme.java
src/jalview/schemes/PurinePyrimidineColourScheme.java [new file with mode: 0644]
src/jalview/schemes/RNAHelicesColour.java [new file with mode: 0644]
src/jalview/schemes/RNAHelicesColourChooser.java [new file with mode: 0644]
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ResidueProperties.java
src/jalview/schemes/ScoreColourScheme.java
src/jalview/schemes/ScoreMatrix.java
src/jalview/schemes/StrandColourScheme.java
src/jalview/schemes/TCoffeeColourScheme.java [new file with mode: 0644]
src/jalview/schemes/TaylorColourScheme.java
src/jalview/schemes/TurnColourScheme.java
src/jalview/schemes/UserColourScheme.java
src/jalview/schemes/ZappoColourScheme.java
src/jalview/structure/AlignmentViewPanelListener.java
src/jalview/structure/SecondaryStructureListener.java [new file with mode: 0644]
src/jalview/structure/SelectionListener.java
src/jalview/structure/SelectionSource.java
src/jalview/structure/SequenceListener.java
src/jalview/structure/StructureListener.java
src/jalview/structure/StructureMapping.java
src/jalview/structure/StructureMappingcommandSet.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/structure/VamsasListener.java
src/jalview/structure/VamsasSource.java
src/jalview/util/AWTConsole.java
src/jalview/util/BrowserLauncher.java
src/jalview/util/ColorUtils.java [new file with mode: 0644]
src/jalview/util/Comparison.java
src/jalview/util/DBRefUtils.java
src/jalview/util/Format.java
src/jalview/util/GroupUrlLink.java
src/jalview/util/ImageMaker.java
src/jalview/util/MapList.java
src/jalview/util/ParseHtmlBodyAndLinks.java
src/jalview/util/Platform.java
src/jalview/util/QuickSort.java
src/jalview/util/ShiftList.java
src/jalview/util/TableSorter.java
src/jalview/util/UrlLink.java
src/jalview/util/jarInputStreamProvider.java
src/jalview/viewmodel/AlignmentViewport.java [new file with mode: 0644]
src/jalview/workers/AlignCalcManager.java [new file with mode: 0644]
src/jalview/workers/AlignCalcWorker.java [new file with mode: 0644]
src/jalview/workers/ConsensusThread.java [new file with mode: 0644]
src/jalview/workers/ConservationThread.java [new file with mode: 0644]
src/jalview/workers/StrucConsensusThread.java [new file with mode: 0644]
src/jalview/ws/AWSThread.java
src/jalview/ws/AWsJob.java
src/jalview/ws/DBRefFetcher.java
src/jalview/ws/DasSequenceFeatureFetcher.java
src/jalview/ws/EnfinEnvision2OneWay.java
src/jalview/ws/JobStateSummary.java
src/jalview/ws/SequenceFetcher.java
src/jalview/ws/WSClient.java
src/jalview/ws/WSClientI.java
src/jalview/ws/WSMenuEntryProviderI.java
src/jalview/ws/dbsources/DasSequenceSource.java [deleted file]
src/jalview/ws/dbsources/EbiFileRetrievedProxy.java
src/jalview/ws/dbsources/EmblCdsSouce.java
src/jalview/ws/dbsources/EmblSource.java
src/jalview/ws/dbsources/EmblXmlSource.java
src/jalview/ws/dbsources/GeneDbSource.java
src/jalview/ws/dbsources/Pdb.java
src/jalview/ws/dbsources/Pfam.java
src/jalview/ws/dbsources/PfamFull.java
src/jalview/ws/dbsources/PfamSeed.java
src/jalview/ws/dbsources/Rfam.java [new file with mode: 0644]
src/jalview/ws/dbsources/RfamFull.java [new file with mode: 0644]
src/jalview/ws/dbsources/RfamSeed.java [new file with mode: 0644]
src/jalview/ws/dbsources/Uniprot.java
src/jalview/ws/dbsources/UnprotName.java
src/jalview/ws/dbsources/Xfam.java [new file with mode: 0644]
src/jalview/ws/dbsources/das/DasSequenceSourceListener.java [deleted file]
src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java [new file with mode: 0644]
src/jalview/ws/dbsources/das/api/jalviewSourceI.java [new file with mode: 0644]
src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java [new file with mode: 0644]
src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java [new file with mode: 0644]
src/jalview/ws/dbsources/das/datamodel/JalviewSource.java [new file with mode: 0644]
src/jalview/ws/ebi/EBIFetchClient.java
src/jalview/ws/io/mime/HttpContentHandler.java
src/jalview/ws/io/mime/JalviewMimeContentHandler.java
src/jalview/ws/io/mime/MimeTypes.java
src/jalview/ws/jws1/Discoverer.java
src/jalview/ws/jws1/JPredClient.java
src/jalview/ws/jws1/JPredThread.java
src/jalview/ws/jws1/JWS1Thread.java
src/jalview/ws/jws1/MsaWSClient.java
src/jalview/ws/jws1/MsaWSThread.java
src/jalview/ws/jws1/SeqSearchWSClient.java
src/jalview/ws/jws1/SeqSearchWSThread.java
src/jalview/ws/jws1/WS1Client.java
src/jalview/ws/jws1/WSJob.java
src/jalview/ws/jws2/AAConsClient.java [new file with mode: 0644]
src/jalview/ws/jws2/AADisorderClient.java [new file with mode: 0644]
src/jalview/ws/jws2/AWS2Thread.java
src/jalview/ws/jws2/JWs2Job.java
src/jalview/ws/jws2/JabaParamStore.java
src/jalview/ws/jws2/JabaPreset.java
src/jalview/ws/jws2/JabaWsServerQuery.java
src/jalview/ws/jws2/JabawsAlignCalcWorker.java [new file with mode: 0644]
src/jalview/ws/jws2/Jws2Client.java
src/jalview/ws/jws2/Jws2Discoverer.java
src/jalview/ws/jws2/MsaWSClient.java
src/jalview/ws/jws2/MsaWSThread.java
src/jalview/ws/jws2/ParameterUtils.java
src/jalview/ws/jws2/SequenceAnnotationWSClient.java [new file with mode: 0644]
src/jalview/ws/jws2/dm/JabaOption.java
src/jalview/ws/jws2/dm/JabaParameter.java
src/jalview/ws/jws2/dm/JabaValueConstrain.java
src/jalview/ws/jws2/dm/JabaWsParamSet.java
src/jalview/ws/jws2/jabaws2/Jws2Instance.java [new file with mode: 0644]
src/jalview/ws/params/ArgumentI.java
src/jalview/ws/params/InvalidArgumentException.java
src/jalview/ws/params/OptionI.java
src/jalview/ws/params/ParamDatastoreI.java
src/jalview/ws/params/ParamManager.java
src/jalview/ws/params/ParameterI.java
src/jalview/ws/params/ValueConstrainI.java
src/jalview/ws/params/WsParamSetI.java
src/jalview/ws/params/simple/BooleanOption.java
src/jalview/ws/params/simple/IntegerParameter.java
src/jalview/ws/params/simple/Option.java
src/jalview/ws/params/simple/Parameter.java
src/jalview/ws/params/simple/StringChoiceParameter.java
src/jalview/ws/rest/AlignmentProcessor.java
src/jalview/ws/rest/HttpResultSet.java
src/jalview/ws/rest/InputType.java
src/jalview/ws/rest/NoValidInputDataException.java
src/jalview/ws/rest/RestClient.java
src/jalview/ws/rest/RestJob.java
src/jalview/ws/rest/RestJobThread.java
src/jalview/ws/rest/RestServiceDescription.java
src/jalview/ws/rest/params/Alignment.java
src/jalview/ws/rest/params/AnnotationFile.java
src/jalview/ws/rest/params/JobConstant.java
src/jalview/ws/rest/params/SeqGroupIndexVector.java
src/jalview/ws/rest/params/SeqIdVector.java
src/jalview/ws/rest/params/SeqVector.java
src/jalview/ws/rest/params/Tree.java
src/jalview/ws/seqfetcher/ASequenceFetcher.java
src/jalview/ws/seqfetcher/DbSourceProxy.java
src/jalview/ws/seqfetcher/DbSourceProxyImpl.java
src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java [deleted file]
src/org/biojava/dasobert/das/DAS_Feature_Handler.java [deleted file]
src/org/biojava/dasobert/das/DAS_Sequence_Handler.java [deleted file]
src/org/biojava/dasobert/das/FeatureThread.java [deleted file]
src/org/biojava/dasobert/das/SequenceThread.java [deleted file]
src/org/biojava/dasobert/das2/Das2Capability.java [deleted file]
src/org/biojava/dasobert/das2/Das2CapabilityImpl.java [deleted file]
src/org/biojava/dasobert/das2/Das2Source.java [deleted file]
src/org/biojava/dasobert/das2/Das2SourceImpl.java [deleted file]
src/org/biojava/dasobert/das2/DasSourceConverter.java [deleted file]
src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java [deleted file]
src/org/biojava/dasobert/das2/io/DasSourceReader.java [deleted file]
src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java [deleted file]
src/org/biojava/dasobert/dasregistry/Das1Source.java [deleted file]
src/org/biojava/dasobert/dasregistry/Das2Validator.java [deleted file]
src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java [deleted file]
src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java [deleted file]
src/org/biojava/dasobert/dasregistry/DasSource.java [deleted file]
src/org/biojava/dasobert/dasregistry/DasSourceComparator.java [deleted file]
src/org/biojava/dasobert/eventmodel/AbstractDasEvent.java [deleted file]
src/org/biojava/dasobert/eventmodel/FeatureEvent.java [deleted file]
src/org/biojava/dasobert/eventmodel/FeatureListener.java [deleted file]
src/org/biojava/dasobert/eventmodel/ObjectListener.java [deleted file]
src/org/biojava/dasobert/eventmodel/SequenceEvent.java [deleted file]
src/org/biojava/dasobert/eventmodel/SequenceListener.java [deleted file]
src/org/biojava/dasobert/feature/AbstractFeatureTrack.java [deleted file]
src/org/biojava/dasobert/feature/AbstractSegment.java [deleted file]
src/org/biojava/dasobert/feature/FeatureComparator.java [deleted file]
src/org/biojava/dasobert/feature/FeatureMapComparator.java [deleted file]
src/org/biojava/dasobert/feature/FeatureTrack.java [deleted file]
src/org/biojava/dasobert/feature/FeatureTrackConverter.java [deleted file]
src/org/biojava/dasobert/feature/FeatureTrackImpl.java [deleted file]
src/org/biojava/dasobert/feature/HistogramFeature.java [deleted file]
src/org/biojava/dasobert/feature/HistogramSegment.java [deleted file]
src/org/biojava/dasobert/feature/Segment.java [deleted file]
src/org/biojava/dasobert/feature/SegmentComparator.java [deleted file]
src/org/biojava/dasobert/feature/SegmentImpl.java [deleted file]
src/uk/ac/ebi/picr/model/CrossReference.java
src/uk/ac/ebi/picr/model/CrossReference_Helper.java
src/uk/ac/ebi/picr/model/UPEntry.java
src/uk/ac/ebi/picr/model/UPEntry_Helper.java
src/uk/ac/ebi/www/Data.java
src/uk/ac/ebi/www/InputParams.java
src/uk/ac/ebi/www/WSFile.java
src/uk/ac/ebi/www/WSWUBlast.java
src/uk/ac/ebi/www/WSWUBlastService.java
src/uk/ac/ebi/www/WSWUBlastServiceLocator.java
src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java
src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperBindingStub.java
src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperInterface.java
src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperService.java
src/uk/ac/ebi/www/picr/AccessionMappingService/AccessionMapperServiceLocator.java
src/vamsas/IMsaWS.java
src/vamsas/objects/simple/Alignment.java
src/vamsas/objects/simple/Alignment_Helper.java
src/vamsas/objects/simple/JpredResult.java
src/vamsas/objects/simple/JpredResult_Helper.java
src/vamsas/objects/simple/MsaResult.java
src/vamsas/objects/simple/MsaResult_Helper.java
src/vamsas/objects/simple/Msfalignment.java
src/vamsas/objects/simple/Msfalignment_Helper.java
src/vamsas/objects/simple/Object.java
src/vamsas/objects/simple/Object_Helper.java
src/vamsas/objects/simple/Result.java
src/vamsas/objects/simple/Result_Helper.java
src/vamsas/objects/simple/Secstructpred.java
src/vamsas/objects/simple/Secstructpred_Helper.java
src/vamsas/objects/simple/SeqSearchResult.java
src/vamsas/objects/simple/SeqSearchResult_Helper.java
src/vamsas/objects/simple/Sequence.java
src/vamsas/objects/simple/SequenceSet.java
src/vamsas/objects/simple/SequenceSet_Helper.java
src/vamsas/objects/simple/Sequence_Helper.java
src/vamsas/objects/simple/WsJobId.java
src/vamsas/objects/simple/WsJobId_Helper.java
test/jalview/io/TCoffeeScoreFileTest.java [new file with mode: 0644]
test/jalview/io/tcoffee.fasta_aln [new file with mode: 0644]
test/jalview/io/tcoffee.score_ascii [new file with mode: 0644]
utils/InstallAnywhere/Jalview.iap_xml
utils/InstallAnywhere/jalview_buildinstaller.xml
utils/eclipse/JalviewCodeStyle.xml
utils/getJavaVersion.java
utils/help2Website.java
utils/jalopy/docs/acknowledge.html
utils/jalopy/docs/bi01.html
utils/jalopy/docs/build.html
utils/jalopy/docs/comments.html
utils/jalopy/docs/contact.html
utils/jalopy/docs/contributors.html
utils/jalopy/docs/dedication.html
utils/jalopy/docs/dependencies.html
utils/jalopy/docs/docs.html
utils/jalopy/docs/download.html
utils/jalopy/docs/environment.html
utils/jalopy/docs/faq.html
utils/jalopy/docs/features.html
utils/jalopy/docs/footer.html
utils/jalopy/docs/header.html
utils/jalopy/docs/history.html
utils/jalopy/docs/imports.html
utils/jalopy/docs/indentation.html
utils/jalopy/docs/index.html
utils/jalopy/docs/inspector-naming.html
utils/jalopy/docs/inspector.html
utils/jalopy/docs/installation.html
utils/jalopy/docs/introduction.html
utils/jalopy/docs/ix01.html
utils/jalopy/docs/javadoc.html
utils/jalopy/docs/license-antlr.html
utils/jalopy/docs/license-apache.html
utils/jalopy/docs/license-common-public.html
utils/jalopy/docs/license-gnu-doc.html
utils/jalopy/docs/license-gnu.html
utils/jalopy/docs/license-sun-public.html
utils/jalopy/docs/links.html
utils/jalopy/docs/manual.html
utils/jalopy/docs/messages.html
utils/jalopy/docs/misc.html
utils/jalopy/docs/part-core.html
utils/jalopy/docs/part-plugins.html
utils/jalopy/docs/plugin-ant-config.html
utils/jalopy/docs/plugin-ant-license.html
utils/jalopy/docs/plugin-ant-usage.html
utils/jalopy/docs/plugin-ant.html
utils/jalopy/docs/plugin-console-license.html
utils/jalopy/docs/plugin-console-usage.html
utils/jalopy/docs/plugin-console.html
utils/jalopy/docs/plugin-eclipse-integration.html
utils/jalopy/docs/plugin-eclipse-license.html
utils/jalopy/docs/plugin-eclipse.html
utils/jalopy/docs/plugin-jbuilder-integration.html
utils/jalopy/docs/plugin-jbuilder-license.html
utils/jalopy/docs/plugin-jbuilder.html
utils/jalopy/docs/plugin-jdev-integration.html
utils/jalopy/docs/plugin-jdev-license.html
utils/jalopy/docs/plugin-jdev.html
utils/jalopy/docs/plugin-jedit-integration.html
utils/jalopy/docs/plugin-jedit-license.html
utils/jalopy/docs/plugin-jedit.html
utils/jalopy/docs/plugin-netbeans-integration.html
utils/jalopy/docs/plugin-netbeans-license.html
utils/jalopy/docs/plugin-netbeans.html
utils/jalopy/docs/plugins.html
utils/jalopy/docs/printer.html
utils/jalopy/docs/project.html
utils/jalopy/docs/separation.html
utils/jalopy/docs/settings.html
utils/jalopy/docs/sorting.html
utils/jalopy/docs/usage.html
utils/jalopy/docs/whitespace.html
utils/jalopy/docs/wrapping.html
utils/jalopy/readme.html

index 01cf242..6cffc21 100644 (file)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
        <classpathentry kind="src" path="src"/>
+       <classpathentry kind="src" path="utils"/>
+       <classpathentry kind="src" path="test"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="lib" path="lib/activation.jar"/>
        <classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
        </classpathentry>
        <classpathentry kind="lib" path="lib/miglayout-4.0-swing.jar"/>
        <classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
-       <classpathentry kind="lib" path="lib/min-jaba-client.jar"/>
        <classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
+       <classpathentry kind="lib" path="lib/min-jaba-client-2.0.jar" sourcepath="/clustengine2"/>
        <classpathentry kind="lib" path="lib/Jmol-12.2.4.jar"/>
        <classpathentry kind="lib" path="appletlib/JmolApplet-12.2.4.jar"/>
+       <classpathentry kind="lib" path="lib/jdas-1.0.4.jar"/>
+       <classpathentry kind="lib" path="lib/spring-core-3.0.5.RELEASE.jar"/>
+       <classpathentry kind="lib" path="lib/spring-web-3.0.5.RELEASE.jar"/>
        <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
+       <classpathentry kind="lib" path="/Users/jimp/git/jalview_clean/lib/VARNAv3-9-dev.jar"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
        <classpathentry kind="output" path="classes"/>
 </classpath>
index 57994d7..4c0c7dd 100644 (file)
@@ -15,6 +15,7 @@
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jalview"/>
 <stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="buildindices,"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_project}/build.xml"/>
 <stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
index 8794563..5f4b511 100644 (file)
--- a/.project
+++ b/.project
                                </dictionary>
                        </arguments>
                </buildCommand>
-               <buildCommand>
-                       <name>org.codehaus.groovy.eclipse.groovyBuilder</name>
-                       <arguments>
-                       </arguments>
-               </buildCommand>
        </buildSpec>
        <natures>
+               <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
                <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
                <nature>org.eclipse.jdt.core.javanature</nature>
                <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
                <nature>de.tud.st.ispace.builder.ISpaceNature</nature>
                <nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
-               <nature>org.codehaus.groovy.eclipse.groovyNature</nature>
        </natures>
 </projectDescription>
diff --git a/FEATURETODO b/FEATURETODO
new file mode 100644 (file)
index 0000000..636cb53
--- /dev/null
@@ -0,0 +1,7 @@
+Normalised logo feature todo
+
+* add gui switches in applet for normalised logo display
+* add flags for normalised logo display to AnnotationFile and Jalview Project
+* add preference for application
+* consider rationalising flag model for N types of consensus/logo calculation methods
+
index e777ead..bedd23a 100644 (file)
@@ -18,6 +18,7 @@ httpclient-4.0.3.jar
 httpcore-4.0.1.jar
 httpmime-4.0.3.jar
 jaxrpc.jar
+jdas-1.0.4.jar : Apache License - built from http://code.google.com/p/jdas/ (29th Feb 2012)
 jhall.jar
 jswingreader-0.3.jar : Apache license - built from http://jswingreader.sourceforge.net/ svn/trunk v12
 log4j-1.2.8.jar
@@ -26,6 +27,8 @@ miglayout-4.0-swing.jar       BSD http://www.migcalendar.com/miglayout/versions/4.0/li
 min-jaba-client.jar
 regex.jar
 saaj.jar
+spring-core-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven
+spring-web-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven
 vamsas-client.jar
 wsdl4j.jar
 xercesImpl.jar
index beccd07..6e3a2f2 100755 (executable)
--- a/build.xml
+++ b/build.xml
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5dfa54f..ff9af07 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/doc/JalviewRNASupport.html b/doc/JalviewRNASupport.html
new file mode 100644 (file)
index 0000000..0104d96
--- /dev/null
@@ -0,0 +1,83 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
+-->
+<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>
+
index dfb21a2..e628f0f 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
 <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
index a5fc4a3..025643c 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 4b43977..d694c67 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 5521d00..c03b21d 100644 (file)
@@ -1,7 +1,7 @@
 <html>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
diff --git a/examples/RF00031_folded.stk b/examples/RF00031_folded.stk
new file mode 100644 (file)
index 0000000..e7a76fb
--- /dev/null
@@ -0,0 +1,227 @@
+# STOCKHOLM 1.0
+
+#=GF ID SECIS_1
+#=GF AC RF00031
+#=GF DE Selenocysteine insertion sequence 1
+#=GF AU Griffiths-Jones SR
+#=GF GA 20.0
+#=GF NC 0.0
+#=GF TC 22.6
+#=GF PI SECIS
+#=GF SE Gautheret D, PMID:12458087
+#=GF SS Published; PMID:12458087
+#=GF TP Cis-reg;
+#=GF BM cmbuild  -F CM SEED; cmcalibrate --mpi -s 1 CM
+#=GF BM cmsearch  -Z 169604 -E 1000  --toponly  CM SEQDB
+#=GF DR SO:1001274 SO:SECIS_element
+#=GF DR GO:0001514 GO:selenocysteine incorporation
+#=GF RN [1]
+#=GF RM 8634917
+#=GF RT A novel RNA structural motif in the selenocysteine insertion element
+#=GF RT of eukaryotic selenoprotein mRNAs.
+#=GF RA Walczak R, Westhof E, Carbon P, Krol A;
+#=GF RL RNA 1996;2:367-379.
+#=GF RN [2]
+#=GF RM 12458087
+#=GF RT A survey of metazoan selenocysteine insertion sequences.
+#=GF RA Lambert A, Lescure A, Gautheret D;
+#=GF RL Biochimie 2002;84:953-959.
+#=GF CC The incorporation of selenocysteine into a protein sequence
+#=GF CC is directed by an in-frame UGA codon (usually a stop codon)
+#=GF CC within the coding region of the mRNA.  Selenoprotein mRNAs
+#=GF CC contain a conserved secondary structure in the 3' UTR that
+#=GF CC is required for the distinction of UGA stop from UGA 
+#=GF CC selenocysteine.  The selenocysteine insertion sequence 
+#=GF CC (SECIS) is around 60 nt in length and adopts a hairpin 
+#=GF CC structure which is sufficiently well-defined and conserved
+#=GF CC to act as a computational screen for selenoprotein genes [2].
+#=GF WK http://en.wikipedia.org/wiki/SECIS_element
+#=GF SQ 61
+
+#=GS D.melanogaster.1 AC AY119185.1/838-902
+#=GS D.melanogaster.2 AC AC092237.1/57223-57161
+#=GS D.melanogaster.3 AC AY060611.1/560-627
+#=GS O.niloticus.1    AC Y11109.1/1272-1330
+#=GS O.niloticus.2    AC Y11109.1/927-987
+#=GS O.niloticus.3    AC Y11111.1/1260-1324
+#=GS D.rerio.1        AC AF322071.1/1577-1642
+#=GS X.laevis.1       AC L28111.1/1299-1365
+#=GS G.gallus.1       AC AF125575.1/5781-5843
+#=GS G.gallus.2       AC Y11110.1/1218-1277
+#=GS G.gallus.3       AC Y11273.1/1139-1211
+#=GS M.musculus.1     AC AF195142.1/461-524
+#=GS M.musculus.2     AC AF021345.1/10097-10160
+#=GS M.musculus.3     AC X03920.1/1172-1235
+#=GS M.musculus.4     AC AF096875.1/5504-5568
+#=GS M.musculus.5     AC AF241527.2/359-424
+#=GS M.musculus.6     AC AF136399.1/1808-1868
+#=GS M.musculus.7     AC X84742.1/5239-5302
+#=GS M.musculus.8     AC AF288740.1/1291-1357
+#=GS M.musculus.9     AC AF274027.1/835-900
+#=GS M.musculus.10    AC AB030643.1/4176-4241
+#=GS M.musculus.11    AC AL645723.11/192421-192359
+#=GS M.musculus.12    AC AC002327.1/156204-156268
+#=GS M.musculus.13    AC AF333036.1/2190-2249
+#=GS M.musculus.14    AC U43285.1/2009-2075
+#=GS R.norvegicus.1   AC X57999.1/1526-1586
+#=GS R.norvegicus.2   AC M63574.1/1465-1528
+#=GS R.norvegicus.3   AC AF390544.1/1076-1142
+#=GS R.norvegicus.4   AC AF072865.1/1887-1947
+#=GS R.norvegicus.5   AC X12367.1/703-764
+#=GS R.norvegicus.6   AC U25264.1/366-432
+#=GS R.norvegicus.7   AC L24896.1/600-665
+#=GS H.sapiens.1      AC AF201385.1/3055-3117
+#=GS H.sapiens.2      AC AL049837.4/130674-130738
+#=GS H.sapiens.3      AC U67171.1/375-442
+#=GS H.sapiens.4      AC AF195141.1/689-759
+#=GS H.sapiens.5      AC X53463.1/847-903
+#=GS H.sapiens.6      AC AF093774.1/5851-5916
+#=GS H.sapiens.7      AC X58295.1/1384-1453
+#=GS H.sapiens.8      AC AL833145.1/1479-1545
+#=GS H.sapiens.9      AC S48220.1/1731-1788
+#=GS H.sapiens.10     AC X71973.1/730-791
+#=GS H.sapiens.11     AC AF166127.1/1919-1981
+#=GS H.sapiens.12     AC U43286.1/2054-2120
+#=GS H.sapiens.13     AC BC003127.1/865-928
+#=GS H.sapiens.14     AC S79854.1/1605-1666
+#=GS H.sapiens.15     AC X13710.1/946-1008
+#=GS B.taurus.1       AC D88033.3/5711-5774
+#=GS B.taurus.2       AC D25220.1/1493-1556
+#=GS B.taurus.3       AC AB017534.1/661-726
+#=GS B.taurus.4       AC AB032826.1/1401-1464
+#=GS B.taurus.5       AC AB022283.1/1669-1729
+#=GS B.taurus.6       AC AF053984.1/1951-2017
+#=GS B.taurus.7       AC X13684.1/700-760
+#=GS O.aries.1        AC U67853.1/375-442
+#=GS S.scrofa.1       AC AF380118.1/366-433
+#=GS S.scrofa.2       AC L12743.1/694-758
+#=GS S.scrofa.3       AC AF532927.1/678-740
+#=GS S.scrofa.4       AC X76008.1/2709-2772
+#=GS C.elegans.1      AC U61947.2/4246-4309
+#=GS S.mansoni.1      AC L37762.1/2940-3006
+
+D.melanogaster.1          G.AGCC.CU...AUGAUCGAUGAUUGG.CAAA.UCCUCUC..GAGG..A.......ACCGAUC.G.U.UGAGAA..CCCCU.....UUGCCUU
+#=GR D.melanogaster.1 SS  ................(((((((((((......((((......)))..)........)))))).).).)))......................
+D.melanogaster.2          C.AUUCAACU.UAUGAGGAUUAUUUCU.UAAA.GGCCUCU...GGC..U.......CGGAAAU.A.G.UCUGAA...CCU........UAUUG
+#=GR D.melanogaster.2 SS  ................(((((((((((......((((......)))..)........)))))).).).)))......................
+D.melanogaster.3          G.UGGCGCU..UAUGACGCAGUUGUCU.UAAA.CUCGAAC..UCGA.GC........GGGCAA.U.U.GCUGAU...UACG...AUUAACCAC
+#=GR D.melanogaster.3 SS  (.(((...(....((((((((((((((......((((......))).).........)))))).).).)).).)...)).....)....))))
+O.niloticus.1             G.UUUCUCA...GUGAAGGCUACAGAU.UAAA..CCUCU....GGC...........CUCUGG.A.G.CCAGAU..GCAUU.......GAAAC
+#=GR O.niloticus.1 SS     ......(((...(((..(((((.((..........)).)....)))...........)((((.......))))....)))).......))...
+O.niloticus.2             U.GUUUAUU..AAUGACGGCUACAGAU.UAAA..CCUUU....AGC...........CUCUGG.A.G.CCAGAU..GCAUU......CAAACA
+#=GR O.niloticus.2 SS     ..((((.....((((..(((((.((..........)).)....)))...........)((((.......))))....)))).......)))).
+O.niloticus.3             G.UGUCUCU...GUGAAGUUCGGUUUU.UAAA.AGGGUCA...UCC..A.......GAAAACC.G.ACACUGAU..GUUUC......CGACAC
+#=GR O.niloticus.3 SS     (.((((..........(((((((((((.(......((.......))..........))))))).).).))).................)))))
+D.rerio.1                 A.UGUGGUCUUUAUGAAGGCAGGUGCA.GAAA.CUAUGCA...CUA.GU........GGUGUC.U.G.UCUGAU..GUUUG.......GCCAU
+#=GR D.rerio.1 SS         ...((((((.......(((((((..(.....(.(((........)).)).........)..)).).).))).........).......)))))
+X.laevis.1                G.UGUUUGCA.AAUGACGACCGAUUUU.GAAA.UGGUCUCACGGCC..A.......AAAACUC.GUG.UCCGAC...AUC........AACCC
+#=GR X.laevis.1 SS        .................((((((.(((......(((((....))))..)........))).)).).).)).......................
+G.gallus.1                G.UGUGUUU...AUGAAGAGCACUAAC.AAAA.GAGUAAU.UGACU..C.......AGUUGGU.G.U.UCAGAU..GCU.........CUCAC
+#=GR G.gallus.1 SS        (.((.(..(...((...((((((((((......((((......)))..)........)))))).).).))..))..)...........).)))
+G.gallus.2                U.AUUUGUC...AUGACAGUCACAGCA.UAAA..GCGCA....GAC...........GGCUGU.G.A.CCUGAU..UUUAG......AAAAUA
+#=GR G.gallus.2 SS        ................((((((((((................................))))).).)..))).....................
+G.gallus.3                U.AUUUCUU..UGUGAUGACCGAUUUU.GAAA.UGGGUUU...CUC..UAAUGCCAGGAAAUC.GUG.UCUGAU...GUUG.....UCAAGUA
+#=GR G.gallus.3 SS        ......(((...(..((((((((((((......((((((..........))).))).)))))).).).)).......)).......).)))..
+M.musculus.1              G.UCACCGA...AUGAUCUGCUCUGGU.CAAA.UCCUUCU...AUG..C......CAGCCAGG.G.U.GGUGAU..GACCC.......GUGAC
+#=GR M.musculus.1 SS      (.((((.(....((.(((.((((((((..............................)))))).).).))).)).....)........)))))
+M.musculus.2              G.UUACAUU..AAUGAGAACAGAAACA.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU..AGCUU.......GUAAU
+#=GR M.musculus.2 SS      (.(((((..........(((((((((........(((......)))............))))).).).))..........).......)))))
+M.musculus.3              G.GUUCUUC..CAUGAUGGUGUUUCCUCUAAA..UUUGC....ACG...........GAGAAA.C.A.CCUGAU.UUCCAG.....GAAAAUC
+#=GR M.musculus.3 SS      (.(((.(((..(..((.((((((((.(((................)...........)))))).).).))......))..).....)))))))
+M.musculus.4              G.UGUGCGA...AUGAUAACUACUGAC.GAAA.GAGCUGU.CUGCU..C.......AGUCUGU.G.G.UUGGAU...GUAG......UCACAC
+#=GR M.musculus.4 SS      (.(((((.........(((((((.(((......((((......)))..)........))).)).).).))).........).......)))))
+M.musculus.5              G.CCGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUUA...GAC..C.....UGUGGUCUU.U.C.CUCGAU..GUUCC......UGCGGC
+#=GR M.musculus.5 SS      (.((((..(...((...((((((((((.(.....(((......)))..........))))))).).).))..))..)...........)))))
+M.musculus.6              G.UCAGAUG...AUGAUGGCCUGGGCA.GAAA.CCCCAUG..UGGG..C........CGCCCA.G.G.UUUGAA...CCC........CUGGC
+#=GR M.musculus.6 SS      (.((((...........(((((((((..(.....(((......)))..).........))))).).).))..................)))))
+M.musculus.7              G.UGUCUCU...AUGAAGGAGGGGCCC.GAAG.CCCUUGU...GGG..C........GGGCCU.C.C.CCUGAG...CCCG....UCUGUGGU
+#=GR M.musculus.7 SS      ................(((.(((((((....(.(((.......)))..)........)))))).)...)))..(...(((........).)))
+M.musculus.8              U.UUGCAUU..AAUGAGGAUUACACAG.AAAA.CCUUUGU..UAAG.GA.......CUUGUGU.AGA.UCUGAU..AAUUG.......GCAAA
+#=GR M.musculus.8 SS      ..((((......((.(((.((((((((......((((......))).).........)))))).))..))).))..............)))).
+M.musculus.9              C.CGGCACU..CAUGAAGGUCUGCUUG.AAAA.CCAGCCU..GCUG.GU........GGGGCA.G.U.CCUGAG.GACCUG.......GCGUG
+#=GR M.musculus.9 SS      (.(((..((..((....((.((((((.....(.((((......))).)).........))))).)...))))))...)).).......)....
+M.musculus.10             C.CGGCACU..CAUGAAGGUCUGCCUG.AAAA.CCAGCCU..GCUG.GU........GGGGCA.G.U.CCUGAG.GACCUG.......GCGUG
+#=GR M.musculus.10 SS     (.(((..((..((....((.((((((.....(.((((......))).)).........))))).)...))))))...)).).......)....
+M.musculus.11             U.AUUUGUG..UAUGAUGGUCACAGUG.UAAA..GUUCC....CAC...........AGCUGU.G.A.CUUGAU..UUUUA....AAAAUGUC
+#=GR M.musculus.11 SS     (.((((...........((((((((((.(...............))...........).)))).).).))................)))))..
+M.musculus.12             C.UCAGCAG..GAUGAUGAGAAGGGCU.GAAA.UGCUGCC..AAAC..C.......AGGUCCU.U.U.UCUGAU..GGUGG.......CUGGG
+#=GR M.musculus.12 SS     (.(((((..........((((((((((......((....)..)..............)))))).).).))..........).......)))))
+M.musculus.13             C.AUGCGUC..CAUGAAGUCACUGGCC.UCAA.GCCCAA....GUG.GU........GGGCAG.U.G.ACAGAA...GA.........GCUGC
+#=GR M.musculus.13 SS     (.(((......))))..(((((((.((......(((.........).))........)).))).).).)).......................
+M.musculus.14             C.UCUGAUA...AUGAUGUCUCUCCCU.CUAA.CUCCCAGUAAGGA..C........UGGGAG.A.G.GCUGAACAAACCU.......CAGAG
+#=GR M.musculus.14 SS     (.(((((.........(((.((..(((.(.....(((((((....)..)........)))))).).).)..)))))....).......)))))
+R.norvegicus.1            A.UAUUUGUU.UAUGAUGGUCACAGUG.UAAA..GUUCA....CAC...........AGCUGU.G.A.CUUGAU..UUUUA.......AAAAU
+#=GR R.norvegicus.1 SS    ....((((.........((((((((((.(...............))...........).)))).).).)).........)).......))...
+R.norvegicus.2            G.UUACAUU..GAUGAGAACAGAAACA.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU..AGCUC.......GUAAU
+#=GR R.norvegicus.2 SS    ............((((((((((((((........(((......)))............))))).).).))........))).......))...
+R.norvegicus.3            U.UUGCAUU..AAUGAGGAUUACACAG.AAAA.CCUUUGU..UAAGGGU........UUGUGUCG.A.UCUGCU..AAUUG.......GCAAA
+#=GR R.norvegicus.3 SS    ..((((..........(((((((((((.(....((((......)))).)........)))))).).).))).................)))).
+R.norvegicus.4            G.UCAGAUG...AUGACGGCCUGUGCA.GAAA.CCCCCAC.GUGGG..C........UGC.CA.G.G.UUUGAA...CCC........CUGGC
+#=GR R.norvegicus.4 SS    (.(((........)))).(((..((...(.......)..).)..))..).........((.((.(.(............)........)))))
+R.norvegicus.5            G.UUUUUCC...AUGACGGUGUUUCCUCUAAA..UUUAC....AUG...........GAGAAA.C.A.CCUGAU.UUCCAG......AAAAAU
+#=GR R.norvegicus.5 SS    (.((((((......(((((((((((.((((..............))...........)))))).).).)).).).)....)......))))))
+R.norvegicus.6            G.CCGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUCA.AAGAC..C.....UGUGGUCUU.U.C.UUCGAU..GUUCU.......GCGGC
+#=GR R.norvegicus.6 SS    (.((((..(...((((..(((((((((.(.....(((......)))..........))))))).).).))).))..)...........)))))
+R.norvegicus.7            C.CGGCACU..CAUGACGGUCUGCCUG.AAAA.CCAGCCC..GCUG.GU........GGGGCA.G.U.CCCGAG.GACCUG.......GCGUG
+#=GR R.norvegicus.7 SS    (.(((..((..(.....((.((((((.....(.((((......))).)).........))))).)...)).)))...)).).......)....
+H.sapiens.1               G.CCAGAUG...AUGACGACCUGGGUG.GAAA.CCUACCC.UGUGG..G........CACCCA.U.G.UCCGAG...CCCC.......CUGGC
+#=GR H.sapiens.1 SS       (.((((...........(((.((((((......(((((....))))..)........))))))...).))..................)))))
+H.sapiens.2               G.UGUGCGG...AUGAUAACUACUGAC.GAAA.GAGUCAU.CGACU..C.......AGUUAGU.G.G.UUGGAU...GUAG......UCACAU
+#=GR H.sapiens.2 SS       (.(((((.........(((((((((((......(((((....))))..)........)))))).).).))).........).......)))))
+H.sapiens.3               G.ACGCUUC...AUGAUAGGAAGGACU.GAAA.AGUCUUG.UGGAC..A.....CCUGGUCUU.U.C.CCUGAU..GUUCU......CGUGGC
+#=GR H.sapiens.3 SS       ..(((...(...((.(..(((((((((.......(((......)))...........)))))).).).).).))..)..........)))...
+H.sapiens.4               G.ACUGACAU.UAUGAAGGCCUGUACU.GAAG.ACAGCAA..GCUG..U.......UAGUACA.G.A.CCAGAU..GCUUU..CUUGGCAGGC
+#=GR H.sapiens.4 SS       ...(((.((.....(((((((((((((....(.((((......)))..).......))))))).)...........)))))..).)).)))..
+H.sapiens.5               U.UCACAGA...AUGAUGGCACCUUCC.UAA...ACCCU....CAU...........GGGUGG.U.G.UCUGAG..AGGC........GUGAA
+#=GR H.sapiens.5 SS       ..((((...........((((((...........((((...................)))))).).).))..................)))).
+H.sapiens.6               G.UGUGCGG...AUGAUAACUACUGAC.GAAAGAGUCAUC...GAC..C.....UCAGUUAGU.G.G.UUGGAU...GUAG......UCACAU
+#=GR H.sapiens.6 SS       (.(((((.........(((((((((((....((.(((......)))..).....)..)))))).).).))).........).......)))))
+H.sapiens.7               U.GGCGUCUU.CAUGAGGGAGGGGCCC..AAA.GCCCUUG..UGGG..C........GGACCU.C.C.CCUGAG...CCUGUCUGAGGGGCCA
+#=GR H.sapiens.7 SS       ..(((.((((.((...((((((((.........((((......)))..)...............).).)))......)))...))))))))).
+H.sapiens.8               U.UUGCUUU..AAUGAGAAUAGAAACG.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU.AAUUAG.....CAGUUUA
+#=GR H.sapiens.8 SS       ..(((((..........(((((((((........(((......)))............))))).).).)).........)).....)))....
+H.sapiens.9               U.AUUUGUU..UAUGAUGGCCACAGCC.UAAA..GUACA....CAC...........GGCUGU.G.A.CUUGAU...UCA........AAAGA
+#=GR H.sapiens.9 SS       .............(((.((.(((((((..............................)))))).)...)).......))).............
+H.sapiens.10              C.CGGCACU..CAUGACGGCCUGCCUG.CAAA..CCUGC....UGG..U........GGGGCA.G.A.CCCGAA.AAUCCA.......GCGUG
+#=GR H.sapiens.10 SS      ...((((....(......)..))))............((....(((..(........(((........))))......))).......))...
+H.sapiens.11              G.CCGGAUG...AUGACGACCUGGGUG.GAAA.CCUACCC.UGUGG..G........CACCCA.U.G.UCCGAG...CCCC.......CUGGC
+#=GR H.sapiens.11 SS      (.((((...........(((.((((((......(((((....))))..)........))))))...).))..................)))))
+H.sapiens.12              C.UCUGUUA...AUGACGUCUCUCCCUCUAAA.CCCCAUU.AAGGA..C........UGGGAG.A.G.GCAGAGCAAGCCU.......CAGAG
+#=GR H.sapiens.12 SS      (.((((.......((..(((((((((.......((........)).............))))).).).))....))............)))))
+H.sapiens.13              G.UCACUGC...AUGAUCCGCUCUGGU.CAAA.CCCUUCC...AGG..C......CAGCCAGA.G.U.GGGGAU..GGUCU.......GUGAC
+#=GR H.sapiens.13 SS      (.((((.((.......(((((((((((......((.........))...........)))))).).).)))......)).........)))))
+H.sapiens.14              C.ACUGCUG...AUGACGAACUAUCUC.UAAC.UGGUCUU..GACC..A.......CGAGCUA.G.U.UCUGAA...UU.G.......CAGGG
+#=GR H.sapiens.14 SS      ...((((.(...((...((((((.(((......((((......)))..)........))).)).).).))...)...)).).......)))..
+H.sapiens.15              U.UUUCAUC..UAUGAGGGUGUUUCCUCUAAA..CCUACG...AGG...........GAGGAA.C.A.CCUGAU...CUUA.....CAGAAAA
+#=GR H.sapiens.15 SS      .......((..(.((((((((((.(((((................)...........)))))).).).)).......))))......)))...
+B.taurus.1                C.UUGCGUU..AAUGAGAACAGAAACG.UAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAAC
+#=GR B.taurus.1 SS        ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.2                C.UUGCGUU..AAUGAGAACAGAAACG.AAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAAC
+#=GR B.taurus.2 SS        ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.3                C.CCGGUGCC.UAUGACGGUCUGUCUG.AAAA.CCAGCCC...CUG.GU........GGGGCA.G.A.CCUGAG.AACCUG.......GCGUG
+#=GR B.taurus.3 SS        (.(.(((..(.(.....(((((((((.....(.((((......))).)).........))))).).).))..))..))).).......)....
+B.taurus.4                ACUUGCGUU..AAUGAGAACAGAAACG.UAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAA.
+#=GR B.taurus.4 SS        ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.5                G.CCAGAUG...AUGAGGACCUGUGCG.GAAA.CCCCCCG..CGGG..C........UGCCCA.U.G.UCUGAG...CCC........CUGGC
+#=GR B.taurus.5 SS        (.((((((....(((.((.((((((.(.(.......))))..)))).............)))).).).)))).)...)...............
+B.taurus.6                G.AUGCGUC..CAUGAAGUCACCAGCC.CCAA.GCCCCUC...GUG.GU........GGGUGG.U.G.AUGGAA.CCGUCA.....AAGCAGU
+#=GR B.taurus.6 SS        (.(((..((..((.....((((((.((.(((.............)).).........)).))).).).)))))...)))).............
+B.taurus.7                U.UUUGCCC...AUGAAGGUGUUCCCUCUAAA..CCUAC....GUG...........GAGGAA.U.G.CCUGAU.GUCCAG.......GAAAA
+#=GR B.taurus.7 SS        (.((((..(...((..(((((((((.((((..............))...........)))))).).).))).)).)..))).......))...
+O.aries.1                 G.ACGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUCU.UGGAC.GC......CUGGUCCU.U.C.CUUGAU..GUUCU......CACGGC
+#=GR O.aries.1 SS         (.(.((.((...(....((((((((((.(....((((......))).)........))))))).).).)))))...))..)......).....
+S.scrofa.1                G.ACGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUUG.UGGAC.GC......CUGGUCCU.U.C.CCUGAU..GUUCU......CAUGGC
+#=GR S.scrofa.1 SS        .......((...(((((((((((((((.(....((((......))).)........))))))).)...))))........)......))))).
+S.scrofa.2                C.UGGCACC..CAUGACAGUCUGCCUA.AAAA.CCAGCCC...CUG.GU........GGGGCA.G.A.CUCGAG.AACCUG.......GCGUG
+#=GR S.scrofa.2 SS        .....((((..((.(.((((((((((.....(.((((......))).)).........))))).).).)).).....).)).......).)))
+S.scrofa.3                A.UUUUAUC..CAUGAAAGUGUUUCCUCUAAA..CCUAU....GUG...........GAGGAA.C.A.CCUGAU.GUCCAG......GAAAAU
+#=GR S.scrofa.3 SS        ...........(((....))).((((((((..............))...........)))))).....((((......)))......).....
+S.scrofa.4                C.UGGCACC..CAUGACAGUCUGCCUA.AAAA.CCAGCC....CUG.GU........GGGGCA.G.A.CUCGAG.AACCUG.......GCGUG
+#=GR S.scrofa.4 SS        .....((((..((.(.((((((((((.....(.(((........)).)).........))))).).).)).).....).)).......).)))
+C.elegans.1               G.AGGCAGCUUUGUGACGACCUUUGGC.UAAA.CUCCAUC..GUGA.GC........GCCUCU.G.G.UCUGAU...GC.........GCCUC
+#=GR C.elegans.1 SS       (.((((.((...((.(.((((...(((......(((........)).).........)))....).).))).))...)).........)))))
+S.mansoni.1               C.UCGCUAU...AUGACGAUGGCAAUC.UCAA..AUGUU....CAU..U........GGUUGC.C.A.UUUGAU..GAAAUCAGUUUUGUGUG
+#=GR S.mansoni.1 SS       ...(((.((...(.(((((((((((((..............................)))))).).).)).............))).))))))
+#=GC SS_cons              <-<<<<-----------<<<<<<<<<<-------<<<______>>>----------->>>>>>->->->>------------------>>>>>
+#=GC RF                   g.ucucauu..uAUGAuGgccucuccc.uAAA.ucccuuu...ggg..c........gggaga.g.g.cCuGAU..gcuug.......gagac
+//
index 3cc5403..39cd9fb 100644 (file)
@@ -1,7 +1,145 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->\r<head>\r<!-- InstanceBeginEditable name="doctitle" -->
-<TITLE>Applet Parameters</TITLE>
-<!-- InstanceEndEditable --> \r<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">\r<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> \r<style type="text/css">\r<!--\rtd {\r     font-family: Geneva, Arial, Helvetica, sans-serif;\r     font-size: 12px;\r}\r.plain {\r    font-family: Verdana, Arial, Helvetica, sans-serif;\r    font-size: 14px;\r       text-decoration: none;\r}\r.plain:hover{\r background-color:#000000; color: #F2F2FF;\r}\r \r-->\r</style>\r\r<script language="JavaScript">\rfunction genHref()\r{\rvar s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";\rfor(i=0; i<8; i++)\r{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i);   }\rwindow.location=href;\r}\rfunction getEventTarget(e)\r{\rif(!e)\re = window.event;\rif(e.target)\rreturn e.target;\rreturn e.srcElement;\r}\r\r</script>\r</head>\r\r<body alink="#000000" vlink="#000000" link="#000000">\r<script type="text/javascript">\rvar gaJsHost = (("https:" == document.location.protocol) ? \r"https://ssl." : "http://www.");\rdocument.write(unescape("%3Cscript src='" + gaJsHost + \r"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r</script>\r<script type="text/javascript">\rtry{\rvar pageTracker = _gat._getTracker("UA-9060947-1");\rpageTracker._trackPageview();\r} catch(err) {}\r</script>\r<div align="left"> \r  <table width="805" height="100" cellpadding="5">\r    <tr>\r      <td background="../jalview.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>\r    </tr>\r  </table>\r  <table width="805" border="0" cellpadding="5" cellspacing="5">\r    <tr> \r      <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> \r       \r       <div align="center">\r          <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">\r            <tr> \r              <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="applets.html" class="plain">Applet \r                Version</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>\r            </tr>\r            <tr>\r              <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release \r                history</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source \r                Code</a></td>\r            </tr>\r                   <tr> \r              <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>\r            </tr>\r                   <tr> \r              <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>\r            </tr>\r            <tr> \r              <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News \r                Mailing List</a></td>\r            </tr>\r            <tr>\r              <td align="left" valign="middle"><a\r            href="http://www.jalview.org/mailman/listinfo/jalview-discuss"\r            class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and\r            bug reports to the discussion list.</em></td>\r            </tr>\r            <tr></tr>\r            <tr>\r              <!--<td align="left" valign="middle"><br>\r                Please send problems<br>and\r            bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->\r            </tr>\r          </table>\r\r        </div>\r\r        <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>\r          <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> \r        </div>\r        </td>\r      <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" --> 
-        <p>\r                                           <strong>Quick Links:<ul><li>Download the applet jar file from <a\r                                                       href="jalviewApplet.jar">here</a>\r                                              </li>\r                                          <li>Parameters are described <a href="#parameters">below</a></li>\r                                              <li>The javascript API is described <a\r                                                         href="jalviewLiteJs.html">here</a></li>\r                                                </ul></strong>\r                                 </p>\r                                   
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->\r
+<TITLE>Applet Parameters</TITLE>\r
+<!-- InstanceEndEditable --> 
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
+<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> 
+<style type="text/css">
+<!--
+td {
+       font-family: Geneva, Arial, Helvetica, sans-serif;
+       font-size: 12px;
+}
+.plain {
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 14px;
+       text-decoration: none;
+}
+.plain:hover{
+       background-color:#000000; color: #F2F2FF;
+}
+-->
+</style>
+
+<script language="JavaScript">
+function genHref()
+{
+var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
+for(i=0; i<8; i++)
+{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i);     }
+window.location=href;
+}
+function getEventTarget(e)
+{
+if(!e)
+e = window.event;
+if(e.target)
+return e.target;
+return e.srcElement;
+}
+
+</script>
+</head>
+
+<body alink="#000000" vlink="#000000" link="#000000">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ? 
+"https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost + 
+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-9060947-1");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+<div align="left"> 
+  <table width="805" height="100" cellpadding="5">
+    <tr>
+      <td background="../jalview.gif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
+    </tr>
+  </table>
+  <table width="805" border="0" cellpadding="5" cellspacing="5">
+    <tr> 
+      <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> 
+         
+         <div align="center">
+          <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
+            <tr> 
+              <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="applets.html" class="plain">Applet 
+                Version</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
+            </tr>
+            <tr>
+              <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release 
+                history</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source 
+                Code</a></td>
+            </tr>
+                       <tr> 
+              <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
+            </tr>
+                       <tr> 
+              <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
+            </tr>
+            <tr> 
+              <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News 
+                Mailing List</a></td>
+            </tr>
+            <tr>
+              <td align="left" valign="middle"><a
+            href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
+            class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
+            bug reports to the discussion list.</em></td>
+            </tr>
+            <tr></tr>
+            <tr>
+              <!--<td align="left" valign="middle"><br>
+                Please send problems<br>and
+            bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
+            </tr>
+          </table>
+
+        </div>
+
+        <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
+          <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> 
+        </div>
+        </td>
+      <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" --> \r
+        <p>
+                                               <strong>Quick Links:<ul><li>Download the applet jar file from <a
+                                                       href="jalviewApplet.jar">here</a>
+                                               </li>
+                                               <li>Parameters are described <a href="#parameters">below</a></li>
+                                               <li>The javascript API is described <a
+                                                               href="jalviewLiteJs.html">here</a></li>
+                                               </ul></strong>
+                                       </p>
+                                       
         <h3 align="left">Useful to know!!</h3>
         <ul>
           <li>Package all your data files into a single (or multiple) zip / jar 
             </font></li>
           <li> Use Jalview for input to a HTML form. For an example of how to 
             code this using Javascript, click <a href="formComplete.html">here</a>. 
-            <br>
-          </li>
+            <br>\r
+          </li>\r
           <li>Embed Jalview into the web page, without the &quot;Start Jalview&quot; 
             button by setting the embed parameter to true;<br>
             &lt;param name=&quot;embedded&quot;
           value=&quot;true&quot;&gt; </li>
-        </ul>\r        <p><strong><font size="2">** NEW FEATURES ** in Jalview 2.7.1</font></strong></p>\r        <ul><li><font size="2">Jmol compatibility updated to Jmol 12.2.x series - <a href="JmolApplet-12.2.4.jar">download the JmolApplet here</a></font></li>\r<li>To use Jmol as the structure viewer for Jalview, you must include \r            the jar file in the applet archive argument thus:<br>\r            <pre>archive=&quot;jalviewApplet.jar,Jmol-12.2.4.jar&quot;</pre></font>\r          </li>\r          <li>Jmol 12.2.x requires at least Java 1.6 to run in the clients web browser. If the client does not have \r            Java 1.6, or if the Jmol-12.2.jar is not added to the archive, the \r            original Jalview structure viewer will still be available. <br>\r          </li>\r          \r        </ul>\r        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7</font></strong></p>\r        <ul>\r        <li><font size="2">Javascript callbacks capabilities<ul><li>oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.</li>\r        <li>To use javascript callbacks, ensure the applet tag includes the '<a href="http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html">mayscript</a>' attribute - either as a parameter (&lt;param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).</li></ul></font>\r        </li>\r        <li><font size="2">New <a href="jalviewLiteJs.html">jalviewLite java api</a> methods for selecting, highlighting, scrolling and reordering sequences in an alignment view.\r        </font></li></ul>\r        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.6</font></strong></p>\r        <ul>\r        <li><font size="2">Jmol compatibility updated to Jmol 12.1.x series</font></li>\r          <li>Jalview 2.6 works only with Jmol version 12.1.13 or later. You can use the JmolApplet.jar from \r          the Jmol binary distribution available at the Jmol Sourceforge site, \r          or <a href="JmolApplet-12.1.13.jar">download the Jmol applet from here</a></li>\r          <li><font size="2">Minimum recommended version of Java runtime for the applet is now 1.5 (JalviewLite v2.6 without the Jmol viewer may work ok on earlier Java environments but compatibility can no-longer be guaranteed).</font></li>\r          </ul>
-        <br><strong><font size="2">**NEW FEATURES** in Jalview 2.5</font></strong></p>\r        <ul>\r        <li><font size="2">New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</font></li>\r         </ul>        \r        <br><strong><font size="2">**NEW FEATURES** in Jalview 2.4</font></strong></p>
+        </ul>
+        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.8</font></strong></p>
+        <ul>
+        <li><font size="2">Normalised sequence logo display
+        </font></li>
+        <li><font size="2">RNA secondary structure annotation row
+        </font></li>
+        </ul>
+        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7.1</font></strong></p>
+        <ul>
+<li><font size="2">Jmol compatibility updated to Jmol 12.2.x series - <a href="JmolApplet-12.2.4.jar">download the JmolApplet here</a></font></li>
+<li>To use Jmol as the structure viewer for Jalview, you must include 
+            the jar file in the applet archive argument thus:<br>
+            <pre>archive=&quot;jalviewApplet.jar,Jmol-12.2.4.jar&quot;</pre></font>
+          </li>
+          <li>Jmol 12.2.x requires at least Java 1.6 to run in the clients web browser. If the client does not have 
+            Java 1.6, or if the Jmol-12.2.jar is not added to the archive, the 
+            original Jalview structure viewer will still be available. <br>
+          </li>
+          
+        </ul>
+        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7</font></strong></p>
+        <ul>
+        <li><font size="2">Javascript callbacks capabilities<ul><li>oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.</li>
+        <li>To use javascript callbacks, ensure the applet tag includes the '<a href="http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html">mayscript</a>' attribute - either as a parameter (&lt;param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).</li></ul></font>
+        </li>
+        <li><font size="2">New <a href="jalviewLiteJs.html">jalviewLite java api</a> methods for selecting, highlighting, scrolling and reordering sequences in an alignment view.
+        </font></li></ul>
+        <p><strong><font size="2">**NEW FEATURES** in Jalview 2.6</font></strong></p>
+        <ul>
+        <li><font size="2">Jmol compatibility updated to Jmol 12.1.x series</font></li>
+          <li>Jalview 2.6 works only with Jmol version 12.1.13 or later. You can use the JmolApplet.jar from 
+          the Jmol binary distribution available at the Jmol Sourceforge site, 
+          or <a href="JmolApplet-12.1.13.jar">download the Jmol applet from here</a></li>
+          <li><font size="2">Minimum recommended version of Java runtime for the applet is now 1.5 (JalviewLite v2.6 without the Jmol viewer may work ok on earlier Java environments but compatibility can no-longer be guaranteed).</font></li>
+               </ul>
+        <br><strong><font size="2">**NEW FEATURES** in Jalview 2.5</font></strong></p>
+        <ul>
+        <li><font size="2">New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</font></li>
+               </ul>        
+        <br><strong><font size="2">**NEW FEATURES** in Jalview 2.4</font></strong></p>
         <ul>
         <li><font size="2">New applet API methods for feature display control, views, and obtaining current selection via javascript.</font></li>
           <li><font size="2">Group show and hide parameters:
             <font size="2">&lt;param name=&quot;PDBFile3&quot; value=&quot;Third.pdb 
             D=SeqX B=SeqY C=SeqZ&quot;&gt; </font> <br>
           </li>
-          <li>Note parameter &quot;PDBSeq&quot; is no longer required.<br>
+          <li>Note parameter &quot;PDBSeq&quot; is no longer required.<br>\r
           </li>
           <li>Jalview 2.3 was updated to work with Jmol 11. See the <a href="../versions.html">versions archive if you want to download the old Jmol applet</a>.</li> 
             <p>&nbsp;</p>
             <font face="Courier New, Courier, mono">&lt;param name=&quot;userDefinedColour&quot; 
             value=&quot;D,E=red; K,R,H=0022FF; C=yellow&quot;&gt;</font><br>
           </li>
-          <li>Param <font face="Courier New, Courier, mono">showFeatureSettings</font> 
+          <li>Param <font face="Courier New, Courier, mono">showFeatureSettings</font>
             - this will display the feature settings window when the applet starts.<br>
           </li>
           <li>Param <font face="Courier New, Courier, mono">Application_URL value=&quot;http://www.jalview.org/services/launchApp&quot;<br>
           <tr><td>showbutton</td>
           <td>true</td>
           <td>Show the jalview button on the page. When false, JalviewLite will open immediately.</td>
-          </tr>\r          </tr>\r                 <tr><td>sortByTree</td>\r                <td>true or false (default is false)</td>\r              <td>automatically sort the associated alignment view by the tree when a new tree is opened.</td>\r               </tr>\r                  <tr>\r            <td>showTreeBootstraps</td><td>true or false (default is true)</td><td>show or hide branch bootstraps</td>\r                  </tr>\r  <tr><td>showTreeDistances</td><td>true or false (default is true)</td><td>show or hide branch lengths</td></tr>\r        <tr><td>showUnlinkedTreeNodes</td><td>true or false (default is false)</td><td>indicate if unassociated nodes should be highlighted in the tree view</td>\r      </tr>\r          <tr><td>heightScale</td>\r          <td>1.0 or greater</td>\r          <td>Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r          </tr>
-          <tr><td>widthScale</td>\r          <td>1.0 or greater</td>\r          <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r          </tr>\r          <tr><td>centrecolumnlabels</td>\r          <td>true of false (default is false)</td>\r          <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>\r          <tr><td>showUnconserved</td>\r          <td>true of false (default is false)</td>\r          <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>\r          </tr>\r          <tr><td>upperCase</td>\r          <td><em>bold</em> or other value</td>\r          <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>\r          </tr>\r          <tr><td>automaticScrolling</td>\r          <td>true of false (default is true)</td>\r          <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>\r          </tr>\r          \r          <tr><td>showGroupConsensus</td>\r          <td>true of false (default is false)</td>\r          <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r          </tr>\r          \r          <tr><td>showGroupConservation</td>\r          <td>true of false (default is false)</td>\r          <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>showConsensusHistogram</td>\r          <td>true of false (default is true)</td>\r          <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>showSequenceLogo</td>\r          <td>true of false (default is false)</td>\r          <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>oninit</td>\r          <td><em>after_init()</em></td>\r          <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>relaxedidmatch</td>\r          <td><em>true or false (default is false)</em></td>\r          <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>alignpdbfiles</td>\r          <td><em>true or false (default is false)</em></td>\r          <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>externalstructureviewer</td>\r          <td><em>true or false (default is false)</em></td>\r          <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>\r          \r          </tr>\r          <tr><td>annotationcolour_max</td>\r          <td>colour name or RGB hex triplet (default is red)</td>\r          <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>annotationcolour_min</td>\r          <td>colour name or RGB hex triplet (default is orange)</td>\r          <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>jalviewhelpurl</td>\r          <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>\r          <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>\r          </tr>\r          <tr><td>resolvetocodebase</td>\r          <td>True or False (False)</td>\r          <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>\r          </tr>\r          \r                  </table>
+          </tr>
+          </tr>
+                 <tr><td>sortByTree</td>
+                 <td>true or false (default is false)</td>
+                 <td>automatically sort the associated alignment view by the tree when a new tree is opened.</td>
+                 </tr>
+                 <tr>
+                  <td>showTreeBootstraps</td><td>true or false (default is true)</td><td>show or hide branch bootstraps</td>
+                       </tr>
+       <tr><td>showTreeDistances</td><td>true or false (default is true)</td><td>show or hide branch lengths</td></tr>
+       <tr><td>showUnlinkedTreeNodes</td><td>true or false (default is false)</td><td>indicate if unassociated nodes should be highlighted in the tree view</td>
+       </tr>
+          <tr><td>heightScale</td>
+          <td>1.0 or greater</td>
+          <td>Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (<em>since 2.5.1</em>)</td>
+          </tr>
+          <tr><td>widthScale</td>
+          <td>1.0 or greater</td>
+          <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>
+          </tr>
+          <tr><td>centrecolumnlabels</td>
+          <td>true of false (default is false)</td>
+          <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>
+          <tr><td>showUnconserved</td>
+          <td>true of false (default is false)</td>
+          <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>
+          </tr>
+          <tr><td>upperCase</td>
+          <td><em>bold</em> or other value</td>
+          <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>
+          </tr>
+          <tr><td>automaticScrolling</td>
+          <td>true of false (default is true)</td>
+          <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>
+          </tr>
+          
+          <tr><td>showGroupConsensus</td>
+          <td>true of false (default is false)</td>
+          <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>
+          </tr>
+          
+          <tr><td>showGroupConservation</td>
+          <td>true of false (default is false)</td>
+          <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>showConsensusHistogram</td>
+          <td>true of false (default is true)</td>
+          <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>showSequenceLogo</td>
+          <td>true of false (default is false)</td>
+          <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>normaliseLogo</td>
+          <td>true of false (default is false)</td>
+          <td>When true, all sequence logos will be normalised (all symbol stacks add up to full height of annotation row), rather than being scaled according to the fraction of symbols identical to the consensus. (<em>since 2.7.1</em>)</td>
+          </tr>
+          <tr><td>oninit</td>
+          <td><em>after_init()</em></td>
+          <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>relaxedidmatch</td>
+          <td><em>true or false (default is false)</em></td>
+          <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>alignpdbfiles</td>
+          <td><em>true or false (default is false)</em></td>
+          <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>externalstructureviewer</td>
+          <td><em>true or false (default is false)</em></td>
+          <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>
+          
+          </tr>
+          <tr><td>annotationcolour_max</td>
+          <td>colour name or RGB hex triplet (default is red)</td>
+          <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>annotationcolour_min</td>
+          <td>colour name or RGB hex triplet (default is orange)</td>
+          <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>jalviewhelpurl</td>
+          <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>
+          <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>resolvetocodebase</td>
+          <td>True or False (False)</td>
+          <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>
+          </tr>
+          <tr><td>scoreFile</td>
+          <td>file</td>
+          <td>Multiple sequences aligment scores file. Currently is supported only the T-Coffee score_ascii file format</td>
+          </tr>
+                  </table>
         <p align="center">&nbsp;</p>
-        <!-- InstanceEndEditable --></td>\r    </tr>\r  </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
+        <!-- InstanceEndEditable --></td>
+    </tr>
+  </table>
+</div>
+</body>
+<!-- InstanceEnd --></html>
index e3c71ba..1086416 100755 (executable)
                 </table></td>
             </tr>
           </table>
-          <p>&nbsp;</p>
-          <table width="300" border="1" cellspacing="0" cellpadding="0">
-            <tr>
-              <td><table width="300" border="0" cellspacing="0" cellpadding="0">
-                  <tr>
-                    <td width="100"> <applet code="jalview.bin.JalviewLite"
-                               width="140" height="35"
-                               archive="jalviewApplet.jar">
-                        <param name="file" value="jpred_msa.fasta">
-                        <param name="jnetfile" value="jpred_msa.seq.concise">
-                        <param name="defaultColour" value="Clustal">
-                        <param name="showAnnotation" value="true">
-                        <param name="windowHeight" value="515">
-                        <param name="windowWidth" value="650">
-                        <param name="showConservation" value="false">
-                        <param name="showQuality" value="false">
-                        <param name="showConsensus" value="false">
-                        <param name="showFullId" value="false">
-                        <param name="RGB"  value="F2F2FF">
-                        <param name="linkLabel_1" value="SRS">
-                        <param name="linkUrl_1" value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
-                        <param name="linkLabel_2" value="Uniprot">
-                        <param name="linkUrl_2" value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
-                        <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">
-                      </applet> </td>
-                    <td width="165">Displays a Multiple Sequence Alignment Based
-                      JNet Prediction for a Sequence</td>
-                  </tr>
-                </table></td>
-            </tr>
-          </table>\r        </div>\r        <p>&nbsp;</p>\r          <p>For more JalviewLite examples, follow the links below.\r          <ul>\r          <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>\r          <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r          <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>\r          <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r          </ul>
+          <p>&nbsp;</p>\r                                               <table width="300" border="1" cellspacing="0" cellpadding="0">\r                                                 <tr>\r                                                           <td><table width="300" border="0" cellspacing="0"\r                                                                              cellpadding="0">\r                                                                               <tr>\r                                                                                   <td width="100"><applet code="jalview.bin.JalviewLite"\r                                                                                                 width="140" height="35" archive="jalviewApplet.jar">\r                                                                                                   <param name="file" value="jpred_msa.fasta">\r                                                                                                    <param name="jnetfile" value="jpred_msa.seq.concise">\r                                                                                                  <param name="defaultColour" value="Clustal">\r                                                                                                   <param name="showAnnotation" value="true">\r                                                                                                     <param name="windowHeight" value="515">\r                                                                                                        <param name="windowWidth" value="650">\r                                                                                                 <param name="showConservation" value="false">\r                                                                                                  <param name="showQuality" value="false">\r                                                                                                       <param name="showConsensus" value="false">\r                                                                                                     <param name="showFullId" value="false">\r                                                                                                        <param name="RGB" value="F2F2FF">\r                                                                                                      <param name="linkLabel_1" value="SRS">\r                                                                                                 <param name="linkUrl_1"\r                                                                                                                value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">\r                                                                                                       <param name="linkLabel_2" value="Uniprot">\r                                                                                                     <param name="linkUrl_2"\r                                                                                                                value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">\r                                                                                                        <param name="APPLICATION_URL"\r                                                                                                          value="http://www.jalview.org/services/launchApp">\r                                                                                             </applet></td>\r                                                                                 <td width="165">Displays a Multiple Sequence Alignment\r                                                                                         Based JNet Prediction for a Sequence</td>\r                                                                              </tr>\r                                                                  </table></td>\r                                                  </tr>\r                                          </table>\r                                               <p>&nbsp;</p>\r                                          <table width="300" border="1" cellspacing="0" cellpadding="0">\r            <tr>\r              <td><table width="300" border="0" cellspacing="0" cellpadding="0">\r                  <tr>\r                    <td width="100"> <applet code="jalview.bin.JalviewLite"\r                            width="140" height="35"\r                                archive="jalviewApplet.jar">\r                        <param name="file" value="RF00031_folded.stk">\r                        <param name="defaultColour" value="Purine/Pyrimidine">\r                        <param name="showAnnotation" value="true">\r                        <param name="windowHeight" value="515">\r                        <param name="windowWidth" value="650">\r                        <param name="showConservation" value="false">\r                        <param name="showQuality" value="false">\r                        <param name="showConsensus" value="true">\r                        <param name="showFullId" value="false">\r                        <param name="RGB"  value="F2F2FF">\r                        <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">\r                      </applet> </td>\r                    <td width="165">Displays an RFAM RNA fold family with secondary structure annotation</td>\r                  </tr>\r                </table></td>\r            </tr>\r          </table>\r        </div>\r        <p>&nbsp;</p>\r          <p>For more JalviewLite examples, follow the links below.\r          <ul>\r          <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>\r          <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r          <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>\r          <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r          </ul>
         <!-- InstanceEndEditable --></td>\r    </tr>\r  </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
index 261d6d0..91ef827 100755 (executable)
@@ -29,6 +29,7 @@
    <mapID target="viewingpdbs" url="html/features/viewingpdbs.html"/>
    <mapID target="pdbmcviewer" url="html/features/pdbviewer.html"/>
    <mapID target="pdbjmol" url="html/features/jmol.html"/>
+   <mapID target="varna" url="html/features/varna.html"/>
    <mapID target="preferences" url="html/features/preferences.html"/>     
    <mapID target="commandline" url="html/features/commandline.html"/>
    <mapID target="clarguments" url="html/features/clarguments.html"/>
    <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.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"/>
    <mapID target="alMenu" url="html/menus/alignmentMenu.html"/>
index 926a710..9406292 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
 <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 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="Editing Alignments" target ="edit"/>        
     <tocitem text="Cursor Mode" target="cursor"/>
        <tocitem text="Multiple Views" target="multipleviews"/>
        <tocitem text="Viewing Trees" target="treeviewer" expand="false"/>
        <tocitem text="Fetching Sequences" target="seqfetch"/>
+       <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="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="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="Remove Redundancy" target="redundancy"/>
        </tocitem>
        <tocitem text="Alignment Annotations" target ="alannotation" expand="false">
-          <tocitem text="Conservation" target="calcs.alconserv"/>
+          <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>
        <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="Viewing RNA structures" target="varna" expand="false">   </tocitem>
        <tocitem text="VAMSAS Data Exchange" target="vamsas">
                <!-- what can Jalview share with other apps -->
                <!-- what other apps exist -->
index 5a962a4..71bd90f 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
 <p>Select the <strong>&quot;Copy Consensus Sequence&quot;</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 it's size in the logo. The tooltip of a column gives the
+exact numbers for all occuring residues.
 </p>
 </body>
 </html>
index ebba3ab..bd4a625 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -28,14 +28,21 @@ is based on the one used in
   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><em>Colouring an alignment by conservation</em><br>
+       <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>.
index 795450b..7fdaedf 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9ae9e50..b042dd8 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4846acc..e83a124 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c09acbc..87fb24b 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4ded83c..403535b 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d7cb9d1..262b2b0 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/help/html/calculations/structureconsensus.html b/help/html/calculations/structureconsensus.html
new file mode 100755 (executable)
index 0000000..d945919
--- /dev/null
@@ -0,0 +1,44 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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>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
+&quot;StrConsensus&quot; 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 it's size in the logo. The tool tip of a column gives the
+exact numbers for all occurring valid base pairs.
+</p>
+</body>
+</html>
index 1579043..9460378 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fe6dbbc..638ed3c 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 406fdde..d39772b 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6f2f59d..9b8c95c 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index bad9d30..b03840c 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1367245..576fa9f 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9f3e04c..1657ab1 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4d53a57..11bac41 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2d2804a..7321951 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 09cf5d3..f55a33f 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 70d74ee..a0ae963 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -49,6 +49,7 @@ 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>&nbsp;</p>
+<p><strong>Protein Colour Schemes</strong></p>
 <table border="1">
        <tr>
                <td>
@@ -291,6 +292,81 @@ background, and the intensity threshold for transition between them.</p>
                </td>
        </tr>
 </table>
+<p>&nbsp;</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">&nbsp;</p>
 </body>
index a0d4c8c..1e5eb67 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -35,6 +35,7 @@ td {
       <td bgcolor="#FFB340">C</td>
       <td bgcolor="#EB413C">G</td>
       <td bgcolor="#3C88EE">T</td>
+      <td bgcolor="#3C88EE">U</td>
     </tr>
   </table>
 </div>
index 58e8489..2aa9138 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/help/html/colourSchemes/purinepyrimidine.html b/help/html/colourSchemes/purinepyrimidine.html
new file mode 100644 (file)
index 0000000..0f10577
--- /dev/null
@@ -0,0 +1,40 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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>Purine/Pyrimidine Colour Scheme</title>
+<style type="text/css">
+<!--
+td {
+       text-align: center;
+}
+-->
+</style>
+</head>
+
+<body>
+<p><em>Purine/Pyrimidine Colours</em></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 (file)
index 0000000..f31bb78
--- /dev/null
@@ -0,0 +1,50 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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>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 &quot;Colour&quot; <strong>&#8594;</strong> &quot; 
+  By RNA Helices&quot; 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 (file)
index 0000000..05e9230
Binary files /dev/null and b/help/html/colourSchemes/rnahelicescoloring.png differ
index 33f1d34..e35bc52 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 41edf24..5b667de 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index de18633..f2fd8c8 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 928c5ee..9605118 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1f48afa..71345f6 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 327c9b1..dc55f2e 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1a1bc31..3bef965 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4e4ea73..01353aa 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3705569..2604430 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9a50c86..f278516 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5977ae5..9e6739c 100644 (file)
@@ -1,7 +1,7 @@
 <html>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 0d6cd2f..368698b 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c820e45..e41bf4d 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b43e79e..1c61b81 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9bd70ff..b29262b 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b9fe144..5927ddb 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5439609..ef410cb 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8693756..897640c 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e5b30ae..215e283 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c1d08a9..c0fbf32 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 77888dd..f630639 100644 (file)
@@ -1,7 +1,7 @@
 <html>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 3bfa293..606083c 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3694d07..060059e 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 93146a5..a10b14e 100644 (file)
@@ -1,7 +1,7 @@
 <html>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -23,7 +23,7 @@
 <p><strong>The Jmol PDB Viewer</strong></p>\r
 <p>Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>\r
 has been integrated into Jalview for interactively viewing structures\r
-opened by selecting the <strong>&quot;Sequence&#8594;View PDB\r
+opened by selecting the <strong>&quot;Structure&#8594;View PDB\r
 entry:&quot;</strong> option in the <a href="../menus/popupMenu.html">sequence\r
 id pop-up menu</a> (if you can't see this, then you need to <a\r
        href="viewingpdbs.html">associate a PDB structure</a> with the\r
index 1e4852a..06841df 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4f93219..b6e1127 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c5dc93d..67af998 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 743f2a9..5c08e55 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7bc2a61..089d1a5 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0c733e4..87e4a96 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e77ec85..68741f7 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cca5c66..a956d6d 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
 </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
-&quot;File&quot; menu on the main desktop in order to retrieve sequences
-as a new alignment, or opened via the &quot;File&quot; 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 &quot;Example&quot; button to paste the example accession
-for the currently selected database into the retrieval box. Finally,
-press &quot;OK&quot; 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>
-  &lt;AccessionId&gt;:&lt;start&gt;,&lt;end&gt;</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>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 &quot;File&quot; 
+  menu on the main desktop in order to retrieve sequences as a new
+  alignment, or opened via the &quot;File&quot; 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 
+  &quot;Example&quot; button to paste the example accession for the currently selected database into the retrieval box.
+   Finally, press &quot;OK&quot; to initiate the retrieval.</p>
+<p>
+  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><br>When retrieving from DAS sequence sources,
+  coordinate range arguments can be passed to the server using the standard DAS 
+  sequence command format (<strong>:&lt;start&gt;,&lt;end&gt;</strong>)</p>
+<p>If you use the WSDBFetch sequence fetcher services (EMBL, Uniprot, PDB, 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>
index bb93c97..f90f882 100644 (file)
@@ -1,7 +1,7 @@
 <html>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
diff --git a/help/html/features/varna.html b/help/html/features/varna.html
new file mode 100644 (file)
index 0000000..507b26f
--- /dev/null
@@ -0,0 +1,74 @@
+<html>\r
+<!--\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE.  See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
+-->\r
+<head>\r
+<title>The VARNA RNA Viewer</title>\r
+</head>\r
+<body>\r
+<p><strong>The VARNA RNA Viewer</strong></p>\r
+<p>Since Jalview\r
+2.7.1, <a href="http://varna.lri.fr/index.html">VARNA</a> has been\r
+integrated into Jalview for interactively viewing structures opened by\r
+selecting the <strong>&quot;Structure&#8594;View\r
+Structure:&quot;</strong> option in\r
+the <a href="../menus/popupMenu.html">sequence id pop-up menu</a> (if\r
+you can't see this, then no RNA structure is associated with your\r
+sequence or alignment. In the pop-up menu all structures that\r
+are associated with this sequence and all sequences that are\r
+associated with the alignment are available.\r
+\r
+<p><strong>Different structures</strong></p>\r
+<ul>\r
+  <li>\r
+    <b>Alignment structures</b>:\r
+    Structures associated with the alignment are marked by having &quot;consensus&quot; attached to their name. VARNA contains two different entries for consensus structures.\r
+    <ul>\r
+      <li>Consensus structure: the individual sequence folded into the consensus structure</li>\r
+      <li>Trimmed consensus structure: the individual sequence\r
+       folded into the the gap-free consensus structure. That means all\r
+       columns that contained gaps in the individual sequence were\r
+       removed. If this breaks a base-pair the pairing is removed also.\r
+       This can be considered as an approximation for the individual structure.\r
+    </ul>\r
+  </li>\r
+  <li>\r
+    <b>Individual structures</b>:\r
+    this is a structure associated with the individual sequence and therefore not related to the alignment    \r
+  </li>\r
+\r
+<p><strong>Controls</strong><br>\r
+<ul>\r
+<li>Rotate view - Left Click and drag</li>\r
+<li>Zoom in - Press '+'</li>\r
+<li>Zoom out - Press '-'</li>\r
+<li>Choose a different structure - Left click on structure in the left hand panel</li>\r
+<li>Highlighting bases - Move mouse over columns in the Jalview alignment panel</li>\r
+</ul>\r
+\r
+<p><strong>Functionality provided by VARNA</strong></p>\r
+<p>VARNA's own functions are accessed by right-clicking in the\r
+structure display area. That will open the VARNA pop-up menu,\r
+which provides access to a number of features like different draw algorithm, color highlighting or annotations. \r
+</p>\r
+<p><strong>More Information</strong></p>\r
+<p>VARNA is a very powerful RNA viewer on its own. Only the\r
+essentials have been described here - the interested reader is\r
+referred to <a href="http://varna.lri.fr/usermanual.html">VARNA's own\r
+comprehensive online documentation</a>.</p>\r
+</body>\r
+</html>\r
index fc12b3b..1460e8a 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 689d516..a4ff930 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0957962..cfa8cb3 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b5a86da..ed24f59 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9172b28..7cbfbf5 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -63,6 +63,11 @@ THISISASEQENCE<br></td>
 </tr><tr><td width="17%">PFAM</td>
 <td width="60%">SequenceName THISISASEQENCE</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>
 </table>
 <p>The file extensions are used to associate jalview alignment icons
index be803bb..f413786 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7d12827..b7809a5 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6f31a7a..dfebd8e 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ee526e8..f154572 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 366c073..4e52b84 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ff74139..4a1a200 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -28,8 +28,8 @@
                <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
+                                               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
 
                                        </ul></li>
                        </ul>
+       </li>
+
+               </ul>
                </li>
 
                <li><strong>Colour</strong>
                                <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
+                                               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
                                                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>
index bd1eda6..9508b24 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 444dfe3..28ff3d6 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3093edd..4e4978c 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -31,7 +31,7 @@
       </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>
+      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>
       <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>
index 488e2f0..4ab514f 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index af3e105..39db7ae 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -25,7 +25,7 @@
 <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
+       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>
index 62fdf93..ab5fd74 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6cbaad3..dd8a343 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b533452..2cf52db 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4098c67..d8c5c46 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 436dc35..b1c115d 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f875672..19dd51a 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fb16551..46b8605 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3c5221e..d6c8264 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 494db99..e985312 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a57bc0a..95164d9 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/help/html/na/index.html b/help/html/na/index.html
new file mode 100644 (file)
index 0000000..bad0c92
--- /dev/null
@@ -0,0 +1,58 @@
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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>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>
+<p>Sequences can be <a href="../features/seqfetch.html">fetched</a> from the 
+RFAM database by accession number or ID.</p>
+<p>If an RNA alignment is loaded from a Stockholm file with secondary
+structure information in WUSS notation, the alignment can be coloured by 
+the helices in the secondary structure. Helices are determined by the base-pairing
+in the secondary structure line. See <a href="../colourSchemes/rnahelicesColouring.html">
+RNA Helices Colouring</a>. Below is an example of this type of coloring</p>
+<p>Annotation panel shows the presence of RNA helices and WUSS notation from
+input file specifying secondary structure.<p>
+<div align="center">
+  <img src="../colourschemes/rnahelicescoloring.png" width="600" height="140"> </div> 
+
+</div>
+<p align="center">&nbsp;</p>
+</body>
+</html>
index b1e12c2..567cc58 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 88bd1dc..fc054dc 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 20c0897..ef23489 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 58950b9..3a95ab3 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f62012c..39c499f 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 21bceca..b41e643 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3009823..297d8ea 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5736258..ecca088 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 80f8a28..2dcaa4d 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index dc01f71..e8ddabf 100644 (file)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fd0acf6..6eb8ee7 100644 (file)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1187204..9fc29db 100644 (file)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cf96d47..20c80df 100755 (executable)
@@ -1,7 +1,7 @@
 <html>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
                <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
+               The Jalview 2.7.1 release features (tbc)
+               <br /> For full
+               details see the <a href="releases.html#Jalview2.7.1">Jalview 2.7.1
                        release history</a>.
        </p>
        <p>
-               <strong>Highlights in Jalview Desktop Version 2.7</strong>
+               <strong>Highlights in Jalview Desktop Version 2.7.1</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>
+
+       <li>New Purine/Pyrimidine colour scheme</li>
+       <li>Colouring of RNA secondary structure by helices.  See <a href="na/index.html">Nucleic Acid Support</a></li>
+       <li>Embedded <a href="http://www.varna.fr/">VARNA</a> RNA secondary structure viewer.
        </ul>
 
        <p>
                <strong>Issues Resolved (a select list - see the <a
-                       href="releases.html#Jalview2.7">release history</a> for full details)
+                       href="releases.html#Jalview2.7.1">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>&lt;= 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>
index 014f741..1708b7d 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/lib/VARNAv3-9-dev.jar b/lib/VARNAv3-9-dev.jar
new file mode 100644 (file)
index 0000000..6ae57bf
Binary files /dev/null and b/lib/VARNAv3-9-dev.jar differ
index 2c9332e..1cfc700 100644 (file)
Binary files a/lib/castor-1.1-cycle-xml.jar and b/lib/castor-1.1-cycle-xml.jar differ
index 17f7559..ebd457b 100755 (executable)
Binary files a/lib/jaxrpc.jar and b/lib/jaxrpc.jar differ
diff --git a/lib/jdas-1.0.4.jar b/lib/jdas-1.0.4.jar
new file mode 100644 (file)
index 0000000..fb5d128
Binary files /dev/null and b/lib/jdas-1.0.4.jar differ
index 493a3cc..05f8702 100755 (executable)
Binary files a/lib/log4j-1.2.8.jar and b/lib/log4j-1.2.8.jar differ
diff --git a/lib/min-jaba-client-2.0.jar b/lib/min-jaba-client-2.0.jar
new file mode 100644 (file)
index 0000000..4ba3f33
Binary files /dev/null and b/lib/min-jaba-client-2.0.jar differ
diff --git a/lib/min-jaba-client.jar b/lib/min-jaba-client.jar
deleted file mode 100644 (file)
index b626144..0000000
Binary files a/lib/min-jaba-client.jar and /dev/null differ
index 465dd55..fcdd67d 100755 (executable)
Binary files a/lib/saaj.jar and b/lib/saaj.jar differ
diff --git a/lib/spring-core-3.0.5.RELEASE.jar b/lib/spring-core-3.0.5.RELEASE.jar
new file mode 100644 (file)
index 0000000..ea9500d
Binary files /dev/null and b/lib/spring-core-3.0.5.RELEASE.jar differ
diff --git a/lib/spring-web-3.0.5.RELEASE.jar b/lib/spring-web-3.0.5.RELEASE.jar
new file mode 100644 (file)
index 0000000..5a2381a
Binary files /dev/null and b/lib/spring-web-3.0.5.RELEASE.jar differ
index 830f355..3b03197 100644 (file)
@@ -1,6 +1,6 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
    
     This file is part of Jalview.
    
index 878d309..14cb70b 100644 (file)
@@ -63,7 +63,7 @@ file.reference.Jmol-12.2.4.jar=lib/Jmol-12.2.4.jar
 file.reference.JmolApplet-12.2.4.jar=appletlib/JmolApplet-12.2.4.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-dev.jar
 includes=**
 jar.compress=false
 javac.classpath=\
@@ -100,7 +101,8 @@ javac.classpath=\
     ${file.reference.xml-apis.jar}:\
     ${file.reference.xercesImpl.jar}:\
     ${file.reference.wsdl4j.jar}:\
-    ${file.reference.JmolApplet-12.2.4.jar}
+    ${file.reference.JmolApplet-12.2.4.jar} \
+    ${file.reference.varna-3.9-dev.jar}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.deprecation=false
index f3db653..99ac32c 100644 (file)
@@ -1,6 +1,6 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
    
     This file is part of Jalview.
    
diff --git a/resources/authors.props b/resources/authors.props
new file mode 100644 (file)
index 0000000..69c89a6
--- /dev/null
@@ -0,0 +1,4 @@
+YEAR=2011
+AUTHORS=J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+AUTHORFNAMES=Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton
\ No newline at end of file
index d3af6c7..7a1f585 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0"?>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index bf971af..337ec44 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1142745..7268b0e 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7238f18..506c9f2 100644 (file)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3d37852..63d02b7 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 431fad5..cc8b1e9 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7c562fb..a453b97 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index f061b42..9d4b679 100755 (executable)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
                        <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">
index f8bfed0..7742e6a 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <!--\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 181d85f..cadbc77 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ae255e1..cebd6a9 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9ab7e09..1502f4e 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9d22b6a..2979cd1 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 298fcc4..500e203 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fd1b764..987dcd1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0004308..aeb4800 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a5f050d..c3ab9d7 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3f9bc9d..18b83ae 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cb3d221..041277d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fd2c210..a5d7905 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e952e53..7ea16ce 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 866fe88..e582b59 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d015f63..885c62d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 06483a6..d8ed0e4 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 216f411..3e539d5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b878c18..5f1f636 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 03a2383..724a7d9 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 249c163..f6cc6a5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 752f622..0c9bd24 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c669d23..538be42 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e582192..f148589 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ca961e2..fecd11c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3af0cf0..e366cbb 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index bd70635..e424865 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index f476ec2..48f99cb 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 118c893..979a855 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 3a96d70..b649c99 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 64687a1..eefbac5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index aadd8f0..7e77b0f 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -26,7 +26,7 @@ import jalview.datamodel.*;
  * 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$
  */
@@ -44,20 +44,21 @@ public class AAFrequency
 
   public static final String PROFILE = "P";
 
-  public static final Hashtable[] calculate(Vector sequences, int start,
+  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,
+  public static final Hashtable[] calculate(List<SequenceI> sequences, int start,
           int end, boolean profile)
   {
     SequenceI[] seqs = new SequenceI[sequences.size()];
     int width = 0;
+    synchronized (sequences) {
     for (int i = 0; i < sequences.size(); i++)
     {
-      seqs[i] = (SequenceI) sequences.elementAt(i);
+      seqs[i] = sequences.get(i);
       if (seqs[i].getLength() > width)
       {
         width = seqs[i].getLength();
@@ -72,9 +73,9 @@ public class AAFrequency
     }
 
     calculate(seqs, start, end, reply, profile);
-
     return reply;
   }
+  }
 
   public static final void calculate(SequenceI[] sequences, int start,
           int end, Hashtable[] result)
@@ -171,10 +172,10 @@ public class AAFrequency
       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;
+      percentage = ((float) maxCount * 100) / nongap;
       residueHash.put(PID_NOGAPS, new Float(percentage));
       result[i] = residueHash;
     }
@@ -183,7 +184,7 @@ public class AAFrequency
   /**
    * Compute all or part of the annotation row from the given consensus
    * hashtable
-   * 
+   *
    * @param consensus
    *          - pre-allocated annotation row
    * @param hconsensus
@@ -218,33 +219,40 @@ public class AAFrequency
     }
     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;
+      Float fv;
       if (ignoreGapsInConsensusCalculation)
       {
-        value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
-                .floatValue();
+        fv = (Float) hci.get(AAFrequency.PID_NOGAPS);
       }
       else
       {
-        value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
-                .floatValue();
+        fv = (Float) hci.get(AAFrequency.PID_GAPS);
       }
-
-      String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
-      String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
+      if (fv==null)
+      {
+        consensus.annotations[i] = null;
+        // data has changed below us .. give up and
+        continue;
+      }
+      value = fv.floatValue();
+      String maxRes = hci.get(AAFrequency.MAXRESIDUE).toString();
+      String mouseOver = hci.get(AAFrequency.MAXRESIDUE) + " ";
       if (maxRes.length() > 1)
       {
         mouseOver = "[" + maxRes + "] ";
         maxRes = "+";
       }
-      int[][] profile = (int[][]) hconsensus[i].get(AAFrequency.PROFILE);
+      int[][] profile = (int[][]) hci.get(AAFrequency.PROFILE);
       if (profile != null && includeAllConsSymbols)
       {
         mouseOver = "";
@@ -252,9 +260,9 @@ public class AAFrequency
         {
           for (int c = 0; c < alphabet.length; c++)
           {
-            tval = ((float) profile[0][alphabet[c]])
+            tval = profile[0][alphabet[c]]
                     * 100f
-                    / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+                    / profile[1][ignoreGapsInConsensusCalculation ? 1
                             : 0];
             mouseOver += ((c == 0) ? "" : "; ") + alphabet[c] + " "
                     + ((int) tval) + "%";
@@ -268,7 +276,7 @@ public class AAFrequency
           {
             ca[c] = new char[]
             { (char) c };
-            vl[c] = (float) profile[0][c];
+            vl[c] = profile[0][c];
           }
           ;
           jalview.util.QuickSort.sort(vl, ca);
@@ -276,9 +284,9 @@ public class AAFrequency
           {
             if (((char[]) ca[c])[0] != '-')
             {
-              tval = ((float) profile[0][((char[]) ca[c])[0]])
+              tval = profile[0][((char[]) ca[c])[0]]
                       * 100f
-                      / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+                      / profile[1][ignoreGapsInConsensusCalculation ? 1
                               : 0];
               mouseOver += ((p == 0) ? "" : "; ") + ((char[]) ca[c])[0]
                       + " " + ((int) tval) + "%";
@@ -300,7 +308,7 @@ public class AAFrequency
 
   /**
    * get the sorted profile for the given position of the consensus
-   * 
+   *
    * @param hconsensus
    * @return
    */
@@ -317,18 +325,20 @@ public class AAFrequency
     {
       ca[c] = new char[]
       { (char) c };
-      vl[c] = (float) profile[0][c];
+      vl[c] = profile[0][c];
     }
     ;
     jalview.util.QuickSort.sort(vl, ca);
-    rtnval[0] = 1;
+    rtnval[0] = 2;
+    rtnval[1]=0;
     for (int c = ca.length - 1; profile[0][((char[]) ca[c])[0]] > 0; c--)
     {
       if (((char[]) ca[c])[0] != '-')
       {
         rtnval[rtnval[0]++] = ((char[]) ca[c])[0];
-        rtnval[rtnval[0]++] = (int) (((float) profile[0][((char[]) ca[c])[0]]) * 100f / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+        rtnval[rtnval[0]] = (int) (profile[0][((char[]) ca[c])[0]] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
                 : 0]);
+        rtnval[1]+=rtnval[rtnval[0]++];
       }
     }
     return rtnval;
index 3db4435..2ce08fc 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d78b5b3..881dc74 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -75,7 +75,7 @@ public class AlignmentSorter
 
   /**
    * Sort by Percentage Identity w.r.t. s
-   * 
+   *
    * @param align
    *          AlignmentI
    * @param s
@@ -91,7 +91,7 @@ public class AlignmentSorter
 
   /**
    * Sort by Percentage Identity w.r.t. s
-   * 
+   *
    * @param align
    *          AlignmentI
    * @param s
@@ -124,7 +124,7 @@ public class AlignmentSorter
 
   /**
    * Reverse the order of the sort
-   * 
+   *
    * @param align
    *          DOCUMENT ME!
    * @param seqs
@@ -146,17 +146,21 @@ 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]);
+      }
     }
   }
 
   /**
    * Sets the Alignment object with the given sequences
-   * 
+   *
    * @param align
    *          Alignment object to be updated
    * @param tmp
@@ -169,7 +173,7 @@ public class AlignmentSorter
 
   /**
    * Sets the Alignment object with the given sequences
-   * 
+   *
    * @param align
    *          DOCUMENT ME!
    * @param seqs
@@ -178,29 +182,31 @@ 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));
+      }
     }
-
   }
 
   /**
    * Sorts by ID. Numbers are sorted before letters.
-   * 
+   *
    * @param align
    *          The alignment object to sort
    */
@@ -233,7 +239,7 @@ public class AlignmentSorter
 
   /**
    * Sorts by sequence length
-   * 
+   *
    * @param align
    *          The alignment object to sort
    */
@@ -247,7 +253,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);
@@ -268,7 +274,7 @@ public class AlignmentSorter
    * Sorts the alignment by size of group. <br>
    * Maintains the order of sequences in each group by order in given alignment
    * object.
-   * 
+   *
    * @param align
    *          sorts the given alignment object by group
    */
@@ -290,10 +296,8 @@ 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);
@@ -340,10 +344,10 @@ 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)
@@ -359,18 +363,20 @@ public class AlignmentSorter
   }
 
   /**
-   * DOCUMENT ME!
-   * 
+   * Select sequences in order from tmp that is present in mask, and any
+   * remaining seqeunces in mask not in tmp
+   *
    * @param tmp
-   *          DOCUMENT ME!
+   *          thread safe collection of sequences
    * @param mask
-   *          DOCUMENT ME!
-   * 
-   * @return DOCUMENT ME!
+   *          thread safe collection of sequences
+   *
+   * @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();
+    ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
     int i, idx;
     boolean[] tmask = new boolean[mask.size()];
 
@@ -381,12 +387,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,16 +400,16 @@ 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()]);
   }
 
   /**
    * Sorts by a given AlignmentOrder object
-   * 
+   *
    * @param align
    *          Alignment to order
    * @param order
@@ -435,12 +441,12 @@ public class AlignmentSorter
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param align
    *          alignment to order
    * @param tree
    *          tree which has
-   * 
+   *
    * @return DOCUMENT ME!
    */
   private static Vector getOrderByTree(AlignmentI align, NJTree tree)
@@ -463,8 +469,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");
       }
     }
 
@@ -473,7 +483,7 @@ public class AlignmentSorter
 
   /**
    * Sorts the alignment by a given tree
-   * 
+   *
    * @param align
    *          alignment to order
    * @param tree
@@ -506,7 +516,7 @@ public class AlignmentSorter
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param align
    *          DOCUMENT ME!
    * @param seqs
@@ -533,18 +543,18 @@ public class AlignmentSorter
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param node
    *          DOCUMENT ME!
    * @param tmp
    *          DOCUMENT ME!
    * @param seqset
    *          DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
   private static Vector _sortByTree(SequenceNode node, Vector tmp,
-          Vector seqset)
+          List<SequenceI> seqset)
   {
     if (node == null)
     {
@@ -560,9 +570,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.addElement(node.element());
           }
         }
       }
@@ -603,7 +615,7 @@ public class AlignmentSorter
   /**
    * Sort sequence in order of increasing score attribute for annotation with a
    * particular scoreLabel. Or reverse if same label was used previously
-   * 
+   *
    * @param scoreLabel
    *          exact label for sequence associated AlignmentAnnotation scores to
    *          use for sorting.
@@ -691,7 +703,7 @@ public class AlignmentSorter
   /**
    * sort the alignment using the features on each sequence found between start
    * and stop with the given featureLabel (and optional group qualifier)
-   * 
+   *
    * @param featureLabel
    *          (may not be null)
    * @param groupLabel
index 2a065f6..6957b5c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -85,9 +85,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;
@@ -103,7 +102,7 @@ public class Conservation
     try {
     for (s = 0; s < sSize; s++)
     {
-      sarray[s] = (SequenceI) sequences.elementAt(s);
+      sarray[s] = (SequenceI) sequences.get(s);
       if (sarray[s].getLength() > maxLength)
       {
         maxLength = sarray[s].getLength();
@@ -695,4 +694,42 @@ 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;
+  }
 }
index 1420c9a..94aa5c9 100644 (file)
@@ -1,23 +1,24 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ *\r
  * This file is part of Jalview.\r
- * \r
+ *\r
  * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
+ * modify it under the terms of the GNU General Public License\r
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ *\r
+ * Jalview is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty\r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
  * PURPOSE.  See the GNU General Public License for more details.\r
- * \r
+ *\r
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
  */\r
 package jalview.analysis;\r
 \r
 import java.util.Enumeration;\r
+import java.util.List;\r
 import java.util.Vector;\r
 import java.util.Hashtable;\r
 \r
@@ -34,15 +35,15 @@ import jalview.ws.seqfetcher.ASequenceFetcher;
 /**\r
  * Functions for cross-referencing sequence databases. user must first specify\r
  * if cross-referencing from protein or dna (set dna==true)\r
- * \r
+ *\r
  * @author JimP\r
- * \r
+ *\r
  */\r
 public class CrossRef\r
 {\r
   /**\r
    * get the DNA or protein references for a protein or dna sequence\r
-   * \r
+   *\r
    * @param dna\r
    * @param rfs\r
    * @return\r
@@ -90,7 +91,7 @@ public class CrossRef
   /**\r
    * Indirect references are references from other sequences from the dataset to\r
    * any of the direct DBRefEntrys on the given sequences.\r
-   * \r
+   *\r
    * @param dna\r
    *          true if seqs are DNA seqs\r
    * @param seqs\r
@@ -201,7 +202,7 @@ public class CrossRef
   }\r
 \r
   /**\r
-   * \r
+   *\r
    * @param dna\r
    * @param seqs\r
    * @return\r
@@ -213,7 +214,7 @@ public class CrossRef
   }\r
 \r
   /**\r
-   * \r
+   *\r
    * @param seqs\r
    * @param dna\r
    * @param source\r
@@ -415,7 +416,7 @@ public class CrossRef
    * find references to lrfs in the cross-reference set of each sequence in\r
    * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry\r
    * based on source and accession string only - Map and Version are nulled.\r
-   * \r
+   *\r
    * @param sequenceI\r
    * @param lrfs\r
    * @param dataset\r
@@ -443,7 +444,7 @@ public class CrossRef
   /**\r
    * search a given sequence dataset for references matching cross-references to\r
    * the given sequence\r
-   * \r
+   *\r
    * @param sequenceI\r
    * @param xrf\r
    * @param dataset\r
@@ -462,7 +463,7 @@ public class CrossRef
    * TODO: generalise to different protein classifications Search dataset for\r
    * DBRefEntrys matching the given one (xrf) and add the associated sequence to\r
    * rseq.\r
-   * \r
+   *\r
    * @param sequenceI\r
    * @param xrf\r
    * @param dataset\r
@@ -486,10 +487,10 @@ public class CrossRef
       System.err.println("Empty dataset sequence set - NO VECTOR");\r
       return false;\r
     }\r
-    Enumeration e = dataset.getSequences().elements();\r
-    while (e.hasMoreElements())\r
+    List<SequenceI> ds;\r
+    synchronized (ds=dataset.getSequences())\r
     {\r
-      SequenceI nxt = (SequenceI) e.nextElement();\r
+      for (SequenceI nxt:ds)\r
       if (nxt != null)\r
       {\r
         if (nxt.getDatasetSequence() != null)\r
@@ -566,7 +567,7 @@ public class CrossRef
   /**\r
    * precalculate different products that can be found for seqs in dataset and\r
    * return them.\r
-   * \r
+   *\r
    * @param dna\r
    * @param seqs\r
    * @param dataset\r
index 49c37df..9f3a8d0 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 2dd6a74..41478d6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 57f1dcf..91fef84 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -24,6 +24,7 @@ import jalview.datamodel.SequenceI;
 
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Vector;
 
 /**
@@ -42,25 +43,24 @@ 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();
     int width = 0, i;
     Hashtable pgroup = new Hashtable();
-    if (exgroups != null)
+    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++)
index e9e1cd7..67ce460 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6498b6d..b001549 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3649a29..f188bef 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java
new file mode 100644 (file)
index 0000000..ba18732
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
+ */
+
+/* Author: Lauren Michelle Lui 
+ * Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/
+ * */
+
+package jalview.analysis;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+
+import jalview.datamodel.SequenceFeature;
+
+public class Rna
+{
+       static Hashtable<Integer, Integer> pairHash = new Hashtable();
+  /**
+   * 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 SequenceFeature[] GetBasePairs(CharSequence line) throws WUSSParseException
+  {
+    Stack stack = new Stack();
+    Vector pairs = new Vector();
+
+    int i = 0;
+    while (i < line.length())
+    {
+      char base = line.charAt(i);
+
+      if ((base == '<') || (base == '(') || (base == '{') || (base == '['))
+      {
+        stack.push(i);
+      }
+      else if ((base == '>') || (base == ')') || (base == '}')
+              || (base == ']'))
+      {
+
+        if (stack.isEmpty())
+        {
+          // error whilst parsing i'th position. pass back
+          throw new WUSSParseException("Mismatched closing bracket", i);
+        }
+        Object temp = stack.pop();
+        pairs.addElement(temp);
+        pairs.addElement(i);        
+      }
+
+      i++;
+    }
+
+    int numpairs = pairs.size() / 2;
+    SequenceFeature[] outPairs = new SequenceFeature[numpairs];
+
+    // Convert pairs to array
+    for (int p = 0; p < pairs.size(); p += 2)
+    {
+      int begin = Integer.parseInt(pairs.elementAt(p).toString());
+      int end = Integer.parseInt(pairs.elementAt(p + 1).toString());
+      
+       outPairs[p / 2] = new SequenceFeature("RNA helix", "", "", begin,
+              end, "");
+       //pairHash.put(begin, end);
+
+    }
+
+    return outPairs;
+  }
+  
+  
+  /**
+   * 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;
+
+    }
+  }
+}
+
index f28fa05..21dea57 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a8ce33d..4b1900c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java
new file mode 100644 (file)
index 0000000..67d8b9b
--- /dev/null
@@ -0,0 +1,474 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.*;
+
+import jalview.datamodel.*;
+
+/**
+ * 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
+{
+  // 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[] seq, struc = rnaStruc.getRNAStruc().toCharArray();
+    SequenceFeature[] rna = rnaStruc._rnasecstr;
+    char c, s, cEnd;
+    int count, nonGap = 0, i, bpEnd = -1, j, jSize = sequences.length;
+    int[] values;
+    int[][] pairs;
+    float percentage;
+
+    for (i = start; i < end; i++) // foreach column
+    {
+      residueHash = new Hashtable();
+      maxResidue = "-";
+      values = new int[255];
+      pairs = new int[255][255];
+      bpEnd = -1;
+      if (i < struc.length)
+      {
+        s = struc[i];
+      }
+      else
+      {
+        s = '-';
+      }
+      if (s == '.' || s == ' ')
+      {
+        s = '-';
+      }
+
+      if (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);
+          {
+
+            // standard representation for gaps in sequence and structure
+            if (c == '.' || c == ' ')
+            {
+              c = '-';
+            }
+
+            if (c == '-')
+            {
+              values['-']++;
+              continue;
+            }
+            cEnd = sequences[j].getCharAt(bpEnd);
+            if (checkBpType(c, cEnd))
+            {
+              values['(']++; // H means it's a helix (structured)
+            }
+            pairs[c][cEnd]++;
+
+            maxResidue = "(";
+          }
+        }
+        }
+        // nonGap++;
+      }
+      // UPDATE this for new values
+      if (profile)
+      {
+        residueHash.put(PROFILE, new int[][]
+        { values, new int[]
+        { jSize, (jSize - values['-']) } });
+
+        residueHash.put(PAIRPROFILE, pairs);
+      }
+
+      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['('] = 0;
+
+        residueHash = new Hashtable();
+        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)
+  {
+    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;
+    }
+    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 {
+         */
+        Object[] ca = new Object[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;
+
+        for (int c = 624; c > 0; c--)
+        {
+          if (vl[c] > 0)
+          {
+            tval = (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
+                    : 0]);
+            mouseOver += ((p == 0) ? "" : "; ") + (char) ((int[]) ca[c])[0]
+                    + (char) ((int[]) ca[c])[1] + " " + ((int) tval) + "%";
+            p++;
+
+          }
+        }
+
+        // }
+      }
+      else
+      {
+        mouseOver += ((int) 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[74]; // 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];
+    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);
+
+    rtnval[0] = 2;
+    rtnval[1] = 0;
+    for (int c = 624; c > 0; c--)
+    {
+      if (vl[c] > 0)
+      {
+        rtnval[rtnval[0]++] = ((int[]) ca[c])[0];
+        rtnval[rtnval[0]++] = ((int[]) ca[c])[1];
+        rtnval[rtnval[0]] = (int) (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
+                : 0]);
+        rtnval[1]+=rtnval[rtnval[0]++];
+      }
+    }
+
+    return rtnval;
+  }
+
+  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 (file)
index 0000000..c8ade0c
--- /dev/null
@@ -0,0 +1,19 @@
+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;
+  }
+  
+}
\ No newline at end of file
diff --git a/src/jalview/api/AlignCalcManagerI.java b/src/jalview/api/AlignCalcManagerI.java
new file mode 100644 (file)
index 0000000..1eedc74
--- /dev/null
@@ -0,0 +1,118 @@
+package jalview.api;
+
+import java.util.List;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+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);
+
+}
diff --git a/src/jalview/api/AlignCalcWorkerI.java b/src/jalview/api/AlignCalcWorkerI.java
new file mode 100644 (file)
index 0000000..00f967a
--- /dev/null
@@ -0,0 +1,11 @@
+package jalview.api;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+public interface AlignCalcWorkerI extends Runnable
+{
+
+  public boolean involves(AlignmentAnnotation annot);
+
+  public void updateAnnotation();
+}
diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java
new file mode 100644 (file)
index 0000000..ab9efb1
--- /dev/null
@@ -0,0 +1,112 @@
+/**
+ * 
+ */
+package jalview.api;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.RNAHelicesColour;
+
+/**
+ * @author jimp
+ *
+ */
+public interface AlignViewportI
+{
+
+  int getCharWidth();
+
+  int getEndRes();
+
+  int getCharHeight();
+
+  boolean hasHiddenColumns();
+
+  boolean isValidCharWidth();
+
+  boolean isShowConsensusHistogram();
+
+  boolean isShowSequenceLogo();
+
+  boolean isNormaliseSequenceLogo();
+
+  ColourSchemeI getGlobalColourScheme();
+
+  AlignmentI getAlignment();
+
+  ColumnSelection getColumnSelection();
+
+  Hashtable[] getSequenceConsensusHash();
+
+  Hashtable[] getRnaStructureConsensusHash();
+
+  boolean getIgnoreGapsConsensus();
+
+  boolean getCentreColumnLabels();
+
+  boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
+
+  AlignmentAnnotation getAlignmentQualityAnnot();
+
+  AlignmentAnnotation getAlignmentConservationAnnotation();
+  /**
+   * get the container for alignment consensus annotation
+   * @return
+   */
+  AlignmentAnnotation getAlignmentConsensusAnnotation();
+
+  /**
+   * 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);
+
+  /**
+   * 
+   * @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);
+
+}
index a7acc66..70bb3d6 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
@@ -26,9 +26,20 @@ import jalview.structure.StructureSelectionManager;
  * @author JimP
  *
  */
-public interface AlignmentViewPanel
+public interface AlignmentViewPanel extends OOMHandlerI
 {
 
   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();
 }
index fe3786d..5e237ff 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/api/OOMHandlerI.java b/src/jalview/api/OOMHandlerI.java
new file mode 100644 (file)
index 0000000..c14b4f7
--- /dev/null
@@ -0,0 +1,8 @@
+package jalview.api;
+
+public interface OOMHandlerI
+{
+
+  void raiseOOMWarning(String string, OutOfMemoryError error);
+
+}
index a4ec373..dcc50d5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b5938bb..89cebe5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e89aeb5..efe63be 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 0727b0c..acdae46 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -157,7 +157,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
       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))
       {
         groupMenu.remove(unGroupMenuItem);
       }
@@ -300,12 +300,12 @@ public class APopupMenu extends java.awt.PopupMenu implements
       remove(seqMenu);
     }
 
-    if (!ap.av.hasHiddenRows)
+    if (!ap.av.hasHiddenRows())
     {
       remove(revealAll);
       remove(revealSeq);
     } else {
-      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)
@@ -513,8 +513,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
           EditCommand editCommand = new EditCommand("Edit Sequences",
                   EditCommand.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);
 
@@ -529,44 +529,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
       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);
-        }
+        int[][] startEnd = ap.av.getVisibleRegionBoundaries(sg.getStartRes(),
+                sg.getEndRes() + 1);
 
         String description;
         int caseChange;
@@ -588,7 +552,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
         }
 
         ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
-                sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
+                sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), startEnd,
                 caseChange);
 
         ap.alignFrame.addHistoryItem(caseCommand);
@@ -652,6 +616,8 @@ public class APopupMenu extends java.awt.PopupMenu implements
     frame.add(cap);
     jalview.bin.JalviewLite.addFrame(frame,
             "Selection output - " + 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(),
@@ -833,8 +799,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
   {
     SequenceGroup sg = getGroup();
     sg.cs = new ClustalxColourScheme(
-            sg.getSequences(ap.av.hiddenRepSequences),
-            ap.av.alignment.getWidth());
+            sg,ap.av.getHiddenRepSequences());
     refresh();
   }
 
@@ -897,8 +862,8 @@ 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.getSequences(ap.av.getHiddenRepSequences()), 0,
+              ap.av.getAlignment().getWidth()));
       int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
               .getName());
 
@@ -927,8 +892,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.getSequences(ap.av.getHiddenRepSequences()), 0,
+            ap.av.getAlignment().getWidth()));
     refresh();
   }
 
@@ -939,8 +904,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.getSequences(ap.av.getHiddenRepSequences()), 0,
+            ap.av.getAlignment().getWidth()));
 
     refresh();
   }
@@ -962,16 +927,11 @@ public class APopupMenu extends java.awt.PopupMenu implements
     if (conservationMenuItem.getState())
     {
 
-      Conservation c = new Conservation("Group",
+      sg.cs.setConservation(Conservation.calculateConservation("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.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 +951,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,7 +960,7 @@ 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);
   }
index 5790bc3..4948613 100644 (file)
@@ -1,39 +1,98 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ *\r
  * This file is part of Jalview.\r
- * \r
+ *\r
  * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
+ * modify it under the terms of the GNU General Public License\r
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ *\r
+ * Jalview is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty\r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
  * PURPOSE.  See the GNU General Public License for more details.\r
- * \r
+ *\r
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
  */\r
 package jalview.appletgui;\r
 \r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.analysis.*;\r
+import jalview.analysis.AAFrequency;\r
+import jalview.analysis.AlignmentSorter;\r
+import jalview.analysis.Conservation;\r
 import jalview.api.SequenceStructureBinding;\r
 import jalview.bin.JalviewLite;\r
-import jalview.commands.*;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
+import jalview.commands.CommandI;\r
+import jalview.commands.EditCommand;\r
+import jalview.commands.OrderCommand;\r
+import jalview.commands.RemoveGapColCommand;\r
+import jalview.commands.RemoveGapsCommand;\r
+import jalview.commands.SlideSequencesCommand;\r
+import jalview.commands.TrimRegionCommand;\r
+import jalview.datamodel.Alignment;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.AlignmentOrder;\r
+import jalview.datamodel.ColumnSelection;\r
+import jalview.datamodel.PDBEntry;\r
+import jalview.datamodel.Sequence;\r
+import jalview.datamodel.SequenceCollectionI;\r
+import jalview.datamodel.SequenceGroup;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.io.AnnotationFile;\r
+import jalview.io.AppletFormatAdapter;\r
+import jalview.io.FeaturesFile;\r
+import jalview.io.TCoffeeScoreFile;\r
+import jalview.schemes.Blosum62ColourScheme;\r
+import jalview.schemes.BuriedColourScheme;\r
+import jalview.schemes.ClustalxColourScheme;\r
+import jalview.schemes.ColourSchemeI;\r
+import jalview.schemes.HelixColourScheme;\r
+import jalview.schemes.HydrophobicColourScheme;\r
+import jalview.schemes.NucleotideColourScheme;\r
+import jalview.schemes.PIDColourScheme;\r
+import jalview.schemes.PurinePyrimidineColourScheme;\r
+import jalview.schemes.RNAHelicesColourChooser;\r
+import jalview.schemes.ResidueProperties;\r
+import jalview.schemes.StrandColourScheme;\r
+import jalview.schemes.TCoffeeColourScheme;\r
+import jalview.schemes.TaylorColourScheme;\r
+import jalview.schemes.TurnColourScheme;\r
+import jalview.schemes.ZappoColourScheme;\r
 import jalview.structure.StructureSelectionManager;\r
 \r
-public class AlignFrame extends EmbmenuFrame implements ActionListener,\r
-        ItemListener, KeyListener\r
+import java.awt.BorderLayout;\r
+import java.awt.Canvas;\r
+import java.awt.CheckboxMenuItem;\r
+import java.awt.Color;\r
+import java.awt.Font;\r
+import java.awt.FontMetrics;\r
+import java.awt.Frame;\r
+import java.awt.Graphics;\r
+import java.awt.Label;\r
+import java.awt.Menu;\r
+import java.awt.MenuBar;\r
+import java.awt.MenuItem;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.FocusEvent;\r
+import java.awt.event.FocusListener;\r
+import java.awt.event.ItemEvent;\r
+import java.awt.event.ItemListener;\r
+import java.awt.event.KeyEvent;\r
+import java.awt.event.KeyListener;\r
+import java.awt.event.WindowAdapter;\r
+import java.awt.event.WindowEvent;\r
+import java.io.IOException;\r
+import java.io.InputStreamReader;\r
+import java.net.URL;\r
+import java.net.URLEncoder;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.List;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemListener, KeyListener\r
 {\r
   public AlignmentPanel alignPanel;\r
 \r
@@ -45,10 +104,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   String jalviewServletURL;\r
 \r
-  public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,\r
-          String title, boolean embedded)\r
-  {\r
 \r
+  public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title, boolean embedded)\r
+  {\r
     if (applet != null)\r
     {\r
       jalviewServletURL = applet.getParameter("APPLICATION_URL");\r
@@ -69,12 +127,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     viewport.updateConsensus(alignPanel);\r
 \r
     annotationPanelMenuItem.setState(viewport.showAnnotation);\r
-    displayNonconservedMenuItem.setState(viewport.getShowunconserved());\r
+    displayNonconservedMenuItem.setState(viewport.getShowUnconserved());\r
     followMouseOverFlag.setState(viewport.getFollowHighlight());\r
-    showGroupConsensus.setState(viewport.showGroupConsensus);\r
-    showGroupConservation.setState(viewport.showGroupConservation);\r
-    showConsensusHistogram.setState(viewport.showConsensusHistogram);\r
-    showSequenceLogo.setState(viewport.showSequenceLogo);\r
+    showGroupConsensus.setState(viewport.isShowGroupConsensus());\r
+    showGroupConservation.setState(viewport.isShowGroupConservation());\r
+    showConsensusHistogram.setState(viewport.isShowConsensusHistogram());\r
+    showSequenceLogo.setState(viewport.isShowSequenceLogo());\r
 \r
     seqLimits.setState(viewport.showJVSuffix);\r
 \r
@@ -131,7 +189,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       }\r
 \r
     }\r
-\r
+    if (viewport.getAlignment().isNucleotide())\r
+    {\r
+      viewport.updateStrucConsensus(alignPanel);\r
+      if (viewport.getAlignment().hasRNAStructure())\r
+      {\r
+        RNAHelixColour.setEnabled(true);\r
+      }\r
+      else {\r
+        RNAHelixColour.setEnabled(false);\r
+      }\r
+    } else {\r
+      RNAHelixColour.setEnabled(false);\r
+      purinePyrimidineColour.setEnabled(false);\r
+    }\r
     // Some JVMS send keyevents to Top frame or lowest panel,\r
     // Havent worked out why yet. So add to both this frame and seqCanvas for\r
     // now\r
@@ -162,31 +233,34 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * Load a features file onto the alignment\r
-   * \r
+   *\r
    * @param file file URL, content, or other resolvable path\r
    * @param type is protocol for accessing data referred to by file\r
    */\r
 \r
-  public void parseFeaturesFile(String file, String type)\r
+  public boolean parseFeaturesFile(String file, String type)\r
   {\r
-    parseFeaturesFile(file, type, true);\r
+    return parseFeaturesFile(file, type, true);\r
   }\r
-  \r
+\r
   /**\r
    * Load a features file onto the alignment\r
-   * \r
+   *\r
    * @param file file URL, content, or other resolvable path\r
    * @param type is protocol for accessing data referred to by file\r
    * @param autoenabledisplay when true, display features flag will be automatically enabled if features are loaded\r
+   * @return true if data parsed as a features file\r
    */\r
-  public void parseFeaturesFile(String file, String type, boolean autoenabledisplay)\r
-  {    \r
+  public boolean parseFeaturesFile(String file, String type, boolean autoenabledisplay)\r
+  {\r
+    // TODO: test if importing a features file onto an alignment which already has features with links overwrites the original links.\r
+\r
     Hashtable featureLinks = new Hashtable();\r
     boolean featuresFile = false;\r
     try\r
     {\r
       featuresFile = new jalview.io.FeaturesFile(file, type)\r
-              .parse(viewport.alignment,\r
+              .parse(viewport.getAlignment(),\r
                       alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,\r
                       featureLinks, true, viewport.applet.getDefaultParameter("relaxedidmatch", false));\r
     } catch (Exception ex)\r
@@ -210,10 +284,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         viewport.featureSettings.refreshTable();\r
       }\r
       alignPanel.paintAlignment(true);\r
+      statusBar.setText("Successfully added features to alignment.");\r
     }\r
-\r
+    return featuresFile;\r
   }\r
 \r
+  @Override\r
   public void keyPressed(KeyEvent evt)\r
   {\r
     if (viewport.cursorMode\r
@@ -227,8 +303,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {\r
     case 27: // escape key\r
       deselectAllSequenceMenuItem_actionPerformed();\r
-      \r
-      alignPanel.alabels.cancelDrag(); \r
+\r
+      alignPanel.alabels.cancelDrag();\r
       break;\r
     case KeyEvent.VK_X:\r
       if (evt.isControlDown() || evt.isMetaDown())\r
@@ -475,7 +551,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * called by key handler and the hide all/show all menu items\r
-   * \r
+   *\r
    * @param toggleSeqs\r
    * @param toggleCols\r
    */\r
@@ -488,7 +564,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       // Hide everything by the current selection - this is a hack - we do the\r
       // invert and then hide\r
       // first check that there will be visible columns after the invert.\r
-      if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel\r
+      if ((viewport.getColumnSelection() != null && viewport.getColumnSelection().getSelected() != null && viewport.getColumnSelection()\r
               .getSelected().size() > 0)\r
               || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg\r
                       .getEndRes()))\r
@@ -512,12 +588,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
     if (toggleSeqs)\r
     {\r
-      if (sg != null && sg.getSize() != viewport.alignment.getHeight())\r
+      if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())\r
       {\r
         hide = true;\r
         viewport.hideAllSelectedSeqs();\r
       }\r
-      else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))\r
+      else if (!(toggleCols && viewport.getColumnSelection().getSelected().size() > 0))\r
       {\r
         viewport.showAllHiddenSeqs();\r
       }\r
@@ -525,12 +601,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
     if (toggleCols)\r
     {\r
-      if (viewport.colSel.getSelected().size() > 0)\r
+      if (viewport.getColumnSelection().getSelected().size() > 0)\r
       {\r
         viewport.hideSelectedColumns();\r
         if (!toggleSeqs)\r
         {\r
-          viewport.selectionGroup = sg;\r
+          viewport.setSelectionGroup(sg);\r
         }\r
       }\r
       else if (!hide)\r
@@ -540,14 +616,17 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     }\r
   }\r
 \r
+  @Override\r
   public void keyReleased(KeyEvent evt)\r
   {\r
   }\r
 \r
+  @Override\r
   public void keyTyped(KeyEvent evt)\r
   {\r
   }\r
 \r
+  @Override\r
   public void itemStateChanged(ItemEvent evt)\r
   {\r
     if (evt.getSource() == displayNonconservedMenuItem)\r
@@ -614,7 +693,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     }\r
     else if (evt.getSource() == autoCalculate)\r
     {\r
-      viewport.autocalculateConsensus = autoCalculate.getState();\r
+      viewport.autoCalculateConsensus = autoCalculate.getState();\r
     }\r
     else if (evt.getSource() == sortByTree)\r
     {\r
@@ -664,6 +743,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     this.alignPanel.annotationPanel.repaint();\r
   }\r
 \r
+  @Override\r
   public void actionPerformed(ActionEvent evt)\r
   {\r
     Object source = evt.getSource();\r
@@ -864,7 +944,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     else if (source == alProperties)\r
     {\r
       StringBuffer contents = new jalview.io.AlignmentProperties(\r
-              viewport.alignment).formatAsString();\r
+              viewport.getAlignment()).formatAsString();\r
       CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
       cap.setText(contents.toString());\r
       Frame frame = new Frame();\r
@@ -883,9 +963,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     else if (source == clustalColour)\r
     {\r
       abovePIDThreshold.setState(false);\r
-      changeColour(new ClustalxColourScheme(\r
-              viewport.alignment.getSequences(),\r
-              viewport.alignment.getWidth()));\r
+      changeColour(new ClustalxColourScheme(viewport.getAlignment(),null));\r
     }\r
     else if (source == zappoColour)\r
     {\r
@@ -919,6 +997,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {\r
       changeColour(new NucleotideColourScheme());\r
     }\r
+    else if (source == purinePyrimidineColour)\r
+    {\r
+      changeColour(new PurinePyrimidineColourScheme());\r
+    }\r
+    else if (source == RNAHelixColour)\r
+    {\r
+      new RNAHelicesColourChooser(viewport, alignPanel);\r
+    }\r
     else if (source == modifyPID)\r
     {\r
       modifyPID_actionPerformed();\r
@@ -939,6 +1025,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {\r
       changeColour(new Blosum62ColourScheme());\r
     }\r
+    else if (source == tcoffeeColour) {\r
+        changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+    }\r
     else if (source == annotationColour)\r
     {\r
       new AnnotationColourChooser(viewport, alignPanel);\r
@@ -1021,7 +1110,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   public void loadAnnotations()\r
   {\r
     CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
-    cap.setText("Paste your features / annotations file here.");\r
+    cap.setText("Paste your features / annotations / T-coffee score file here.");\r
     cap.setAnnotationImport();\r
     Frame frame = new Frame();\r
     frame.add(cap);\r
@@ -1032,10 +1121,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   public String outputAnnotations(boolean displayTextbox)\r
   {\r
     String annotation = new AnnotationFile().printAnnotations(\r
-            viewport.showAnnotation ? viewport.alignment\r
-                    .getAlignmentAnnotation() : null, viewport.alignment\r
+            viewport.showAnnotation ? viewport.getAlignment()\r
+                    .getAlignmentAnnotation() : null, viewport.getAlignment()\r
                     .getGroups(),\r
-            ((Alignment) viewport.alignment).alignmentProperties);\r
+            ((Alignment) viewport.getAlignment()).alignmentProperties);\r
 \r
     if (displayTextbox)\r
     {\r
@@ -1072,13 +1161,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     if (format.equalsIgnoreCase("Jalview"))\r
     {\r
       features = new FeaturesFile().printJalviewFormat(\r
-              viewport.alignment.getSequencesArray(),\r
+              viewport.getAlignment().getSequencesArray(),\r
               getDisplayedFeatureCols());\r
     }\r
     else\r
     {\r
       features = new FeaturesFile().printGFFFormat(\r
-              viewport.alignment.getSequencesArray(),\r
+              viewport.getAlignment().getSequencesArray(),\r
               getDisplayedFeatureCols());\r
     }\r
 \r
@@ -1090,7 +1179,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         features = "# No features visible - paste some and import them here.";\r
         frimport=true;\r
       }\r
-      \r
+\r
       CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);\r
       if (frimport)\r
       {\r
@@ -1202,8 +1291,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   public void closeMenuItem_actionPerformed()\r
   {\r
     PaintRefresher.RemoveComponent(alignPanel);\r
-    PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
-    PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+    if (alignPanel.seqPanel!=null && alignPanel.seqPanel.seqCanvas!=null)\r
+    {\r
+      PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
+    }\r
+    if (alignPanel.idPanel!=null && alignPanel.idPanel.idCanvas!=null) {\r
+      PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+    }\r
 \r
     if (PaintRefresher.components.size() == 0 && viewport.applet == null)\r
     {\r
@@ -1216,7 +1310,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   }\r
 \r
   /**\r
-   * DOCUMENT ME!\r
+   * TODO: JAL-1104\r
    */\r
   void updateEditMenuBar()\r
   {\r
@@ -1247,6 +1341,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     }\r
   }\r
 \r
+  /**\r
+   * TODO: JAL-1104\r
+   */\r
   public void addHistoryItem(CommandI command)\r
   {\r
     if (command.getSize() > 0)\r
@@ -1254,13 +1351,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       viewport.historyList.push(command);\r
       viewport.redoList.removeAllElements();\r
       updateEditMenuBar();\r
-      viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+      viewport.updateHiddenColumns();\r
     }\r
   }\r
 \r
   /**\r
+   * TODO: JAL-1104\r
    * DOCUMENT ME!\r
-   * \r
+   *\r
    * @param e\r
    *          DOCUMENT ME!\r
    */\r
@@ -1276,16 +1374,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     command.undoCommand(null);\r
 \r
     AlignViewport originalSource = getOriginatingSource(command);\r
-\r
-    originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+    // JBPNote Test\r
+    if (originalSource!=viewport) {\r
+      System.err.println("Warning: Viewport object mismatch whilst undoing");\r
+    }\r
+    originalSource.updateHiddenColumns(); //    originalSource.hasHiddenColumns = viewport.getColumnSelection().getHiddenColumns() != null;\r
     updateEditMenuBar();\r
     originalSource.firePropertyChange("alignment", null,\r
-            originalSource.alignment.getSequences());\r
+            originalSource.getAlignment().getSequences());\r
   }\r
 \r
   /**\r
+   * TODO: JAL-1104\r
    * DOCUMENT ME!\r
-   * \r
+   *\r
    * @param e\r
    *          DOCUMENT ME!\r
    */\r
@@ -1301,11 +1403,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     command.doCommand(null);\r
 \r
     AlignViewport originalSource = getOriginatingSource(command);\r
-    originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+    // JBPNote Test\r
+    if (originalSource!=viewport) {\r
+      System.err.println("Warning: Viewport object mismatch whilst re-doing");\r
+    }\r
+    originalSource.updateHiddenColumns(); //sethasHiddenColumns(); = viewport.getColumnSelection().getHiddenColumns() != null;\r
 \r
     updateEditMenuBar();\r
     originalSource.firePropertyChange("alignment", null,\r
-            originalSource.alignment.getSequences());\r
+            originalSource.getAlignment().getSequences());\r
   }\r
 \r
   AlignViewport getOriginatingSource(CommandI command)\r
@@ -1325,7 +1431,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       {\r
         if (comps.elementAt(i) instanceof AlignmentPanel)\r
         {\r
-          if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)\r
+          if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())\r
           {\r
             originalSource = ((AlignmentPanel) comps.elementAt(i)).av;\r
             break;\r
@@ -1340,7 +1446,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       // the current view against the closed view first\r
       if (al != null)\r
       {\r
-        PaintRefresher.validateSequences(al, viewport.alignment);\r
+        PaintRefresher.validateSequences(al, viewport.getAlignment());\r
       }\r
 \r
       originalSource = viewport;\r
@@ -1356,65 +1462,24 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {\r
       return;\r
     }\r
-\r
-    if (up)\r
-    {\r
-      for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
-      {\r
-        SequenceI seq = viewport.alignment.getSequenceAt(i);\r
-        if (!sg.getSequences(null).contains(seq))\r
-        {\r
-          continue;\r
-        }\r
-\r
-        SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
-        if (sg.getSequences(null).contains(temp))\r
-        {\r
-          continue;\r
-        }\r
-\r
-        viewport.alignment.getSequences().setElementAt(temp, i);\r
-        viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
-      }\r
-    }\r
-    else\r
-    {\r
-      for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
-      {\r
-        SequenceI seq = viewport.alignment.getSequenceAt(i);\r
-        if (!sg.getSequences(viewport.hiddenRepSequences).contains(seq))\r
-        {\r
-          continue;\r
-        }\r
-\r
-        SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
-        if (sg.getSequences(viewport.hiddenRepSequences).contains(temp))\r
-        {\r
-          continue;\r
-        }\r
-\r
-        viewport.alignment.getSequences().setElementAt(temp, i);\r
-        viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
-      }\r
-    }\r
-\r
+    viewport.getAlignment().moveSelectedSequencesByOne(sg, up ? null : viewport.getHiddenRepSequences(), up);\r
     alignPanel.paintAlignment(true);\r
   }\r
 \r
   synchronized void slideSequences(boolean right, int size)\r
   {\r
-    Vector sg = new Vector();\r
+    List<SequenceI>sg = new Vector<SequenceI>();\r
     if (viewport.cursorMode)\r
     {\r
-      sg.addElement(viewport.alignment\r
+      sg.add(viewport.getAlignment()\r
               .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));\r
     }\r
     else if (viewport.getSelectionGroup() != null\r
-            && viewport.getSelectionGroup().getSize() != viewport.alignment\r
+            && viewport.getSelectionGroup().getSize() != viewport.getAlignment()\r
                     .getHeight())\r
     {\r
       sg = viewport.getSelectionGroup().getSequences(\r
-              viewport.hiddenRepSequences);\r
+              viewport.getHiddenRepSequences());\r
     }\r
 \r
     if (sg.size() < 1)\r
@@ -1422,21 +1487,19 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       return;\r
     }\r
 \r
-    Vector invertGroup = new Vector();\r
+    Vector<SequenceI> invertGroup = new Vector();\r
 \r
-    for (int i = 0; i < viewport.alignment.getHeight(); i++)\r
+    for (int i = 0; i < viewport.getAlignment().getHeight(); i++)\r
     {\r
-      if (!sg.contains(viewport.alignment.getSequenceAt(i)))\r
-        invertGroup.addElement(viewport.alignment.getSequenceAt(i));\r
+      if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))\r
+        invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));\r
     }\r
 \r
-    SequenceI[] seqs1 = new SequenceI[sg.size()];\r
-    for (int i = 0; i < sg.size(); i++)\r
-      seqs1[i] = (SequenceI) sg.elementAt(i);\r
+    SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);\r
 \r
-    SequenceI[] seqs2 = new SequenceI[invertGroup.size()];\r
+    SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup.size()]);\r
     for (int i = 0; i < invertGroup.size(); i++)\r
-      seqs2[i] = (SequenceI) invertGroup.elementAt(i);\r
+      seqs2[i] = invertGroup.elementAt(i);\r
 \r
     SlideSequencesCommand ssc;\r
     if (right)\r
@@ -1502,14 +1565,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     for (int i = 0; i < sg.getSize(); i++)\r
     {\r
       SequenceI seq = sg.getSequenceAt(i);\r
-      int index = viewport.alignment.findIndex(seq);\r
+      int index = viewport.getAlignment().findIndex(seq);\r
       orderedSeqs.put(index + "", seq);\r
     }\r
 \r
     int index = 0, startRes, endRes;\r
     char ch;\r
 \r
-    if (viewport.hasHiddenColumns && viewport.getSelectionGroup() != null)\r
+    if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)\r
     {\r
       copiedHiddenColumns = new Vector();\r
       int hiddenOffset = viewport.getSelectionGroup().getStartRes();\r
@@ -1656,17 +1719,17 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   {\r
     for (int i = 0; i < seqs.length; i++)\r
     {\r
-      viewport.alignment.addSequence(seqs[i]);\r
+      viewport.getAlignment().addSequence(seqs[i]);\r
     }\r
 \r
     // !newAlignment\r
     addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,\r
-            seqs, 0, viewport.alignment.getWidth(), viewport.alignment));\r
+            seqs, 0, viewport.getAlignment().getWidth(), viewport.getAlignment()));\r
 \r
-    viewport.setEndSeq(viewport.alignment.getHeight());\r
-    viewport.alignment.getWidth();\r
+    viewport.setEndSeq(viewport.getAlignment().getHeight());\r
+    viewport.getAlignment().getWidth();\r
     viewport.firePropertyChange("alignment", null,\r
-            viewport.alignment.getSequences());\r
+            viewport.getAlignment().getSequences());\r
 \r
   }\r
 \r
@@ -1694,7 +1757,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     }\r
 \r
     // If the cut affects all sequences, remove highlighted columns\r
-    if (sg.getSize() == viewport.alignment.getHeight())\r
+    if (sg.getSize() == viewport.getAlignment().getHeight())\r
     {\r
       viewport.getColumnSelection().removeElements(sg.getStartRes(),\r
               sg.getEndRes() + 1);\r
@@ -1711,10 +1774,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
      */\r
     addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,\r
             sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
 \r
     viewport.setSelectionGroup(null);\r
-    viewport.alignment.deleteGroup(sg);\r
+    viewport.getAlignment().deleteGroup(sg);\r
 \r
     viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
             .getSequences());\r
@@ -1728,7 +1791,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * group consensus toggled\r
-   * \r
+   *\r
    */\r
   protected void showGroupConsensus_actionPerformed()\r
   {\r
@@ -1748,7 +1811,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /*\r
    * (non-Javadoc)\r
-   * \r
+   *\r
    * @see\r
    * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt\r
    * .event.ActionEvent)\r
@@ -1760,7 +1823,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   }\r
   /*\r
    * (non-Javadoc)\r
-   * \r
+   *\r
    * @see\r
    * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt\r
    * .event.ActionEvent)\r
@@ -1784,8 +1847,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
               viewport.getSequenceSelection(),\r
               viewport.getAlignmentView(true).getSequenceStrings(\r
                       viewport.getGapCharacter()),\r
-              viewport.alignment.getGroups());\r
-      viewport.alignment.deleteAllGroups();\r
+              viewport.getAlignment().getGroups());\r
+      viewport.getAlignment().deleteAllGroups();\r
       viewport.sequenceColours = null;\r
       viewport.setSelectionGroup(null);\r
       // set view properties for each group\r
@@ -1793,13 +1856,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       {\r
         // gps[g].setShowunconserved(viewport.getShowUnconserved());\r
         gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());\r
-        viewport.alignment.addGroup(gps[g]);\r
+        viewport.getAlignment().addGroup(gps[g]);\r
         Color col = new Color((int) (Math.random() * 255),\r
                 (int) (Math.random() * 255), (int) (Math.random() * 255));\r
         col = col.brighter();\r
-        for (Enumeration sq = gps[g].getSequences(null).elements(); sq\r
-                .hasMoreElements(); viewport.setSequenceColour(\r
-                (SequenceI) sq.nextElement(), col))\r
+        for (SequenceI sq : gps[g].getSequences(null))\r
+          viewport.setSequenceColour(\r
+                sq, col)\r
           ;\r
       }\r
       PaintRefresher.Refresh(this, viewport.getSequenceSetId());\r
@@ -1810,7 +1873,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   protected void deleteGroups_actionPerformed()\r
   {\r
-    viewport.alignment.deleteAllGroups();\r
+    viewport.getAlignment().deleteAllGroups();\r
     viewport.sequenceColours = null;\r
     viewport.setSelectionGroup(null);\r
 \r
@@ -1824,7 +1887,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     {\r
       sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
     }\r
-    sg.setEndRes(viewport.alignment.getWidth() - 1);\r
+    sg.setEndRes(viewport.getAlignment().getWidth() - 1);\r
     viewport.setSelectionGroup(sg);\r
     alignPanel.paintAlignment(true);\r
     PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
@@ -1888,11 +1951,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       if (viewport.getSelectionGroup() != null)\r
       {\r
         seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
-                viewport.hiddenRepSequences);\r
+                viewport.getHiddenRepSequences());\r
       }\r
       else\r
       {\r
-        seqs = viewport.alignment.getSequencesArray();\r
+        seqs = viewport.getAlignment().getSequencesArray();\r
       }\r
 \r
       TrimRegionCommand trimRegion;\r
@@ -1900,32 +1963,30 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       {\r
         trimRegion = new TrimRegionCommand("Remove Left",\r
                 TrimRegionCommand.TRIM_LEFT, seqs, column,\r
-                viewport.alignment, viewport.colSel,\r
-                viewport.selectionGroup);\r
+                viewport.getAlignment(), viewport.getColumnSelection(),\r
+                viewport.getSelectionGroup());\r
         viewport.setStartRes(0);\r
       }\r
       else\r
       {\r
         trimRegion = new TrimRegionCommand("Remove Right",\r
                 TrimRegionCommand.TRIM_RIGHT, seqs, column,\r
-                viewport.alignment, viewport.colSel,\r
-                viewport.selectionGroup);\r
+                viewport.getAlignment(), viewport.getColumnSelection(),\r
+                viewport.getSelectionGroup());\r
       }\r
 \r
       statusBar.setText("Removed " + trimRegion.getSize() + " columns.");\r
 \r
       addHistoryItem(trimRegion);\r
 \r
-      Vector groups = viewport.alignment.getGroups();\r
 \r
-      for (int i = 0; i < groups.size(); i++)\r
-      {\r
-        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
 \r
+      for (SequenceGroup sg:viewport.getAlignment().getGroups())\r
+      {\r
         if ((trimLeft && !sg.adjustForRemoveLeft(column))\r
                 || (!trimLeft && !sg.adjustForRemoveRight(column)))\r
         {\r
-          viewport.alignment.deleteGroup(sg);\r
+          viewport.getAlignment().deleteGroup(sg);\r
         }\r
       }\r
 \r
@@ -1936,23 +1997,23 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   public void removeGappedColumnMenuItem_actionPerformed()\r
   {\r
-    int start = 0, end = viewport.alignment.getWidth() - 1;\r
+    int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
 \r
     SequenceI[] seqs;\r
     if (viewport.getSelectionGroup() != null)\r
     {\r
       seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
-              viewport.hiddenRepSequences);\r
+              viewport.getHiddenRepSequences());\r
       start = viewport.getSelectionGroup().getStartRes();\r
       end = viewport.getSelectionGroup().getEndRes();\r
     }\r
     else\r
     {\r
-      seqs = viewport.alignment.getSequencesArray();\r
+      seqs = viewport.getAlignment().getSequencesArray();\r
     }\r
 \r
     RemoveGapColCommand removeGapCols = new RemoveGapColCommand(\r
-            "Remove Gapped Columns", seqs, start, end, viewport.alignment);\r
+            "Remove Gapped Columns", seqs, start, end, viewport.getAlignment());\r
 \r
     addHistoryItem(removeGapCols);\r
 \r
@@ -1961,7 +2022,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
     // This is to maintain viewport position on first residue\r
     // of first sequence\r
-    SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+    SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
     int startRes = seq.findPosition(viewport.startRes);\r
     // ShiftList shifts;\r
     // viewport.getAlignment().removeGaps(shifts=new ShiftList());\r
@@ -1976,28 +2037,28 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   public void removeAllGapsMenuItem_actionPerformed()\r
   {\r
-    int start = 0, end = viewport.alignment.getWidth() - 1;\r
+    int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
 \r
     SequenceI[] seqs;\r
     if (viewport.getSelectionGroup() != null)\r
     {\r
       seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
-              viewport.hiddenRepSequences);\r
+              viewport.getHiddenRepSequences());\r
       start = viewport.getSelectionGroup().getStartRes();\r
       end = viewport.getSelectionGroup().getEndRes();\r
     }\r
     else\r
     {\r
-      seqs = viewport.alignment.getSequencesArray();\r
+      seqs = viewport.getAlignment().getSequencesArray();\r
     }\r
 \r
     // This is to maintain viewport position on first residue\r
     // of first sequence\r
-    SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+    SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
     int startRes = seq.findPosition(viewport.startRes);\r
 \r
     addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
 \r
     viewport.setStartRes(seq.findIndex(startRes) - 1);\r
 \r
@@ -2013,37 +2074,37 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * create a new view derived from the current view\r
-   * \r
+   *\r
    * @param viewtitle\r
    * @return frame for the new view\r
    */\r
   public AlignFrame newView(String viewtitle)\r
   {\r
     AlignmentI newal;\r
-    if (viewport.hasHiddenRows)\r
+    if (viewport.hasHiddenRows())\r
     {\r
       newal = new Alignment(viewport.getAlignment().getHiddenSequences()\r
               .getFullAlignment().getSequencesArray());\r
     }\r
     else\r
     {\r
-      newal = new Alignment(viewport.alignment.getSequencesArray());\r
+      newal = new Alignment(viewport.getAlignment().getSequencesArray());\r
     }\r
 \r
-    if (viewport.alignment.getAlignmentAnnotation() != null)\r
+    if (viewport.getAlignment().getAlignmentAnnotation() != null)\r
     {\r
-      for (int i = 0; i < viewport.alignment.getAlignmentAnnotation().length; i++)\r
+      for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)\r
       {\r
-        if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)\r
+        if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)\r
         {\r
-          newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);\r
+          newal.addAnnotation(viewport.getAlignment().getAlignmentAnnotation()[i]);\r
         }\r
       }\r
     }\r
 \r
     AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);\r
 \r
-    newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();\r
+    newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());\r
     PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());\r
     PaintRefresher.Register(newaf.alignPanel,\r
             newaf.alignPanel.av.getSequenceSetId());\r
@@ -2086,7 +2147,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   }\r
 \r
   /**\r
-   * \r
+   *\r
    * @return list of feature groups on the view\r
    */\r
   public String[] getFeatureGroups()\r
@@ -2102,7 +2163,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * get sequence feature groups that are hidden or shown\r
-   * \r
+   *\r
    * @param visible\r
    *          true is visible\r
    * @return list\r
@@ -2120,7 +2181,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * Change the display state for the given feature groups\r
-   * \r
+   *\r
    * @param groups\r
    *          list of group strings\r
    * @param state\r
@@ -2188,11 +2249,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
             overview.getPreferredSize().height + 50);\r
 \r
     frame.pack();\r
+    final AlignmentPanel ap=alignPanel;\r
     frame.addWindowListener(new WindowAdapter()\r
     {\r
+      @Override\r
       public void windowClosing(WindowEvent e)\r
       {\r
-        alignPanel.setOverviewPanel(null);\r
+        if (ap!=null) {\r
+          ap.setOverviewPanel(null);\r
+        }\r
       };\r
     });\r
 \r
@@ -2223,13 +2288,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       if (viewport.getConservationSelected())\r
       {\r
 \r
-        Alignment al = (Alignment) viewport.alignment;\r
+        Alignment al = (Alignment) viewport.getAlignment();\r
         Conservation c = new Conservation("All",\r
                 ResidueProperties.propHash, 3, al.getSequences(), 0,\r
                 al.getWidth() - 1);\r
 \r
         c.calculate();\r
-        c.verdict(false, viewport.ConsPercGaps);\r
+        c.verdict(false, viewport.getConsPercGaps());\r
 \r
         cs.setConservation(c);\r
 \r
@@ -2242,73 +2307,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         cs.setConservation(null);\r
       }\r
 \r
-      cs.setConsensus(viewport.hconsensus);\r
+      cs.setConsensus(viewport.getSequenceConsensusHash());\r
 \r
     }\r
     viewport.setGlobalColourScheme(cs);\r
 \r
-    if (viewport.getColourAppliesToAllGroups())\r
-    {\r
-      Vector groups = viewport.alignment.getGroups();\r
-      for (int i = 0; i < groups.size(); i++)\r
-      {\r
-        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-\r
-        if (cs == null)\r
-        {\r
-          sg.cs = null;\r
-          continue;\r
-        }\r
-        if (cs instanceof ClustalxColourScheme)\r
-        {\r
-          sg.cs = new ClustalxColourScheme(\r
-                  sg.getSequences(viewport.hiddenRepSequences),\r
-                  sg.getWidth());\r
-        }\r
-        else\r
-        {\r
-          try\r
-          {\r
-            sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
-          } catch (Exception ex)\r
-          {\r
-            ex.printStackTrace();\r
-            sg.cs = cs;\r
-          }\r
-        }\r
-\r
-        if (viewport.getAbovePIDThreshold()\r
-                || cs instanceof PIDColourScheme\r
-                || cs instanceof Blosum62ColourScheme)\r
-        {\r
-          sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());\r
-          sg.cs.setConsensus(AAFrequency.calculate(\r
-                  sg.getSequences(viewport.hiddenRepSequences), 0,\r
-                  sg.getWidth()));\r
-        }\r
-        else\r
-        {\r
-          sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
-        }\r
-\r
-        if (viewport.getConservationSelected())\r
-        {\r
-          Conservation c = new Conservation("Group",\r
-                  ResidueProperties.propHash, 3,\r
-                  sg.getSequences(viewport.hiddenRepSequences), 0,\r
-                  viewport.alignment.getWidth() - 1);\r
-          c.calculate();\r
-          c.verdict(false, viewport.ConsPercGaps);\r
-          sg.cs.setConservation(c);\r
-        }\r
-        else\r
-        {\r
-          sg.cs.setConservation(null);\r
-          sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
-        }\r
-\r
-      }\r
-    }\r
 \r
     if (alignPanel.getOverviewPanel() != null)\r
     {\r
@@ -2325,7 +2328,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   protected void modifyPID_actionPerformed()\r
   {\r
     if (viewport.getAbovePIDThreshold()\r
-            && viewport.globalColourScheme != null)\r
+            && viewport.getGlobalColourScheme() != null)\r
     {\r
       SliderPanel.setPIDSliderSource(alignPanel,\r
               viewport.getGlobalColourScheme(), "Background");\r
@@ -2336,10 +2339,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   protected void modifyConservation_actionPerformed()\r
   {\r
     if (viewport.getConservationSelected()\r
-            && viewport.globalColourScheme != null)\r
+            && viewport.getGlobalColourScheme() != null)\r
     {\r
       SliderPanel.setConservationSlider(alignPanel,\r
-              viewport.globalColourScheme, "Background");\r
+              viewport.getGlobalColourScheme(), "Background");\r
       SliderPanel.showConservationSlider();\r
     }\r
   }\r
@@ -2375,7 +2378,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
             .getAlignment().getSequenceAt(0), null);\r
 \r
     addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
     alignPanel.paintAlignment(true);\r
   }\r
 \r
@@ -2383,7 +2386,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   {\r
     SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
     AlignmentSorter.sortByID(viewport.getAlignment());\r
-    addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));\r
+    addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.getAlignment()));\r
     alignPanel.paintAlignment(true);\r
   }\r
 \r
@@ -2392,7 +2395,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
     AlignmentSorter.sortByLength(viewport.getAlignment());\r
     addHistoryItem(new OrderCommand("Length Sort", oldOrder,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
     alignPanel.paintAlignment(true);\r
   }\r
 \r
@@ -2401,7 +2404,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
     AlignmentSorter.sortByGroup(viewport.getAlignment());\r
     addHistoryItem(new OrderCommand("Group Sort", oldOrder,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
     alignPanel.paintAlignment(true);\r
 \r
   }\r
@@ -2426,7 +2429,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   public void PCAMenuItem_actionPerformed()\r
   {\r
     // are the sequences aligned?\r
-    if (!viewport.alignment.isAligned(false))\r
+    if (!viewport.getAlignment().isAligned(false))\r
     {\r
       SequenceI current;\r
       int Width = viewport.getAlignment().getWidth();\r
@@ -2483,7 +2486,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   void NewTreePanel(String type, String pwType, String title)\r
   {\r
     // are the sequences aligned?\r
-    if (!viewport.alignment.isAligned(false))\r
+    if (!viewport.getAlignment().isAligned(false))\r
     {\r
       SequenceI current;\r
       int Width = viewport.getAlignment().getWidth();\r
@@ -2503,7 +2506,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
     if ((viewport.getSelectionGroup() != null && viewport\r
             .getSelectionGroup().getSize() > 1)\r
-            || (viewport.getSelectionGroup() == null && viewport.alignment\r
+            || (viewport.getSelectionGroup() == null && viewport.getAlignment()\r
                     .getHeight() > 1))\r
     {\r
       final TreePanel tp = new TreePanel(alignPanel, type, pwType);\r
@@ -2533,7 +2536,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * sort the alignment using the given treePanel\r
-   * \r
+   *\r
    * @param treePanel\r
    *          tree used to sort view\r
    * @param title\r
@@ -2547,14 +2550,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     // addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
     // HistoryItem.SORT));\r
     addHistoryItem(new OrderCommand("Order by " + title, oldOrder,\r
-            viewport.alignment));\r
+            viewport.getAlignment()));\r
     alignPanel.paintAlignment(true);\r
   }\r
 \r
   /**\r
    * Do any automatic reordering of the alignment and add the necessary bits to\r
    * the menu structure for the new tree\r
-   * \r
+   *\r
    * @param treePanel\r
    * @param title\r
    */\r
@@ -2565,14 +2568,16 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     sortByTreeMenu.add(item);\r
     item.addActionListener(new java.awt.event.ActionListener()\r
     {\r
+      @Override\r
       public void actionPerformed(ActionEvent evt)\r
       {\r
         sortByTree(treePanel, title); // treePanel.getTitle());\r
       }\r
     });\r
-    \r
+\r
     treePanel.addWindowListener(new WindowAdapter()\r
     {\r
+      @Override\r
       public void windowOpened(WindowEvent e)\r
       {\r
         if (viewport.sortByTree)\r
@@ -2582,6 +2587,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         super.windowOpened(e);\r
       }\r
 \r
+      @Override\r
       public void windowClosing(WindowEvent e)\r
       {\r
         sortByTreeMenu.remove(item);\r
@@ -2599,7 +2605,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     AlignmentSorter.sortBy(viewport.getAlignment(), alorder);\r
     if (undoname!=null)\r
     {\r
-      addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.alignment));\r
+      addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.getAlignment()));\r
     }\r
     alignPanel.paintAlignment(true);\r
     return true;\r
@@ -2625,6 +2631,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
         this.builddate = builddate;\r
       }\r
 \r
+      @Override\r
       public void paint(Graphics g)\r
       {\r
         g.setColor(Color.white);\r
@@ -2767,12 +2774,17 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   MenuItem buriedColour = new MenuItem();\r
 \r
+  MenuItem purinePyrimidineColour = new MenuItem();\r
+  MenuItem RNAHelixColour = new MenuItem();\r
+\r
   MenuItem userDefinedColour = new MenuItem();\r
 \r
   MenuItem PIDColour = new MenuItem();\r
 \r
   MenuItem BLOSUM62Colour = new MenuItem();\r
 \r
+  MenuItem tcoffeeColour = new MenuItem();\r
+\r
   MenuItem njTreeBlosumMenuItem = new MenuItem();\r
 \r
   MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
@@ -2858,7 +2870,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
 \r
   CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();\r
-  \r
+\r
   CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();\r
   Menu autoAnnMenu=new Menu();\r
   CheckboxMenuItem showSequenceLogo= new CheckboxMenuItem();\r
@@ -2883,6 +2895,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
       item.addActionListener(new java.awt.event.ActionListener()\r
       {\r
+        @Override\r
         public void actionPerformed(ActionEvent e)\r
         {\r
           outputText_actionPerformed(e);\r
@@ -2955,14 +2968,20 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     turnColour.addActionListener(this);\r
     buriedColour.setLabel("Buried Index");\r
     buriedColour.addActionListener(this);\r
+    purinePyrimidineColour.setLabel("Purine/Pyrimidine");\r
+    purinePyrimidineColour.addActionListener(this);\r
+    RNAHelixColour.setLabel("by RNA Helices");\r
+    RNAHelixColour.addActionListener(this);\r
     userDefinedColour.setLabel("User Defined...");\r
     userDefinedColour.addActionListener(this);\r
     PIDColour.setLabel("Percentage Identity");\r
     PIDColour.addActionListener(this);\r
     BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
     BLOSUM62Colour.addActionListener(this);\r
-    avDistanceTreeBlosumMenuItem\r
-            .setLabel("Average Distance Using BLOSUM62");\r
+    tcoffeeColour.setLabel("T-Coffee Scores");\r
+    tcoffeeColour.setEnabled(false);   // it will enabled only if a score file is provided\r
+    tcoffeeColour.addActionListener(this);\r
+    avDistanceTreeBlosumMenuItem .setLabel("Average Distance Using BLOSUM62");\r
     avDistanceTreeBlosumMenuItem.addActionListener(this);\r
     njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
     njTreeBlosumMenuItem.addActionListener(this);\r
@@ -3077,7 +3096,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     applyAutoAnnotationSettings.setLabel("Apply to all groups");\r
     applyAutoAnnotationSettings.setState(true);\r
     autoAnnMenu.setLabel("Autocalculated Annotation");\r
-    \r
+\r
     invertColSel.addActionListener(this);\r
     showColumns.addActionListener(this);\r
     showSeqs.addActionListener(this);\r
@@ -3168,6 +3187,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     colourMenu.add(turnColour);\r
     colourMenu.add(buriedColour);\r
     colourMenu.add(nucleotideColour);\r
+    colourMenu.add(purinePyrimidineColour);\r
+    colourMenu.add(tcoffeeColour);\r
     colourMenu.add(userDefinedColour);\r
     colourMenu.addSeparator();\r
     colourMenu.add(conservationMenuItem);\r
@@ -3175,6 +3196,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
     colourMenu.add(abovePIDThreshold);\r
     colourMenu.add(modifyPID);\r
     colourMenu.add(annotationColour);\r
+    colourMenu.add(RNAHelixColour);\r
     calculateMenu.add(sort);\r
     calculateMenu.add(calculate);\r
     calculateMenu.addSeparator();\r
@@ -3262,7 +3284,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
    * Attach the alignFrame panels after embedding menus, if necessary. This used\r
    * to be called setEmbedded, but is now creates the dropdown menus in a\r
    * platform independent manner to avoid OSX/Mac menu appendage daftness.\r
-   * \r
+   *\r
    * @param reallyEmbedded\r
    *          true to attach the view to the applet area on the page rather than\r
    *          in a new window\r
@@ -3290,14 +3312,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
       final AlignFrame me = this;\r
       viewport.applet.addFocusListener(new FocusListener()\r
       {\r
-        \r
+\r
         @Override\r
         public void focusLost(FocusEvent e)\r
         {\r
           if (me.viewport.applet.currentAlignFrame==me) {\r
                   me.viewport.applet.currentAlignFrame = null;\r
         }}\r
-        \r
+\r
         @Override\r
         public void focusGained(FocusEvent e)\r
         {\r
@@ -3332,7 +3354,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
    * structures in the original jmol window. Note This method doesn't work\r
    * without an additional javascript library to exchange messages between the\r
    * distinct applets. See http://issues.jalview.org/browse/JAL-621\r
-   * \r
+   *\r
    * @param viewer\r
    *          JmolViewer instance\r
    * @param sequenceIds\r
@@ -3397,7 +3419,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   }\r
   /**\r
    * bind a pdb file to a sequence in the current view\r
-   * \r
+   *\r
    * @param sequenceId\r
    *          - sequenceId within the dataset.\r
    * @param pdbEntryString\r
@@ -3569,7 +3591,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   /**\r
    * modify the current selection, providing the user has not made a selection already.\r
-   * @param sel - sequences from this alignment \r
+   * @param sel - sequences from this alignment\r
    * @param csel - columns to be selected on the alignment\r
    */\r
   public void select(SequenceGroup sel, ColumnSelection csel)\r
@@ -3579,15 +3601,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
 \r
   public void scrollTo(int row, int column)\r
   {\r
-    alignPanel.seqPanel.scrollTo(row, column);    \r
+    alignPanel.seqPanel.scrollTo(row, column);\r
   }\r
   public void scrollToRow(int row)\r
   {\r
-    alignPanel.seqPanel.scrollToRow(row);    \r
+    alignPanel.seqPanel.scrollToRow(row);\r
   }\r
   public void scrollToColumn(int column)\r
   {\r
-    alignPanel.seqPanel.scrollToColumn(column);    \r
+    alignPanel.seqPanel.scrollToColumn(column);\r
   }\r
   /**\r
    * @return the alignments unique ID.\r
@@ -3595,4 +3617,51 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
   public String getSequenceSetId() {\r
     return viewport.getSequenceSetId();\r
   }\r
+\r
+\r
+  /**\r
+   * Load the (T-Coffee) score file from the specified url\r
+   *\r
+   * @param source File/URL/T-COFFEE score file contents\r
+   * @throws IOException\r
+   * @return true if alignment was annotated with data from source\r
+   */\r
+  public boolean loadScoreFile( String source ) throws IOException {\r
+\r
+    TCoffeeScoreFile file = new TCoffeeScoreFile(source, AppletFormatAdapter.checkProtocol(source));\r
+         if( !file.isValid()) {\r
+           // TODO: raise dialog for gui\r
+           System.err.println("Problems parsing T-Coffee scores: "+file.getWarningMessage());\r
+           System.err.println("Origin was:\n"+source);\r
+           return false;\r
+         }\r
+\r
+         /*\r
+          * check that the score matrix matches the alignment dimensions\r
+          */\r
+         AlignmentI aln;\r
+         if( (aln=viewport.getAlignment()) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) {\r
+           // TODO: raise a dialog box here rather than bomb out.\r
+           System.err.println("The scores matrix does not match the alignment dimensions");\r
+\r
+         }\r
+\r
+          // TODO add parameter to indicate if matching should be done\r
+         if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
+         {\r
+           alignPanel.fontChanged();\r
+           tcoffeeColour.setEnabled(true);\r
+                 // switch to this color\r
+                 changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+                 return true;\r
+          } else {\r
+            System.err.println("Problems resolving T-Coffee scores:");\r
+            if (file.getWarningMessage()!=null) {\r
+              System.err.println(file.getWarningMessage());\r
+            }\r
+          }\r
+         return false;\r
+  }\r
+\r
+\r
 }\r
index ff8f7df..e0a6a71 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -22,14 +22,18 @@ import java.util.*;
 import java.awt.*;
 
 import jalview.analysis.*;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
 import jalview.bin.*;
 import jalview.datamodel.*;
 import jalview.schemes.*;
 import jalview.structure.SelectionSource;
-import jalview.structure.StructureSelectionManager;
 import jalview.structure.VamsasSource;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.workers.ConservationThread;
+import jalview.workers.ConsensusThread;
 
-public class AlignViewport implements SelectionSource, VamsasSource
+public class AlignViewport extends AlignmentViewport implements AlignViewportI, SelectionSource, VamsasSource 
 {
   int startRes;
 
@@ -57,23 +61,8 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   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;
 
@@ -85,10 +74,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   boolean validCharWidth = true;
 
-  AlignmentI alignment;
-
-  ColumnSelection colSel = new ColumnSelection();
-
   int threshold;
 
   int increment;
@@ -105,33 +90,9 @@ public class AlignViewport implements SelectionSource, VamsasSource
   // 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;
@@ -141,11 +102,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
   Stack historyList = new Stack();
 
   Stack redoList = new Stack();
-
-  String sequenceSetID;
-
-  Hashtable hiddenRepSequences;
-  
+    
   public void finalize() {
     applet=null;
     quality=null;
@@ -155,8 +112,11 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   public AlignViewport(AlignmentI al, JalviewLite applet)
   {
+    calculator = new jalview.workers.AlignCalcManager();
     this.applet = applet;
     setAlignment(al);
+    // we always pad gaps
+    this.setPadGaps(true);
     this.startRes = 0;
     this.endRes = al.getWidth() - 1;
     this.startSeq = 0;
@@ -243,7 +203,9 @@ public class AlignViewport implements SelectionSource, VamsasSource
       followSelection = followHighlight;
 
       showSequenceLogo = applet.getDefaultParameter("showSequenceLogo", showSequenceLogo);
-      
+
+      normaliseSequenceLogo = applet.getDefaultParameter("normaliseSequenceLogo", normaliseSequenceLogo);
+
       showGroupConsensus = applet.getDefaultParameter("showGroupConsensus", showGroupConsensus);
       
       showGroupConservation = applet.getDefaultParameter("showGroupConservation", showGroupConservation);
@@ -281,44 +243,7 @@ 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);
-      }
-    }
+    initAutoAnnotation();
 
   }
 
@@ -332,282 +257,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     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);
-    }
-
-    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);
-      }
-    }
-  }
 
   /**
    * get the consensus sequence as displayed under the PID consensus annotation
@@ -646,36 +295,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;
@@ -691,16 +310,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     return startSeq;
   }
 
-  public void setGlobalColourScheme(ColourSchemeI cs)
-  {
-    globalColourScheme = cs;
-  }
-
-  public ColourSchemeI getGlobalColourScheme()
-  {
-    return globalColourScheme;
-  }
-
   public void setStartRes(int res)
   {
     this.startRes = res;
@@ -889,20 +498,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     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());
@@ -918,16 +513,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     return currentTree;
   }
 
-  public void setColourAppliesToAllGroups(boolean b)
-  {
-    colourAppliesToAllGroups = b;
-  }
-
-  public boolean getColourAppliesToAllGroups()
-  {
-    return colourAppliesToAllGroups;
-  }
-
   public boolean getShowJVSuffix()
   {
     return showJVSuffix;
@@ -990,390 +575,9 @@ public class AlignViewport implements SelectionSource, VamsasSource
     }
   }
 
-  /**
-   * 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 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)
-  {
-    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());
-      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()
-  {
-    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
-   */
-  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];
-
-    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()
   {
@@ -1414,103 +618,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     }
   }
 
-  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);
-      }
-    }
-
-    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();
-    }
-  }
-
   boolean centreColumnLabels;
 
   public boolean getCentreColumnLabels()
@@ -1520,16 +627,14 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   public void updateSequenceIdColours()
   {
-    Vector groups = alignment.getGroups();
-    for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
+    
+    for (SequenceGroup sg:alignment.getGroups())
     {
-      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++)
+        for (SequenceI s:sg.getSequences(getHiddenRepSequences()))
         {
-          this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
+          this.setSequenceColour(s, sg.idColour);
         }
       }
     }
@@ -1552,42 +657,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
   {
     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)
-    {
-      colselhash = hc;
-      return true;
-    }
-    return false;
-  }
   public void sendSelection()
   {
     jalview.structure.StructureSelectionManager
@@ -1600,133 +669,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
 
   /**
-   * 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)
-    {
-      // TODO: decouple settings setting from calculation when refactoring
-      // annotation update method from alignframe to viewport
-      this.showSequenceLogo = showSequenceLogo;
-      if (consensusThread != null)
-      {
-        consensusThread.updateAnnotation();
-      }
-    }
-    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.
@@ -1758,4 +700,30 @@ public class AlignViewport implements SelectionSource, VamsasSource
       }
     }
   }
+
+  @Override
+  public boolean hasHiddenColumns()
+  {
+    return hasHiddenColumns;
+  }
+  
+  public boolean isNormaliseSequenceLogo()
+  {
+    return normaliseSequenceLogo;
+  }
+
+  public void setNormaliseSequenceLogo(boolean state)
+  {
+    normaliseSequenceLogo = state;
+  }
+
+  /**
+   * 
+   * @return true if alignment characters should be displayed 
+   */
+  public boolean isValidCharWidth()
+  {
+    return validCharWidth;
+  }
+
 }
index 08d1f85..e9d418e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -286,13 +286,14 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
     // 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
@@ -327,13 +328,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
            int startv, endv, starts, ends, width;
 
          int start=-1;
-    if (av.hasHiddenColumns)
+    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;
@@ -373,18 +374,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
                 || (av.getEndRes() < start)
                 || ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
         {
-          if (start > av.alignment.getWidth() - hextent)
+          if (start > av.getAlignment().getWidth() - hextent)
           {
-            start = av.alignment.getWidth() - hextent;
+            start = av.getAlignment().getWidth() - hextent;
             if (start < 0)
             {
               start = 0;
             }
 
           }
-          if (seqIndex > av.alignment.getHeight() - vextent)
+          if (seqIndex > av.getAlignment().getHeight() - vextent)
           {
-            seqIndex = av.alignment.getHeight() - vextent;
+            seqIndex = av.getAlignment().getHeight() - vextent;
             if (seqIndex < 0)
             {
               seqIndex = 0;
@@ -588,10 +589,10 @@ 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);
     }
@@ -636,9 +637,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
     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);
@@ -768,9 +769,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
     
     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;
       }
@@ -918,10 +919,10 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
     // remove old automatic annotation
     // add any new annotation
 
-    Vector gr = av.alignment.getGroups(); // OrderedBy(av.alignment.getSequencesArray());
+    ; // OrderedBy(av.alignment.getSequencesArray());
     // intersect alignment annotation with alignment groups
 
-    AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
     Hashtable oldrfs = new Hashtable();
     if (aan != null)
     {
@@ -930,18 +931,16 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
         if (aan[an].autoCalculated && aan[an].groupRef != null)
         {
           oldrfs.put(aan[an].groupRef, aan[an].groupRef);
-          av.alignment.deleteAnnotation(aan[an]);
+          av.getAlignment().deleteAnnotation(aan[an]);
           aan[an] = null;
         }
       }
     }
-    SequenceGroup sg;
-    if (gr != null)
+    if (av.getAlignment().getGroups()!= null)
     {
-      for (int g = 0; g < gr.size(); g++)
+      for (SequenceGroup sg:av.getAlignment().getGroups())
       {
         updateCalcs = false;
-        sg = (SequenceGroup) gr.elementAt(g);
         if (applyGlobalSettings || !oldrfs.containsKey(sg))
         {
           // set defaults for this group's conservation/consensus
@@ -951,12 +950,12 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
         if (conv)
         {
           updateCalcs = true;
-          av.alignment.addAnnotation(sg.getConservationRow(), 0);
+          av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
         }
         if (cons)
         {
           updateCalcs = true;
-          av.alignment.addAnnotation(sg.getConsensus(), 0);
+          av.getAlignment().addAnnotation(sg.getConsensus(), 0);
         }
         // refresh the annotation rows
         if (updateCalcs)
@@ -972,12 +971,19 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, Alignme
   @Override
   public AlignmentI getAlignment()
   {
-    return av.alignment;
+    return av.getAlignment();
   }
   @Override
   public StructureSelectionManager getStructureSelectionManager()
   {
     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();
+  }
 
 }
index 5463ed8..1a661be 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -55,14 +55,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,7 +76,7 @@ public class AnnotationColourChooser extends Panel implements
     slider.addAdjustmentListener(this);
     slider.addMouseListener(this);
 
-    if (av.alignment.getAlignmentAnnotation() == null)
+    if (av.getAlignment().getAlignmentAnnotation() == null)
     {
       return;
     }
@@ -100,9 +97,9 @@ public class AnnotationColourChooser extends Panel implements
 
     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
@@ -395,7 +392,7 @@ public class AnnotationColourChooser extends Panel implements
       return;
     }
 
-    currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+    currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
             .getSelectedIndex()];
 
     int aboveThreshold = -1;
@@ -464,14 +461,11 @@ public class AnnotationColourChooser extends Panel implements
 
     av.setGlobalColourScheme(acg);
 
-    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);
-
+     
         if (sg.cs == null)
         {
           continue;
@@ -499,13 +493,10 @@ public class AnnotationColourChooser extends Panel implements
   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)
         {
index 5140024..635535c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -107,7 +107,7 @@ 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 +134,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))
     {
@@ -228,7 +228,7 @@ 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);
@@ -337,17 +337,17 @@ public class AnnotationLabels extends Panel implements ActionListener,
       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;
@@ -395,7 +395,7 @@ public class AnnotationLabels extends Panel implements ActionListener,
     // 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)
@@ -622,7 +622,7 @@ 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++)
@@ -665,7 +665,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;
 
index 7d1333b..7e6e3a1 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -21,14 +21,13 @@ import java.util.*;
 
 import java.awt.*;
 import java.awt.event.*;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
 
-import jalview.analysis.AAFrequency;
 import jalview.datamodel.*;
-import jalview.schemes.ColourSchemeI;
+import jalview.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
 
-public class AnnotationPanel extends Panel implements AdjustmentListener,
+public class AnnotationPanel extends Panel implements AwtRenderPanelI, AdjustmentListener,
         ActionListener, MouseListener, MouseMotionListener
 {
   AlignViewport av;
@@ -39,19 +38,24 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
 
   Vector activeRes;
 
-  static String HELIX = "Helix";
+  final String HELIX = "Helix";
 
-  static String SHEET = "Sheet";
+  final String SHEET = "Sheet";
 
-  static String LABEL = "Label";
+  /**
+   * For RNA secondary structure "stems" aka helices
+   */
+  final String STEM = "RNA Helix";
 
-  static String REMOVE = "Remove Annotation";
+  final String LABEL = "Label";
 
-  static String COLOUR = "Colour";
+  final String REMOVE = "Remove Annotation";
 
-  static Color HELIX_COLOUR = Color.red.darker();
+  final String COLOUR = "Colour";
 
-  static Color SHEET_COLOUR = Color.green.darker().darker();
+  final Color HELIX_COLOUR = Color.red.darker();
+
+  final Color SHEET_COLOUR = Color.green.darker().darker();
 
   Image image;
 
@@ -74,6 +78,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,26 +94,30 @@ 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)
   {
   }
 
   /**
    * 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;
@@ -123,8 +133,8 @@ 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,7 +162,7 @@ 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,7 +184,7 @@ 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 +211,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;
@@ -222,7 +239,7 @@ 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)
@@ -235,6 +252,8 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
       }
     }
 
+    aa[activeRow].validateRangeAndDisplay();
+
     adjustPanelHeight();
     repaint();
 
@@ -252,9 +271,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
       return null;
   }
 
+  @Override
   public void mousePressed(MouseEvent evt)
   {
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     if (aa == null)
     {
       return;
@@ -296,12 +316,23 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
       }
 
       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);
+      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);
@@ -325,6 +356,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
     ap.scalePanel.mousePressed(evt);
   }
 
+  @Override
   public void mouseReleased(MouseEvent evt)
   {
     graphStretch = -1;
@@ -338,21 +370,23 @@ 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();
@@ -365,9 +399,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 +427,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 +444,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);
@@ -442,7 +479,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
   public int calcPanelHeight()
   {
     // setHeight of panels
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     int height = 0;
 
     if (aa != null)
@@ -492,7 +529,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
   {
     if (activeRow == -1)
     {
-      AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+      AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
       if (aa == null)
       {
         return;
@@ -518,11 +555,13 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
     activeRes.addElement(String.valueOf(i));
   }
 
+  @Override
   public void update(Graphics g)
   {
     paint(g);
   }
 
+  @Override
   public void paint(Graphics g)
   {
     Dimension d = getSize();
@@ -557,8 +596,8 @@ 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;
@@ -590,7 +629,7 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param g
    *          DOCUMENT ME!
    * @param startRes
@@ -611,8 +650,8 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
       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);
@@ -624,664 +663,34 @@ public class AnnotationPanel extends Panel implements AdjustmentListener,
 
       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++;
-    }
-
-    if (aa.threshold != null)
-    {
-      g.setColor(aa.threshold.colour);
-
-      y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
-      g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
-    }
-  }
+  int scrollOffset = 0;
 
-  public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
-          int eRes, float min, float max, int y)
+  public void setScrollOffset(int value)
   {
-    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);
-    }
+    scrollOffset = value;
+    repaint();
   }
 
-  private int[] getProfileFor(AlignmentAnnotation aa, int column)
+  @Override
+  public FontMetrics getFontMetrics()
   {
-    // 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 fm;
   }
 
-  // used by overview window
-  public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
-          int y, int sRes, int eRes)
+  @Override
+  public Image getFadedImage()
   {
-    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 image;
   }
 
-  int scrollOffset = 0;
-
-  public void setScrollOffset(int value)
+  @Override
+  public int getFadedImageWidth()
   {
-    scrollOffset = value;
-    repaint();
+    return imgWidth;
   }
 }
index 7bf21a8..afaedb8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -71,6 +71,8 @@ public class AppletJmol extends EmbmenuFrame implements
   MenuItem turn = new MenuItem("Turn Propensity");
 
   MenuItem buried = new MenuItem("Buried Index");
+  
+  MenuItem purinepyrimidine = new MenuItem("Purine/Pyrimidine");
 
   MenuItem user = new MenuItem("User Defined Colours");
 
@@ -187,6 +189,7 @@ public class AppletJmol extends EmbmenuFrame implements
     strand.addActionListener(this);
     turn.addActionListener(this);
     buried.addActionListener(this);
+    purinepyrimidine.addActionListener(this);
     user.addActionListener(this);
     
     jmolHelp.addActionListener(this);
@@ -201,6 +204,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);
@@ -444,6 +448,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);
index 808e30b..23aa311 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e5b5e43..ec31b0a 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -22,6 +22,7 @@ import java.awt.event.*;
 
 import jalview.datamodel.*;
 import jalview.io.*;
+import jalview.schemes.TCoffeeColourScheme;
 
 public class CutAndPasteTransfer extends Panel implements ActionListener,
         MouseListener
@@ -150,24 +151,64 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
 
       } 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("Could not parse Newick file!\n" + ex);
         return;
       }
     }
     else if (annotationImport)
     {
-      if (new AnnotationFile().readAnnotationFile(
-              alignFrame.viewport.alignment, textarea.getText(),
-              jalview.io.AppletFormatAdapter.PASTE))
+      TCoffeeScoreFile tcf = null;
+      try
       {
-        alignFrame.alignPanel.fontChanged();
-        alignFrame.alignPanel.setScrollValues(0, 0);
-
+        tcf = new TCoffeeScoreFile(textarea.getText(),
+                jalview.io.AppletFormatAdapter.PASTE);
+        if (tcf.isValid())
+        {
+          if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(),
+                  true))
+          {
+            alignFrame.tcoffeeColour.setEnabled(true);
+            alignFrame.alignPanel.fontChanged();
+            alignFrame.changeColour(new TCoffeeColourScheme(
+                    alignFrame.viewport.getAlignment()));
+            alignFrame.statusBar
+                    .setText("Successfully pasted T-Coffee scores to alignment.");
+          }
+          else
+          {
+            // file valid but didn't get added to alignment for some reason
+            alignFrame.statusBar.setText("Failed to add T-Coffee scores: "+(tcf.getWarningMessage()!=null ? tcf.getWarningMessage():""));
+          }
+        }
+        else
+        {
+          tcf = null;
+        }
+      } catch (Exception x)
+      {
+        tcf = null;
       }
-      else
+      if (tcf == null)
       {
-        alignFrame.parseFeaturesFile(textarea.getText(),
-                jalview.io.AppletFormatAdapter.PASTE);
+        if (new AnnotationFile().readAnnotationFile(
+                alignFrame.viewport.getAlignment(), textarea.getText(),
+                jalview.io.AppletFormatAdapter.PASTE))
+        {
+          alignFrame.alignPanel.fontChanged();
+          alignFrame.alignPanel.setScrollValues(0, 0);
+          alignFrame.statusBar
+                  .setText("Successfully pasted annotation to alignment.");
+
+        }
+        else
+        {
+          if (!alignFrame.parseFeaturesFile(textarea.getText(),
+                  jalview.io.AppletFormatAdapter.PASTE))
+          {
+            alignFrame.statusBar.setText("Couldn't parse pasted text as a valid annotation, feature, GFF, or T-Coffee score file.");
+          }
+        }
       }
     }
     else if (alignFrame != null)
@@ -196,10 +237,13 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
         else
         {
           alignFrame.addSequences(al.getSequencesArray());
+          alignFrame.statusBar
+                  .setText("Successfully pasted alignment 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);
index 162750a..99ffbf6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 005f4a3..cdaca2b 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index b3d1a3c..705b510 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a35cf49..4f67357 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 03f15d3..259030f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -786,10 +786,10 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     av.featuresDisplayed = new Hashtable();
     Vector allfeatures = new Vector();
     minmax = new Hashtable();
-
-    for (int i = 0; i < av.alignment.getHeight(); i++)
+    AlignmentI alignment=av.getAlignment();
+    for (int i = 0; i < alignment.getHeight(); i++)
     {
-      SequenceFeature[] features = av.alignment.getSequenceAt(i)
+      SequenceFeature[] features = alignment.getSequenceAt(i)
               .getSequenceFeatures();
 
       if (features == null)
@@ -1110,16 +1110,17 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     ArrayList allGroups = new ArrayList();
     SequenceFeature[] tmpfeatures;
     String group;
-    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;
       }
 
       alignmentHasFeatures = true;
 
-      tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+      tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
       int index = 0;
       while (index < tmpfeatures.length)
       {
@@ -1175,16 +1176,17 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     Vector allFeatures = new Vector();
     SequenceFeature[] tmpfeatures;
     String group;
-    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;
       }
 
       alignmentHasFeatures = true;
 
-      tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+      tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
       int index = 0;
       while (index < tmpfeatures.length)
       {
index ee0e23d..de9d231 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -291,15 +291,15 @@ 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)
       {
index 5f697ea..583a5ad 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7a27df8..2f38084 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -153,20 +153,54 @@ public class FontChooser extends Panel implements ActionListener,
     frame.setVisible(false);
   }
 
+  private Font lastSelected=null; 
+  private int lastSelStyle=0;
+  private int lastSelSize=0;
+  /**
+   * 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)
-    {
-      ap.av.setFont(newFont);
-      ap.fontChanged();
+    FontMetrics fm = getGraphics().getFontMetrics(newFont);
+    double mw=fm.getStringBounds("M", getGraphics())
+            .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+                    .getWidth();
+    if (mw<1 || iw < 1) {
+       // TODO: JAL-1100
+      fontName.select(lastSelected.getName());
+      fontStyle.select(lastSelStyle);
+      fontSize.select(""+lastSelSize);
+      JVDialog d = new JVDialog(this.frame, "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()
index 58a4af1..a3eac2d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -18,6 +18,7 @@
 package jalview.appletgui;
 
 import java.awt.*;
+import java.util.List;
 
 import jalview.datamodel.*;
 
@@ -39,7 +40,7 @@ public class IdCanvas extends Panel
 
   boolean fastPaint = false;
 
-  java.util.Vector searchResults;
+  List<SequenceI> searchResults;
 
   public IdCanvas(AlignViewport av)
   {
@@ -80,7 +81,7 @@ public class IdCanvas extends Panel
             ((i - starty) * charHeight) + ypos + charHeight
                     - (charHeight / 5));
 
-    if (av.hasHiddenRows && av.showHiddenMarkers)
+    if (av.hasHiddenRows() && av.showHiddenMarkers)
     {
       drawMarker(i, starty, ypos);
     }
@@ -186,10 +187,10 @@ public class IdCanvas extends Panel
 
     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;
       }
@@ -221,9 +222,9 @@ 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 (av.hasHiddenRows())
           {
             setHiddenFont(s);
           }
@@ -246,14 +247,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 (av.hasHiddenRows())
         {
           // isrep =
           setHiddenFont(seq);
@@ -288,7 +289,7 @@ public class IdCanvas extends Panel
                 (((i - starty) * av.charHeight) + av.charHeight)
                         - (av.charHeight / 5));
 
-        if (av.hasHiddenRows && av.showHiddenMarkers)
+        if (av.hasHiddenRows() && av.showHiddenMarkers)
         {
           drawMarker(i, starty, 0);
         }
@@ -296,15 +297,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;
@@ -362,8 +363,8 @@ 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.getHiddenRepSequences() != null
+            && av.getHiddenRepSequences().containsKey(seq))
     {
       gg.setFont(bold);
       return true;
index 1497616..0042856 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -19,6 +19,7 @@ package jalview.appletgui;
 
 import java.awt.*;
 import java.awt.event.*;
+import java.util.List;
 import java.util.Vector;
 
 import jalview.datamodel.*;
@@ -272,7 +273,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);
     }
@@ -331,7 +332,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)
@@ -400,16 +401,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 +455,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);
           }
index 047d657..6495750 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index eaf8255..a722458 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 01b448c..b48b2a4 100755 (executable)
@@ -1,22 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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 jalview.datamodel.AlignmentI;
+
 import java.awt.*;
 import java.awt.event.*;
 
@@ -67,15 +69,15 @@ public class OverviewPanel extends Panel implements Runnable,
     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 +102,7 @@ public class OverviewPanel extends Panel implements Runnable,
     addComponentListener(new ComponentAdapter()
     {
 
+      @Override
       public void componentResized(ComponentEvent evt)
       {
         if (getSize().width != width
@@ -118,22 +121,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 +149,7 @@ public class OverviewPanel extends Panel implements Runnable,
     checkValid();
   }
 
+  @Override
   public void mouseReleased(MouseEvent evt)
   {
     boxX = evt.getX();
@@ -148,6 +157,7 @@ public class OverviewPanel extends Panel implements Runnable,
     checkValid();
   }
 
+  @Override
   public void mouseDragged(MouseEvent evt)
   {
     boxX = evt.getX();
@@ -174,7 +184,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 +195,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,9 +205,9 @@ public class OverviewPanel extends Panel implements Runnable,
       col = av.getColumnSelection().findColumnPosition(col);
     }
 
-    if (av.hasHiddenRows)
+    if (av.hasHiddenRows())
     {
-      row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+      row = av.getAlignment().getHiddenSequences().findIndexWithoutHiddenSeqs(
               row);
     }
 
@@ -240,11 +250,12 @@ 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)
     {
@@ -278,6 +289,7 @@ public class OverviewPanel extends Panel implements Runnable,
     int row, col, sameRow = 0, sameCol = 0;
     jalview.datamodel.SequenceI seq;
     boolean hiddenRow = false;
+    AlignmentI alignment=av.getAlignment();
     for (row = 0; row <= sequencesHeight; row++)
     {
       if ((int) (row * sampleRow) == lastrow)
@@ -287,15 +299,15 @@ public class OverviewPanel extends Panel implements Runnable,
       }
 
       hiddenRow = false;
-      if (av.hasHiddenRows)
+      if (av.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 +316,7 @@ public class OverviewPanel extends Panel implements Runnable,
       }
       else
       {
-        seq = av.alignment.getSequenceAt(lastrow);
+        seq = alignment.getSequenceAt(lastrow);
       }
 
       for (col = 0; col < width; col++)
@@ -333,7 +345,7 @@ public class OverviewPanel extends Panel implements Runnable,
         }
 
         if (hiddenRow
-                || (av.hasHiddenColumns && !av.getColumnSelection()
+                || (av.hasHiddenColumns() && !av.getColumnSelection()
                         .isVisible(lastcol)))
         {
           color = color.darker().darker();
@@ -357,14 +369,14 @@ 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 +398,14 @@ public class OverviewPanel extends Panel implements Runnable,
 
   public void setBoxPosition()
   {
-    int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
-    int fullsizeHeight = (av.alignment.getHeight() + av.alignment
+    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 +414,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 = av.getAlignment().getHiddenSequences().adjustForHiddenSeqs(
               startSeq);
 
-      endSeq = av.alignment.getHiddenSequences()
+      endSeq = av.getAlignment().getHiddenSequences()
               .adjustForHiddenSeqs(endSeq);
 
     }
@@ -418,7 +430,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 +444,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();
index 3e87f17..37b4281 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -69,11 +69,11 @@ public class PCAPanel extends EmbmenuFrame implements Runnable,
     useidentity=av.getAlignment().isNucleotide();
     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());
     }
     SeqCigar sq[] = seqstrings.getSequences();
     int length = sq[0].getWidth();
index 722dd32..4e1bfaf 100755 (executable)
@@ -1,23 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.util.*;
+import java.util.List;
 
 import java.awt.*;
 
@@ -25,7 +26,7 @@ import jalview.datamodel.*;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -35,7 +36,7 @@ public class PaintRefresher
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param comp
    *          DOCUMENT ME!
    * @param al
@@ -122,8 +123,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 +184,11 @@ 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,7 +240,7 @@ 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()];
index fe5e31d..a1fb5ea 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -48,17 +48,17 @@ 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;
 
index b3c6a01..0b4987c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -28,8 +28,6 @@ import jalview.datamodel.*;
 public class RedundancyPanel extends SliderPanel implements Runnable,
         WindowListener
 {
-  AlignmentPanel ap;
-
   Stack historyList = new Stack(); // simpler than synching with alignFrame.
 
   float[] redundancy;
@@ -109,15 +107,15 @@ 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;
@@ -241,11 +239,11 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
       }
 
       EditCommand cut = new EditCommand("Remove Redundancy",
-              EditCommand.CUT, deleted, 0, width, ap.av.alignment);
-
+              EditCommand.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]);
+        alignment.deleteSequence(deleted[i]);
         PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
         if (sg != null)
         {
index fd63acf..ce03ef0 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -518,13 +518,13 @@ public class RotatableCanvas extends Panel implements MouseListener,
       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());
index 1f256fe..8fe6e30 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -60,7 +60,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);
     }
@@ -122,7 +122,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
           {
             av.hideColumns(res, res);
             if (av.getSelectionGroup() != null
-                    && av.getSelectionGroup().getSize() == av.alignment
+                    && av.getSelectionGroup().getSize() == av.getAlignment()
                             .getHeight())
             {
               av.setSelectionGroup(null);
@@ -150,9 +150,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 +182,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 +225,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 +307,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
 
   public void mouseMoved(MouseEvent evt)
   {
-    if (!av.hasHiddenColumns)
+    if (!av.hasHiddenColumns())
     {
       return;
     }
@@ -360,7 +360,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
     for (int i = 0; i < cs.size(); i++)
     {
       int sel = cs.columnAt(i);
-      if (av.hasHiddenColumns)
+      if (av.hasHiddenColumns())
       {
         sel = av.getColumnSelection().findColumnPosition(sel);
       }
@@ -417,7 +417,7 @@ public class ScalePanel extends Panel implements MouseMotionListener,
       }
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       gg.setColor(Color.blue);
       int res;
index 26da08b..c7a8232 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -78,7 +78,7 @@ 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);
       }
@@ -97,22 +97,22 @@ public class SeqCanvas extends Panel
   {
     FontMetrics fm = getFontMetrics(av.getFont());
     ypos += av.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;
 
@@ -125,7 +125,7 @@ public class SeqCanvas extends Panel
           continue;
         }
 
-        value = av.alignment.getSequenceAt(i).findPosition(index);
+        value = av.getAlignment().getSequenceAt(i).findPosition(index);
 
         break;
       }
@@ -144,16 +144,16 @@ public class SeqCanvas extends Panel
   {
     ypos += av.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;
 
@@ -348,9 +348,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;
@@ -397,9 +398,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;
     }
@@ -433,7 +434,7 @@ public class SeqCanvas extends Panel
       {
         drawNorthScale(g, startRes, endx, ypos);
       }
-      if (av.hasHiddenColumns && av.showHiddenMarkers)
+      if (av.hasHiddenColumns() && av.showHiddenMarkers)
       {
         g.setColor(Color.blue);
         int res;
@@ -506,7 +507,7 @@ public class SeqCanvas extends Panel
   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);
     }
@@ -575,14 +576,14 @@ public class SeqCanvas extends Panel
     // ///////////////////////////
     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),
+      sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
               startRes, endRes, offset + ((i - startSeq) * av.charHeight));
 
       if (av.showSequenceFeatures)
@@ -619,7 +620,7 @@ public class SeqCanvas extends Panel
     }
 
     if (av.getSelectionGroup() != null
-            || av.alignment.getGroups().size() > 0)
+            || av.getAlignment().getGroups().size() > 0)
     {
       drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
     }
@@ -640,9 +641,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 = (SequenceGroup) av.getAlignment().getGroups().get(0);
       groupIndex = 0;
     }
 
@@ -655,7 +656,7 @@ 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++)
         {
@@ -670,11 +671,11 @@ public class SeqCanvas extends Panel
 
           if ((sx <= (endRes - startRes) * av.charWidth)
                   && 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;
             }
@@ -683,7 +684,7 @@ public class SeqCanvas extends Panel
             {
               if (((top == -1) && (i == 0))
                       || !group.getSequences(null).contains(
-                              av.alignment.getSequenceAt(i - 1)))
+                              av.getAlignment().getSequenceAt(i - 1)))
               {
                 top = sy;
               }
@@ -793,14 +794,14 @@ 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(
+        group = (SequenceGroup) av.getAlignment().getGroups().get(
                 groupIndex);
-      } while (groupIndex < av.alignment.getGroups().size());
+      } while (groupIndex < av.getAlignment().getGroups().size());
 
     }
   }
index f961212..b9c5cf0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -154,19 +154,19 @@ 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,18 +180,18 @@ 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();
@@ -209,7 +209,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 +218,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 +227,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();
@@ -240,12 +240,12 @@ public class SeqPanel extends Panel implements MouseMotionListener,
 
     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 +287,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);
         }
       }
     }
@@ -372,7 +372,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
             + sequence.getName());
 
     Object obj = null;
-    if (av.alignment.isNucleotide())
+    if (av.getAlignment().isNucleotide())
     {
       obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
               + "");
@@ -455,7 +455,7 @@ 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
@@ -543,7 +543,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);
     }
@@ -582,7 +582,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
       y -= hgap;
 
       seq = Math.min((y % cHeight) / av.getCharHeight(),
-              av.alignment.getHeight() - 1);
+              av.getAlignment().getHeight() - 1);
       if (seq < 0)
       {
         seq = -1;
@@ -591,7 +591,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     else
     {
       seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
-              av.alignment.getHeight() - 1);
+              av.getAlignment().getHeight() - 1);
       if (seq < 0)
       {
         seq = -1;
@@ -688,7 +688,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
             + sequence.getName());
 
     Object obj = null;
-    if (av.alignment.isNucleotide())
+    if (av.getAlignment().isNucleotide())
     {
       obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
               + "");
@@ -717,7 +717,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     ap.alignFrame.statusBar.setText(text.toString());
 
     StringBuffer tooltipText = new StringBuffer();
-    SequenceGroup[] groups = av.alignment.findAllGroups(sequence);
+    SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
     if (groups != null)
     {
       for (int g = 0; g < groups.length; g++)
@@ -916,14 +916,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 = (SequenceGroup) av.getRepresentedSequences(seq);
         groupEditing = true;
       }
     }
@@ -965,7 +964,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 +973,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 +1006,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
       }
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       fixedColumns = true;
       int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
@@ -1038,13 +1036,7 @@ 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 +1044,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,11 +1058,11 @@ 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]
+              if (!jalview.util.Comparison.isGap(gs
                       .getCharAt(fixedRight - j)))
               {
                 blank = false;
@@ -1086,19 +1078,19 @@ 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()
+            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 +1115,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();
@@ -1155,7 +1147,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
         else
         {
           editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
-                  startres, startres - lastres, av.alignment, true);
+                  startres, startres - lastres, av.getAlignment(), true);
         }
       }
       else
@@ -1171,7 +1163,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
         else
         {
           editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
-                  startres, lastres - startres, av.alignment, true);
+                  startres, lastres - startres, av.getAlignment(), true);
         }
 
       }
@@ -1193,7 +1185,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
         else
         {
           editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
-          { seq }, lastres, startres - lastres, av.alignment, true);
+          { seq }, lastres, startres - lastres, av.getAlignment(), true);
         }
       }
       else
@@ -1228,7 +1220,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
           if (max > 0)
           {
             editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
-            { seq }, startres, max, av.alignment, true);
+            { seq }, startres, max, av.getAlignment(), true);
           }
         }
       }
@@ -1264,9 +1256,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     }
 
     editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
-            av.alignment, true);
+            av.getAlignment(), true);
 
-    editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
+    editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.getAlignment(),
             true);
 
   }
@@ -1274,11 +1266,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(EditCommand.DELETE_GAP, seq, j, 1, av.getAlignment(),
             true);
 
     editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
-            av.alignment, true);
+            av.getAlignment(), true);
   }
 
   // ////////////////////////////////////////
@@ -1313,7 +1305,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 +1323,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)
       {
@@ -1423,9 +1415,8 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     {
       if (stretchGroup.cs instanceof ClustalxColourScheme)
       {
-        ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
-                stretchGroup.getSequences(av.hiddenRepSequences),
-                stretchGroup.getWidth());
+        ((ClustalxColourScheme) stretchGroup.cs).alignmentChanged(
+stretchGroup,av.getHiddenRepSequences());
       }
 
       if (stretchGroup.cs instanceof Blosum62ColourScheme
@@ -1473,14 +1464,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 +1516,7 @@ 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 +1653,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);
           }
@@ -1709,12 +1700,12 @@ public class SeqPanel extends Panel implements MouseMotionListener,
     // 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 (av.alignment == null)
+        if (av.getAlignment() == null)
         {
           System.out
                   .println("Selection message: alignviewport av SeqSetId="
@@ -1723,8 +1714,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 +1731,35 @@ 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");
     }
index 857472b..044fcbe 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.appletgui;
 
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+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 +66,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,7 +77,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
     }
     else if (av.getShowBoxes())
     {
-      getBoxColour(av.globalColourScheme, seq, i);
+      getBoxColour(av.getGlobalColourScheme(), seq, i);
     }
 
     return resBoxColour;
@@ -82,7 +87,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)))
@@ -98,7 +103,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;
   }
@@ -223,7 +228,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
         {
           // 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(av.getAlignmentConsensusAnnotation(), i, s, '.');
         }
       }
       else
@@ -245,9 +250,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
             graphics.setColor(resBoxColour);
           }
         }
-        if (av.getShowunconserved())
+        if (av.getShowUnconserved())
         {
-          s = getDisplayChar(av.consensus, i, s, '.');
+          s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
 
         }
       }
index 4e6c2bf..2046df6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -18,6 +18,7 @@
 package jalview.appletgui;
 
 import java.util.*;
+import java.util.List;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -57,7 +58,7 @@ public class SliderPanel extends Panel implements ActionListener,
 
     conservationSlider.setTitle("Conservation Colour Increment  (" + source
             + ")");
-    if (ap.av.alignment.getGroups() != null)
+    if (ap.av.getAlignment().getGroups() != null)
     {
       sp.setAllGroupsCheckEnabled(true);
     }
@@ -112,7 +113,7 @@ public class SliderPanel extends Panel implements ActionListener,
     }
     PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
 
-    if (ap.av.alignment.getGroups() != null)
+    if (ap.av.getAlignment().getGroups() != null)
     {
       pid.setAllGroupsCheckEnabled(true);
     }
@@ -195,24 +196,22 @@ public class SliderPanel extends Panel implements ActionListener,
     }
 
     ColourSchemeI toChange = null;
-    Vector allGroups = null;
-    int groupIndex = 0;
+    Iterator<SequenceGroup> allGroups = null;
 
     if (allGroupsCheck.getState())
     {
-      allGroups = ap.av.alignment.getGroups();
-      groupIndex = allGroups.size() - 1;
+      allGroups = ap.av.getAlignment().getGroups().listIterator();
     }
     else
     {
       toChange = cs;
     }
 
-    while (groupIndex > -1)
+    do 
     {
       if (allGroups != null)
       {
-        toChange = ((SequenceGroup) allGroups.elementAt(groupIndex)).cs;
+        toChange = allGroups.next().cs;
       }
 
       if (forConservation)
@@ -224,8 +223,7 @@ public class SliderPanel extends Panel implements ActionListener,
         toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
       }
 
-      groupIndex--;
-    }
+    } while (allGroups!=null && allGroups.hasNext());
 
     ap.seqPanel.seqCanvas.repaint();
 
index 11020fc..52b40e5 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 5d5b7ba..ca78bda 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -64,7 +64,7 @@ public class TreeCanvas extends Panel implements MouseListener,
 
   SequenceNode highlightNode;
 
-  AlignmentPanel ap; 
+  AlignmentPanel ap;
   public TreeCanvas(AlignmentPanel ap, ScrollPane scroller)
   {
     this.ap = ap;
@@ -87,7 +87,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 +143,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 +194,13 @@ 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()))
+                      node.element()))
       {
         g.setColor(Color.gray);
 
@@ -224,7 +224,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 +390,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,7 +442,7 @@ public class TreeCanvas extends Panel implements MouseListener,
     // for
     // scrollbar
 
-    float wscale = (float) (width - labelLength - offx * 2)
+    float wscale = (width - labelLength - offx * 2)
             / tree.getMaxHeight();
 
     SequenceNode top = tree.getTopNode();
@@ -466,25 +468,29 @@ public class TreeCanvas extends Panel implements MouseListener,
       }
 
       int x = (int) (threshold
-              * (float) (getSize().width - labelLength - 2 * offx) + offx);
+              * (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 +520,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 +547,7 @@ public class TreeCanvas extends Panel implements MouseListener,
     }
   }
 
+  @Override
   public void mousePressed(MouseEvent e)
   {
     av.setCurrentTree(tree);
@@ -570,7 +579,7 @@ public class TreeCanvas extends Panel implements MouseListener,
         setColor(tree.getTopNode(), Color.black);
 
         av.setSelectionGroup(null);
-        av.alignment.deleteAllGroups();
+        av.getAlignment().deleteAllGroups();
         av.sequenceColours = null;
 
         colourGroups();
@@ -608,6 +617,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,8 +631,7 @@ public class TreeCanvas extends Panel implements MouseListener,
         }
         else
         {
-          cs = ColourSchemeProperty.getColour(sequences, av.alignment
-                  .getWidth(), ColourSchemeProperty.getColourName(av
+          cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty.getColourName(av
                   .getGlobalColourScheme()));
         }
         // cs is null if shading is an annotationColourGradient
@@ -630,9 +641,9 @@ public class TreeCanvas extends Panel implements MouseListener,
                   av.getIgnoreGapsConsensus());
         }
       }
-
-      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 +655,18 @@ 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);
 
     }
     ap.updateAnnotation();
-    
+
   }
 
   public void setShowDistances(boolean state)
index 0351d14..aa57908 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -186,11 +186,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);
         }
 
@@ -204,14 +204,14 @@ public class TreePanel extends EmbmenuFrame implements ActionListener,
         if (av.getSelectionGroup() == null)
         {
           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());
         }
 
         tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
index 7220321..73df35f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 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 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.MouseEvent;
+import java.util.Vector;
 
 public class UserDefinedColours extends Panel implements ActionListener,
         AdjustmentListener
@@ -379,7 +397,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)
       {
       }
index 069589e..b24304a 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,6 +17,9 @@
  */
 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.text.DateFormat;
@@ -24,7 +27,6 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 
 import org.apache.log4j.*;
-import org.biojava.dasobert.dasregistry.Das1Source;
 
 /**
  * Stores and retrieves Jalview Application Properties Lists and fields within
@@ -124,6 +126,8 @@ 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>
@@ -280,6 +284,26 @@ public class Cache
       System.setProperty("http.proxyPort", getDefault("PROXY_PORT", null));
     }
 
+    // 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
     // MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE
     // VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW
@@ -580,46 +604,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.
    */
@@ -824,4 +808,18 @@ public class Cache
     }
     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;
+  }
 }
index dd61e76..272250e 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0cba50e..9c23a0a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -492,6 +492,8 @@ public class JalviewLite extends Applet implements
       boolean seqlimits = suffix.equalsIgnoreCase("true");\r
       if (alf.viewport.getSelectionGroup() != null)\r
       {\r
+        // JBPNote: getSelectionAsNewSequence behaviour has changed - this method now returns a full copy of sequence data\r
+        // TODO consider using getSequenceSelection instead here\r
         String reply = new AppletFormatAdapter().formatSequences(format,\r
                 new Alignment(alf.viewport.getSelectionAsNewSequence()),\r
                 seqlimits);\r
@@ -730,9 +732,9 @@ public class JalviewLite extends Applet implements
    * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame\r
    * , java.lang.String)\r
    */\r
-  public void loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay)\r
+  public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay)\r
   {\r
-    alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, autoenabledisplay);\r
+    return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, autoenabledisplay);\r
   }\r
 \r
 \r
@@ -1821,8 +1823,7 @@ public class JalviewLite extends Applet implements
 \r
         if (protocol == jalview.io.AppletFormatAdapter.PASTE)\r
         {\r
-          newAlignFrame.setTitle("Sequences from "\r
-                  + applet.getDocumentBase());\r
+          newAlignFrame.setTitle("Sequences from " + applet.getDocumentBase());\r
         }\r
 \r
         newAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
@@ -1863,6 +1864,25 @@ public class JalviewLite extends Applet implements
           }\r
         }\r
 \r
+\r
+        /*\r
+         * Try to load T-Coffee score file\r
+         */\r
+        String sScoreFile = applet.getParameter("scoreFile");\r
+        if( sScoreFile != null && !"".equals(sScoreFile) ) {\r
+            try {\r
+              if (debug) {\r
+                System.err.println("Attempting to load T-COFFEE score file from the scoreFile parameter");\r
+              }\r
+              if (!newAlignFrame.loadScoreFile(sScoreFile)) {\r
+                System.err.println("Failed to parse T-COFFEE parameter as a valid score file ('"+sScoreFile+"')");\r
+              }\r
+            }catch( Exception e ) {\r
+               System.err.printf("Cannot read score file: '%s'. Cause: %s \n", sScoreFile, e.getMessage());\r
+            }\r
+        }\r
+       \r
+\r
         // ///////////////////////////\r
         // modify display of features\r
         // we do this before any features have been loaded, ensuring any hidden groups are hidden when features first displayed\r
index a77186f..8ba113d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cc8f4dc..86d1ff3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 95447d3..61fa377 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 8b018c5..1648a24 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 38f7740..d8b2b3c 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 53beb10..34d5d7f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1a5a830..ec7001d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4b807c1..b2a47d7 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1186169..83d3b9a 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 407640a..bb48199 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 5c9be24..04fda30 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e4f6c5a..c88190d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 3248adf..b122fac 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9e01bf4..e1fee09 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 316ace7..ea36590 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c95c80a..9c8fc59 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f8eea6f..770985a 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1af7025..ff5d7b3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 3f34069..a459891 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 0acbe9f..5dbb9c8 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 80d22ee..aa35b20 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 846ed9d..aeeb3b4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index d57d24c..e36ec4b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 02cf07f..e6f469c 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4a04798..9ded3d4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 220dec2..bbd1f79 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4be6b86..097ba71 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index dc859f6..776d713 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cebbfff..388b0ff 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d18cb62..9321524 100644 (file)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.commands;
@@ -22,24 +22,24 @@ import java.util.*;
 import jalview.datamodel.*;
 
 /**
- * 
+ *
  * <p>
  * Title: EditCommmand
  * </p>
- * 
+ *
  * <p>
  * Description: Essential information for performing undo and redo for cut/paste
  * insert/delete gap which can be stored in the HistoryList
  * </p>
- * 
+ *
  * <p>
  * Copyright: Copyright (c) 2006
  * </p>
- * 
+ *
  * <p>
  * Company: Dundee University
  * </p>
- * 
+ *
  * @author not attributable
  * @version 1.0
  */
@@ -55,6 +55,8 @@ public class EditCommand implements CommandI
 
   public static final int REPLACE = 4;
 
+  public static final int INSERT_NUC=5;
+
   Edit[] edits;
 
   String description;
@@ -94,11 +96,13 @@ public class EditCommand implements CommandI
     performEdit(0, null);
   }
 
+  @Override
   final public String getDescription()
   {
     return description;
   }
 
+  @Override
   public int getSize()
   {
     return edits == null ? 0 : edits.length;
@@ -114,7 +118,7 @@ public class EditCommand implements CommandI
    * operation affects more alignment objects than the one referenced in al (for
    * example, cut or pasting whole sequences). Use the form with an additional
    * AlignmentI[] views parameter.
-   * 
+   *
    * @param command
    * @param seqs
    * @param position
@@ -131,7 +135,7 @@ public class EditCommand implements CommandI
   /**
    * append a new edit command with a set of alignment views that may be
    * operated on
-   * 
+   *
    * @param command
    * @param seqs
    * @param position
@@ -192,15 +196,21 @@ public class EditCommand implements CommandI
       case REPLACE:
         replace(edits[e]);
         break;
+        //TODO:add deleteNuc for UNDO
+//      case INSERT_NUC:
+//     insertNuc(edits[e]);
+//     break;
       }
     }
   }
 
+  @Override
   final public void doCommand(AlignmentI[] views)
   {
     performEdit(0, views);
   }
 
+  @Override
   final public void undoCommand(AlignmentI[] views)
   {
     int e = 0, eSize = edits.length;
@@ -223,7 +233,7 @@ public class EditCommand implements CommandI
       case REPLACE:
         replace(edits[e]);
         break;
-      }
+       }
     }
   }
 
@@ -234,10 +244,23 @@ public class EditCommand implements CommandI
     {
       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 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);
+//  }
 
   final void deleteGap(Edit command)
   {
@@ -325,8 +348,10 @@ public class EditCommand implements CommandI
         // read 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()) {
+            sequences.add(command.alIndex[i], command.seqs[i]);
+          }
         }
         else
         {
@@ -431,12 +456,12 @@ public class EditCommand implements CommandI
        * cut addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT,
        * cut, sg.getStartRes(), sg.getEndRes()-sg.getStartRes()+1,
        * viewport.alignment));
-       * 
+       *
        */
       /**
        * then addHistoryItem(new EditCommand( "Add sequences",
        * EditCommand.PASTE, sequences, 0, alignment.getWidth(), alignment) );
-       * 
+       *
        */
       oldstring = command.seqs[i].getSequenceAsString();
       tmp = new StringBuffer(oldstring.substring(0, start));
index e45aaa1..02c4fd9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 83197d7..1dd4373 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ef39ef0..575b4ca 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e7126ee..dc62666 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index de94dd4..edb9b3e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9c2bd83..335621f 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 707eee8..6c11936 100755 (executable)
@@ -1,40 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.analysis.*;
-
 /**
  * Data structure to hold and manipulate a multiple sequence alignment
  */
 /**
  * @author JimP
- * 
+ *
  */
 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 +43,8 @@ public class Alignment implements AlignmentI
 
   public static final int NUCLEOTIDE = 1;
 
+  public boolean hasRNAStructure = false;
+
   /** DOCUMENT ME!! */
   public AlignmentAnnotation[] annotations;
 
@@ -64,18 +65,19 @@ 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 an alignment from an array of Sequences.
-   * 
+   *
    * @param sequences
    */
   public Alignment(SequenceI[] seqs)
@@ -85,7 +87,7 @@ public class Alignment implements AlignmentI
 
   /**
    * Make a new alignment from an array of SeqCigars
-   * 
+   *
    * @param seqs
    *          SeqCigar[]
    */
@@ -101,7 +103,7 @@ public class Alignment implements AlignmentI
    * compactAlignment does not contain hidden regions. JBPNote - must also check
    * that compactAlignment resolves to a set of SeqCigars - or construct them
    * appropriately.
-   * 
+   *
    * @param compactAlignment
    *          CigarArray
    */
@@ -113,49 +115,62 @@ public class Alignment implements AlignmentI
 
   /**
    * 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;
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param i
    *          DOCUMENT ME!
-   * 
+   *
    * @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;
   }
 
   /**
    * Adds a sequence to the alignment. Recalculates maxLength and size.
-   * 
+   *
    * @param snew
    */
+  @Override
   public void addSequence(SequenceI snew)
   {
     if (dataset != null)
@@ -180,7 +195,10 @@ public class Alignment implements AlignmentI
     }
     else
     {
-      sequences.addElement(snew);
+      synchronized (sequences)
+      {
+        sequences.add(snew);
+      }
     }
     if (hiddenSequences != null)
       hiddenSequences.adjustHeightSequenceAdded();
@@ -188,27 +206,32 @@ public class Alignment implements AlignmentI
 
   /**
    * Adds a sequence to the alignment. Recalculates maxLength and size.
-   * 
+   *
    * @param snew
    */
+  @Override
   public void setSequenceAt(int i, SequenceI snew)
   {
     SequenceI oldseq = getSequenceAt(i);
-    deleteSequence(oldseq);
-
-    sequences.setElementAt(snew, i);
+    deleteSequence(i);
+    synchronized (sequences)
+    {
+      sequences.set(i, snew);
+    }
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
-  public Vector getGroups()
+  @Override
+  public List<SequenceGroup> getGroups()
   {
     return groups;
   }
 
+  @Override
   public void finalize()
   {
     if (getDataset() != null)
@@ -235,10 +258,11 @@ public class Alignment implements AlignmentI
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param s
    *          DOCUMENT ME!
    */
+  @Override
   public void deleteSequence(SequenceI s)
   {
     deleteSequence(findIndex(s));
@@ -246,105 +270,115 @@ public class Alignment implements AlignmentI
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param i
    *          DOCUMENT ME!
    */
+  @Override
   public void deleteSequence(int i)
   {
     if (i > -1 && i < getHeight())
     {
-      sequences.removeElementAt(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!
-   * 
-   * @return DOCUMENT ME!
+  /*
+   * (non-Javadoc)
+   *
+   * @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) == null)
+        {
+          this.deleteGroup(sg);
+          gSize--;
+          continue;
+        }
 
-      if (sg.getSequences(null).contains(s))
-      {
-        temp.addElement(sg);
+        if (sg.getSequences(null).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;
+          }
         }
-      }
 
-      groups.addElement(sg);
+        groups.add(sg);
+      }
     }
   }
 
   /**
    * remove any annotation that references gp
-   * 
+   *
    * @param gp
    *          (if null, removes all group associated annotation)
    */
@@ -402,26 +436,35 @@ public class Alignment implements AlignmentI
     }
   }
 
+  @Override
   public void deleteAllGroups()
   {
-    if (annotations != null)
+    synchronized (groups)
     {
-      removeAnnotationForGroup(null);
+      if (annotations != null)
+      {
+        removeAnnotationForGroup(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);
+      }
     }
   }
 
   /**    */
+  @Override
   public SequenceI findName(String name)
   {
     return findName(name, false);
@@ -429,9 +472,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
    */
+  @Override
   public SequenceI findName(String token, boolean b)
   {
     return findName(null, token, b);
@@ -439,10 +483,11 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
    * boolean)
    */
+  @Override
   public SequenceI findName(SequenceI startAfter, String token, boolean b)
   {
 
@@ -483,6 +528,7 @@ public class Alignment implements AlignmentI
     return null;
   }
 
+  @Override
   public SequenceI[] findSequenceMatch(String name)
   {
     Vector matches = new Vector();
@@ -509,9 +555,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
    */
+  @Override
   public int findIndex(SequenceI s)
   {
     int i = 0;
@@ -531,10 +578,11 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
    */
+  @Override
   public int findIndex(SearchResults results)
   {
     int i = 0;
@@ -552,9 +600,10 @@ public class Alignment implements AlignmentI
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
+  @Override
   public int getHeight()
   {
     return sequences.size();
@@ -562,9 +611,10 @@ public class Alignment implements AlignmentI
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
+  @Override
   public int getWidth()
   {
     int maxLength = -1;
@@ -582,27 +632,30 @@ public class Alignment implements AlignmentI
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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));
+      }
     }
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
+  @Override
   public char getGapCharacter()
   {
     return gapCharacter;
@@ -610,9 +663,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#isAligned()
    */
+  @Override
   public boolean isAligned()
   {
     return isAligned(false);
@@ -620,9 +674,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#isAligned(boolean)
    */
+  @Override
   public boolean isAligned(boolean includeHidden)
   {
     int width = getWidth();
@@ -646,15 +701,17 @@ public class Alignment implements AlignmentI
 
   /*
    * (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;
@@ -688,7 +745,8 @@ public class Alignment implements AlignmentI
     if (swap)
     {
       annotations = temp;
-      if (unhook) {
+      if (unhook)
+      {
         unhookAnnotation(aa);
       }
     }
@@ -697,7 +755,7 @@ public class Alignment implements AlignmentI
 
   /**
    * remove any object references associated with this annotation
-   * 
+   *
    * @param aa
    */
   private void unhookAnnotation(AlignmentAnnotation aa)
@@ -715,10 +773,11 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
    * AlignmentAnnotation)
    */
+  @Override
   public void addAnnotation(AlignmentAnnotation aa)
   {
     addAnnotation(aa, -1);
@@ -726,12 +785,18 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @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 +832,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 +865,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 +887,7 @@ public class Alignment implements AlignmentI
     }
   }
 
+  @Override
   public boolean isNucleotide()
   {
     if (type == NUCLEOTIDE)
@@ -833,6 +900,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 +922,7 @@ public class Alignment implements AlignmentI
         currentSeq = getSequenceAt(i);
         if (currentSeq.getDatasetSequence() != null)
         {
-          seqs[i] = (Sequence) currentSeq.getDatasetSequence();
+          seqs[i] = currentSeq.getDatasetSequence();
         }
         else
         {
@@ -877,11 +952,13 @@ public class Alignment implements AlignmentI
     alignmentRefs++;
   }
 
+  @Override
   public Alignment getDataset()
   {
     return dataset;
   }
 
+  @Override
   public boolean padGaps()
   {
     boolean modified = false;
@@ -928,11 +1005,12 @@ public class Alignment implements AlignmentI
   /**
    * Justify the sequences to the left or right by deleting and inserting gaps
    * before the initial residue or after the terminal residue
-   * 
+   *
    * @param right
    *          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,23 +1108,30 @@ 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)
@@ -1055,6 +1140,7 @@ public class Alignment implements AlignmentI
     alignmentProperties.put(key, value);
   }
 
+  @Override
   public Object getProperty(Object key)
   {
     if (alignmentProperties != null)
@@ -1063,6 +1149,7 @@ public class Alignment implements AlignmentI
       return null;
   }
 
+  @Override
   public Hashtable getProperties()
   {
     return alignmentProperties;
@@ -1072,11 +1159,12 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
    * )
    */
+  @Override
   public void addCodonFrame(AlignedCodonFrame codons)
   {
     if (codons == null)
@@ -1095,9 +1183,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#getCodonFrame(int)
    */
+  @Override
   public AlignedCodonFrame getCodonFrame(int index)
   {
     return codonFrameList[index];
@@ -1105,10 +1194,11 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
    */
+  @Override
   public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
   {
     if (seq == null || codonFrameList == null)
@@ -1128,9 +1218,10 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.datamodel.AlignmentI#getCodonFrames()
    */
+  @Override
   public AlignedCodonFrame[] getCodonFrames()
   {
     return codonFrameList;
@@ -1138,10 +1229,11 @@ public class Alignment implements AlignmentI
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
    * AlignedCodonFrame)
    */
+  @Override
   public boolean removeCodonFrame(AlignedCodonFrame codons)
   {
     if (codons == null || codonFrameList == null)
@@ -1168,8 +1260,13 @@ public class Alignment implements AlignmentI
     return removed;
   }
 
+  @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 +1274,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();
@@ -1209,13 +1307,12 @@ public class Alignment implements AlignmentI
     {
       this.addCodonFrame(acod[a]);
     }
-    Vector sg = toappend.getGroups();
+    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 +1379,99 @@ public class Alignment implements AlignmentI
     }
   }
 
+  @Override
+  public AlignmentAnnotation findOrCreateAnnotation(String name,
+          boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef)
+  {
+    for (AlignmentAnnotation annot : getAlignmentAnnotation())
+    {
+      if (annot.autoCalculated == autoCalc
+              && annot.getCalcId().equals(name)
+              && 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(name));
+    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;
+  }
+
+  @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);
+        }
+      }
+
+    }
+  }
+
 }
index 1d624d4..f5d34a6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,6 +17,9 @@
  */
 package jalview.datamodel;
 
+import jalview.analysis.Rna;
+import jalview.analysis.WUSSParseException;
+
 import java.util.Enumeration;
 import java.util.Hashtable;
 
@@ -35,7 +38,7 @@ public class AlignmentAnnotation
   public boolean autoCalculated = false;
 
   public String annotationId;
-
+  
   public SequenceI sequenceRef;
 
   /** DOCUMENT ME!! */
@@ -47,6 +50,46 @@ public class AlignmentAnnotation
   /** DOCUMENT ME!! */
   public Annotation[] annotations;
 
+  /**
+   * RNA secondary structure contact positions
+   */
+  public SequenceFeature[] _rnasecstr = null;
+  /**
+   * position of annotation resulting in invalid WUSS parsing or -1
+   */
+  private long invalidrnastruc=-1;
+  /**
+   * 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);
+    invalidrnastruc=-1;
+    }
+    catch (WUSSParseException 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;
+    }
+    // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+  }
   public java.util.Hashtable sequenceMapping;
 
   /** DOCUMENT ME!! */
@@ -117,6 +160,8 @@ public class AlignmentAnnotation
    */
   public boolean centreColLabels = false;
 
+  private boolean isrna;
+
   /*
    * (non-Javadoc)
    * 
@@ -167,9 +212,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 +234,22 @@ public class AlignmentAnnotation
       {
         hasIcons |= true;
       }
+      else
+      // Check for RNA secondary structure
+      {
+        if (annotations[i].secondaryStructure == 'S')
+        {
+          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)
@@ -205,6 +270,7 @@ public class AlignmentAnnotation
                 firstChar != ' '
                 && firstChar != 'H'
                 && firstChar != 'E'
+                && firstChar != 'S'
                 && firstChar != '-'
                 && firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
         {
@@ -219,6 +285,10 @@ public class AlignmentAnnotation
           }
         }
       }
+      else
+      {
+        rnastring.append(annotations[i].displayCharacter.charAt(1));
+      }
 
       if (annotations[i].displayCharacter.length() > 0)
       {
@@ -241,11 +311,83 @@ public class AlignmentAnnotation
 
       }
     }
+    else
+    {
+      if (isrna)
+      {
+        _updateRnaSecStr(new AnnotCharSequence());
+      }
+    }
 
     annotationId = this.hashCode() + "";
   }
-
   /**
+   * 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)
+    {
+      String dc;
+      return ((index+offset<0) || (index+offset)>=max || annotations[index+offset]==null || (dc=annotations[index+offset].displayCharacter.trim()).length()<1)
+              ? '.' : dc.charAt(0);
+    }
+    public String toString()
+    {
+      char[] string=new char[max-offset];
+      int mx=annotations.length;
+        
+      for (int i=offset;i<mx;i++)
+      {
+        String dc;
+        string[i]=(annotations[i]==null || (dc=annotations[i].displayCharacter.trim()).length()<1 )? '.' : dc.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;
+  }
+
+/**
    * Creates a new AlignmentAnnotation object.
    * 
    * @param label
@@ -280,7 +422,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)
@@ -376,6 +518,10 @@ 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 (this.hasScore = annotation.hasScore)
     {
       this.score = annotation.score;
@@ -425,6 +571,11 @@ public class AlignmentAnnotation
         }
       }
     }
+    // TODO: check if we need to do this: JAL-952
+    //if (this.isrna=annotation.isrna)
+    {
+      // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
+    }
     validateRangeAndDisplay(); // construct hashcodes, etc.
   }
 
@@ -823,4 +974,28 @@ public class AlignmentAnnotation
     }
     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="";
+  public String getCalcId()
+  {
+    return calcId;
+  }
+
+  public void setCalcId(String calcId)
+  {
+    this.calcId = calcId;
+  }
+  
 }
index be1bff7..d09c41d 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -22,33 +22,34 @@ import java.util.*;
 /**
  * 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();
 
   /**
    * Calculates the maximum width of the alignment, including gaps.
-   * 
+   *
    * @return Greatest sequence length within alignment.
    */
+  @Override
   public int getWidth();
 
   /**
    * Calculates if this set of sequences (visible and invisible) are all the
    * same length
-   * 
+   *
    * @return true if all sequences in alignment are the same length
    */
   public boolean isAligned();
 
   /**
    * Calculates if this set of sequences is all the same length
-   * 
+   *
    * @param includeHidden
    *          optionally exclude hidden sequences from test
    * @return true if all (or just visible) sequences are the same length
@@ -56,40 +57,42 @@ public interface AlignmentI
   public boolean isAligned(boolean includeHidden);
 
   /**
-   * Gets sequences as a Vector
-   * 
+   * Gets sequences as a Synchronized collection
+   *
    * @return All sequences in alignment.
    */
-  public Vector getSequences();
+  @Override
+  public List<SequenceI> getSequences();
 
   /**
    * Gets sequences as a SequenceI[]
-   * 
+   *
    * @return All sequences in alignment.
    */
   public SequenceI[] getSequencesArray();
 
   /**
    * Find a specific sequence in this alignment.
-   * 
+   *
    * @param i
    *          Index of required sequence.
-   * 
+   *
    * @return SequenceI at given index.
    */
   public SequenceI getSequenceAt(int i);
 
   /**
    * Add a new sequence to this alignment.
-   * 
+   *
    * @param seq
    *          New sequence will be added at end of alignment.
    */
   public void addSequence(SequenceI seq);
 
+
   /**
    * Used to set a particular index of the alignment with the given sequence.
-   * 
+   *
    * @param i
    *          Index of sequence to be updated.
    * @param seq
@@ -99,7 +102,7 @@ public interface AlignmentI
 
   /**
    * Deletes a sequence from the alignment
-   * 
+   *
    * @param s
    *          Sequence to be deleted.
    */
@@ -107,7 +110,7 @@ public interface AlignmentI
 
   /**
    * Deletes a sequence from the alignment.
-   * 
+   *
    * @param i
    *          Index of sequence to be deleted.
    */
@@ -115,10 +118,10 @@ public interface AlignmentI
 
   /**
    * Finds sequence in alignment using sequence name as query.
-   * 
+   *
    * @param name
    *          Id of sequence to search for.
-   * 
+   *
    * @return Sequence matching query, if found. If not found returns null.
    */
   public SequenceI findName(String name);
@@ -127,20 +130,20 @@ public interface AlignmentI
 
   /**
    * Finds index of a given sequence in the alignment.
-   * 
+   *
    * @param s
    *          Sequence to look for.
-   * 
+   *
    * @return Index of sequence within the alignment or -1 if not found
    */
   public int findIndex(SequenceI s);
 
   /**
    * Finds group that given sequence is part of.
-   * 
+   *
    * @param s
    *          Sequence in alignment.
-   * 
+   *
    * @return First group found for sequence. WARNING : Sequences may be members
    *         of several groups. This method is incomplete.
    */
@@ -148,17 +151,17 @@ public interface AlignmentI
 
   /**
    * Finds all groups that a given sequence is part of.
-   * 
+   *
    * @param s
    *          Sequence in alignment.
-   * 
+   *
    * @return All groups containing given sequence.
    */
   public SequenceGroup[] findAllGroups(SequenceI s);
 
   /**
    * Adds a new SequenceGroup to this alignment.
-   * 
+   *
    * @param sg
    *          New group to be added.
    */
@@ -166,7 +169,7 @@ public interface AlignmentI
 
   /**
    * Deletes a specific SequenceGroup
-   * 
+   *
    * @param g
    *          Group will be deleted from alignment.
    */
@@ -174,10 +177,10 @@ public interface AlignmentI
 
   /**
    * Get all the groups associated with this alignment.
-   * 
-   * @return All groups as a Vector.
+   *
+   * @return All groups as a list.
    */
-  public Vector getGroups();
+  public List<SequenceGroup> getGroups();
 
   /**
    * Deletes all groups from this alignment.
@@ -186,7 +189,7 @@ public interface AlignmentI
 
   /**
    * Adds a new AlignmentAnnotation to this alignment
-   * 
+   *
    * @note Care should be taken to ensure that annotation is at least as wide as
    *       the longest sequence in the alignment for rendering purposes.
    */
@@ -194,7 +197,7 @@ public interface AlignmentI
 
   /**
    * moves annotation to a specified index in alignment annotation display stack
-   * 
+   *
    * @param aa
    *          the annotation object to be moved
    * @param index
@@ -204,10 +207,10 @@ public interface AlignmentI
 
   /**
    * 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.
@@ -215,15 +218,17 @@ public interface AlignmentI
   public 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);
@@ -231,14 +236,15 @@ public interface AlignmentI
   /**
    * Get the annotation associated with this alignment (this can be null if no
    * annotation has ever been created on the alignment)
-   * 
+   *
    * @return array of AlignmentAnnotation objects
    */
+  @Override
   public AlignmentAnnotation[] getAlignmentAnnotation();
 
   /**
    * Change the gap character used in this alignment to 'gc'
-   * 
+   *
    * @param gc
    *          the new gap character.
    */
@@ -246,27 +252,34 @@ public interface AlignmentI
 
   /**
    * Get the gap character used in this alignment
-   * 
+   *
    * @return gap character
    */
   public char getGapCharacter();
 
   /**
    * Test for all nucleotide alignment
-   * 
+   *
    * @return true if alignment is nucleotide sequence
    */
   public boolean isNucleotide();
 
   /**
+   * Test if alignment contains RNA structure
+   *
+   * @return true if RNA structure AligmnentAnnotation was added to alignment
+   */
+  public boolean hasRNAStructure();
+
+  /**
    * Set alignment to be a nucleotide sequence
-   * 
+   *
    */
   public void setNucleotide(boolean b);
 
   /**
    * Get the associated dataset for the alignment.
-   * 
+   *
    * @return Alignment containing dataset sequences or null of this is a
    *         dataset.
    */
@@ -274,7 +287,7 @@ public interface AlignmentI
 
   /**
    * Set the associated dataset for the alignment, or create one.
-   * 
+   *
    * @param dataset
    *          The dataset alignment or null to construct one.
    */
@@ -282,7 +295,7 @@ public interface AlignmentI
 
   /**
    * pads sequences with gaps (to ensure the set looks like an alignment)
-   * 
+   *
    * @return boolean true if alignment was modified
    */
   public boolean padGaps();
@@ -291,7 +304,7 @@ public interface AlignmentI
 
   /**
    * Compact representation of alignment
-   * 
+   *
    * @return CigarArray
    */
   public CigarArray getCompactAlignment();
@@ -299,7 +312,7 @@ public interface AlignmentI
   /**
    * Set an arbitrary key value pair for an alignment. Note: both key and value
    * objects should return a meaningful, human readable response to .toString()
-   * 
+   *
    * @param key
    * @param value
    */
@@ -307,7 +320,7 @@ public interface AlignmentI
 
   /**
    * Get a named property from the alignment.
-   * 
+   *
    * @param key
    * @return value of property
    */
@@ -315,21 +328,21 @@ public interface AlignmentI
 
   /**
    * Get the property hashtable.
-   * 
+   *
    * @return hashtable of alignment properties (or null if none are defined)
    */
   public Hashtable getProperties();
 
   /**
    * add a reference to a frame of aligned codons for this alignment
-   * 
+   *
    * @param codons
    */
   public void addCodonFrame(AlignedCodonFrame codons);
 
   /**
    * remove a particular codon frame reference from this alignment
-   * 
+   *
    * @param codons
    * @return true if codon frame was removed.
    */
@@ -337,14 +350,14 @@ public interface AlignmentI
 
   /**
    * get all codon frames associated with this alignment
-   * 
+   *
    * @return
    */
   public AlignedCodonFrame[] getCodonFrames();
 
   /**
    * get a particular codon frame
-   * 
+   *
    * @param index
    * @return
    */
@@ -357,7 +370,7 @@ public interface AlignmentI
 
   /**
    * find sequence with given name in alignment
-   * 
+   *
    * @param token
    *          name to find
    * @param b
@@ -370,7 +383,7 @@ public interface AlignmentI
   /**
    * find next sequence with given name in alignment starting after a given
    * sequence
-   * 
+   *
    * @param startAfter
    *          the sequence after which the search will be started (usually the
    *          result of the last call to findName)
@@ -386,7 +399,7 @@ public interface AlignmentI
   /**
    * find first sequence in alignment which is involved in the given search
    * result object
-   * 
+   *
    * @param results
    * @return -1 or index of sequence in alignment
    */
@@ -399,7 +412,7 @@ public interface AlignmentI
    * gap characters, etc...). If you are uncertain, use the copy Alignment copy
    * constructor to create a new version which can be appended without side
    * effect.
-   * 
+   *
    * @param toappend
    *          - the alignment to be appended.
    */
@@ -408,7 +421,7 @@ public interface AlignmentI
   /**
    * Justify the sequences to the left or right by deleting and inserting gaps
    * before the initial residue or after the terminal residue
-   * 
+   *
    * @param right
    *          true if alignment padded to right, false to justify to left
    * @return true if alignment was changed TODO: return undo object
@@ -417,9 +430,32 @@ public interface AlignmentI
 
   /**
    * add given annotation row at given position (0 is start, -1 is end)
-   * 
+   *
    * @param consensus
    * @param i
    */
   public void addAnnotation(AlignmentAnnotation consensus, int i);
+
+  /**
+   * search for or create a specific annotation row on the alignment
+   *
+   * @param method - CalcId for the annotation (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
+   * @return existing annotation matching the given attributes
+   */
+  public AlignmentAnnotation findOrCreateAnnotation(String name, 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
+   */
+  public void moveSelectedSequencesByOne(SequenceGroup sg,
+          Map<SequenceI, SequenceCollectionI> map, boolean up);
 }
index 528fbfc..9ba8586 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4bd1ace..a23aad5 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -21,6 +21,7 @@ import jalview.util.ShiftList;
 \r
 import java.io.PrintStream;\r
 import java.util.Enumeration;\r
+import java.util.List;\r
 import java.util.Vector;\r
 \r
 /**\r
@@ -105,7 +106,7 @@ public class AlignmentView
     SequenceI[] selseqs;\r
     if (selection != null)\r
     {\r
-      Vector sel = selection.getSequences(null);\r
+      List<SequenceI> sel = selection.getSequences(null);\r
       this.selected = new Vector();\r
       selseqs = selection.getSequencesInOrder(alignment, selectedRegionOnly);\r
     }\r
@@ -116,12 +117,8 @@ public class AlignmentView
 \r
     // get the alignment's group list and make a copy\r
     Vector grps = new Vector();\r
-    Vector gg = alignment.getGroups();\r
-    Enumeration gge = gg.elements();\r
-    while (gge.hasMoreElements())\r
-    {\r
-      grps.addElement(gge.nextElement());\r
-    }\r
+    List<SequenceGroup> gg = alignment.getGroups();\r
+    grps.addAll(gg);\r
     ScGroup[] sgrps = null;\r
     boolean addedgps[] = null;\r
     if (grps != null)\r
@@ -1047,12 +1044,10 @@ public class AlignmentView
                 + " wide and has " + visal.getHeight() + " seqs.");\r
         if (visal.getGroups() != null && visal.getGroups().size() > 0)\r
         {\r
-          SequenceGroup sg;\r
-          Enumeration en = visal.getGroups().elements();\r
+          \r
           int i = 1;\r
-          while (en.hasMoreElements())\r
+          for (SequenceGroup sg:visal.getGroups())\r
           {\r
-            sg = (SequenceGroup) en.nextElement();\r
             os.println("Group " + (i++) + " begins at column "\r
                     + sg.getStartRes() + " and ends at " + sg.getEndRes());\r
           }\r
diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java
new file mode 100644 (file)
index 0000000..ff365a9
--- /dev/null
@@ -0,0 +1,14 @@
+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);
+
+}
index 609158d..6b22cad 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -34,7 +34,7 @@ public class Annotation
   public String description = ""; // currently used as mouse over
 
   /** DOCUMENT ME!! */
-  public char secondaryStructure = ' '; // recognises H and E
+  public char secondaryStructure = ' '; // recognises H, E and S(?)
 
   /** DOCUMENT ME!! */
   public float value;
index 451e7b5..6a1d2d2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2b4ce6b..062f6ba 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 78d34ed..dea0d72 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index df6f5f3..cd653cd 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index e31c818..b779498 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 6aa9988..9ea3a43 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 786101e..d0fc927 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 853255d..115ef88 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e1f5f41..fbd11ad 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -61,6 +61,11 @@ public class DBRefSource
    * PFAM ID\r
    */\r
   public static String PFAM = "PFAM";\r
+  \r
+  /**\r
+   * RFAM ID\r
+   */\r
+  public static String RFAM = "RFAM";\r
 \r
   /**\r
    * GeneDB ID\r
@@ -86,7 +91,7 @@ public class DBRefSource
   { PDB };\r
 \r
   public static final String[] DOMAINDBS =\r
-  { PFAM };\r
+  { PFAM, RFAM };\r
 \r
   /**\r
    * set of unique DBRefSource property constants. These could be used to\r
@@ -115,7 +120,7 @@ public class DBRefSource
   public static final Object DNACODINGSEQDB = "XONCODING";\r
 \r
   /**\r
-   * DB returns several sequences associated with a protein domain\r
+   * DB returns several sequences associated with a protein/nucleotide domain\r
    */\r
   public static final Object DOMAINDB = "DOMAIN";\r
 \r
index 8c238ef..eaf5874 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index deab08a..4af7ac4 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 901cf35..2a6b601 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -140,14 +140,15 @@ public class HiddenSequences
     alignment.deleteSequence(sequence);
   }
 
-  public Vector showAll(Hashtable hiddenReps)
+  public Vector showAll(
+          Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
     Vector revealedSeqs = new Vector();
     for (int i = 0; i < hiddenSequences.length; i++)
     {
       if (hiddenSequences[i] != null)
       {
-        Vector tmp = showSequence(i, hiddenReps);
+        Vector tmp = showSequence(i, hiddenRepSequences);
         for (int t = 0; t < tmp.size(); t++)
         {
           revealedSeqs.addElement(tmp.elementAt(t));
@@ -157,14 +158,15 @@ public class HiddenSequences
     return revealedSeqs;
   }
 
-  public Vector showSequence(int alignmentIndex, Hashtable hiddenReps)
+  public Vector showSequence(int alignmentIndex,
+          Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
   {
     Vector revealedSeqs = new Vector();
     SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
-    if (repSequence != null && hiddenReps != null
-            && hiddenReps.containsKey(repSequence))
+    if (repSequence != null && hiddenRepSequences != null
+            && hiddenRepSequences.containsKey(repSequence))
     {
-      hiddenReps.remove(repSequence);
+      hiddenRepSequences.remove(repSequence);
       revealedSeqs.addElement(repSequence);
     }
 
@@ -175,25 +177,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.addElement(seq);
+            asequences.add(alignmentIndex, seq);
+          }
+          else
+          {
+            System.out.println(seq.getName()
+                    + " has been deleted whilst hidden");
+          }
         }
-      }
 
+      }
     }
 
     return revealedSeqs;
index 7116a2b..01c5151 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0e1c880..cea2fd9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d65293f..8c2473b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cb3bbf7..a05a6e9 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d6711d7..55d6c8b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 89268f0..3efb713 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 182ad7b..46989bf 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 52d9a72..293528d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.datamodel;
 
-import java.util.*;
+import jalview.analysis.AlignSeq;
 
-import jalview.analysis.*;
+import java.util.Enumeration;
+import java.util.Vector;
 
 /**
  * 
@@ -53,6 +54,11 @@ public class Sequence implements SequenceI
    * to the residues of this sequence
    */
   Vector annotation;
+  
+  /**
+   * The index of the sequence in a MSA 
+   */
+  int index = -1;
 
   /** array of seuqence features - may not be null for a valid sequence object */
   public SequenceFeature[] sequenceFeatures;
@@ -895,8 +901,10 @@ public class Sequence implements SequenceI
     {
       this.annotation = new Vector();
     }
-
-    this.annotation.addElement(annotation);
+    if (!this.annotation.contains(annotation))
+    {
+      this.annotation.addElement(annotation);
+    }
     annotation.setSequenceRef(this);
   }
 
@@ -1172,4 +1180,17 @@ 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; }
 }
diff --git a/src/jalview/datamodel/SequenceCollectionI.java b/src/jalview/datamodel/SequenceCollectionI.java
new file mode 100644 (file)
index 0000000..db79b4d
--- /dev/null
@@ -0,0 +1,12 @@
+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();
+
+}
index 6fed6ee..a0ba614 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -40,7 +40,7 @@ public class SequenceFeature
   public Hashtable otherDetails;
 
   public java.util.Vector links;
-
+  
   // Feature group can be set from a features file
   // as a group of features between STARTGROUP and ENDGROUP markers
   public String featureGroup;
@@ -95,7 +95,7 @@ public class SequenceFeature
       }
     }
   }
-
+  
   public SequenceFeature(String type, String desc, String status,
           int begin, int end, String featureGroup)
   {
index 01bf677..ed21f60 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -18,6 +18,7 @@
 package jalview.datamodel;
 
 import java.util.*;
+import java.util.List;
 
 import java.awt.*;
 
@@ -30,7 +31,7 @@ import jalview.schemes.*;
  * @author $author$
  * @version $Revision$
  */
-public class SequenceGroup
+public class SequenceGroup implements AnnotatedCollectionI
 {
   String groupName;
 
@@ -54,7 +55,7 @@ public class SequenceGroup
   /**
    * group members
    */
-  private Vector sequences = new Vector();
+  private Vector<SequenceI> sequences = new Vector<SequenceI>();
 
   /**
    * representative sequence for this group (if any)
@@ -91,6 +92,11 @@ public class SequenceGroup
    * consensus calculation property
    */
   private boolean showSequenceLogo = false;
+  /**
+   * flag indicating if logo should be rendered normalised
+   */
+  private boolean normaliseSequenceLogo;
+
 
   /**
    * @return the includeAllConsSymbols
@@ -147,7 +153,7 @@ public class SequenceGroup
     if (seqsel != null)
     {
       sequences = new Vector();
-      Enumeration sq = seqsel.sequences.elements();
+      Enumeration<SequenceI> sq = seqsel.sequences.elements();
       while (sq.hasMoreElements())
       {
         sequences.addElement(sq.nextElement());
@@ -279,8 +285,11 @@ public class SequenceGroup
 
     return eres;
   }
-
-  public Vector getSequences(Hashtable hiddenReps)
+  public List<SequenceI> getSequences()
+  {
+    return sequences;
+  }
+  public List<SequenceI> getSequences(Map<SequenceI, SequenceCollectionI> hiddenReps)
   {
     if (hiddenReps == null)
     {
@@ -289,17 +298,16 @@ public class SequenceGroup
     else
     {
       Vector allSequences = new Vector();
-      SequenceI seq, seq2;
+      SequenceI seq;
       for (int i = 0; i < sequences.size(); i++)
       {
         seq = (SequenceI) sequences.elementAt(i);
         allSequences.addElement(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);
@@ -312,20 +320,14 @@ public class SequenceGroup
     }
   }
 
-  public SequenceI[] getSequencesAsArray(Hashtable hiddenReps)
+  public SequenceI[] getSequencesAsArray(Map<SequenceI, SequenceCollectionI> map)
   {
-    Vector tmp = getSequences(hiddenReps);
-    if (tmp == null)
+    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()]);
   }
 
   /**
@@ -477,7 +479,10 @@ public class SequenceGroup
     {
       return;
     }
-
+    if (cs!=null)
+    {
+      cs.alignmentChanged(this,null);
+    }
     try
     {
       Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes,
@@ -489,11 +494,7 @@ public class SequenceGroup
       if (cs != null)
       {
         cs.setConsensus(cnsns);
-
-        if (cs instanceof ClustalxColourScheme)
-        {
-          ((ClustalxColourScheme) cs).resetClustalX(sequences, getWidth());
-        }
+        cs.alignmentChanged(this,null);
       }
 
       if ((conservation != null)
@@ -513,12 +514,7 @@ public class SequenceGroup
           if (cs.conservationApplied())
           {
             cs.setConservation(c);
-
-            if (cs instanceof ClustalxColourScheme)
-            {
-              ((ClustalxColourScheme) cs).resetClustalX(sequences,
-                      getWidth());
-            }
+            cs.alignmentChanged(this,null);
           }
         }
       }
@@ -948,18 +944,18 @@ 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();
     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]);
       }
@@ -1167,4 +1163,63 @@ 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>();
+    for (SequenceI seq:(Vector<SequenceI>)sequences)
+    {
+      for (AlignmentAnnotation al: seq.getAnnotation())
+      {
+        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;
+  }
+
+  public void clear()
+  {
+    sequences.clear();
+  }
 }
index d1e3853..33045d0 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,7 +17,7 @@
  */
 package jalview.datamodel;
 
-import java.util.*;
+import java.util.Vector;
 
 /**
  * DOCUMENT ME!
@@ -348,5 +348,15 @@ public interface SequenceI
    *          null or mapping from entry's numbering to local start/end
    */
   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();
 
 }
index 90a3681..0546065 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 921318f..2e6f175 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e93a262..adb9484 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e90c616..cf82757 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 18eeb74..578e60c 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index c239766..151e5b4 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 31a1418..0922b36 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a949888..4011e0b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 612cf23..aab91ac 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 65ee51a..04b88ba 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 91a0133..16784cc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a20a9f7..43a6cef 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 277423d..111f816 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6c583cf..442147f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5e085fa..c0b0cf7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0640b8c..7f949c7 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -357,7 +357,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
       for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
       {\r
         StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
-\r
+        // RACE CONDITION - getMapping only returns Jmol loaded filenames once Jmol callback has completed. \r
         if (mapping == null || mapping.length < 1)\r
           continue;\r
 \r
@@ -690,10 +690,17 @@ public abstract class JalviewJmolBinding implements StructureListener,
       String mset[] = new String[viewer.getModelCount()];\r
       _modelFileNameMap = new int[mset.length];\r
       int j = 1;\r
-      mset[0] = viewer.getModelFileName(0);\r
+      String m=viewer.getModelFileName(0);\r
+      if (m!=null)\r
+      {\r
+        mset[0] = new File(m).getAbsolutePath();\r
+      }\r
       for (int i = 1; i < mset.length; i++)\r
       {\r
-        mset[j] = viewer.getModelFileName(i);\r
+        m=viewer.getModelFileName(i);\r
+        if (m!=null) {\r
+          mset[j] = new File(m).getAbsolutePath();\r
+        }\r
         _modelFileNameMap[j] = i; // record the model index for the filename\r
         // skip any additional models in the same file (NMR structures)\r
         if ((mset[j] == null ? mset[j] != mset[j - 1]\r
@@ -869,8 +876,17 @@ public abstract class JalviewJmolBinding implements StructureListener,
       try\r
       {\r
         // recover PDB filename for the model hovered over.\r
-        pdbfilename = viewer\r
-                .getModelFileName(new Integer(mdlId).intValue() - 1);\r
+        int _mp=_modelFileNameMap.length-1,\r
+                mnumber=new Integer(mdlId).intValue() - 1;\r
+        while(mnumber<_modelFileNameMap[_mp])\r
+        {\r
+          _mp--;\r
+        }\r
+        pdbfilename = modelFileNames[_mp];\r
+        if (pdbfilename==null) {pdbfilename=new File(viewer\r
+                .getModelFileName(mnumber)).getAbsolutePath();\r
+        }\r
+        \r
       } catch (Exception e)\r
       {\r
       }\r
@@ -1130,7 +1146,8 @@ public abstract class JalviewJmolBinding implements StructureListener,
           }\r
           else\r
           {\r
-            if (matches = pdbentry[pe].getFile().equals(fileName))\r
+            File fl;\r
+            if (matches = (fl=new File(pdbentry[pe].getFile())).equals(new File(fileName)))\r
             {\r
               foundEntry = true;\r
               // TODO: Jmol can in principle retrieve from CLASSLOADER but\r
@@ -1141,7 +1158,6 @@ public abstract class JalviewJmolBinding implements StructureListener,
               String protocol = AppletFormatAdapter.URL;\r
               try\r
               {\r
-                File fl = new java.io.File(pdbentry[pe].getFile());\r
                 if (fl.exists())\r
                 {\r
                   protocol = AppletFormatAdapter.FILE;\r
@@ -1151,9 +1167,10 @@ public abstract class JalviewJmolBinding implements StructureListener,
               } catch (Error e)\r
               {\r
               }\r
-              ;\r
+              //Explicitly map to the filename used by Jmol ;\r
               pdb = ssm.setMapping(sequence[pe], chains[pe],\r
-                      pdbentry[pe].getFile(), protocol);\r
+                      fileName, protocol);\r
+                      //pdbentry[pe].getFile(), protocol);\r
 \r
             }\r
           }\r
@@ -1164,7 +1181,7 @@ public abstract class JalviewJmolBinding implements StructureListener,
             {\r
               String chid = new String(pdb.id + ":"\r
                       + ((MCview.PDBChain) pdb.chains.elementAt(i)).id);\r
-              chainFile.put(chid, pdbentry[pe].getFile());\r
+              chainFile.put(chid, fileName);\r
               chainNames.addElement(chid);\r
             }\r
             notifyLoaded = true;\r
index 71faba3..b38979b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java
new file mode 100644 (file)
index 0000000..ced3c8d
--- /dev/null
@@ -0,0 +1,56 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE.  See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package jalview.ext.varna;\r
+\r
+import java.io.File;\r
+\r
+import java.net.URL;\r
+import java.util.*;\r
+import java.applet.Applet;\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.JPanel;\r
+\r
+import jalview.api.AlignmentViewPanel;\r
+import jalview.api.FeatureRenderer;\r
+import jalview.api.SequenceRenderer;\r
+import jalview.api.SequenceStructureBinding;\r
+import jalview.api.StructureSelectionManagerProvider;\r
+import jalview.datamodel.*;\r
+import jalview.structure.*;\r
+import jalview.io.*;\r
+\r
+import org.jmol.api.*;\r
+import org.jmol.adapter.smarter.SmarterJmolAdapter;\r
+\r
+import org.jmol.popup.*;\r
+import org.jmol.viewer.JmolConstants;\r
+import org.jmol.viewer.Viewer;\r
+\r
+import jalview.schemes.*;\r
+\r
+import fr.orsay.lri.varna.applications.*;\r
+\r
+\r
+public abstract class JalviewVarnaBinding implements StructureListener, SequenceStructureBinding,\r
+        ComponentListener, StructureSelectionManagerProvider\r
+\r
+{\r
+  \r
+}\r
diff --git a/src/jalview/ext/varna/VarnaCommands.java b/src/jalview/ext/varna/VarnaCommands.java
new file mode 100644 (file)
index 0000000..9d57969
--- /dev/null
@@ -0,0 +1,142 @@
+/**\r
+ * \r
+ */\r
+package jalview.ext.varna;\r
+\r
+import jalview.api.FeatureRenderer;\r
+import jalview.api.SequenceRenderer;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.structure.StructureMapping;\r
+import jalview.structure.StructureSelectionManager;\r
+import jalview.util.Comparison;\r
+\r
+import java.awt.Color;\r
+import java.util.ArrayList;\r
+\r
+/**\r
+ * Routines for generating Jmol commands for Jalview/Jmol binding\r
+ * another cruisecontrol test.\r
+ * \r
+ * @author JimP\r
+ *\r
+ */\r
+public class VarnaCommands\r
+{\r
+\r
+  /**\r
+   * Jmol utility which constructs the commands to colour chains by the given alignment\r
+   * \r
+   */\r
+  public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)\r
+  {\r
+    ArrayList<String> str = new ArrayList<String>();\r
+    StringBuffer command = new StringBuffer();\r
+  \r
+    for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
+    {\r
+      StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
+  \r
+      if (mapping == null || mapping.length < 1)\r
+        continue;\r
+  \r
+      int lastPos = -1;\r
+      for (int s = 0; s < sequence[pdbfnum].length; s++)\r
+      {\r
+        for (int sp, m = 0; m < mapping.length; m++)\r
+        {\r
+          if (mapping[m].getSequence() == sequence[pdbfnum][s]\r
+                  && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)\r
+          {\r
+            SequenceI asp = alignment.getSequenceAt(sp);\r
+            for (int r = 0; r < asp.getLength(); r++)\r
+            {\r
+              // no mapping to gaps in sequence\r
+              if (jalview.util.Comparison.isGap(asp.getCharAt(r)))\r
+              {\r
+                continue;\r
+              }\r
+              int pos = mapping[m].getPDBResNum(asp.findPosition(r));\r
+  \r
+              if (pos < 1 || pos == lastPos)\r
+                continue;\r
+  \r
+              lastPos = pos;\r
+  \r
+              Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);\r
+  \r
+              if (fr != null)\r
+                col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);\r
+              String newSelcom = (mapping[m].getChain() != " " ? ":"\r
+                      + mapping[m].getChain() : "")\r
+                      + "/"\r
+                      + (pdbfnum + 1)\r
+                      + ".1"\r
+                      + ";color["\r
+                      + col.getRed()\r
+                      + ","\r
+                      + col.getGreen()\r
+                      + ","\r
+                      + col.getBlue() + "]";\r
+              if (command.length()>newSelcom.length() && command.substring(command.length()-newSelcom.length()).equals(newSelcom))\r
+              {\r
+                command = VarnaCommands.condenseCommand(command, pos);\r
+                continue;\r
+              }\r
+              // TODO: deal with case when buffer is too large for Jmol to parse\r
+              // - execute command and flush\r
+  \r
+              command.append(";");\r
+              if (command.length()>51200)\r
+              {\r
+                // add another chunk\r
+                str.add(command.toString());\r
+                command.setLength(0);\r
+              }\r
+              command.append("select " + pos);\r
+              command.append(newSelcom);\r
+            }\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+    {\r
+      // add final chunk\r
+      str.add(command.toString());\r
+      command.setLength(0);\r
+    }\r
+    return str.toArray(new String[str.size()]);\r
+  }\r
+\r
+  public static StringBuffer condenseCommand(StringBuffer command, int pos)\r
+  {\r
+  \r
+    // work back to last 'select'\r
+    int p=command.length(),q=p;\r
+    do {\r
+      p-=6;\r
+      if (p<1) { p=0; };\r
+    } while ((q=command.indexOf("select",p))==-1 && p>0);\r
+    \r
+    StringBuffer sb = new StringBuffer(command.substring(0,q+7));\r
+  \r
+    command =  command.delete(0,q+7);\r
+  \r
+    String start;\r
+  \r
+    if (command.indexOf("-") > -1)\r
+    {\r
+      start = command.substring(0, command.indexOf("-"));\r
+    }\r
+    else\r
+    {\r
+      start = command.substring(0, command.indexOf(":"));\r
+    }\r
+  \r
+    sb.append(start + "-" + pos + command.substring(command.indexOf(":")));\r
+  \r
+    return sb;\r
+  }\r
+\r
+}\r
index 2ecd947..304cfb7 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -55,6 +55,7 @@ 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,15 +66,18 @@ 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.ws.jws1.Discoverer;
 import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.seqfetcher.DbSourceProxy;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -104,6 +108,7 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.JButton;
@@ -122,7 +127,7 @@ import javax.swing.SwingUtilities;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -154,7 +159,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Creates a new AlignFrame object with specific width and height.
-   * 
+   *
    * @param al
    * @param width
    * @param height
@@ -167,7 +172,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Creates a new AlignFrame object with specific width, height and
    * sequenceSetId
-   * 
+   *
    * @param al
    * @param width
    * @param height
@@ -182,7 +187,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Creates a new AlignFrame object with specific width, height and
    * sequenceSetId
-   * 
+   *
    * @param al
    * @param width
    * @param height
@@ -197,7 +202,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * new alignment window with hidden columns
-   * 
+   *
    * @param al
    *          AlignmentI
    * @param hiddenColumns
@@ -216,7 +221,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Create alignment frame for al with hiddenColumns, a specific width and
    * height, and specific sequenceId
-   * 
+   *
    * @param al
    * @param hiddenColumns
    * @param width
@@ -233,7 +238,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Create alignment frame for al with hiddenColumns, a specific width and
    * height, and specific sequenceId
-   * 
+   *
    * @param al
    * @param hiddenColumns
    * @param width
@@ -262,7 +267,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Make a new AlignFrame from exisiting alignmentPanels
-   * 
+   *
    * @param ap
    *          AlignmentPanel
    * @param av
@@ -282,7 +287,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   void init()
   {
-    if (viewport.conservation == null)
+    if (viewport.getAlignmentConservationAnnotation() == null)
     {
       BLOSUM62Colour.setEnabled(false);
       conservationMenuItem.setEnabled(false);
@@ -308,7 +313,7 @@ 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);
@@ -330,7 +335,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Change the filename and format for the alignment, and enable the 'reload'
    * button functionality.
-   * 
+   *
    * @param file
    *          valid filename
    * @param format
@@ -347,6 +352,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   {
     addKeyListener(new KeyAdapter()
     {
+      @Override
       public void keyPressed(KeyEvent evt)
       {
         if (viewport.cursorMode
@@ -402,6 +408,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           }
           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)
@@ -516,6 +533,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         }
       }
 
+      @Override
       public void keyReleased(KeyEvent evt)
       {
         switch (evt.getKeyCode())
@@ -568,12 +586,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);
     }
   }
 
@@ -599,6 +618,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 +627,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                   SwingUtilities.invokeLater(new Runnable()
                   {
 
+                    @Override
                     public void run()
                     {
                       System.err
@@ -620,6 +641,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             });
     addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
     {
+      @Override
       public void internalFrameClosed(
               javax.swing.event.InternalFrameEvent evt)
       {
@@ -632,6 +654,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();
@@ -645,11 +668,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     conservationMenuItem.setEnabled(!nucleotide);
     modifyConservation.setEnabled(!nucleotide);
     showGroupConservation.setEnabled(!nucleotide);
+    rnahelicesColour.setEnabled(nucleotide);
+    purinePyrimidineColour.setEnabled(nucleotide);
     // Remember AlignFrame always starts as protein
-    if (!nucleotide)
-    {
-      calculateMenu.remove(calculateMenu.getItemCount() - 2);
-    }
+    // if (!nucleotide)
+    // {
+    // showTr
+    // calculateMenu.remove(calculateMenu.getItemCount() - 2);
+    // }
   }
 
   /**
@@ -665,13 +691,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Need to call this method when tabs are selected for multiple views, or when
    * loading from Jalview2XML.java
-   * 
+   *
    * @param av
    *          AlignViewport
    */
   void setMenusFromViewport(AlignViewport av)
   {
-    padGapsMenuitem.setSelected(av.padGaps);
+    padGapsMenuitem.setSelected(av.isPadGaps());
     colourTextMenuItem.setSelected(av.showColourText);
     abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
     conservationMenuItem.setSelected(av.getConservationSelected());
@@ -686,23 +712,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     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);
+    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);
+    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();
@@ -712,9 +742,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
    */
+  @Override
   public void setProgressBar(String message, long id)
   {
     if (progressBars == null)
@@ -762,6 +793,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     validate();
   }
 
+  @Override
   public void registerHandler(final long id,
           final IProgressIndicatorHandler handler)
   {
@@ -779,6 +811,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       cancel.addActionListener(new ActionListener()
       {
 
+        @Override
         public void actionPerformed(ActionEvent e)
         {
           handler.cancelActivity(id);
@@ -793,7 +826,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * 
+   *
    * @return true if any progress bars are still active
    */
   public boolean operationInProgress()
@@ -818,20 +851,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     return alignPanel.seqPanel.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"))
@@ -877,6 +915,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 +929,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @Override
   public void addFromText_actionPerformed(ActionEvent e)
   {
     Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
   }
 
+  @Override
   public void addFromURL_actionPerformed(ActionEvent e)
   {
     Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
   }
 
+  @Override
   public void save_actionPerformed(ActionEvent e)
   {
     if (fileName == null
@@ -917,10 +959,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void saveAs_actionPerformed(ActionEvent e)
   {
     JalviewFileChooser chooser = new JalviewFileChooser(
@@ -995,7 +1038,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
       String[] omitHidden = null;
 
-      if (viewport.hasHiddenColumns)
+      if (viewport.hasHiddenColumns())
       {
         int reply = JOptionPane
                 .showInternalConfirmDialog(
@@ -1012,10 +1055,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         }
       }
       FormatAdapter f = new FormatAdapter();
-      String output = f.formatSequences(format,
-              (Alignment) viewport.alignment, // class cast exceptions will
+      String output = f.formatSequences(
+              format,
+              viewport.getAlignment(), // class cast exceptions will
               // occur in the distant future
-              omitHidden, f.getCacheSuffixDefault(format), viewport.colSel);
+              omitHidden, f.getCacheSuffixDefault(format),
+              viewport.getColumnSelection());
 
       if (output == null)
       {
@@ -1067,15 +1112,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void outputText_actionPerformed(ActionEvent e)
   {
     String[] omitHidden = null;
 
-    if (viewport.hasHiddenColumns)
+    if (viewport.hasHiddenColumns())
     {
       int reply = JOptionPane
               .showInternalConfirmDialog(
@@ -1098,7 +1144,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     try
     {
       cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
-              viewport.alignment, omitHidden, viewport.colSel));
+              viewport.getAlignment(), omitHidden,
+              viewport.getColumnSelection()));
       Desktop.addInternalFrame(cap,
               "Alignment output - " + e.getActionCommand(), 600, 500);
     } catch (OutOfMemoryError oom)
@@ -1111,10 +1158,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void htmlMenuItem_actionPerformed(ActionEvent e)
   {
     new HTMLOutput(alignPanel,
@@ -1129,10 +1177,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void createPNG(File f)
   {
     alignPanel.makePNG(f);
@@ -1140,15 +1189,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void createEPS(File f)
   {
     alignPanel.makeEPS(f);
   }
 
+  @Override
   public void pageSetup_actionPerformed(ActionEvent e)
   {
     PrinterJob printJob = PrinterJob.getPrinterJob();
@@ -1157,10 +1208,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void printMenuItem_actionPerformed(ActionEvent e)
   {
     // Putting in a thread avoids Swing painting problems
@@ -1168,21 +1220,23 @@ 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,
+            viewport.showAnnotation ? viewport.getAlignment()
+                    .getAlignmentAnnotation() : null, viewport
+                    .getAlignment().getGroups(), ((Alignment) viewport
+                    .getAlignment()).alignmentProperties);
   }
 
+  @Override
   public void associatedData_actionPerformed(ActionEvent e)
   {
     // Pick the tree file
@@ -1206,9 +1260,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Close the current view or all views in the alignment frame. If the frame
    * only contains one view then the alignment will be removed from memory.
-   * 
+   *
    * @param closeAllTabs
    */
+  @Override
   public void closeMenuItem_actionPerformed(boolean closeAllTabs)
   {
     if (alignPanels != null && alignPanels.size() < 2)
@@ -1251,7 +1306,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * close alignPanel2 and shuffle tabs appropriately.
-   * 
+   *
    * @param alignPanel2
    */
   public void closeView(AlignmentPanel alignPanel2)
@@ -1318,14 +1373,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       viewport.historyList.push(command);
       viewport.redoList.clear();
       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);
     }
   }
 
   /**
-   * 
+   *
    * @return alignment objects for all views
    */
   AlignmentI[] getViewAlignments()
@@ -1343,17 +1400,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     if (viewport != null)
     {
       return new AlignmentI[]
-      { viewport.alignment };
+      { viewport.getAlignment() };
     }
     return null;
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void undoMenuItem_actionPerformed(ActionEvent e)
   {
     if (viewport.historyList.empty())
@@ -1367,20 +1425,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     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());
     }
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void redoMenuItem_actionPerformed(ActionEvent e)
   {
     if (viewport.redoList.size() < 1)
@@ -1397,11 +1464,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     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());
     }
   }
 
@@ -1423,7 +1499,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       {
         if (comps.elementAt(i) instanceof AlignmentPanel)
         {
-          if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)
+          if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())
           {
             originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
             break;
@@ -1438,7 +1514,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;
@@ -1449,7 +1525,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param up
    *          DOCUMENT ME!
    */
@@ -1461,69 +1537,24 @@ 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 Vector();
     if (viewport.cursorMode)
     {
-      sg.addElement(viewport.alignment
-              .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));
+      sg.add(viewport.getAlignment().getSequenceAt(
+              alignPanel.seqPanel.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)
@@ -1533,15 +1564,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     Vector invertGroup = new Vector();
 
-    for (int i = 0; i < viewport.alignment.getHeight(); i++)
+    for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
     {
-      if (!sg.contains(viewport.alignment.getSequenceAt(i)))
-        invertGroup.add(viewport.alignment.getSequenceAt(i));
+      if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+        invertGroup.add(viewport.getAlignment().getSequenceAt(i));
     }
 
-    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++)
@@ -1596,10 +1625,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void copy_actionPerformed(ActionEvent e)
   {
     System.gc();
@@ -1612,7 +1642,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     SequenceI[] seqs = viewport.getSelectionAsNewSequence();
     String[] omitHidden = null;
 
-    if (viewport.hasHiddenColumns)
+    if (viewport.hasHiddenColumns())
     {
       omitHidden = viewport.getViewAsString(true);
     }
@@ -1639,7 +1669,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
 
     Vector hiddenColumns = null;
-    if (viewport.hasHiddenColumns)
+    if (viewport.hasHiddenColumns())
     {
       hiddenColumns = new Vector();
       int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
@@ -1658,16 +1688,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
 
     Desktop.jalviewClipboard = new Object[]
-    { seqs, viewport.alignment.getDataset(), hiddenColumns };
+    { seqs, viewport.getAlignment().getDataset(), hiddenColumns };
     statusBar.setText("Copied " + seqs.length + " sequences to clipboard.");
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void pasteNew_actionPerformed(ActionEvent e)
   {
     paste(true);
@@ -1675,10 +1706,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void pasteThis_actionPerformed(ActionEvent e)
   {
     paste(false);
@@ -1686,7 +1718,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Paste contents of Jalview clipboard
-   * 
+   *
    * @param newAlignment
    *          true to paste to a new alignment, otherwise add to this.
    */
@@ -1955,10 +1987,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void cut_actionPerformed(ActionEvent e)
   {
     copy_actionPerformed(null);
@@ -1967,10 +2000,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void delete_actionPerformed(ActionEvent evt)
   {
 
@@ -1989,7 +2023,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
 
     // If the cut affects all sequences, remove highlighted columns
-    if (sg.getSize() == viewport.alignment.getHeight())
+    if (sg.getSize() == viewport.getAlignment().getHeight())
     {
       viewport.getColumnSelection().removeElements(sg.getStartRes(),
               sg.getEndRes() + 1);
@@ -2006,11 +2040,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
      */
     addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
             sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
-            viewport.alignment));
+            viewport.getAlignment()));
 
     viewport.setSelectionGroup(null);
     viewport.sendSelection();
-    viewport.alignment.deleteGroup(sg);
+    viewport.getAlignment().deleteGroup(sg);
 
     viewport.firePropertyChange("alignment", null, viewport.getAlignment()
             .getSequences());
@@ -2027,13 +2061,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void deleteGroups_actionPerformed(ActionEvent e)
   {
-    viewport.alignment.deleteAllGroups();
+    viewport.getAlignment().deleteAllGroups();
     viewport.sequenceColours = null;
     viewport.setSelectionGroup(null);
     PaintRefresher.Refresh(this, viewport.getSequenceSetId());
@@ -2043,10 +2078,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
   {
     SequenceGroup sg = new SequenceGroup();
@@ -2056,7 +2092,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);
@@ -2065,10 +2101,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
   {
     if (viewport.cursorMode)
@@ -2088,10 +2125,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
   {
     SequenceGroup sg = viewport.getSelectionGroup();
@@ -2113,6 +2151,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     viewport.sendSelection();
   }
 
+  @Override
   public void invertColSel_actionPerformed(ActionEvent e)
   {
     viewport.invertColumnSelection();
@@ -2122,10 +2161,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
   {
     trimAlignment(true);
@@ -2133,10 +2173,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void remove2RightMenuItem_actionPerformed(ActionEvent e)
   {
     trimAlignment(false);
@@ -2162,11 +2203,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 +2215,28 @@ 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.");
 
       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);
         }
       }
 
@@ -2210,29 +2247,31 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
 
@@ -2241,7 +2280,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
     // 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());
@@ -2256,34 +2295,35 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
 
@@ -2294,13 +2334,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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());
   }
@@ -2317,22 +2358,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void findMenuItem_actionPerformed(ActionEvent e)
   {
     new Finder();
   }
 
+  @Override
   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.
@@ -2343,7 +2386,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * 
+   *
    * @param viewTitle
    *          title of newly created view
    * @return new alignment panel, already displayed.
@@ -2354,7 +2397,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   /**
-   * 
+   *
    * @param viewTitle
    *          title of newly created view
    * @param copyAnnotation
@@ -2368,13 +2411,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     if (!copyAnnotation)
     {
       // just remove all the current annotation except for the automatic stuff
-      newap.av.alignment.deleteAllGroups();
-      for (AlignmentAnnotation alan : newap.av.alignment
+      newap.av.getAlignment().deleteAllGroups();
+      for (AlignmentAnnotation alan : newap.av.getAlignment()
               .getAlignmentAnnotation())
       {
         if (!alan.autoCalculated)
         {
-          newap.av.alignment.deleteAnnotation(alan);
+          newap.av.getAlignment().deleteAnnotation(alan);
         }
         ;
       }
@@ -2436,11 +2479,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     return newap;
   }
 
+  @Override
   public void expandViews_actionPerformed(ActionEvent e)
   {
     Desktop.instance.explodeViews(this);
   }
 
+  @Override
   public void gatherViews_actionPerformed(ActionEvent e)
   {
     Desktop.instance.gatherViews(this);
@@ -2448,10 +2493,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void font_actionPerformed(ActionEvent e)
   {
     new FontChooser(alignPanel);
@@ -2459,10 +2505,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void seqLimit_actionPerformed(ActionEvent e)
   {
     viewport.setShowJVSuffix(seqLimits.isSelected());
@@ -2472,12 +2519,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     alignPanel.paintAlignment(true);
   }
 
+  @Override
   public void idRightAlign_actionPerformed(ActionEvent e)
   {
     viewport.rightAlignIds = idRightAlign.isSelected();
     alignPanel.paintAlignment(true);
   }
 
+  @Override
   public void centreColumnLabels_actionPerformed(ActionEvent e)
   {
     viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState();
@@ -2486,9 +2535,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
    */
+  @Override
   protected void followHighlight_actionPerformed()
   {
     if (viewport.followHighlight = this.followHighlightMenuItem.getState())
@@ -2500,10 +2550,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void colourTextMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setColourText(colourTextMenuItem.isSelected());
@@ -2512,10 +2563,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void wrapMenuItem_actionPerformed(ActionEvent e)
   {
     scaleAbove.setVisible(wrapMenuItem.isSelected());
@@ -2525,17 +2577,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
   }
 
+  @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();
@@ -2544,7 +2599,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * called by key handler and the hide all/show all menu items
-   * 
+   *
    * @param toggleSeqs
    * @param toggleCols
    */
@@ -2558,8 +2613,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 +2638,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 +2652,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)
@@ -2612,11 +2669,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
    * event.ActionEvent)
    */
+  @Override
   public void hideAllButSelection_actionPerformed(ActionEvent e)
   {
     toggleHiddenRegions(false, false);
@@ -2624,11 +2682,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  @Override
   public void hideAllSelection_actionPerformed(ActionEvent e)
   {
     SequenceGroup sg = viewport.getSelectionGroup();
@@ -2640,11 +2699,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
    * ActionEvent)
    */
+  @Override
   public void showAllhidden_actionPerformed(ActionEvent e)
   {
     viewport.showAllHiddenColumns();
@@ -2652,12 +2712,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());
@@ -2666,10 +2728,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void scaleAbove_actionPerformed(ActionEvent e)
   {
     viewport.setScaleAboveWrapped(scaleAbove.isSelected());
@@ -2678,10 +2741,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void scaleLeft_actionPerformed(ActionEvent e)
   {
     viewport.setScaleLeftWrapped(scaleLeft.isSelected());
@@ -2690,10 +2754,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void scaleRight_actionPerformed(ActionEvent e)
   {
     viewport.setScaleRightWrapped(scaleRight.isSelected());
@@ -2702,10 +2767,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setShowBoxes(viewBoxesMenuItem.isSelected());
@@ -2714,10 +2780,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void viewTextMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setShowText(viewTextMenuItem.isSelected());
@@ -2726,10 +2793,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setRenderGaps(renderGapsMenuItem.isSelected());
@@ -2738,6 +2806,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   public FeatureSettings featureSettings;
 
+  @Override
   public void featureSettings_actionPerformed(ActionEvent e)
   {
     if (featureSettings != null)
@@ -2756,10 +2825,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Set or clear 'Show Sequence Features'
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void showSeqFeatures_actionPerformed(ActionEvent evt)
   {
     viewport.setShowSequenceFeatures(showSeqFeatures.isSelected());
@@ -2772,10 +2842,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Set or clear 'Show Sequence Features'
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void showSeqFeaturesHeight_actionPerformed(ActionEvent evt)
   {
     viewport.setShowSequenceFeaturesHeight(showSeqFeaturesHeight
@@ -2795,21 +2866,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());
     alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
   }
 
+  @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>");
     JInternalFrame frame = new JInternalFrame();
@@ -2821,10 +2894,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void overviewMenuItem_actionPerformed(ActionEvent e)
   {
     if (alignPanel.overviewPanel != null)
@@ -2841,6 +2915,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     frame.setLayer(JLayeredPane.PALETTE_LAYER);
     frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
     {
+      @Override
       public void internalFrameClosed(
               javax.swing.event.InternalFrameEvent evt)
       {
@@ -2851,6 +2926,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     alignPanel.setOverviewPanel(overview);
   }
 
+  @Override
   public void textColour_actionPerformed(ActionEvent e)
   {
     new TextColourChooser().chooseColour(alignPanel, null);
@@ -2858,10 +2934,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void noColourmenuItem_actionPerformed(ActionEvent e)
   {
     changeColour(null);
@@ -2869,23 +2946,23 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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()));
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void zappoColour_actionPerformed(ActionEvent e)
   {
     changeColour(new ZappoColourScheme());
@@ -2893,10 +2970,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void taylorColour_actionPerformed(ActionEvent e)
   {
     changeColour(new TaylorColourScheme());
@@ -2904,10 +2982,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void hydrophobicityColour_actionPerformed(ActionEvent e)
   {
     changeColour(new HydrophobicColourScheme());
@@ -2915,10 +2994,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void helixColour_actionPerformed(ActionEvent e)
   {
     changeColour(new HelixColourScheme());
@@ -2926,10 +3006,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void strandColour_actionPerformed(ActionEvent e)
   {
     changeColour(new StrandColourScheme());
@@ -2937,10 +3018,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void turnColour_actionPerformed(ActionEvent e)
   {
     changeColour(new TurnColourScheme());
@@ -2948,10 +3030,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void buriedColour_actionPerformed(ActionEvent e)
   {
     changeColour(new BuriedColourScheme());
@@ -2959,26 +3042,47 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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 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());
@@ -2986,12 +3090,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param cs
    *          DOCUMENT ME!
    */
   public void changeColour(ColourSchemeI cs)
   {
+    // TODO: compare with applet and pull up to model method
     int threshold = 0;
 
     if (cs != null)
@@ -3013,13 +3118,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       if (viewport.getConservationSelected())
       {
 
-        Alignment al = (Alignment) viewport.alignment;
+        Alignment al = (Alignment) viewport.getAlignment();
         Conservation c = new Conservation("All",
                 ResidueProperties.propHash, 3, al.getSequences(), 0,
                 al.getWidth() - 1);
 
         c.calculate();
-        c.verdict(false, viewport.ConsPercGaps);
+        c.verdict(false, viewport.getConsPercGaps());
 
         cs.setConservation(c);
 
@@ -3031,19 +3136,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         cs.setConservation(null);
       }
 
-      cs.setConsensus(viewport.hconsensus);
+      cs.setConsensus(viewport.getSequenceConsensusHash());
     }
 
     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);
 
+      for (SequenceGroup sg:viewport.getAlignment().getGroups())
+      {
         if (cs == null)
         {
           sg.cs = null;
@@ -3052,9 +3155,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
         if (cs instanceof ClustalxColourScheme)
         {
-          sg.cs = new ClustalxColourScheme(
-                  sg.getSequences(viewport.hiddenRepSequences),
-                  sg.getWidth());
+          sg.cs = new ClustalxColourScheme(sg, viewport
+                  .getHiddenRepSequences());
         }
         else if (cs instanceof UserColourScheme)
         {
@@ -3064,7 +3166,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         {
           try
           {
-            sg.cs = (ColourSchemeI) cs.getClass().newInstance();
+            sg.cs = cs.getClass().newInstance();
           } catch (Exception ex)
           {
           }
@@ -3077,7 +3179,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
           sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
 
           sg.cs.setConsensus(AAFrequency.calculate(
-                  sg.getSequences(viewport.hiddenRepSequences),
+                  sg.getSequences(viewport.getHiddenRepSequences()),
                   sg.getStartRes(), sg.getEndRes() + 1));
         }
         else
@@ -3088,11 +3190,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         if (viewport.getConservationSelected())
         {
           Conservation c = new Conservation("Group",
-                  ResidueProperties.propHash, 3,
-                  sg.getSequences(viewport.hiddenRepSequences),
-                  sg.getStartRes(), sg.getEndRes() + 1);
+                  ResidueProperties.propHash, 3, sg.getSequences(viewport
+                          .getHiddenRepSequences()), sg.getStartRes(),
+                  sg.getEndRes() + 1);
           c.calculate();
-          c.verdict(false, viewport.ConsPercGaps);
+          c.verdict(false, viewport.getConsPercGaps());
           sg.cs.setConservation(c);
         }
         else
@@ -3112,14 +3214,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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");
@@ -3129,27 +3232,29 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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();
     }
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void conservationMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setConservationSelected(conservationMenuItem.isSelected());
@@ -3164,10 +3269,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void abovePIDThreshold_actionPerformed(ActionEvent e)
   {
     viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
@@ -3182,10 +3288,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void userDefinedColour_actionPerformed(ActionEvent e)
   {
     if (e.getActionCommand().equals("User Defined..."))
@@ -3227,6 +3334,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()
@@ -3249,6 +3357,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               {
                 radioItem.addActionListener(new ActionListener()
                 {
+                  @Override
                   public void actionPerformed(ActionEvent evt)
                   {
                     userDefinedColour_actionPerformed(evt);
@@ -3260,6 +3369,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         });
         radioItem.addActionListener(new ActionListener()
         {
+          @Override
           public void actionPerformed(ActionEvent evt)
           {
             userDefinedColour_actionPerformed(evt);
@@ -3274,10 +3384,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void PIDColour_actionPerformed(ActionEvent e)
   {
     changeColour(new PIDColourScheme());
@@ -3285,10 +3396,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void BLOSUM62Colour_actionPerformed(ActionEvent e)
   {
     changeColour(new Blosum62ColourScheme());
@@ -3296,71 +3408,77 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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);
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
   {
     new RedundancyPanel(alignPanel, this);
@@ -3368,10 +3486,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
   {
     if ((viewport.getSelectionGroup() == null)
@@ -3391,10 +3510,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void PCAMenuItem_actionPerformed(ActionEvent e)
   {
     if (((viewport.getSelectionGroup() != null)
@@ -3414,6 +3534,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     new PCAPanel(alignPanel);
   }
 
+  @Override
   public void autoCalculate_actionPerformed(ActionEvent e)
   {
     viewport.autoCalculateConsensus = autoCalculate.isSelected();
@@ -3423,6 +3544,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               .getAlignment().getSequences());
     }
   }
+
+  @Override
   public void sortByTreeOption_actionPerformed(ActionEvent e)
   {
     viewport.sortByTree = sortByTree.isSelected();
@@ -3433,12 +3556,14 @@ 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");
@@ -3446,10 +3571,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
   {
     NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
@@ -3457,10 +3583,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
   {
     NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
@@ -3468,10 +3595,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
   {
     NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
@@ -3479,7 +3607,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param type
    *          DOCUMENT ME!
    * @param pwType
@@ -3503,13 +3631,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         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
+        if (_s.getLength() < sg
                 .getEndRes())
         {
           JOptionPane
@@ -3531,7 +3658,7 @@ 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(
@@ -3545,7 +3672,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         return;
       }
 
-      if (viewport.alignment.getHeight() < 2)
+      if (viewport.getAlignment().getHeight() < 2)
       {
         return;
       }
@@ -3567,7 +3694,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param title
    *          DOCUMENT ME!
    * @param order
@@ -3580,6 +3707,7 @@ 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();
@@ -3588,8 +3716,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);
       }
@@ -3598,7 +3726,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Add a new sort by annotation score menu item
-   * 
+   *
    * @param sort
    *          the menu to add the option to
    * @param scoreLabel
@@ -3612,13 +3740,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);
       }
     });
@@ -3634,25 +3763,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * search the alignment and rebuild the sort by annotation score submenu the
    * last alignment annotation vector hash is stored to minimize cost of
    * 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 +3799,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       sortByAnnotScore.setVisible(scoreSorts.size() > 0);
       scoreSorts.clear();
 
-      _annotationScoreVectorHash = viewport.alignment
+      _annotationScoreVectorHash = viewport.getAlignment()
               .getAlignmentAnnotation().hashCode();
     }
   }
@@ -3681,12 +3810,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * call. Listeners are added to remove the menu item when the treePanel is
    * closed, and adjust the tree leaf to sequence mapping when the alignment is
    * modified.
-   * 
+   *
    * @param treePanel
    *          Displayed tree window.
    * @param title
    *          SortBy menu item title.
    */
+  @Override
   public void buildTreeMenu()
   {
     sortByTreeMenu.removeAll();
@@ -3720,11 +3850,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       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);
           addHistoryItem(tp.sortAlignmentIn(alignPanel));
-          
+
         }
       });
 
@@ -3739,7 +3870,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;
@@ -3748,7 +3879,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Work out whether the whole set of sequences or just the selected set will
    * be submitted for multiple alignment.
-   * 
+   *
    */
   public jalview.datamodel.AlignmentView gatherSequencesForAlignment()
   {
@@ -3763,7 +3894,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       /*
        * SequenceGroup seqs = viewport.getSelectionGroup(); int sz; msa = new
        * SequenceI[sz = seqs.getSize(false)];
-       * 
+       *
        * for (int i = 0; i < sz; i++) { msa[i] = (SequenceI)
        * seqs.getSequenceAt(i); }
        */
@@ -3773,9 +3904,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       /*
        * 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); } }
        */
@@ -3806,9 +3937,9 @@ 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] });
@@ -3821,10 +3952,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
   {
     // Pick the tree file
@@ -3860,6 +3992,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @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);
@@ -3880,7 +4018,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Add a treeviewer for the tree extracted from a newick file object to the
    * current alignment view
-   * 
+   *
    * @param nf
    *          the tree
    * @param title
@@ -3931,7 +4069,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Generates menu items and listener event actions for web service clients
-   * 
+   *
    */
   public void BuildWebServiceMenu()
   {
@@ -3950,6 +4088,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     buildingMenu = true;
     new Thread(new Runnable()
     {
+      @Override
       public void run()
       {
         try
@@ -3966,20 +4105,19 @@ 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("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
@@ -3987,7 +4125,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS");
             Vector secstrpr = (Vector) Discoverer.services
                     .get("SecStrPred");
-            Vector seqsrch = null; // (Vector) Discoverer.services.get("SeqSearch");
+            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,
@@ -4031,27 +4170,24 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
             }
           }
 
-          // 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);
+          // final ArrayList<JMenu> submens=new ArrayList<JMenu>();
+          // submens.add(msawsmenu);
+          // submens.add(secstrmenu);
+          // submens.add(dismenu);
+          // submens.add(analymenu);
+
           // No search services yet
           // wsmenu.add(seqsrchmenu);
 
           javax.swing.SwingUtilities.invokeLater(new Runnable()
           {
+            @Override
             public void run()
             {
               try
@@ -4062,15 +4198,46 @@ 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.
+                if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+                {
+                  Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+                  if (jws2servs != null)
+                  {
+                    if (jws2servs.hasServices())
+                    {
+                      jws2servs.attachWSMenuEntry(webService, me);
+                    }
+                    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)
               {
               }
@@ -4088,10 +4255,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   }
 
-
   /**
    * construct any groupURL type service menu entries.
-   * 
+   *
    * @param webService
    */
   private void build_urlServiceMenu(JMenu webService)
@@ -4101,20 +4267,25 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     /*
      * JMenuItem testAlView = new JMenuItem("Test AlignmentView"); final
      * 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);
      */
     // TODO: refactor to RestClient discoverer and merge menu entries for
     // 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);
+
+    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))
@@ -4128,12 +4299,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser
    * chooser = new JalviewFileChooser(jalview.bin.Cache.
    * getProperty("LAST_DIRECTORY"));
-   * 
+   *
    * chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Export
    * to Vamsas file"); chooser.setToolTipText("Export");
-   * 
+   *
    * int value = chooser.showSaveDialog(this);
-   * 
+   *
    * if (value == JalviewFileChooser.APPROVE_OPTION) {
    * jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(viewport);
    * //vs.store(chooser.getSelectedFile().getAbsolutePath() ); vs.storeJalview(
@@ -4141,7 +4312,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   /**
    * prototype of an automatically enabled/disabled analysis function
-   * 
+   *
    */
   protected void setShowProductsEnabled()
   {
@@ -4161,7 +4332,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * search selection for sequence xRef products and build the show products
    * menu.
-   * 
+   *
    * @param selection
    * @param dataset
    * @return true if showProducts menu should be enabled.
@@ -4191,6 +4362,7 @@ 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
@@ -4224,13 +4396,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     Runnable foo = new Runnable()
     {
 
+      @Override
       public void run()
       {
         final long sttime = System.currentTimeMillis();
         ths.setProgressBar("Searching for sequences from " + fsrc, sttime);
         try
         {
-          Alignment ds = ths.getViewport().alignment.getDataset(); // update
+          Alignment ds = ths.getViewport().getAlignment().getDataset(); // update
           // our local
           // dataset
           // reference
@@ -4307,6 +4480,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @Override
   public void showProducts_actionPerformed(ActionEvent e)
   {
     // /////////////////////////////
@@ -4340,6 +4514,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @Override
   public void showTranslation_actionPerformed(ActionEvent e)
   {
     // /////////////////////////////
@@ -4352,8 +4527,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     {
       al = jalview.analysis.Dna.CdnaTranslate(selection, seqstring,
               viewport.getViewAsVisibleContigs(true), viewport
-                      .getGapCharacter(), viewport.alignment
-                      .getAlignmentAnnotation(), viewport.alignment
+                      .getGapCharacter(), viewport.getAlignment()
+                      .getAlignmentAnnotation(), viewport.getAlignment()
                       .getWidth(), viewport.getAlignment().getDataset());
     } catch (Exception ex)
     {
@@ -4378,7 +4553,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * Try to load a features file onto the alignment.
-   * 
+   *
    * @param file
    *          contents or path to retrieve file
    * @param type
@@ -4390,11 +4565,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     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));
+      featuresFile = new FeaturesFile(file, type).parse(viewport
+              .getAlignment().getDataset(), alignPanel.seqPanel.seqCanvas
+              .getFeatureRenderer().featureColours, false,
+              jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
     } catch (Exception ex)
     {
       ex.printStackTrace();
@@ -4419,22 +4593,27 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     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 +4699,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);
@@ -4573,18 +4752,18 @@ 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);
+                if (pe != null)
+                {
+                  System.err.println("Associated file : "
+                          + ((String) fm[0]) + " with "
+                          + toassoc.getDisplayId(true));
+                  assocfiles++;
+                }
               }
               alignPanel.paintAlignment(true);
             }
@@ -4623,7 +4802,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * it's and Annotation file, then a JNet file, and finally a features file. If
    * all are false then the user may have dropped an alignment file onto this
    * AlignFrame.
-   * 
+   *
    * @param file
    *          either a filename or a URL string.
    */
@@ -4641,59 +4820,97 @@ 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)
+              .readAnnotationFile(viewport.getAlignment(), 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("Successfully pasted T-Coffee 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 ? "Check that the file matches sequence IDs in the alignment." : tcf.getWarningMessage(),
+                      "Problem reading T-COFFEE 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().add_annotation(predictions,
+                    viewport.getAlignment(), 0, false);
+            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);
+            }
           }
         }
       }
@@ -4711,6 +4928,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @Override
   public void tabSelectionChanged(int index)
   {
     if (index > -1)
@@ -4721,6 +4939,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     }
   }
 
+  @Override
   public void tabbedPane_mousePressed(MouseEvent e)
   {
     if (SwingUtilities.isRightMouseButton(e))
@@ -4745,10 +4964,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*)",
@@ -4762,11 +4982,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
    * )
    */
+  @Override
   protected void showDbRefs_actionPerformed(ActionEvent e)
   {
     viewport.setShowDbRefs(showDbRefsMenuitem.isSelected());
@@ -4774,10 +4995,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
    * ActionEvent)
    */
+  @Override
   protected void showNpFeats_actionPerformed(ActionEvent e)
   {
     viewport.setShowNpFeats(showNpFeatsMenuitem.isSelected());
@@ -4786,7 +5008,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * find the viewport amongst the tabs in this alignment frame and close that
    * tab
-   * 
+   *
    * @param av
    */
   public boolean closeView(AlignViewport av)
@@ -4827,11 +5049,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     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 +5071,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 +5137,112 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                   }
 
                 });
-                fetchr.setToolTipText("Retrieve from " + dbname);
+                fetchr.setToolTipText("<html>"
+                        + JvSwingUtils.wrapTooltip("Retrieve from "
+                                + src.getDbName()) + "<html>");
+                dfetch.add(fetchr);
+                comp++;
+              }
+              else
+              {
+                final DbSourceProxy[] dassource = otherdb
+                        .toArray(new DbSourceProxy[0]);
+                // fetch all entry
+                DbSourceProxy src = otherdb.get(0);
+                fetchr = new JMenuItem("Fetch All '" + 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("<html>"
+                        + JvSwingUtils.wrapTooltip("Retrieve from all "
+                                + otherdb.size() + " sources in "
+                                + src.getDbSource() + "<br>First is :"
+                                + src.getDbName()) + "<html>");
                 dfetch.add(fetchr);
-                if (comp++ == mcomp || i == (otherdb.length - 1))
+                comp++;
+                // and then build the rest of the individual menus
+                ifetch = new JMenu("Sources from " + 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 = "from '" + 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>"
+                          + JvSwingUtils.wrapTooltip("Retrieve from "
+                                  + dbname) + "</html>");
+                  ifetch.add(fetchr);
+                  ++i;
+                  if (++icomp >= mcomp || i == (otherdb.size()))
+                  {
+                    ifetch.setText(imname + " to '" + sname + "'");
+                    dfetch.add(ifetch);
+                    ifetch = new JMenu();
+                    imname = null;
+                    icomp = 0;
+                    comp++;
+                  }
                 }
               }
+              ++dbi;
+              if (comp >= mcomp || dbi >= (dbclasses.length))
+              {
+                dfetch.setText(mname + " to '" + dbclass + "'");
+                rfetch.add(dfetch);
+                dfetch = new JMenu();
+                mname = null;
+                comp = 0;
+              }
             }
           }
         });
@@ -4917,6 +5254,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 +5265,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /**
    * Right justify the whole alignment.
    */
+  @Override
   protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
   {
     AlignmentI al = viewport.getAlignment();
@@ -4942,11 +5281,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java.
    * awt.event.ActionEvent)
    */
+  @Override
   protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
   {
     viewport.setShowUnconserved(showNonconservedMenuItem.getState());
@@ -4955,11 +5295,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
    * .ActionEvent)
    */
+  @Override
   protected void showGroupConsensus_actionPerformed(ActionEvent e)
   {
     viewport.setShowGroupConsensus(showGroupConsensus.getState());
@@ -4969,11 +5310,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  @Override
   protected void showGroupConservation_actionPerformed(ActionEvent e)
   {
     viewport.setShowGroupConservation(showGroupConservation.getState());
@@ -4982,11 +5324,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  @Override
   protected void showConsensusHistogram_actionPerformed(ActionEvent e)
   {
     viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
@@ -4995,17 +5338,26 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * 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)
+  {
+    viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState());
+    alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+  }
+
+  @Override
   protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
   {
     alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
@@ -5013,11 +5365,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
    * .event.ActionEvent)
    */
+  @Override
   protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
   {
     if (viewport.getSelectionGroup() != null)
@@ -5025,9 +5378,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
               viewport.getSequenceSelection(),
               viewport.getAlignmentView(true).getSequenceStrings(
-                      viewport.getGapCharacter()),
-              viewport.alignment.getGroups());
-      viewport.alignment.deleteAllGroups();
+                      viewport.getGapCharacter()), viewport.getAlignment()
+                      .getGroups());
+      viewport.getAlignment().deleteAllGroups();
       viewport.sequenceColours = null;
       viewport.setSelectionGroup(null);
       // set view properties for each group
@@ -5035,13 +5388,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
       {
         gps[g].setShowNonconserved(viewport.getShowUnconserved());
         gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
-        viewport.alignment.addGroup(gps[g]);
+        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 (Enumeration sq = gps[g].getSequences(null).elements(); sq
-                .hasMoreElements(); viewport.setSequenceColour(
-                (SequenceI) sq.nextElement(), col))
+        for (SequenceI s:gps[g].getSequences())
+          viewport.setSequenceColour(
+                s, col)
           ;
       }
       PaintRefresher.Refresh(this, viewport.getSequenceSetId());
@@ -5052,7 +5405,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
 
   /**
    * make the given alignmentPanel the currently selected tab
-   * 
+   *
    * @param alignmentPanel
    */
   public void setDisplayedView(AlignmentPanel alignmentPanel)
@@ -5064,7 +5417,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               "Implementation error: cannot show a view from another alignment in an AlignFrame.");
     }
     if (tabbedPane != null
-            & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex())
+            & alignPanels.indexOf(alignmentPanel) != tabbedPane
+                    .getSelectedIndex())
     {
       tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
     }
@@ -5082,6 +5436,7 @@ class PrintThread extends Thread
 
   static PageFormat pf;
 
+  @Override
   public void run()
   {
     PrinterJob printJob = PrinterJob.getPrinterJob();
index 13f66d9..7294bae 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -40,7 +40,10 @@ import java.util.*;
 import java.awt.*;
 
 import jalview.analysis.*;
-import jalview.api.StructureSelectionManagerProvider;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.OOMHandlerI;
 
 import jalview.bin.*;
 
@@ -50,6 +53,11 @@ import jalview.schemes.*;
 import jalview.structure.SelectionSource;
 import jalview.structure.StructureSelectionManager;
 import jalview.structure.VamsasSource;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.workers.AlignCalcManager;
+import jalview.workers.ConsensusThread;
+import jalview.workers.ConservationThread;
+import jalview.workers.StrucConsensusThread;
 
 /**
  * DOCUMENT ME!
@@ -57,7 +65,7 @@ import jalview.structure.VamsasSource;
  * @author $author$
  * @version $Revision: 1.141 $
  */
-public class AlignViewport implements SelectionSource, VamsasSource
+public class AlignViewport extends AlignmentViewport implements SelectionSource, VamsasSource, AlignViewportI
 {
   private static final int RIGHT_JUSTIFY = 1;
 
@@ -85,16 +93,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   boolean showAnnotation = true;
 
-  boolean colourAppliesToAllGroups = true;
-
-  ColourSchemeI globalColourScheme = null;
-
-  boolean conservationColourSelected = false;
-
-  boolean abovePIDThreshold = false;
-
-  SequenceGroup selectionGroup;
-
   int charHeight;
 
   int charWidth;
@@ -107,13 +105,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   boolean seqNameItalics;
 
-  AlignmentI alignment;
-
-  ColumnSelection colSel = new ColumnSelection();
-
-  int threshold;
-
-  int increment;
 
   NJTree currentTree = null;
 
@@ -123,10 +114,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   boolean scaleRightWrapped = true;
 
-  boolean hasHiddenColumns = false;
-
-  boolean hasHiddenRows = false;
-
   boolean showHiddenMarkers = true;
 
   boolean cursorMode = false;
@@ -137,42 +124,12 @@ public class AlignViewport implements SelectionSource, VamsasSource
    */
   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;
 
   String viewName;
 
-  String sequenceSetID;
-
   boolean gatherViewsHere = false;
 
   Stack historyList = new Stack();
@@ -189,10 +146,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   boolean rightAlignIds = false;
 
-  Hashtable hiddenRepSequences;
-
-  boolean sortByTree;
-
   /**
    * Creates a new AlignViewport object.
    * 
@@ -334,7 +287,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
     centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false);
     autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
 
-    padGaps = Cache.getDefault("PAD_GAPS", true);
+    setPadGaps(Cache.getDefault("PAD_GAPS", true));
     shownpfeats = Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true);
     showdbrefs = Cache.getDefault("SHOW_DBREFS_TOOLTIP", true);
 
@@ -366,53 +319,23 @@ 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
+      showConsensus=Cache.getDefault("SHOW_IDENTITY", true);
       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);
-      }
     }
-
+    initAutoAnnotation();
     if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
     {
       globalColourScheme = ColourSchemeProperty.getColour(alignment,
@@ -455,20 +378,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     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
@@ -479,131 +388,7 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   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);
-      }
-    }
-  }
+  // --------END Structure Conservation
 
   /**
    * get the consensus sequence as displayed under the PID consensus annotation
@@ -644,66 +429,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
   }
 
   /**
-   * 
-   * 
-   * @return null or the currently selected sequence region
-   */
-  public SequenceGroup getSelectionGroup()
-  {
-    return selectionGroup;
-  }
-
-  /**
-   * Set the selection group for this window.
-   * 
-   * @param sg - group holding references to sequences in this alignment view
-   *          
-   */
-  public void setSelectionGroup(SequenceGroup sg)
-  {
-    selectionGroup = sg;
-  }
-
-  /**
-   * GUI state
-   * @return true if conservation based shading is enabled
-   */
-  public boolean getConservationSelected()
-  {
-    return conservationColourSelected;
-  }
-
-  /**
-   * GUI state
-   * @param b
-   *          enable conservation based shading
-   */
-  public void setConservationSelected(boolean b)
-  {
-    conservationColourSelected = b;
-  }
-
-  /**
-   * GUI state
-   * @return true if percent identity threshold is applied to shading
-   */
-  public boolean getAbovePIDThreshold()
-  {
-    return abovePIDThreshold;
-  }
-
-  /**
-   * GUI state
-   * 
-   * 
-   * @param b indicate if percent identity threshold is applied to shading
-   */
-  public void setAbovePIDThreshold(boolean b)
-  {
-    abovePIDThreshold = b;
-  }
-
-  /**
    * DOCUMENT ME!
    * 
    * @return DOCUMENT ME!
@@ -736,27 +461,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
   /**
    * DOCUMENT ME!
    * 
-   * @param cs
-   *          DOCUMENT ME!
-   */
-  public void setGlobalColourScheme(ColourSchemeI cs)
-  {
-    globalColourScheme = cs;
-  }
-
-  /**
-   * DOCUMENT ME!
-   * 
-   * @return DOCUMENT ME!
-   */
-  public ColourSchemeI getGlobalColourScheme()
-  {
-    return globalColourScheme;
-  }
-
-  /**
-   * DOCUMENT ME!
-   * 
    * @param res
    *          DOCUMENT ME!
    */
@@ -941,14 +645,14 @@ public class AlignViewport implements SelectionSource, VamsasSource
   {
     if (alignment != null && alignment.getCodonFrames() != null)
     {
-      StructureSelectionManager.getStructureSelectionManager(Desktop.instance)
-              .removeMappings(alignment.getCodonFrames());
+      StructureSelectionManager.getStructureSelectionManager(
+              Desktop.instance).removeMappings(alignment.getCodonFrames());
     }
     this.alignment = align;
-    if (alignment.getCodonFrames() != null)
+    if (alignment!=null && alignment.getCodonFrames() != null)
     {
-      StructureSelectionManager.getStructureSelectionManager(Desktop.instance).addMappings(
-              alignment.getCodonFrames());
+      StructureSelectionManager.getStructureSelectionManager(
+              Desktop.instance).addMappings(alignment.getCodonFrames());
     }
   }
 
@@ -1074,48 +778,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
   /**
    * 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()
@@ -1147,27 +809,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
   /**
    * 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()
@@ -1270,61 +911,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     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)
   {
@@ -1336,488 +922,40 @@ public class AlignViewport implements SelectionSource, VamsasSource
     return isDataset;
   }
 
-  public void hideSelectedColumns()
-  {
-    if (colSel.size() < 1)
-    {
-      return;
-    }
 
-    colSel.hideSelectedColumns();
-    setSelectionGroup(null);
 
-    hasHiddenColumns = true;
+  public boolean getShowHiddenMarkers()
+  {
+    return showHiddenMarkers;
+  }
+
+  public void setShowHiddenMarkers(boolean show)
+  {
+    showHiddenMarkers = show;
   }
 
-  public void hideColumns(int start, int end)
+  public Color getSequenceColour(SequenceI seq)
   {
-    if (start == end)
+    if (sequenceColours == null || !sequenceColours.containsKey(seq))
     {
-      colSel.hideColumns(start);
+      return Color.white;
     }
     else
     {
-      colSel.hideColumns(start, end);
+      return (Color) sequenceColours.get(seq);
     }
-
-    hasHiddenColumns = true;
   }
 
-  public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
+  public void setSequenceColour(SequenceI seq, Color col)
   {
-    int sSize = sg.getSize();
-    if (sSize < 2)
+    if (sequenceColours == null)
     {
-      return;
+      sequenceColours = new Hashtable();
     }
 
-    if (hiddenRepSequences == null)
+    if (col == 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)
-  {
-    if (sequenceColours == null)
-    {
-      sequenceColours = new Hashtable();
-    }
-
-    if (col == null)
-    {
-      sequenceColours.remove(seq);
+      sequenceColours.remove(seq);
     }
     else
     {
@@ -1907,20 +1045,17 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   public void updateSequenceIdColours()
   {
-    Vector groups = alignment.getGroups();
     if (sequenceColours == null)
     {
       sequenceColours = new Hashtable();
     }
-    for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
+    for (SequenceGroup sg:alignment.getGroups())
     {
-      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++)
+        for (SequenceI s:sg.getSequences(getHiddenRepSequences()))
         {
-          sequenceColours.put(sqs.elementAt(s), sg.idColour);
+          sequenceColours.put(s, sg.idColour);
         }
       }
     }
@@ -2008,46 +1143,8 @@ public class AlignViewport implements SelectionSource, VamsasSource
     return followSelection;
   }
 
-  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
-   * 
-   * @return true if SelectionGroup changed since last call (when b is true)
-   */
-  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)
-   */
-  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;
-  }
-
   public void sendSelection()
   {
     jalview.structure.StructureSelectionManager
@@ -2066,18 +1163,6 @@ public class AlignViewport implements SelectionSource, VamsasSource
     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.
@@ -2112,106 +1197,6 @@ 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
-   */
-  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)
-    {
-      // TODO: decouple settings setting from calculation when refactoring
-      // annotation update method from alignframe to viewport
-      this.showSequenceLogo = showSequenceLogo;
-      if (consensusThread != null)
-      {
-        consensusThread.updateAnnotation();
-      }
-    }
-    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.
@@ -2246,40 +1231,64 @@ public class AlignViewport implements SelectionSource, VamsasSource
 
   public StructureSelectionManager getStructureSelectionManager()
   {
-    return StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
+    return StructureSelectionManager
+            .getStructureSelectionManager(Desktop.instance);
   }
 
   /**
    * 
    * @param pdbEntries
-   * @return a series of SequenceI arrays, one for each PDBEntry, listing which sequence in the alignment holds a reference to it
+   * @return a series of SequenceI arrays, one for each PDBEntry, listing which
+   *         sequence in the alignment holds a reference to it
    */
   public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
   {
     ArrayList<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
-    for (PDBEntry pdb: pdbEntries) {
-    ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
-    for (int i = 0; i < alignment.getHeight(); i++)
+    for (PDBEntry pdb : pdbEntries)
     {
-      Vector pdbs = alignment.getSequenceAt(i)
-              .getDatasetSequence().getPDBId();
-      if (pdbs == null)
-        continue;
-      SequenceI sq;
-      for (int p = 0; p < pdbs.size(); p++)
+      ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
+      for (int i = 0; i < alignment.getHeight(); i++)
       {
-        PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
-        if (p1.getId().equals(pdb.getId()))
+        Vector pdbs = alignment.getSequenceAt(i).getDatasetSequence()
+                .getPDBId();
+        if (pdbs == null)
+          continue;
+        SequenceI sq;
+        for (int p = 0; p < pdbs.size(); p++)
         {
-          if (!seqs.contains(sq=alignment.getSequenceAt(i)))
-            seqs.add(sq);
+          PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
+          if (p1.getId().equals(pdb.getId()))
+          {
+            if (!seqs.contains(sq = alignment.getSequenceAt(i)))
+              seqs.add(sq);
 
-          continue;
+            continue;
+          }
         }
       }
-    }
-    seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
+      seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
     }
     return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
   }
+
+  
+  public boolean isNormaliseSequenceLogo()
+  {
+    return normaliseSequenceLogo;
+  }
+
+  public void setNormaliseSequenceLogo(boolean state)
+  {
+    normaliseSequenceLogo = state;
+  }
+
+
+  /**
+   * 
+   * @return true if alignment characters should be displayed 
+   */
+  public boolean isValidCharWidth()
+  {
+    return validCharWidth;
+  }
 }
index 95ef295..330620c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -32,7 +32,6 @@ import jalview.bin.Cache;
 import jalview.datamodel.*;
 import jalview.jbgui.*;
 import jalview.schemes.*;
-import jalview.structure.SelectionSource;
 import jalview.structure.StructureSelectionManager;
 
 /**
@@ -276,16 +275,16 @@ public class AlignmentPanel extends GAlignmentPanel implements
     // do we need to scroll the panel?
     // TODO: tons of nullpointereexceptions 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);
+      SequenceI seq = av.getAlignment().getSequenceAt(seqIndex);
       
-      int[] r=results.getResults(seq, 0, av.alignment.getWidth());
+      int[] r=results.getResults(seq, 0, av.getAlignment().getWidth());
       if (r == null)
       {
         return false;
@@ -302,13 +301,13 @@ 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 (!av.colSel.isVisible(r[0]))
+          if (!av.getColumnSelection().isVisible(r[0]))
           {
             // don't scroll - position isn't visible
             return false;
@@ -547,14 +546,14 @@ public class AlignmentPanel extends GAlignmentPanel implements
   public void setScrollValues(int x, int y)
   {
     // System.err.println("Scroll to "+x+","+y);
-    if (av == null || av.alignment == null)
+    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);
     }
@@ -723,9 +722,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     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;
       }
@@ -849,7 +848,7 @@ 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)
     {
@@ -920,12 +919,12 @@ public class AlignmentPanel extends GAlignmentPanel implements
     pg.translate(idWidth, 0);
     seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
 
-    if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
+    if (av.showAnnotation && (endSeq == av.getAlignment().getHeight()))
     {
       pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
       alabels.drawComponent((Graphics2D) pg, idWidth);
       pg.translate(idWidth + 3, 0);
-      annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes + 1);
+      annotationPanel.renderer.drawComponent(annotationPanel, av, (Graphics2D) pg, -1, startRes, endRes + 1);
     }
 
     return Printable.PAGE_EXISTS;
@@ -971,8 +970,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
     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;
     }
@@ -998,10 +997,10 @@ 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);
+        SequenceI s = av.getAlignment().getSequenceAt(i);
         String string = s.getDisplayId(av.getShowJVSuffix());
         int xPos = 0;
         if (av.rightAlignIds)
@@ -1073,13 +1072,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
 
   void makeAlignmentImage(int type, File file)
   {
-    int maxwidth = av.alignment.getWidth();
-    if (av.hasHiddenColumns)
+    int maxwidth = av.getAlignment().getWidth();
+    if (av.hasHiddenColumns())
     {
       maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
     }
 
-    int height = ((av.alignment.getHeight() + 1) * av.charHeight)
+    int height = ((av.getAlignment().getHeight() + 1) * av.charHeight)
             + scalePanel.getHeight();
     int width = getVisibleIdWidth(false) + (maxwidth * av.charWidth);
 
@@ -1183,7 +1182,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
     {
       try
       {
-        int s, sSize = av.alignment.getHeight(), res, alwidth = av.alignment
+        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));
@@ -1196,15 +1195,15 @@ public class AlignmentPanel extends GAlignmentPanel implements
         {
           sy = s * av.charHeight + scaleHeight;
 
-          SequenceI seq = av.alignment.getSequenceAt(s);
+          SequenceI seq = av.getAlignment().getSequenceAt(s);
           SequenceFeature[] features = seq.getDatasetSequence()
                   .getSequenceFeatures();
-          SequenceGroup[] groups = av.alignment.findAllGroups(seq);
+          SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
           for (res = 0; res < alwidth; res++)
           {
             text = new StringBuffer();
             Object obj = null;
-            if (av.alignment.isNucleotide())
+            if (av.getAlignment().isNucleotide())
             {
               obj = ResidueProperties.nucleotideName.get(seq.getCharAt(res)
                       + "");
@@ -1340,8 +1339,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
     int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
             + annotationHeight;
 
-    int maxwidth = av.alignment.getWidth();
-    if (av.hasHiddenColumns)
+    int maxwidth = av.getAlignment().getWidth();
+    if (av.hasHiddenColumns())
     {
       maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
     }
@@ -1365,7 +1364,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
       jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
       ssm.removeStructureViewerListener(seqPanel, null);
       ssm.removeSelectionListener(seqPanel);
-      av.alignment = null;
+      av.setAlignment(null);
       av = null;
     }
     else
@@ -1394,16 +1393,16 @@ public class AlignmentPanel extends GAlignmentPanel implements
     boolean cons = av.isShowGroupConsensus();
     boolean showprf = av.isShowSequenceLogo();
     boolean showConsHist = av.isShowConsensusHistogram();
+    boolean normLogo = av.isNormaliseSequenceLogo();
 
     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
 
-    AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
     Hashtable oldrfs = new Hashtable();
     if (aan != null)
     {
@@ -1412,33 +1411,32 @@ public class AlignmentPanel extends GAlignmentPanel implements
         if (aan[an].autoCalculated && aan[an].groupRef != null)
         {
           oldrfs.put(aan[an].groupRef, aan[an].groupRef);
-          av.alignment.deleteAnnotation(aan[an]);
+          av.getAlignment().deleteAnnotation(aan[an]);
           aan[an] = null;
         }
       }
     }
-    SequenceGroup sg;
-    if (gr != null)
+    if (av.getAlignment().getGroups()!=null)
     {
-      for (int g = 0; g < gr.size(); g++)
+      for (SequenceGroup sg:av.getAlignment().getGroups())
       {
         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);
+          sg.setNormaliseSequenceLogo(normLogo);
         }
         if (conv)
         {
           updateCalcs = true;
-          av.alignment.addAnnotation(sg.getConservationRow(), 0);
+          av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
         }
         if (cons)
         {
           updateCalcs = true;
-          av.alignment.addAnnotation(sg.getConsensus(), 0);
+          av.getAlignment().addAnnotation(sg.getConsensus(), 0);
         }
         // refresh the annotation rows
         if (updateCalcs)
@@ -1454,7 +1452,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
   @Override
   public AlignmentI getAlignment()
   {
-    return av.alignment;
+    return av.getAlignment();
   }
 
   /**
@@ -1487,4 +1485,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
   {
     return av.getStructureSelectionManager();
   }
+
+  @Override
+  public void raiseOOMWarning(String string, OutOfMemoryError error)
+  {
+    new OOMWarning(string,  error, this);
+  }
 }
index eca0b4c..64b1d19 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -51,14 +51,11 @@ public class AnnotationColourChooser extends JPanel
   public AnnotationColourChooser(AlignViewport av, final AlignmentPanel 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++)
+      for (SequenceGroup sg:ap.av.getAlignment().getGroups())
       {
-        sg = (SequenceGroup) allGroups.get(g);
         if (sg.cs != null)
         {
           oldgroupColours.put(sg, sg.cs);
@@ -91,7 +88,7 @@ public class AnnotationColourChooser extends JPanel
       }
     });
 
-    if (av.alignment.getAlignmentAnnotation() == null)
+    if (av.getAlignment().getAlignmentAnnotation() == null)
     {
       return;
     }
@@ -113,9 +110,9 @@ public class AnnotationColourChooser extends JPanel
     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
@@ -378,7 +375,7 @@ public class AnnotationColourChooser extends JPanel
       return;
     }
 
-    currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+    currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
             .getSelectedIndex()];
 
     int aboveThreshold = -1;
@@ -450,14 +447,11 @@ public class AnnotationColourChooser extends JPanel
 
     av.setGlobalColourScheme(acg);
 
-    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.get(g);
-
         if (sg.cs == null)
         {
           continue;
@@ -508,13 +502,11 @@ public class AnnotationColourChooser extends JPanel
   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.get(g);
         sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
       }
     }
index a6ccc7b..9c6231a 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -18,6 +18,7 @@
 package jalview.gui;\r
 \r
 import java.util.*;\r
+import java.util.List;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
@@ -44,7 +45,7 @@ public class AnnotationExporter extends JPanel
 \r
   AlignmentAnnotation[] annotations;\r
 \r
-  Vector sequenceGroups;\r
+  List<SequenceGroup> sequenceGroups;\r
 \r
   Hashtable alignmentProperties;\r
 \r
@@ -73,7 +74,7 @@ public class AnnotationExporter extends JPanel
   }\r
 \r
   public void exportAnnotations(AlignmentPanel ap,\r
-          AlignmentAnnotation[] annotations, Vector sequenceGroups,\r
+          AlignmentAnnotation[] annotations, List<SequenceGroup> list,\r
           Hashtable alProperties)\r
   {\r
     this.ap = ap;\r
@@ -81,7 +82,7 @@ public class AnnotationExporter extends JPanel
     GFFFormat.setVisible(false);\r
     CSVFormat.setVisible(true);\r
     this.annotations = annotations;\r
-    this.sequenceGroups = sequenceGroups;\r
+    this.sequenceGroups = list;\r
     this.alignmentProperties = alProperties;\r
     frame.setTitle("Export Annotations");\r
   }\r
@@ -105,13 +106,13 @@ public class AnnotationExporter extends JPanel
       {\r
         if (GFFFormat.isSelected())\r
         {\r
-          text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+          text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
                   .getDataset().getSequencesArray(),\r
                   getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);\r
         }\r
         else\r
         {\r
-          text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+          text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
                   .getDataset().getSequencesArray(),\r
                   getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);\r
         }\r
@@ -152,13 +153,13 @@ public class AnnotationExporter extends JPanel
     {\r
       if (GFFFormat.isSelected())\r
       {\r
-        text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+        text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
                 .getDataset().getSequencesArray(),\r
                 getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
       }\r
       else\r
       {\r
-        text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+        text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
                 .getDataset().getSequencesArray(),\r
                 getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
       }\r
index ff3b0cd..6d32c04 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -143,7 +143,7 @@ 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 +175,20 @@ 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 +201,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))
     {
@@ -305,16 +305,16 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     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;
@@ -402,9 +402,9 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     getSelectedRow(evt.getY() - scrollOffset);
 
     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
@@ -460,7 +460,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
    */
   public void mouseClicked(MouseEvent evt)
   {
-    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
     if (SwingUtilities.isLeftMouseButton(evt))
     {
       if (selectedRow > -1 && selectedRow < aa.length)
@@ -630,6 +630,28 @@ public class AnnotationLabels extends JPanel implements MouseListener,
             }
           });
           pop.add(cprofl);
+          final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+                  "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
         {
@@ -646,6 +668,7 @@ 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());
             }
@@ -664,11 +687,32 @@ 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(
+                  "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);
@@ -700,7 +744,7 @@ 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);
@@ -713,7 +757,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
             .setContents(new StringSelection(output), Desktop.instance);
 
     Vector hiddenColumns = null;
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       hiddenColumns = new Vector();
       for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
@@ -782,7 +826,7 @@ public class AnnotationLabels extends JPanel implements MouseListener,
     g.translate(0, scrollOffset);
     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;
index 359c500..03fbf28 100755 (executable)
@@ -1,74 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.*;
 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.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
-public class AnnotationPanel extends JPanel implements MouseListener,
-        MouseMotionListener, ActionListener, AdjustmentListener
+public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
+        MouseListener, MouseMotionListener, ActionListener,
+        AdjustmentListener
 {
   final String HELIX = "Helix";
 
   final String SHEET = "Sheet";
 
+  /**
+   * For RNA secondary structure "stems" aka helices
+   */
+  final String STEM = "RNA Helix";
+
   final String LABEL = "Label";
 
   final String REMOVE = "Remove Annotation";
 
   final String COLOUR = "Colour";
 
-  final Color HELIX_COLOUR = Color.red.darker();
+  public 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,9 +89,16 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   boolean MAC = false;
 
+  // for editing cursor
+  int cursorX = 0;
+
+  int cursorY = 0;
+
+  public final AnnotationRenderer renderer;
+
   /**
    * Creates a new AnnotationPanel object.
-   * 
+   *
    * @param ap
    *          DOCUMENT ME!
    */
@@ -106,19 +117,22 @@ public class AnnotationPanel extends JPanel implements MouseListener,
     addMouseMotionListener(this);
     ap.annotationScroller.getVerticalScrollBar()
             .addAdjustmentListener(this);
+    renderer = new AnnotationRenderer();
   }
 
   public AnnotationPanel(AlignViewport av)
   {
     this.av = av;
+    renderer = new AnnotationRenderer();
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void adjustmentValueChanged(AdjustmentEvent evt)
   {
     ap.alabels.setScrollOffset(-evt.getValue());
@@ -128,11 +142,11 @@ public class AnnotationPanel extends JPanel implements MouseListener,
    * Calculates the height of the annotation displayed in the annotation panel.
    * Callers should normally call the ap.adjustAnnotationHeight method to ensure
    * all annotation associated components are updated correctly.
-   * 
+   *
    */
   public int adjustPanelHeight()
   {
-    int height=calcPanelHeight();
+    int height = calcPanelHeight();
     this.setPreferredSize(new Dimension(1, height));
     if (ap != null)
     {
@@ -144,14 +158,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
   }
 
   /**
-   * 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();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     int height = 0;
 
     if (aa != null)
@@ -203,13 +218,14 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * 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;
@@ -251,7 +267,7 @@ 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)
@@ -276,7 +292,7 @@ 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)
@@ -303,6 +319,13 @@ 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;
@@ -325,7 +348,7 @@ 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)
@@ -337,6 +360,7 @@ public class AnnotationPanel extends JPanel implements MouseListener,
         anot[index].displayCharacter = label;
       }
     }
+    aa[activeRow].validateRangeAndDisplay();
 
     adjustPanelHeight();
     repaint();
@@ -349,22 +373,25 @@ 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;
             }
@@ -389,14 +416,15 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mousePressed(MouseEvent evt)
   {
 
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
     if (aa == null)
     {
       return;
@@ -437,12 +465,25 @@ public class AnnotationPanel extends JPanel implements MouseListener,
       }
 
       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);
+      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);
@@ -468,10 +509,11 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseReleased(MouseEvent evt)
   {
     graphStretch = -1;
@@ -482,10 +524,11 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseEntered(MouseEvent evt)
   {
     ap.scalePanel.mouseEntered(evt);
@@ -493,10 +536,11 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseExited(MouseEvent evt)
   {
     ap.scalePanel.mouseExited(evt);
@@ -504,19 +548,20 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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();
@@ -530,13 +575,14 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @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 +616,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)
       {
@@ -629,20 +675,54 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseClicked(MouseEvent evt)
   {
+    if (activeRow != -1)
+    {
+      AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
+      AlignmentAnnotation anot = aa[activeRow];
+
+      if (anot.description.equals("secondary structure"))
+      {
+        // System.out.println(anot.description+" "+anot.getRNAStruc());
+      }
+    }
   }
 
+  // TODO mouseClicked-content and drawCursor are quite experimental!
+  public void drawCursor(Graphics graphics, SequenceI seq, int res, int x1,
+          int y1)
+  {
+    int pady = av.charHeight / 5;
+    int charOffset = 0;
+    graphics.setColor(Color.black);
+    graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+
+    if (av.validCharWidth)
+    {
+      graphics.setColor(Color.white);
+
+      char s = seq.getCharAt(res);
+
+      charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+      graphics.drawString(String.valueOf(s), charOffset + x1,
+              (y1 + av.charHeight) - pady);
+    }
+
+  }
+  private volatile boolean imageFresh=false;
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param g
    *          DOCUMENT ME!
    */
+  @Override
   public void paintComponent(Graphics g)
   {
     g.setColor(Color.white);
@@ -678,15 +758,17 @@ 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);
   }
 
   /**
    * non-Thread safe repaint
-   * 
+   *
    * @param horizontal
    *          repaint with horizontal shift in alignment
    */
@@ -694,9 +776,9 @@ public class AnnotationPanel extends JPanel implements MouseListener,
   {
 
     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;
@@ -727,10 +809,10 @@ public class AnnotationPanel extends JPanel implements MouseListener,
     repaint();
 
   }
-
+  private volatile boolean lastImageGood=false;
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param g
    *          DOCUMENT ME!
    * @param startRes
@@ -740,18 +822,21 @@ 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,10 +850,16 @@ 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;
     }
 
@@ -781,8 +872,8 @@ 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());
@@ -794,710 +885,28 @@ public class AnnotationPanel extends JPanel implements MouseListener,
 
       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++)
-    {
-      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;
-      }
-    }
-  }
-
-  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);
-
-    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)
+    lastImageGood = renderer.drawComponent(this, av, g, activeRow, startRes, endRes);
+    if (!lastImageGood && fadedImage==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());
+      fadedImage=oldFaded;
     }
   }
 
-  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 = 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 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 fadedImage;
   }
 
-  // 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] != 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;
-    }
+    return imgWidth;
   }
-
 }
index 2c0d7d6..e942b88 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -35,6 +35,7 @@ import jalview.structure.*;
 import jalview.datamodel.PDBEntry;
 import jalview.io.*;
 import jalview.schemes.*;
+import jalview.util.Platform;
 
 public class AppJmol extends GStructureViewer implements Runnable,
         SequenceStructureBinding, ViewSetProvider
@@ -321,7 +322,6 @@ public class AppJmol extends GStructureViewer implements Runnable,
     openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
   }
   private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys, SequenceI[][] seqs) {
-    boolean promptUser=pdbentrys.length==1;
     progressBar = ap.alignFrame;
     jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
     addAlignmentPanel(ap);
@@ -335,24 +335,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
     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)
-    {
-      initJmol("load"+(pdbentrys.length>1 ? " APPEND" : "") + filelist);
-    }
-*/
     this.addInternalFrameListener(new InternalFrameAdapter()
     {
       public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
@@ -736,9 +723,11 @@ public class AppJmol extends GStructureViewer implements Runnable,
           {
             // 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(((PDBEntry) pdbseq
+                    .getSequenceAt(0).getPDBId().elementAt(0)).getFile()).getAbsolutePath();
+            jmb.pdbentry[pi].setFile(file);
+            
+            files.append(" \"" + Platform.escapeString(file) + "\"");
           }
           else
           {
@@ -761,7 +750,7 @@ public class AppJmol extends GStructureViewer implements Runnable,
           }
           if (file != null)
           {
-            files.append(" \"" + file + "\"");
+            files.append(" \"" + Platform.escapeString(file) + "\"");
           }
         }
       }
@@ -1056,7 +1045,12 @@ public class AppJmol extends GStructureViewer implements Runnable,
     buriedColour.setSelected(true);
     jmb.setJalviewColourScheme(new BuriedColourScheme());
   }
-
+  
+  public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+  {
+    setJalviewColourScheme(new PurinePyrimidineColourScheme());
+  }
+  
   public void userColour_actionPerformed(ActionEvent actionEvent)
   {
     userColour.setSelected(true);
index 3e243fc..63813a9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java
new file mode 100644 (file)
index 0000000..da6c6e5
--- /dev/null
@@ -0,0 +1,413 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+
+import java.awt.event.*;
+import java.io.*;
+
+import jalview.api.AlignViewportI;
+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.io.*;
+import jalview.schemes.*;
+import jalview.util.ShiftList;
+import fr.orsay.lri.varna.VARNAPanel;
+import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener;
+import fr.orsay.lri.varna.models.BaseList;
+import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
+import fr.orsay.lri.varna.models.rna.ModeleBase;
+import fr.orsay.lri.varna.models.rna.ModeleBaseNucleotide;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarna extends JInternalFrame implements
+        InterfaceVARNAListener, SelectionListener,
+        SecondaryStructureListener// implements
+                                  // Runnable,SequenceStructureBinding,
+                                  // ViewSetProvider
+        , InterfaceVARNASelectionListener, VamsasSource
+
+{
+  AppVarnaBinding vab;
+
+  VARNAPanel varnaPanel;
+
+  public String name;
+
+  public StructureSelectionManager ssm;
+
+  /*
+   * public AppVarna(){ vab = new AppVarnaBinding(); initVarna(); }
+   */
+
+  AlignmentPanel ap;
+
+  public AppVarna(String sname, SequenceI seq, String strucseq, String struc,
+          String name, AlignmentPanel ap)
+  {
+    this.ap = ap;
+    ArrayList<RNA> rnaList = new ArrayList<RNA>();
+    RNA rna1 = new RNA(name);
+    try
+    {
+      rna1.setRNA(strucseq, replaceOddGaps(struc));
+    } catch (ExceptionUnmatchedClosingParentheses e2)
+    {
+      e2.printStackTrace();
+    } catch (ExceptionFileFormatOrSyntax e3)
+    {
+      e3.printStackTrace();
+    }
+    RNA trim = trimRNA(rna1, "trimmed "+sname);
+    rnaList.add(trim);
+    rnaList.add(rna1);
+    rnas.put(seq, rna1);
+    rnas.put(seq, trim);
+    rna1.setName(sname+" (with gaps)");
+
+    {
+      seqs.put(trim, seq);
+      seqs.put(rna1, seq);
+
+      /**
+       * if (false || seq.getStart()!=1) { for (RNA rshift:rnaList) { ShiftList
+       * shift=offsets.get(rshift); if (shift==null) { offsets.put(rshift,
+       * shift=new ShiftList());} shift.addShift(1, seq.getStart()-1);
+       * offsetsInv.put(rshift, shift.getInverse()); } }
+       **/
+    }
+    vab = new AppVarnaBinding(rnaList);
+    // vab = new AppVarnaBinding(seq,struc);
+    // System.out.println("Hallo: "+name);
+    this.name = sname+" trimmed to "+name;
+    initVarna();
+    ssm = ap.getStructureSelectionManager();
+    ssm.addStructureViewerListener(this);
+    ssm.addSelectionListener(this);
+  }
+
+  public void initVarna()
+  {
+    // vab.setFinishedInit(false);
+    varnaPanel = vab.get_varnaPanel();
+    setBackground(Color.white);
+    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
+            vab.getListPanel(), varnaPanel);
+    getContentPane().setLayout(new BorderLayout());
+    getContentPane().add(split, BorderLayout.CENTER);
+    // getContentPane().add(vab.getTools(), BorderLayout.NORTH);
+    varnaPanel.addVARNAListener(this);
+    varnaPanel.addSelectionListener(this);
+    jalview.gui.Desktop.addInternalFrame(this, "VARNA -" + name,
+            getBounds().width, getBounds().height);
+    this.pack();
+    showPanel(true);
+  }
+
+  public String replaceOddGaps(String oldStr)
+  {
+    String patternStr = "[^([{<>}])]";
+    String replacementStr = ".";
+    Pattern pattern = Pattern.compile(patternStr);
+    Matcher matcher = pattern.matcher(oldStr);
+    String newStr = matcher.replaceAll(replacementStr);
+    return newStr;
+  }
+
+  public RNA trimRNA(RNA rna, String name)
+  {
+    ShiftList offset = new ShiftList();
+    RNA rnaTrim = new RNA(name);
+    try
+    {
+      rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(rna.getStructDBN()));
+    } catch (ExceptionUnmatchedClosingParentheses e2)
+    {
+      e2.printStackTrace();
+    } catch (ExceptionFileFormatOrSyntax e3)
+    {
+      e3.printStackTrace();
+    }
+
+    StringBuffer seq = new StringBuffer(rnaTrim.getSeq());
+    StringBuffer struc = new StringBuffer(rnaTrim.getStructDBN());
+    int ofstart = -1, sleng = rnaTrim.getSeq().length();
+    for (int i = 0; i < sleng; i++)
+    {
+      // TODO: Jalview utility for gap detection java.utils.isGap()
+      // TODO: Switch to jalview rna datamodel
+      if (jalview.util.Comparison.isGap(seq.charAt(i)))
+      {
+        if (ofstart == -1)
+        {
+          ofstart = i;
+        }
+        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;
+    }
+    String newSeq = rnaTrim.getSeq().replace("-", "");
+    rnaTrim.getSeq().replace(".", "");
+    String newStruc = struc.toString().replace("*", "");
+
+    try
+    {
+      rnaTrim.setRNA(newSeq, newStruc);
+      registerOffset(rnaTrim, offset);
+    } catch (ExceptionUnmatchedClosingParentheses e)
+    {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    } catch (ExceptionFileFormatOrSyntax e)
+    {
+      // TODO Auto-generated catch block
+      e.printStackTrace();
+    }
+    return rnaTrim;
+  }
+
+  // needs to be many-many
+  Map<RNA, SequenceI> seqs = new Hashtable<RNA, SequenceI>();
+
+  Map<SequenceI, RNA> rnas = new Hashtable<SequenceI, RNA>();
+
+  Map<RNA, ShiftList> offsets = new Hashtable<RNA, ShiftList>();
+
+  Map<RNA, ShiftList> offsetsInv = new Hashtable<RNA, ShiftList>();
+
+  private void registerOffset(RNA rnaTrim, ShiftList offset)
+  {
+    offsets.put(rnaTrim, offset);
+    offsetsInv.put(rnaTrim, offset.getInverse());
+  }
+
+  public void showPanel(boolean show)
+  {
+    this.setVisible(show);
+  }
+
+  private boolean _started = false;
+
+  public void run()
+  {
+    _started = true;
+
+    try
+    {
+      initVarna();
+    } catch (OutOfMemoryError oomerror)
+    {
+      new OOMWarning("When trying to open the Varna viewer!", oomerror);
+    } catch (Exception ex)
+    {
+      Cache.log.error("Couldn't open Varna viewer!", ex);
+    }
+  }
+
+  @Override
+  public void onUINewStructure(VARNAConfig v, RNA r)
+  {
+
+  }
+
+  @Override
+  public void onWarningEmitted(String s)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  private class VarnaHighlighter
+  {
+    private HighlightRegionAnnotation _lastHighlight;
+
+    private RNA _lastRNAhighlighted = null;
+
+    public void highlightRegion(RNA rna, int start, int end)
+    {
+      clearSelection(null);
+      HighlightRegionAnnotation highlight = new HighlightRegionAnnotation(
+              rna.getBasesBetween(start, end));
+      rna.addHighlightRegion(highlight);
+      _lastHighlight = highlight;
+      _lastRNAhighlighted = rna;
+
+    }
+
+    public HighlightRegionAnnotation getLastHighlight()
+    {
+      return _lastHighlight;
+    }
+
+    public RNA getLastRNA()
+    {
+      return _lastRNAhighlighted;
+    }
+
+    public void clearSelection(AppVarnaBinding vab)
+    {
+      if (_lastRNAhighlighted != null)
+      {
+        _lastRNAhighlighted.removeHighlightRegion(_lastHighlight);
+        if (vab != null)
+        {
+          vab.updateSelectedRNA(_lastRNAhighlighted);
+        }
+        _lastRNAhighlighted = null;
+        _lastHighlight = null;
+
+      }
+    }
+  }
+
+  VarnaHighlighter mouseOverHighlighter = new VarnaHighlighter(),
+          selectionHighlighter = new VarnaHighlighter();
+
+  /**
+   * 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
+   */
+  @Override
+  public void mouseOverSequence(SequenceI sequence, int index)
+  {
+    RNA rna = vab.getSelectedRNA();
+    if (seqs.get(rna) == sequence)
+    {
+      ShiftList shift = offsets.get(rna);
+      if (shift != null)
+      {
+   //      System.err.print("Orig pos:"+index);
+         index = shift.shift(index);
+   //      System.err.println("\nFinal pos:"+index);
+      }
+      mouseOverHighlighter.highlightRegion(rna, index, index);
+      vab.updateSelectedRNA(rna);
+    }
+  }
+
+  @Override
+  public void onStructureRedrawn()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @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;
+    }
+    if (seqsel != null && seqsel.getSize() > 0)
+    {
+      int start = seqsel.getStartRes(), end = seqsel.getEndRes();
+      RNA rna = vab.getSelectedRNA();
+      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(vab);
+    }
+  }
+
+  @Override
+  public void onHoverChanged(ModeleBase arg0, ModeleBase arg1)
+  {
+    RNA rna = vab.getSelectedRNA();
+    ShiftList shift = offsetsInv.get(rna);
+    SequenceI seq = seqs.get(rna);
+    if (arg1 != null && seq != null)
+    {
+      if (shift != null)
+      {
+        int i = shift.shift(arg1.getIndex());
+ //       System.err.println("shifted "+(arg1.getIndex())+" to "+i);
+        ssm.mouseOverVamsasSequence(seq, i, this);
+      }
+      else
+      {
+        ssm.mouseOverVamsasSequence(seq, arg1.getIndex(), this);
+      }
+    }
+  }
+
+  @Override
+  public void onSelectionChanged(BaseList arg0, BaseList arg1, BaseList arg2)
+  {
+    // TODO translate selected regions in VARNA to a selection on the
+    // alignpanel.
+
+  }
+
+}
diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java
new file mode 100644 (file)
index 0000000..fc1f446
--- /dev/null
@@ -0,0 +1,944 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.File;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextField;
+import javax.swing.ListModel;
+import javax.swing.ListSelectionModel;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+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.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
+import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
+import fr.orsay.lri.varna.models.FullBackup;
+import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.rna.Mapping;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
+        implements DropTargetListener, InterfaceVARNAListener,
+        MouseListener
+{
+
+  /**
+        * 
+        */
+  // private static final long serialVersionUID = -790155708306987257L;
+
+  private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
+
+  private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
+
+  private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
+
+  public VARNAPanel vp;
+
+  protected JPanel _tools = new JPanel();
+
+  private JPanel _input = new JPanel();
+
+  private JPanel _seqPanel = new JPanel();
+
+  private JPanel _strPanel = new JPanel();
+
+  private JLabel _info = new JLabel();
+
+  private JTextField _str = new JTextField();
+
+  private JTextField _seq = new JTextField();
+
+  private JLabel _strLabel = new JLabel(" Str:");
+
+  private JLabel _seqLabel = new JLabel(" Seq:");
+
+  private JButton _createButton = new JButton("Create");
+
+  private JButton _updateButton = new JButton("Update");
+
+  private JButton _deleteButton = new JButton("Delete");
+
+  private JButton _duplicateButton = new JButton("Snapshot");
+
+  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;
+
+  /*
+   * public AppVarnaBinding() { //super("VARNA in Jalview");
+   * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
+   * 
+   * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
+   * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
+   */
+
+  public AppVarnaBinding(String seq, String struc)
+  {
+    // super("VARNA in Jalview");
+    initVarna(seq, struc);
+  }
+
+  public AppVarnaBinding(ArrayList<RNA> rnaList)
+  {
+    // super("VARNA in Jalview");
+    initVarnaEdit(rnaList);
+  }
+
+  private void initVarna(String seq, String str)
+  {
+    DefaultListModel dlm = new DefaultListModel();
+
+    DefaultListSelectionModel m = new DefaultListSelectionModel();
+    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    m.setLeadAnchorNotificationEnabled(false);
+
+    _sideList = new ReorderableJList();
+    _sideList.setModel(dlm);
+    _sideList.addMouseListener(this);
+    _sideList.setSelectionModel(m);
+    _sideList.setPreferredSize(new Dimension(100, 0));
+    _sideList.addListSelectionListener(new ListSelectionListener()
+    {
+      public void valueChanged(ListSelectionEvent arg0)
+      {
+        if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
+        {
+          FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+          Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
+                  .getSize(), sel.rna.getSize());
+          vp.showRNAInterpolated(sel.rna, sel.config, map);
+          _seq.setText(sel.rna.getSeq());
+          _str.setText(sel.rna.getStructDBN());
+        }
+      }
+    });
+
+    _rnaList = new BackupHolder(dlm, _sideList);
+    RNA _RNA1 = new RNA("User defined 1");
+
+    try
+    {
+      vp = new VARNAPanel("0", ".");
+      _RNA1.setRNA(seq, str);
+      _RNA1.drawRNARadiate(vp.getConfig());
+    } catch (ExceptionNonEqualLength e)
+    {
+      vp.errorDialog(e);
+    } catch (ExceptionUnmatchedClosingParentheses e2)
+    {
+      e2.printStackTrace();
+    } catch (ExceptionFileFormatOrSyntax e3)
+    {
+      e3.printStackTrace();
+    }
+    vp.setPreferredSize(new Dimension(400, 400));
+    _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
+
+    // TODO setBackground(_backgroundColor);
+    vp.setBackground(_backgroundColor);
+
+    // TODO getContentPane().setLayout(new BorderLayout());
+    // TODO getContentPane().add(vp, BorderLayout.CENTER);
+
+    // setVisible(true);
+    vp.addVARNAListener(this);
+  }
+
+  private void initVarnaEdit(ArrayList<RNA> rnaInList)
+  {
+    DefaultListModel dlm = new DefaultListModel();
+
+    int marginTools = 40;
+
+    DefaultListSelectionModel m = new DefaultListSelectionModel();
+    m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+    m.setLeadAnchorNotificationEnabled(false);
+
+    _sideList = new ReorderableJList();
+    _sideList.setModel(dlm);
+    _sideList.addMouseListener(this);
+    _sideList.setSelectionModel(m);
+    _sideList.setPreferredSize(new Dimension(100, 0));
+    _sideList.addListSelectionListener(new ListSelectionListener()
+    {
+      public void valueChanged(ListSelectionEvent arg0)
+      {
+        // System.out.println(arg0);
+        if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
+        {
+          FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+          Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
+                  .getSize(), sel.rna.getSize());
+          vp.showRNAInterpolated(sel.rna, sel.config, map);
+          // _seq.setText(sel.rna.getSeq());
+          _str.setText(sel.rna.getStructDBN());
+        }
+      }
+    });
+    _rnaList = new BackupHolder(dlm, _sideList);
+
+    try
+    {
+      vp = new VARNAPanel("0", ".");
+      for (int i = 0; i < rnaInList.size(); i++)
+      {
+        rnaInList.get(i).drawRNARadiate(vp.getConfig());
+      }
+    } catch (ExceptionNonEqualLength e)
+    {
+      vp.errorDialog(e);
+    }
+    vp.setPreferredSize(new Dimension(400, 400));
+    for (int i = 0; i < rnaInList.size(); i++)
+    {
+      if (i < rnaInList.size() - 1)
+      {
+        _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
+                .get(i).getName());
+      }
+      else
+      {
+        _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
+                .get(i).getName(), true);
+      }
+    }
+
+    /*
+     * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
+     * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
+     */
+
+    JScrollPane listScroller = new JScrollPane(_sideList);
+    listScroller.setPreferredSize(new Dimension(150, 0));
+
+    vp.setBackground(_backgroundColor);
+
+    Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
+
+    // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
+    // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
+    _seq.setFont(textFieldsFont);
+    _seq.setText(rnaInList.get(0).getSeq());
+
+    _updateButton.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+        sel.rna.setSequence("A");
+      }
+    });
+
+    // _seqPanel.setLayout(new BorderLayout());
+    // _seqPanel.add(_seqLabel, BorderLayout.WEST);
+    // _seqPanel.add(_seq, BorderLayout.CENTER);
+
+    _strLabel.setPreferredSize(new Dimension(marginTools, 15));
+    _strLabel.setHorizontalTextPosition(JLabel.LEFT);
+    _str.setFont(textFieldsFont);
+    _strPanel.setLayout(new BorderLayout());
+    _strPanel.add(_strLabel, BorderLayout.WEST);
+    _strPanel.add(_str, BorderLayout.CENTER);
+
+    _input.setLayout(new GridLayout(1, 0));
+    // _input.add(_seqPanel);
+    _input.add(_strPanel);
+
+    JPanel goPanel = new JPanel();
+    goPanel.setLayout(new BorderLayout());
+
+    _tools.setLayout(new BorderLayout());
+    _tools.add(_input, BorderLayout.CENTER);
+    // _tools.add(_info, BorderLayout.SOUTH);
+    _tools.add(goPanel, BorderLayout.EAST);
+
+    /*
+     * _deleteButton.addActionListener(new ActionListener() { public void
+     * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
+     * _duplicateButton.addActionListener(new ActionListener() { public void
+     * actionPerformed(ActionEvent e) {
+     * _rnaList.add((VARNAConfig)vp.getConfig().
+     * clone(),vp.getRNA().clone(),vp.getRNA
+     * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
+     * Date()),true); }});
+     */
+    goPanel.add(_updateButton, BorderLayout.CENTER);
+
+    JPanel ops = new JPanel();
+    ops.setLayout(new GridLayout(1, 2));
+    ops.add(_deleteButton);
+    ops.add(_duplicateButton);
+
+    JLabel j = new JLabel("Structures Manager", JLabel.CENTER);
+    _listPanel.setLayout(new BorderLayout());
+
+    //_listPanel.add(ops, BorderLayout.SOUTH);
+    _listPanel.add(j, BorderLayout.NORTH);
+    _listPanel.add(listScroller, BorderLayout.CENTER);
+
+    // JSplitPane split = new
+    // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
+    /**
+     * TODO getContentPane().setLayout(new BorderLayout());
+     * getContentPane().add(split, BorderLayout.CENTER);
+     * getContentPane().add(_tools, BorderLayout.NORTH);
+     */
+
+    // TODO setVisible(true);
+    DropTarget dt = new DropTarget(vp, this);
+
+    vp.addVARNAListener(this);
+  }
+
+  public JPanel getTools()
+  {
+    return _tools;
+  }
+
+  public JPanel getListPanel()
+  {
+    return _listPanel;
+  }
+
+  /**
+   * TODO: Is it effective to transfer the whole RNA?
+   * 
+   * @return Currently selected RNA
+   */
+  public RNA getSelectedRNA()
+  {
+    return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
+  }
+
+  /**
+   * Substitute currently selected RNA with the edited one
+   * 
+   * @param rnaEdit
+   */
+  public void updateSelectedRNA(RNA rnaEdit)
+  {
+    vp.repaint();
+    vp.showRNA(rnaEdit);
+  }
+
+  /*
+   * private void RNAPanelDemoInit() { DefaultListModel dlm = new
+   * DefaultListModel();
+   * 
+   * 
+   * int marginTools = 40;
+   * 
+   * DefaultListSelectionModel m = new DefaultListSelectionModel();
+   * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+   * m.setLeadAnchorNotificationEnabled(false);
+   * 
+   * 
+   * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
+   * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
+   * _sideList.setPreferredSize(new Dimension(100, 0));
+   * _sideList.addListSelectionListener( new ListSelectionListener(){ public
+   * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
+   * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
+   * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
+   * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
+   * vp.showRNAInterpolated(sel.rna,sel.config,map);
+   * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
+   * });
+   * 
+   * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
+   * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
+   * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
+   * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
+   * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
+   * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
+   * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
+   * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
+   * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
+   * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
+   * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
+   * 
+   * JScrollPane listScroller = new JScrollPane(_sideList);
+   * listScroller.setPreferredSize(new Dimension(150, 0));
+   * 
+   * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
+   * 
+   * 
+   * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
+   * 
+   * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
+   * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
+   * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
+   * 
+   * _createButton.addActionListener(new ActionListener() { public void
+   * actionPerformed(ActionEvent e) { try { RNA nRNA = new
+   * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
+   * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
+   * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
+   * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
+   * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
+   * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
+   * JOptionPane.ERROR_MESSAGE); } } });
+   * 
+   * 
+   * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
+   * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
+   * 
+   * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
+   * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
+   * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
+   * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
+   * BorderLayout.CENTER);
+   * 
+   * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
+   * _input.add(_strPanel);
+   * 
+   * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
+   * 
+   * _tools.setLayout(new BorderLayout()); _tools.add(_input,
+   * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
+   * _tools.add(goPanel, BorderLayout.EAST);
+   * 
+   * _deleteButton.addActionListener(new ActionListener() { public void
+   * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
+   * _duplicateButton.addActionListener(new ActionListener() { public void
+   * actionPerformed(ActionEvent e) {
+   * _rnaList.add((VARNAConfig)vp.getConfig().clone
+   * (),vp.getRNA().clone(),vp.getRNA
+   * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
+   * Date()),true); }});
+   * 
+   * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
+   * ops.add(_deleteButton); ops.add(_duplicateButton);
+   * 
+   * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
+   * _listPanel.setLayout(new BorderLayout());
+   * 
+   * _listPanel.add(ops,BorderLayout.SOUTH);
+   * _listPanel.add(j,BorderLayout.NORTH);
+   * _listPanel.add(listScroller,BorderLayout.CENTER);
+   * 
+   * goPanel.add(_createButton, BorderLayout.CENTER);
+   * 
+   * JSplitPane split = new
+   * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
+   * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
+   * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
+   * 
+   * setVisible(true); DropTarget dt = new DropTarget(vp, this);
+   * 
+   * vp.addVARNAListener(this); }
+   */
+  public static String generateDefaultName()
+  {
+    return "User file #" + _nextID++;
+  }
+
+  public RNA getRNA()
+  {
+    return (RNA) _sideList.getSelectedValue();
+  }
+
+  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;
+  }
+
+  public void init()
+  {
+    vp.setBackground(_backgroundColor);
+    _error = true;
+  }
+
+  @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 String get_seq()
+  {
+    return _seq.getText();
+  }
+
+  public void set_seq(String _seq)
+  {
+    this._seq.setText(_seq);
+  }
+
+  public String get_str()
+  {
+    return _str.getText();
+  }
+
+  public void set_str(String _str)
+  {
+    this._str.setText(_str);
+  }
+
+  public JLabel get_info()
+  {
+    return _info;
+  }
+
+  public void set_info(JLabel _info)
+  {
+    this._info = _info;
+  }
+
+  /*
+   * public static void main(String[] args) { AppVarnaBinding d = new
+   * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+   * d.pack(); d.setVisible(true); }
+   */
+
+  public void dragEnter(DropTargetDragEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void dragExit(DropTargetEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void dragOver(DropTargetDragEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  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 vp = (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(vp.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(vp.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();
+    }
+
+  }
+
+  public void dropActionChanged(DropTargetDragEvent arg0)
+  {
+  }
+
+  private class BackupHolder
+  {
+    private DefaultListModel _rnaList;
+
+    private ArrayList<RNA> _rnas = new ArrayList<RNA>();
+
+    JList _l;
+
+    public BackupHolder(DefaultListModel rnaList, JList l)
+    {
+      _rnaList = rnaList;
+      _l = l;
+    }
+
+    public void add(VARNAConfig c, RNA r)
+    {
+      add(c, r, r.getName(), false);
+    }
+
+    public void add(VARNAConfig c, RNA r, boolean select)
+    {
+      add(c, r, r.getName(), select);
+    }
+
+    public void add(VARNAConfig c, RNA r, String name)
+    {
+      add(c, r, name, false);
+    }
+
+    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(0, r);
+      _rnaList.add(0, bck);
+      if (select)
+      {
+        _l.setSelectedIndex(0);
+      }
+    }
+
+    public void remove(int i)
+    {
+      _rnas.remove(i);
+      _rnaList.remove(i);
+
+    }
+
+    public DefaultListModel getModel()
+    {
+      return _rnaList;
+    }
+
+    public boolean contains(RNA r)
+    {
+      return _rnas.contains(r);
+    }
+
+    /*
+     * public int getSize() { return _rnaList.getSize(); }
+     */
+    public FullBackup getElementAt(int i)
+    {
+      return (FullBackup) _rnaList.getElementAt(i);
+    }
+
+    public void removeSelected()
+    {
+      int i = _l.getSelectedIndex();
+      if (i != -1)
+      {
+        if (_rnaList.getSize() == 1)
+        {
+          RNA r = new RNA();
+          try
+          {
+            r.setRNA(" ", ".");
+          } catch (ExceptionUnmatchedClosingParentheses e1)
+          {
+          } catch (ExceptionFileFormatOrSyntax e1)
+          {
+          }
+          vp.showRNA(r);
+          vp.repaint();
+        }
+        else
+        {
+          int newi = i + 1;
+          if (newi == _rnaList.getSize())
+          {
+            newi = _rnaList.getSize() - 2;
+          }
+          FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
+          _l.setSelectedValue(bck, true);
+        }
+        _rnaList.remove(i);
+      }
+
+    }
+  }
+
+  public void onLayoutChanged()
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void onUINewStructure(VARNAConfig v, RNA r)
+  {
+    _rnaList.add(v, r, "", true);
+  }
+
+  public void onWarningEmitted(String s)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void mouseClicked(MouseEvent e)
+  {
+    if (e.getClickCount() == 2)
+    {
+      int index = _sideList.locationToIndex(e.getPoint());
+      ListModel dlm = _sideList.getModel();
+      FullBackup item = (FullBackup) 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(); }
+       */
+    }
+  }
+
+  public void mouseEntered(MouseEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void mouseExited(MouseEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void mousePressed(MouseEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void mouseReleased(MouseEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public Color getColour(int atomIndex, int pdbResNum, String chain,
+          String pdbId)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public String[] getPdbFile()
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public void highlightAtom(int atomIndex, int pdbResNum, String chain,
+          String pdbId)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void mouseOverStructure(int atomIndex, String strInfo)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void releaseReferences(Object svl)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void updateColours(Object source)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void componentHidden(ComponentEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void componentMoved(ComponentEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void componentResized(ComponentEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void componentShown(ComponentEvent e)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void onStructureRedrawn()
+  {
+    // TODO Auto-generated method stub
+
+  }
+}
+
+/*
+ * public static void main(String[] args) { JTextField str = new
+ * JTextField("ATGC");
+ * 
+ * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
+ * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }
+ */
\ No newline at end of file
index 5c22e55..6f36a79 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 2b728ae..dad0548 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
diff --git a/src/jalview/gui/ConservationThread.java b/src/jalview/gui/ConservationThread.java
deleted file mode 100644 (file)
index 8f4a6a6..0000000
+++ /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);
-    }
-
-  }
-}
index b4917ca..603d418 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 18dffd6..5192f09 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -27,7 +27,8 @@ import jalview.io.*;
 import jalview.jbgui.*;
 
 /**
- * DOCUMENT ME!
+ * Cut'n'paste files into the desktop
+ * See JAL-1105
  * 
  * @author $author$
  * @version $Revision$
index c623530..71efbd0 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
  */\r
 package jalview.gui;\r
 \r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-import javax.swing.table.*;\r
-\r
-import org.biojava.dasobert.dasregistry.*;\r
-import jalview.jbgui.*;\r
-import jalview.util.*;\r
+import jalview.jbgui.GDasSourceBrowser;\r
+import jalview.util.TableSorter;\r
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+\r
+import java.awt.BorderLayout;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.MouseAdapter;\r
+import java.awt.event.MouseEvent;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Properties;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JCheckBox;\r
+import javax.swing.JLabel;\r
+import javax.swing.JOptionPane;\r
+import javax.swing.JPanel;\r
+import javax.swing.JTextField;\r
+import javax.swing.ListSelectionModel;\r
+import javax.swing.SwingUtilities;\r
+import javax.swing.event.ListSelectionEvent;\r
+import javax.swing.event.ListSelectionListener;\r
+import javax.swing.table.AbstractTableModel;\r
+\r
+import org.biodas.jdas.schema.sources.CAPABILITY;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
+import org.biodas.jdas.schema.sources.PROP;\r
+import org.biodas.jdas.schema.sources.VERSION;\r
 \r
 public class DasSourceBrowser extends GDasSourceBrowser implements\r
         Runnable, ListSelectionListener\r
 {\r
-  static DasSource[] dasSources = null;\r
-\r
-  Hashtable localSources = null;\r
-\r
-  Vector selectedSources;\r
+  DasSourceRegistryI sourceRegistry = null;\r
 \r
-  public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das1/sources/";\r
-\r
-  /**\r
-   * true if thread is running and we are talking to DAS registry service\r
-   */\r
-  public boolean loadingDasSources = false;\r
-\r
-  protected static String getDasRegistryURL()\r
-  {\r
-    String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
-            DEFAULT_REGISTRY);\r
-\r
-    if (registry.indexOf("/registry/das1/sources/") > -1)\r
-    {\r
-      jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,\r
-              DEFAULT_REGISTRY);\r
-      registry = DEFAULT_REGISTRY;\r
-    }\r
-    return registry;\r
-  }\r
+  Vector<String> selectedSources;\r
 \r
   public DasSourceBrowser(FeatureSettings featureSettings)\r
   {\r
     fs = featureSettings;\r
-    String registry = getDasRegistryURL();\r
+    // TODO DasSourceRegistryProvider API\r
+    sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();\r
+    String registry = sourceRegistry.getDasRegistryURL();\r
 \r
     registryURL.setText(registry);\r
 \r
@@ -102,7 +100,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     });\r
 \r
-    if (dasSources != null)\r
+    if (sourceRegistry.getSources() != null)\r
     {\r
       init();\r
     }\r
@@ -110,6 +108,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
   FeatureSettings fs = null;\r
 \r
+  private boolean loadingDasSources;\r
+\r
   public DasSourceBrowser()\r
   {\r
     this(null);\r
@@ -117,7 +117,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
   public void paintComponent(java.awt.Graphics g)\r
   {\r
-    if (dasSources == null && !loadingDasSources)\r
+    if (sourceRegistry == null)\r
     {\r
       Thread worker = new Thread(this);\r
       worker.start();\r
@@ -126,17 +126,18 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
   void init()\r
   {\r
-    int dSize = dasSources.length;\r
+    List<jalviewSourceI> sources = sourceRegistry.getSources();\r
+    int dSize = sources.size();\r
     Object[][] data = new Object[dSize][2];\r
     for (int i = 0; i < dSize; i++)\r
     {\r
-      data[i][0] = dasSources[i].getNickname();\r
-      data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
-              .getNickname()));\r
+      data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname\r
+      data[i][1] = new Boolean(selectedSources.contains(sources.get(i)\r
+              .getTitle()));\r
     }\r
 \r
     refreshTableData(data);\r
-    setCapabilities(dasSources);\r
+    setCapabilities(sourceRegistry);\r
 \r
     javax.swing.SwingUtilities.invokeLater(new Runnable()\r
     {\r
@@ -174,51 +175,73 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       return;\r
     }\r
 \r
-    int dSize = dasSources.length;\r
-    for (int i = 0; i < dSize; i++)\r
+    int dSize = sourceRegistry.getSources().size();\r
+    for (jalviewSourceI ds : sourceRegistry.getSources())\r
     {\r
-      if (!dasSources[i].getNickname().equals(nickName))\r
+      if (!ds.getTitle().equals(nickName))\r
       {\r
         continue;\r
       }\r
 \r
-      DasSource ds = dasSources[i];\r
-\r
-      text.append("<font color=\"#0000FF\">Id:</font> "\r
-              + dasSources[i].getId() + "<br>");\r
+      VERSION latest = ds.getVersion();\r
+      text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()\r
+              + "<br>");\r
       text.append("<font color=\"#0000FF\">Nickname:</font> "\r
-              + dasSources[i].getNickname() + "<br>");\r
-      text.append("<font color=\"#0000FF\">URL:</font> "\r
-              + dasSources[i].getUrl() + "<br>");\r
+              + ds.getTitle() + "<br>");\r
+\r
+      text.append("<font color=\"#0000FF\">URL:</font> <a href=\""\r
+              + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"\r
+              + "<br>");\r
+      if (!ds.isLocal())\r
+      {\r
+        if (ds.getDocHref() != null && ds.getDocHref().length() > 0)\r
+        {\r
+          text.append("<font color=\"#0000FF\">Site:</font> <a href=\""\r
+                  + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"\r
+                  + "<br>");\r
+        }\r
 \r
-      text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
-              + dasSources[i].getAdminemail()\r
-              + "\">"\r
-              + dasSources[i].getAdminemail() + "</a>" + "<br>");\r
+        text.append("<font color=\"#0000FF\">Description:</font> "\r
+                + ds.getDescription() + "<br>");\r
 \r
-      text.append("<font color=\"#0000FF\">Registered at:</font> "\r
-              + dasSources[i].getRegisterDate() + "<br>");\r
+        text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
+                + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");\r
 \r
-      text.append("<font color=\"#0000FF\">Last successful test:</font> "\r
-              + dasSources[i].getLeaseDate() + "<br>");\r
+        text.append("<font color=\"#0000FF\">Registered at:</font> "\r
+                + latest.getCreated() + "<br>");\r
 \r
+        // TODO: Identify last successful test date\r
+        // text.append("<font color=\"#0000FF\">Last successful test:</font> "\r
+        // + latest.dasSources[i].getLeaseDate() + "<br>");\r
+      }\r
+      else\r
+      {\r
+        text.append("Source was added manually.<br/>");\r
+      }\r
       text.append("<font color=\"#0000FF\">Labels:</font> ");\r
-      for (int s = 0; s < dasSources[i].getLabels().length; s++)\r
+      boolean b = false;\r
+      for (PROP labl : latest.getPROP())\r
       {\r
-        text.append(dasSources[i].getLabels()[s]);\r
-        if (s < dasSources[i].getLabels().length - 1)\r
+        if (labl.getName().equalsIgnoreCase("LABEL"))\r
         {\r
-          text.append(",");\r
+          if (b)\r
+          {\r
+            text.append(",");\r
+          }\r
+          text.append(" ");\r
+\r
+          text.append(labl.getValue());\r
+          b = true;\r
         }\r
-        text.append(" ");\r
+        ;\r
       }\r
       text.append("<br>");\r
 \r
       text.append("<font color=\"#0000FF\">Capabilities:</font> ");\r
-      String[] scap = dasSources[i].getCapabilities();\r
+      CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);\r
       for (int j = 0; j < scap.length; j++)\r
       {\r
-        text.append(scap[j]);\r
+        text.append(scap[j].getType());\r
         if (j < scap.length - 1)\r
         {\r
           text.append(", ");\r
@@ -226,35 +249,25 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
       text.append("<br>");\r
 \r
-      text.append("<font color=\"#0000FF\">Coordinates:</font> ");\r
-      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
-      for (int j = 0; j < dcs.length; j++)\r
+      text.append("<font color=\"#0000FF\">Coordinates:</font>");\r
+      int i=1;\r
+      for (COORDINATES dcs : latest.getCOORDINATES())\r
       {\r
-        text.append("(" + dcs[j].getUniqueId() + ") "\r
-                + dcs[j].getCategory() + ", " + dcs[j].getName());\r
-        if (dcs[j].getNCBITaxId() != 0)\r
+        text.append("<br/>"+i+++". ");\r
+        text.append(dcs.getAuthority()+" : "+dcs.getSource());\r
+        if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)\r
         {\r
-          text.append(", " + dcs[j].getNCBITaxId());\r
+          text.append(" [TaxId:" + dcs.getTaxid()+"]");\r
         }\r
-        if (dcs[j].getOrganismName().length() > 0)\r
+        if (dcs.getVersion() != null\r
+                && dcs.getVersion().trim().length() > 0)\r
         {\r
-          text.append(", " + dcs[j].getOrganismName());\r
+          {\r
+            text.append(" {v. " + dcs.getVersion()+"}");\r
+          }\r
         }\r
-\r
-        text.append("<br>");\r
-      }\r
-\r
-      text.append("<font color=\"#0000FF\">Description:</font> "\r
-              + dasSources[i].getDescription() + "<br>");\r
-\r
-      if (dasSources[i].getHelperurl() != null\r
-              && dasSources[i].getHelperurl().length() > 0)\r
-      {\r
-        text.append("<font color=\"#0000FF\"><a href=\""\r
-                + dasSources[i].getHelperurl()\r
-                + "\">Go to site</a></font<br>");\r
+        text.append(" (<a href=\""+dcs.getUri() +"\">"+dcs.getUri() + "</a>)");\r
       }\r
-\r
       text.append("</font></html>");\r
 \r
       break;\r
@@ -280,8 +293,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     progressBar.setIndeterminate(true);\r
     setParentGuiEnabled(false);\r
     // Refresh the source list.\r
-    dasSources = null;\r
-    getDASSource();\r
+    sourceRegistry.refreshSources();\r
 \r
     init();\r
 \r
@@ -299,10 +311,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     }\r
   }\r
 \r
-  public Vector getSelectedSources()\r
+  public Vector<jalviewSourceI> getSelectedSources()\r
   {\r
     // wait around if we're still loading.\r
-    while (dasSources == null)\r
+    while (sourceRegistry == null)\r
     {\r
       if (!loadingDasSources)\r
       {\r
@@ -328,39 +340,18 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     }\r
 \r
-    Vector selected = new Vector();\r
-    for (int r = 0; r < selectedSources.size(); r++)\r
+    Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();\r
+    for (String source : selectedSources)\r
     {\r
-      for (int i = 0; i < dasSources.length; i++)\r
+      jalviewSourceI srce = sourceRegistry.getSource(source);\r
+      if (srce != null)\r
       {\r
-        if (dasSources[i].getNickname()\r
-                .equals(selectedSources.elementAt(r)))\r
-        {\r
-          selected.addElement(dasSources[i]);\r
-          break;\r
-        }\r
+        selected.addElement(srce);\r
       }\r
     }\r
-\r
     return selected;\r
   }\r
 \r
-  /**\r
-   * retrieve das sources from registry and add local source list\r
-   * \r
-   * @return\r
-   */\r
-  public DasSource[] getDASSource()\r
-  {\r
-    if (dasSources == null)\r
-    {\r
-      dasSources = jalview.ws.DasSequenceFeatureFetcher.getDASSources();\r
-      appendLocalSources();\r
-    }\r
-\r
-    return dasSources;\r
-  }\r
-\r
   public void refresh_actionPerformed(ActionEvent e)\r
   {\r
     saveProperties(jalview.bin.Cache.applicationProperties);\r
@@ -369,41 +360,39 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     worker.start();\r
   }\r
 \r
-  private void setCapabilities(DasSource[] sources)\r
+  private void setCapabilities(DasSourceRegistryI sourceRegistry2)\r
   {\r
-    Vector authority = new Vector();\r
-    Vector type = new Vector();\r
-    Vector label = new Vector();\r
+    Vector<String> authority = new Vector<String>();\r
+    Vector<String> type = new Vector<String>();\r
+    Vector<String> label = new Vector<String>();\r
+    Vector<String> taxIds = new Vector<String>();\r
+    authority.add("Any");\r
+    type.add("Any");\r
+    label.add("Any");\r
 \r
-    authority.addElement("Any");\r
-    type.addElement("Any");\r
-    label.addElement("Any");\r
-\r
-    for (int i = 0; i < sources.length; i++)\r
+    for (jalviewSourceI ds : sourceRegistry2.getSources())\r
     {\r
-      DasSource ds = sources[i];\r
-\r
-      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
+      VERSION latest = ds.getVersion();\r
 \r
-      for (int j = 0; j < dcs.length; j++)\r
+      for (COORDINATES cs : latest.getCOORDINATES())\r
       {\r
-        if (!type.contains(dcs[j].getCategory()))\r
+        if (!type.contains(cs.getSource()))\r
         {\r
-          type.addElement(dcs[j].getCategory());\r
+          type.add(cs.getSource()); // source==category\r
         }\r
 \r
-        if (!authority.contains(dcs[j].getName()))\r
+        if (!authority.contains(cs.getAuthority()))\r
         {\r
-          authority.addElement(dcs[j].getName());\r
+          authority.add(cs.getAuthority());\r
         }\r
       }\r
 \r
-      String[] slabels = ds.getLabels();\r
-      for (int s = 0; s < slabels.length; s++)\r
+      for (PROP slabel : latest.getPROP())\r
       {\r
-        if (!label.contains(slabels[s]))\r
+        if (slabel.getName().equalsIgnoreCase("LABEL")\r
+                && !label.contains(slabel.getValue()))\r
         {\r
-          label.addElement(slabels[s]);\r
+          label.add(slabel.getValue());\r
         }\r
       }\r
 \r
@@ -412,6 +401,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     filter1.setListData(authority);\r
     filter2.setListData(type);\r
     filter3.setListData(label);\r
+    // filter4 taxIds\r
 \r
     javax.swing.SwingUtilities.invokeLater(new Runnable()\r
     {\r
@@ -432,9 +422,9 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     {\r
       int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
       nickname = table.getValueAt(selectedRow, 0).toString();\r
-      url = ((DasSource) localSources.get(nickname)).getUrl();\r
-      seqsrc = ((DasSource) localSources.get(nickname))\r
-              .hasCapability("sequence");\r
+      jalviewSourceI source = sourceRegistry.getSource(nickname);\r
+      url = source.getUri();\r
+      seqsrc = source.isSequenceSource();\r
     }\r
 \r
     JTextField nametf = new JTextField(nickname, 40);\r
@@ -466,66 +456,39 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       urltf.setText(urltf.getText() + "/");\r
     }\r
 \r
-    Das1Source local = new Das1Source();\r
+    jalviewSourceI local = sourceRegistry.createLocalSource(\r
+            urltf.getText(), nametf.getText(), seqs.isSelected(), true);\r
+    List sources = sourceRegistry.getSources();\r
+    int osize = sources.size();\r
+    int size = osize + (newSource ? 1 : 0);\r
 \r
-    local.setUrl(urltf.getText());\r
-    local.setNickname(nametf.getText());\r
-    if (seqs.isSelected())\r
-    {\r
-      local.setCapabilities(new String[]\r
-      { "features", "sequence" });\r
-    }\r
-    if (localSources == null)\r
+    Object[][] data = new Object[size][2];\r
+    DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table\r
+            .getModel()).getTableModel() : null;\r
+    for (int i = 0; i < osize; i++)\r
     {\r
-      localSources = new Hashtable();\r
-    }\r
-\r
-    localSources.put(local.getNickname(), local);\r
-\r
-    if (!newSource && !nickname.equals(nametf.getText()))\r
-    {\r
-      localSources.remove(nickname);\r
-    }\r
-\r
-    int size = dasSources.length;\r
-    int adjust = newSource ? 1 : 0;\r
-\r
-    Object[][] data = new Object[size + adjust][2];\r
-    for (int i = 0; i < size; i++)\r
-    {\r
-      if (!newSource && dasSources[i].getNickname().equals(nickname))\r
+      String osrc = (dtm == null || i >= osize) ? null : (String) dtm\r
+              .getValueAt(i, 0);\r
+      if (!newSource && osrc != null\r
+              && dtm.getValueAt(i, 0).equals(nickname))\r
       {\r
-        ((DasSource) dasSources[i]).setNickname(local.getNickname());\r
-        ((DasSource) dasSources[i]).setUrl(local.getUrl());\r
-        data[i][0] = local.getNickname();\r
+        data[i][0] = local.getTitle();\r
         data[i][1] = new Boolean(true);\r
       }\r
       else\r
       {\r
-        data[i][0] = dasSources[i].getNickname();\r
-        data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
-                .getNickname()));\r
+        data[i][0] = osrc;\r
+        data[i][1] = new Boolean(selectedSources.contains(osrc));\r
       }\r
     }\r
-\r
-    if (newSource)\r
-    {\r
-      data[size][0] = local.getNickname();\r
-      data[size][1] = new Boolean(true);\r
-      selectedSources.add(local.getNickname());\r
-    }\r
-\r
-    DasSource[] tmp = new DasSource[size + adjust];\r
-\r
-    System.arraycopy(dasSources, 0, tmp, 0, size);\r
-\r
+    // Always add a new source at the end\r
     if (newSource)\r
     {\r
-      tmp[size] = local;\r
+      data[osize][0] = local.getTitle();\r
+      data[osize][1] = new Boolean(true);\r
+      selectedSources.add(local.getTitle());\r
     }\r
 \r
-    dasSources = tmp;\r
-\r
     refreshTableData(data);\r
 \r
     SwingUtilities.invokeLater(new Runnable()\r
@@ -537,7 +500,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     });\r
 \r
-    displayFullDetails(local.getNickname());\r
+    displayFullDetails(local.getTitle());\r
   }\r
 \r
   public void editRemoveLocalSource(MouseEvent evt)\r
@@ -550,7 +513,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 \r
     String nickname = table.getValueAt(selectedRow, 0).toString();\r
 \r
-    if (!localSources.containsKey(nickname))\r
+    if (!sourceRegistry.getSource(nickname).isLocal())\r
     {\r
       JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
               "You can only edit or remove local DAS Sources!",\r
@@ -573,27 +536,26 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       amendLocal(false);\r
       break;\r
     case 1:\r
-      localSources.remove(nickname);\r
+      sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));\r
       selectedSources.remove(nickname);\r
-      Object[][] data = new Object[dasSources.length - 1][2];\r
-      DasSource[] tmp = new DasSource[dasSources.length - 1];\r
-      int index = 0;\r
-      for (int i = 0; i < dasSources.length; i++)\r
+      Object[][] data = new Object[sourceRegistry.getSources().size()][2];\r
+      int index = 0,\r
+      l = table.getRowCount();\r
+\r
+      for (int i = 0; i < l; i++)\r
       {\r
-        if (dasSources[i].getNickname().equals(nickname))\r
+        String nm;\r
+        if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))\r
         {\r
           continue;\r
         }\r
         else\r
         {\r
-          tmp[index] = dasSources[i];\r
-          data[index][0] = dasSources[i].getNickname();\r
-          data[index][1] = new Boolean(\r
-                  selectedSources.contains(dasSources[i].getNickname()));\r
+          data[index][0] = nm;\r
+          data[index][1] = new Boolean(selectedSources.contains(nm));\r
           index++;\r
         }\r
       }\r
-      dasSources = tmp;\r
       refreshTableData(data);\r
       SwingUtilities.invokeLater(new Runnable()\r
       {\r
@@ -608,50 +570,6 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     }\r
   }\r
 \r
-  void appendLocalSources()\r
-  {\r
-    if (localSources == null)\r
-    {\r
-      return;\r
-    }\r
-    // note - we add all das sources to list so they can be filtered for the\r
-    // standard fetchDbRefs function\r
-    int size = dasSources != null ? dasSources.length : 0;\r
-    int lsize = localSources.size();\r
-\r
-    Object[][] data = new Object[size + lsize][2];\r
-    for (int i = 0; i < size; i++)\r
-    {\r
-      data[i][0] = dasSources[i].getNickname();\r
-      data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
-              .getNickname()));\r
-    }\r
-\r
-    DasSource[] tmp = new DasSource[size + lsize];\r
-    if (dasSources != null)\r
-    {\r
-      System.arraycopy(dasSources, 0, tmp, 0, size);\r
-    }\r
-\r
-    Enumeration en = localSources.keys();\r
-    int index = size;\r
-    while (en.hasMoreElements())\r
-    {\r
-      String key = en.nextElement().toString();\r
-      data[index][0] = key;\r
-      data[index][1] = new Boolean(false);\r
-      tmp[index] = new Das1Source();\r
-      tmp[index].setNickname(key);\r
-      tmp[index].setUrl(((DasSource) localSources.get(key)).getUrl());\r
-\r
-      index++;\r
-    }\r
-\r
-    dasSources = tmp;\r
-\r
-    refreshTableData(data);\r
-  }\r
-\r
   public void valueChanged(ListSelectionEvent evt)\r
   {\r
     // Called when the MainTable selection changes\r
@@ -663,59 +581,57 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     displayFullDetails(null);\r
 \r
     // Filter the displayed data sources\r
-    int dSize = dasSources.length;\r
 \r
     ArrayList names = new ArrayList();\r
     ArrayList selected = new ArrayList();\r
-    DasSource ds;\r
 \r
     // The features filter is not visible, but we must still\r
     // filter the das source list here.\r
     // July 2006 - only 6 sources fo not serve features\r
     Object[] dummyFeatureList = new Object[]\r
     { "features" };\r
-\r
-    for (int i = 0; i < dSize; i++)\r
+    List<jalviewSourceI> srcs = sourceRegistry.getSources();\r
+    for (jalviewSourceI ds : srcs)\r
     {\r
-      ds = dasSources[i];\r
-      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
 \r
-      if (dcs.length == 0 && ds.getCapabilities().length == 0\r
-              && filter1.getSelectedIndex() == 0\r
-              && filter2.getSelectedIndex() == 0\r
-              && filter3.getSelectedIndex() == 0)\r
+      VERSION v = ds.getVersion();\r
+      List<COORDINATES> coords = v.getCOORDINATES();\r
+      if (ds.isLocal()\r
+              || ((coords == null || coords.size() == 0)\r
+                      && filter1.getSelectedIndex() == 0\r
+                      && filter2.getSelectedIndex() == 0 && filter3\r
+                      .getSelectedIndex() == 0))\r
       {\r
         // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT\r
         // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT\r
         // IS ADDED FROM THE REGISTRY\r
-        names.add(ds.getNickname());\r
-        selected.add(new Boolean(selectedSources.contains(ds.getNickname())));\r
+        names.add(ds.getTitle());\r
+        selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
         continue;\r
       }\r
 \r
-      if (!selectedInList(dummyFeatureList, ds.getCapabilities())\r
+      if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))\r
               || !selectedInList(filter3.getSelectedValues(),\r
-                      ds.getLabels()))\r
+                      ds.getLabelsFor(v)))\r
       {\r
         continue;\r
       }\r
 \r
-      for (int j = 0; j < dcs.length; j++)\r
+      for (int j = 0; j < coords.size(); j++)\r
       {\r
         if (selectedInList(filter1.getSelectedValues(), new String[]\r
-        { dcs[j].getName() })\r
+        { coords.get(j).getAuthority() })\r
                 && selectedInList(filter2.getSelectedValues(), new String[]\r
-                { dcs[j].getCategory() }))\r
+                { coords.get(j).getSource() }))\r
         {\r
-          names.add(ds.getNickname());\r
-          selected.add(new Boolean(selectedSources.contains(ds\r
-                  .getNickname())));\r
+          names.add(ds.getTitle());\r
+          selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
           break;\r
         }\r
       }\r
     }\r
 \r
-    dSize = names.size();\r
+    int dSize = names.size();\r
     Object[][] data = new Object[dSize][2];\r
     for (int d = 0; d < dSize; d++)\r
     {\r
@@ -726,7 +642,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     refreshTableData(data);\r
   }\r
 \r
-  boolean selectedInList(Object[] selection, String[] items)\r
+  private boolean selectedInList(Object[] selection, String[] items)\r
   {\r
     for (int i = 0; i < selection.length; i++)\r
     {\r
@@ -734,10 +650,15 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       {\r
         return true;\r
       }\r
-\r
+      if (items == null || items.length == 0)\r
+      {\r
+        return false;\r
+      }\r
+      String sel = (items[0].startsWith("das1:") ? "das1:" : "")\r
+              + selection[i];\r
       for (int j = 0; j < items.length; j++)\r
       {\r
-        if (selection[i].equals(items[j]))\r
+        if (sel.equals(items[j]))\r
         {\r
           return true;\r
         }\r
@@ -757,26 +678,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     {\r
       selectedSources.addElement(st.nextToken());\r
     }\r
-\r
-    Vector _localSources = jalview.bin.Cache.getLocalDasSources();\r
-    if (_localSources != null)\r
-    {\r
-      if (localSources == null)\r
-      {\r
-        localSources = new Hashtable();\r
-      }\r
-      Enumeration sources = _localSources.elements();\r
-      while (sources.hasMoreElements())\r
-      {\r
-        Das1Source source = (Das1Source) sources.nextElement();\r
-        localSources.put(source.getNickname(), source);\r
-      }\r
-    }\r
   }\r
 \r
   public void reset_actionPerformed(ActionEvent e)\r
   {\r
-    registryURL.setText(DEFAULT_REGISTRY);\r
+    registryURL.setText(sourceRegistry.getDasRegistryURL());\r
   }\r
 \r
   /**\r
@@ -808,24 +714,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,\r
             sb.toString());\r
 \r
-    if (localSources != null)\r
-    {\r
-      sb = new StringBuffer();\r
-      Enumeration en = localSources.keys();\r
-      while (en.hasMoreElements())\r
-      {\r
-        String token = en.nextElement().toString();\r
-        sb.append(token\r
-                + "|"\r
-                + (((DasSource) localSources.get(token))\r
-                        .hasCapability("sequence") ? "sequence:" : "")\r
-                + ((DasSource) localSources.get(token)).getUrl() + "\t");\r
-      }\r
-\r
-      properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE,\r
-              sb.toString());\r
-    }\r
-\r
+    String sourceprop = sourceRegistry.getLocalSourceString();\r
+    properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);\r
   }\r
 \r
   class DASTableModel extends AbstractTableModel\r
@@ -917,7 +807,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }\r
     });\r
     thr.start();\r
-    while (loadingDasSources || dasSources == null)\r
+    while (loadingDasSources || sourceRegistry == null)\r
     {\r
       try\r
       {\r
@@ -929,26 +819,6 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     }\r
   }\r
 \r
-  public Vector resolveSourceNicknames(Vector sources)\r
-  {\r
-\r
-    Vector resolved = new Vector();\r
-    if (sources != null)\r
-    {\r
-      for (int i = 0; i < dasSources.length; i++)\r
-      {\r
-        if (sources.contains(dasSources[i].getNickname()))\r
-        {\r
-          if (!resolved.contains(dasSources[i]))\r
-          {\r
-            resolved.addElement(dasSources[i]);\r
-          }\r
-        }\r
-      }\r
-    }\r
-    return resolved;\r
-  }\r
-\r
   /**\r
    * disable or enable the buttons on the source browser\r
    * \r
index b6cbea3..300fcc2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -1060,30 +1060,77 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    */
   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,
 
-    if (!jalview.bin.Cache.getProperty("LATEST_VERSION").equals(
-            jalview.bin.Cache.getProperty("VERSION")))
+    message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+  }
+
+  public StringBuffer getAboutMessage(boolean shortv)
+  {
+    StringBuffer message = new StringBuffer();
+    message.append("<html>");
+    if (shortv)
     {
-      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("<h1><strong>Jalview "
+              + jalview.bin.Cache.getProperty("VERSION")
+              + "</strong></h1><br>");
+      message.append("<strong>Last Updated: <em>"
+              + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
+              + "</em></strong>");
 
     }
-    // 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@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,
+    else
+    {
 
-    message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+      message.append("<strong>Jalview version "
+              + jalview.bin.Cache.getProperty("VERSION")
+              + "; last updated: "
+              + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+    }
+
+    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>!! 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") + " !!");
+      if (red)
+      {
+        message.append("</div>");
+      }
+    }
+    message.append("<br>Authors:  "
+            + jalview.bin.Cache
+                    .getDefault(
+                            "AUTHORNAMES",
+                            "Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton")
+            + "<br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
+            + "<br>For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list"
+            + "<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;
   }
 
   /**
@@ -1592,7 +1639,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
     source.viewport.gatherViewsHere = true;
     source.viewport.explodedPosition = source.getBounds();
     JInternalFrame[] frames = desktop.getAllFrames();
-    String viewId = source.viewport.sequenceSetID;
+    String viewId = source.viewport.getSequenceSetId();
 
     for (int t = 0; t < frames.length; t++)
     {
index 5b4e77a..277cffb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a9fedf6..ecc78b0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e5ea8fe..68052d0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0679873..2db75bf 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -685,9 +685,10 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     {
       minmax = new Hashtable();
     }
-    for (int i = 0; i < av.alignment.getHeight(); i++)
+    AlignmentI alignment=av.getAlignment();
+    for (int i = 0; i < alignment.getHeight(); i++)
     {
-      SequenceFeature[] features = av.alignment.getSequenceAt(i)
+      SequenceFeature[] features = alignment.getSequenceAt(i)
               .getDatasetSequence().getSequenceFeatures();
 
       if (features == null)
index fae5259..35690a9 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -19,11 +19,10 @@ package jalview.gui;
 
 import java.io.*;
 import java.util.*;
+import java.util.List;
 
 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;
 
@@ -38,6 +37,7 @@ import jalview.datamodel.*;
 import jalview.io.*;
 import jalview.schemes.AnnotationColourGradient;
 import jalview.schemes.GraduatedColor;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
 
 public class FeatureSettings extends JPanel
 {
@@ -313,15 +313,15 @@ public class FeatureSettings extends JPanel
     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()
+      if (af.getViewport().getAlignment().getSequenceAt(i).getDatasetSequence()
               .getSequenceFeatures() == null)
       {
         continue;
       }
 
-      tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+      tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
               .getDatasetSequence().getSequenceFeatures();
 
       int index = 0;
@@ -442,10 +442,10 @@ 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)
+      tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
               .getDatasetSequence().getSequenceFeatures();
       if (tmpfeatures == null)
       {
@@ -1177,7 +1177,7 @@ 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;
@@ -1225,9 +1225,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 +1253,14 @@ 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()
index 05fad6f..3bcb2c0 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -195,7 +195,7 @@ 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.setFindAll(findAll);
 
index d996aaf..d12c697 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -179,14 +179,43 @@ public class FontChooser extends GFontChooser
     }
   }
 
+  private Font lastSelected=null; 
+  private int lastSelStyle=0;
+  private int lastSelSize=0;
+  private boolean lastSelMono=false;
   /**
    * DOCUMENT ME!
    */
   void changeFont()
   {
+    if (lastSelected==null)
+    {
+      // initialise with original font
+      lastSelected=oldFont;
+      lastSelSize=oldFont.getSize();
+      lastSelStyle=oldFont.getStyle();
+      FontMetrics fm = getGraphics().getFontMetrics(oldFont);
+      double mw=fm.getStringBounds("M", getGraphics())
+              .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+                      .getWidth();
+      lastSelMono=mw==iw;
+    }
+    
     Font newFont = new Font(fontName.getSelectedItem().toString(),
             fontStyle.getSelectedIndex(), Integer.parseInt(fontSize
                     .getSelectedItem().toString()));
+    FontMetrics fm = getGraphics().getFontMetrics(newFont);
+    double mw=fm.getStringBounds("M", getGraphics())
+            .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+                    .getWidth();
+    if (mw<1 || iw < 1) {
+      fontName.setSelectedItem(lastSelected.getName());
+      fontStyle.setSelectedIndex(lastSelStyle);
+      fontSize.setSelectedItem(""+lastSelSize);
+      monospaced.setSelected(lastSelMono);
+      JOptionPane.showInternalMessageDialog(this, "Font doesn't have letters defined\nso cannot be used\nwith alignment data.", "Invalid Font", JOptionPane.WARNING_MESSAGE);
+      return;
+    }
     if (tp != null)
     {
       tp.setTreeFont(newFont);
@@ -197,12 +226,10 @@ public class FontChooser extends GFontChooser
       ap.fontChanged();
     }
 
-    FontMetrics fm = getGraphics().getFontMetrics(newFont);
-
-    monospaced.setSelected(fm.getStringBounds("M", getGraphics())
-            .getWidth() == fm.getStringBounds("|", getGraphics())
-            .getWidth());
 
+    monospaced.setSelected(mw==iw);
+    // remember last selected
+    lastSelected=newFont;
   }
 
   /**
index 943c83d..3477153 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 3e8fa2f..08445a9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 5cd7c51..235747c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -19,6 +19,8 @@ package jalview.gui;
 
 import java.awt.*;
 import java.awt.image.*;
+import java.util.List;
+
 import javax.swing.*;
 
 import jalview.datamodel.*;
@@ -47,7 +49,7 @@ public class IdCanvas extends JPanel
 
   boolean fastPaint = false;
 
-  java.util.Vector searchResults;
+  List<SequenceI> searchResults;
 
   FontMetrics fm;
 
@@ -123,7 +125,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 (av.hasHiddenRows() && av.showHiddenMarkers)
     {
       drawMarker(i, starty, ypos);
     }
@@ -264,10 +266,10 @@ public class IdCanvas extends JPanel
 
     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;
       }
@@ -304,8 +306,8 @@ 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 (av.hasHiddenRows())
           {
             setHiddenFont(s);
           }
@@ -338,14 +340,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 (av.hasHiddenRows())
         {
           setHiddenFont(sequence);
         }
@@ -387,7 +389,7 @@ public class IdCanvas extends JPanel
                 (((i - starty) * av.charHeight) + av.charHeight)
                         - (av.charHeight / 5));
 
-        if (av.hasHiddenRows && av.showHiddenMarkers)
+        if (av.hasHiddenRows() && av.showHiddenMarkers)
         {
           drawMarker(i, starty, 0);
         }
@@ -400,7 +402,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;
@@ -463,8 +465,7 @@ 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);
     }
@@ -477,12 +478,12 @@ public class IdCanvas extends JPanel
   /**
    * 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();
   }
 }
index 1732291..0480ffa 100755 (executable)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.*;
 import java.awt.event.*;
+import java.util.List;
 import java.util.Vector;
 
 import javax.swing.*;
@@ -28,7 +29,7 @@ import jalview.util.UrlLink;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -54,7 +55,7 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * Creates a new IdPanel object.
-   * 
+   *
    * @param av
    *          DOCUMENT ME!
    * @param parent
@@ -76,18 +77,19 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseMoved(MouseEvent e)
   {
     SeqPanel sp = alignPanel.seqPanel;
     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);
+      SequenceI sequence = av.getAlignment().getSequenceAt(seq);
       StringBuffer tip = new StringBuffer();
       tip.append("<i>");
 
@@ -146,10 +148,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseDragged(MouseEvent e)
   {
     mouseDragging = true;
@@ -169,6 +172,7 @@ public class IdPanel extends JPanel implements MouseListener,
     alignPanel.paintAlignment(true);
   }
 
+  @Override
   public void mouseWheelMoved(MouseWheelEvent e)
   {
     e.consume();
@@ -184,10 +188,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseClicked(MouseEvent e)
   {
     if (e.getClickCount() < 2)
@@ -256,10 +261,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseEntered(MouseEvent e)
   {
     if (scrollThread != null)
@@ -270,10 +276,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseExited(MouseEvent e)
   {
     if (av.getWrapAlignment())
@@ -287,7 +294,7 @@ 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);
     }
@@ -295,10 +302,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mousePressed(MouseEvent e)
   {
     if (e.getClickCount() == 2)
@@ -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))
@@ -358,7 +366,7 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param seq
    *          DOCUMENT ME!
    */
@@ -372,7 +380,7 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param start
    *          DOCUMENT ME!
    * @param end
@@ -409,10 +417,11 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseReleased(MouseEvent e)
   {
     if (scrollThread != null)
@@ -428,20 +437,20 @@ public class IdPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
-   * @param found
+   *
+   * @param list
    *          DOCUMENT ME!
    */
-  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.get(0));
+    int index = av.getAlignment().findIndex(list.get(0));
 
     // do we need to scroll the panel?
     if ((av.getStartSeq() > index) || (av.getEndSeq() < index))
@@ -468,6 +477,7 @@ public class IdPanel extends JPanel implements MouseListener,
       running = false;
     }
 
+    @Override
     public void run()
     {
       running = true;
index f7ff75a..15faa74 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java
new file mode 100644 (file)
index 0000000..53fc35c
--- /dev/null
@@ -0,0 +1,511 @@
+package jalview.gui;
+
+import jalview.bin.Cache;
+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.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+public class JDatabaseTree extends JalviewDialog implements KeyListener
+{
+  boolean allowMultiSelections = false;
+
+  JButton getDatabaseSelectorButton()
+  {
+    final JButton viewdbs = new JButton("--- Select Database ---");
+    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, "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);
+    }
+    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 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
+            {
+              if ((admt = dmt.getFirstLeaf()) != null
+                      && admt.getUserObject() != null)
+              {
+                // modify db selection to just first leaf.
+                if (admt.getUserObject() instanceof DbSourceProxy)
+                {
+                  srcs.add((DbSourceProxy) admt.getUserObject());
+                }
+                else
+                {
+                  srcs.add(sfetcher.getSourceProxy(
+                          (String) admt.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("Selected "
+              + srcs.size()
+              + " database"
+              + (srcs.size() == 1 ? "" : "s")
+              + " to fetch from"
+              + (srcs.size() > 0 ? " with " + x + " test quer"
+                      + (x == 1 ? "y" : "ies") : "."));
+      dbstatex.setText(" ");
+    }
+    else
+    {
+      if (nm.length() > 0)
+      {
+        dbstatus.setText("Database: " + nm);
+        if (qr.length() > 0)
+        {
+          dbstatex.setText("Example: " + 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)
+    {
+      okPressed();
+    }
+    if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE)
+    {
+      cancelPressed();
+    }
+  }
+
+  @Override
+  public void keyReleased(KeyEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void keyTyped(KeyEvent arg0)
+  {
+    // TODO Auto-generated method stub
+
+  }
+}
index cb29ab5..14650a9 100644 (file)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -29,7 +29,6 @@ import javax.swing.*;
 
 import org.exolab.castor.xml.*;
 
-import uk.ac.vamsas.objects.utils.MapList;
 import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentAnnotation;
@@ -37,16 +36,16 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceI;
 import jalview.schemabinding.version2.*;
 import jalview.schemes.*;
-import jalview.structure.StructureSelectionManager;
+import jalview.util.Platform;
 import jalview.util.jarInputStreamProvider;
 
 /**
  * Write out the current jalview desktop state as a Jalview XML stream.
- * 
+ *
  * Note: the vamsas objects referred to here are primitive versions of the
  * VAMSAS project schema elements - they are not the same and most likely never
  * will be :)
- * 
+ *
  * @author $author$
  * @version $Revision: 1.134 $
  */
@@ -54,7 +53,7 @@ public class Jalview2XML
 {
   /**
    * create/return unique hash string for sq
-   * 
+   *
    * @param sq
    * @return new or existing unique string for sq
    */
@@ -260,7 +259,7 @@ public class Jalview2XML
 
   /**
    * Writes a jalview project archive to the given Jar output stream.
-   * 
+   *
    * @param jout
    */
   public void SaveState(JarOutputStream jout)
@@ -401,7 +400,7 @@ public class Jalview2XML
   /**
    * create a JalviewModel from an algnment view and marshall it to a
    * JarOutputStream
-   * 
+   *
    * @param ap
    *          panel to create jalview model for
    * @param fileName
@@ -426,9 +425,9 @@ public class Jalview2XML
     object.setCreationDate(new java.util.Date(System.currentTimeMillis()));
     object.setVersion(jalview.bin.Cache.getProperty("VERSION"));
 
-    jalview.datamodel.AlignmentI jal = av.alignment;
+    jalview.datamodel.AlignmentI jal = av.getAlignment();
 
-    if (av.hasHiddenRows)
+    if (av.hasHiddenRows())
     {
       jal = jal.getHiddenSequences().getFullAlignment();
     }
@@ -497,15 +496,13 @@ public class Jalview2XML
 
       jseq.setId(id); // jseq id should be a string not a number
 
-      if (av.hasHiddenRows)
+      if (av.hasHiddenRows())
       {
-        jseq.setHidden(av.alignment.getHiddenSequences().isHidden(jds));
+        jseq.setHidden(av.getAlignment().getHiddenSequences().isHidden(jds));
 
-        if (av.hiddenRepSequences != null
-                && av.hiddenRepSequences.containsKey(jal.getSequenceAt(i)))
+        if (av.isHiddenRepSequence(jal.getSequenceAt(i)))
         {
-          jalview.datamodel.SequenceI[] reps = ((jalview.datamodel.SequenceGroup) av.hiddenRepSequences
-                  .get(jal.getSequenceAt(i))).getSequencesInOrder(jal);
+          jalview.datamodel.SequenceI[] reps = av.getRepresentedSequences(jal.getSequenceAt(i)).getSequencesInOrder(jal);
 
           for (int h = 0; h < reps.length; h++)
           {
@@ -612,7 +609,8 @@ public class Jalview2XML
 
                 for (int smap = 0; smap < jmol.jmb.sequence[peid].length; smap++)
                 {
-                  if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+//                  if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+                  if (jds==jmol.jmb.sequence[peid][smap])
                   {
                     StructureState state = new StructureState();
                     state.setVisible(true);
@@ -706,9 +704,9 @@ public class Jalview2XML
       jms.addJSeq(jseq);
     }
 
-    if (av.hasHiddenRows)
+    if (av.hasHiddenRows())
     {
-      jal = av.alignment;
+      jal = av.getAlignment();
     }
     // SAVE MAPPINGS
     if (jal.getCodonFrames() != null && jal.getCodonFrames().length > 0)
@@ -764,7 +762,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());
@@ -842,6 +840,7 @@ public class Jalview2XML
         an.setCentreColLabels(aa[i].centreColLabels);
         an.setScaleColLabels(aa[i].scaleColLabel);
         an.setShowAllColLabels(aa[i].showAllColLabels);
+        an.setBelowAlignment(aa[i].belowAlignment);
 
         if (aa[i].graph > 0)
         {
@@ -864,8 +863,8 @@ public class Jalview2XML
 
         an.setLabel(aa[i].label);
 
-        if (aa[i] == av.quality || aa[i] == av.conservation
-                || aa[i] == av.consensus || aa[i].autoCalculated)
+        if (aa[i] == av.getAlignmentQualityAnnot() || aa[i] == av.getAlignmentConservationAnnotation()
+                || aa[i] == av.getAlignmentConsensusAnnotation() || aa[i].autoCalculated)
         {
           // new way of indicating autocalculated annotation -
           an.setAutoCalculated(aa[i].autoCalculated);
@@ -874,6 +873,12 @@ public class Jalview2XML
         {
           an.setScore(aa[i].getScore());
         }
+
+        if (aa[i].getCalcId()!=null)
+        {
+          an.setCalcId(aa[i].getCalcId());
+        }
+
         AnnotationElement ae;
         if (aa[i].annotations != null)
         {
@@ -927,13 +932,11 @@ public class Jalview2XML
     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();
+        groups[++i] = new 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());
@@ -1204,7 +1207,7 @@ public class Jalview2XML
 
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       if (av.getColumnSelection() == null
               || av.getColumnSelection().getHiddenColumns() == null)
@@ -1267,7 +1270,7 @@ public class Jalview2XML
   /**
    * Construct a unique ID for jvobj using either existing bindings or if none
    * exist, the result of the hashcode call for the object.
-   * 
+   *
    * @param jvobj
    *          jalview data object
    * @return unique ID for referring to jvobj
@@ -1298,7 +1301,7 @@ public class Jalview2XML
 
   /**
    * return local jalview object mapped to ID, if it exists
-   * 
+   *
    * @param idcode
    *          (may be null)
    * @return null or object bound to idcode
@@ -1534,7 +1537,7 @@ public class Jalview2XML
 
   /**
    * Load a jalview project archive from a jar file
-   * 
+   *
    * @param file
    *          - HTTP URL or filename
    */
@@ -1578,6 +1581,7 @@ public class Jalview2XML
     return new jarInputStreamProvider()
     {
 
+      @Override
       public JarInputStream getJarInputStream() throws IOException
       {
         if (_url != null)
@@ -1590,6 +1594,7 @@ public class Jalview2XML
         }
       }
 
+      @Override
       public String getFilename()
       {
         return file;
@@ -1602,7 +1607,7 @@ public class Jalview2XML
    * initialise uniqueSetSuffix, seqRefIds, viewportsAdded and frefedSequence
    * themselves. Any null fields will be initialised with default values,
    * non-null fields are left alone.
-   * 
+   *
    * @param jprovider
    * @return
    */
@@ -1754,6 +1759,7 @@ public class Jalview2XML
       {
         javax.swing.SwingUtilities.invokeLater(new Runnable()
         {
+          @Override
           public void run()
           {
             JOptionPane.showInternalMessageDialog(Desktop.desktop,
@@ -1778,7 +1784,7 @@ public class Jalview2XML
    * 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;
 
   String loadPDBFile(jarInputStreamProvider jprovider, String pdbId)
   {
@@ -1822,9 +1828,9 @@ public class Jalview2XML
         }
         ;
         out.close();
-
-        alreadyLoadedPDB.put(pdbId, outFile.getAbsolutePath());
-        return outFile.getAbsolutePath();
+        String t=outFile.getAbsolutePath();
+        alreadyLoadedPDB.put(pdbId, t);
+        return t;
       }
       else
       {
@@ -1859,7 +1865,7 @@ public class Jalview2XML
 
   /**
    * Load alignment frame from jalview XML DOM object
-   * 
+   *
    * @param object
    *          DOM
    * @param file
@@ -1897,7 +1903,7 @@ public class Jalview2XML
 
       if (seqRefIds.get(seqId) != null)
       {
-        tmpseqs.add((jalview.datamodel.Sequence) seqRefIds.get(seqId));
+        tmpseqs.add(seqRefIds.get(seqId));
         multipleView = true;
       }
       else
@@ -1920,7 +1926,7 @@ public class Jalview2XML
           hiddenSeqs = new Vector();
         }
 
-        hiddenSeqs.addElement((jalview.datamodel.Sequence) seqRefIds
+        hiddenSeqs.addElement(seqRefIds
                 .get(seqId));
       }
 
@@ -2263,6 +2269,12 @@ public class Jalview2XML
         {
           jaa.graphHeight = an[i].getGraphHeight();
         }
+        if (an[i].hasBelowAlignment())
+        {
+          jaa.belowAlignment=an[i].isBelowAlignment();
+        }
+        jaa.setCalcId(an[i].getCalcId());
+
         if (jaa.autoCalculated)
         {
           autoAlan.add(new JvAnnotRow(i, jaa));
@@ -2603,7 +2615,7 @@ public class Jalview2XML
               // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
               // seqs_file 2}, boolean[] {
               // linkAlignPanel,superposeWithAlignpanel}} from hash
-              Object[] jmoldat = (Object[]) jmolViewIds.get(sviewid);
+              Object[] jmoldat = jmolViewIds.get(sviewid);
               ((boolean[]) jmoldat[3])[0] |= ids[p].getStructureState(s)
                       .hasAlignwithAlignPanel() ? ids[p].getStructureState(
                       s).getAlignwithAlignPanel() : false;
@@ -2626,12 +2638,13 @@ public class Jalview2XML
               }
               if (ids[p].getFile() != null)
               {
+                File mapkey=new File(ids[p].getFile());
                 Object[] seqstrmaps = (Object[]) ((Hashtable) jmoldat[2])
-                        .get(ids[p].getFile());
+                        .get(mapkey);
                 if (seqstrmaps == null)
                 {
                   ((Hashtable) jmoldat[2]).put(
-                          new File(ids[p].getFile()).toString(),
+                          mapkey,
                           seqstrmaps = new Object[]
                           { pdbFile, ids[p].getId(), new Vector(),
                               new Vector() });
@@ -2664,7 +2677,7 @@ public class Jalview2XML
           Object[] svattrib = entry.getValue();
           int[] geom = (int[]) svattrib[0];
           String state = (String) svattrib[1];
-          Hashtable<String, Object[]> oldFiles = (Hashtable<String, Object[]>) svattrib[2];
+          Hashtable<File, Object[]> oldFiles = (Hashtable<File, 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
@@ -2728,6 +2741,8 @@ public class Jalview2XML
               {
                 newFileLoc = new StringBuffer();
               }
+              do {
+                // look for next filename in load statement
               newFileLoc.append(state.substring(cp,
                       ncp = (state.indexOf("\"", ncp + 1) + 1)));
               String oldfilenam = state.substring(ncp,
@@ -2735,16 +2750,16 @@ public class Jalview2XML
               // 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]));
+              Object[] filedat = oldFiles.get(new File(oldfilenam));
+              newFileLoc.append(Platform.escapeString((String) filedat[0]));
               pdbfilenames.addElement((String) filedat[0]);
               pdbids.addElement((String) filedat[1]);
-              seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
+              seqmaps.addElement(((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.
+              } while ((ncp=state.indexOf("/*file*/",cp))>-1);
             }
             if (cp > 0)
             {
@@ -2757,7 +2772,7 @@ public class Jalview2XML
                       .print("Ignoring incomplete Jmol state for PDB ids: ");
               newFileLoc = new StringBuffer(state);
               newFileLoc.append("; load append ");
-              for (String id : oldFiles.keySet())
+              for (File id : oldFiles.keySet())
               {
                 // add this and any other pdb files that should be present in
                 // the viewer
@@ -2766,7 +2781,7 @@ public class Jalview2XML
                 newFileLoc.append(((String) filedat[0]));
                 pdbfilenames.addElement((String) filedat[0]);
                 pdbids.addElement((String) filedat[1]);
-                seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
+                seqmaps.addElement(((Vector<SequenceI>) filedat[2])
                         .toArray(new SequenceI[0]));
                 newFileLoc.append(" \"");
                 newFileLoc.append((String) filedat[0]);
@@ -2802,10 +2817,10 @@ public class Jalview2XML
               // 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
+              final String[] pdbf = pdbfilenames
+                      .toArray(new String[pdbfilenames.size()]), id = pdbids
                       .toArray(new String[pdbids.size()]);
-              final SequenceI[][] sq = (SequenceI[][]) seqmaps
+              final SequenceI[][] sq = seqmaps
                       .toArray(new SequenceI[seqmaps.size()][]);
               final String fileloc = newFileLoc.toString(), vid = sviewid;
               final AlignFrame alf = af;
@@ -2815,6 +2830,7 @@ public class Jalview2XML
               {
                 javax.swing.SwingUtilities.invokeAndWait(new Runnable()
                 {
+                  @Override
                   public void run()
                   {
                     AppJmol sview = null;
@@ -2855,36 +2871,36 @@ public class Jalview2XML
 
             // add mapping for sequences in this view to an already open Jmol
             // instance
-            for (String id : oldFiles.keySet())
+            for (File 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])
+              SequenceI[] seq = ((Vector<SequenceI>) filedat[2])
                       .toArray(new SequenceI[0]);
-              ((AppJmol) comp).jmb.ssm.setMapping(seq, null, pdbFile,
+              comp.jmb.ssm.setMapping(seq, null, pdbFile,
                       jalview.io.AppletFormatAdapter.FILE);
-              ((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq);
+              comp.jmb.addSequenceForStructFile(pdbFile, seq);
             }
             // and add the AlignmentPanel's reference to the Jmol view
-            ((AppJmol) comp).addAlignmentPanel(ap);
+            comp.addAlignmentPanel(ap);
             if (useinJmolsuperpos)
             {
-              ((AppJmol) comp).useAlignmentPanelForSuperposition(ap);
+              comp.useAlignmentPanelForSuperposition(ap);
             }
             else
             {
-              ((AppJmol) comp).excludeAlignmentPanelForSuperposition(ap);
+              comp.excludeAlignmentPanelForSuperposition(ap);
             }
             if (usetoColourbyseq)
             {
-              ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap,
+              comp.useAlignmentPanelForColourbyseq(ap,
                       !jmolColouring);
             }
             else
             {
-              ((AppJmol) comp).excludeAlignmentPanelForColourbyseq(ap);
+              comp.excludeAlignmentPanelForColourbyseq(ap);
             }
           }
         }
@@ -2907,7 +2923,7 @@ public class Jalview2XML
 
     for (int i = 0; i < JSEQ.length; i++)
     {
-      af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),
+      af.viewport.setSequenceColour(af.viewport.getAlignment().getSequenceAt(i),
               new java.awt.Color(JSEQ[i].getColour()));
     }
 
@@ -2918,7 +2934,7 @@ public class Jalview2XML
       jalview.gui.AlignViewport av = (jalview.gui.AlignViewport) viewportsAdded
               .get(uniqueSeqSetId);
 
-      af.viewport.sequenceSetID = uniqueSeqSetId;
+      af.viewport.setSequenceSetId(uniqueSeqSetId);
       if (av != null)
       {
         // propagate shared settings to this new view
@@ -3008,18 +3024,18 @@ public class Jalview2XML
       else if (view.getBgColour().startsWith("Annotation"))
       {
         // int find annotation
-        if (af.viewport.alignment.getAlignmentAnnotation() != null)
+        if (af.viewport.getAlignment().getAlignmentAnnotation() != null)
         {
-          for (int i = 0; i < af.viewport.alignment
+          for (int i = 0; i < af.viewport.getAlignment()
                   .getAlignmentAnnotation().length; i++)
           {
-            if (af.viewport.alignment.getAlignmentAnnotation()[i].label
+            if (af.viewport.getAlignment().getAlignmentAnnotation()[i].label
                     .equals(view.getAnnotationColours().getAnnotation()))
             {
-              if (af.viewport.alignment.getAlignmentAnnotation()[i]
+              if (af.viewport.getAlignment().getAlignmentAnnotation()[i]
                       .getThreshold() == null)
               {
-                af.viewport.alignment.getAlignmentAnnotation()[i]
+                af.viewport.getAlignment().getAlignmentAnnotation()[i]
                         .setThreshold(new jalview.datamodel.GraphLine(view
                                 .getAnnotationColours().getThreshold(),
                                 "Threshold", java.awt.Color.black)
@@ -3031,7 +3047,7 @@ public class Jalview2XML
                       .equals("None"))
               {
                 cs = new AnnotationColourGradient(
-                        af.viewport.alignment.getAlignmentAnnotation()[i],
+                        af.viewport.getAlignment().getAlignmentAnnotation()[i],
                         new java.awt.Color(view.getAnnotationColours()
                                 .getMinColour()), new java.awt.Color(view
                                 .getAnnotationColours().getMaxColour()),
@@ -3041,7 +3057,7 @@ public class Jalview2XML
                       .startsWith("ucs"))
               {
                 cs = new AnnotationColourGradient(
-                        af.viewport.alignment.getAlignmentAnnotation()[i],
+                        af.viewport.getAlignment().getAlignmentAnnotation()[i],
                         GetUserColourScheme(jms, view
                                 .getAnnotationColours().getColourScheme()),
                         view.getAnnotationColours().getAboveThreshold());
@@ -3049,7 +3065,7 @@ public class Jalview2XML
               else
               {
                 cs = new AnnotationColourGradient(
-                        af.viewport.alignment.getAlignmentAnnotation()[i],
+                        af.viewport.getAlignment().getAlignmentAnnotation()[i],
                         ColourSchemeProperty.getColour(al, view
                                 .getAnnotationColours().getColourScheme()),
                         view.getAnnotationColours().getAboveThreshold());
@@ -3060,8 +3076,8 @@ public class Jalview2XML
               {
                 for (int g = 0; g < al.getGroups().size(); g++)
                 {
-                  jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) al
-                          .getGroups().elementAt(g);
+                  jalview.datamodel.SequenceGroup sg = al
+                          .getGroups().get(g);
 
                   if (sg.cs == null)
                   {
@@ -3072,7 +3088,7 @@ public class Jalview2XML
                    * if
                    * (view.getAnnotationColours().getColourScheme().equals("None"
                    * )) { sg.cs = new AnnotationColourGradient(
-                   * af.viewport.alignment.getAlignmentAnnotation()[i], new
+                   * af.viewport.getAlignment().getAlignmentAnnotation()[i], new
                    * java.awt.Color(view.getAnnotationColours().
                    * getMinColour()), new
                    * java.awt.Color(view.getAnnotationColours().
@@ -3081,7 +3097,7 @@ public class Jalview2XML
                    */
                   {
                     sg.cs = new AnnotationColourGradient(
-                            af.viewport.alignment.getAlignmentAnnotation()[i],
+                            af.viewport.getAlignment().getAlignmentAnnotation()[i],
                             sg.cs, view.getAnnotationColours()
                                     .getAboveThreshold());
                   }
@@ -3103,7 +3119,7 @@ public class Jalview2XML
       if (cs != null)
       {
         cs.setThreshold(view.getPidThreshold(), true);
-        cs.setConsensus(af.viewport.hconsensus);
+        cs.setConsensus(af.viewport.getSequenceConsensusHash());
       }
     }
 
@@ -3129,8 +3145,8 @@ public class Jalview2XML
     }
     if (view.hasIgnoreGapsinConsensus())
     {
-      af.viewport.ignoreGapsInConsensusCalculation = view
-              .getIgnoreGapsinConsensus();
+      af.viewport.setIgnoreGapsConsensus(view
+              .getIgnoreGapsinConsensus(), null);
     }
     if (view.hasFollowHighlight())
     {
@@ -3151,11 +3167,11 @@ 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.hasShowDbRefTooltip())
     {
@@ -3344,7 +3360,7 @@ public class Jalview2XML
 
   /**
    * TODO remove this method
-   * 
+   *
    * @param view
    * @return AlignFrame bound to sequenceSetId from view, if one exists. private
    *         AlignFrame getSkippedFrame(Viewport view) { if (skipList==null) {
@@ -3355,7 +3371,7 @@ public class Jalview2XML
 
   /**
    * Check if the Jalview view contained in object should be skipped or not.
-   * 
+   *
    * @param object
    * @return true if view's sequenceSetId is a key in skipList
    */
@@ -3428,7 +3444,7 @@ public class Jalview2XML
   }
 
   /**
-   * 
+   *
    * @param vamsasSeq
    *          sequence definition to create/merge dataset sequence for
    * @param ds
@@ -3446,7 +3462,7 @@ public class Jalview2XML
     jalview.datamodel.SequenceI dsq = null;
     if (sq != null && sq.getDatasetSequence() != null)
     {
-      dsq = (jalview.datamodel.SequenceI) sq.getDatasetSequence();
+      dsq = sq.getDatasetSequence();
     }
 
     String sqid = vamsasSeq.getDsseqid();
@@ -3552,7 +3568,7 @@ public class Jalview2XML
 
   /**
    * make a new dataset ID for this jalview dataset alignment
-   * 
+   *
    * @param dataset
    * @return
    */
@@ -3719,11 +3735,11 @@ public class Jalview2XML
     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,15 +3749,16 @@ 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;
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see java.lang.Object#finalize()
    */
+  @Override
   protected void finalize() throws Throwable
   {
     // really make sure we have no buried refs left.
@@ -3816,13 +3833,13 @@ public class Jalview2XML
    * finalize and clearSeqRefs will not clear the tables when the Jalview2XML
    * object goes out of scope. - also populates the datasetIds hashtable with
    * alignment objects containing dataset sequences
-   * 
+   *
    * @param vobj2jv
    *          Map from ID strings to jalview datamodel
    * @param jv2vobj
    *          Map from jalview datamodel to ID strings
-   * 
-   * 
+   *
+   *
    */
   public void setObjectMappingTables(Hashtable vobj2jv,
           IdentityHashMap jv2vobj)
@@ -3894,7 +3911,7 @@ public class Jalview2XML
    * set the uniqueSetSuffix used to prefix/suffix object IDs for jalview
    * objects created from the project archive. If string is null (default for
    * construction) then suffix will be set automatically.
-   * 
+   *
    * @param string
    */
   public void setUniqueSetSuffix(String string)
@@ -3906,7 +3923,7 @@ public class Jalview2XML
   /**
    * uses skipList2 as the skipList for skipping views on sequence sets
    * associated with keys in the skipList
-   * 
+   *
    * @param skipList2
    */
   public void setSkipList(Hashtable skipList2)
index c8ac01c..e264b68 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -271,7 +271,7 @@ public class Jalview2XML_V1
 \r
     for (int i = 0; i < JSEQ.length; i++)\r
     {\r
-      af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),\r
+      af.viewport.setSequenceColour(af.viewport.getAlignment().getSequenceAt(i),\r
               new java.awt.Color(JSEQ[i].getColour()));\r
     }\r
 \r
@@ -371,7 +371,7 @@ public class Jalview2XML_V1
       if (cs != null)\r
       {\r
         cs.setThreshold(view.getPidThreshold(), true);\r
-        cs.setConsensus(af.viewport.hconsensus);\r
+        cs.setConsensus(af.viewport.getSequenceConsensusHash());\r
       }\r
     }\r
 \r
index 6842fa3..8077e07 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 97e3315..64ecaf3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index eee5ffe..833af15 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9573e1f..5d7cdd6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b14ac14..2195fb2 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 106c3b7..cca9cee 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 64e3d29..6d653b3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f8299bf..475f0c7 100755 (executable)
@@ -1,22 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.renderer.AnnotationRenderer;
+
 import java.awt.*;
 import java.awt.event.*;
 import java.awt.image.*;
@@ -24,7 +26,7 @@ import javax.swing.*;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -36,6 +38,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
   AlignmentPanel ap;
 
+  final AnnotationRenderer renderer = new AnnotationRenderer();
   float scalew = 1f;
 
   float scaleh = 1f;
@@ -64,7 +67,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
   /**
    * Creates a new OverviewPanel object.
-   * 
+   *
    * @param ap
    *          DOCUMENT ME!
    */
@@ -80,15 +83,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 +115,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
     addComponentListener(new ComponentAdapter()
     {
+      @Override
       public void componentResized(ComponentEvent evt)
       {
         if ((getWidth() != width)
@@ -124,6 +128,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
     addMouseMotionListener(new MouseMotionAdapter()
     {
+      @Override
       public void mouseDragged(MouseEvent evt)
       {
         if (!av.wrapAlignment)
@@ -139,6 +144,7 @@ public class OverviewPanel extends JPanel implements Runnable
 
     addMouseListener(new MouseAdapter()
     {
+      @Override
       public void mousePressed(MouseEvent evt)
       {
         if (!av.wrapAlignment)
@@ -175,7 +181,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 +192,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,9 +202,9 @@ public class OverviewPanel extends JPanel implements Runnable
       col = av.getColumnSelection().findColumnPosition(col);
     }
 
-    if (av.hasHiddenRows)
+    if (av.hasHiddenRows())
     {
-      row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+      row = av.getAlignment().getHiddenSequences().findIndexWithoutHiddenSeqs(
               row);
     }
 
@@ -239,6 +245,7 @@ public class OverviewPanel extends JPanel implements Runnable
   /**
    * DOCUMENT ME!
    */
+  @Override
   public void run()
   {
     miniMe = null;
@@ -248,9 +255,9 @@ public class OverviewPanel extends JPanel implements Runnable
       fr.transferSettings(ap.seqPanel.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));
 
@@ -291,15 +298,15 @@ public class OverviewPanel extends JPanel implements Runnable
       lastrow = (int) (row * sampleRow);
 
       hiddenRow = false;
-      if (av.hasHiddenRows)
+      if (av.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 +315,7 @@ public class OverviewPanel extends JPanel implements Runnable
       }
       else
       {
-        seq = av.alignment.getSequenceAt(lastrow);
+        seq = av.getAlignment().getSequenceAt(lastrow);
       }
 
       if (seq == null)
@@ -343,7 +350,7 @@ public class OverviewPanel extends JPanel implements Runnable
         }
 
         if (hiddenRow
-                || (av.hasHiddenColumns && !av.getColumnSelection()
+                || (av.hasHiddenColumns() && !av.getColumnSelection()
                         .isVisible(lastcol)))
         {
           color = new Color(color).darker().darker().getRGB();
@@ -354,14 +361,15 @@ 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 +394,14 @@ public class OverviewPanel extends JPanel implements Runnable
    */
   public void setBoxPosition()
   {
-    int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
-    int fullsizeHeight = (av.alignment.getHeight() + av.alignment
+    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 +410,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 = av.getAlignment().getHiddenSequences().adjustForHiddenSeqs(
               startSeq);
 
-      endSeq = av.alignment.getHiddenSequences()
+      endSeq = av.getAlignment().getHiddenSequences()
               .adjustForHiddenSeqs(endSeq);
 
     }
@@ -418,7 +426,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);
     }
@@ -434,10 +442,11 @@ public class OverviewPanel extends JPanel implements Runnable
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param g
    *          DOCUMENT ME!
    */
+  @Override
   public void paintComponent(Graphics g)
   {
     if (resizing)
index 0941c7d..9dc73b7 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -75,11 +75,11 @@ public class PCAPanel extends GPCAPanel implements Runnable
     nucleotide=av.getAlignment().isNucleotide();
     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());
     }
     SeqCigar sq[] = seqstrings.getSequences();
     int length = sq[0].getWidth();
index 41a0da9..91a0978 100755 (executable)
@@ -1,23 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.util.List;
 
 import java.awt.*;
 
@@ -25,7 +26,7 @@ import jalview.datamodel.*;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -35,7 +36,7 @@ public class PaintRefresher
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param comp
    *          DOCUMENT ME!
    * @param al
@@ -118,8 +119,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 +180,16 @@ 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
         {
@@ -233,7 +243,7 @@ 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()];
index 5ca572c..fedd8d2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -56,14 +56,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];
index 1cc4cd7..c1bbc8d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -70,6 +70,11 @@ public class PopupMenu extends JPopupMenu
 
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
 
+  protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+  // protected JRadioButtonMenuItem covariationColour = new
+  // JRadioButtonMenuItem();
+
   JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
 
   protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();
@@ -80,7 +85,7 @@ public class PopupMenu extends JPopupMenu
 
   JMenuItem sequenceName = new JMenuItem();
 
-  Sequence sequence;
+  SequenceI sequence;
 
   JMenuItem unGroupMenuItem = new JMenuItem();
 
@@ -157,7 +162,7 @@ public class PopupMenu extends JPopupMenu
    * @param links
    * @param groupLinks
    */
-  public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links,
+  public PopupMenu(final AlignmentPanel ap, final SequenceI seq, Vector links,
           Vector groupLinks)
   {
     // /////////////////////////////////////////////////////////
@@ -183,6 +188,8 @@ public class PopupMenu extends JPopupMenu
     colours.add(userDefinedColour);
     colours.add(PIDColour);
     colours.add(BLOSUM62Colour);
+    colours.add(purinePyrimidineColour);
+    // colours.add(covariationColour);
 
     for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
     {
@@ -248,10 +255,67 @@ public class PopupMenu extends JPopupMenu
       }
       else
       {
+        if (ap.av.getAlignment().isNucleotide() == false)
+        {
         structureMenu.remove(viewStructureMenu);
+        }
         // structureMenu.remove(colStructureMenu);
       }
 
+      if (ap.av.getAlignment().isNucleotide() == true)
+      {
+        AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
+        for (int i = 0; i < aa.length; i++)
+        {
+          if (aa[i].getRNAStruc() != null)
+          {
+            final String rnastruc = aa[i].getRNAStruc();
+            final String structureLine=aa[i].label;
+            menuItem = new JMenuItem();
+            menuItem.setText("2D RNA "+structureLine);
+            menuItem.addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
+                        .getName(), ap);
+              }
+            });
+            viewStructureMenu.add(menuItem);
+          }
+        }
+
+        // SequenceFeatures[] test = seq.getSequenceFeatures();
+
+        if (seq.getAnnotation() != null)
+        {
+          AlignmentAnnotation seqAnno[] = seq.getAnnotation();
+          for (int i = 0; i < seqAnno.length; i++)
+          {
+            if (seqAnno[i].getRNAStruc() != null)
+            {
+              final String rnastruc = seqAnno[i].getRNAStruc();
+              
+           // TODO: make rnastrucF a bit more nice
+              menuItem = new JMenuItem();
+              menuItem.setText("2D RNA - "+seq.getName());
+              menuItem.addActionListener(new java.awt.event.ActionListener()
+              {
+                public void actionPerformed(ActionEvent e)
+                {
+                  // TODO: VARNA does'nt print gaps in the sequence
+                  new AppVarna(seq.getName()+" structure",seq,seq.getSequenceAsString(), rnastruc, seq
+                          .getName(), ap);
+                }
+              });
+              viewStructureMenu.add(menuItem);
+            }
+          }
+        }
+
+        
+      }
+
       menuItem = new JMenuItem("Hide Sequences");
       menuItem.addActionListener(new java.awt.event.ActionListener()
       {
@@ -276,9 +340,9 @@ 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)
@@ -300,7 +364,7 @@ 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.addActionListener(new ActionListener()
@@ -371,6 +435,14 @@ 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);
@@ -434,7 +506,7 @@ public class PopupMenu extends JPopupMenu
       editMenu.setVisible(false);
     }
 
-    if (!ap.av.alignment.getGroups().contains(sg))
+    if (!ap.av.getAlignment().getGroups().contains(sg))
     {
       unGroupMenuItem.setVisible(false);
     }
@@ -1009,6 +1081,10 @@ public class PopupMenu extends JPopupMenu
     colourMenu.add(turnColour);
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideMenuItem);
+    if (ap.getAlignment().isNucleotide()) {
+       colourMenu.add(purinePyrimidineColour);
+    }
+    // colourMenu.add(covariationColour);
     colourMenu.add(userDefinedColour);
 
     if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
@@ -1160,6 +1236,21 @@ public class PopupMenu extends JPopupMenu
         BLOSUM62Colour_actionPerformed();
       }
     });
+    purinePyrimidineColour.setText("Purine/Pyrimidine");
+    purinePyrimidineColour
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                purinePyrimidineColour_actionPerformed();
+              }
+            });
+    /*
+     * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+     * public void actionPerformed(ActionEvent e) {
+     * covariationColour_actionPerformed(); } });
+     */
+
     conservationMenuItem.setText("Conservation");
     conservationMenuItem
             .addActionListener(new java.awt.event.ActionListener()
@@ -1198,8 +1289,7 @@ public class PopupMenu extends JPopupMenu
   {
     SequenceGroup sg = getGroup();
     sg.cs = new ClustalxColourScheme(
-            sg.getSequences(ap.av.hiddenRepSequences),
-            ap.av.alignment.getWidth());
+            sg,ap.av.getHiddenRepSequences());
     refresh();
   }
 
@@ -1299,6 +1389,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,7 +1416,7 @@ public class PopupMenu extends JPopupMenu
     if (abovePIDColour.isSelected())
     {
       sg.cs.setConsensus(AAFrequency.calculate(
-              sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+              sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
               sg.getEndRes() + 1));
 
       int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
@@ -1370,7 +1470,7 @@ 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.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
             sg.getEndRes() + 1));
     refresh();
   }
@@ -1388,7 +1488,7 @@ public class PopupMenu extends JPopupMenu
     sg.cs = new Blosum62ColourScheme();
 
     sg.cs.setConsensus(AAFrequency.calculate(
-            sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+            sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
             sg.getEndRes() + 1));
 
     refresh();
@@ -1424,11 +1524,11 @@ public class PopupMenu extends JPopupMenu
     {
       Conservation c = new Conservation("Group",
               ResidueProperties.propHash, 3,
-              sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+              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);
 
@@ -1498,7 +1598,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;
@@ -1552,7 +1652,7 @@ 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();
   }
@@ -1706,7 +1806,7 @@ public class PopupMenu extends JPopupMenu
       }
 
       ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
-              sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
+              sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), startEnd,
               caseChange);
 
       ap.alignFrame.addHistoryItem(caseCommand);
@@ -1733,7 +1833,7 @@ public class PopupMenu extends JPopupMenu
     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();
+    AlignmentAnnotation[] nala = ap.av.getAlignment().getAlignmentAnnotation();
     if (nala != null)
     {
       for (int i = 0; i < nala.length; i++)
@@ -1782,9 +1882,9 @@ 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()
     {
       public void run()
@@ -1853,10 +1953,10 @@ public class PopupMenu extends JPopupMenu
     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();
 
@@ -1883,8 +1983,8 @@ public class PopupMenu extends JPopupMenu
         EditCommand editCommand = new EditCommand("Edit Sequences",
                 EditCommand.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);
 
index 789799e..acb9654 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fae7783..95d9c69 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 16db1fa..9f117b6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -131,15 +131,15 @@ 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;
@@ -150,7 +150,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
       redundancy[i] = 0f;
     }
 
-    if (ap.av.hasHiddenColumns)
+    if (ap.av.hasHiddenColumns())
     {
       omitHidden = ap.av.getViewAsString(sg != null);
     }
@@ -273,11 +273,11 @@ public class RedundancyPanel extends GSliderPanel implements Runnable
       }
 
       EditCommand cut = new EditCommand("Remove Redundancy",
-              EditCommand.CUT, deleted, 0, width, ap.av.alignment);
+              EditCommand.CUT, deleted, 0, width, ap.av.getAlignment());
 
       for (int i = 0; i < del.size(); i++)
       {
-        ap.av.alignment.deleteSequence(deleted[i]);
+        ap.av.getAlignment().deleteSequence(deleted[i]);
         PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
         if (sg != null)
         {
index fcff86d..9cf73f4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
@@ -26,8 +26,6 @@ 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;
index dee5d7e..3863f40 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e40852a..458a29d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -648,7 +648,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());
index a4f6546..c70f3c1 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -70,14 +70,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
     {
@@ -137,7 +137,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
           {
             av.hideColumns(res, res);
             if (av.getSelectionGroup() != null
-                    && av.getSelectionGroup().getSize() == av.alignment
+                    && av.getSelectionGroup().getSize() == av.getAlignment()
                             .getHeight())
             {
               av.setSelectionGroup(null);
@@ -165,7 +165,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 +205,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 +256,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)
@@ -337,7 +337,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
 
   public void mouseMoved(MouseEvent evt)
   {
-    if (!av.hasHiddenColumns)
+    if (!av.hasHiddenColumns())
     {
       return;
     }
@@ -409,7 +409,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))
           {
@@ -473,7 +473,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener,
       }
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       gg.setColor(Color.blue);
       int res;
index 9211d0f..adebec8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b55e32b..57aeebe 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -105,7 +105,7 @@ public class SeqCanvas extends JComponent
     for (int i = scalestartx; i < endx; i += 10)
     {
       int value = i;
-      if (av.hasHiddenColumns)
+      if (av.hasHiddenColumns())
       {
         value = av.getColumnSelection().adjustForHiddenColumns(value);
       }
@@ -137,22 +137,22 @@ public class SeqCanvas extends JComponent
     FontMetrics fm = getFontMetrics(av.getFont());
     ypos += av.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 +165,7 @@ public class SeqCanvas extends JComponent
           continue;
         }
 
-        value = av.alignment.getSequenceAt(i).findPosition(index);
+        value = av.getAlignment().getSequenceAt(i).findPosition(index);
 
         break;
       }
@@ -196,16 +196,16 @@ public class SeqCanvas extends JComponent
   {
     ypos += av.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;
 
@@ -425,9 +425,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;
@@ -485,9 +485,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;
     }
@@ -523,7 +523,7 @@ public class SeqCanvas extends JComponent
         drawNorthScale(g, startRes, endx, ypos);
       }
 
-      if (av.hasHiddenColumns && av.showHiddenMarkers)
+      if (av.hasHiddenColumns() && av.showHiddenMarkers)
       {
         g.setColor(Color.blue);
         int res;
@@ -572,7 +572,7 @@ public class SeqCanvas extends JComponent
           annotations = new AnnotationPanel(av);
         }
 
-        annotations.drawComponent((Graphics2D) g, startRes, endx + 1);
+        annotations.renderer.drawComponent(annotations, av, (Graphics2D) g, -1, startRes, endx + 1);
         g.translate(0, -cHeight - ypos - 3);
       }
       g.setClip(clip);
@@ -620,7 +620,7 @@ public class SeqCanvas extends JComponent
   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);
     }
@@ -690,14 +690,14 @@ 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),
+      sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
               startRes, endRes, offset + ((i - startSeq) * av.charHeight));
 
       if (av.showSequenceFeatures)
@@ -734,7 +734,7 @@ public class SeqCanvas extends JComponent
     }
 
     if (av.getSelectionGroup() != null
-            || av.alignment.getGroups().size() > 0)
+            || av.getAlignment().getGroups().size() > 0)
     {
       drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
     }
@@ -757,9 +757,9 @@ public class SeqCanvas extends JComponent
     int groupIndex = -1;
     int visWidth = (endRes - startRes + 1) * av.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 = (SequenceGroup) av.getAlignment().getGroups().get(0);
       groupIndex = 0;
     }
 
@@ -786,11 +786,11 @@ public class SeqCanvas extends JComponent
 
           if ((sx <= (endRes - startRes) * av.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;
             }
@@ -799,7 +799,7 @@ public class SeqCanvas extends JComponent
             {
               if (((top == -1) && (i == 0))
                       || !group.getSequences(null).contains(
-                              av.alignment.getSequenceAt(i - 1)))
+                              av.getAlignment().getSequenceAt(i - 1)))
               {
                 top = sy;
               }
@@ -915,15 +915,15 @@ 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(
+        group = (SequenceGroup) av.getAlignment().getGroups().get(
                 groupIndex);
 
-      } while (groupIndex < av.alignment.getGroups().size());
+      } while (groupIndex < av.getAlignment().getGroups().size());
 
     }
 
index ca5d7f7..cdaa5b9 100644 (file)
@@ -1,23 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.util.List;
 
 import java.awt.*;
 import java.awt.event.*;
@@ -31,7 +32,7 @@ import jalview.structure.*;
 
 /**
  * DOCUMENT ME!
- * 
+ *
  * @author $author$
  * @version $Revision: 1.130 $
  */
@@ -97,7 +98,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * Creates a new SeqPanel object.
-   * 
+   *
    * @param avp
    *          DOCUMENT ME!
    * @param p
@@ -176,7 +177,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       res = (x / av.getCharWidth()) + av.getStartRes();
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       res = av.getColumnSelection().adjustForHiddenColumns(res);
     }
@@ -204,12 +205,12 @@ public class SeqPanel extends JPanel implements MouseListener,
       y -= hgap;
 
       seq = Math.min((y % cHeight) / av.getCharHeight(),
-              av.alignment.getHeight() - 1);
+              av.getAlignment().getHeight() - 1);
     }
     else
     {
       seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
-              av.alignment.getHeight() - 1);
+              av.getAlignment().getHeight() - 1);
     }
 
     return seq;
@@ -297,7 +298,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   void setCursorPosition()
   {
-    SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+    SequenceI sequence = av.getAlignment().getSequenceAt(
             seqCanvas.cursorY);
 
     seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1() - 1);
@@ -308,19 +309,19 @@ 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,18 +336,18 @@ 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();
@@ -366,7 +367,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       }
       if (!av.wrapAlignment)
       {
-        while (seqCanvas.cursorX < av.colSel
+        while (seqCanvas.cursorX < av.getColumnSelection()
                 .adjustForHiddenColumns(av.startRes))
         {
           if (!ap.scrollRight(false))
@@ -374,7 +375,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 +385,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 +393,17 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   void setSelectionAreaAtCursor(boolean topLeft)
   {
-    SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+    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 +448,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 +471,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,10 +480,18 @@ 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();
+  }
+
   void numberPressed(char value)
   {
     if (keyboardNo1 == null)
@@ -526,10 +535,11 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseReleased(MouseEvent evt)
   {
     mouseDragging = false;
@@ -546,10 +556,11 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mousePressed(MouseEvent evt)
   {
     lastMousePress = evt.getPoint();
@@ -599,6 +610,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,6 +623,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     lastMessage = tmp;
   }
 
+  @Override
   public void highlightSequence(SearchResults results)
   {
     if (av.followHighlight)
@@ -623,6 +636,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     seqCanvas.highlightSearchResults(results);
   }
 
+  @Override
   public void updateColours(SequenceI seq, int index)
   {
     System.out.println("update the seqPanel colours");
@@ -631,10 +645,11 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseMoved(MouseEvent evt)
   {
     if (editingSeqs)
@@ -665,7 +680,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
     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++)
@@ -747,7 +762,7 @@ public class SeqPanel extends JPanel implements MouseListener,
   /**
    * appends the features at rpos to the given stringbuffer ready for display in
    * a tooltip
-   * 
+   *
    * @param tooltipText2
    * @param linkImageURL
    * @param rpos
@@ -888,7 +903,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * Set status message in alignment panel
-   * 
+   *
    * @param sequence
    *          aligned sequence object
    * @param res
@@ -904,7 +919,7 @@ public class SeqPanel extends JPanel implements MouseListener,
             + sequence.getName());
 
     Object obj = null;
-    if (av.alignment.isNucleotide())
+    if (av.getAlignment().isNucleotide())
     {
       obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
               + "");
@@ -936,10 +951,11 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseDragged(MouseEvent evt)
   {
     if (mouseWheelPressed)
@@ -1013,11 +1029,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,22 +1043,22 @@ 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;
       }
     }
@@ -1084,7 +1100,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 +1109,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 +1141,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       }
     }
 
-    if (av.hasHiddenColumns)
+    if (av.hasHiddenColumns())
     {
       fixedColumns = true;
       int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
@@ -1156,12 +1171,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 +1185,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 +1219,19 @@ 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()
+            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;
@@ -1273,7 +1288,7 @@ public class SeqPanel extends JPanel implements MouseListener,
         else
         {
           editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
-                  startres, startres - lastres, av.alignment, true);
+                  startres, startres - lastres, av.getAlignment(), true);
         }
       }
       else
@@ -1289,7 +1304,7 @@ public class SeqPanel extends JPanel implements MouseListener,
         else
         {
           editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
-                  startres, lastres - startres, av.alignment, true);
+                  startres, lastres - startres, av.getAlignment(), true);
         }
 
       }
@@ -1311,11 +1326,12 @@ public class SeqPanel extends JPanel implements MouseListener,
         else
         {
           editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
-          { seq }, lastres, startres - lastres, av.alignment, true);
-        }
+          { seq }, lastres, startres - lastres, av.getAlignment(), true);
+         }
       }
       else
       {
+       if(!editSeq){
         // dragging to the left
         if (fixedColumns && fixedRight != -1)
         {
@@ -1346,9 +1362,24 @@ public class SeqPanel extends JPanel implements MouseListener,
           if (max > 0)
           {
             editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
-            { seq }, startres, max, av.alignment, true);
+            { seq }, startres, max, av.getAlignment(), true);
           }
         }
+       }else{//insertGap==false AND editSeq==TRUE;
+               if (fixedColumns && fixedRight != -1)
+            {
+              for (int j = lastres; j < startres; j++)
+              {
+                insertChar(j, new SequenceI[]
+                { seq }, fixedRight);
+              }
+              }
+            else
+            {
+              editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[]
+              { seq }, lastres, startres - lastres, av.getAlignment(), true);
+             }
+       }
       }
     }
 
@@ -1382,9 +1413,9 @@ public class SeqPanel extends JPanel implements MouseListener,
     }
 
     editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
-            av.alignment, true);
+            av.getAlignment(), true);
 
-    editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
+    editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.getAlignment(),
             true);
 
   }
@@ -1392,19 +1423,20 @@ public class SeqPanel extends JPanel implements MouseListener,
   void deleteChar(int j, SequenceI[] seq, int fixedColumn)
   {
 
-    editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.alignment,
+    editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.getAlignment(),
             true);
 
     editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
-            av.alignment, true);
+            av.getAlignment(), true);
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseEntered(MouseEvent e)
   {
     if (oldSeq < 0)
@@ -1421,10 +1453,11 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param e
    *          DOCUMENT ME!
    */
+  @Override
   public void mouseExited(MouseEvent e)
   {
     if (av.getWrapAlignment())
@@ -1438,10 +1471,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();
@@ -1472,6 +1506,7 @@ public class SeqPanel extends JPanel implements MouseListener,
     }
   }
 
+  @Override
   public void mouseWheelMoved(MouseWheelEvent e)
   {
     e.consume();
@@ -1488,7 +1523,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
@@ -1500,7 +1535,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
     startWrapBlock = wrappedBlock;
 
-    if (av.wrapAlignment && seq > av.alignment.getHeight())
+    if (av.wrapAlignment && seq > av.getAlignment().getHeight())
     {
       JOptionPane.showInternalMessageDialog(Desktop.desktop,
               "Cannot edit annotations in wrapped view.",
@@ -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)
       {
@@ -1633,7 +1668,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
@@ -1650,9 +1685,8 @@ public class SeqPanel extends JPanel implements MouseListener,
     {
       if (stretchGroup.cs instanceof ClustalxColourScheme)
       {
-        ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
-                stretchGroup.getSequences(av.hiddenRepSequences),
-                stretchGroup.getWidth());
+        ((ClustalxColourScheme) stretchGroup.cs).alignmentChanged(
+                stretchGroup,av.getHiddenRepSequences());
       }
 
       if (stretchGroup.cs.conservationApplied())
@@ -1677,7 +1711,7 @@ public class SeqPanel extends JPanel implements MouseListener,
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param evt
    *          DOCUMENT ME!
    */
@@ -1696,9 +1730,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 +1777,7 @@ 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 +1868,7 @@ public class SeqPanel extends JPanel implements MouseListener,
       running = false;
     }
 
+    @Override
     public void run()
     {
       running = true;
@@ -1848,7 +1883,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 +1911,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)
   {
@@ -1901,15 +1937,15 @@ public class SeqPanel extends JPanel implements MouseListener,
       SequenceGroup sgroup = null;
       if (seqsel != null && seqsel.getSize()>0)
       {
-        if (av.alignment == null)
+        if (av.getAlignment() == 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);
+        sgroup = seqsel.intersect(av.getAlignment(),
+                (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
         if ((sgroup == null || sgroup.getSize() == 0)
                 || (colsel == null || colsel.size() == 0))
         {
@@ -1934,29 +1970,29 @@ public class SeqPanel extends JPanel implements MouseListener,
       // 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();
           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");
     }
index 43c9d42..9c51409 100755 (executable)
@@ -1,43 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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.util.*;
+import java.util.List;
 
 import java.awt.*;
 import java.awt.event.*;
 
 import javax.swing.*;
-
-import MCview.*;
+import javax.swing.tree.DefaultMutableTreeNode;
 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.util.DBRefUtils;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
 import jalview.ws.seqfetcher.DbSourceProxy;
-
-import java.awt.Rectangle;
 import java.awt.BorderLayout;
-import java.awt.Dimension;
 
 public class SequenceFetcher extends JPanel implements Runnable
 {
@@ -52,11 +45,11 @@ 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;
 
@@ -65,7 +58,7 @@ public class SequenceFetcher extends JPanel implements Runnable
   /**
    * Blocking method that initialises and returns the shared instance of the
    * SequenceFetcher client
-   * 
+   *
    * @param guiWindow
    *          - where the initialisation delay message should be shown
    * @return the singleton instance of the sequence fetcher client
@@ -102,7 +95,11 @@ public class SequenceFetcher extends JPanel implements Runnable
       }
     }
     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();
@@ -114,13 +111,17 @@ public class SequenceFetcher extends JPanel implements Runnable
         guiWindow.setProgressBar("Initialising 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());
       }
+      lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() + dasRegistry
+              .getLocalSourceString()).hashCode();
       sfetch = sf;
       _initingFetcher = false;
       initingThread = null;
@@ -136,6 +137,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     Thread sf = new Thread(new Runnable()
     {
 
+      @Override
       public void run()
       {
         if (getSequenceFetcherSingleton(guiWindow) != null)
@@ -146,6 +148,7 @@ public class SequenceFetcher extends JPanel implements Runnable
         {
           javax.swing.SwingUtilities.invokeLater(new Runnable()
           {
+            @Override
             public void run()
             {
               JOptionPane
@@ -164,9 +167,19 @@ 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
-   * 
+   *
    * @param guiWindow
    */
   private void initGui(IProgressIndicator guiWindow)
@@ -176,29 +189,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();
@@ -242,6 +233,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     ok.setText("OK");
     ok.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         ok_actionPerformed();
@@ -250,6 +242,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     clear.setText("Clear");
     clear.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         clear_actionPerformed();
@@ -259,6 +252,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     example.setText("Example");
     example.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         example_actionPerformed();
@@ -267,6 +261,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     close.setText("Close");
     close.addActionListener(new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent e)
       {
         close_actionPerformed(e);
@@ -276,6 +271,7 @@ 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)
@@ -290,20 +286,32 @@ 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
         {
-          db = sfetch.getSourceProxy((String) sources.get(database
-                  .getSelectedItem()));
-          String eq = db.getTestQuery();
+          databaseButt.setText(database.getSelectedItem()
+                  + (database.getSelectedSources().size() > 1 ? " (and "
+                          + database.getSelectedSources().size()
+                          + " others)" : ""));
+          String eq = database.getExampleQueries();
           dbeg.setText("Example query: " + eq);
-          replacePunctuation.setEnabled(!(eq != null && eq.indexOf(",") > -1));
+          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("");
@@ -313,7 +321,7 @@ public class SequenceFetcher extends JPanel implements Runnable
       }
     });
     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);
@@ -333,9 +341,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     DbSourceProxy db = null;
     try
     {
-      db = sfetch.getSourceProxy((String) sources.get(database
-              .getSelectedItem()));
-      textArea.setText(db.getTestQuery());
+      textArea.setText(database.getExampleQueries());
     } catch (Exception ex)
     {
     }
@@ -350,7 +356,9 @@ public class SequenceFetcher extends JPanel implements Runnable
 
   JLabel dbeg = new JLabel();
 
-  JComboBox database = new JComboBox();
+  JDatabaseTree database;
+
+  JButton databaseButt;
 
   JLabel jLabel1 = new JLabel();
 
@@ -411,10 +419,11 @@ public class SequenceFetcher extends JPanel implements Runnable
     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,274 +453,248 @@ 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)
+      {
+        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
       {
-        while (en.hasMoreElements())
+        // update status
+        guiWindow.setProgressBar("Fetching " + nqueries
+                + " sequence queries from " + 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());
+                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("Finished querying", Thread.currentThread().hashCode());
     }
-    if (aresult != null && aresult.size()>0)
+    guiWindow.setProgressBar((presult.size()>0) ? "Parsing results.":"Processing ..", Thread.currentThread().hashCode());
+    // process results
+    while (presult.size() > 0)
     {
-      AlignmentI ar=null;
-      if (isAliSource) {
-        // new window for each result
-        while (aresult.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");
@@ -742,12 +725,15 @@ 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)
   {
@@ -771,19 +757,21 @@ public class SequenceFetcher extends JPanel implements Runnable
           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).getDatasetSequence().getSequenceFeatures()) != null)
             {
-              af.setShowSeqFeatures(true);
-              break;
+              if (sfs.length > 0)
+              {
+                af.setShowSeqFeatures(true);
+                break;
+              }
             }
-          }
 
+          }
         }
         Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
                 AlignFrame.DEFAULT_HEIGHT);
@@ -802,16 +790,17 @@ public class SequenceFetcher extends JPanel implements Runnable
       {
         for (int i = 0; i < al.getHeight(); i++)
         {
-          alignFrame.viewport.alignment.addSequence(al.getSequenceAt(i)); // this
+          alignFrame.viewport.getAlignment().addSequence(
+                  al.getSequenceAt(i)); // this
           // also
           // creates
           // dataset
           // sequence
           // entries
         }
-        alignFrame.viewport.setEndSeq(alignFrame.viewport.alignment
+        alignFrame.viewport.setEndSeq(alignFrame.viewport.getAlignment()
                 .getHeight());
-        alignFrame.viewport.alignment.getWidth();
+        alignFrame.viewport.getAlignment().getWidth();
         alignFrame.viewport.firePropertyChange("alignment", null,
                 alignFrame.viewport.getAlignment().getSequences());
       }
@@ -824,6 +813,7 @@ public class SequenceFetcher extends JPanel implements Runnable
     resetDialog();
     javax.swing.SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         JOptionPane.showInternalMessageDialog(Desktop.desktop, error,
index b3dfc97..b294282 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.gui;
 
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+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!
@@ -80,7 +84,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))
     {
@@ -91,7 +95,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
     }
     else if (av.getShowBoxes())
     {
-      getBoxColour(av.globalColourScheme, seq, i);
+      getBoxColour(av.getGlobalColourScheme(), seq, i);
     }
 
     return resBoxColour;
@@ -111,7 +115,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)))
@@ -205,7 +209,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
         }
         else if (av.getShowBoxes())
         {
-          getBoxColour(av.globalColourScheme, seq, i);
+          getBoxColour(av.getGlobalColourScheme(), seq, i);
         }
 
       }
@@ -328,7 +332,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
           if (currentSequenceGroup.getShowNonconserved()) // todo optimize
           {
             // todo - use sequence group consensus
-            s = getDisplayChar(av.consensus, i, s, '.');
+            s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
 
           }
 
@@ -343,7 +347,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())
             {
@@ -359,7 +363,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
           {
             if (!getboxColour)
             {
-              getBoxColour(av.globalColourScheme, seq, i);
+              getBoxColour(av.getGlobalColourScheme(), seq, i);
             }
 
             if (resBoxColour.getRed() + resBoxColour.getBlue()
@@ -368,9 +372,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer
               graphics.setColor(av.textColour2);
             }
           }
-          if (av.showUnconserved)
+          if (av.getShowUnconserved())
           {
-            s = getDisplayChar(av.consensus, i, s, '.');
+            s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
 
           }
 
index 3eccf63..40b2cac 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -133,7 +133,7 @@ public class SliderPanel extends GSliderPanel
     conservationSlider.setTitle("Conservation Colour Increment  (" + source
             + ")");
 
-    if (ap.av.alignment.getGroups() != null)
+    if (ap.av.getAlignment().getGroups() != null)
     {
       sp.setAllGroupsCheckEnabled(true);
     }
@@ -209,7 +209,7 @@ public class SliderPanel extends GSliderPanel
 
     PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
 
-    if (ap.av.alignment.getGroups() != null)
+    if (ap.av.getAlignment().getGroups() != null)
     {
       pid.setAllGroupsCheckEnabled(true);
     }
@@ -266,12 +266,12 @@ public class SliderPanel extends GSliderPanel
     }
 
     ColourSchemeI toChange = null;
-    Vector allGroups = null;
+    List<SequenceGroup> allGroups = null;
     int groupIndex = 0;
 
     if (allGroupsCheck.isSelected())
     {
-      allGroups = ap.av.alignment.getGroups();
+      allGroups = ap.av.getAlignment().getGroups();
       groupIndex = allGroups.size() - 1;
     }
     else
index cf424e8..32c6aac 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -19,6 +19,7 @@ package jalview.gui;
 
 import java.awt.*;
 import java.awt.event.*;
+
 import javax.swing.*;
 
 /**
@@ -31,6 +32,10 @@ public class SplashScreen extends JPanel implements Runnable
 {
   boolean visible = true;
 
+  JPanel iconimg = new JPanel(new BorderLayout());
+
+  JTextPane authlist = new JTextPane();
+
   JInternalFrame iframe;
 
   Image image;
@@ -48,26 +53,27 @@ public class SplashScreen extends JPanel implements Runnable
     t.start();
   }
 
+  MouseAdapter closer = new MouseAdapter()
+  {
+    public void mousePressed(MouseEvent evt)
+    {
+      try
+      {
+        visible = false;
+        closeSplash();
+      } catch (Exception ex)
+      {
+      }
+    }
+  };
+
   /**
    * ping the jalview version page then create and display the jalview
    * splashscreen window.
    */
   void initSplashScreenWindow()
   {
-    addMouseListener(new MouseAdapter()
-    {
-      public void mousePressed(MouseEvent evt)
-      {
-        try
-        {
-          visible = false;
-          closeSplash();
-        } catch (Exception ex)
-        {
-        }
-      }
-    });
-
+    addMouseListener(closer);
     try
     {
       java.net.URL url = getClass().getResource("/images/logo.gif");
@@ -88,14 +94,50 @@ public class SplashScreen extends JPanel implements Runnable
     iframe = new JInternalFrame();
     iframe.setFrameIcon(null);
     iframe.setClosable(false);
+    this.setLayout(new BorderLayout());
     iframe.setContentPane(this);
     iframe.setLayer(JLayeredPane.PALETTE_LAYER);
 
     Desktop.desktop.add(iframe);
+    SplashImage splashimg = new SplashImage(image);
+    iconimg.add(splashimg, BorderLayout.CENTER);
+    add(iconimg, BorderLayout.WEST);
+    add(authlist, BorderLayout.CENTER);
+    authlist.setEditable(false);
+    authlist.addMouseListener(closer);
+    refreshText();
+  }
 
-    iframe.setVisible(true);
-    iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
-            (int) ((Desktop.instance.getHeight() - 160) / 2), 750, 190);
+  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.setContentType("text/html");
+      authlist.setText(newtext);
+      authlist.setVisible(true);
+      add(authlist, BorderLayout.CENTER);
+      iframe.pack();
+      iframe.setVisible(true);
+      iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
+              (int) ((Desktop.instance.getHeight() - 160) / 2), 750,
+              iframe.getPreferredSize().height);
+      System.err.println("New preferred size: "+iframe.getPreferredSize().height);
+
+      return true;
+    }
+    return false;
   }
 
   /**
@@ -104,13 +146,14 @@ public class SplashScreen extends JPanel implements Runnable
   public void run()
   {
     initSplashScreenWindow();
+
     long startTime = System.currentTimeMillis() / 1000;
 
     while (visible)
     {
       try
       {
-        Thread.sleep(1000);
+        Thread.sleep(500);
       } catch (Exception ex)
       {
       }
@@ -119,8 +162,11 @@ public class SplashScreen extends JPanel implements Runnable
       {
         visible = false;
       }
-      else
-        repaint();
+
+      if (visible && refreshText())
+      {
+          repaint();
+      }
     }
 
     closeSplash();
@@ -140,82 +186,69 @@ 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"))
+    public void paintComponent(Graphics g)
     {
-      // Displayed when code version and jnlp version do not match
-      g.drawString("...Checking latest version...", 50, y += fontSize + 10);
-      y += 5;
+      g.setColor(Color.white);
+      g.fillRect(0, 0, getWidth(), getHeight());
       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)
+      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, 4, (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);
     }
-
-    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);
+    /*
+     * 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); }
+     */
   }
-}
+}
\ No newline at end of file
index 804dc0b..614bfee 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -137,7 +137,7 @@ public class TextColourChooser
     if (sg == null)
     {
       ap.av.textColour = col;
-      if (ap.av.colourAppliesToAllGroups)
+      if (ap.av.getColourAppliesToAllGroups())
       {
         setGroupTextColour();
       }
@@ -155,7 +155,7 @@ public class TextColourChooser
     if (sg == null)
     {
       ap.av.textColour2 = col;
-      if (ap.av.colourAppliesToAllGroups)
+      if (ap.av.getColourAppliesToAllGroups())
       {
         setGroupTextColour();
       }
@@ -173,7 +173,7 @@ public class TextColourChooser
     if (sg == null)
     {
       ap.av.thresholdTextColour = value;
-      if (ap.av.colourAppliesToAllGroups)
+      if (ap.av.getColourAppliesToAllGroups())
       {
         setGroupTextColour();
       }
@@ -188,16 +188,15 @@ 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;
index 02be03f..9f65511 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -125,7 +125,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);
     }
   }
@@ -851,7 +851,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         for (int a = 0; a < aps.length; a++)
         {
           aps[a].av.setSelectionGroup(null);
-          aps[a].av.alignment.deleteAllGroups();
+          aps[a].av.getAlignment().deleteAllGroups();
           aps[a].av.sequenceColours = null;
         }
         colourGroups();
@@ -889,6 +889,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,8 +903,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         }
         else
         {
-          cs = ColourSchemeProperty.getColour(sequences, av.alignment
-                  .getWidth(), ColourSchemeProperty.getColourName(av
+          cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty.getColourName(av
                   .getGlobalColourScheme()));
         }
         // cs is null if shading is an annotationColourGradient
@@ -912,10 +913,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
                   av.getIgnoreGapsConsensus());
         }
       }
-
-      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++)
@@ -928,11 +927,11 @@ 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(sg);
       }
     }
     // notify the panel to redo any group specific stuff.
index d8253db..602ded6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -255,11 +255,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())
@@ -276,14 +276,14 @@ public class TreePanel extends GTreePanel
         if (av.getSelectionGroup() == null)
         {
           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());
         }
 
         tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
@@ -570,7 +570,7 @@ public class TreePanel extends GTreePanel
     AlignmentSorter.sortByTree(av.getAlignment(), tree);
     CommandI undo;
     undo=new OrderCommand("Tree Sort", oldOrder,
-          av.alignment);
+          av.getAlignment());
 
     ap.paintAlignment(true);    
     return undo;
index 792ef7d..53e4ad3 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 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.datamodel.SequenceGroup;
+import jalview.io.JalviewFileChooser;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+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.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
 
 /**
  * DOCUMENT ME!
@@ -372,7 +386,7 @@ public class UserDefinedColours extends GUserDefinedColours implements
       {
         try
         {
-          col = oldColourScheme.findColour(aa.charAt(0), -1);
+          col = oldColourScheme.findColour(aa.charAt(0), -1, null);
         } catch (Exception ex)
         {
         }
index 182ab1c..f06eaa6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 03b83cd..764b256 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -1021,10 +1021,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)
                   {
index 47e96b2..26c52c9 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index ba7f4f3..9f8a8a8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b199489..b9bd873 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -22,7 +22,7 @@ import jalview.gui.OptsAndParamsPage.ParamBox;
 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;
@@ -867,8 +867,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]))
index f7d6bc4..9452ff5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e2482f6..7104fa9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.gui;
 
+import jalview.bin.Cache;
+import jalview.jbgui.GWsPreferences;
+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.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
 {
 
+
   public WsPreferences()
   {
     super();
     initFromPreferences();
   }
 
-  Vector<String> wsUrls, oldUrls,rsbsUrls,oldRsbsUrls;
+  Vector<String> wsUrls, oldUrls, rsbsUrls, oldRsbsUrls;
 
   private boolean needWsMenuUpdate;
 
@@ -62,6 +69,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)
@@ -101,11 +110,109 @@ public class WsPreferences extends GWsPreferences
 
   };
 
-  private void updateList()
+  private void updateList() {
+    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("Status").setMinWidth(10);
+  }
+  private class JabaWSStatusRenderer extends JPanel implements TableCellRenderer
   {
-    wsList.setListData(wsUrls);
+    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;
+    public WsUrlTableModel(Object[][] tdat)
+    {
+      this.data=tdat;
+    }
 
+    @Override
+    public int getColumnCount()
+    {
+      return 2;
+    }
+    @Override
+    public String getColumnName(int column)
+    {
+      if (column==1)
+      {
+        return "Status";
+      }
+      return "Service URL";
+    }
+    @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()
   {
     sbrsList.setListData(rsbsUrls);
@@ -131,7 +238,7 @@ 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);
@@ -149,7 +256,7 @@ 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");
@@ -173,37 +280,44 @@ public class WsPreferences extends GWsPreferences
       }
     }
   }
+
   @Override
   protected void newSbrsUrl_actionPerformed(ActionEvent e)
   {
     RestServiceEditorPane rse = new RestServiceEditorPane();
     rse.showDialog("Add a new Simple Bioinformatics Rest 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)));
+      RestServiceEditorPane rse = new RestServiceEditorPane(
+              new RestServiceDescription(rsbsUrls.elementAt(sel)));
       rse.showDialog("Edit Simple Bioinformatics Rest Service 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 +326,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 +367,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 +387,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);
       updateList();
-      wsList.setSelectedIndex(p + 1);
+      wsList.getSelectionModel().setSelectionInterval(p+1,p + 1);
       update++;
     }
   }
@@ -288,14 +409,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);
       updateList();
-      wsList.setSelectedIndex(p - 1);
+      wsList.getSelectionModel().setSelectionInterval(p-1,p - 1);
       update++;
     }
   }
@@ -326,9 +447,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;
@@ -384,7 +505,7 @@ public class WsPreferences extends GWsPreferences
     {
       if (!wsUrls.contains(url))
       {
-        int selind = wsList.getSelectedIndex();
+        int selind = wsList.getSelectedRow();
         if (selind > -1)
         {
           wsUrls.insertElementAt(url, selind);
@@ -446,6 +567,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);
@@ -468,6 +591,7 @@ public class WsPreferences extends GWsPreferences
           {
             lastrefresh = update;
             Desktop.instance.startServiceDiscovery(true);
+            updateList();
           }
           Desktop.instance.setProgressBar(null, ct);
         }
@@ -493,12 +617,13 @@ public class WsPreferences extends GWsPreferences
   {
     jalview.ws.jws2.Jws2Discoverer.setServiceUrls(null);
     Vector nwsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls();
-    if (!wsUrls.equals(nwsUrls)) {
+    if (!wsUrls.equals(nwsUrls))
+    {
       update++;
     }
-    wsUrls=nwsUrls;
+    wsUrls = nwsUrls;
     updateList();
-    
+
     updateAndRefreshWsMenuConfig(true);
   }
 
index 64f8399..373a918 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ad834be..3ef7210 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 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.datamodel.*;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
 
 /**
  * DOCUMENT ME!
@@ -37,7 +42,7 @@ 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
@@ -73,10 +78,12 @@ public abstract class AlignFile extends FileParse
   public AlignFile(String inFile, String type) throws IOException
   {
     super(inFile, type);
-
     initData();
-
     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);  
+    }
   }
 
   /**
@@ -91,12 +98,16 @@ public abstract class AlignFile extends FileParse
     super(source);
     initData();
     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;
   }
@@ -127,7 +138,17 @@ public abstract class AlignFile extends FileParse
     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 = (AlignmentAnnotation) annotations
+              .elementAt(i);
+      an.validateRangeAndDisplay();
+      al.addAnnotation(an);
     }
 
   }
index 9bb6ea9..14cc9c4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 69926b5..b3b2111 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -68,14 +68,14 @@ public class AnnotationFile
    * columns or hidden row keywords.\r
    * \r
    * @param annotations\r
-   * @param groups\r
+   * @param list\r
    * @param properties\r
    * @return feature file as a string.\r
    */\r
   public String printAnnotations(AlignmentAnnotation[] annotations,\r
-          Vector groups, Hashtable properties)\r
+          List<SequenceGroup> list, Hashtable properties)\r
   {\r
-    return printAnnotations(annotations, groups, properties, null);\r
+    return printAnnotations(annotations, list, properties, null);\r
 \r
   }\r
 \r
@@ -110,13 +110,13 @@ public class AnnotationFile
    * properties and views.\r
    * \r
    * @param annotations\r
-   * @param groups\r
+   * @param list\r
    * @param properties\r
    * @param views\r
    * @return annotation file\r
    */\r
   public String printAnnotations(AlignmentAnnotation[] annotations,\r
-          Vector groups, Hashtable properties, ViewDef[] views)\r
+          List<SequenceGroup> list, Hashtable properties, ViewDef[] views)\r
   {\r
     // TODO: resolve views issue : annotationFile could contain visible region,\r
     // or full data + hidden region specifications for a view.\r
@@ -393,9 +393,9 @@ public class AnnotationFile
       text.append(rowprops.toString());\r
     }\r
 \r
-    if (groups != null)\r
+    if (list != null)\r
     {\r
-      printGroups(groups);\r
+      printGroups(list);\r
     }\r
 \r
     if (properties != null)\r
@@ -419,13 +419,11 @@ public class AnnotationFile
     return text.toString();\r
   }\r
 \r
-  public void printGroups(Vector sequenceGroups)\r
+  public void printGroups(List<SequenceGroup> list)\r
   {\r
-    SequenceGroup sg;\r
     SequenceI seqrep = null;\r
-    for (int i = 0; i < sequenceGroups.size(); i++)\r
+    for (SequenceGroup sg:list)\r
     {\r
-      sg = (SequenceGroup) sequenceGroups.elementAt(i);\r
       if (!sg.hasSeqrep())\r
       {\r
         text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
@@ -889,17 +887,14 @@ public class AnnotationFile
       }\r
       // Finally, resolve the groupRefs\r
       Enumeration en = groupRefRows.keys();\r
-      SequenceGroup theGroup = null;\r
-\r
+      \r
       while (en.hasMoreElements())\r
       {\r
         groupRef = (String) en.nextElement();\r
         boolean matched = false;\r
         // Resolve group: TODO: add a getGroupByName method to alignments\r
-        Vector grps = al.getGroups();\r
-        for (int g = 0, gSize = grps.size(); g < gSize; g++)\r
+        for (SequenceGroup theGroup : al.getGroups())\r
         {\r
-          theGroup = (SequenceGroup) grps.elementAt(g);\r
           if (theGroup.getName().equals(groupRef))\r
           {\r
             if (matched)\r
@@ -1018,7 +1013,7 @@ public class AnnotationFile
         }\r
       }\r
       if (hasSymbols\r
-              && (token.equals("H") || token.equals("E") || token\r
+              && (token.equals("H") || token.equals("E") || token.equals("S") || token\r
                       .equals(" ")))\r
       {\r
         // Either this character represents a helix or sheet\r
@@ -1293,15 +1288,12 @@ public class AnnotationFile
     {\r
       return;\r
     }\r
-    SequenceGroup sg = null;\r
-\r
+    \r
     String name = st.nextToken();\r
-\r
-    Vector groups = al.getGroups();\r
-    for (int i = 0; i < groups.size(); i++)\r
+    SequenceGroup sg=null;\r
+    for (SequenceGroup _sg:al.getGroups())\r
     {\r
-      sg = (SequenceGroup) groups.elementAt(i);\r
-      if (sg.getName().equals(name))\r
+      if ((sg=_sg).getName().equals(name))\r
       {\r
         break;\r
       }\r
@@ -1343,7 +1335,7 @@ public class AnnotationFile
                   sg.getStartRes(), sg.getEndRes() + 1);\r
 \r
           c.calculate();\r
-          c.verdict(false, 25);\r
+          c.verdict(false, 25); // TODO: refer to conservation percent threshold\r
 \r
           sg.cs.setConservation(c);\r
 \r
index 635c801..0709a2f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -67,7 +67,7 @@ public class AppletFormatAdapter
    */
   public static final String[] READABLE_EXTENSIONS = new String[]
   { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
-      "sto" }; // ,
+      "sto,stk" }; // ,
 
   // ".blast"
   // };
index 7b080a4..03b2edf 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9f32c70..a134cbb 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 6a36078..8c0cac1 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -49,7 +49,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 +62,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 +101,7 @@ public class ClustalFile extends AlignFile
                 {
                   tempseq.append(str.nextToken());
                 }
+                top=false;
               }
             }
           }
@@ -102,6 +109,16 @@ 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,12 +156,30 @@ 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)
index f2df79a..0249a32 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 1f51f44..3b74855 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8664cba..2ac0e13 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index cbdfc6f..24b6c61 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -303,6 +303,7 @@ public class FileLoader implements Runnable
         {
           if (viewport != null)
           {
+            // TODO: create undo object for this JAL-1101
             for (int i = 0; i < al.getHeight(); i++)
             {
               viewport.getAlignment().addSequence(al.getSequenceAt(i));
index 718eab3..05a7212 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 643e971..81460eb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e06acec..6be11a8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7313043..7c5223c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 59a010d..396847d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7f0bab1..b128997 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -80,12 +80,11 @@ public class JalviewFileChooser extends JFileChooser
     // SelectAllFilter needs to be set first before adding further
     // file filters to fix bug on Mac OSX
     setAcceptAllFileFilterUsed(selectAll);
-
+    
     for (int i = 0; i < suffix.length; i++)
     {
       JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);
       addChoosableFileFilter(jvf);
-
       if ((selected != null) && selected.equalsIgnoreCase(desc[i]))
       {
         chosen = jvf;
index 4fa2ae8..fad3dab 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 82d0061..a4db9f4 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7c6c61d..7252e5d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7c2e1b2..6b584a8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 11463ce..1aa87a5 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 21b2aaf..3b58519 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5fdcc01..769f9bd 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 571248a..07dc6b5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b5415a3..f74a15a 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index bb55e02..571c469 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2f4f2e2..ec1cbd0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1625241..6b60cd5 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -25,6 +25,7 @@ import java.util.*;
 \r
 import com.stevesoft.pat.*;\r
 import jalview.datamodel.*;\r
+import jalview.analysis.Rna;\r
 \r
 // import org.apache.log4j.*;\r
 \r
@@ -82,6 +83,9 @@ public class StockholmFile extends AlignFile
     Hashtable seqs = new Hashtable();\r
     Regex p, r, rend, s, x;\r
 \r
+    // Temporary line for processing RNA annotation\r
+    // String RNAannot = "";\r
+\r
     // ------------------ Parsing File ----------------------\r
     // First, we have to check that this file has STOCKHOLM format, i.e. the\r
     // first line must match\r
@@ -105,11 +109,20 @@ public class StockholmFile extends AlignFile
     r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
     x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
 \r
+    // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
+    Regex openparen = new Regex("(<|\\[)", "(");\r
+    Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+    // Detect if file is RNA by looking for bracket types\r
+    Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
     rend.optimize();\r
     p.optimize();\r
     s.optimize();\r
     r.optimize();\r
     x.optimize();\r
+    openparen.optimize();\r
+    closeparen.optimize();\r
 \r
     while ((line = nextLine()) != null)\r
     {\r
@@ -136,12 +149,16 @@ public class StockholmFile extends AlignFile
           int start = 1;\r
           int end = -1;\r
           String sid = acc;\r
-          // Retrieve hash of annotations for this accession\r
+          /*\r
+           * Retrieve hash of annotations for this accession\r
+           * Associate Annotation with accession\r
+           */\r
           Hashtable accAnnotations = null;\r
 \r
           if (seqAnn != null && seqAnn.containsKey(acc))\r
           {\r
             accAnnotations = (Hashtable) seqAnn.remove(acc);\r
+            //TODO: add structures to sequence\r
           }\r
 \r
           // Split accession in id and from/to\r
@@ -171,7 +188,19 @@ public class StockholmFile extends AlignFile
               jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
               // seqO.addDBRef(dbref);\r
             }\r
+          }        \r
+          if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
+          {\r
+                 Vector v = (Vector) accAnnotations.get("SS");\r
+                 \r
+                 for (int i = 0; i < v.size(); i++)\r
+                   {\r
+                         AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
+                         seqO.addAlignmentAnnotation(an);\r
+                         //annotations.add(an);\r
+                   }\r
           }\r
+        \r
           Hashtable features = null;\r
           // We need to adjust the positions of all features to account for gaps\r
           try\r
@@ -413,7 +442,7 @@ public class StockholmFile extends AlignFile
               ann = new Hashtable();\r
               seqAnn.put(acc, ann);\r
             }\r
-\r
+            //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence\r
             Hashtable features;\r
             // Get an object with all the content for an annotation\r
             if (ann.containsKey("features"))\r
@@ -448,6 +477,24 @@ public class StockholmFile extends AlignFile
             }\r
             ns += seq;\r
             content.put(description, ns);\r
+
+            if(type.equals("SS")){\r
+                Hashtable strucAnn;\r
+                if (seqAnn.containsKey(acc))\r
+                {\r
+                  strucAnn = (Hashtable) seqAnn.get(acc);\r
+                }\r
+                else\r
+                {\r
+                  strucAnn = new Hashtable();\r
+                }\r
+                \r
+                Vector newStruc=new Vector();\r
+                parseAnnotationRow(newStruc, type,ns);\r
+                \r
+                strucAnn.put(type, newStruc);\r
+                seqAnn.put(acc, strucAnn);\r
+             }\r
           }\r
           else\r
           {\r
@@ -474,9 +521,22 @@ public class StockholmFile extends AlignFile
     }\r
   }\r
 \r
-  private AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
+  protected static AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
           String label, String annots)\r
   {\r
+    String convert1, convert2 = null;\r
+\r
+    // Convert all bracket types to parentheses\r
+    Regex openparen = new Regex("(<|\\[)", "(");\r
+    Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+    // Detect if file is RNA by looking for bracket types\r
+    Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
+    convert1 = openparen.replaceAll(annots);\r
+    convert2 = closeparen.replaceAll(convert1);\r
+    annots = convert2;\r
+\r
     String type = (label.indexOf("_cons") == label.length() - 5) ? label\r
             .substring(0, label.length() - 5) : label;\r
     boolean ss = false;\r
@@ -495,8 +555,17 @@ public class StockholmFile extends AlignFile
       // be written out\r
       if (ss)\r
       {\r
-        ann.secondaryStructure = jalview.schemes.ResidueProperties\r
-                .getDssp3state(pos).charAt(0);\r
+        if (detectbrackets.search(pos))\r
+        {\r
+          ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+                  .getRNASecStrucState(pos).charAt(0);\r
+        }\r
+        else\r
+        {\r
+          ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+                  .getDssp3state(pos).charAt(0);\r
+        }\r
+\r
         if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')\r
         {\r
           ann.displayCharacter = ""; // null; // " ";\r
@@ -531,6 +600,7 @@ public class StockholmFile extends AlignFile
               annot.annotations.length);\r
       System.arraycopy(els, 0, anns, annot.annotations.length, els.length);\r
       annot.annotations = anns;\r
+      //System.out.println("else: ");\r
     }\r
     return annot;\r
   }\r
@@ -570,7 +640,7 @@ public class StockholmFile extends AlignFile
     }\r
   }\r
 \r
-  private String id2type(String id)\r
+  protected static String id2type(String id)\r
   {\r
     if (typeIds.containsKey(id))\r
     {\r
@@ -580,4 +650,38 @@ public class StockholmFile extends AlignFile
             + id);\r
     return id;\r
   }\r
+  /**\r
+   * //ssline is complete secondary structure line private AlignmentAnnotation\r
+   * addHelices(Vector annotation, String label, String ssline) {\r
+   * \r
+   * // decide on secondary structure or not. Annotation[] els = new\r
+   * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) {\r
+   * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new\r
+   * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not\r
+   * \r
+   * ann.secondaryStructure =\r
+   * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0);\r
+   * \r
+   * ann.displayCharacter = "x" + ann.displayCharacter;\r
+   * \r
+   * System.out.println(ann.displayCharacter);\r
+   * \r
+   * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e =\r
+   * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot =\r
+   * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type))\r
+   * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot =\r
+   * new AlignmentAnnotation(type, type, els);\r
+   * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new\r
+   * Annotation[helicesAnnot.annotations.length + els.length];\r
+   * System.arraycopy(helicesAnnot.annotations, 0, anns, 0,\r
+   * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns,\r
+   * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations =\r
+   * anns; }\r
+   * \r
+   * helicesAnnot.features = Rna.GetBasePairs(ssline);\r
+   * Rna.HelixMap(helicesAnnot.features);\r
+   * \r
+   * \r
+   * return helicesAnnot; }\r
+   */\r
 }\r
diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java
new file mode 100644 (file)
index 0000000..cf33671
--- /dev/null
@@ -0,0 +1,520 @@
+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.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 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 teh score value are supposd 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;
+         }
+       }
+       /**
+        * 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();
+                       
+                       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())
+         {
+           warningMessage="Alignment shape does not match T-Coffee score file shape.";
+           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,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.";
+  }
+}
index 8228239..735f415 100644 (file)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -20,11 +20,7 @@ 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,14 +30,13 @@ 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 java.io.IOException;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.IdentityHashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Vector;
 import java.util.jar.JarInputStream;
 import java.util.jar.JarOutputStream;
@@ -51,14 +46,14 @@ import uk.ac.vamsas.objects.core.*;
 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
 {
@@ -183,7 +178,7 @@ public class VamsasAppDatastore
   }
 
   /**
-   * 
+   *
    * @param vobj
    * @return Jalview datamodel object bound to the vamsas document object
    */
@@ -250,7 +245,7 @@ public class VamsasAppDatastore
 
   /**
    * put the alignment viewed by AlignViewport into cdoc.
-   * 
+   *
    * @param av
    *          alignViewport to be stored
    * @param aFtitle
@@ -491,14 +486,14 @@ public class VamsasAppDatastore
           /*
            * We do not put local Alignment Sequence Features into the vamsas
            * document yet.
-           * 
-           * 
+           *
+           *
            * jalview.datamodel.SequenceFeature[] features = alseq
            * .getSequenceFeatures(); for (int f = 0; f < features.length; f++) {
            * if (features[f] != null) { AlignmentSequenceAnnotation valseqf = (
            * AlignmentSequenceAnnotation) getjv2vObj(features[i]); if (valseqf
            * == null) {
-           * 
+           *
            * valseqf = (AlignmentSequenceAnnotation) getDSAnnotationFromJalview(
            * new AlignmentSequenceAnnotation(), features[i]);
            * valseqf.setGraph(false);
@@ -546,12 +541,7 @@ 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())
-              {
-                jvalsq = (SequenceI) jval.nextElement();
+              for (SequenceI jvalsq:av.getAlignment().getSequences()) {
                 // saveDatasetSequenceAnnotation(AlSeqMaps,(uk.ac.vamsas.objects.core.Sequence)
                 // sref, aa[i]);
                 if (jvalsq.getDatasetSequence() == aa[i].sequenceRef)
@@ -729,7 +719,7 @@ public class VamsasAppDatastore
    * very quick test to see if the viewport would be stored in the vamsas
    * document. Reasons for not storing include the unaligned flag being false
    * (for all sequences, including the hidden ones!)
-   * 
+   *
    * @param av
    * @return true if alignment associated with this view will be stored in
    *         document.
@@ -751,7 +741,7 @@ public class VamsasAppDatastore
   /**
    * remove docseqs from the given alignment marking provenance appropriately
    * and removing any references to the sequences.
-   * 
+   *
    * @param alignment
    * @param docseqs
    */
@@ -819,7 +809,7 @@ public class VamsasAppDatastore
    * vamsas alignment sequence for jvalsq and adds it to the alignment if
    * necessary. unbounddocseq is a duplicate of the vamsas alignment sequences
    * and these are removed after being processed w.r.t a bound jvalsq
-   * 
+   *
    */
   private boolean syncToAlignmentSequence(SequenceI jvalsq,
           Alignment alignment, Vector unbounddocseq)
@@ -884,7 +874,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;
@@ -1168,7 +1158,7 @@ public class VamsasAppDatastore
 
   /**
    * set vamsas annotation object type from jalview annotation
-   * 
+   *
    * @param an
    * @param alan
    */
@@ -1216,7 +1206,7 @@ public class VamsasAppDatastore
   /**
    * get start<end range of segment, adjusting for inclusivity flag and
    * polarity.
-   * 
+   *
    * @param visSeg
    * @param ensureDirection
    *          when true - always ensure start is less than end.
@@ -1243,7 +1233,7 @@ public class VamsasAppDatastore
   }
 
   /**
-   * 
+   *
    * @param annotation
    * @return true if annotation is not to be stored in document
    */
@@ -1260,7 +1250,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 +1282,7 @@ public class VamsasAppDatastore
             jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider()
             {
 
+              @Override
               public String getFilename()
               {
 
@@ -1299,6 +1290,7 @@ public class VamsasAppDatastore
                 return "Jalview Vamsas Document Client Data";
               }
 
+              @Override
               public JarInputStream getJarInputStream() throws IOException
               {
                 jalview.bin.Cache.log
@@ -1338,6 +1330,7 @@ public class VamsasAppDatastore
           jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider()
           {
 
+            @Override
             public String getFilename()
             {
 
@@ -1345,6 +1338,7 @@ public class VamsasAppDatastore
               return "Jalview Vamsas Document User Data";
             }
 
+            @Override
             public JarInputStream getJarInputStream() throws IOException
             {
               jalview.bin.Cache.log
@@ -1462,7 +1456,7 @@ public class VamsasAppDatastore
   /**
    * replaces oldjvobject with newjvobject in the Jalview Object <> VorbaID
    * binding tables
-   * 
+   *
    * @param oldjvobject
    * @param newjvobject
    *          (may be null)
@@ -1472,6 +1466,7 @@ public class VamsasAppDatastore
     Object vobject = jv2vobj.remove(oldjvobject);
     if (vobject == null)
     {
+      // NOTE: this happens if user deletes object in one session then updates from another client
       throw new Error(
               "IMPLEMENTATION ERROR: old jalview object is not bound ! ("
                       + oldjvobject + ")");
@@ -1520,7 +1515,7 @@ public class VamsasAppDatastore
 
   /**
    * translate the Vobject keys to strings for use in Jalview2XML
-   * 
+   *
    * @param jv2vobj2
    * @return
    */
@@ -1538,7 +1533,7 @@ public class VamsasAppDatastore
 
   /**
    * translate the Vobject values to strings for use in Jalview2XML
-   * 
+   *
    * @param vobj2jv2
    * @return hashtable with string values
    */
@@ -1556,7 +1551,7 @@ public class VamsasAppDatastore
 
   /**
    * synchronize Jalview from the vamsas document
-   * 
+   *
    * @return number of new views from document
    */
   public int updateToJalview()
@@ -1573,7 +1568,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 +1615,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.");
@@ -1782,8 +1777,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 "
@@ -1987,7 +1982,7 @@ public class VamsasAppDatastore
    * jalview.datamodel.Annotation[] rows Two annotation rows are made if there
    * are distinct annotation for both at 'pos' and 'after pos' at any particular
    * site.
-   * 
+   *
    * @param annotation
    * @return { boolean[static int constants ], int[ae.length] - map to annotated
    *         object frame, jalview.datamodel.Annotation[],
@@ -2405,7 +2400,7 @@ public class VamsasAppDatastore
    * get real bounds of a RangeType's specification. start and end are an
    * inclusive range within which all segments and positions lie. TODO: refactor
    * to vamsas utils
-   * 
+   *
    * @param dseta
    * @return int[] { start, end}
    */
@@ -2463,7 +2458,7 @@ public class VamsasAppDatastore
   /**
    * map from a rangeType's internal frame to the referenced object's coordinate
    * frame.
-   * 
+   *
    * @param dseta
    * @return int [] { ref(pos)...} for all pos in rangeType's frame.
    */
@@ -2515,7 +2510,7 @@ public class VamsasAppDatastore
   }
 
   /**
-   * 
+   *
    * @param maprange
    *          where the from range is the local mapped range, and the to range
    *          is the 'mapped' range in the MapRangeType
@@ -2540,7 +2535,7 @@ public class VamsasAppDatastore
 
   /**
    * initialise a range type object from a set of start/end inclusive intervals
-   * 
+   *
    * @param mrt
    * @param range
    */
@@ -2557,7 +2552,7 @@ public class VamsasAppDatastore
 
   /**
    * initialise a MapType object from a MapList object.
-   * 
+   *
    * @param maprange
    * @param ml
    * @param setUnits
@@ -2582,12 +2577,12 @@ public class VamsasAppDatastore
    * App and Action here. Provenance prov = new Provenance();
    * org.exolab.castor.types.Date date = new org.exolab.castor.types.Date( new
    * java.util.Date()); Entry provEntry;
-   * 
+   *
    * if (jprov != null) { entries = jprov.getEntries(); for (int i = 0; i <
    * entries.length; i++) { provEntry = new Entry(); try { date = new
    * org.exolab.castor.types.Date(entries[i].getDate()); } catch (Exception ex)
    * { ex.printStackTrace();
-   * 
+   *
    * date = new org.exolab.castor.types.Date(entries[i].getDate()); }
    * provEntry.setDate(date); provEntry.setUser(entries[i].getUser());
    * provEntry.setAction(entries[i].getAction()); prov.addEntry(provEntry); } }
@@ -2595,7 +2590,7 @@ public class VamsasAppDatastore
    * provEntry.setUser(System.getProperty("user.name")); // TODO: ext string
    * provEntry.setApp("JVAPP"); // TODO: ext string provEntry.setAction(action);
    * prov.addEntry(provEntry); }
-   * 
+   *
    * return prov; }
    */
   jalview.datamodel.Provenance getJalviewProvenance(Provenance prov)
@@ -2613,7 +2608,7 @@ public class VamsasAppDatastore
   }
 
   /**
-   * 
+   *
    * @return default initial provenance list for a Jalview created vamsas
    *         object.
    */
index f4569dc..cae1f1b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b3e8b3d..5c867c8 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index bb70274..95de89d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1b760df..b611d5e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 879c64f..4374bd4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e57942b..d15ceb3 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 1a5a1ea..365f8a8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f00426a..8b23e4c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 218aa5b..899a3ae 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1ff29af..7cdbe58 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2fd2333..7914797 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f69db60..0dedee3 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 2174553..ec2a407 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index eab51f0..5caded1 100644 (file)
@@ -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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
@@ -20,10 +20,10 @@ package jalview.io.vamsas;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Hashtable;
+import java.util.List;
 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,7 +32,6 @@ 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;
@@ -100,9 +99,10 @@ public class Tree extends DatastoreItem
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.io.vamsas.DatastoreItem#addFromDocument()
    */
+  @Override
   public void addFromDocument()
   {
     tree = (uk.ac.vamsas.objects.core.Tree) vobj; // vtree;
@@ -130,9 +130,10 @@ public class Tree extends DatastoreItem
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.io.vamsas.DatastoreItem#conflict()
    */
+  @Override
   public void conflict()
   {
     Cache.log
@@ -141,9 +142,10 @@ public class Tree extends DatastoreItem
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see jalview.io.vamsas.DatastoreItem#update()
    */
+  @Override
   public void updateToDoc()
   {
     if (isModifiable(tree.getModifiable()))
@@ -161,9 +163,10 @@ public class Tree extends DatastoreItem
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @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
@@ -171,7 +174,7 @@ public class Tree extends DatastoreItem
     // TODO: Tree.updateFromDoc
     /*
      * TreePanel tp = (TreePanel) jvobj; // getvObj2jv(tree);
-     * 
+     *
      * // make a new tree Object[] idata =
      * recoverInputData(tree.getProvenance()); try { if (idata != null &&
      * idata[0] != null) { inputData = (AlignmentView) idata[0]; } ntree =
@@ -198,7 +201,7 @@ public class Tree extends DatastoreItem
   /**
    * correctly creates provenance for trees calculated on an alignment by
    * jalview.
-   * 
+   *
    * @param jal
    * @param tp
    * @return
@@ -253,7 +256,7 @@ public class Tree extends DatastoreItem
 
   /**
    * look up SeqCigars in an existing alignment.
-   * 
+   *
    * @param jal
    * @param sequences
    * @return vector of alignment sequences in order of SeqCigar array (but
@@ -264,10 +267,10 @@ 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())
+    {for (SequenceI asq:jalsqs)
     {
-      SequenceI asq = (SequenceI) as.nextElement();
       for (int t = 0; t < sequences.length; t++)
       {
         if (tseqs[t] != null
@@ -280,7 +283,7 @@ public class Tree extends DatastoreItem
           alsq.add(asq);
         }
       }
-    }
+    }}
     if (alsq.size() < sequences.length)
       Cache.log
               .warn("Not recovered all alignment sequences for given set of input sequence CIGARS");
@@ -288,9 +291,9 @@ public class Tree extends DatastoreItem
   }
 
   /**
-   * 
+   *
    * Update jalview newick representation with TreeNode map
-   * 
+   *
    * @param tp
    *          the treepanel that this tree is bound to.
    */
@@ -355,7 +358,7 @@ public class Tree extends DatastoreItem
   // / TODO: refactor to vamsas :start
   /**
    * construct treenode mappings for mapped sequences
-   * 
+   *
    * @param ntree
    * @param newick
    * @return
@@ -432,7 +435,7 @@ public class Tree extends DatastoreItem
 
   /**
    * call to match up Treenode specs to NJTree parsed from document object.
-   * 
+   *
    * @param nodespec
    * @param leaves
    *          as returned from NJTree.findLeaves( .., ..) ..
@@ -473,8 +476,9 @@ public class Tree extends DatastoreItem
   // todo: end refactor to vamsas library
   /**
    * add jalview object to vamsas document
-   * 
+   *
    */
+  @Override
   public void addToDocument()
   {
     tree = new uk.ac.vamsas.objects.core.Tree();
@@ -493,7 +497,7 @@ public class Tree extends DatastoreItem
   /**
    * note: this function assumes that all sequence and alignment objects
    * referenced in input data has already been associated with jalview objects.
-   * 
+   *
    * @param tp
    * @param alignFrame
    * @return Object[] { AlignmentView, AlignmentI - reference alignment for
index 93b35e5..4e337ff 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index d064790..f849dc3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
@@ -291,8 +291,9 @@ public interface JalviewLiteJsApi
    * @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 void loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
+  public abstract boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
 
   /**
    * get the sequence features in the given format (Jalview or GFF)
index b069dee..8a9e7d8 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 93731a9..326c259 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f6742b7..c62d48d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index fbb179f..581c3f9 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6253e36..6c1c8c6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.jbgui;
 
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.schemes.ColourSchemeProperty;
+
+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.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+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.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
 
 public class GAlignFrame extends JInternalFrame
 {
@@ -113,6 +135,16 @@ public class GAlignFrame extends JInternalFrame
 
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
 
+  protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
+  protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+  // protected JRadioButtonMenuItem covariationColour = new
+  // JRadioButtonMenuItem();
+
+  protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+  
   JMenuItem njTreeBlosumMenuItem = new JMenuItem();
 
   JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
@@ -149,8 +181,6 @@ public class GAlignFrame extends JInternalFrame
 
   public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
 
-  protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
-
   JMenuItem deleteGroups = new JMenuItem();
 
   JMenuItem delete = new JMenuItem();
@@ -176,7 +206,7 @@ public class GAlignFrame extends JInternalFrame
   JMenuItem epsFile = new JMenuItem();
 
   JMenuItem LoadtreeMenuItem = new JMenuItem();
-
+  
   public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
 
   public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
@@ -211,12 +241,14 @@ public class GAlignFrame extends JInternalFrame
 
   protected JMenu showProducts = new JMenu();
 
-  public JMenuItem featureSettings = new JMenuItem();
+  public JMenuItem openFeatureSettings = new JMenuItem();
 
   JMenuItem fetchSequence = new JMenuItem();
 
   JMenuItem annotationColour = new JMenuItem();
 
+  protected JMenuItem rnahelicesColour = new JMenuItem();
+
   JMenuItem associatedData = new JMenuItem();
 
   protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
@@ -307,6 +339,8 @@ 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();
@@ -417,6 +451,9 @@ public class GAlignFrame extends JInternalFrame
     colours.add(PIDColour);
     colours.add(BLOSUM62Colour);
     colours.add(nucleotideColour);
+    colours.add(purinePyrimidineColour);
+    // colours.add(covariationColour);
+    colours.add(tcoffeeColour);
 
     setColourSelected(jalview.bin.Cache
             .getDefault("DEFAULT_COLOUR", "None"));
@@ -486,7 +523,21 @@ public class GAlignFrame extends JInternalFrame
         nucleotideColour.setSelected(true);
 
         break;
+        
+      case ColourSchemeProperty.TCOFFEE:
+       tcoffeeColour.setSelected(true);
+       break;
 
+      case ColourSchemeProperty.PURINEPYRIMIDINE:
+        purinePyrimidineColour.setSelected(true);
+
+        break;
+      /*
+       * case ColourSchemeProperty.COVARIATION:
+       * covariationColour.setSelected(true);
+       * 
+       * break;
+       */
       case ColourSchemeProperty.USER_DEFINED:
         userDefinedColour.setSelected(true);
 
@@ -850,6 +901,31 @@ public class GAlignFrame extends JInternalFrame
         BLOSUM62Colour_actionPerformed(e);
       }
     });
+    nucleotideColour.setText("Nucleotide");
+    nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        nucleotideColour_actionPerformed(e);
+      }
+    });
+
+    purinePyrimidineColour.setText("Purine/Pyrimidine");
+    purinePyrimidineColour
+            .addActionListener(new java.awt.event.ActionListener()
+            {
+              public void actionPerformed(ActionEvent e)
+              {
+                purinePyrimidineColour_actionPerformed(e);
+              }
+            });
+    /*
+     * covariationColour.setText("Covariation");
+     * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+     * public void actionPerformed(ActionEvent e) {
+     * covariationColour_actionPerformed(e); } });
+     */
+
     avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62");
     avDistanceTreeBlosumMenuItem
             .addActionListener(new java.awt.event.ActionListener()
@@ -1069,6 +1145,16 @@ public class GAlignFrame extends JInternalFrame
       }
 
     });
+    normaliseSequenceLogo.setText("Normalise Consensus Logo");
+    normaliseSequenceLogo.addActionListener(new ActionListener()
+    {
+
+      public void actionPerformed(ActionEvent e)
+      {
+        normaliseSequenceLogo_actionPerformed(e);
+      }
+
+    });
     applyAutoAnnotationSettings.setText("Apply to all groups");
     applyAutoAnnotationSettings.setState(false);
     applyAutoAnnotationSettings.setVisible(true);
@@ -1090,6 +1176,18 @@ public class GAlignFrame extends JInternalFrame
         nucleotideColour_actionPerformed(e);
       }
     });
+    
+    tcoffeeColour.setText("T-Coffee scores");
+    tcoffeeColour.setEnabled(false);
+    tcoffeeColour.addActionListener( new ActionListener() {
+               
+               @Override
+               public void actionPerformed(ActionEvent e) {
+                       tcoffeeColorScheme_actionPerformed(e);
+               }
+       } );
+    
+    
     deleteGroups.setText("Undefine groups");
     deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
@@ -1202,7 +1300,7 @@ public class GAlignFrame extends JInternalFrame
       }
     });
     LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");
-    LoadtreeMenuItem.setText("Load Associated Tree");
+    LoadtreeMenuItem.setText("Load Associated Tree"); 
     LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
     {
       public void actionPerformed(ActionEvent e)
@@ -1210,6 +1308,7 @@ public class GAlignFrame extends JInternalFrame
         LoadtreeMenuItem_actionPerformed(e);
       }
     });
+    
     scaleAbove.setVisible(false);
     scaleAbove.setText("Scale Above");
     scaleAbove.addActionListener(new java.awt.event.ActionListener()
@@ -1364,8 +1463,8 @@ public class GAlignFrame extends JInternalFrame
      * public void actionPerformed(ActionEvent e) {
      * showProducts_actionPerformed(e); } });
      */
-    featureSettings.setText("Feature Settings...");
-    featureSettings.addActionListener(new ActionListener()
+    openFeatureSettings.setText("Feature Settings...");
+    openFeatureSettings.addActionListener(new ActionListener()
     {
       public void actionPerformed(ActionEvent e)
       {
@@ -1389,6 +1488,16 @@ public class GAlignFrame extends JInternalFrame
         annotationColour_actionPerformed(e);
       }
     });
+
+    rnahelicesColour.setText("By RNA helices");
+    rnahelicesColour.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        rnahelicesColour_actionPerformed(e);
+      }
+    });
+
     associatedData.setText("Load Features / Annotations");
     associatedData.addActionListener(new ActionListener()
     {
@@ -1729,6 +1838,7 @@ public class GAlignFrame extends JInternalFrame
     autoAnnMenu.add(applyAutoAnnotationSettings);
     autoAnnMenu.add(showConsensusHistogram);
     autoAnnMenu.add(showSequenceLogo);
+    autoAnnMenu.add(normaliseSequenceLogo);
     autoAnnMenu.addSeparator();
     autoAnnMenu.add(showGroupConservation);
     autoAnnMenu.add(showGroupConsensus);
@@ -1737,7 +1847,7 @@ public class GAlignFrame extends JInternalFrame
     viewMenu.add(showSeqFeatures);
     // viewMenu.add(showSeqFeaturesHeight);
 
-    viewMenu.add(featureSettings);
+    viewMenu.add(openFeatureSettings);
     tooltipSettingsMenu.add(showDbRefsMenuitem);
     tooltipSettingsMenu.add(showNpFeatsMenuitem);
     viewMenu.add(tooltipSettingsMenu);
@@ -1760,6 +1870,9 @@ public class GAlignFrame extends JInternalFrame
     colourMenu.add(turnColour);
     colourMenu.add(buriedColour);
     colourMenu.add(nucleotideColour);
+    colourMenu.add(purinePyrimidineColour);
+    // colourMenu.add(covariationColour);
+    colourMenu.add(tcoffeeColour);
     colourMenu.add(userDefinedColour);
     colourMenu.addSeparator();
     colourMenu.add(conservationMenuItem);
@@ -1767,6 +1880,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();
@@ -1837,6 +1951,12 @@ public class GAlignFrame extends JInternalFrame
     //selectMenu.add(listenToViewSelections);
   }
 
+  protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
+  }
+
   protected void listenToViewSelections_actionPerformed(ActionEvent e)
   {
     // TODO Auto-generated method stub
@@ -2141,6 +2261,14 @@ public class GAlignFrame extends JInternalFrame
   {
   }
 
+  protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+  {
+  }
+
+  /*
+   * protected void covariationColour_actionPerformed(ActionEvent e) { }
+   */
+
   protected void noColourmenuItem_actionPerformed(ActionEvent e)
   {
   }
@@ -2224,7 +2352,32 @@ public class GAlignFrame extends JInternalFrame
 
   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 +2446,11 @@ public class GAlignFrame extends JInternalFrame
 
   }
 
+  public void rnahelicesColour_actionPerformed(ActionEvent e)
+  {
+
+  }
+
   public void associatedData_actionPerformed(ActionEvent e)
   {
 
index bcab09f..fc66218 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5024fc2..05759cd 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f2fc849..69bba49 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index d7e8be3..16fe9a9 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 78ae0a8..dd749e3 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3352e42..2035be7 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8ff42f8..72cb5cd 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index dc0d511..6f8c8d2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 29e11ce..64bcf5c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f389430..4173b03 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index de35733..e964a22 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
diff --git a/src/jalview/jbgui/GRnaStructureViewer.java b/src/jalview/jbgui/GRnaStructureViewer.java
new file mode 100644 (file)
index 0000000..8c7f1f2
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class GRnaStructureViewer extends JInternalFrame
+{
+  public GRnaStructureViewer()
+  {
+    try
+    {
+      jbInit();
+    } catch (Exception ex)
+    {
+      ex.printStackTrace();
+    }
+  }
+
+  private void jbInit() throws Exception
+  {
+   
+  }
+  
+}
index c8c5a5d..f15b4bf 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8cd67db..82acc2c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 28d2c7a..b1b5200 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -164,6 +164,15 @@ public class GStructureViewer extends JInternalFrame
         buriedColour_actionPerformed(actionEvent);
       }
     });
+    purinePyrimidineColour.setText("Purine/Pyrimidine");
+    purinePyrimidineColour.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent actionEvent)
+      {
+         purinePyrimidineColour_actionPerformed(actionEvent);
+      }
+    });
+    
     userColour.setText("User Defined ...");
     userColour.addActionListener(new ActionListener()
     {
@@ -224,6 +233,7 @@ 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(backGround);
@@ -300,6 +310,9 @@ public class GStructureViewer extends JInternalFrame
   protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
 
   protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+  
+  protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+  
 
   protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
 
@@ -380,6 +393,11 @@ public class GStructureViewer extends JInternalFrame
   {
 
   }
+  
+  public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+  {
+
+  }
 
   public void userColour_actionPerformed(ActionEvent actionEvent)
   {
index 53c1248..4d847c0 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 06b57db..2c10974 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b76e48e..5d6b6eb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d94b047..4e855af 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -36,8 +36,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;
 
 /**
@@ -58,8 +58,9 @@ 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");
 
@@ -288,11 +289,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 +327,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 +348,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()
     {
index bb55ed6..b6e77ed 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1af539b..614c70a 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java
new file mode 100644 (file)
index 0000000..8588bf2
--- /dev/null
@@ -0,0 +1,996 @@
+package jalview.renderer;
+
+import jalview.analysis.AAFrequency;
+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 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.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+public class AnnotationRenderer
+{
+
+  public AnnotationRenderer()
+  {
+    // TODO Auto-generated constructor stub
+  }
+
+  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("(\\))");
+
+    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))
+    {
+      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 = new 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[] 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;
+
+  // 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();
+    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();// hconsensus;
+    hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
+    av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
+  }
+
+  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"))
+    {
+      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_renderProfile)
+      {
+        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
+                && av_renderProfile && hStrucConsensus != null
+                && hStrucConsensus.length > column)
+        {
+          return StructureFrequency.extractProfile(hStrucConsensus[column],
+                  av_ignoreGapsConsensus);
+        }
+      }
+    }
+    return null;
+  }
+
+  /**
+   * 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)
+  {
+    boolean usedFaded=false;
+    // NOTES:
+    // AnnotationPanel needs to implement: ImageObserver, access to
+    // AlignViewport
+    updateFromAwtRenderPanel(annotPanel, av);
+    fm = g.getFontMetrics();
+    AlignmentAnnotation[] aa = av.getAlignment().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++)
+    {
+      AlignmentAnnotation row = aa[i];
+      Annotation[] row_annotations=row.annotations;
+      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 = 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;
+        }
+        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.isValidStruc())
+          {
+            g.setColor(Color.orange);
+            g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
+                    charWidth, charHeight);
+          }
+          if (validCharWidth
+                  && validRes
+                  && row_annotations[column].displayCharacter != null
+                  && (row_annotations[column].displayCharacter.length() > 0))
+          {
+
+            if (centreColLabels || scaleColLabel)
+            {
+              fmWidth = 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 > 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;
+                }
+              }
+            }
+            else
+            {
+              fmWidth = fm
+                      .charWidth(row_annotations[column].displayCharacter
+                              .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(row_annotations[column].displayCharacter,
+                      (x * 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
+                      * charWidth + charOffset, y + iconOffset);
+            }
+            g.setFont(ofont);
+          }
+        }
+        if (row.hasIcons)
+        {
+          char ss = validRes ? row_annotations[column].secondaryStructure
+                  : ' ';
+          if (ss == 'S')
+          {
+            // distinguish between forward/backward base-pairing
+            if (row_annotations[column].displayCharacter.indexOf(')') > -1)
+            {
+              ss = 's';
+            }
+          }
+          if (!validRes || (ss != lastSS))
+          {
+            if (x > -1)
+            {
+              switch (lastSS)
+              {
+              case 'H':
+                drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+                        column, validRes, validEnd);
+                break;
+
+              case 'E':
+                drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+                        column, validRes, validEnd);
+                break;
+
+              case 'S': // Stem case for RNA secondary structure
+              case 's': // and opposite direction
+                drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+                        column, validRes, validEnd);
+                break;
+
+              default:
+                g.setColor(Color.gray);
+                g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
+                        - lastSSX, 2);
+
+                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':
+          drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+                  column, validRes, validEnd);
+          break;
+
+        case 'E':
+          drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+                  column, validRes, validEnd);
+          break;
+        case 's':
+        case 'S': // Stem case for RNA secondary structure
+          drawStemAnnot(g, 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[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], aa[gg].annotations, startRes, endRes, y, groupmin,
+                        groupmax, row.graphHeight);
+              }
+            }
+
+            graphGroupDrawn[row.graphGroup] = true;
+          }
+          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);
+        }
+      }
+
+      if (row.graph > 0 && row.hasText)
+      {
+        y += charHeight;
+      }
+
+      if (row.graph == 0)
+      {
+        y += aa[i].height;
+      }
+    }
+    return !usedFaded;
+  }
+
+  private final Color GLYPHLINE_COLOR = Color.gray;
+
+  private final Color SHEET_COLOUR = Color.green;
+
+  private final Color HELIX_COLOUR = Color.red;
+
+  private final Color STEM_COLOUR = Color.blue;
+
+  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)
+  {
+    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;
+    boolean renderHistogram = true, renderProfile = true, normaliseProfile = 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();
+        normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
+      }
+      else
+      {
+        renderHistogram = av_renderHistogram;
+        renderProfile = av_renderProfile;
+        normaliseProfile = av_normaliseProfile;
+      }
+    }
+    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)
+      {
+
+        int profl[] = getProfileFor(_aa, column);
+        // just try to draw the logo if profl is not null
+        if (profl != null && profl[1] != 0)
+        {
+          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;
+
+          /**
+           * profl.length == 74 indicates that the profile of a secondary
+           * structure conservation row was accesed. Therefore dc gets length 2,
+           * to have space for a basepair instead of just a single nucleotide
+           */
+          if (profl.length == 74)
+          {
+            dc = new char[2];
+          }
+          else
+          {
+            dc = new char[1];
+          }
+          LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
+          double scale = 1f / (normaliseProfile ? profl[1] : 100f);
+          float ofontHeight = 1f / lm.getAscent();// magnify to fill box
+          double scl = 0.0;
+          for (int c = 2; c < profl[0];)
+          {
+            dc[0] = (char) profl[c++];
+
+            if (_aa.label.startsWith("StrucConsensus"))
+            {
+              dc[1] = (char) profl[c++];
+            }
+
+            wdth = charWidth;
+            wdth /= fm.charsWidth(dc, 0, dc.length);
+
+            ht += scl;
+            {
+              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());
+              g.setColor(profcolour.findColour(dc[0], column,null));
+
+              hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
+                      .getBaselineIndex()]));
+
+              g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
+            }
+          }
+          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;
+    }
+  }
+}
diff --git a/src/jalview/renderer/AwtRenderPanelI.java b/src/jalview/renderer/AwtRenderPanelI.java
new file mode 100644 (file)
index 0000000..09b8c7c
--- /dev/null
@@ -0,0 +1,25 @@
+package jalview.renderer;
+
+import java.awt.FontMetrics;
+import java.awt.Image;
+import java.awt.image.ImageObserver;
+
+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();
+
+}
index cd0b1e7..33cd4bf 100644 (file)
@@ -1,4 +1,4 @@
-#Wed Aug 03 09:15:24 BST 2011
+#Thu May 24 20:06:46 BST 2012
 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
index a98ab62..8e4bec5 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 0ed8292..068951b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 33fdf99..2155996 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9fd0802..039c227 100644 (file)
@@ -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
@@ -180,6 +163,25 @@ public class Annotation implements java.io.Serializable {
     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;
@@ -251,6 +253,13 @@ public class Annotation implements java.io.Serializable {
 
     /**
      */
+    public void deleteBelowAlignment(
+    ) {
+        this._has_belowAlignment= false;
+    }
+
+    /**
+     */
     public void deleteCentreColLabels(
     ) {
         this._has_centreColLabels= false;
@@ -397,6 +406,34 @@ public class Annotation implements java.io.Serializable {
     }
 
     /**
+     * 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'.
@@ -579,6 +616,16 @@ public class Annotation implements java.io.Serializable {
     }
 
     /**
+     * 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
@@ -701,6 +748,19 @@ public class Annotation implements java.io.Serializable {
     }
 
     /**
+     * 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'.
@@ -887,6 +947,35 @@ public class Annotation implements java.io.Serializable {
     }
 
     /**
+     * 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'.
index 223c652..5f1b1c7 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 7e17396..0432af3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index a5fc601..172ae9e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b93ca1f..bedb407 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 55ac992..50a39a3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index fb2c04e..029b4f4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f109523..9a46e5f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 3ade8c4..e590e3f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e25182f..4e0b408 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index cb83036..c27e083 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index d6d0192..65b1124 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6e6b46c..759e83f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 927f447..41a1580 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 5aa62f8..22c6a96 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index aba37ec..e9f2ae3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6cb7e0d..9d19a0b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e4240f4..1afc99f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6fbc00c..8bd3a2a 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6ea0e09..2101c10 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 69046dc..bf64182 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 32eae8d..c34fd73 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index ab879e4..922086a 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 5432b30..62651df 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 20d36bf..66eb6fa 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b8c1d19..07343c1 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c9e124e..0b98118 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4288229..ab3a399 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index df0f1da..d5afcab 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9b052e1..05367ce 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 39fea56..2feb11e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 653ea68..14f65ae 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 8d24990..50b1428 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b8c7608..65b6108 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 0a0753e..4ae22d3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 3bb565f..b5ebab4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 2b1499f..7998b55 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 0db130f..948d7d0 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index ba7f6a1..4514ba5 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index edfba43..a0994af 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 998bc98..bad96cd 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 30d9c98..44ee825 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c0e7e8f..ce385a0 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 968c661..f12cbbd 100644 (file)
@@ -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
@@ -693,6 +676,84 @@ public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDes
             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
index 644e8af..d481cb2 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 38d8159..64f5c8e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 3618b65..c3782be 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f10d1d7..20e41b1 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b15bad4..7646791 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 29d3f16..fdff616 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 531a24a..b7df12e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 944c9e9..e729dec 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index d87439d..f7509a1 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b99687c..45911d3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 2b5e02a..1eb8d22 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e33e6c5..62866dd 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index bcc6801..4ac8e75 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1c30225..4a58034 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 393eb3f..7b63ce4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c7b217f..ede544f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6edaa47..db3513d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 937b298..17cb1b1 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 516d841..74af98b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f5f95a7..6d41dc5 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1800aa8..1e93ebd 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9728465..3fcf5ec 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 8960603..cbfb4ee 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 2798c1a..d4740a3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4d7daca..f0595d3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e90908f..aa11cfc 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 9638913..f00e6b9 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 44ea42c..2687ccc 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index a01f2f5..faf841e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4d8f645..4cc1dfd 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6b46c5b..93643c5 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6c71d87..7ba9073 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 1fb1b50..7da0970 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 506e479..6ccb291 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 72f0b41..67a7588 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 13ad9f7..c4fc82d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 005a71f..24cfc51 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e265598..6c46d0e 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.schemes;
 
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceI;
 
-import jalview.datamodel.*;
+import java.awt.Color;
 
 public class AnnotationColourGradient extends ResidueColourScheme
 {
@@ -152,7 +154,8 @@ 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;
 
@@ -202,7 +205,7 @@ public class AnnotationColourGradient extends ResidueColourScheme
 
           if (colourScheme != null)
           {
-            currentColour = colourScheme.findColour(c, j);
+            currentColour = colourScheme.findColour(c, j, seq);
           }
           else if (range != 0)
           {
index 3236b55..0f04168 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.schemes;
 
-import java.awt.*;
-
-import jalview.analysis.*;
+import jalview.analysis.AAFrequency;
 
+import java.awt.Color;
+import jalview.datamodel.SequenceI;
 public class Blosum62ColourScheme extends ResidueColourScheme
 {
   public Blosum62ColourScheme()
@@ -28,7 +28,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')
     {
index af85e08..6ccdef5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 309bdc2..d363764 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.schemes;
 
-import java.util.*;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
 
-import java.awt.*;
-
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
 
 public class ClustalxColourScheme extends ResidueColourScheme // implements
 // IParameterizable
@@ -55,13 +59,13 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
     colhash.put("YELLOW", new Color((float) 0.8, (float) 0.8, (float) 0.0));
   }
 
-  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 +86,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;
 
@@ -251,12 +255,14 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements
     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;
 
index fdda463..c56b1bb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.schemes;
 
-import java.awt.*;
+import java.awt.Color;
+import java.util.Map;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
 
 public interface ColourSchemeI
 {
   public Color findColour(char c);
 
-  public Color findColour(char c, int j);
+  public Color findColour(char c, int j, SequenceI seq);
 
   public void setConsensus(java.util.Hashtable[] h);
 
@@ -39,4 +46,6 @@ public interface ColourSchemeI
 
   public void setThreshold(int ct, boolean ignoreGaps);
 
+  public void alignmentChanged(AnnotatedCollectionI alignment, Map<SequenceI, SequenceCollectionI> hiddenReps);
+
 }
index 0f758e0..1e2db76 100755 (executable)
@@ -1,33 +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
- * 
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 
+ * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- * 
- * Jalview is distributed in the hope that it will be useful, but 
- * WITHOUT ANY WARRANTY; without even the implied warranty 
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  * PURPOSE.  See the GNU General Public License for more 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;
 
-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
  * values of the colourscheme constants is important for callers of
  * getColourName(int i), since it can be used to enumerate the set of built in
  * colours. The FIRST_COLOUR and LAST_COLOUR symbols are provided for this.
- * 
+ *
  * @author $author$
  * @version $Revision$
  */
@@ -82,6 +84,9 @@ public class ColourSchemeProperty
 
   public static final int COVARIATION = 14;
 
+  public static final int TCOFFEE = 15;
+
+
   /**
    * index of first colourscheme (includes 'None')
    */
@@ -91,10 +96,10 @@ public class ColourSchemeProperty
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param name
    *          DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
   public static int getColourIndexFromName(String name)
@@ -145,6 +150,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,16 +163,24 @@ public class ColourSchemeProperty
     {
       ret = NONE;
     }
+    else if (name.equalsIgnoreCase("Purine/Pyrimidine"))
+    {
+      ret = PURINEPYRIMIDINE;
+    }
+    // else if (name.equalsIgnoreCase("Covariation"))
+    // {
+    // ret = COVARIATION;
+    // }
 
     return ret;
   }
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param cs
    *          DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
   public static String getColourName(ColourSchemeI cs)
@@ -214,6 +232,17 @@ public class ColourSchemeProperty
     {
       index = NUCLEOTIDE;
     }
+    else if (cs instanceof PurinePyrimidineColourScheme)
+    {
+      index = PURINEPYRIMIDINE;
+    }
+    else if (cs instanceof TCoffeeColourScheme)
+    {
+      index = TCOFFEE;
+    }
+    /*
+     * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
+     */
     else if (cs instanceof UserColourScheme)
     {
       if ((((UserColourScheme) cs).getName() != null)
@@ -230,10 +259,10 @@ public class ColourSchemeProperty
 
   /**
    * DOCUMENT ME!
-   * 
+   *
    * @param index
    *          DOCUMENT ME!
-   * 
+   *
    * @return DOCUMENT ME!
    */
   public static String getColourName(int index)
@@ -296,6 +325,20 @@ public class ColourSchemeProperty
 
       break;
 
+    case PURINEPYRIMIDINE:
+      ret = "Purine/Pyrimidine";
+
+      break;
+
+    case TCOFFEE:
+      ret = "T-Coffee Scores";
+
+      break;
+    /*
+     * case COVARIATION: ret = "Covariation";
+     *
+     * break;
+     */
     case USER_DEFINED:
       ret = "User Defined";
 
@@ -309,26 +352,9 @@ public class ColourSchemeProperty
 
     return ret;
   }
-
-  /**
-   * 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
    *          sequences to colour
    * @param width
@@ -338,7 +364,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 +397,30 @@ 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!
-   * 
-   * @return DOCUMENT ME!
+   *          colourscheme number
+   *
+   * @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 +473,18 @@ public class ColourSchemeProperty
 
       break;
 
+    case PURINEPYRIMIDINE:
+      cs = new PurinePyrimidineColourScheme();
+
+      break;
+
+    case TCOFFEE:
+      cs = new TCoffeeColourScheme(coll);
+    // case COVARIATION:
+    // cs = new CovariationColourScheme(annotation);
+
+    // break;
+
     case USER_DEFINED:
       Color[] col = new Color[24];
       for (int i = 0; i < 24; i++)
index 0c010d5..a2de3c6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/schemes/CovariationColourScheme.java b/src/jalview/schemes/CovariationColourScheme.java
new file mode 100644 (file)
index 0000000..0434574
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * 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;
+  }
+
+}
index 037b6ca..f5c3688 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 32dd06e..ca2bb61 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5714a28..4dd05c1 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 249d87d..2c63ddb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,7 +17,9 @@
  */
 package jalview.schemes;
 
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
 
 /**
  * DOCUMENT ME!
@@ -43,6 +45,7 @@ public class NucleotideColourScheme extends ResidueColourScheme
    * 
    * @return DOCUMENT ME!
    */
+  @Override
   public Color findColour(char c)
   {
     // System.out.println("called"); log.debug
@@ -59,7 +62,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))
index 23a2ee2..5301267 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 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 +37,9 @@ 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 (file)
index 0000000..0498536
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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;
+
+import java.awt.*;
+
+/**
+ * Class is based off of NucleotideColourScheme
+ * 
+ * @author Lauren Michelle Lui
+ */
+public class PurinePyrimidineColourScheme extends ResidueColourScheme
+{
+  /**
+   * Creates a new PurinePyrimidineColourScheme object.
+   */
+  public PurinePyrimidineColourScheme()
+  {
+    super(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 (file)
index 0000000..16f822f
--- /dev/null
@@ -0,0 +1,154 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * 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
+{
+
+  /**
+   * Stores random colors generated for the number of helices
+   */
+  public Hashtable helixcolorhash = new Hashtable();
+
+  /**
+   * Maps sequence positions to the RNA helix they belong to. Key: position,
+   * Value: helix
+   */
+  public Hashtable positionsToHelix = new Hashtable();
+
+  /**
+   * Number of helices in the RNA secondary structure
+   */
+  int numHelix = 0;
+
+  public AlignmentAnnotation annotation;
+
+  /**
+   * Creates a new RNAHelicesColour object.
+   */
+  public RNAHelicesColour(AlignmentAnnotation annotation)
+  {
+    this.annotation = annotation;
+    refresh();
+  }
+
+  private long lastrefresh = -1;
+
+  public void refresh()
+  {
+    if (lastrefresh != annotation._rnasecstr.hashCode() && annotation.isValidStruc())
+    {
+      annotation.getRNAStruc();
+      lastrefresh = annotation._rnasecstr.hashCode();
+      numHelix = 0;
+      positionsToHelix = new Hashtable();
+
+      // 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());
+        }
+
+      }
+
+      // Generate random colors and store
+      for (int j = 0; j <= numHelix; j++)
+      {
+        if (!helixcolorhash.containsKey(Integer.toString(j)))
+        {
+          helixcolorhash.put(Integer.toString(j),
+                  jalview.util.ColorUtils.generateRandomColor(Color.white));
+        }
+      }
+    }
+  }
+
+  /**
+   * Returns default color base on purinepyrimidineIndex in
+   * jalview.schemes.ResidueProperties (Allows coloring in sequence logo)
+   * 
+   * @param c
+   *          Character in sequence
+   * 
+   * @return color in RGB
+   */
+  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
+   *          Threshold
+   * 
+   * @return Color in RGB
+   */
+  public Color findColour(char c, int j)
+  {
+    refresh();
+    Color currentColour = Color.white;
+    String currentHelix = null;
+    currentHelix = (String) 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/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java
new file mode 100644 (file)
index 0000000..39062e7
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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;
+
+import java.util.*;
+import java.awt.event.*;
+
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+/**
+ * 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;
+    }
+
+    currentAnnotation = av.getAlignment().getAlignmentAnnotation()[0];// annotations.getSelectedIndex()];
+
+    RNAHelicesColour rhc = null;
+
+    rhc = new RNAHelicesColour(currentAnnotation);
+   
+    av.setGlobalColourScheme(rhc);
+
+    if (av.getAlignment().getGroups() != null)
+    {
+      for (SequenceGroup sg:ap.getAlignment().getGroups())
+      {
+        if (sg.cs == null)
+        {
+          continue;
+        }
+
+        sg.cs = new RNAHelicesColour(currentAnnotation);
+
+      }
+    }
+
+    ap.paintAlignment(false);
+  }
+
+  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();
+  }
+
+}
index 5402d75..bbba865 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.schemes;
 
-import java.util.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
 
-import java.awt.*;
-
-import jalview.analysis.*;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.Map;
 
 /**
  * DOCUMENT ME!
@@ -82,7 +86,8 @@ public class ResidueColourScheme implements ColourSchemeI
             : colors[ResidueProperties.aaIndex[c]];
   }
 
-  public Color findColour(char c, int j)
+  @Override
+  public Color findColour(char c, int j, SequenceI seq)
   {
     Color currentColour;
 
@@ -102,7 +107,6 @@ public class ResidueColourScheme implements ColourSchemeI
 
     return currentColour;
   }
-
   /**
    * Get the percentage threshold for this colour scheme
    * 
@@ -278,4 +282,10 @@ public class ResidueColourScheme implements ColourSchemeI
     return currentColour;
   }
 
+  @Override
+  public void alignmentChanged(AnnotatedCollectionI alignment,
+          Map<SequenceI, SequenceCollectionI> hiddenReps)
+  {
+  }
+
 }
index bc15298..98b7101 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -30,6 +30,8 @@ public class ResidueProperties
 
   public static final int[] nucleotideIndex;
 
+  public static final int[] purinepyrimidineIndex;
+
   public static final Hashtable aa3Hash = new Hashtable();
 
   public static final Hashtable aa2Triplet = new Hashtable();
@@ -153,6 +155,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
@@ -289,14 +339,22 @@ public class ResidueProperties
       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
@@ -1274,6 +1332,46 @@ public class ResidueProperties
     return ss.toString();
   }
 
+  /**
+   * Used by getRNASecStrucState
+   * 
+   */
+  public static Hashtable toRNAssState;
+  static
+  {
+    toRNAssState = new Hashtable();
+    toRNAssState.put(")", "S");
+    toRNAssState.put("(", "S");
+  }
+
+  /**
+   * 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))
+      {
+        ss.append((String) toRNAssState.get(ssc));
+      }
+      else
+      {
+        ss.append(" ");
+      }
+    }
+    return ss.toString();
+  }
+
   // main method generates perl representation of residue property hash
   // / cut here
   public static void main(String[] args)
index 37dd9e5..116bbd8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,7 +17,9 @@
  */
 package jalview.schemes;
 
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
 
 /**
  * DOCUMENT ME!
@@ -85,7 +87,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)
     {
index 6a4ceec..f5d30a9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 5de9cdb..ef88c38 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/schemes/TCoffeeColourScheme.java b/src/jalview/schemes/TCoffeeColourScheme.java
new file mode 100644 (file)
index 0000000..5a49640
--- /dev/null
@@ -0,0 +1,99 @@
+package jalview.schemes;
+
+import jalview.analysis.SequenceIdMatcher;
+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;
+import java.util.TreeMap;
+
+/**
+ * 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[]>();
+          int w=0;
+          for (AlignmentAnnotation al:alignment.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];
+       }
+}
index 3416a51..ceee169 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 208db8d..a2c1eda 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b6602ea..cdc618e 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,9 +17,9 @@
  */
 package jalview.schemes;
 
-import java.util.*;
-
-import java.awt.*;
+import java.awt.Color;
+import java.util.StringTokenizer;
+import jalview.datamodel.SequenceI;
 
 public class UserColourScheme extends ResidueColourScheme
 {
@@ -201,7 +201,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];
index bc193fd..c6dffe5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5794a42..b91e70f 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
diff --git a/src/jalview/structure/SecondaryStructureListener.java b/src/jalview/structure/SecondaryStructureListener.java
new file mode 100644 (file)
index 0000000..6116ded
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.*;
+
+public interface SecondaryStructureListener
+{
+  //  TODO - redefine to allow RNA mouseovers to be passed back correctly to listeners
+  public void mouseOverSequence(SequenceI sequence, int index);
+}
index c4bb355..3df8863 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1cf7007..1e22e67 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f7ba696..88c3021 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c2d1ecb..5ceefd3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 84e25ba..b706f17 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 44631a8..64cfdda 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f9e8fdb..35e0ea5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -433,9 +433,14 @@ public class StructureSelectionManager
     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);
+        continue;
+      }
+      if (listener instanceof StructureListener)
+      {
+        sl = (StructureListener) listener;
         if (mappings == null)
         {
           continue;
@@ -458,7 +463,7 @@ public class StructureSelectionManager
       else
       {
         if (relaySeqMappings && hasSequenceListeners
-                && listeners.elementAt(i) instanceof SequenceListener)
+                && listener instanceof SequenceListener)
         {
           // DEBUG
           // System.err.println("relay Seq " + seq.getDisplayId(false) + " " +
@@ -493,11 +498,11 @@ public class StructureSelectionManager
           }
           if (hasSequenceListeners)
           {
-            ((SequenceListener) listeners.elementAt(i))
+            ((SequenceListener) listener)
                     .highlightSequence(results);
           }
         }
-        else if (listeners.elementAt(i) instanceof VamsasListener
+        else if (listener instanceof VamsasListener
                 && !handlingVamsasMo)
         {
           // DEBUG
@@ -506,9 +511,12 @@ public class StructureSelectionManager
           // index);
           // pass the mouse over and absolute position onto the
           // VamsasListener(s)
-          ((VamsasListener) listeners.elementAt(i)).mouseOver(seq,
+          ((VamsasListener) listener).mouseOver(seq,
                   indexpos, source);
         }
+        else if(listener instanceof SecondaryStructureListener){
+               ((SecondaryStructureListener) listener).mouseOverSequence(seq,indexpos);
+        }
       }
     }
   }
index af5d720..b94945a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 2e3d78d..683812c 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c2a73f7..ad2e08b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 23324a0..9014de2 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java
new file mode 100644 (file)
index 0000000..f03588e
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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/>.
+ */
+
+/**
+ * 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;
+
+  }
+
+}
index ff4e1a9..f8e1fcd 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 42fbef6..70ef47c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 89d5a5c..d85013c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 581ca4b..b4eb2ab 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b4547be..3c6b05f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e5a0254..2e81276 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8bd19a0..1c633a4 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 392f1f9..3e508eb 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -51,4 +51,23 @@ public class Platform
     // TODO: determine nominal limits for most platforms.\r
     return 2046; // this is the max length for a windows NT system.\r
   }\r
+\r
+  /**\r
+   * escape a string according to the local platform's escape character\r
+   * @param file\r
+   * @return escaped file\r
+   */\r
+  public static String escapeString(String file)\r
+  {\r
+    StringBuffer f=new StringBuffer();\r
+    int p=0,lastp=0;\r
+    while ((p=file.indexOf('\\',lastp))>-1)\r
+    {\r
+      f.append(file.subSequence(lastp,p));\r
+      f.append("\\\\");\r
+      lastp=p+1;\r
+    }\r
+    f.append(file.substring(lastp));\r
+    return f.toString();\r
+  }\r
 }\r
index 94ec1aa..6b77fad 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9fb5eca..e57b872 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index f1a8794..5e9556e 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 84a327a..007b502 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 1f02d31..8f1f051 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java
new file mode 100644 (file)
index 0000000..8c34f31
--- /dev/null
@@ -0,0 +1,1377 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.viewmodel;
+
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.workers.AlignCalcManager;
+import jalview.workers.ConsensusThread;
+import jalview.workers.StrucConsensusThread;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * 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
+{
+  /**
+   * alignment displayed in the viewport. Please use get/setter
+   */
+  protected AlignmentI alignment;
+
+  protected String sequenceSetID;
+
+  /**
+   * probably unused indicator that view is of a dataset rather than an
+   * alignment
+   */
+  protected boolean isDataset = false;
+
+  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;
+
+  /**
+   * gui state - changes to colour scheme propagated to all groups
+   */
+  private boolean colourAppliesToAllGroups;
+
+  /**
+   * @param value
+   *          indicating if subsequent colourscheme changes will be propagated
+   *          to all groups
+   */
+  public void setColourAppliesToAllGroups(boolean b)
+  {
+    colourAppliesToAllGroups = b;
+  }
+
+  /**
+   *
+   *
+   * @return flag indicating if colourchanges propagated to all groups
+   */
+  public boolean getColourAppliesToAllGroups()
+  {
+    return colourAppliesToAllGroups;
+  }
+
+  boolean abovePIDThreshold = false;
+
+  /**
+   * GUI state
+   *
+   * @return true if percent identity threshold is applied to shading
+   */
+  public boolean getAbovePIDThreshold()
+  {
+    return abovePIDThreshold;
+  }
+
+  /**
+   * GUI state
+   *
+   *
+   * @param b
+   *          indicate if percent identity threshold is applied to shading
+   */
+  public void setAbovePIDThreshold(boolean b)
+  {
+    abovePIDThreshold = b;
+  }
+
+  int threshold;
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @param thresh
+   *          DOCUMENT ME!
+   */
+  public void setThreshold(int thresh)
+  {
+    threshold = thresh;
+  }
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @return DOCUMENT ME!
+   */
+  public int getThreshold()
+  {
+    return threshold;
+  }
+
+  int increment;
+
+  /**
+   *
+   * @param inc
+   *          set the scalar for bleaching colourschemes according to degree of
+   *          conservation
+   */
+  public void setIncrement(int inc)
+  {
+    increment = inc;
+  }
+
+  /**
+   * GUI State
+   *
+   * @return get scalar for bleaching colourschemes by conservation
+   */
+  public int getIncrement()
+  {
+    return increment;
+  }
+
+  boolean conservationColourSelected = false;
+
+  /**
+   * GUI state
+   *
+   * @return true if conservation based shading is enabled
+   */
+  public boolean getConservationSelected()
+  {
+    return conservationColourSelected;
+  }
+
+  /**
+   * GUI state
+   *
+   * @param b
+   *          enable conservation based shading
+   */
+  public void setConservationSelected(boolean b)
+  {
+    conservationColourSelected = b;
+  }
+
+  @Override
+  public void setGlobalColourScheme(ColourSchemeI cs)
+  {
+    // TODO: logic refactored from AlignFrame changeColour -
+    // 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;
+    if (getColourAppliesToAllGroups())
+    {
+      for (SequenceGroup sg : getAlignment().getGroups())
+      {
+        if (cs == null)
+        {
+          sg.cs = null;
+          continue;
+        }
+        if (cs instanceof ClustalxColourScheme)
+        {
+          sg.cs = new ClustalxColourScheme(sg, getHiddenRepSequences());
+        }
+        else
+        {
+          try
+          {
+            sg.cs = cs.getClass().newInstance();
+          } catch (Exception ex)
+          {
+            ex.printStackTrace();
+            sg.cs = cs;
+          }
+        }
+
+        if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
+                || cs instanceof Blosum62ColourScheme)
+        {
+          sg.cs.setThreshold(threshold, getIgnoreGapsConsensus());
+          sg.cs.setConsensus(AAFrequency.calculate(
+                  sg.getSequences(getHiddenRepSequences()), 0,
+                  sg.getWidth()));
+        }
+        else
+        {
+          sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+        }
+
+        if (getConservationSelected())
+        {
+          Conservation c = new Conservation("Group",
+                  ResidueProperties.propHash, 3,
+                  sg.getSequences(getHiddenRepSequences()), 0,
+                  getAlignment().getWidth() - 1);
+          c.calculate();
+          c.verdict(false, getConsPercGaps());
+          sg.cs.setConservation(c);
+        }
+        else
+        {
+          sg.cs.setConservation(null);
+          sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+        }
+
+      }
+    }
+
+  }
+
+  @Override
+  public ColourSchemeI getGlobalColourScheme()
+  {
+    return globalColourScheme;
+  }
+
+  protected AlignmentAnnotation consensus;
+
+  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 secondary structure base pair consensus for visible portion of
+   * view
+   */
+  protected Hashtable[] hStrucConsensus = null;
+
+  /**
+   * 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 Hashtable[] getSequenceConsensusHash()
+  {
+    return hconsensus;
+  }
+
+  @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 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));
+    }
+  }
+
+  // --------START Structure Conservation
+  public void updateStrucConsensus(final AlignmentViewPanel ap)
+  {
+    if (autoCalculateStrucConsensus && strucConsensus == null
+            && alignment.isNucleotide() && alignment.hasRNAStructure())
+    {
+
+    }
+
+    // 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(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;
+  }
+
+  /**
+   * show non-conserved residues only
+   */
+  protected boolean showUnconserved = false;
+
+  /**
+   * 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;
+
+  public boolean getShowUnconserved()
+  {
+    return showUnconserved;
+  }
+
+  public void setShowUnconserved(boolean showunconserved)
+  {
+    showUnconserved = showunconserved;
+  }
+
+  /**
+   * @param showNonconserved
+   *          the showUnconserved to set
+   */
+  public void setShowunconserved(boolean displayNonconserved)
+  {
+    this.showUnconserved = displayNonconserved;
+  }
+
+  /**
+   *
+   *
+   * @return null or the currently selected sequence region
+   */
+  public SequenceGroup getSelectionGroup()
+  {
+    return selectionGroup;
+  }
+
+  /**
+   * Set the selection group for this window.
+   *
+   * @param sg
+   *          - group holding references to sequences in this alignment view
+   *
+   */
+  public void setSelectionGroup(SequenceGroup sg)
+  {
+    selectionGroup = sg;
+  }
+
+  public void setHiddenColumns(ColumnSelection colsel)
+  {
+    this.colSel = colsel;
+    if (colSel.getHiddenColumns() != null)
+    {
+      hasHiddenColumns = true;
+    }
+  }
+
+  @Override
+  public ColumnSelection getColumnSelection()
+  {
+    return colSel;
+  }
+
+  public void setColumnSelection(ColumnSelection colSel)
+  {
+    this.colSel = colSel;
+  }
+
+  /**
+   *
+   * @return
+   */
+  @Override
+  public Map<SequenceI, SequenceCollectionI> getHiddenRepSequences()
+  {
+    return hiddenRepSequences;
+  }
+
+  @Override
+  public void setHiddenRepSequences(
+          Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+  {
+    this.hiddenRepSequences = hiddenRepSequences;
+  }
+
+  protected boolean hasHiddenColumns = false;
+
+  public void updateHiddenColumns()
+  {
+    hasHiddenColumns = colSel.getHiddenColumns() != null;
+  }
+
+  protected boolean hasHiddenRows = false;
+
+  public boolean hasHiddenRows()
+  {
+    return hasHiddenRows;
+  }
+
+  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);
+  }
+
+  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;
+
+  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 getIgnoreGapsConsensus()
+  {
+    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;
+
+  /**
+   * 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);
+
+    hasHiddenColumns = true;
+  }
+
+  public void hideColumns(int start, int end)
+  {
+    if (start == end)
+    {
+      colSel.hideColumns(start);
+    }
+    else
+    {
+      colSel.hideColumns(start, end);
+    }
+
+    hasHiddenColumns = true;
+  }
+
+  public void showColumn(int col)
+  {
+    colSel.revealHiddenColumns(col);
+    if (colSel.getHiddenColumns() == null)
+    {
+      hasHiddenColumns = false;
+    }
+  }
+
+  public void showAllHiddenColumns()
+  {
+    colSel.revealAllHiddenColumns();
+    hasHiddenColumns = false;
+  }
+
+  // common hide/show seq stuff
+  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);
+      }
+
+      hasHiddenRows = false;
+      hiddenRepSequences = null;
+
+      firePropertyChange("alignment", null, alignment.getSequences());
+      // used to set hasHiddenRows/hiddenRepSequences here, after the property
+      // changed event
+      sendSelection();
+    }
+  }
+
+  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);
+      }
+      // JBPNote: refactor: only update flag if we modified visiblity (used to
+      // do this regardless)
+      if (alignment.getHiddenSequences().getSize() < 1)
+      {
+        hasHiddenRows = false;
+      }
+      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]);
+      }
+      hasHiddenRows = true;
+      firePropertyChange("alignment", null, alignment.getSequences());
+    }
+  }
+
+  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 hiddenRepSequences != null
+            && hiddenRepSequences.containsKey(seq);
+  }
+
+  public SequenceGroup getRepresentedSequences(SequenceI seq)
+  {
+    return (SequenceGroup) (hiddenRepSequences == null ? null
+            : hiddenRepSequences.get(seq));
+  }
+
+  public int adjustForHiddenSeqs(int alignmentIndex)
+  {
+    return alignment.getHiddenSequences().adjustForHiddenSeqs(
+            alignmentIndex);
+  }
+
+  // Selection manipulation
+  /**
+   * broadcast selection to any interested parties
+   */
+  public abstract void sendSelection();
+
+  public void invertColumnSelection()
+  {
+    colSel.invertColumnSelection(0, alignment.getWidth());
+  }
+
+  /**
+   * 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;
+    // 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)
+    {
+      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;
+  }
+
+  /**
+   * 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
+   */
+  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;
+
+  }
+
+  /**
+   * @return the padGaps
+   */
+  public boolean isPadGaps()
+  {
+    return padGaps;
+  }
+
+  /**
+   * @param padGaps
+   *          the padGaps to set
+   */
+  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
+   */
+  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, null);
+
+      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())
+      {
+        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);
+          }
+        }
+        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);
+          }
+        }
+      }
+      else
+      {
+        if (alignment.hasRNAStructure())
+        {
+          strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID",
+                  new Annotation[1], 0f, 100f,
+                  AlignmentAnnotation.BAR_GRAPH);
+          strucConsensus.hasText = true;
+          strucConsensus.autoCalculated = true;
+        }
+      }
+
+      consensus = new AlignmentAnnotation("Consensus", "PID",
+              new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+      consensus.hasText = true;
+      consensus.autoCalculated = true;
+
+      if (showConsensus)
+      {
+        alignment.addAnnotation(consensus);
+        if (strucConsensus != null)
+        {
+          alignment.addAnnotation(strucConsensus);
+        }
+      }
+    }
+  }
+
+}
diff --git a/src/jalview/workers/AlignCalcManager.java b/src/jalview/workers/AlignCalcManager.java
new file mode 100644 (file)
index 0000000..bc5e8e3
--- /dev/null
@@ -0,0 +1,318 @@
+package jalview.workers;
+
+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 jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentAnnotation;
+
+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[0]);
+    }
+    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());
+      }
+    }
+  }
+}
diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java
new file mode 100644 (file)
index 0000000..19a92fb
--- /dev/null
@@ -0,0 +1,53 @@
+/**
+ * 
+ */
+package jalview.workers;
+
+import java.util.List;
+
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * 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);
+  }
+  
+  // TODO: allow GUI to query workers associated with annotation to add items to annotation label panel popup menu
+
+}
diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java
new file mode 100644 (file)
index 0000000..9bdd714
--- /dev/null
@@ -0,0 +1,134 @@
+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.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 = alignViewport.getAlignmentConsensusAnnotation();
+      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();
+      }
+      AlignmentI alignment = alignViewport.getAlignment();
+
+      int aWidth = -1;
+
+      if (alignment == null || (aWidth = alignment.getWidth()) < 0)
+      {
+        calcMan.workerComplete(this);
+        // .updatingConservation = false;
+        // AlignViewport.UPDATING_CONSERVATION = false;
+
+        return;
+      }
+      consensus = alignViewport
+              .getAlignmentConsensusAnnotation();
+
+      consensus.annotations = null;
+      consensus.annotations = new Annotation[aWidth];
+      Hashtable[] hconsensus = alignViewport.getSequenceConsensusHash();
+      hconsensus = new Hashtable[aWidth];
+      try {
+       AAFrequency.calculate(alignment.getSequencesArray(), 0,
+              alignment.getWidth(), hconsensus, true);
+      } catch (ArrayIndexOutOfBoundsException x){
+        // this happens due to a race condition -
+        // alignment was edited at same time as calculation was running
+        //
+//        calcMan.workerCannotRun(this);
+        calcMan.workerComplete(this);
+        return;
+      }
+      alignViewport.setSequenceConsensusHash(hconsensus);
+      updateResultAnnotation(true);
+      ColourSchemeI globalColourScheme = alignViewport
+              .getGlobalColourScheme();
+      if (globalColourScheme != null)
+      {
+        globalColourScheme.setConsensus(hconsensus);
+      }
+
+    } catch (OutOfMemoryError error)
+    {
+      calcMan.workerCannotRun(this);
+
+      // consensus = null;
+      // hconsensus = null;
+      ap.raiseOOMWarning("calculating consensus", error);
+    }
+
+    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)
+  {
+    AlignmentAnnotation consensus = alignViewport
+            .getAlignmentConsensusAnnotation();
+    Hashtable[] hconsensus = alignViewport.getSequenceConsensusHash();
+    if (immediate || !calcMan.isWorking(this) && consensus!=null && hconsensus!=null)
+    {
+      AAFrequency.completeConsensus(consensus, hconsensus, 0,
+            hconsensus.length, alignViewport.getIgnoreGapsConsensus(),
+            alignViewport.isShowSequenceLogo());
+    }
+  }
+}
diff --git a/src/jalview/workers/ConservationThread.java b/src/jalview/workers/ConservationThread.java
new file mode 100644 (file)
index 0000000..194c389
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.workers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+
+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();
+      }
+      List<AlignmentAnnotation>ourAnnot = new ArrayList<AlignmentAnnotation>();
+      AlignmentI alignment=alignViewport.getAlignment();
+      conservation=alignViewport.getAlignmentConservationAnnotation();
+      quality=alignViewport.getAlignmentQualityAnnot();
+      ourAnnot.add(conservation);
+      ourAnnot.add(quality);
+      ourAnnots = ourAnnot;
+
+      // 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)
+    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 (file)
index 0000000..a7f919b
--- /dev/null
@@ -0,0 +1,148 @@
+package jalview.workers;
+
+import java.util.Hashtable;
+
+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;
+
+public class StrucConsensusThread extends AlignCalcWorker implements
+        AlignCalcWorkerI
+{
+  public StrucConsensusThread(AlignViewportI alignViewport,
+          AlignmentViewPanel alignPanel)
+  {
+    super(alignViewport, alignPanel);
+  }
+
+  AlignmentAnnotation strucConsensus;
+
+  Hashtable[] hStrucConsensus;
+
+  @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();
+      }
+      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].getRNAStruc() != null && aa[i].isValidStruc())
+        {
+          rnaStruc = aa[i];
+          break;
+        }
+      }
+      // check to see if its valid
+
+      if (rnaStruc == null || !rnaStruc.isValidStruc())
+      {
+        calcMan.workerComplete(this);
+        return;
+      }
+
+      try {
+              jalview.analysis.StructureFrequency.calculate(
+              alignment.getSequencesArray(), 0, alignment.getWidth(),
+              hStrucConsensus, true, rnaStruc);
+      } catch (ArrayIndexOutOfBoundsException x)
+      {
+        calcMan.workerComplete(this);
+        return;
+      }
+      alignViewport.setRnaStructureConsensusHash(hStrucConsensus);
+      // TODO AlignmentAnnotation rnaStruc!!!
+      updateResultAnnotation(true);
+      if (alignViewport.getGlobalColourScheme() != null)
+      {
+        alignViewport.getGlobalColourScheme().setConsensus(hStrucConsensus);
+      }
+
+    } 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.getIgnoreGapsConsensus(),
+              alignViewport.isShowSequenceLogo());
+    }
+  }
+
+}
\ No newline at end of file
index 108ca03..7d174bc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1b89758..5c6a716 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d235410..1886172 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -30,15 +30,17 @@ import jalview.gui.CutAndPasteTransfer;
 import jalview.gui.Desktop;\r
 import jalview.gui.IProgressIndicator;\r
 import jalview.gui.OOMWarning;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.seqfetcher.DbSourceProxy;\r
 \r
 import java.lang.reflect.Array;\r
+import java.util.ArrayList;\r
 import java.util.Enumeration;\r
 import java.util.Hashtable;\r
+import java.util.List;\r
 import java.util.StringTokenizer;\r
 import java.util.Vector;\r
 \r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-\r
 import uk.ac.ebi.picr.model.UPEntry;\r
 \r
 /**\r
@@ -69,7 +71,7 @@ public class DBRefFetcher implements Runnable
   // The key will be the seq name or accession id of the seq\r
   Hashtable seqRefs;\r
 \r
-  String[] dbSources;\r
+  DbSourceProxy[] dbSources;\r
 \r
   SequenceFetcher sfetcher;\r
 \r
@@ -104,7 +106,7 @@ public class DBRefFetcher implements Runnable
    * @param sources\r
    *          array of database source strings to query references from\r
    */\r
-  public DBRefFetcher(SequenceI[] seqs, AlignFrame af, String[] sources)\r
+  public DBRefFetcher(SequenceI[] seqs, AlignFrame af, DbSourceProxy[] sources)\r
   {\r
     this.af = af;\r
     alseqs = new SequenceI[seqs.length];\r
@@ -124,26 +126,20 @@ public class DBRefFetcher implements Runnable
     {\r
       // af.featureSettings_actionPerformed(null);\r
       String[] defdb = null, otherdb = sfetcher\r
-              .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);\r
-      Vector selsources = new Vector(), dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
+              .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
+      List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();\r
+      Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
               .getSelectedSources() : new jalview.gui.DasSourceBrowser()\r
               .getSelectedSources();\r
-      Enumeration en = dasselsrc.elements();\r
+      Enumeration<jalviewSourceI> en = dasselsrc.elements();\r
       while (en.hasMoreElements())\r
       {\r
-        DasSource src = (DasSource) en.nextElement();\r
-        selsources.addElement(src.getNickname());\r
-      }\r
-      int osel = 0;\r
-      for (int o = 0; otherdb != null && o < otherdb.length; o++)\r
-      {\r
-        if (!selsources.contains(otherdb[o]))\r
+        jalviewSourceI src = en.nextElement();\r
+        List<DbSourceProxy> sp=src.getSequenceSourceProxies();\r
+        selsources.addAll(sp);\r
+        if (sp.size()>1)\r
         {\r
-          otherdb[o] = null;\r
-        }\r
-        else\r
-        {\r
-          osel++;\r
+          Cache.log.debug("Added many Db Sources for :"+src.getTitle());\r
         }\r
       }\r
       // select appropriate databases based on alignFrame context.\r
@@ -155,17 +151,14 @@ public class DBRefFetcher implements Runnable
       {\r
         defdb = DBRefSource.PROTEINDBS;\r
       }\r
-      // append the selected sequence sources to the default dbs\r
-      dbSources = new String[defdb.length + osel];\r
-      System.arraycopy(defdb, 0, dbSources, 0, defdb.length);\r
-      for (int o = 0, op = defdb.length; otherdb != null\r
-              && o < otherdb.length; o++)\r
-      {\r
-        if (otherdb[o] != null)\r
-        {\r
-          dbSources[op++] = otherdb[o];\r
-        }\r
+      List<DbSourceProxy> srces=new ArrayList<DbSourceProxy>();\r
+      for (String ddb:defdb) {\r
+        srces.addAll(sfetcher.getSourceProxy(ddb));\r
       }\r
+      \r
+      // append the selected sequence sources to the default dbs\r
+      srces.addAll(selsources);\r
+      dbSources = srces.toArray(new DbSourceProxy[0]);\r
     }\r
     else\r
     {\r
@@ -183,15 +176,14 @@ public class DBRefFetcher implements Runnable
   {\r
     if (dbSources == null)\r
     {\r
-      dbSources = new String[]\r
-      {};\r
+      dbSources = new DbSourceProxy[0];\r
     }\r
     // append additional sources\r
-    String[] otherdb = sfetcher\r
-            .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);\r
+    DbSourceProxy[] otherdb=sfetcher\r
+            .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
     if (otherdb != null && otherdb.length > 0)\r
     {\r
-      String[] newsrc = new String[dbSources.length + otherdb.length];\r
+      DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length + otherdb.length];\r
       System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);\r
       System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);\r
       dbSources = newsrc;\r
@@ -295,25 +287,9 @@ public class DBRefFetcher implements Runnable
     while (sdataset.size() > 0 && db < dbSources.length)\r
     {\r
       int maxqlen = 1; // default number of queries made to at one time\r
-      System.err.println("Verifying against " + dbSources[db]);\r
-      jalview.ws.seqfetcher.DbSourceProxy dbsource = sfetcher\r
-              .getSourceProxy(dbSources[db]);\r
-      if (dbsource == null)\r
-      {\r
-        System.err.println("No proxy for " + dbSources[db]);\r
-        db++;\r
-        continue;\r
-      }\r
-      if (dbsource.getDbSourceProperties()\r
-              .containsKey(DBRefSource.MULTIACC))\r
-      {\r
-        maxqlen = ((Integer) dbsource.getDbSourceProperties().get(\r
-                DBRefSource.MULTIACC)).intValue();\r
-      }\r
-      else\r
-      {\r
-        maxqlen = 1;\r
-      }\r
+      System.err.println("Verifying against " + dbSources[db].getDbName());\r
+      boolean dn = false;\r
+\r
       // iterate through db for each remaining un-verified sequence\r
       SequenceI[] currSeqs = new SequenceI[sdataset.size()];\r
       sdataset.copyInto(currSeqs);// seqs that are to be validated against\r
@@ -323,116 +299,132 @@ public class DBRefFetcher implements Runnable
 \r
       int seqIndex = 0;\r
 \r
-      while (queries.size() > 0 || seqIndex < currSeqs.length)\r
+      jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];\r
       {\r
-        if (queries.size() > 0)\r
+        // for moment, we dumbly iterate over all retrieval sources for a particular database\r
+        // TODO: introduce multithread multisource queries and logic to remove a query from other sources if any source for a database returns a record\r
+        if (dbsource.getDbSourceProperties().containsKey(\r
+                DBRefSource.MULTIACC))\r
         {\r
-          // Still queries to make for current seqIndex\r
-          StringBuffer queryString = new StringBuffer("");\r
-          int numq = 0, nqSize = (maxqlen > queries.size()) ? queries\r
-                  .size() : maxqlen;\r
-\r
-          while (queries.size() > 0 && numq < nqSize)\r
+          maxqlen = ((Integer) dbsource.getDbSourceProperties().get(\r
+                  DBRefSource.MULTIACC)).intValue();\r
+        }\r
+        else\r
+        {\r
+          maxqlen = 1;\r
+        }\r
+        while (queries.size() > 0 || seqIndex < currSeqs.length)\r
+        {\r
+          if (queries.size() > 0)\r
           {\r
-            String query = (String) queries.elementAt(0);\r
-            if (dbsource.isValidReference(query))\r
+            // Still queries to make for current seqIndex\r
+            StringBuffer queryString = new StringBuffer("");\r
+            int numq = 0, nqSize = (maxqlen > queries.size()) ? queries\r
+                    .size() : maxqlen;\r
+\r
+            while (queries.size() > 0 && numq < nqSize)\r
             {\r
-              queryString.append((numq == 0) ? "" : dbsource\r
-                      .getAccessionSeparator());\r
-              queryString.append(query);\r
-              numq++;\r
+              String query = (String) queries.elementAt(0);\r
+              if (dbsource.isValidReference(query))\r
+              {\r
+                queryString.append((numq == 0) ? "" : dbsource\r
+                        .getAccessionSeparator());\r
+                queryString.append(query);\r
+                numq++;\r
+              }\r
+              // remove the extracted query string\r
+              queries.removeElementAt(0);\r
             }\r
-            // remove the extracted query string\r
-            queries.removeElementAt(0);\r
-          }\r
-          // make the queries and process the response\r
-          AlignmentI retrieved = null;\r
-          try\r
-          {\r
-            if (jalview.bin.Cache.log.isDebugEnabled())\r
+            // make the queries and process the response\r
+            AlignmentI retrieved = null;\r
+            try\r
+            {\r
+              if (jalview.bin.Cache.log.isDebugEnabled())\r
+              {\r
+                jalview.bin.Cache.log.debug("Querying "\r
+                        + dbsource.getDbName() + " with : '"\r
+                        + queryString.toString() + "'");\r
+              }\r
+              retrieved = dbsource.getSequenceRecords(queryString\r
+                      .toString());\r
+            } catch (Exception ex)\r
             {\r
-              jalview.bin.Cache.log.debug("Querying "\r
-                      + dbsource.getDbName() + " with : '"\r
-                      + queryString.toString() + "'");\r
+              ex.printStackTrace();\r
+            } catch (OutOfMemoryError err)\r
+            {\r
+              new OOMWarning("retrieving database references ("\r
+                      + queryString.toString() + ")", err);\r
+            }\r
+            if (retrieved != null)\r
+            {\r
+              transferReferences(sdataset, dbsource.getDbSource(), retrieved);\r
             }\r
-            retrieved = dbsource.getSequenceRecords(queryString.toString());\r
-          } catch (Exception ex)\r
-          {\r
-            ex.printStackTrace();\r
-          } catch (OutOfMemoryError err)\r
-          {\r
-            new OOMWarning("retrieving database references ("\r
-                    + queryString.toString() + ")", err);\r
-          }\r
-          if (retrieved != null)\r
-          {\r
-            transferReferences(sdataset, dbSources[db], retrieved);\r
           }\r
-        }\r
-        else\r
-        {\r
-          // make some more strings for use as queries\r
-          for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)\r
+          else\r
           {\r
-            SequenceI sequence = dataset[seqIndex];\r
-            DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
-                    sequence.getDBRef(), new String[]\r
-                    { dbSources[db] }); // jalview.datamodel.DBRefSource.UNIPROT\r
-            // });\r
-            // check for existing dbrefs to use\r
-            if (uprefs != null && uprefs.length > 0)\r
+            // make some more strings for use as queries\r
+            for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)\r
             {\r
-              for (int j = 0; j < uprefs.length; j++)\r
+              SequenceI sequence = dataset[seqIndex];\r
+              DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
+                      sequence.getDBRef(), new String[]\r
+                      { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT\r
+              // });\r
+              // check for existing dbrefs to use\r
+              if (uprefs != null && uprefs.length > 0)\r
               {\r
-                addSeqId(sequence, uprefs[j].getAccessionId());\r
-                queries.addElement(uprefs[j].getAccessionId().toUpperCase());\r
+                for (int j = 0; j < uprefs.length; j++)\r
+                {\r
+                  addSeqId(sequence, uprefs[j].getAccessionId());\r
+                  queries.addElement(uprefs[j].getAccessionId()\r
+                          .toUpperCase());\r
+                }\r
               }\r
-            }\r
-            else\r
-            {\r
-              // generate queries from sequence ID string\r
-              StringTokenizer st = new StringTokenizer(sequence.getName(),\r
-                      "|");\r
-              while (st.hasMoreTokens())\r
+              else\r
               {\r
-                String token = st.nextToken();\r
-                UPEntry[] presp = null;\r
-                if (picrClient != null)\r
+                // generate queries from sequence ID string\r
+                StringTokenizer st = new StringTokenizer(\r
+                        sequence.getName(), "|");\r
+                while (st.hasMoreTokens())\r
                 {\r
-                  // resolve the string against PICR to recover valid IDs\r
-                  try\r
+                  String token = st.nextToken();\r
+                  UPEntry[] presp = null;\r
+                  if (picrClient != null)\r
                   {\r
-                    presp = picrClient\r
-                            .getUPIForAccession(token, null,\r
-                                    picrClient.getMappedDatabaseNames(),\r
-                                    null, true);\r
-                  } catch (Exception e)\r
+                    // resolve the string against PICR to recover valid IDs\r
+                    try\r
+                    {\r
+                      presp = picrClient.getUPIForAccession(token, null,\r
+                              picrClient.getMappedDatabaseNames(), null,\r
+                              true);\r
+                    } catch (Exception e)\r
+                    {\r
+                      System.err.println("Exception with Picr for '"\r
+                              + token + "'\n");\r
+                      e.printStackTrace();\r
+                    }\r
+                  }\r
+                  if (presp != null && presp.length > 0)\r
                   {\r
-                    System.err.println("Exception with Picr for '" + token\r
-                            + "'\n");\r
-                    e.printStackTrace();\r
+                    for (int id = 0; id < presp.length; id++)\r
+                    {\r
+                      // construct sequences from response if sequences are\r
+                      // present, and do a transferReferences\r
+                      // otherwise transfer non sequence x-references directly.\r
+                    }\r
+                    System.out\r
+                            .println("Validated ID against PICR... (for what its worth):"\r
+                                    + token);\r
+                    addSeqId(sequence, token);\r
+                    queries.addElement(token.toUpperCase());\r
                   }\r
-                }\r
-                if (presp != null && presp.length > 0)\r
-                {\r
-                  for (int id = 0; id < presp.length; id++)\r
+                  else\r
                   {\r
-                    // construct sequences from response if sequences are\r
-                    // present, and do a transferReferences\r
-                    // otherwise transfer non sequence x-references directly.\r
+                    // if ()\r
+                    // System.out.println("Not querying source with token="+token+"\n");\r
+                    addSeqId(sequence, token);\r
+                    queries.addElement(token.toUpperCase());\r
                   }\r
-                  System.out\r
-                          .println("Validated ID against PICR... (for what its worth):"\r
-                                  + token);\r
-                  addSeqId(sequence, token);\r
-                  queries.addElement(token.toUpperCase());\r
-                }\r
-                else\r
-                {\r
-                  // if ()\r
-                  // System.out.println("Not querying source with token="+token+"\n");\r
-                  addSeqId(sequence, token);\r
-                  queries.addElement(token.toUpperCase());\r
                 }\r
               }\r
             }\r
index bf200ce..bef6425 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
  */\r
 package jalview.ws;\r
 \r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import javax.swing.*;\r
-\r
-import org.biojava.dasobert.das.*;\r
-import org.biojava.dasobert.das2.*;\r
-import org.biojava.dasobert.das2.io.*;\r
-import org.biojava.dasobert.dasregistry.*;\r
-import org.biojava.dasobert.eventmodel.*;\r
 import jalview.bin.Cache;\r
-import jalview.datamodel.*;\r
-import jalview.gui.*;\r
+import jalview.datamodel.DBRefEntry;\r
+import jalview.datamodel.SequenceFeature;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.gui.AlignFrame;\r
+import jalview.gui.Desktop;\r
+import jalview.gui.FeatureSettings;\r
 import jalview.util.UrlLink;\r
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Enumeration;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Set;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JOptionPane;\r
+\r
+import org.biodas.jdas.client.FeaturesClient;\r
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter;\r
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;\r
+import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;\r
+import org.biodas.jdas.schema.features.ERRORSEGMENT;\r
+import org.biodas.jdas.schema.features.FEATURE;\r
+import org.biodas.jdas.schema.features.LINK;\r
+import org.biodas.jdas.schema.features.SEGMENT;\r
+import org.biodas.jdas.schema.features.TYPE;\r
+import org.biodas.jdas.schema.features.UNKNOWNFEATURE;\r
+import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -48,7 +71,7 @@ public class DasSequenceFeatureFetcher
 \r
   StringBuffer sbuffer = new StringBuffer();\r
 \r
-  Vector selectedSources;\r
+  List<jalviewSourceI> selectedSources;\r
 \r
   boolean cancelled = false;\r
 \r
@@ -75,6 +98,8 @@ public class DasSequenceFeatureFetcher
 \r
   long startTime;\r
 \r
+  private DasSourceRegistryI sourceRegistry;\r
+  private boolean useJDASMultiThread=true;\r
   /**\r
    * Creates a new SequenceFeatureFetcher object. Uses default\r
    * \r
@@ -86,22 +111,27 @@ public class DasSequenceFeatureFetcher
   public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
           FeatureSettings fsettings, Vector selectedSources)\r
   {\r
-    this(sequences, fsettings, selectedSources, true, true);\r
+    this(sequences, fsettings, selectedSources, true, true, true);\r
   }\r
 \r
   public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
-          FeatureSettings fsettings, Vector ourselectedSources,\r
+          FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
           boolean checkDbrefs, boolean promptFetchDbrefs)\r
   {\r
-    this.selectedSources = new Vector();\r
-    Enumeration sources = ourselectedSources.elements();\r
+    this(oursequences,fsettings,selectedSources2,checkDbrefs,promptFetchDbrefs,true);\r
+  }\r
+  public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
+          FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
+          boolean checkDbrefs, boolean promptFetchDbrefs, boolean useJDasMultiThread)\r
+  {\r
+    this.useJDASMultiThread=useJDasMultiThread;\r
+    this.selectedSources = new ArrayList<jalviewSourceI>();\r
     // filter both sequences and sources to eliminate duplicates\r
-    while (sources.hasMoreElements())\r
+    for (jalviewSourceI src : selectedSources2)\r
     {\r
-      Object src = sources.nextElement();\r
       if (!selectedSources.contains(src))\r
       {\r
-        selectedSources.addElement(src);\r
+        selectedSources.add(src);\r
       }\r
       ;\r
     }\r
@@ -125,15 +155,13 @@ public class DasSequenceFeatureFetcher
       af.setShowSeqFeatures(true);\r
     }\r
     int uniprotCount = 0;\r
-    for (int i = 0; i < selectedSources.size(); i++)\r
+    for (jalviewSourceI source : selectedSources)\r
     {\r
-      DasSource source = (DasSource) selectedSources.elementAt(i);\r
-      DasCoordinateSystem[] coords = source.getCoordinateSystem();\r
-      for (int c = 0; c < coords.length; c++)\r
+      for (COORDINATES coords : source.getVersion().getCOORDINATES())\r
       {\r
         // TODO: match UniProt coord system canonically (?) - does\r
         // UniProt==uniprot==UNIPROT ?\r
-        if (coords[c].getName().indexOf("UniProt") > -1)\r
+        if (coords.getAuthority().toLowerCase().equals("uniprot"))\r
         {\r
           uniprotCount++;\r
           break;\r
@@ -182,45 +210,61 @@ public class DasSequenceFeatureFetcher
       }\r
       else\r
       {\r
-        startFetching();\r
+        _startFetching();\r
       }\r
     }\r
     else\r
     {\r
-      startFetching();\r
+      _startFetching();\r
     }\r
 \r
   }\r
-\r
+  private void _startFetching()\r
+  {\r
+    running=true;\r
+    new Thread(new FetchSeqFeatures()).start();\r
+  }\r
+  class FetchSeqFeatures implements Runnable\r
+  {\r
+    public void run()\r
+    {\r
+      startFetching();\r
+      setGuiFetchComplete();\r
+    }\r
+  }\r
   class FetchDBRefs implements Runnable\r
   {\r
     public void run()\r
     {\r
+      running=true;\r
       new DBRefFetcher(sequences, af).fetchDBRefs(true);\r
       startFetching();\r
+      setGuiFetchComplete();\r
     }\r
   }\r
 \r
   /**\r
-   * Spawns a number of dasobert Fetcher threads to add features to sequences in\r
-   * the dataset\r
+   * Spawns Fetcher threads to add features to sequences in the dataset\r
    */\r
   void startFetching()\r
   {\r
+    running=true;\r
     cancelled = false;\r
     startTime = System.currentTimeMillis();\r
     if (af != null)\r
     {\r
       af.setProgressBar("Fetching DAS Sequence Features", startTime);\r
     }\r
-\r
+    if (sourceRegistry == null)\r
+    {\r
+      sourceRegistry = Cache.getDasSourceRegistry();\r
+    }\r
     if (selectedSources == null || selectedSources.size() == 0)\r
     {\r
       try\r
       {\r
-        DasSource[] sources = new jalview.gui.DasSourceBrowser()\r
-                .getDASSource();\r
-\r
+        jalviewSourceI[] sources = sourceRegistry.getSources().toArray(\r
+                new jalviewSourceI[0]);\r
         String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",\r
                 "uniprot");\r
         StringTokenizer st = new StringTokenizer(active, "\t");\r
@@ -231,9 +275,9 @@ public class DasSequenceFeatureFetcher
           token = st.nextToken();\r
           for (int i = 0; i < sources.length; i++)\r
           {\r
-            if (sources[i].getNickname().equals(token))\r
+            if (sources[i].getTitle().equals(token))\r
             {\r
-              selectedSources.addElement(sources[i]);\r
+              selectedSources.add(sources[i]);\r
               break;\r
             }\r
           }\r
@@ -254,14 +298,213 @@ public class DasSequenceFeatureFetcher
     }\r
 \r
     sourcesRemaining = selectedSources.size();\r
+    FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();\r
+    fc.setConnProps(sourceRegistry.getSessionHandler());\r
     // Now sending requests one at a time to each server\r
-    for (int sourceIndex = 0; sourceIndex < selectedSources.size()\r
-            && !cancelled; sourceIndex++)\r
+    ArrayList<jalviewSourceI> srcobj = new ArrayList<jalviewSourceI>();\r
+    ArrayList<String> src = new ArrayList<String>();\r
+    List<List<String>> ids = new ArrayList<List<String>>();\r
+    List<List<DBRefEntry>> idobj = new ArrayList<List<DBRefEntry>>();\r
+    List<Map<String, SequenceI>> sqset = new ArrayList<Map<String, SequenceI>>();\r
+    for (jalviewSourceI _sr : selectedSources)\r
+    {\r
+\r
+      Map<String, SequenceI> slist = new HashMap<String, SequenceI>();\r
+      List<DBRefEntry> idob = new ArrayList<DBRefEntry>();\r
+      List<String> qset = new ArrayList<String>();\r
+\r
+      for (SequenceI seq : sequences)\r
+      {\r
+        Object[] idset = nextSequence(_sr, seq);\r
+        if (idset != null)\r
+        {\r
+          List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];\r
+          List<String> _qset = (List<String>) idset[1];\r
+          if (_idob.size() > 0)\r
+          {\r
+            // add sequence's ref for each id derived from it\r
+            // (space inefficient, but most unambiguous)\r
+            // could replace with hash with _qset values as keys.\r
+            Iterator<DBRefEntry> dbobj = _idob.iterator();\r
+            for (String q : _qset)\r
+            {\r
+              SequenceI osq = slist.get(q);\r
+              DBRefEntry dr = dbobj.next();\r
+              if (osq != null && osq != seq)\r
+              {\r
+                // skip - non-canonical query\r
+              }\r
+              else\r
+              {\r
+                idob.add(dr);\r
+                qset.add(q);\r
+                slist.put(q, seq);\r
+              }\r
+            }\r
+          }\r
+        }\r
+      }\r
+      if (idob.size() > 0)\r
+      {\r
+        srcobj.add(_sr);\r
+        src.add(_sr.getSourceURL());\r
+        ids.add(qset);\r
+        idobj.add(idob);\r
+        sqset.add(slist);\r
+      }\r
+    }\r
+    Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
+    Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();\r
+    if (!useJDASMultiThread)\r
+    {\r
+      Iterator<String> sources=src.iterator();\r
+      // iterate over each query for each source and do each one individually\r
+      for (List<String> idl:ids)\r
+      {\r
+        String source=sources.next();\r
+        FeaturesClient featuresc=new FeaturesClient(sourceRegistry.getSessionHandler().getConnectionPropertyProviderFor(source));\r
+        for (String id:idl)\r
+        {\r
+          List<String> qid=Arrays.asList(new String[] { id});\r
+          try {\r
+            DasGFFAdapter dga=featuresc.fetchData(source, qid);\r
+            Map<List<String>,DasGFFAdapter> ers=results.get(source);\r
+            if (ers==null)\r
+            {\r
+              results.put(source, ers=new HashMap<List<String>,DasGFFAdapter>());\r
+            }\r
+            ers.put(qid, dga);\r
+          } catch (Exception ex)\r
+          {\r
+            Map<List<String>,Exception> ers=errors.get(source);\r
+            if (ers==null)\r
+            {\r
+              errors.put(source, ers=new HashMap<List<String>,Exception>());\r
+            }\r
+            ers.put(qid, ex);\r
+          }\r
+        }\r
+      }\r
+    } else {\r
+      // pass them all at once\r
+    fc.fetchData(src, ids, false, results, errors);\r
+    fc.shutDown();\r
+    while (!fc.isTerminated())\r
     {\r
-      DasSource dasSource = (DasSource) selectedSources\r
-              .elementAt(sourceIndex);\r
+      try\r
+      {\r
+        Thread.sleep(200);\r
+      } catch (InterruptedException x)\r
+      {\r
 \r
-      nextSequence(dasSource, sequences[0]);\r
+      }\r
+    }\r
+    }\r
+    Iterator<List<String>> idset = ids.iterator();\r
+    Iterator<List<DBRefEntry>> idobjset = idobj.iterator();\r
+    Iterator<Map<String, SequenceI>> seqset = sqset.iterator();\r
+    for (jalviewSourceI source : srcobj)\r
+    {\r
+      processResponse(seqset.next(), source, idset.next(), idobjset.next(),\r
+              results.get(source.getSourceURL()),\r
+              errors.get(source.getSourceURL()));\r
+    }\r
+  }\r
+\r
+  private void processResponse(Map<String, SequenceI> sequencemap,\r
+          jalviewSourceI jvsource, List<String> ids,\r
+          List<DBRefEntry> idobj, Map<List<String>, DasGFFAdapter> results,\r
+          Map<List<String>, Exception> errors)\r
+  {\r
+    Set<SequenceI> sequences = new HashSet<SequenceI>();\r
+    String source = jvsource.getSourceURL();\r
+    // process features\r
+    DasGFFAdapter result = (results == null) ? null : results.get(ids);\r
+    Exception error = (errors == null) ? null : errors.get(ids);\r
+    if (result == null)\r
+    {\r
+      debug("das source " + source + " could not be contacted. "\r
+              + (error == null ? "" : error.toString()));\r
+    }\r
+    else\r
+    {\r
+\r
+      GFFAdapter gff = result.getGFF();\r
+      List<SEGMENT> segments = gff.getSegments();\r
+      List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();\r
+      List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();\r
+      List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();\r
+      debug("das source " + source + " returned " + gff.getTotal()\r
+              + " responses. " + (errorsegs != null ? errorsegs.size() : 0)\r
+              + " were incorrect segment queries, "\r
+              + (unkfeats != null ? unkfeats.size() : 0)\r
+              + " were unknown features "\r
+              + (unksegs != null ? unksegs.size() : 0)\r
+              + " were unknown segments and "\r
+              + (segments != null ? segments.size() : 0)\r
+              + " were segment responses.");\r
+      Iterator<DBRefEntry> dbr = idobj.iterator();\r
+      if (segments != null)\r
+      {\r
+        for (SEGMENT seg : segments)\r
+        {\r
+          String id = seg.getId();\r
+          DBRefEntry dbref = idobj.get(ids.indexOf(id));\r
+          SequenceI sequence = sequencemap.get(id);\r
+          boolean added = false;\r
+          sequences.add(sequence);\r
+\r
+          for (FEATURE feat : seg.getFEATURE())\r
+          {\r
+            // standard DAS feature-> jalview sequence feature transformation\r
+            SequenceFeature f = newSequenceFeature(feat, jvsource.getTitle());\r
+            if (!parseSeqFeature(sequence, f, feat, jvsource))\r
+            {\r
+              if (dbref.getMap() != null && f.getBegin() > 0\r
+                      && f.getEnd() > 0)\r
+              {\r
+                debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
+                SequenceFeature vf[] = null;\r
+\r
+                try\r
+                {\r
+                  vf = dbref.getMap().locateFeature(f);\r
+                } catch (Exception ex)\r
+                {\r
+                  Cache.log\r
+                          .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");\r
+                  Cache.log.info("Mapping feature from " + f.getBegin()\r
+                          + " to " + f.getEnd() + " in dbref "\r
+                          + dbref.getAccessionId() + " in "\r
+                          + dbref.getSource());\r
+                  Cache.log.info("using das Source " + source);\r
+                  Cache.log.info("Exception", ex);\r
+                }\r
+\r
+                if (vf != null)\r
+                {\r
+                  for (int v = 0; v < vf.length; v++)\r
+                  {\r
+                    debug("mapping to " + v + ": " + vf[v].getBegin()\r
+                            + " - " + vf[v].getEnd());\r
+                    sequence.addSequenceFeature(vf[v]);\r
+                  }\r
+                }\r
+              }\r
+              else\r
+              {\r
+                sequence.addSequenceFeature(f);\r
+              }\r
+            }\r
+          }\r
+        }\r
+        featuresAdded(sequences);\r
+      }\r
+      else\r
+      {\r
+        // System.out.println("No features found for " + seq.getName()\r
+        // + " from: " + e.getDasSource().getNickname());\r
+      }\r
     }\r
   }\r
 \r
@@ -306,34 +549,10 @@ public class DasSequenceFeatureFetcher
   }\r
 \r
   int sourcesRemaining = 0;\r
-\r
-  void responseComplete(DasSource dasSource, SequenceI seq)\r
-  {\r
-    if (seq != null)\r
-    {\r
-      for (int seqIndex = 0; seqIndex < sequences.length - 1 && !cancelled; seqIndex++)\r
-      {\r
-        if (sequences[seqIndex] == seq)\r
-        {\r
-          nextSequence(dasSource, sequences[++seqIndex]);\r
-          return;\r
-        }\r
-      }\r
-    }\r
-\r
-    sourcesRemaining--;\r
-\r
-    if (sourcesRemaining == 0)\r
-    {\r
-      System.err.println("Fetching Complete.");\r
-      setGuiFetchComplete();\r
-    }\r
-\r
-  }\r
-\r
+  private boolean running=false;\r
   private void setGuiFetchComplete()\r
   {\r
-\r
+    running=false;\r
     if (!cancelled && af != null)\r
     {\r
       // only update the progress bar if we've completed the fetch normally\r
@@ -351,7 +570,7 @@ public class DasSequenceFeatureFetcher
     }\r
   }\r
 \r
-  void featuresAdded(SequenceI seq)\r
+  void featuresAdded(Set<SequenceI> seqs)\r
   {\r
     if (af == null)\r
     {\r
@@ -365,19 +584,23 @@ public class DasSequenceFeatureFetcher
     int index;\r
     for (index = start; index < end; index++)\r
     {\r
-      if (seq == af.getViewport().getAlignment().getSequenceAt(index)\r
-              .getDatasetSequence())\r
+      for (SequenceI seq : seqs)\r
       {\r
-        af.alignPanel.paintAlignment(true);\r
-        break;\r
+        if (seq == af.getViewport().getAlignment().getSequenceAt(index)\r
+                .getDatasetSequence())\r
+        {\r
+          af.alignPanel.paintAlignment(true);\r
+          index = end;\r
+          break;\r
+        }\r
       }\r
     }\r
   }\r
 \r
-  void nextSequence(DasSource dasSource, SequenceI seq)\r
+  Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)\r
   {\r
     if (cancelled)\r
-      return;\r
+      return null;\r
     DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
             seq.getDBRef(), new String[]\r
             {\r
@@ -389,6 +612,8 @@ public class DasSequenceFeatureFetcher
     // TODO: minimal list of DAS queries to make by querying with untyped ID if\r
     // distinct from any typed IDs\r
 \r
+    List<DBRefEntry> ids = new ArrayList<DBRefEntry>();\r
+    List<String> qstring = new ArrayList<String>();\r
     boolean dasCoordSysFound = false;\r
 \r
     if (uprefs != null)\r
@@ -396,29 +621,28 @@ public class DasSequenceFeatureFetcher
       // do any of these ids match the source's coordinate system ?\r
       for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)\r
       {\r
-        DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
 \r
-        for (int csIndex = 0; csIndex < cs.length && !dasCoordSysFound; csIndex++)\r
+        for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())\r
         {\r
-          if (cs.length > 0\r
-                  && jalview.util.DBRefUtils.isDasCoordinateSystem(\r
-                          cs[csIndex].getName(), uprefs[j]))\r
+          if (jalview.util.DBRefUtils.isDasCoordinateSystem(\r
+                  csys.getAuthority(), uprefs[j]))\r
           {\r
             debug("Launched fetcher for coordinate system "\r
-                    + cs[0].getName());\r
+                    + csys.getAuthority());\r
             // Will have to pass any mapping information to the fetcher\r
             // - the start/end for the DBRefEntry may not be the same as the\r
             // sequence's start/end\r
 \r
             System.out.println(seq.getName() + " "\r
                     + (seq.getDatasetSequence() == null) + " "\r
-                    + dasSource.getUrl());\r
+                    + csys.getUri());\r
 \r
             dasCoordSysFound = true; // break's out of the loop\r
-            createFeatureFetcher(seq, dasSource, uprefs[j]);\r
+            ids.add(uprefs[j]);\r
+            qstring.add(uprefs[j].getAccessionId());\r
           }\r
           else\r
-            System.out.println("IGNORE " + cs[csIndex].getName());\r
+            System.out.println("IGNORE " + csys.getAuthority());\r
         }\r
       }\r
     }\r
@@ -447,204 +671,17 @@ public class DasSequenceFeatureFetcher
       }\r
       if (id != null)\r
       {\r
+        DBRefEntry dbre = new DBRefEntry();\r
+        dbre.setAccessionId(id);\r
         // Should try to call a general feature fetcher that\r
         // queries many sources with name to discover applicable ID references\r
-        createFeatureFetcher(seq, dasSource, id);\r
+        ids.add(dbre);\r
+        qstring.add(dbre.getAccessionId());\r
       }\r
     }\r
 \r
-  }\r
-\r
-  /**\r
-   * fetch and add das features to a sequence using the given source URL and\r
-   * compatible DbRef id. new features are mapped using the DbRef mapping to the\r
-   * local coordinate system.\r
-   * \r
-   * @param seq\r
-   * @param SourceUrl\r
-   * @param dbref\r
-   */\r
-  protected void createFeatureFetcher(final SequenceI seq,\r
-          final DasSource dasSource, final DBRefEntry dbref)\r
-  {\r
-\r
-    // ////////////\r
-    // / fetch DAS features\r
-    final Das1Source source = new Das1Source();\r
-    source.setUrl(dasSource.getUrl());\r
-    source.setNickname(dasSource.getNickname());\r
-    if (dbref == null || dbref.getAccessionId() == null\r
-            || dbref.getAccessionId().length() < 1)\r
-    {\r
-      responseComplete(dasSource, seq); // reduce thread count anyhow\r
-      return;\r
-    }\r
-    debug("new Das Feature Fetcher for " + dbref.getSource() + ":"\r
-            + dbref.getAccessionId() + " querying " + dasSource.getUrl());\r
-    FeatureThread fetcher = new FeatureThread(dbref.getAccessionId()\r
-    // + ":" + start + "," + end,\r
-            , source);\r
-\r
-    fetcher.addFeatureListener(new FeatureListener()\r
-    {\r
-      public void comeBackLater(FeatureEvent e)\r
-      {\r
-        responseComplete(dasSource, seq);\r
-        debug("das source " + e.getSource().getNickname()\r
-                + " asked us to come back in " + e.getComeBackLater()\r
-                + " secs.");\r
-      }\r
-\r
-      public void newFeatures(FeatureEvent e)\r
-      {\r
-\r
-        Das1Source ds = e.getSource();\r
-\r
-        Map[] features = e.getFeatures();\r
-        // add features to sequence\r
-        debug("das source " + ds.getUrl() + " returned " + features.length\r
-                + " features");\r
-\r
-        if (features.length > 0)\r
-        {\r
-          for (int i = 0; i < features.length; i++)\r
-          {\r
-            // standard DAS feature-> jalview sequence feature transformation\r
-            SequenceFeature f = newSequenceFeature(features[i],\r
-                    source.getNickname());\r
-            if (!parseSeqFeature(seq, f, features[i], source))\r
-            {\r
-              if (dbref.getMap() != null && f.getBegin() > 0\r
-                      && f.getEnd() > 0)\r
-              {\r
-                debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
-                SequenceFeature vf[] = null;\r
-\r
-                try\r
-                {\r
-                  vf = dbref.getMap().locateFeature(f);\r
-                } catch (Exception ex)\r
-                {\r
-                  Cache.log\r
-                          .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");\r
-                  Cache.log.info("Mapping feature from " + f.getBegin()\r
-                          + " to " + f.getEnd() + " in dbref "\r
-                          + dbref.getAccessionId() + " in "\r
-                          + dbref.getSource());\r
-                  Cache.log.info("using das Source " + ds.getUrl());\r
-                  Cache.log.info("Exception", ex);\r
-                }\r
-\r
-                if (vf != null)\r
-                {\r
-                  for (int v = 0; v < vf.length; v++)\r
-                  {\r
-                    debug("mapping to " + v + ": " + vf[v].getBegin()\r
-                            + " - " + vf[v].getEnd());\r
-                    seq.addSequenceFeature(vf[v]);\r
-                  }\r
-                }\r
-              }\r
-              else\r
-              {\r
-                seq.addSequenceFeature(f);\r
-              }\r
-            }\r
-          }\r
-          featuresAdded(seq);\r
-        }\r
-        else\r
-        {\r
-          // System.out.println("No features found for " + seq.getName()\r
-          // + " from: " + e.getDasSource().getNickname());\r
-        }\r
-        responseComplete(dasSource, seq);\r
-\r
-      }\r
-    }\r
-\r
-    );\r
-\r
-    fetcher.start();\r
-  }\r
-\r
-  protected void createFeatureFetcher(final SequenceI seq,\r
-          final DasSource dasSource, String id)\r
-  {\r
-    // ////////////\r
-    // / fetch DAS features\r
-    final Das1Source source = new Das1Source();\r
-    source.setUrl(dasSource.getUrl());\r
-    source.setNickname(dasSource.getNickname());\r
-\r
-    if (id != null)\r
-    {\r
-      id = id.trim();\r
-    }\r
-    if (id != null && id.length() > 0)\r
-    {\r
-      debug("new Das Feature Fetcher for " + id + " querying "\r
-              + dasSource.getUrl());\r
-      FeatureThread fetcher = new FeatureThread(id\r
-      // + ":" + start + "," + end,\r
-              , source);\r
-\r
-      fetcher.addFeatureListener(new FeatureListener()\r
-      {\r
-        public void comeBackLater(FeatureEvent e)\r
-        {\r
-          responseComplete(dasSource, seq);\r
-          debug("das source " + e.getSource().getNickname()\r
-                  + " asked us to come back in " + e.getComeBackLater()\r
-                  + " secs.");\r
-        }\r
-\r
-        public void newFeatures(FeatureEvent e)\r
-        {\r
-\r
-          Das1Source ds = e.getSource();\r
-\r
-          Map[] features = e.getFeatures();\r
-          // add features to sequence\r
-          debug("das source " + ds.getUrl() + " returned "\r
-                  + features.length + " features");\r
-\r
-          if (features.length > 0)\r
-          {\r
-            for (int i = 0; i < features.length; i++)\r
-            {\r
-              // standard DAS feature-> jalview sequence feature transformation\r
-              SequenceFeature f = newSequenceFeature(features[i],\r
-                      source.getNickname());\r
-              if (!parseSeqFeature(seq, f, features[i], source))\r
-              {\r
-                // just add as a simple sequence feature\r
-                seq.addSequenceFeature(f);\r
-              }\r
-            }\r
-\r
-            featuresAdded(seq);\r
-          }\r
-          else\r
-          {\r
-            // System.out.println("No features found for " + seq.getName()\r
-            // + " from: " + e.getDasSource().getNickname());\r
-          }\r
-          responseComplete(dasSource, seq);\r
-\r
-        }\r
-      }\r
-\r
-      );\r
-\r
-      fetcher.start();\r
-    }\r
-    else\r
-    {\r
-      // invalid fetch - indicate it is finished.\r
-      debug("Skipping empty ID for querying " + dasSource.getUrl());\r
-      responseComplete(dasSource, seq);\r
-    }\r
+    return new Object[]\r
+    { ids, qstring };\r
   }\r
 \r
   /**\r
@@ -663,7 +700,7 @@ public class DasSequenceFeatureFetcher
    * @return true if feature was consumed as another kind of annotation.\r
    */\r
   protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,\r
-          Map map, Das1Source source)\r
+          FEATURE feature, jalviewSourceI source)\r
   {\r
     SequenceI mseq = seq;\r
     while (seq.getDatasetSequence() != null)\r
@@ -698,7 +735,7 @@ public class DasSequenceFeatureFetcher
         // try to parse the accession out\r
 \r
         DBRefEntry dbr = new DBRefEntry();\r
-        dbr.setVersion(source.getNickname());\r
+        dbr.setVersion(source.getTitle());\r
         StringTokenizer st = new StringTokenizer(f.getDescription(), ":");\r
         if (st.hasMoreTokens())\r
         {\r
@@ -754,12 +791,12 @@ public class DasSequenceFeatureFetcher
   /**\r
    * creates a jalview sequence feature from a das feature document\r
    * \r
-   * @param dasfeature\r
+   * @param feat\r
    * @return sequence feature object created using dasfeature information\r
    */\r
-  SequenceFeature newSequenceFeature(Map dasfeature, String nickname)\r
+  SequenceFeature newSequenceFeature(FEATURE feat, String nickname)\r
   {\r
-    if (dasfeature == null)\r
+    if (feat == null)\r
     {\r
       return null;\r
     }\r
@@ -772,9 +809,12 @@ public class DasSequenceFeatureFetcher
        * qName.equals("SCORE")\r
        */\r
       String desc = new String();\r
-      if (dasfeature.containsKey("NOTE"))\r
+      if (feat.getNOTE() != null)\r
       {\r
-        desc += (String) dasfeature.get("NOTE");\r
+        for (String note : feat.getNOTE())\r
+        {\r
+          desc += (String) note;\r
+        }\r
       }\r
 \r
       int start = 0, end = 0;\r
@@ -782,19 +822,19 @@ public class DasSequenceFeatureFetcher
 \r
       try\r
       {\r
-        start = Integer.parseInt(dasfeature.get("START").toString());\r
+        start = Integer.parseInt(feat.getSTART().toString());\r
       } catch (Exception ex)\r
       {\r
       }\r
       try\r
       {\r
-        end = Integer.parseInt(dasfeature.get("END").toString());\r
+        end = Integer.parseInt(feat.getEND().toString());\r
       } catch (Exception ex)\r
       {\r
       }\r
       try\r
       {\r
-        Object scr = dasfeature.get("SCORE");\r
+        Object scr = feat.getSCORE();\r
         if (scr != null)\r
         {\r
           score = (float) Double.parseDouble(scr.toString());\r
@@ -805,20 +845,24 @@ public class DasSequenceFeatureFetcher
       }\r
 \r
       SequenceFeature f = new SequenceFeature(\r
-              (String) dasfeature.get("TYPE"), desc, start, end, score,\r
+              getTypeString(feat.getTYPE()), desc, start, end, score,\r
               nickname);\r
 \r
-      if (dasfeature.containsKey("LINK"))\r
+      if (feat.getLINK() != null)\r
       {\r
-        // Do not put feature extent in link text for non-positional features\r
-        if (f.begin == 0 && f.end == 0)\r
-        {\r
-          f.addLink(f.getType() + "|" + dasfeature.get("LINK"));\r
-        }\r
-        else\r
+        for (LINK link : feat.getLINK())\r
         {\r
-          f.addLink(f.getType() + " " + f.begin + "_" + f.end + "|"\r
-                  + dasfeature.get("LINK"));\r
+          // Do not put feature extent in link text for non-positional features\r
+          if (f.begin == 0 && f.end == 0)\r
+          {\r
+            f.addLink(f.getType() + " " + link.getContent() + "|"\r
+                    + link.getHref());\r
+          }\r
+          else\r
+          {\r
+            f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "\r
+                    + link.getContent() + "|" + link.getHref());\r
+          }\r
         }\r
       }\r
 \r
@@ -828,71 +872,19 @@ public class DasSequenceFeatureFetcher
       System.out.println("ERRR " + e);\r
       e.printStackTrace();\r
       System.out.println("############");\r
-      debug("Failed to parse " + dasfeature.toString(), e);\r
+      debug("Failed to parse " + feat.toString(), e);\r
       return null;\r
     }\r
   }\r
 \r
-  /**\r
-   * query the default DAS Source Registry for sources. Uses value of jalview\r
-   * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that\r
-   * doesn't exist.\r
-   * \r
-   * @return list of sources\r
-   */\r
-  public static DasSource[] getDASSources()\r
+  private String getTypeString(TYPE type)\r
   {\r
-\r
-    String registryURL = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
-            DasSourceBrowser.DEFAULT_REGISTRY);\r
-    return getDASSources(registryURL);\r
+    return type.getContent();\r
   }\r
 \r
-  /**\r
-   * query the given URL for DasSources.\r
-   * \r
-   * @param registryURL\r
-   *          return sources from registryURL\r
-   */\r
-  public static DasSource[] getDASSources(String registryURL)\r
+  public boolean isRunning()\r
   {\r
-    DasSourceReaderImpl reader = new DasSourceReaderImpl();\r
-\r
-    try\r
-    {\r
-      URL url = new URL(registryURL);\r
-\r
-      DasSource[] sources = reader.readDasSource(url);\r
-\r
-      List das1sources = new ArrayList();\r
-      for (int i = 0; i < sources.length; i++)\r
-      {\r
-        DasSource ds = sources[i];\r
-        if (ds instanceof Das2Source)\r
-        {\r
-          Das2Source d2s = (Das2Source) ds;\r
-          if (d2s.hasDas1Capabilities())\r
-          {\r
-            Das1Source d1s = DasSourceConverter.toDas1Source(d2s);\r
-            das1sources.add(d1s);\r
-          }\r
-\r
-        }\r
-        else if (ds instanceof Das1Source)\r
-        {\r
-          das1sources.add((Das1Source) ds);\r
-        }\r
-      }\r
-\r
-      return (Das1Source[]) das1sources.toArray(new Das1Source[das1sources\r
-              .size()]);\r
-    } catch (Exception ex)\r
-    {\r
-      System.err.println("Failed to contact DAS1 registry at "\r
-              + registryURL);\r
-      ex.printStackTrace();\r
-      return null;\r
-    }\r
+    return running;\r
   }\r
 \r
 }\r
index 7c9f575..503245b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c117e4b..9953978 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4f9e0ab..b1d3f3c 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
  */\r
 package jalview.ws;\r
 \r
-import java.util.ArrayList;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-\r
-import org.biojava.dasobert.das2.Das2Source;\r
-import org.biojava.dasobert.dasregistry.Das1Source;\r
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-\r
 import jalview.datamodel.Alignment;\r
 import jalview.datamodel.AlignmentI;\r
 import jalview.datamodel.DBRefSource;\r
 import jalview.datamodel.SequenceI;\r
-import jalview.ws.dbsources.DasSequenceSource;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.dbsources.das.datamodel.DasSequenceSource;\r
 import jalview.ws.seqfetcher.ASequenceFetcher;\r
 import jalview.ws.seqfetcher.DbSourceProxy;\r
 \r
+import java.util.ArrayList;\r
+import java.util.Enumeration;\r
+import java.util.List;\r
+import java.util.Vector;\r
+\r
 /**\r
  * This is the the concrete implementation of the sequence retrieval interface\r
  * and abstract class in jalview.ws.seqfetcher. This implements the run-time\r
@@ -61,33 +58,112 @@ public class SequenceFetcher extends ASequenceFetcher
     // alignment is\r
     // 'default' for\r
     // PFAM\r
+    addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class);\r
+    addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class);\r
     registerDasSequenceSources();\r
   }\r
 \r
   /**\r
-   * return an ordered list of database sources suitable for using in a GUI\r
-   * element\r
+   * return an ordered list of database sources where non-das database classes\r
+   * appear before das database classes\r
    */\r
   public String[] getOrderedSupportedSources()\r
   {\r
     String[] srcs = this.getSupportedDb();\r
-    ArrayList dassrc = new ArrayList(), nondas = new ArrayList();\r
+    ArrayList<String> dassrc = new ArrayList<String>(), nondas = new ArrayList<String>();\r
     for (int i = 0; i < srcs.length; i++)\r
     {\r
-      String nm = getSourceProxy(srcs[i]).getDbName();\r
-      if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.DasSequenceSource)\r
+      boolean das = false,skip=false;\r
+      String nm;\r
+      for (DbSourceProxy dbs : getSourceProxy(srcs[i]))\r
       {\r
-        if (nm.startsWith("das:"))\r
+        // Skip the alignment databases for the moment - they're not useful for verifying a single sequence against its reference source\r
+        if (dbs.isA(DBRefSource.ALIGNMENTDB))\r
         {\r
-          nm = nm.substring(4);\r
+          skip=true;\r
+        } else {\r
+          nm = dbs.getDbName();\r
+          if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)\r
+          {\r
+            if (nm.startsWith("das:"))\r
+            {\r
+              nm = nm.substring(4);\r
+              das = true;\r
+            }\r
+            break;\r
+          }\r
         }\r
-        dassrc.add(new String[]\r
-        { srcs[i], nm.toUpperCase() });\r
+      }\r
+      if (skip)\r
+      {\r
+        continue;\r
+      }\r
+      if (das)\r
+      {\r
+        dassrc.add(srcs[i]);\r
       }\r
       else\r
       {\r
-        nondas.add(new String[]\r
-        { srcs[i], nm.toUpperCase() });\r
+        nondas.add(srcs[i]);\r
+      }\r
+    }\r
+    String[] tosort = nondas.toArray(new String[0]), sorted = nondas\r
+            .toArray(new String[0]);\r
+    for (int j = 0, jSize = sorted.length; j < jSize; j++)\r
+    {\r
+      tosort[j] = tosort[j].toLowerCase();\r
+    }\r
+    jalview.util.QuickSort.sort(tosort, sorted);\r
+    // construct array with all sources listed\r
+\r
+    srcs = new String[sorted.length + dassrc.size()];\r
+    int i = 0;\r
+    for (int j = sorted.length - 1; j >= 0; j--, i++)\r
+    {\r
+      srcs[i] = sorted[j];\r
+      sorted[j] = null;\r
+    }\r
+\r
+    sorted = dassrc.toArray(new String[0]);\r
+    tosort = dassrc.toArray(new String[0]);\r
+    for (int j = 0, jSize = sorted.length; j < jSize; j++)\r
+    {\r
+      tosort[j] = tosort[j].toLowerCase();\r
+    }\r
+    jalview.util.QuickSort.sort(tosort, sorted);\r
+    for (int j = sorted.length - 1; j >= 0; j--, i++)\r
+    {\r
+      srcs[i] = sorted[j];\r
+    }\r
+    return srcs;\r
+  }\r
+\r
+  /**\r
+   * return plaintext databse list suitable for using in a GUI element\r
+   */\r
+  public String[] _getOrderedSupportedSources()\r
+  {\r
+    String[] srcs = this.getSupportedDb();\r
+    ArrayList dassrc = new ArrayList(), nondas = new ArrayList();\r
+    for (int i = 0; i < srcs.length; i++)\r
+    {\r
+      for (DbSourceProxy dbs : getSourceProxy(srcs[i]))\r
+      {\r
+        String nm = dbs.getDbName();\r
+        if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)\r
+        {\r
+          if (nm.startsWith("das:"))\r
+          {\r
+            nm = nm.substring(4);\r
+          }\r
+          dassrc.add(new String[]\r
+          { srcs[i], nm.toUpperCase() });\r
+        }\r
+        else\r
+        {\r
+          nondas.add(new String[]\r
+          { srcs[i], nm.toUpperCase() });\r
+        }\r
       }\r
     }\r
     Object[] sorted = nondas.toArray();\r
@@ -99,6 +175,8 @@ public class SequenceFetcher extends ASequenceFetcher
     }\r
     jalview.util.QuickSort.sort(tosort, sorted);\r
     int i = 0;\r
+    // construct array with all sources listed\r
+    srcs = new String[sorted.length + dassrc.size()];\r
     for (int j = sorted.length - 1; j >= 0; j--, i++)\r
     {\r
       srcs[i] = ((String[]) sorted[j])[0];\r
@@ -135,27 +213,32 @@ public class SequenceFetcher extends ASequenceFetcher
             + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.";\r
     if (argv != null && argv.length > 0)\r
     {\r
-      DbSourceProxy sp = new SequenceFetcher().getSourceProxy(argv[0]);\r
-      if (sp != null)\r
+      List<DbSourceProxy> sps = new SequenceFetcher()\r
+              .getSourceProxy(argv[0]);\r
+\r
+      if (sps != null)\r
       {\r
-        AlignmentI al = null;\r
-        try\r
-        {\r
-          al = sp.getSequenceRecords(argv[1]);\r
-        } catch (Exception e)\r
+        for (DbSourceProxy sp : sps)\r
         {\r
-          e.printStackTrace();\r
-          System.err.println("Error when retrieving " + argv[1] + " from "\r
-                  + argv[0] + "\nUsage: " + usage);\r
-        }\r
-        SequenceI[] prod = al.getSequencesArray();\r
-        if (al != null)\r
-        {\r
-          for (int p = 0; p < prod.length; p++)\r
+          AlignmentI al = null;\r
+          try\r
+          {\r
+            al = sp.getSequenceRecords(argv[1]);\r
+          } catch (Exception e)\r
           {\r
-            System.out.println("Prod " + p + ": "\r
-                    + prod[p].getDisplayId(true) + " : "\r
-                    + prod[p].getDescription());\r
+            e.printStackTrace();\r
+            System.err.println("Error when retrieving " + argv[1]\r
+                    + " from " + argv[0] + "\nUsage: " + usage);\r
+          }\r
+          SequenceI[] prod = al.getSequencesArray();\r
+          if (al != null)\r
+          {\r
+            for (int p = 0; p < prod.length; p++)\r
+            {\r
+              System.out.println("Prod " + p + ": "\r
+                      + prod[p].getDisplayId(true) + " : "\r
+                      + prod[p].getDescription());\r
+            }\r
           }\r
         }\r
         return;\r
@@ -167,6 +250,7 @@ public class SequenceFetcher extends ASequenceFetcher
                 + new SequenceFetcher().getSupportedDb());\r
       }\r
       System.out.println(usage);\r
+      return;\r
     }\r
     ASequenceFetcher sfetcher = new SequenceFetcher();\r
     String[] dbSources = sfetcher.getSupportedDb();\r
@@ -176,135 +260,141 @@ public class SequenceFetcher extends ASequenceFetcher
       // skip me\r
       if (db.equals(DBRefSource.PDB))\r
         continue;\r
-      DbSourceProxy sp = sfetcher.getSourceProxy(db);\r
-      System.out.println("Source: " + sp.getDbName() + " (" + db\r
-              + "): retrieving test:" + sp.getTestQuery());\r
-      AlignmentI al = null;\r
-      try\r
+      for (DbSourceProxy sp : sfetcher.getSourceProxy(db))\r
       {\r
-        al = sp.getSequenceRecords(sp.getTestQuery());\r
-        if (al != null && al.getHeight() > 0\r
-                && sp.getDbSourceProperties() != null)\r
+        System.out.println("Source: " + sp.getDbName() + " (" + db\r
+                + "): retrieving test:" + sp.getTestQuery());\r
+        AlignmentI al = null;\r
+        try\r
         {\r
-          boolean dna = sp.getDbSourceProperties().containsKey(\r
-                  DBRefSource.DNACODINGSEQDB)\r
-                  || sp.getDbSourceProperties().containsKey(\r
-                          DBRefSource.DNASEQDB)\r
-                  || sp.getDbSourceProperties().containsKey(\r
-                          DBRefSource.CODINGSEQDB);\r
-          // try and find products\r
-          String types[] = jalview.analysis.CrossRef.findSequenceXrefTypes(\r
-                  dna, al.getSequencesArray());\r
-          if (types != null)\r
+          al = sp.getSequenceRecords(sp.getTestQuery());\r
+          if (al != null && al.getHeight() > 0\r
+                  && sp.getDbSourceProperties() != null)\r
           {\r
-            System.out.println("Xref Types for: " + (dna ? "dna" : "prot"));\r
-            for (int t = 0; t < types.length; t++)\r
+            boolean dna = sp.getDbSourceProperties().containsKey(\r
+                    DBRefSource.DNACODINGSEQDB)\r
+                    || sp.getDbSourceProperties().containsKey(\r
+                            DBRefSource.DNASEQDB)\r
+                    || sp.getDbSourceProperties().containsKey(\r
+                            DBRefSource.CODINGSEQDB);\r
+            // try and find products\r
+            String types[] = jalview.analysis.CrossRef\r
+                    .findSequenceXrefTypes(dna, al.getSequencesArray());\r
+            if (types != null)\r
             {\r
-              System.out.println("Type: " + types[t]);\r
-              SequenceI[] prod = jalview.analysis.CrossRef\r
-                      .findXrefSequences(al.getSequencesArray(), dna,\r
-                              types[t]).getSequencesArray();\r
-              System.out.println("Found "\r
-                      + ((prod == null) ? "no" : "" + prod.length)\r
-                      + " products");\r
-              if (prod != null)\r
+              System.out.println("Xref Types for: "\r
+                      + (dna ? "dna" : "prot"));\r
+              for (int t = 0; t < types.length; t++)\r
               {\r
-                for (int p = 0; p < prod.length; p++)\r
+                System.out.println("Type: " + types[t]);\r
+                SequenceI[] prod = jalview.analysis.CrossRef\r
+                        .findXrefSequences(al.getSequencesArray(), dna,\r
+                                types[t]).getSequencesArray();\r
+                System.out.println("Found "\r
+                        + ((prod == null) ? "no" : "" + prod.length)\r
+                        + " products");\r
+                if (prod != null)\r
                 {\r
-                  System.out.println("Prod " + p + ": "\r
-                          + prod[p].getDisplayId(true));\r
+                  for (int p = 0; p < prod.length; p++)\r
+                  {\r
+                    System.out.println("Prod " + p + ": "\r
+                            + prod[p].getDisplayId(true));\r
+                  }\r
                 }\r
               }\r
             }\r
+            else\r
+            {\r
+              noProds.addElement((dna ? new Object[]\r
+              { al, al } : new Object[]\r
+              { al }));\r
+            }\r
+\r
           }\r
-          else\r
-          {\r
-            noProds.addElement((dna ? new Object[]\r
-            { al, al } : new Object[]\r
-            { al }));\r
-          }\r
+        } catch (Exception ex)\r
+        {\r
+          System.out.println("ERROR:Failed to retrieve test query.");\r
+          ex.printStackTrace(System.out);\r
+        }\r
 \r
+        if (al == null)\r
+        {\r
+          System.out.println("ERROR:No alignment retrieved.");\r
+          StringBuffer raw = sp.getRawRecords();\r
+          if (raw != null)\r
+            System.out.println(raw.toString());\r
+          else\r
+            System.out.println("ERROR:No Raw results.");\r
         }\r
-      } catch (Exception ex)\r
-      {\r
-        System.out.println("ERROR:Failed to retrieve test query.");\r
-        ex.printStackTrace(System.out);\r
-      }\r
-      if (al == null)\r
-      {\r
-        System.out.println("ERROR:No alignment retrieved.");\r
-        StringBuffer raw = sp.getRawRecords();\r
-        if (raw != null)\r
-          System.out.println(raw.toString());\r
         else\r
-          System.out.println("ERROR:No Raw results.");\r
-      }\r
-      else\r
-      {\r
-        System.out.println("Retrieved " + al.getHeight() + " sequences.");\r
-        for (int s = 0; s < al.getHeight(); s++)\r
         {\r
-          SequenceI sq = al.getSequenceAt(s);\r
-          while (sq.getDatasetSequence() != null)\r
+          System.out.println("Retrieved " + al.getHeight() + " sequences.");\r
+          for (int s = 0; s < al.getHeight(); s++)\r
           {\r
-            sq = sq.getDatasetSequence();\r
+            SequenceI sq = al.getSequenceAt(s);\r
+            while (sq.getDatasetSequence() != null)\r
+            {\r
+              sq = sq.getDatasetSequence();\r
 \r
-          }\r
-          if (ds == null)\r
-          {\r
-            ds = new Alignment(new SequenceI[]\r
-            { sq });\r
+            }\r
+            if (ds == null)\r
+            {\r
+              ds = new Alignment(new SequenceI[]\r
+              { sq });\r
 \r
-          }\r
-          else\r
-          {\r
-            ds.addSequence(sq);\r
+            }\r
+            else\r
+            {\r
+              ds.addSequence(sq);\r
+            }\r
           }\r
         }\r
-      }\r
-      System.out.flush();\r
-      System.err.flush();\r
-\r
-    }\r
-    if (noProds.size() > 0)\r
-    {\r
-      Enumeration ts = noProds.elements();\r
-      while (ts.hasMoreElements())\r
+        System.out.flush();\r
+        System.err.flush();\r
 \r
+      }\r
+      if (noProds.size() > 0)\r
       {\r
-        Object[] typeSq = (Object[]) ts.nextElement();\r
-        boolean dna = (typeSq.length > 1);\r
-        AlignmentI al = (AlignmentI) typeSq[0];\r
-        System.out.println("Trying getProducts for "\r
-                + al.getSequenceAt(0).getDisplayId(true));\r
-        System.out.println("Search DS Xref for: " + (dna ? "dna" : "prot"));\r
-        // have a bash at finding the products amongst all the retrieved\r
-        // sequences.\r
-        SequenceI[] seqs = al.getSequencesArray();\r
-        Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(\r
-                seqs, dna, null, ds);\r
-        System.out.println("Found "\r
-                + ((prodal == null) ? "no" : "" + prodal.getHeight())\r
-                + " products");\r
-        if (prodal != null)\r
+        Enumeration ts = noProds.elements();\r
+        while (ts.hasMoreElements())\r
+\r
         {\r
-          SequenceI[] prod = prodal.getSequencesArray(); // note\r
-          // should\r
-          // test\r
-          // rather\r
-          // than\r
-          // throw\r
-          // away\r
-          // codon\r
-          // mapping\r
-          // (if\r
-          // present)\r
-          for (int p = 0; p < prod.length; p++)\r
+          Object[] typeSq = (Object[]) ts.nextElement();\r
+          boolean dna = (typeSq.length > 1);\r
+          AlignmentI al = (AlignmentI) typeSq[0];\r
+          System.out.println("Trying getProducts for "\r
+                  + al.getSequenceAt(0).getDisplayId(true));\r
+          System.out.println("Search DS Xref for: "\r
+                  + (dna ? "dna" : "prot"));\r
+          // have a bash at finding the products amongst all the retrieved\r
+          // sequences.\r
+          SequenceI[] seqs = al.getSequencesArray();\r
+          Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(\r
+                  seqs, dna, null, ds);\r
+          System.out.println("Found "\r
+                  + ((prodal == null) ? "no" : "" + prodal.getHeight())\r
+                  + " products");\r
+          if (prodal != null)\r
           {\r
-            System.out.println("Prod " + p + ": "\r
-                    + prod[p].getDisplayId(true));\r
+            SequenceI[] prod = prodal.getSequencesArray(); // note\r
+            // should\r
+            // test\r
+            // rather\r
+            // than\r
+            // throw\r
+            // away\r
+            // codon\r
+            // mapping\r
+            // (if\r
+            // present)\r
+            for (int p = 0; p < prod.length; p++)\r
+            {\r
+              System.out.println("Prod " + p + ": "\r
+                      + prod[p].getDisplayId(true));\r
+            }\r
           }\r
         }\r
+\r
       }\r
 \r
     }\r
@@ -317,91 +407,20 @@ public class SequenceFetcher extends ASequenceFetcher
    */\r
   public void registerDasSequenceSources()\r
   {\r
-    DasSource[] sources = jalview.ws.DasSequenceFeatureFetcher\r
-            .getDASSources();\r
-    if (sources != null)\r
-    {\r
-      for (int s = 0; sources != null && s < sources.length; s++)\r
-      {\r
-        addDasSequenceSource(sources[s]);\r
-      }\r
-    }\r
-\r
-    Vector localsources = jalview.bin.Cache.getLocalDasSources();\r
-    if (localsources != null)\r
-    {\r
-      for (Enumeration ls = localsources.elements(); ls.hasMoreElements();)\r
-      {\r
-        addDasSequenceSource((DasSource) ls.nextElement());\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Try to create and add a DasSequenceSource to the list of sources.\r
-   * \r
-   * @param source\r
-   * @return null if no source was added, or the new DasSequenceSource created\r
-   */\r
-  DasSequenceSource addDasSequenceSource(DasSource source)\r
-  {\r
-    DasSequenceSource ds = null;\r
-    Das1Source d1s = null;\r
-    if (source.hasCapability("sequence"))\r
-    {\r
-      if (source instanceof Das2Source)\r
-      {\r
-        if (((Das2Source) source).hasDas1Capabilities())\r
-        {\r
-          try\r
-          {\r
-            d1s = org.biojava.dasobert.das2.DasSourceConverter\r
-                    .toDas1Source((Das2Source) source);\r
-          } catch (Exception e)\r
-          {\r
-            System.err.println("Ignoring DAS2 sequence source "\r
-                    + source.getNickname()\r
-                    + " - couldn't map to Das1Source.\n");\r
-            e.printStackTrace();\r
-          }\r
-        }\r
-      }\r
-      else\r
-      {\r
-        if (source instanceof Das1Source)\r
-        {\r
-          d1s = (Das1Source) source;\r
-        }\r
-      }\r
-    }\r
-    if (d1s != null)\r
+    // TODO: define a context as a registry provider (either desktop,\r
+    // jalview.bin.cache, or something else).\r
+    for (jalviewSourceI source : jalview.bin.Cache.getDasSourceRegistry()\r
+            .getSources())\r
     {\r
-      DasCoordinateSystem[] css = d1s.getCoordinateSystem();\r
-      if (css == null || css.length == 0)\r
+      if (source.isSequenceSource())\r
       {\r
-        // TODO: query das source directly to identify coordinate system... or\r
-        // have to make up a coordinate system\r
-        css = new DasCoordinateSystem[]\r
-        { new DasCoordinateSystem() };\r
-        css[0].setName(d1s.getNickname());\r
-        css[0].setUniqueId(d1s.getNickname());\r
-      }\r
-      for (int c = 0; c < css.length; c++)\r
-      {\r
-        try\r
+        List<DbSourceProxy> dassources = source.getSequenceSourceProxies();\r
+        for (DbSourceProxy seqsrc : dassources)\r
         {\r
-          addDbRefSourceImpl(ds = new DasSequenceSource("das:"\r
-                  + d1s.getNickname() + " (" + css[c].getName() + ")",\r
-                  css[c].getName(), d1s, css[c]));\r
-        } catch (Exception e)\r
-        {\r
-          System.err.println("Ignoring sequence coord system " + c + " ("\r
-                  + css[c].getName() + ") for source " + d1s.getNickname()\r
-                  + "- threw exception when constructing fetcher.\n");\r
-          e.printStackTrace();\r
+          addDbRefSourceImpl(seqsrc);\r
         }\r
       }\r
     }\r
-    return ds;\r
   }\r
+\r
 }\r
index 3f10686..cc7f70c 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 993865c..ed58e20 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 608a282..fc0bdb3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/ws/dbsources/DasSequenceSource.java b/src/jalview/ws/dbsources/DasSequenceSource.java
deleted file mode 100644 (file)
index f03665d..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE.  See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.util.Hashtable;\r
-\r
-import org.biojava.dasobert.das.SequenceThread;\r
-import org.biojava.dasobert.das2.Das2Source;\r
-import org.biojava.dasobert.dasregistry.Das1Source;\r
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-import org.biojava.dasobert.eventmodel.SequenceEvent;\r
-import org.biojava.dasobert.eventmodel.SequenceListener;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.ws.dbsources.das.DasSequenceSourceListener;\r
-import jalview.ws.seqfetcher.*;\r
-import jalview.datamodel.AlignmentI;\r
-\r
-/**\r
- * an instance of this class is created for each unique DAS Sequence source (ie\r
- * one capable of handling the 'sequence' for a particular MapMaster)\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DasSequenceSource extends DbSourceProxyImpl implements\r
-        DbSourceProxy\r
-{\r
-  protected Das1Source source = null;\r
-\r
-  protected String dbname = "DASCS";\r
-\r
-  protected String dbrefname = "das:source";\r
-\r
-  protected DasCoordinateSystem coordsys = null;\r
-\r
-  /**\r
-   * create a new DbSource proxy for a DAS 1 source\r
-   * \r
-   * @param dbnbame\r
-   *          Human Readable Name to use when fetching from this source\r
-   * @param dbrefname\r
-   *          DbRefName for DbRefs attached to sequences retrieved from this\r
-   *          source\r
-   * @param source\r
-   *          Das1Source\r
-   * @param coordsys\r
-   *          specific coordinate system to use for this source\r
-   * @throws Exception\r
-   *           if source is not capable of the 'sequence' command\r
-   */\r
-  public DasSequenceSource(String dbname, String dbrefname,\r
-          Das1Source source, DasCoordinateSystem coordsys) throws Exception\r
-  {\r
-    if (!source.hasCapability("sequence"))\r
-    {\r
-      throw new Exception("Source " + source.getNickname()\r
-              + " does not support the sequence command.");\r
-    }\r
-    this.source = source;\r
-    this.dbname = dbname;\r
-    this.dbrefname = dbrefname;\r
-    this.coordsys = coordsys;\r
-  }\r
-\r
-  public String getAccessionSeparator()\r
-  {\r
-    // cope with single sequences only\r
-    return null;\r
-  }\r
-\r
-  public Regex getAccessionValidator()\r
-  {\r
-    /** ? * */\r
-    return Regex.perlCode("\\S+");\r
-  }\r
-\r
-  public String getDbName()\r
-  {\r
-    // TODO: map to\r
-    return dbname + " (DAS)";\r
-  }\r
-\r
-  public String getDbSource()\r
-  {\r
-    return dbrefname;\r
-  }\r
-\r
-  public String getDbVersion()\r
-  {\r
-    return coordsys.getVersion();\r
-  }\r
-\r
-  public AlignmentI getSequenceRecords(String queries) throws Exception\r
-  {\r
-    SequenceThread seqfetcher = new org.biojava.dasobert.das.SequenceThread(\r
-            queries, source);\r
-    DasSequenceSourceListener ourlistener = new DasSequenceSourceListener(\r
-            this, queries);\r
-    seqfetcher.addSequenceListener(ourlistener);\r
-    seqfetcher.start();\r
-    try\r
-    {\r
-      Thread.sleep(5);\r
-    } catch (Exception e)\r
-    {\r
-    }\r
-    ;\r
-    while (ourlistener.isNotCalled() && seqfetcher.isAlive())\r
-    {\r
-      try\r
-      {\r
-        Thread.sleep(5);\r
-      } catch (Exception e)\r
-      {\r
-      }\r
-      ;\r
-    }\r
-    if (ourlistener.isNotCalled() || ourlistener.hasNoSequences())\r
-    {\r
-      System.err.println("Sequence Query to " + source.getNickname()\r
-              + " with '" + queries + "' returned no sequences.");\r
-      return null;\r
-    }\r
-    else\r
-    {\r
-      return ourlistener.getSequences();\r
-    }\r
-  }\r
-\r
-  public String getTestQuery()\r
-  {\r
-    return coordsys.getTestCode();\r
-  }\r
-\r
-  public boolean isValidReference(String accession)\r
-  {\r
-    // TODO try to validate an accession against source\r
-    // We don't really know how to do this without querying source\r
-\r
-    return true;\r
-  }\r
-\r
-  /**\r
-   * @return the source\r
-   */\r
-  public Das1Source getSource()\r
-  {\r
-    return source;\r
-  }\r
-\r
-  /**\r
-   * @return the coordsys\r
-   */\r
-  public DasCoordinateSystem getCoordsys()\r
-  {\r
-    return coordsys;\r
-  }\r
-}\r
index d803bea..536ba32 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 1345f48..899fa03 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 9573f72..6a3b3f7 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 80206c0..8832ff6 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 1cbfef8..ea60232 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 7586856..0b44e5a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 8ce586a..37108ca 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -37,7 +37,7 @@ import jalview.ws.seqfetcher.DbSourceProxyImpl;
  * @author JimP\r
  * \r
  */\r
-abstract public class Pfam extends DbSourceProxyImpl implements\r
+abstract public class Pfam extends Xfam implements\r
         DbSourceProxy\r
 {\r
 \r
@@ -95,17 +95,19 @@ abstract public class Pfam extends DbSourceProxyImpl implements
    * \r
    * @see jalview.ws.DbSourceProxy#getDbVersion()\r
    */\r
-  public String getDbVersion()\r
+  @Override\r
+public String getDbVersion()\r
   {\r
     // TODO Auto-generated method stub\r
     return null;\r
   }\r
 \r
-  /**\r
+  /**Returns base URL for selected Pfam alignment type\r
    * \r
    * @return PFAM URL stub for this DbSource\r
    */\r
-  protected abstract String getPFAMURL();\r
+  @Override\r
+protected abstract String getXFAMURL();\r
 \r
   /*\r
    * (non-Javadoc)\r
@@ -118,7 +120,7 @@ abstract public class Pfam extends DbSourceProxyImpl implements
     // individual references to each sequence in each family alignment that's\r
     // retrieved.\r
     startQuery();\r
-    AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getPFAMURL()\r
+    AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()\r
             + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,\r
             "STH");\r
     for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)\r
@@ -151,4 +153,9 @@ abstract public class Pfam extends DbSourceProxyImpl implements
   /*\r
    * public String getDbName() { return "PFAM"; // getDbSource(); }\r
    */\r
+  \r
+  \r
+  public String getXfamSource() { return jalview.datamodel.DBRefSource.PFAM; }\r
+  \r
+  \r
 }\r
index 5f579f6..93b6227 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -35,7 +35,7 @@ public class PfamFull extends Pfam implements DbSourceProxy
    * \r
    * @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
    */\r
-  protected String getPFAMURL()\r
+  protected String getXFAMURL()\r
   {\r
     return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";\r
   }\r
@@ -60,4 +60,8 @@ public class PfamFull extends Pfam implements DbSourceProxy
     return "PF03760";\r
   }\r
 \r
+public String getDbVersion() {\r
+       return null;\r
+}\r
+\r
 }\r
index 0e85f65..98febad 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -37,7 +37,7 @@ public class PfamSeed extends Pfam implements DbSourceProxy
    * \r
    * @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
    */\r
-  protected String getPFAMURL()\r
+  protected String getXFAMURL()\r
   {\r
     return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";\r
   }\r
diff --git a/src/jalview/ws/dbsources/Rfam.java b/src/jalview/ws/dbsources/Rfam.java
new file mode 100644 (file)
index 0000000..45716b7
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 com.stevesoft.pat.Regex;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * 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 (file)
index 0000000..122a39f
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 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;
+  }
+
+}
diff --git a/src/jalview/ws/dbsources/RfamSeed.java b/src/jalview/ws/dbsources/RfamSeed.java
new file mode 100644 (file)
index 0000000..63431bc
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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 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;
+  }
+
+}
index 17d0ca8..167758f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1d1b9f0..901d615 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
diff --git a/src/jalview/ws/dbsources/Xfam.java b/src/jalview/ws/dbsources/Xfam.java
new file mode 100644 (file)
index 0000000..8cde6d7
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.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;
+  }
+
+}
\ No newline at end of file
diff --git a/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java b/src/jalview/ws/dbsources/das/DasSequenceSourceListener.java
deleted file mode 100644 (file)
index 0b0a065..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE.  See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources.das;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.ws.dbsources.DasSequenceSource;\r
-\r
-import org.biojava.dasobert.eventmodel.SequenceEvent;\r
-import org.biojava.dasobert.eventmodel.SequenceListener;\r
-\r
-/**\r
- * Listen for sequence fetch events from a dasobert SequenceThread started with\r
- * a query string and collect sequences returned from the DAS sequence source.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DasSequenceSourceListener implements SequenceListener\r
-{\r
-\r
-  String ourAccession = null;\r
-\r
-  DasSequenceSource oursource = null;\r
-\r
-  /**\r
-   * \r
-   * @param source\r
-   *          the DAS Sequence DbProxy object containing database details for\r
-   *          this source\r
-   * @param query\r
-   *          the query string sent to the das source that we should be\r
-   *          listening for.\r
-   */\r
-  public DasSequenceSourceListener(DasSequenceSource source, String query)\r
-  {\r
-    oursource = source;\r
-    ourAccession = query;\r
-  }\r
-\r
-  public void clearSelection()\r
-  {\r
-    // TODO Auto-generated method stub\r
-\r
-  }\r
-\r
-  java.util.Vector seqs = null;\r
-\r
-  public void newSequence(SequenceEvent e)\r
-  {\r
-    if (!e.getAccessionCode().equals(ourAccession))\r
-    {\r
-      System.err\r
-              .println("Warning - received sequence event for strange accession code ("\r
-                      + e.getAccessionCode()\r
-                      + ") - we expected "\r
-                      + ourAccession);\r
-\r
-      return;\r
-    }\r
-    if (seqs == null)\r
-    {\r
-      if (e.getSequence().length() == 0)\r
-      {\r
-        System.err.println("Empty sequence returned for accession code ("\r
-                + e.getAccessionCode() + ") from " + oursource.getDbName());\r
-        called = true;\r
-        noSequences = true;\r
-        return;\r
-      }\r
-      seqs = new java.util.Vector();\r
-    }\r
-    Sequence sq = new Sequence(e.getAccessionCode(), e.getSequence());\r
-    sq.addDBRef(new DBRefEntry(oursource.getDbSource(), oursource\r
-            .getDbVersion() + ":" + e.getVersion(), e.getAccessionCode()));\r
-    seqs.addElement(sq);\r
-    called = true;\r
-  }\r
-\r
-  public void selectedSeqPosition(int position)\r
-  {\r
-    // TODO Auto-generated method stub\r
-\r
-  }\r
-\r
-  public void selectedSeqRange(int start, int end)\r
-  {\r
-    // TODO Auto-generated method stub\r
-\r
-  }\r
-\r
-  public void selectionLocked(boolean flag)\r
-  {\r
-    // TODO Auto-generated method stub\r
-\r
-  }\r
-\r
-  public void newObjectRequested(String accessionCode)\r
-  {\r
-    // TODO Auto-generated method stub\r
-\r
-  }\r
-\r
-  boolean noSequences = false;\r
-\r
-  public void noObjectFound(String accessionCode)\r
-  {\r
-    if (accessionCode.equals(ourAccession))\r
-    {\r
-      noSequences = true;\r
-      called = true;\r
-    }\r
-  }\r
-\r
-  public boolean hasNoSequences()\r
-  {\r
-    return noSequences;\r
-  }\r
-\r
-  boolean called = false;\r
-\r
-  public boolean isNotCalled()\r
-  {\r
-    return !called;\r
-  }\r
-\r
-  public AlignmentI getSequences()\r
-  {\r
-    if (noSequences || seqs != null && seqs.size() == 0)\r
-      return null;\r
-    SequenceI[] sqs = new SequenceI[seqs.size()];\r
-    for (int i = 0, iSize = seqs.size(); i < iSize; i++)\r
-    {\r
-      sqs[i] = (SequenceI) seqs.elementAt(i);\r
-    }\r
-    Alignment al = new Alignment(sqs);\r
-    if (oursource.getSource().hasCapability("features"))\r
-    {\r
-      java.util.Vector src = new java.util.Vector();\r
-      src.addElement(oursource.getSource());\r
-      new jalview.ws.DasSequenceFeatureFetcher(sqs, null, src, false, false);\r
-    }\r
-\r
-    return al;\r
-  }\r
-\r
-}\r
diff --git a/src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java b/src/jalview/ws/dbsources/das/api/DasSourceRegistryI.java
new file mode 100644 (file)
index 0000000..35e29b2
--- /dev/null
@@ -0,0 +1,37 @@
+package jalview.ws.dbsources.das.api;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.schema.sources.SOURCE;
+
+/**
+ * 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 (file)
index 0000000..7c36ddb
--- /dev/null
@@ -0,0 +1,56 @@
+package jalview.ws.dbsources.das.api;
+
+import java.util.List;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+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);
+
+}
diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java
new file mode 100644 (file)
index 0000000..a63727f
--- /dev/null
@@ -0,0 +1,330 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE.  See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package jalview.ws.dbsources.das.datamodel;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import org.biodas.jdas.client.ConnectionPropertyProviderI;\r
+import org.biodas.jdas.client.SequenceClient;\r
+import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;\r
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;\r
+import org.biodas.jdas.client.threads.SequenceClientMultipleSources;\r
+import org.biodas.jdas.schema.sequence.SEQUENCE;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
+import org.biodas.jdas.schema.sources.SOURCE;\r
+import org.biodas.jdas.schema.sources.VERSION;\r
+\r
+import com.stevesoft.pat.Regex;\r
+\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.seqfetcher.*;\r
+import jalview.bin.Cache;\r
+import jalview.datamodel.Alignment;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.DBRefEntry;\r
+import jalview.datamodel.Sequence;\r
+import jalview.datamodel.SequenceI;\r
+\r
+/**\r
+ * an instance of this class is created for each unique DAS Sequence source (ie\r
+ * one capable of handling the 'sequence' for a particular MapMaster)\r
+ * \r
+ * @author JimP\r
+ * \r
+ */\r
+public class DasSequenceSource extends DbSourceProxyImpl implements\r
+        DbSourceProxy\r
+{\r
+  private jalviewSourceI jsrc;\r
+\r
+  protected SOURCE source = null;\r
+\r
+  protected VERSION version = null;\r
+\r
+  protected COORDINATES coordsys = null;\r
+\r
+  protected String dbname = "DASCS";\r
+\r
+  protected String dbrefname = "das:source";\r
+  protected MultipleConnectionPropertyProviderI connprops=null;\r
+  /**\r
+   * create a new DbSource proxy for a DAS 1 source\r
+   * \r
+   * @param dbnbame\r
+   *          Human Readable Name to use when fetching from this source\r
+   * @param dbrefname\r
+   *          DbRefName for DbRefs attached to sequences retrieved from this\r
+   *          source\r
+   * @param source\r
+   *          Das1Source\r
+   * @param coordsys\r
+   *          specific coordinate system to use for this source\r
+   * @throws Exception\r
+   *           if source is not capable of the 'sequence' command\r
+   */\r
+  public DasSequenceSource(String dbname, String dbrefname, SOURCE source,\r
+          VERSION version, COORDINATES coordsys, MultipleConnectionPropertyProviderI connprops) throws Exception\r
+  {\r
+    if (!(jsrc = new JalviewSource(source, connprops, false)).isSequenceSource())\r
+    {\r
+      throw new Exception("Source " + source.getTitle()\r
+              + " does not support the sequence command.");\r
+    }\r
+    this.source = source;\r
+    this.dbname = dbname;\r
+    this.dbrefname = dbrefname;\r
+    if (coordsys!=null ) {\r
+      this.coordsys = coordsys;\r
+    }\r
+    this.connprops=connprops;\r
+  }\r
+\r
+  public String getAccessionSeparator()\r
+  {\r
+    return "\t";\r
+  }\r
+\r
+  public Regex getAccessionValidator()\r
+  {\r
+    /** ? * */\r
+    return Regex.perlCode("\\S+");\r
+  }\r
+\r
+  public String getDbName()\r
+  {\r
+    // TODO: map to\r
+    return dbname + " (DAS)";\r
+  }\r
+\r
+  public String getDbSource()\r
+  {\r
+    return dbrefname;\r
+  }\r
+\r
+  public String getDbVersion()\r
+  {\r
+    return coordsys!=null ? coordsys.getVersion() : "";\r
+  }\r
+\r
+  public AlignmentI getSequenceRecords(String queries) throws Exception\r
+  {\r
+    StringTokenizer st = new StringTokenizer(queries, "\t");\r
+    List<String> toks = new ArrayList<String>(), src = new ArrayList<String>(), acIds = new ArrayList<String>();\r
+    while (st.hasMoreTokens())\r
+    {\r
+      String t;\r
+      toks.add(t = st.nextToken());\r
+      acIds.add(t.replaceAll(":[0-9,]+", ""));\r
+    }\r
+    src.add(jsrc.getSourceURL());\r
+    Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();\r
+    Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
+    \r
+    // First try multiple sources\r
+    boolean multiple = true, retry = false;\r
+    do\r
+    {\r
+      if (!multiple)\r
+      {\r
+        retry = false;\r
+        // slow, fetch one at a time.\r
+        for (String sr : src)\r
+        {\r
+          System.err\r
+                  .println("Retrieving IDs individually from das source: "\r
+                          + sr);\r
+          org.biodas.jdas.client.SequenceClient sq = new SequenceClient(connprops.getConnectionPropertyProviderFor(sr));\r
+          for (String q : toks)\r
+          {\r
+            List<String> qset = Arrays.asList(new String[]\r
+            { q });\r
+            try\r
+            {\r
+              DasSequenceAdapter s = sq.fetchData(sr, qset);\r
+              Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);\r
+              if (dss == null)\r
+              {\r
+                resultset\r
+                        .put(sr,\r
+                                dss = new HashMap<List<String>, DasSequenceAdapter>());\r
+              }\r
+              dss.put(qset, s);\r
+            } catch (Exception x)\r
+            {\r
+              Map<List<String>, Exception> ers = errors.get(sr);\r
+              if (ers == null)\r
+              {\r
+                errors.put(sr, ers = new HashMap<List<String>, Exception>());\r
+              }\r
+              ers.put(qset, x);\r
+            }\r
+          }\r
+        }\r
+      }\r
+      else\r
+      {\r
+        SequenceClientMultipleSources sclient;\r
+        sclient = new SequenceClientMultipleSources();\r
+        sclient.fetchData(src, toks, resultset, errors);\r
+        sclient.shutDown();\r
+        while (!sclient.isTerminated())\r
+        {\r
+          try\r
+          {\r
+            Thread.sleep(200);\r
+\r
+          } catch (InterruptedException x)\r
+          {\r
+          }\r
+        }\r
+        if (resultset.isEmpty() && !errors.isEmpty())\r
+        {\r
+          retry = true;\r
+          multiple = false;\r
+        }\r
+      }\r
+    } while (retry);\r
+\r
+    if (resultset.isEmpty())\r
+    {\r
+      System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"\r
+              + queries + "' returned no sequences.");\r
+      return null;\r
+    }\r
+    else\r
+    {\r
+      Vector<SequenceI> seqs = null;\r
+      for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset\r
+              .entrySet())\r
+      {\r
+        for (Map.Entry<List<String>, DasSequenceAdapter> result : resset\r
+                .getValue().entrySet())\r
+        {\r
+          DasSequenceAdapter dasseqresp = result.getValue();\r
+          List<String> accessions = result.getKey();\r
+          for (SEQUENCE e : dasseqresp.getSequence())\r
+          {\r
+            String lbl = e.getId();\r
+\r
+            if (acIds.indexOf(lbl) == -1)\r
+            {\r
+              System.err\r
+                      .println("Warning - received sequence event for strange accession code ("\r
+                              + lbl + ")");\r
+            }\r
+            else\r
+            {\r
+              if (seqs == null)\r
+              {\r
+                if (e.getContent().length() == 0)\r
+                {\r
+                  System.err\r
+                          .println("Empty sequence returned for accession code ("\r
+                                  + lbl\r
+                                  + ") from "\r
+                                  + resset.getKey()\r
+                                  + " (source is " + getDbName());\r
+                  continue;\r
+                }\r
+              }\r
+              seqs = new java.util.Vector<SequenceI>();\r
+              // JDAS returns a sequence complete with any newlines and spaces\r
+              // in the XML\r
+              Sequence sq = new Sequence(lbl, e.getContent().replaceAll(\r
+                      "\\s+", ""));\r
+              sq.addDBRef(new DBRefEntry(getDbSource(), getDbVersion()\r
+                      + ":" + e.getVersion(), lbl));\r
+              seqs.addElement(sq);\r
+            }\r
+          }\r
+        }\r
+      }\r
+\r
+      if (seqs == null || seqs.size() == 0)\r
+        return null;\r
+      SequenceI[] sqs = new SequenceI[seqs.size()];\r
+      for (int i = 0, iSize = seqs.size(); i < iSize; i++)\r
+      {\r
+        sqs[i] = (SequenceI) seqs.elementAt(i);\r
+      }\r
+      Alignment al = new Alignment(sqs);\r
+      if (jsrc.isFeatureSource())\r
+      {\r
+        java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();\r
+        srcs.addElement(jsrc);\r
+        try\r
+        {\r
+          jalview.ws.DasSequenceFeatureFetcher dssf=new jalview.ws.DasSequenceFeatureFetcher(sqs, null, srcs, false,\r
+                  false, multiple);\r
+          while (dssf.isRunning())\r
+          {\r
+            try {\r
+              Thread.sleep(200);\r
+            } catch (InterruptedException x)\r
+            {\r
+              \r
+            }\r
+          }\r
+          \r
+        } catch (Exception x)\r
+        {\r
+          Cache.log\r
+                  .error("Couldn't retrieve features for sequence from its source.",\r
+                          x);\r
+        }\r
+      }\r
+\r
+      return al;\r
+    }\r
+  }\r
+\r
+  public String getTestQuery()\r
+  {\r
+    return coordsys==null ? "" : coordsys.getTestRange();\r
+  }\r
+\r
+  public boolean isValidReference(String accession)\r
+  {\r
+    // TODO try to validate an accession against source\r
+    // We don't really know how to do this without querying source\r
+\r
+    return true;\r
+  }\r
+\r
+  /**\r
+   * @return the source\r
+   */\r
+  public SOURCE getSource()\r
+  {\r
+    return source;\r
+  }\r
+\r
+  /**\r
+   * @return the coordsys\r
+   */\r
+  public COORDINATES getCoordsys()\r
+  {\r
+    return coordsys;\r
+  }\r
+}\r
diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java b/src/jalview/ws/dbsources/das/datamodel/DasSourceRegistry.java
new file mode 100644 (file)
index 0000000..3d477a4
--- /dev/null
@@ -0,0 +1,449 @@
+/**
+ * 
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+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.JOptionPane;
+
+import org.apache.http.auth.InvalidCredentialsException;
+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;
+
+import jalview.bin.Cache;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+/**
+ *
+ */
+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/";
+
+  /**
+   * 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)
+      {
+        StringTokenizer st = new StringTokenizer(local, "\t");
+        while (st.hasMoreTokens())
+        {
+          String token = st.nextToken();
+          int bar = token.indexOf("|");
+          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;
+          }
+          createLocalSource(url, token.substring(0, bar), sequence,
+                  features);
+        }
+      }
+    }
+  }
+
+  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 (file)
index 0000000..139bafe
--- /dev/null
@@ -0,0 +1,346 @@
+package jalview.ws.dbsources.das.datamodel;
+
+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.dassources.utils.RegistrySourceAdapter;
+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;
+
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+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("Invalid das source: "+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());
+  }
+}
index 7135d0c..b837354 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 03cc637..b7e08be 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 53f6436..5226f2d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 5dd1e42..7d5b334 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index c401452..3bbf3a3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b429c97..aba0f92 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 796c2af..a478b87 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 18fed82..98061f5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1a9552b..f6f1779 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 602eb50..363296e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2628f04..8cd2fe1 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index aeefcd1..d080c4a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 79ef6d1..061a63f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 481ff27..6c38750 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/ws/jws2/AAConsClient.java b/src/jalview/ws/jws2/AAConsClient.java
new file mode 100644 (file)
index 0000000..7aaac5b
--- /dev/null
@@ -0,0 +1,150 @@
+package jalview.ws.jws2;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import compbio.data.sequence.Score;
+import compbio.metadata.Argument;
+
+public class AAConsClient extends JabawsAlignCalcWorker
+{
+
+  public AAConsClient(Jws2Instance service, AlignFrame alignFrame,
+          WsParamSetI preset, List<Argument> paramset)
+  {
+    super(service, alignFrame, preset, paramset);
+    submitGaps=true;
+    alignedSeqs=true;
+    nucleotidesAllowed=false;
+    proteinAllowed=true;
+  }
+
+  public String getServiceActionText()
+  {
+    return "calculating Amino acid consensus using AACons 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)
+    {
+      AlignmentAnnotation annotation;
+      ;
+      Map<String, TreeSet<Score>> scoremap = scoremanager.asMap();
+      int alWidth = alignViewport.getAlignment().getWidth();
+      AlignmentI alignment;
+      int ann = (alignment = alignViewport.getAlignment())
+              .getAlignmentAnnotation().length;
+      ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+      for (String score : scoremap.keySet())
+      {
+        TreeSet<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
+          {
+            // simple annotation row
+            annotation = alignViewport.getAlignment().findOrCreateAnnotation(scr.getMethod(), true, null, null);
+            Annotation[] elm = new Annotation[alWidth];
+            if (alWidth == scr.getScores().size())
+            {
+              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;
+                  }
+                }
+                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();
+              ourAnnot.add(annotation);
+            }
+          }
+        }
+      }
+      if (ourAnnot.size() > 0)
+      {
+        List<AlignmentAnnotation> our = ourAnnots;
+        ourAnnots = ourAnnot;
+        if (our != null)
+        {
+          if (our.size() > 0)
+          {
+            for (AlignmentAnnotation an : our)
+            {
+              if (!ourAnnots.contains(an))
+              {
+                // remove the old annotation
+                alignment.deleteAnnotation(an);
+              }
+            }
+          }
+          our.clear();
+        }
+      }
+      // if (ann !=
+      // alignViewport.getAlignment().getAlignmentAnnotation().length)
+      {
+        ap.adjustAnnotationHeight();
+      }
+      /*
+       * else { ap.paintAlignment(true); }
+       */
+    }
+  }
+
+}
diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java
new file mode 100644 (file)
index 0000000..baec458
--- /dev/null
@@ -0,0 +1,125 @@
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.Iterator;
+import java.util.List;
+
+import compbio.data.sequence.Range;
+import compbio.data.sequence.Score;
+import compbio.data.sequence.ScoreManager.ScoreHolder;
+import compbio.metadata.Argument;
+
+public class AADisorderClient extends JabawsAlignCalcWorker implements
+        AlignCalcWorkerI
+{
+
+  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
+  public void updateResultAnnotation(boolean immediate)
+  {
+
+    if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+    {
+      boolean dispFeatures = false;
+      for (String seqId : seqNames.keySet())
+      {
+        SequenceI dseq, seq = seqNames.get(seqId);
+        int base = seq.getStart() - 1;
+        while ((dseq = seq).getDatasetSequence() != null)
+        {
+          seq = seq.getDatasetSequence();
+        }
+        ;
+        ScoreHolder scores = scoremanager.getAnnotationForSequence(seqId);
+
+        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;
+              if (vals.hasNext())
+              {
+                sf = new SequenceFeature(typeName + "(" + scr.getMethod()
+                        + ")", "Disordered Region", base + rn.from, base
+                        + rn.to, vals.next().floatValue(), methodName);
+              }
+              else
+              {
+                sf = new SequenceFeature(typeName + "(" + scr.getMethod()
+                        + ")", "Disordered Region", null, base + rn.from,
+                        base + rn.to, methodName);
+              }
+              dseq.addSequenceFeature(sf);
+              dispFeatures = true;
+            }
+          }
+          else
+          {
+            Iterator<Float> vals = scr.getScores().iterator();
+            for (int start = base + 1; vals.hasNext(); start++)
+            {
+              SequenceFeature sf = new SequenceFeature(typeName + "("
+                      + scr.getMethod() + ")", "Disordered Region", start,
+                      start, vals.next().floatValue(), methodName);
+              dseq.addSequenceFeature(sf);
+              dispFeatures = true;
+            }
+          }
+        }
+      }
+      {
+        if (dispFeatures)
+        {
+          // TODO: configure feature display settings for added types if they don't already exist
+          
+          af.alignPanel.av.setShowSequenceFeatures(true);
+          ap.paintAlignment(true);
+        }
+      }
+      /*
+       * else { ap.paintAlignment(true); }
+       */
+    }
+  }
+
+}
index 28ed672..d05f4f6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7382b9f..3da8f92 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 856646c..766bcf7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -33,10 +33,10 @@ 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.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.ArgumentI;
 import jalview.ws.params.ParamDatastoreI;
 import jalview.ws.params.ParamManager;
index 8586d24..401a9af 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -17,7 +17,7 @@
  */
 package jalview.ws.jws2;
 
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.ArgumentI;
 import jalview.ws.params.WsParamSetI;
 
index 74a5df1..089acea 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
 package jalview.ws.jws2;
 
 import jalview.bin.Cache;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
 
-import compbio.data.msa.MsaWS;
+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 jwsservers = 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)
   {
@@ -56,52 +64,122 @@ public class JabaWsServerQuery implements Runnable
   public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String jwsservers)
   {
     this.jws2Discoverer = jws2Discoverer;
-    this.jwsservers=jwsservers;
+    this.jwsservers = jwsservers;
   }
-
-  /* (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 };
+  
+  /*
+   * (non-Javadoc)
+   * 
    * @see java.lang.Runnable#run()
    */
   @Override
   public void run()
   {
-    running=true;
-        try
+    running = true;
+    try
     {
       if (Jws2Client.validURL(jwsservers))
       {
-        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(jwsservers);
+          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();
+            svccategories = registry.getServiceCategories();
+
           }
-          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: " + jwsservers
+                  + " 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(jwsservers, srv);
+            } catch (Exception e)
+            {
+              System.err.println("Jws2 Discoverer: Problem on "
+                      + jwsservers + " with service " + srv + ":\n"
+                      + e.getMessage());
+              if (!(e instanceof javax.xml.ws.WebServiceException))
+              {
+                e.printStackTrace();
+              }
+              // For moment, report service as a problem.
+              jws2Discoverer.addInvalidServiceUrl(jwsservers);
+            }
+            ;
+            if (service != null)
+            {
+              noservices = false;
+              Jws2Instance svc = null;
+              if (registry != null)
+              {
+
+                String description = registry.getServiceDescription(srv);
+
+                svc = new Jws2Instance(jwsservers, srv.toString(),
+                        cat.name, description, service);
+              }
+              if (svc == null)
+              {
+                svc = new Jws2Instance(jwsservers, srv.toString(), cat.name,
+                        "JABAWS 1 Alignment Service", service);
+              }
+              jws2Discoverer.addService(jwsservers, svc);
+            }
+
           }
         }
+
         if (noservices)
         {
           jws2Discoverer.addUrlwithnoservices(jwsservers);
@@ -122,7 +200,7 @@ public class JabaWsServerQuery implements Runnable
       Cache.log.error("Exception when discovering Jws2 services.", e);
       jws2Discoverer.addInvalidServiceUrl(jwsservers);
     }
-    running=false;
+    running = false;
   }
 
 }
diff --git a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java
new file mode 100644 (file)
index 0000000..9a1557c
--- /dev/null
@@ -0,0 +1,443 @@
+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.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.IProgressIndicator;
+import jalview.workers.AlignCalcWorker;
+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.msa.SequenceAnnotation;
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.ScoreManager;
+import compbio.metadata.Argument;
+import compbio.metadata.ChunkHolder;
+import compbio.metadata.JobStatus;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.Option;
+import compbio.metadata.ResultNotAvailableException;
+import compbio.metadata.WrongParameterException;
+
+public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
+{
+
+  @SuppressWarnings("unchecked")
+  protected SequenceAnnotation aaservice;
+
+  protected ScoreManager scoremanager;
+
+  protected WsParamSetI preset;
+
+  protected List<Argument> arguments;
+
+  public JabawsAlignCalcWorker(AlignViewportI alignViewport,
+          AlignmentViewPanel alignPanel)
+  {
+    super(alignViewport, alignPanel);
+  }
+
+  IProgressIndicator guiProgress;
+
+  public JabawsAlignCalcWorker(Jws2Instance service, AlignFrame alignFrame,
+          WsParamSetI preset, List<Argument> paramset)
+  {
+    this(alignFrame.getCurrentView(), alignFrame.alignPanel);
+    this.guiProgress = alignFrame;
+    this.preset = preset;
+    this.arguments = paramset;
+    aaservice = (SequenceAnnotation) service.service;
+
+  }
+
+  public WsParamSetI getPreset()
+  {
+    return preset;
+  }
+
+  public List<Argument> getArguments()
+  {
+    return arguments;
+  }
+
+  /**
+   * reconfigure and restart the AAConsClient. 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)
+  {
+    if (false) // || calcMan.isWorking(this))
+    {
+      new Thread(new Runnable()
+      {
+        @Override
+        public void run()
+        {
+
+          try
+          {
+            Thread.sleep(200);
+          } catch (InterruptedException x)
+          {
+          }
+          ;
+          updateParameters(newpreset, newarguments);
+        }
+      }).start();
+    }
+    else
+    {
+      preset = newpreset;
+      arguments = newarguments;
+      calcMan.startWorker(this);
+    }
+  }
+
+  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;
+  }
+
+  @Override
+  public void run()
+  {
+    if (aaservice == null)
+    {
+      return;
+    }
+    long progressId = -1;
+
+    String rslt = "JOB NOT DEFINED";
+
+    try
+    {
+      if (checkDone())
+      {
+        return;
+      }
+      List<compbio.data.sequence.FastaSequence> seqs = getInputSequences(alignViewport
+              .getAlignment());
+
+      if (seqs == null)
+      {
+        calcMan.workerComplete(this);
+        return;
+      }
+
+      AlignmentAnnotation[] aa = alignViewport.getAlignment()
+              .getAlignmentAnnotation();
+      if (guiProgress != null)
+      {
+        guiProgress.setProgressBar("JABA " + getServiceActionText(),
+                progressId = System.currentTimeMillis());
+      }
+      if (preset == null && arguments==null)
+      {
+        rslt = aaservice.analize(seqs);
+      }
+      else
+      {
+        try
+        {
+          rslt = aaservice.customAnalize(seqs, getJabaArguments());
+        } catch (WrongParameterException x)
+        {
+          throw new JobSubmissionException(
+                  "Invalid paremeter set. Check Jalview implementation.", x);
+
+        }
+      }
+      boolean finished = false;
+      long rpos = 0;
+      do
+      {
+        JobStatus status = aaservice.getJobStatus(rslt);
+        if (status.equals(JobStatus.FINISHED))
+        {
+          finished = true;
+        }
+        if (calcMan.isPending(this) && this instanceof AAConsClient)
+        {
+          finished = true;
+          // cancel this job and yield to the new job
+          try
+          {
+            if (aaservice.cancelJob(rslt))
+            {
+              System.err.println("Cancelled AACon job: " + rslt);
+            }
+            else
+            {
+              System.err.println("FAILED TO CANCELL AACon job: " + rslt);
+            }
+
+          } catch (Exception x)
+          {
+
+          }
+
+          return;
+        }
+        long cpos;
+        ChunkHolder stats;
+        do
+        {
+          cpos = rpos;
+          try
+          {
+            stats = aaservice.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
+            {
+              throw x;
+            }
+          }
+          if (stats != null)
+          {
+            System.out.print(stats.getChunk());
+            rpos = stats.getNextPosition();
+          }
+        } while (stats != null && rpos > cpos);
+
+        if (!finished && status.equals(JobStatus.FAILED))
+        {
+          try
+          {
+            Thread.sleep(200);
+          } catch (InterruptedException x)
+          {
+          }
+          ;
+        }
+
+      } while (!finished);
+      try
+      {
+        Thread.sleep(200);
+      } catch (InterruptedException x)
+      {
+      }
+      ;
+      scoremanager = aaservice.getAnnotation(rslt);
+      if (scoremanager != null)
+      {
+        updateResultAnnotation(true);
+      }
+    } catch (JobSubmissionException x)
+    {
+
+      System.err.println("submission error:");
+      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);
+      }
+    }
+
+  }
+
+  @Override
+  public void updateAnnotation()
+  {
+    updateResultAnnotation(false);
+  }
+
+  public abstract void updateResultAnnotation(boolean immediate);
+
+  public abstract String getServiceActionText();
+
+  boolean submitGaps = true;
+
+  boolean alignedSeqs = true;
+
+  boolean nucleotidesAllowed = false;
+
+  boolean proteinAllowed = false;
+
+  /**
+   * record sequences for mapping result back to afterwards
+   */
+  protected boolean bySequence = false;
+
+  Map<String, SequenceI> seqNames;
+
+  public List<FastaSequence> getInputSequences(AlignmentI alignment)
+  {
+
+    if (alignment == null || alignment.getWidth() <= 0
+            || alignment.getSequences() == null
+            // || (alignedSeqs && !alignment.isAligned() && !submitGaps)
+            || alignment.isNucleotide() ? !nucleotidesAllowed
+            : !proteinAllowed)
+    {
+      return null;
+    }
+    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>();
+    }
+    for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
+    {
+
+      if (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;
+        seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+                (submitGaps) ? sq.getSequenceAsString() : AlignSeq
+                        .extractGaps(jalview.util.Comparison.GapChars,
+                                sq.getSequenceAsString())));
+        if (seq.getSequence().length() > ln)
+        {
+          ln = seq.getSequence().length();
+        }
+      }
+    }
+    if (alignedSeqs && submitGaps)
+    {
+      // try real hard to return something submittable
+      // TODO: some of AAcons measures need a minimum of two or three amino
+      // acids at each position, and aacons doesn't gracefully degrade.
+      for (int p = 0; p < seqs.size(); p++)
+      {
+        FastaSequence sq = seqs.get(p);
+        int l = sq.getSequence().length();
+        if (l < ln)
+        {
+          char[] padded = new char[ln];
+          System.arraycopy(sq.getSequence().toCharArray(), 0, padded, 0, sq
+                  .getSequence().length());
+          while (l < ln)
+          {
+            padded[l++] = '-';
+          }
+          seqs.set(p, new compbio.data.sequence.FastaSequence(sq.getId(),
+                  new String(padded)));
+        }
+      }
+
+    }
+    return seqs;
+  }
+
+  /**
+   * 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.
+   */
+  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;
+  }
+
+}
index 6e60c07..e6b4cf5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.ws.jws2;
 
+import java.util.List;
+
 import javax.swing.JMenu;
 
+import compbio.metadata.Argument;
+
 import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
 import jalview.gui.WebserviceInfo;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.gui.WsJobParameters;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
 
 /**
- * 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(
+                "Implementation error: Can only instantiate Jaba parameter 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 = new WsJobParameters(sh, preset);
+      if (adjustingExisting)
+      {
+        jobParams.setName("Adjusting parameters for existing Calculation");
+      }
+      if (!jobParams.showRunDialog())
+      {
+        return false;
+      }
+      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.
+      }
+    }
+    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 : ""));
     }
     return null;
   }
index ed808f6..b440de8 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
  */
 package jalview.ws.jws2;
 
+import jalview.bin.Cache;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.ws.WSMenuEntryProviderI;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+
 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.net.URL;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -34,26 +38,7 @@ 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;
 
 /**
@@ -136,6 +121,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
       Cache.log.debug("Old discovery thread has finished.");
     }
     running = true;
+    changeSupport.firePropertyChange("services", services, new Vector());
     oldthread = Thread.currentThread();
     try
     {
@@ -162,17 +148,32 @@ 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())
     {
       JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsservers);
+      if (svctypes.size()==0)
+      {
+        // TODO: remove this ugly hack to get Canonical JABA service ordering for all possible services 
+        for (Services sv:squery.JABAWS2SERVERS)
+        {
+          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 +183,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
       ;
       for (JabaWsServerQuery squery : qrys)
       {
-        finished |= !squery.isRunning();
+        finished = finished && !squery.isRunning();
       }
       if (aborted)
       {
@@ -194,12 +195,32 @@ 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;
+        Vector 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) {
+          services.add(svc);
+        }
+      }
     }
+    oldthread = null;
+    running = false;
+    changeSupport.firePropertyChange("services", new Vector(), services);
   }
 
   /**
@@ -209,199 +230,42 @@ 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();
     service.hasParameters();
-  }
-
-  public class Jws2Instance
-  {
-    public String hosturl;
-
-    public String serviceType;
-
-    public MsaWS service;
-
-    public Jws2Instance(String hosturl, String serviceType, MsaWS service)
-    {
-      super();
-      this.hosturl = hosturl;
-      this.serviceType = serviceType;
-      this.service = service;
-    }
-
-    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 (validServiceUrls==null)
     {
-      if (presets == null)
-      {
-        try
-        {
-          presets = service.getPresets();
-        } catch (Exception ex)
-        {
-          System.err
-                  .println("Exception when retrieving presets for service "
-                          + serviceType + " at " + hosturl);
-        }
-      }
-      return presets;
+      validServiceUrls=new Vector();
     }
-
-    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
-    {
-      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)
-        {
-        }
-
-      }
-      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;
-    }
-  };
+    validServiceUrls.add(jwsservers);
+  }
 
   /**
    * holds list of services.
    */
   protected Vector<Jws2Instance> services;
-
+  /**
+   * attach all available web services to the appropriate submenu in the given JMenu
+   */
   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);
-
+    populateWSMenuEntry(wsmenu, alignFrame, null);
   }
 
-  private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame)
+  private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame, String typeFilter)
   {
     if (running || services == null || services.size() == 0)
     {
@@ -417,9 +281,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     MsaWSClient msacl = new MsaWSClient();
     Vector hostLabels = new Vector();
     jws2al.removeAll();
-    String lasthost = null;
+    Hashtable<String,String> lasthostFor = new Hashtable<String,String>();
     Hashtable<String, ArrayList<Jws2Instance>> hosts = new Hashtable<String, ArrayList<Jws2Instance>>();
-    String[] sorton;
+    ArrayList<String> hostlist=new ArrayList<String>();
     for (Jws2Instance service : services)
     {
       ArrayList<Jws2Instance> hostservices = hosts.get(service.getHost());
@@ -427,12 +291,11 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
       {
         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,7 +308,7 @@ 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)
         {
@@ -475,7 +338,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
           // group
           JMenuItem hitm;
           atpoint.addSeparator();
-          if (lasthost == null || !lasthost.equals(host))
+          if (lasthostFor.get(service.action) == null || !lasthostFor.get(service.action).equals(host))
           {
             atpoint.add(hitm = new JMenuItem(host));
             hitm.setForeground(Color.blue);
@@ -490,14 +353,15 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
             });
             hitm.setToolTipText(JvSwingUtils
                     .wrapTooltip("Opens the JABAWS server's homepage in web browser"));
-            lasthost = host;
+            lasthostFor.put(service.action,host);
           }
           hostLabels.addElement(host + service.serviceType
                   + service.getActionText());
           // hostLabels.addElement(host + (bytype ?
           // service.serviceType+service.getActionText() : ""));
         }
-        msacl.attachWSMenuEntry(atpoint, service, alignFrame);
+        
+        service.attachWSMenuEntry(atpoint, alignFrame);
         /*
          * JMenuItem sitem = new JMenuItem(service.serviceType);
          * sitem.setToolTipText("Hosted at " + service.hosturl);
@@ -517,6 +381,14 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
 
   public static void main(String[] args)
   {
+    if (args.length>0)
+    {
+      testUrls = new Vector<String>();
+      for (String url:args)
+      {
+        testUrls.add(url);
+      };
+    }
     Thread runner = getDiscoverer().startDiscoverer(
             new PropertyChangeListener()
             {
@@ -527,6 +399,11 @@ 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,6 +418,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
       }
       ;
     }
+    try {
+      Thread.sleep(50);
+    } catch (InterruptedException x) {}
   }
 
   private static Jws2Discoverer discoverer;
@@ -590,8 +470,14 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     }
   }
 
+  private static Vector<String> testUrls=null;
   public static Vector<String> getServiceUrls()
   {
+    if (testUrls!=null)
+    {
+      // return test urls, if there are any, instead of touching cache
+      return testUrls;
+    }
     String surls = Cache.getDefault(JWS2HOSTURLS,
             "http://www.compbio.dundee.ac.uk/jabaws");
     Vector<String> urls = new Vector<String>();
@@ -694,7 +580,7 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI
     return thr;
   }
 
-  Vector<String> invalidServiceUrls = null, urlsWithoutServices = null;
+  Vector<String> invalidServiceUrls = null, urlsWithoutServices = null, validServiceUrls=null;
 
   /**
    * @return the invalidServiceUrls
@@ -801,4 +687,18 @@ 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;
+  }
 }
index 4f6ce09..66ef9a6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -31,8 +31,8 @@ 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.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
 
 /**
@@ -48,13 +48,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,7 +58,7 @@ public class MsaWSClient extends Jws2Client
     // TODO Auto-generated constructor stub
   }
 
-  public MsaWSClient(Jws2Discoverer.Jws2Instance sh, WsParamSetI preset,
+  public MsaWSClient(Jws2Instance sh, WsParamSetI preset,
           String altitle, jalview.datamodel.AlignmentView msa,
           boolean submitGaps, boolean preserveOrder, Alignment seqdataset,
           AlignFrame _alignFrame)
@@ -90,14 +84,18 @@ 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
@@ -111,68 +109,7 @@ public class MsaWSClient extends Jws2Client
 
       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,
@@ -254,6 +191,7 @@ public class MsaWSClient extends Jws2Client
     return (WebServiceName.indexOf("lustal") > -1); // cheat!
   }
 
+  
   public void attachWSMenuEntry(JMenu rmsawsmenu,
           final Jws2Instance service, final AlignFrame alignFrame)
   {
index 3ecba74..65873f2 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c4e1ca8..09630f7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java
new file mode 100644 (file)
index 0000000..c78ed98
--- /dev/null
@@ -0,0 +1,181 @@
+/**
+ * 
+ */
+package jalview.ws.jws2;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+
+import compbio.metadata.Argument;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JalviewDialog;
+import jalview.gui.JvSwingUtils;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+/**
+ * @author jimp
+ * 
+ */
+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);
+    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;
+
+    }
+    if (sh.action.toLowerCase().contains("conservation"))
+    {
+      // Build an AACons style client - take alignment, return annotation for
+      // columns
+
+      List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
+              .getCalcManager()
+              .getRegisteredWorkersOfClass(AAConsClient.class);
+      if (clnts == null || clnts.size() == 0)
+      {
+        if (!processParams(sh, editParams))
+        {
+          return;
+        }
+        AAConsClient worker;
+        alignFrame
+                .getViewport()
+                .getCalcManager()
+                .registerWorker(
+                        worker = new AAConsClient(sh, alignFrame, preset,
+                                paramset));
+        alignFrame.getViewport().getCalcManager().startWorker(worker);
+
+      }
+      else
+      {
+        AAConsClient worker = (AAConsClient) 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(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));
+    }
+
+  }
+
+  /*
+   * (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)
+  {
+    boolean hasparams = service.hasParameters();
+    // Assume name ends in WS
+    String calcName = service.serviceType.substring(0,
+            service.serviceType.length() - 2);
+
+    JMenuItem aacons = new JMenuItem(calcName + " Defaults");
+    aacons.addActionListener(new ActionListener()
+    {
+
+      @Override
+      public void actionPerformed(ActionEvent e)
+      {
+        new SequenceAnnotationWSClient(service, alignFrame, null, false);
+      }
+    });
+    wsmenu.add(aacons);
+    if (hasparams)
+    {
+      // only add these menu options if the service has user-modifiable
+      // arguments
+      aacons = new JMenuItem("Edit settings and run ...");
+      aacons.setToolTipText("View and change parameters before running calculation");
+
+      aacons.addActionListener(new ActionListener()
+      {
+        public void actionPerformed(ActionEvent e)
+        {
+          new SequenceAnnotationWSClient(service, alignFrame, null, true);
+        }
+      });
+      wsmenu.add(aacons);
+      List<WsParamSetI> presets = service.getParamStore().getPresets();
+      if (presets != null && presets.size() > 0)
+      {
+        JMenu presetlist = new JMenu("Run " + calcName + "with preset");
+
+        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>");
+          methodR.addActionListener(new ActionListener()
+          {
+            public void actionPerformed(ActionEvent e)
+            {
+              new SequenceAnnotationWSClient(service, alignFrame, preset,
+                      false);
+            }
+
+          });
+          presetlist.add(methodR);
+        }
+        wsmenu.add(presetlist);
+      }
+
+    }
+  }
+}
index c313bd1..9e9e926 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d833725..e527ca3 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2c63841..b30326f 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6fc8169..5904775 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java
new file mode 100644 (file)
index 0000000..49371a8
--- /dev/null
@@ -0,0 +1,185 @@
+package jalview.ws.jws2.jabaws2;
+
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+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 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;
+    
+  }
+
+  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("Implementation Error: Runner Config not available for a JABAWS service of type "+serviceType+" ("+service.getClass()+")");
+  }
+
+  @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)
+      {
+      }
+
+    }
+    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);
+    }
+  }
+}
\ No newline at end of file
index 7cb6a35..09eecca 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7aefe16..20dabaf 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 02f4829..1993603 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b3e8d6e..2a6cea4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5f25e2e..44f7551 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fb23dce..2603f9c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 851be86..147e17c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8d72b2c..ba7d91a 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5983d05..1e8f418 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index e83af2c..c277f70 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4efeaeb..2608eed 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 54210f4..4c886a8 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f1a50a2..17e7dce 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 05d9c1a..51f9001 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 53d15de..fddc4e3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 26b5ea6..981861e 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 00ae610..ca3cba3 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 95de391..ac1188d 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 200c573..e5dd841 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index bdd20c9..5f8eb03 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
@@ -860,10 +860,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)
index 0ea68b1..e0c56da 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
@@ -44,7 +44,6 @@ 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
 {
index 0cd1578..2d28a9c 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index b05b4ed..663f7d7 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 6534e93..d643c15 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index f02c262..2c6d78a 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
@@ -92,7 +92,10 @@ public class SeqGroupIndexVector extends InputType implements
     // blocks
     ArrayList<int[]> gl = new ArrayList<int[]>();
     int p = 0;
-    for (SequenceGroup sg : (Vector<SequenceGroup>) al.getGroups())
+    List<SequenceGroup> sgs;
+    synchronized (sgs=al.getGroups())
+    {
+    for (SequenceGroup sg : sgs)
     {
       if (sg.getSize() < minsize)
       {
@@ -123,6 +126,7 @@ public class SeqGroupIndexVector extends InputType implements
         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)
index 559cadf..43993ed 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 4930e0f..7632067 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index 50fe7e8..e442b5b 100644 (file)
@@ -1,6 +1,6 @@
 /*******************************************************************************
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  *
  * This file is part of Jalview.
  *
index d3385f3..d4501d8 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
 package jalview.ws.seqfetcher;\r
 \r
 import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.DBRefEntry;\r
 import jalview.datamodel.SequenceI;\r
+import jalview.util.DBRefUtils;\r
 \r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
 import java.util.Enumeration;\r
+import java.util.HashSet;\r
 import java.util.Hashtable;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Stack;\r
 import java.util.Vector;\r
 \r
 public class ASequenceFetcher\r
@@ -30,7 +39,7 @@ public class ASequenceFetcher
   /**\r
    * set of databases we can retrieve entries from\r
    */\r
-  protected Hashtable FETCHABLEDBS;\r
+  protected Hashtable<String, Map<String, DbSourceProxy>> FETCHABLEDBS;\r
 \r
   public ASequenceFetcher()\r
   {\r
@@ -75,120 +84,136 @@ public class ASequenceFetcher
   public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)\r
   {\r
     SequenceI[] ret = null;\r
-    Vector rseqs = new Vector();\r
-    Hashtable queries = new Hashtable();\r
+    Vector<SequenceI> rseqs = new Vector();\r
+    Hashtable<String, List<String>> queries = new Hashtable();\r
     for (int r = 0; r < refs.length; r++)\r
     {\r
       if (!queries.containsKey(refs[r].getSource()))\r
       {\r
-        queries.put(refs[r].getSource(), new Vector());\r
+        queries.put(refs[r].getSource(), new ArrayList<String>());\r
       }\r
-      Vector qset = (Vector) queries.get(refs[r].getSource());\r
+      List<String> qset = queries.get(refs[r].getSource());\r
       if (!qset.contains(refs[r].getAccessionId()))\r
       {\r
-        qset.addElement(refs[r].getAccessionId());\r
+        qset.add(refs[r].getAccessionId());\r
       }\r
     }\r
-    Enumeration e = queries.keys();\r
+    Enumeration<String> e = queries.keys();\r
     while (e.hasMoreElements())\r
     {\r
-      Vector query = null;\r
+      List<String> query = null;\r
       String db = null;\r
-      try\r
+      db = e.nextElement();\r
+      query = queries.get(db);\r
+      if (!isFetchable(db))\r
       {\r
-        db = (String) e.nextElement();\r
-        query = (Vector) queries.get(db);\r
-        if (!isFetchable(db))\r
-          throw new Exception(\r
-                  "Don't know how to fetch from this database :" + db);\r
-        DbSourceProxy fetcher = getSourceProxy(db);\r
-        boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
-        // separator\r
-        // - no\r
-        // Multiple\r
-        // Queries\r
-        Enumeration qs = query.elements();\r
-        while (qs.hasMoreElements())\r
+        reportStdError(db, query, new Exception(\r
+                "Don't know how to fetch from this database :" + db));\r
+        continue;\r
+      }\r
+      Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();\r
+      Stack<String> queriesLeft = new Stack<String>();\r
+//      List<String> queriesFailed = new ArrayList<String>();\r
+      queriesLeft.addAll(query);\r
+      while (fetchers.hasNext())\r
+      {\r
+        List<String> queriesMade = new ArrayList<String>();\r
+        HashSet queriesFound = new HashSet<String>();\r
+        try\r
         {\r
-          StringBuffer qsb = new StringBuffer();\r
-          do\r
-          {\r
-            qsb.append((String) qs.nextElement());\r
-            if (qs.hasMoreElements() && doMultiple) // and not reached limit for\r
-            // multiple queries at one\r
-            // time for this source\r
-            {\r
-              qsb.append(fetcher.getAccessionSeparator());\r
-            }\r
-          } while (doMultiple && qs.hasMoreElements());\r
-\r
-          AlignmentI seqset = null;\r
-          try\r
-          {\r
-            // create a fetcher and go to it\r
-            seqset = fetcher.getSequenceRecords(qsb.toString());\r
-          } catch (Exception ex)\r
+          DbSourceProxy fetcher = fetchers.next();\r
+          boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
+          // separator\r
+          // - no\r
+          // Multiple\r
+          // Queries\r
+          while (!queriesLeft.isEmpty())\r
           {\r
-            System.err.println("Failed to retrieve the following from "\r
-                    + db);\r
-            System.err.println(qsb);\r
-            ex.printStackTrace(System.err);\r
-          }\r
-          // TODO: Merge alignment together - perhaps\r
-          if (seqset != null)\r
-          {\r
-            SequenceI seqs[] = seqset.getSequencesArray();\r
-            if (seqs != null)\r
+            StringBuffer qsb = new StringBuffer();\r
+            do\r
             {\r
-              for (int is = 0; is < seqs.length; is++)\r
+              if (qsb.length() > 0)\r
               {\r
-                rseqs.addElement(seqs[is]);\r
-                seqs[is] = null;\r
+                qsb.append(fetcher.getAccessionSeparator());\r
               }\r
+              String q = queriesLeft.pop();\r
+              queriesMade.add(q);\r
+              qsb.append(q);\r
+            } while (doMultiple && !queriesLeft.isEmpty());\r
+\r
+            AlignmentI seqset = null;\r
+            try\r
+            {\r
+              // create a fetcher and go to it\r
+              seqset = fetcher.getSequenceRecords(qsb.toString()); // ,\r
+                      // queriesFailed);\r
+            } catch (Exception ex)\r
+            {\r
+              System.err.println("Failed to retrieve the following from "\r
+                      + db);\r
+              System.err.println(qsb);\r
+              ex.printStackTrace(System.err);\r
             }\r
-            else\r
+            // TODO: Merge alignment together - perhaps\r
+            if (seqset != null)\r
             {\r
-              if (fetcher.getRawRecords() != null)\r
+              SequenceI seqs[] = seqset.getSequencesArray();\r
+              if (seqs != null)\r
               {\r
-                System.out.println("# Retrieved from " + db + ":"\r
-                        + qs.toString());\r
-                StringBuffer rrb = fetcher.getRawRecords();\r
-                /*\r
-                 * for (int rr = 0; rr<rrb.length; rr++) {\r
-                 */\r
-                String hdr;\r
-                // if (rr<qs.length)\r
-                // {\r
-                hdr = "# " + db + ":" + qsb.toString();\r
-                /*\r
-                 * } else { hdr = "# part "+rr; }\r
-                 */\r
-                System.out.println(hdr);\r
-                if (rrb != null)\r
-                  System.out.println(rrb);\r
-                System.out.println("# end of " + hdr);\r
+                for (int is = 0; is < seqs.length; is++)\r
+                {\r
+                  rseqs.addElement(seqs[is]);\r
+                  DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]\r
+                          .getDBRef(), new DBRefEntry(db, null, null));\r
+                  if (frefs != null)\r
+                  {\r
+                    for (DBRefEntry dbr : frefs)\r
+                    {\r
+                      queriesFound.add(dbr.getAccessionId());\r
+                      queriesMade.remove(dbr.getAccessionId());\r
+                    }\r
+                  }\r
+                  seqs[is] = null;\r
+                }\r
+              }\r
+              else\r
+              {\r
+                if (fetcher.getRawRecords() != null)\r
+                {\r
+                  System.out.println("# Retrieved from " + db + ":"\r
+                          + qsb.toString());\r
+                  StringBuffer rrb = fetcher.getRawRecords();\r
+                  /*\r
+                   * for (int rr = 0; rr<rrb.length; rr++) {\r
+                   */\r
+                  String hdr;\r
+                  // if (rr<qs.length)\r
+                  // {\r
+                  hdr = "# " + db + ":" + qsb.toString();\r
+                  /*\r
+                   * } else { hdr = "# part "+rr; }\r
+                   */\r
+                  System.out.println(hdr);\r
+                  if (rrb != null)\r
+                    System.out.println(rrb);\r
+                  System.out.println("# end of " + hdr);\r
+                }\r
+\r
               }\r
             }\r
+\r
           }\r
+        } catch (Exception ex)\r
+        {\r
+          reportStdError(db, queriesMade, ex);\r
         }\r
-      } catch (Exception ex)\r
-      {\r
-        System.err\r
-                .println("Failed to retrieve the following references from "\r
-                        + db);\r
-        Enumeration qv = query.elements();\r
-        int n = 0;\r
-        while (qv.hasMoreElements())\r
+        if (queriesMade.size() > 0)\r
         {\r
-          System.err.print(" " + qv.nextElement() + ";");\r
-          if (n++ > 10)\r
-          {\r
-            System.err.println();\r
-            n = 0;\r
-          }\r
+          System.out.println("# Adding " + queriesMade.size()\r
+                  + " ids back to queries list for searching again (" + db\r
+                  + ".");\r
+          queriesLeft.addAll(queriesMade);\r
         }\r
-        System.err.println();\r
-        ex.printStackTrace();\r
       }\r
     }\r
     if (rseqs.size() > 0)\r
@@ -206,6 +231,26 @@ public class ASequenceFetcher
     return ret;\r
   }\r
 \r
+  public void reportStdError(String db, List<String> queriesMade,\r
+          Exception ex)\r
+  {\r
+\r
+    System.err.println("Failed to retrieve the following references from "\r
+            + db);\r
+    int n = 0;\r
+    for (String qv : queriesMade)\r
+    {\r
+      System.err.print(" " + qv + ";");\r
+      if (n++ > 10)\r
+      {\r
+        System.err.println();\r
+        n = 0;\r
+      }\r
+    }\r
+    System.err.println();\r
+    ex.printStackTrace();\r
+  }\r
+\r
   /**\r
    * Retrieve an instance of the proxy for the given source\r
    * \r
@@ -214,9 +259,28 @@ public class ASequenceFetcher
    *          retrieval of specific DB source/version combinations.\r
    * @return an instance of DbSourceProxy for that db.\r
    */\r
-  public DbSourceProxy getSourceProxy(String db)\r
+  public List<DbSourceProxy> getSourceProxy(String db)\r
   {\r
-    DbSourceProxy dbs = (DbSourceProxy) FETCHABLEDBS.get(db);\r
+    List<DbSourceProxy> dbs;\r
+    Collection<DbSourceProxy> dblist = FETCHABLEDBS.get(db).values();\r
+    if (dblist.size()>1)\r
+    {\r
+      DbSourceProxy[] l=dblist.toArray(new DbSourceProxy[0]);\r
+      int i=0;\r
+      String[] nm=new String[l.length];\r
+      for (DbSourceProxy s:l)\r
+      {\r
+        nm[i++]=s.getDbName().toLowerCase();\r
+      }\r
+      jalview.util.QuickSort.sort(nm,l);\r
+      dbs = new ArrayList<DbSourceProxy>();\r
+      for (i=l.length-1;i>=0; i--)\r
+      {\r
+        dbs.add(l[i]);\r
+      }\r
+    } else {\r
+      dbs = new ArrayList<DbSourceProxy>(dblist);\r
+    }\r
     return dbs;\r
   }\r
 \r
@@ -268,15 +332,22 @@ public class ASequenceFetcher
     {\r
       if (FETCHABLEDBS == null)\r
       {\r
-        FETCHABLEDBS = new Hashtable();\r
+        FETCHABLEDBS = new Hashtable<String, Map<String,DbSourceProxy>>();\r
+      }\r
+      Map<String,DbSourceProxy> slist = FETCHABLEDBS.get(proxy.getDbSource());\r
+      if (slist == null)\r
+      {\r
+        FETCHABLEDBS.put(proxy.getDbSource(),\r
+                slist = new Hashtable<String,DbSourceProxy>());\r
       }\r
-      FETCHABLEDBS.put(proxy.getDbSource(), proxy);\r
+      slist.put(proxy.getDbName(),proxy);\r
     }\r
   }\r
 \r
   /**\r
    * test if the database handler for dbName contains the given dbProperty\r
-   * \r
+   * when a dbName resolves to a set of proxies - this method will return the result of the test for the first instance.\r
+   * TODO implement additional method to query all sources for a db to find one with a particular property\r
    * @param dbName\r
    * @param dbProperty\r
    * @return true if proxy has the given property\r
@@ -284,12 +355,16 @@ public class ASequenceFetcher
   public boolean hasDbSourceProperty(String dbName, String dbProperty)\r
   {\r
     // TODO: decide if invalidDbName exception is thrown here.\r
-    DbSourceProxy proxy = getSourceProxy(dbName);\r
-    if (proxy != null)\r
+\r
+    List<DbSourceProxy> proxies = getSourceProxy(dbName);\r
+    if (proxies != null)\r
     {\r
-      if (proxy.getDbSourceProperties() != null)\r
+      for (DbSourceProxy proxy : proxies)\r
       {\r
-        return proxy.getDbSourceProperties().containsKey(dbProperty);\r
+        if (proxy.getDbSourceProperties() != null)\r
+        {\r
+          return proxy.getDbSourceProperties().containsKey(dbProperty);\r
+        }\r
       }\r
     }\r
     return false;\r
@@ -319,10 +394,12 @@ public class ASequenceFetcher
     while (dbs.hasMoreElements())\r
     {\r
       String dbn = (String) dbs.nextElement();\r
-      DbSourceProxy dbp = (DbSourceProxy) FETCHABLEDBS.get(dbn);\r
-      if (class1.isAssignableFrom(dbp.getClass()))\r
+      for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())\r
       {\r
-        src.addElement(dbn);\r
+        if (class1.isAssignableFrom(dbp.getClass()))\r
+        {\r
+          src.addElement(dbn);\r
+        }\r
       }\r
     }\r
     if (src.size() > 0)\r
@@ -331,4 +408,20 @@ public class ASequenceFetcher
     }\r
     return sources;\r
   }\r
+  public DbSourceProxy[] getDbSourceProxyInstances(\r
+          Class class1)\r
+  {\r
+    ArrayList<DbSourceProxy> prlist=new ArrayList<DbSourceProxy>();\r
+    for (String fetchable:getSupportedDb())\r
+    for (DbSourceProxy pr:getSourceProxy(fetchable))\r
+    {\r
+      if (class1.isInstance(pr)) {prlist.add(pr);}\r
+    }\r
+    if (prlist.size()==0)\r
+    {\r
+      return null;\r
+    }\r
+    return prlist.toArray(new DbSourceProxy[0]);\r
+  }\r
+\r
 }\r
index ea3fc0f..4b9c472 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
@@ -31,7 +31,7 @@ import com.stevesoft.pat.Regex;
  * database (unify with io)\r
  * \r
  * @author JimP\r
- * \r
+ * TODO: promote to API\r
  */\r
 public interface DbSourceProxy\r
 {\r
@@ -100,11 +100,10 @@ public interface DbSourceProxy
   /**\r
    * make one or more queries to the database and attempt to parse the response\r
    * into an alignment\r
-   * \r
-   * @param queries\r
+   * @param queries - one or more queries for database in expected form\r
    * @return null if queries were successful but result was not parsable\r
-   * @throws Exception\r
-   *           TODO\r
+   * @throws Exception - propagated from underlying transport to database (note - exceptions are not raised if query not found in database)\r
+   *           \r
    */\r
   public AlignmentI getSequenceRecords(String queries) throws Exception;\r
 \r
index 1467aaf..89d41fa 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
diff --git a/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java b/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java
deleted file mode 100755 (executable)
index 7d35dea..0000000
+++ /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 100755 (executable)
index b6badc7..0000000
+++ /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 100755 (executable)
index fe5be8b..0000000
+++ /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 100755 (executable)
index 172078b..0000000
+++ /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 100755 (executable)
index 720c60b..0000000
+++ /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 100755 (executable)
index e91bc77..0000000
+++ /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 100755 (executable)
index 196b681..0000000
+++ /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 100755 (executable)
index 71d59e0..0000000
+++ /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 100755 (executable)
index 2f5a7ed..0000000
+++ /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 100755 (executable)
index 3e4d8e8..0000000
+++ /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 100755 (executable)
index 0ee0b5e..0000000
+++ /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 100755 (executable)
index 62a28f6..0000000
+++ /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 100755 (executable)
index 54afa25..0000000
+++ /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 100755 (executable)
index c46d709..0000000
+++ /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 100755 (executable)
index fea8a0f..0000000
+++ /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 100755 (executable)
index dbae74d..0000000
+++ /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 100755 (executable)
index 8936a16..0000000
+++ /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 100755 (executable)
index 892963b..0000000
+++ /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 100755 (executable)
index 0d52fd9..0000000
+++ /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 (file)
index d8cbebe..0000000
+++ /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 100755 (executable)
index dd89ef3..0000000
+++ /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 &lt; features; i++)
-   * {
-   *   Map f = features[i];
-   *   String type = (String) f.get(&quot;TYPE&quot;);
-   *   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 100755 (executable)
index 235c486..0000000
+++ /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 100755 (executable)
index a19ae4d..0000000
+++ /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 100755 (executable)
index 484cf49..0000000
+++ /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 100755 (executable)
index df3a687..0000000
+++ /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 (file)
index 0ad2df7..0000000
+++ /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 (file)
index 12c5e1d..0000000
+++ /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 (file)
index 2b75c22..0000000
+++ /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 (file)
index aa38981..0000000
+++ /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 (file)
index e7b6bbd..0000000
+++ /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 (file)
index 4818e10..0000000
+++ /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 (file)
index a13fbb3..0000000
+++ /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 (file)
index 8663081..0000000
+++ /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 (file)
index 7a7ea25..0000000
+++ /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 (file)
index 78e2840..0000000
+++ /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 (file)
index 68a2c16..0000000
+++ /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 (file)
index dba25e9..0000000
+++ /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;
-
-  }
-}
index caae608..6fe8f8f 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 21dd4f3..36d05c9 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 818eab1..160293a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 871832c..c38720d 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index ca7d651..3a7df11 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 106d3b4..a946bc5 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 37cebc0..53d57df 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e31f5d0..7cd7410 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7e45712..278dc31 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 849a0f8..0d2f76b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ddd94d4..4d33eb1 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cdfd618..3535305 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 3a4a2ab..3e76fd0 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 05ded00..c884909 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 80a870b..b581d05 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index 37eefad..e5fe2f4 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 27d233d..38c1079 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d525218..268ab5b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8c427cb..7e453ba 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4270e55..f3e7d51 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cf5fdb0..f812ac8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3205207..1302463 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f36c6cc..ed62d9f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7df1599..35bb843 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3520905..258df90 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fab0138..5c92a28 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0f0e7e2..d309db8 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ed2f541..aa1795b 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 82332bd..0055387 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 63bf731..59ef7e6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 71084c0..82331fd 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index fb11db5..7a0433d 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
  * \r
  * This file is part of Jalview.\r
  * \r
index ac44b66..e11eb74 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index dc866f4..a3c8088 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c8aef7f..018b1d6 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 82a7e4b..dddef03 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7e44a42..16e0dcb 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 3444b8d..40126bc 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
diff --git a/test/jalview/io/TCoffeeScoreFileTest.java b/test/jalview/io/TCoffeeScoreFileTest.java
new file mode 100644 (file)
index 0000000..85c0bff
--- /dev/null
@@ -0,0 +1,161 @@
+package jalview.io;
+
+import static org.junit.Assert.*;
+import jalview.io.TCoffeeScoreFile.Block;
+import jalview.io.TCoffeeScoreFile.Header;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.List;
+
+import org.junit.Test;
+
+public class TCoffeeScoreFileTest {
+
+       final static File SCORE_FILE = new File("test/jalview/io/tcoffee.score_ascii");
+        final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln");
+       
+       @Test
+       public void testReadHeader() throws IOException, FileNotFoundException {
+
+               TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
+               assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
+               Header header = scoreFile.header;
+               assertNotNull(header);
+               assertEquals( "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", header.head );
+               assertEquals( 90, header.score );
+               assertEquals( 89, header.getScoreFor("1PHT") );
+               assertEquals( 90, header.getScoreFor("1BB9") );
+               assertEquals( 94, header.getScoreFor("1UHC") );
+               assertEquals( 94, header.getScoreFor("1YCS") );
+               assertEquals( 93, header.getScoreFor("1OOT") );
+               assertEquals( 94, header.getScoreFor("1ABO") );
+               assertEquals( 94, header.getScoreFor("1FYN") );
+               assertEquals( 94, header.getScoreFor("1QCF") );
+               assertEquals( 90, header.getScoreFor("cons") );
+       }
+       
+       
+       @Test
+       public void testWrongFile() {
+           try {
+               TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
+               assertFalse(result.isValid());
+           } catch (IOException x)
+           {
+             assertTrue("File not found exception thrown",x instanceof FileNotFoundException);
+           }
+       } 
+
+       @Test
+       public void testHeightAndWidth() throws IOException {
+               TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
+               assertTrue(result.isValid());
+               assertEquals( 8, result.getHeight() );
+               assertEquals( 83, result.getWidth() );
+       }       
+       
+       @Test
+       public void testReadBlock( ) throws IOException {
+               
+               String BLOCK = "\n" +
+                               "\n" +
+                               "\n" +
+                               "1PHT   999999999999999999999999998762112222543211112134\n" +
+                               "1BB9   99999999999999999999999999987-------4322----2234  \n" +
+                               "1UHC   99999999999999999999999999987-------5321----2246\n" +
+                               "1YCS   99999999999999999999999999986-------4321----1-35\n" +
+                               "1OOT   999999999999999999999999999861-------3------1135  \n" +
+                               "1ABO   99999999999999999999999999986-------422-------34\n" +
+                               "1FYN   99999999999999999999999999985-------32--------35\n" +
+                               "1QCF   99999999999999999999999999974-------2---------24\n" +
+                               "cons   999999999999999999999999999851000110321100001134\n" +
+                               "\n" +
+                               "\n";
+               FileParse source=new FileParse(BLOCK, FormatAdapter.PASTE);
+               Block block = TCoffeeScoreFile.readBlock(source, 0);
+
+                assertNotNull(block);
+               assertEquals( "999999999999999999999999998762112222543211112134", block.getScoresFor("1PHT") );
+               assertEquals( "99999999999999999999999999987-------4322----2234", block.getScoresFor("1BB9") );
+               assertEquals( "99999999999999999999999999987-------5321----2246", block.getScoresFor("1UHC") );
+               assertEquals( "99999999999999999999999999986-------4321----1-35", block.getScoresFor("1YCS") );
+               assertEquals( "999999999999999999999999999861-------3------1135", block.getScoresFor("1OOT") );
+               assertEquals( "99999999999999999999999999986-------422-------34", block.getScoresFor("1ABO") );
+               assertEquals( "99999999999999999999999999985-------32--------35", block.getScoresFor("1FYN") );
+               assertEquals( "99999999999999999999999999974-------2---------24", block.getScoresFor("1QCF") );
+               assertEquals( "999999999999999999999999999851000110321100001134", block.getConsensus() );
+       }
+
+       @Test
+       public void testParse() throws IOException {
+
+               TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
+
+               assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", parser.getScoresFor("1PHT") );
+               assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", parser.getScoresFor("1BB9") );
+               assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", parser.getScoresFor("1UHC") );
+               assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", parser.getScoresFor("1YCS") );
+               assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", parser.getScoresFor("1OOT") );
+               assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", parser.getScoresFor("1ABO") );
+               assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", parser.getScoresFor("1FYN") );
+               assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", parser.getScoresFor("1QCF") );
+               assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", parser.getScoresFor("cons") );             
+       }
+
+       
+       @Test
+       public void testGetAsList() throws IOException {
+               
+          TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
+          assertTrue(parser.getWarningMessage(),parser.isValid());
+               List<String> scores = parser.getScoresList();
+               assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", scores.get(0) );
+               assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", scores.get(1) );
+               assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", scores.get(2) );
+               assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", scores.get(3) );
+               assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", scores.get(4) );
+               assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", scores.get(5) );
+               assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", scores.get(6) );
+               assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", scores.get(7) );
+               assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", scores.get(8) );           
+               
+       } 
+       
+       
+       @Test
+       public void testGetAsArray() throws IOException {
+               
+          TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
+          assertTrue(parser.getWarningMessage(),parser.isValid());
+               byte[][] scores = parser.getScoresArray();
+       
+               assertEquals( 9, scores[0][0] );
+               assertEquals( 9, scores[1][0] );
+               assertEquals( 9, scores[2][0] );
+               assertEquals( 9, scores[3][0] );
+               assertEquals( 9, scores[4][0] );
+               assertEquals( 9, scores[5][0] );
+               assertEquals( 9, scores[6][0] );
+               assertEquals( 9, scores[7][0] );
+               assertEquals( 9, scores[8][0] );
+               
+               assertEquals( 5, scores[0][36] );
+               assertEquals( 4, scores[1][36] );
+               assertEquals( 5, scores[2][36] );
+               assertEquals( 4, scores[3][36] );
+               assertEquals( -1, scores[4][36] );
+               assertEquals( 4, scores[5][36] );
+               assertEquals( 3, scores[6][36] );
+               assertEquals( 2, scores[7][36] );
+               assertEquals( 3, scores[8][36] );
+               
+       } 
+       
+       
+       
+}
diff --git a/test/jalview/io/tcoffee.fasta_aln b/test/jalview/io/tcoffee.fasta_aln
new file mode 100644 (file)
index 0000000..63b12b1
--- /dev/null
@@ -0,0 +1,24 @@
+>1PHT
+YQYRALYDYKKEREEDIDLHLGDILTVNKGSLVALGFSDGQEARPEEI--
+--------GWLNGYNETTGERGDFPGTYVEYIG
+>1BB9
+FKVQAQHDYTATDTDELQLKAGDVVLVIP-------FQNP----EEQDEG
+WLMGVKESDWNQHK-ELEKCRGVFPENFTERVQ
+>1UHC
+QVYFAVYTFKARNPNELSVSANQKLKILE-------FKDV----TGNT--
+--------EWWLAE--VNGKKGYVPSNYIRKTE
+>1YCS
+GVIYALWDYEPQNDDELPMKEGDCMTIIH-------REDE----D-EI--
+--------EWWWA--RLNDKEGYVPRNLLGLYP
+>1OOT
+PKAVALYSFAGEESGDLPFRKGDVITILKK-------S------DSQN--
+--------DWWTG--RVNGREGIFPANYVE-LV
+>1ABO
+NLFVALYDFVASGDNTLSITKGEKLRVLG-------YNH-------NG--
+--------EWCEAQ--TKNGQGWVPSNYITPVN
+>1FYN
+TLFVALYDYEARTEDDLSFHKGEKFQILN-------SS--------EG--
+--------DWWEARSLTTGETGYIPSNYVAPVD
+>1QCF
+IIVVALYDYEAIHHEDLSFQKGDQMVVLE-------E---------SG--
+--------EWWKARSLATRKEGYIPSNYVARVD
\ No newline at end of file
diff --git a/test/jalview/io/tcoffee.score_ascii b/test/jalview/io/tcoffee.score_ascii
new file mode 100644 (file)
index 0000000..2b533a3
--- /dev/null
@@ -0,0 +1,37 @@
+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
index 9b317a7..a227676 100755 (executable)
@@ -1148,7 +1148,7 @@ and any path to a file to save to the file]]></string>
                                                                <string><![CDATA[664]]></string>
                                                        </property>
                                                        <property name="sourceName">
-                                                               <string><![CDATA[min-jaba-client.jar]]></string>
+                                                               <string><![CDATA[min-jaba-client-2.0.jar]]></string>
                                                        </property>
                                                        <property name="overrideUnixPermissions">
                                                                <boolean>false</boolean>
@@ -1166,7 +1166,7 @@ and any path to a file to save to the file]]></string>
                                                                <boolean>true</boolean>
                                                        </property>
                                                        <property name="destinationName">
-                                                               <string><![CDATA[min-jaba-client.jar]]></string>
+                                                               <string><![CDATA[min-jaba-client-2.0.jar]]></string>
                                                        </property>
                                                        <property name="fileSize">
                                                                <long>81728</long>
@@ -1501,6 +1501,53 @@ and any path to a file to save to the file]]></string>
                                                        </property>
                                                </object>
                                        </method>
+                                       
+                                       <method name="addElement">
+                                               <object class="com.zerog.ia.installer.actions.InstallZipfile" objectID="df3a5220b6bc">
+                                                       <property name="belongsToUninstallPhase">
+                                                               <boolean>false</boolean>
+                                                       </property>
+                                                       <property name="rollbackEnabledCancel">
+                                                               <boolean>true</boolean>
+                                                       </property>
+                                                       <property name="rollbackEnabledError">
+                                                               <boolean>true</boolean>
+                                                       </property>
+                                                       <property name="unixPermissions">
+                                                               <string><![CDATA[664]]></string>
+                                                       </property>
+                                                       <property name="sourceName">
+                                                               <string><![CDATA[VARNAv3-9-dev.jar]]></string>
+                                                       </property>
+                                                       <property name="overrideUnixPermissions">
+                                                               <boolean>false</boolean>
+                                                       </property>
+                                                       <property name="sourcePath">
+                                                               <string><![CDATA[/homes/ws-dev1/jalview/lib/]]></string>
+                                                       </property>
+                                                       <property name="shouldUninstall">
+                                                               <boolean>true</boolean>
+                                                       </property>
+                                                       <property name="rollbackEnabledCancel">
+                                                               <boolean>true</boolean>
+                                                       </property>
+                                                       <property name="rollbackEnabledError">
+                                                               <boolean>true</boolean>
+                                                       </property>
+                                                       <property name="destinationName">
+                                                               <string><![CDATA[VARNAv3-9-dev.jar]]></string>
+                                                       </property>
+                                                       <property name="fileSize">
+                                                               <long>663408</long>
+                                                       </property>
+                                                       <property name="macBinary">
+                                                               <boolean>false</boolean>
+                                                       </property>
+                                                       <property name="targetCheckKind">
+                                                               <int>0</int>
+                                                       </property>
+                                               </object>
+                                       </method>
                                </object>
                        </property>
                        <property name="rulesFailedMessage">
@@ -4156,6 +4203,7 @@ and any path to a file to read from that file]]></string>
                                                                                <object refID="8fbb17529b9d"/>
                                                                                <object refID="aa3a521fb6bc"/>
                                                                                <object refID="aa3a5220b6bc"/>
+                                                                               <object refID="df3a5220b6bc"/>
                                                                                <object refID="aa3a5220b6bc1"/>
                                                                                <object class="com.zerog.ia.installer.actions.InstallDirectory" objectID="24485f85a670">
                                                                                        <property name="belongsToUninstallPhase">
@@ -4219,6 +4267,7 @@ and any path to a file to read from that file]]></string>
                                                                                                <object refID="8fbb17529b9d"/>
                                                                                                <object refID="aa3a521fb6bc"/>
                                                                                                <object refID="aa3a5220b6bc"/>
+                                                                                               <object refID="df3a5220b6bc"/>
                                                                                                <object refID="aa3a5220b6bc1"/>
                                                                                        </visualChildren>
                                                                                </object>
index fa17a26..b43ee7e 100644 (file)
@@ -1,7 +1,7 @@
 <?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
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index bf92753..632f709 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 663224a..c94602d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index efffcd6..afe8c9f 100755 (executable)
@@ -1,6 +1,6 @@
 /*
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index abe255c..048fb91 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5cef455..aed643b 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 76b2568..a03a669 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 68ad176..8c5fad9 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 7349d5b..8c08a14 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index a99514d..0e2e81c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d2b0676..669f417 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 788e27e..c424c06 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c6075d5..78a141c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8c5e599..b68494c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 60f50a4..1451f11 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4b45dc1..9c28929 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f3aa3dc..ba1c7e3 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0b9a518..18455fe 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 767376e..9c83b28 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 537e110..e7edc5c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index bef1bb7..867c704 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 91ac51e..b32a071 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index adcf3bd..d6baade 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 208eba4..89189bf 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d092461..9338ba2 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 701ce16..e0c916a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 0e69868..50c87ce 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 58804fb..d5d80f5 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index adc862c..c17223a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 44db0d6..ea66215 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ae1e75c..7a6c732 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 58bade3..08cf3b7 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 745a414..d8c663a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 28cd01b..3732fd5 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index be025aa..8984c2c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1c8785e..648157e 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 06b1056..4f21931 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 84f3bfd..dc060e9 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 22b4dca..d74d939 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 4ae2884..0ee9fdc 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 817a63b..00ea4c0 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 61b98e9..b1c7073 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d9c4657..2d5e7e6 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 5453356..e67cba0 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f5bf177..ed14571 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 10fc687..c69ab9b 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 94ac39c..891de41 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 8fda026..8f9599a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 6f5a5d4..b9a67c8 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 1b1c243..b0c39f9 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 17deca7..3faf2ca 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index f7dd356..6005ae2 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index cbc5291..9062224 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index facb504..2b15f01 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index c5f70e9..8199ce6 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 884b47c..9be092b 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 696f538..3c53e3d 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d4cf0ac..266e678 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 36ca7a8..671b270 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e8c0176..77769ae 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b473194..635ec6b 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fb653a6..e1ac35a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index e0dfc7a..76cf1c2 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 77fe1b6..20ac57a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index b4446c3..48aa2db 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index d388f70..535ac9b 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index fb8f9f6..cc384ab 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9355268..878a49a 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 9ef7eff..c72ac4d 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 2c54ab8..ddb7f0d 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index ef407d5..a8022e3 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 21a73a9..4a7a80c 100755 (executable)
@@ -1,7 +1,7 @@
 
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  * 
index 77a656b..c468222 100755 (executable)
@@ -1,7 +1,7 @@
 <html><head>
 <!--
  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
  * 
  * This file is part of Jalview.
  *