From 59d682209891099d46b960509907c79e3fb276fe Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 4 Oct 2012 17:43:26 +0100 Subject: [PATCH] Jalview 2.8 Source Header --- doc/AddingGroovySupport.html | 6 +- doc/JalviewRNASupport.html | 6 +- doc/building.html | 6 +- doc/developing.html | 82 +- doc/index.html | 306 +- doc/newdmobj.html | 72 +- examples/appletParameters.html | 29 +- examples/applets.html | 241 +- examples/embedded.html | 93 +- examples/embeddedWJmol.html | 503 +- examples/exampleFeatures.txt | 639 +- examples/formComplete.html | 17 + examples/jalviewLiteJs.html | 17 + examples/javascript/jalview.js | 634 +- examples/javascriptLaunch.html | 19 +- examples/linkedapplets_ng.html | 489 +- help/help.hs | 17 + help/help.jhm | 17 + help/helpTOC.xml | 30 +- help/html/calculations/consensus.html | 6 +- help/html/calculations/conservation.html | 6 +- help/html/calculations/pairwise.html | 6 +- help/html/calculations/pca.html | 6 +- help/html/calculations/quality.html | 6 +- help/html/calculations/recoverInputdata.html | 6 +- help/html/calculations/redundancy.html | 6 +- help/html/calculations/scorematrices.html | 19 +- help/html/calculations/sorting.html | 6 +- help/html/calculations/structureconsensus.html | 6 +- help/html/calculations/tree.html | 6 +- help/html/calculations/treeviewer.html | 6 +- help/html/colourSchemes/abovePID.html | 6 +- help/html/colourSchemes/annotationColouring.html | 6 +- help/html/colourSchemes/blosum.html | 6 +- help/html/colourSchemes/buried.html | 6 +- help/html/colourSchemes/clustal.html | 6 +- help/html/colourSchemes/conservation.html | 6 +- help/html/colourSchemes/helix.html | 6 +- help/html/colourSchemes/hydrophobic.html | 6 +- help/html/colourSchemes/index.html | 6 +- help/html/colourSchemes/nucleotide.html | 6 +- help/html/colourSchemes/pid.html | 6 +- help/html/colourSchemes/purinepyrimidine.html | 6 +- help/html/colourSchemes/rnahelicesColouring.html | 6 +- help/html/colourSchemes/strand.html | 6 +- help/html/colourSchemes/taylor.html | 6 +- help/html/colourSchemes/textcolour.html | 6 +- help/html/colourSchemes/turn.html | 6 +- help/html/colourSchemes/user.html | 6 +- help/html/colourSchemes/zappo.html | 6 +- help/html/editing/index.html | 6 +- help/html/features/annotation.html | 6 +- help/html/features/annotationsFormat.html | 6 +- help/html/features/clarguments.html | 6 +- help/html/features/codingfeatures.html | 66 +- help/html/features/commandline.html | 6 +- help/html/features/creatinFeatures.html | 6 +- help/html/features/cursorMode.html | 6 +- help/html/features/dasfeatures.html | 6 +- help/html/features/dassettings.html | 6 +- help/html/features/editingFeatures.html | 6 +- help/html/features/featuresFormat.html | 6 +- help/html/features/featureschemes.html | 6 +- help/html/features/featuresettings.html | 6 +- help/html/features/groovy.html | 188 +- help/html/features/hiddenRegions.html | 6 +- help/html/features/jalarchive.html | 6 +- help/html/features/jmol.html | 428 +- help/html/features/multipleViews.html | 6 +- help/html/features/newkeystrokes.html | 6 +- help/html/features/overview.html | 6 +- help/html/features/pdbviewer.html | 6 +- help/html/features/preferences.html | 6 +- help/html/features/search.html | 6 +- help/html/features/seqfeatures.html | 6 +- help/html/features/seqfetch.html | 6 +- help/html/features/seqmappings.html | 78 +- help/html/features/varna.html | 148 +- help/html/features/viewingpdbs.html | 6 +- help/html/features/wrap.html | 6 +- help/html/index.html | 6 +- help/html/io/export.html | 6 +- help/html/io/exportseqreport.html | 6 +- help/html/io/fileformats.html | 6 +- help/html/io/index.html | 6 +- help/html/io/modellerpir.html | 6 +- help/html/io/tcoffeescores.html | 8 +- help/html/jalviewjnlp.html | 6 +- help/html/keys.html | 6 +- help/html/memory.html | 6 +- help/html/menus/alignmentMenu.html | 6 +- help/html/menus/alwannotations.html | 6 +- help/html/menus/alwcalculate.html | 6 +- help/html/menus/alwcolour.html | 6 +- help/html/menus/alwedit.html | 6 +- help/html/menus/alwfile.html | 6 +- help/html/menus/alwformat.html | 6 +- help/html/menus/alwselect.html | 6 +- help/html/menus/alwview.html | 6 +- help/html/menus/desktopMenu.html | 6 +- help/html/menus/index.html | 6 +- help/html/menus/popupMenu.html | 6 +- help/html/menus/wsmenu.html | 6 +- help/html/misc/aaproperties.html | 6 +- help/html/misc/aminoAcids.html | 6 +- help/html/misc/geneticCode.html | 6 +- help/html/na/index.html | 6 +- help/html/privacy.html | 6 +- help/html/releases.html | 6 +- help/html/vamsas/index.html | 6 +- help/html/webServices/AACon.html | 6 +- help/html/webServices/JABAWS.html | 6 +- help/html/webServices/dbreffetcher.html | 171 +- help/html/webServices/index.html | 7 +- help/html/webServices/jnet.html | 6 +- help/html/webServices/msaclient.html | 6 +- help/html/webServices/newsreader.html | 17 + help/html/webServices/proteinDisorder.html | 6 +- help/html/webServices/shmr.html | 6 +- help/html/webServices/urllinks.html | 6 +- help/html/webServices/webServicesParams.html | 7 +- help/html/webServices/webServicesPrefs.html | 7 +- help/html/whatsNew.html | 6 +- nbproject/genfiles.properties | 12 +- nbproject/project.properties | 12 +- nbproject/project.xml | 34 +- resources/embl_mapping.xml | 316 +- resources/uniprot_mapping.xml | 30 +- schemas/JalviewUserColours.xsd | 30 +- schemas/JalviewWsParamSet.xsd | 30 +- schemas/castor-mapping.xsd | 628 +- schemas/jalview.nodesc.properties | 38 +- schemas/jalview.properties | 38 +- schemas/jalview.xsd | 30 +- schemas/jalviewJvV1.xsd | 324 +- schemas/vamsas.xsd | 30 +- schemas/vamsasJvV1.xsd | 182 +- src/MCview/AppletPDBCanvas.java | 6 +- src/MCview/AppletPDBViewer.java | 6 +- src/MCview/Atom.java | 6 +- src/MCview/Bond.java | 6 +- src/MCview/MCMatrix.java | 6 +- src/MCview/PDBCanvas.java | 6 +- src/MCview/PDBChain.java | 6 +- src/MCview/PDBViewer.java | 6 +- src/MCview/PDBfile.java | 6 +- src/MCview/Residue.java | 6 +- src/MCview/Zsort.java | 6 +- src/ext/vamsas/IRegistry.java | 6 +- src/ext/vamsas/IRegistryService.java | 6 +- src/ext/vamsas/IRegistryServiceLocator.java | 6 +- src/ext/vamsas/Jpred.java | 6 +- src/ext/vamsas/JpredService.java | 6 +- src/ext/vamsas/JpredServiceLocator.java | 6 +- src/ext/vamsas/JpredSoapBindingStub.java | 6 +- src/ext/vamsas/MuscleWS.java | 6 +- src/ext/vamsas/MuscleWSService.java | 6 +- src/ext/vamsas/MuscleWSServiceLocator.java | 6 +- src/ext/vamsas/MuscleWSSoapBindingStub.java | 6 +- src/ext/vamsas/RegistryServiceSoapBindingStub.java | 6 +- src/ext/vamsas/SeqSearchI.java | 74 +- src/ext/vamsas/SeqSearchServiceLocator.java | 366 +- src/ext/vamsas/SeqSearchServiceService.java | 58 +- .../vamsas/SeqSearchServiceSoapBindingStub.java | 976 +-- src/ext/vamsas/ServiceHandle.java | 6 +- src/ext/vamsas/ServiceHandles.java | 6 +- src/jalview/analysis/AAFrequency.java | 20 +- src/jalview/analysis/AlignSeq.java | 6 +- src/jalview/analysis/AlignmentSorter.java | 20 +- src/jalview/analysis/Conservation.java | 6 +- src/jalview/analysis/CrossRef.java | 1204 ++-- src/jalview/analysis/Dna.java | 1432 ++-- src/jalview/analysis/Finder.java | 6 +- src/jalview/analysis/Grouping.java | 6 +- src/jalview/analysis/NJTree.java | 6 +- src/jalview/analysis/PCA.java | 6 +- src/jalview/analysis/ParseProperties.java | 6 +- src/jalview/analysis/Rna.java | 7 +- src/jalview/analysis/SeqsetUtils.java | 6 +- src/jalview/analysis/SequenceIdMatcher.java | 6 +- src/jalview/analysis/StructureFrequency.java | 21 +- src/jalview/analysis/WUSSParseException.java | 19 +- src/jalview/api/AlignCalcManagerI.java | 17 + src/jalview/api/AlignCalcWorkerI.java | 17 + src/jalview/api/AlignViewportI.java | 16 +- src/jalview/api/AlignmentViewPanel.java | 17 +- src/jalview/api/FeatureRenderer.java | 6 +- src/jalview/api/OOMHandlerI.java | 17 + src/jalview/api/RotatableCanvasI.java | 17 + src/jalview/api/SequenceRenderer.java | 6 +- src/jalview/api/SequenceStructureBinding.java | 6 +- .../api/StructureSelectionManagerProvider.java | 16 +- src/jalview/appletgui/APopupMenu.java | 6 +- src/jalview/appletgui/AlignFrame.java | 7512 ++++++++++---------- src/jalview/appletgui/AlignViewport.java | 6 +- src/jalview/appletgui/AlignmentPanel.java | 6 +- src/jalview/appletgui/AnnotationColourChooser.java | 6 +- src/jalview/appletgui/AnnotationLabels.java | 6 +- src/jalview/appletgui/AnnotationPanel.java | 20 +- src/jalview/appletgui/AppletJmol.java | 6 +- src/jalview/appletgui/AppletJmolBinding.java | 6 +- src/jalview/appletgui/CutAndPasteTransfer.java | 6 +- src/jalview/appletgui/EditNameDialog.java | 6 +- src/jalview/appletgui/EmbmenuFrame.java | 628 +- src/jalview/appletgui/ExtJmol.java | 6 +- src/jalview/appletgui/FeatureColourChooser.java | 6 +- src/jalview/appletgui/FeatureRenderer.java | 6 +- src/jalview/appletgui/FeatureSettings.java | 6 +- src/jalview/appletgui/Finder.java | 6 +- src/jalview/appletgui/FontChooser.java | 6 +- src/jalview/appletgui/IdCanvas.java | 6 +- src/jalview/appletgui/IdPanel.java | 6 +- src/jalview/appletgui/IdwidthAdjuster.java | 6 +- src/jalview/appletgui/JVDialog.java | 6 +- src/jalview/appletgui/OverviewPanel.java | 20 +- src/jalview/appletgui/PCAPanel.java | 6 +- src/jalview/appletgui/PaintRefresher.java | 20 +- src/jalview/appletgui/PairwiseAlignPanel.java | 6 +- src/jalview/appletgui/RedundancyPanel.java | 6 +- src/jalview/appletgui/RotatableCanvas.java | 6 +- src/jalview/appletgui/ScalePanel.java | 6 +- src/jalview/appletgui/SeqCanvas.java | 6 +- src/jalview/appletgui/SeqPanel.java | 6 +- src/jalview/appletgui/SequenceRenderer.java | 6 +- src/jalview/appletgui/SliderPanel.java | 6 +- src/jalview/appletgui/Tooltip.java | 466 +- src/jalview/appletgui/TreeCanvas.java | 20 +- src/jalview/appletgui/TreePanel.java | 6 +- src/jalview/appletgui/UserDefinedColours.java | 6 +- src/jalview/bin/Cache.java | 6 +- src/jalview/bin/Jalview.java | 6 +- src/jalview/bin/JalviewLite.java | 5494 +++++++------- src/jalview/bin/JalviewLiteURLRetrieve.java | 6 +- src/jalview/binding/Alignment.java | 20 +- src/jalview/binding/Annotation.java | 20 +- src/jalview/binding/AnnotationElement.java | 20 +- src/jalview/binding/Colour.java | 20 +- src/jalview/binding/Feature.java | 20 +- src/jalview/binding/FeatureSettings.java | 20 +- src/jalview/binding/Features.java | 20 +- src/jalview/binding/JGroup.java | 20 +- src/jalview/binding/JSeq.java | 20 +- src/jalview/binding/JalviewModel.java | 20 +- src/jalview/binding/JalviewModelSequence.java | 20 +- src/jalview/binding/JalviewUserColours.java | 20 +- src/jalview/binding/Pdbentry.java | 20 +- src/jalview/binding/PdbentryItem.java | 20 +- src/jalview/binding/Pdbids.java | 20 +- src/jalview/binding/Property.java | 20 +- src/jalview/binding/Sequence.java | 20 +- src/jalview/binding/SequenceSet.java | 20 +- src/jalview/binding/SequenceType.java | 20 +- src/jalview/binding/Setting.java | 20 +- src/jalview/binding/Tree.java | 20 +- src/jalview/binding/UserColourScheme.java | 20 +- src/jalview/binding/UserColours.java | 20 +- src/jalview/binding/VAMSAS.java | 20 +- src/jalview/binding/VamsasModel.java | 20 +- src/jalview/binding/Viewport.java | 20 +- src/jalview/commands/ChangeCaseCommand.java | 6 +- src/jalview/commands/CommandI.java | 6 +- src/jalview/commands/EditCommand.java | 20 +- src/jalview/commands/OrderCommand.java | 6 +- src/jalview/commands/RemoveGapColCommand.java | 6 +- src/jalview/commands/RemoveGapsCommand.java | 6 +- src/jalview/commands/SlideSequencesCommand.java | 6 +- src/jalview/commands/TrimRegionCommand.java | 6 +- src/jalview/datamodel/AlignedCodonFrame.java | 636 +- src/jalview/datamodel/Alignment.java | 20 +- src/jalview/datamodel/AlignmentAnnotation.java | 6 +- src/jalview/datamodel/AlignmentI.java | 20 +- src/jalview/datamodel/AlignmentOrder.java | 6 +- src/jalview/datamodel/AlignmentView.java | 2352 +++--- src/jalview/datamodel/AnnotatedCollectionI.java | 17 + src/jalview/datamodel/Annotation.java | 6 +- src/jalview/datamodel/BinaryNode.java | 6 +- src/jalview/datamodel/BinarySequence.java | 6 +- src/jalview/datamodel/CigarArray.java | 792 +-- src/jalview/datamodel/CigarBase.java | 1292 ++-- src/jalview/datamodel/CigarCigar.java | 122 +- src/jalview/datamodel/CigarSimple.java | 64 +- src/jalview/datamodel/ColumnSelection.java | 2516 +++---- src/jalview/datamodel/DBRefEntry.java | 6 +- src/jalview/datamodel/DBRefSource.java | 276 +- src/jalview/datamodel/FeatureProperties.java | 96 +- src/jalview/datamodel/GraphLine.java | 6 +- src/jalview/datamodel/HiddenSequences.java | 20 +- src/jalview/datamodel/Mapping.java | 6 +- src/jalview/datamodel/NodeTransformI.java | 6 +- src/jalview/datamodel/PDBEntry.java | 6 +- src/jalview/datamodel/Provenance.java | 6 +- src/jalview/datamodel/ProvenanceEntry.java | 6 +- src/jalview/datamodel/SearchResults.java | 6 +- src/jalview/datamodel/SeqCigar.java | 6 +- src/jalview/datamodel/Sequence.java | 6 +- src/jalview/datamodel/SequenceCollectionI.java | 17 + src/jalview/datamodel/SequenceFeature.java | 6 +- src/jalview/datamodel/SequenceGroup.java | 6 +- src/jalview/datamodel/SequenceI.java | 6 +- src/jalview/datamodel/SequenceNode.java | 6 +- src/jalview/datamodel/SequencePoint.java | 6 +- src/jalview/datamodel/UniprotEntry.java | 6 +- src/jalview/datamodel/UniprotFile.java | 6 +- src/jalview/datamodel/UniprotProteinName.java | 74 +- src/jalview/datamodel/UniprotSequence.java | 6 +- src/jalview/datamodel/xdb/embl/BasePosition.java | 6 +- src/jalview/datamodel/xdb/embl/EmblEntry.java | 6 +- src/jalview/datamodel/xdb/embl/EmblError.java | 6 +- src/jalview/datamodel/xdb/embl/EmblFeature.java | 6 +- .../datamodel/xdb/embl/EmblFeatureLocElement.java | 6 +- .../datamodel/xdb/embl/EmblFeatureLocations.java | 6 +- src/jalview/datamodel/xdb/embl/EmblFile.java | 6 +- src/jalview/datamodel/xdb/embl/EmblSequence.java | 6 +- src/jalview/datamodel/xdb/embl/Qualifier.java | 6 +- src/jalview/ext/jmol/JalviewJmolBinding.java | 3220 ++++----- src/jalview/ext/jmol/JmolCommands.java | 17 +- src/jalview/ext/varna/JalviewVarnaBinding.java | 112 +- src/jalview/ext/varna/VarnaCommands.java | 322 +- src/jalview/gui/AlignFrame.java | 20 +- src/jalview/gui/AlignViewport.java | 6 +- src/jalview/gui/AlignmentPanel.java | 6 +- src/jalview/gui/AnnotationColourChooser.java | 6 +- src/jalview/gui/AnnotationExporter.java | 610 +- src/jalview/gui/AnnotationLabels.java | 6 +- src/jalview/gui/AnnotationPanel.java | 20 +- src/jalview/gui/AppJmol.java | 6 +- src/jalview/gui/AppJmolBinding.java | 6 +- src/jalview/gui/AppVarna.java | 6 +- src/jalview/gui/AppVarnaBinding.java | 8 +- src/jalview/gui/AssociatePdbFileWithSeq.java | 16 +- src/jalview/gui/BlogReader.java | 16 +- src/jalview/gui/Console.java | 6 +- src/jalview/gui/CutAndPasteHtmlTransfer.java | 6 +- src/jalview/gui/CutAndPasteTransfer.java | 6 +- src/jalview/gui/DasSourceBrowser.java | 1666 ++--- src/jalview/gui/Desktop.java | 6 +- src/jalview/gui/EPSOptions.java | 6 +- src/jalview/gui/EditNameDialog.java | 6 +- src/jalview/gui/FeatureColourChooser.java | 6 +- src/jalview/gui/FeatureRenderer.java | 6 +- src/jalview/gui/FeatureSettings.java | 6 +- src/jalview/gui/Finder.java | 6 +- src/jalview/gui/FontChooser.java | 6 +- src/jalview/gui/IProgressIndicator.java | 110 +- src/jalview/gui/IProgressIndicatorHandler.java | 70 +- src/jalview/gui/IdCanvas.java | 6 +- src/jalview/gui/IdPanel.java | 20 +- src/jalview/gui/IdwidthAdjuster.java | 6 +- src/jalview/gui/JDatabaseTree.java | 17 + src/jalview/gui/Jalview2XML.java | 20 +- src/jalview/gui/Jalview2XML_V1.java | 936 +-- src/jalview/gui/JalviewAppender.java | 6 +- src/jalview/gui/JalviewChangeSupport.java | 18 +- src/jalview/gui/JalviewDialog.java | 16 +- src/jalview/gui/JvSwingUtils.java | 6 +- src/jalview/gui/OOMWarning.java | 176 +- src/jalview/gui/OptsAndParamsPage.java | 16 +- src/jalview/gui/OptsParametersContainerI.java | 16 +- src/jalview/gui/OverviewPanel.java | 20 +- src/jalview/gui/PCAPanel.java | 6 +- src/jalview/gui/PaintRefresher.java | 20 +- src/jalview/gui/PairwiseAlignPanel.java | 6 +- src/jalview/gui/PopupMenu.java | 6 +- src/jalview/gui/Preferences.java | 6 +- src/jalview/gui/PromptUserConfig.java | 6 +- src/jalview/gui/RedundancyPanel.java | 6 +- src/jalview/gui/RestInputParamEditDialog.java | 16 +- src/jalview/gui/RestServiceEditorPane.java | 16 +- src/jalview/gui/RotatableCanvas.java | 6 +- src/jalview/gui/ScalePanel.java | 6 +- src/jalview/gui/ScriptWindow.java | 6 +- src/jalview/gui/SeqCanvas.java | 6 +- src/jalview/gui/SeqPanel.java | 21 +- src/jalview/gui/SequenceFetcher.java | 20 +- src/jalview/gui/SequenceRenderer.java | 6 +- src/jalview/gui/SliderPanel.java | 6 +- src/jalview/gui/SplashScreen.java | 8 +- src/jalview/gui/TextColourChooser.java | 6 +- src/jalview/gui/TreeCanvas.java | 6 +- src/jalview/gui/TreePanel.java | 6 +- src/jalview/gui/UserDefinedColours.java | 6 +- src/jalview/gui/UserQuestionnaireCheck.java | 6 +- src/jalview/gui/VamsasApplication.java | 6 +- src/jalview/gui/ViewSelectionMenu.java | 17 +- src/jalview/gui/WebserviceInfo.java | 6 +- src/jalview/gui/WsJobParameters.java | 6 +- src/jalview/gui/WsParamSetManager.java | 6 +- src/jalview/gui/WsPreferences.java | 6 +- src/jalview/io/AMSAFile.java | 6 +- src/jalview/io/AlignFile.java | 6 +- src/jalview/io/AlignmentProperties.java | 6 +- src/jalview/io/AnnotationFile.java | 2958 ++++---- src/jalview/io/AppletFormatAdapter.java | 6 +- src/jalview/io/BLCFile.java | 6 +- src/jalview/io/ClansFile.java | 54 +- src/jalview/io/ClustalFile.java | 6 +- src/jalview/io/DBRefFile.java | 88 +- src/jalview/io/FastaFile.java | 6 +- src/jalview/io/FeaturesFile.java | 2052 +++--- src/jalview/io/FileLoader.java | 6 +- src/jalview/io/FileParse.java | 6 +- src/jalview/io/FormatAdapter.java | 6 +- src/jalview/io/HTMLOutput.java | 6 +- src/jalview/io/IdentifyFile.java | 6 +- src/jalview/io/JPredFile.java | 6 +- src/jalview/io/JalviewFileChooser.java | 6 +- src/jalview/io/JalviewFileFilter.java | 6 +- src/jalview/io/JalviewFileView.java | 6 +- src/jalview/io/JnetAnnotationMaker.java | 6 +- src/jalview/io/MSFfile.java | 6 +- src/jalview/io/MatrixFile.java | 68 +- src/jalview/io/ModellerDescription.java | 6 +- src/jalview/io/NewickFile.java | 6 +- src/jalview/io/PIRFile.java | 6 +- src/jalview/io/PfamFile.java | 6 +- src/jalview/io/PileUpfile.java | 6 +- src/jalview/io/SequenceAnnotationReport.java | 17 + src/jalview/io/SimpleBlastFile.java | 6 +- src/jalview/io/StockholmFile.java | 1378 ++-- src/jalview/io/TCoffeeScoreFile.java | 17 + src/jalview/io/VamsasAppDatastore.java | 20 +- src/jalview/io/WSWUBlastClient.java | 6 +- src/jalview/io/packed/DataProvider.java | 19 +- src/jalview/io/packed/JalviewDataset.java | 19 +- src/jalview/io/packed/ParsePackedSet.java | 16 +- src/jalview/io/packed/SimpleDataProvider.java | 18 +- src/jalview/io/vamsas/Datasetsequence.java | 550 +- src/jalview/io/vamsas/DatastoreItem.java | 6 +- src/jalview/io/vamsas/DatastoreRegistry.java | 6 +- src/jalview/io/vamsas/Dbref.java | 6 +- src/jalview/io/vamsas/LocalDocSyncObject.java | 6 +- src/jalview/io/vamsas/Rangetype.java | 6 +- src/jalview/io/vamsas/Sequencefeature.java | 718 +- src/jalview/io/vamsas/Sequencemapping.java | 6 +- src/jalview/io/vamsas/Tree.java | 20 +- src/jalview/javascript/JSFunctionExec.java | 16 +- src/jalview/javascript/JalviewLiteJsApi.java | 18 +- src/jalview/javascript/JsCallBack.java | 17 +- src/jalview/javascript/JsSelectionSender.java | 16 +- src/jalview/javascript/MouseOverListener.java | 16 +- .../javascript/MouseOverStructureListener.java | 22 +- src/jalview/jbgui/GAlignFrame.java | 6 +- src/jalview/jbgui/GAlignmentPanel.java | 6 +- src/jalview/jbgui/GCutAndPasteHtmlTransfer.java | 6 +- src/jalview/jbgui/GCutAndPasteTransfer.java | 6 +- src/jalview/jbgui/GDasSourceBrowser.java | 442 +- src/jalview/jbgui/GDesktop.java | 6 +- src/jalview/jbgui/GFinder.java | 6 +- src/jalview/jbgui/GFontChooser.java | 6 +- src/jalview/jbgui/GPCAPanel.java | 6 +- src/jalview/jbgui/GPairwiseAlignPanel.java | 6 +- src/jalview/jbgui/GPreferences.java | 6 +- src/jalview/jbgui/GRestInputParamEditDialog.java | 16 +- src/jalview/jbgui/GRestServiceEditorPane.java | 16 +- src/jalview/jbgui/GRnaStructureViewer.java | 6 +- src/jalview/jbgui/GSequenceLink.java | 6 +- src/jalview/jbgui/GSliderPanel.java | 6 +- src/jalview/jbgui/GStructureViewer.java | 6 +- src/jalview/jbgui/GTreePanel.java | 6 +- src/jalview/jbgui/GUserDefinedColours.java | 6 +- src/jalview/jbgui/GWebserviceInfo.java | 6 +- src/jalview/jbgui/GWsPreferences.java | 6 +- src/jalview/math/Matrix.java | 6 +- src/jalview/math/RotatableMatrix.java | 6 +- src/jalview/renderer/AnnotationRenderer.java | 17 + src/jalview/renderer/AwtRenderPanelI.java | 17 + src/jalview/schemabinding/version2/AlcodMap.java | 20 +- src/jalview/schemabinding/version2/Alcodon.java | 20 +- .../schemabinding/version2/AlcodonFrame.java | 20 +- src/jalview/schemabinding/version2/Annotation.java | 20 +- .../schemabinding/version2/AnnotationColours.java | 20 +- .../schemabinding/version2/AnnotationElement.java | 20 +- .../schemabinding/version2/CalcIdParam.java | 20 +- src/jalview/schemabinding/version2/Colour.java | 20 +- src/jalview/schemabinding/version2/DBRef.java | 20 +- src/jalview/schemabinding/version2/Feature.java | 20 +- .../schemabinding/version2/FeatureSettings.java | 20 +- src/jalview/schemabinding/version2/Features.java | 20 +- src/jalview/schemabinding/version2/Group.java | 20 +- .../schemabinding/version2/HiddenColumns.java | 20 +- src/jalview/schemabinding/version2/JGroup.java | 20 +- src/jalview/schemabinding/version2/JSeq.java | 20 +- .../schemabinding/version2/JalviewModel.java | 20 +- .../version2/JalviewModelSequence.java | 20 +- .../schemabinding/version2/JalviewUserColours.java | 20 +- .../schemabinding/version2/MapListFrom.java | 20 +- src/jalview/schemabinding/version2/MapListTo.java | 20 +- .../schemabinding/version2/MapListType.java | 20 +- src/jalview/schemabinding/version2/Mapping.java | 20 +- .../schemabinding/version2/MappingChoice.java | 20 +- src/jalview/schemabinding/version2/OtherData.java | 20 +- src/jalview/schemabinding/version2/Pdbentry.java | 20 +- .../schemabinding/version2/PdbentryItem.java | 20 +- src/jalview/schemabinding/version2/Pdbids.java | 20 +- src/jalview/schemabinding/version2/Property.java | 20 +- src/jalview/schemabinding/version2/Sequence.java | 20 +- .../schemabinding/version2/SequenceSet.java | 20 +- .../version2/SequenceSetProperties.java | 20 +- .../schemabinding/version2/SequenceType.java | 20 +- src/jalview/schemabinding/version2/Setting.java | 20 +- .../schemabinding/version2/StructureState.java | 20 +- .../schemabinding/version2/ThresholdLine.java | 20 +- src/jalview/schemabinding/version2/Tree.java | 20 +- .../schemabinding/version2/UserColourScheme.java | 20 +- .../schemabinding/version2/UserColours.java | 20 +- src/jalview/schemabinding/version2/VAMSAS.java | 20 +- .../schemabinding/version2/VamsasModel.java | 20 +- src/jalview/schemabinding/version2/Viewport.java | 20 +- .../version2/WebServiceParameterSet.java | 20 +- .../version2/descriptors/AlcodMapDescriptor.java | 20 +- .../version2/descriptors/AlcodonDescriptor.java | 20 +- .../descriptors/AlcodonFrameDescriptor.java | 20 +- .../descriptors/AnnotationColoursDescriptor.java | 20 +- .../version2/descriptors/AnnotationDescriptor.java | 20 +- .../descriptors/AnnotationElementDescriptor.java | 20 +- .../descriptors/CalcIdParamDescriptor.java | 20 +- .../version2/descriptors/ColourDescriptor.java | 20 +- .../version2/descriptors/DBRefDescriptor.java | 20 +- .../version2/descriptors/FeatureDescriptor.java | 20 +- .../descriptors/FeatureSettingsDescriptor.java | 20 +- .../version2/descriptors/FeaturesDescriptor.java | 20 +- .../version2/descriptors/GroupDescriptor.java | 20 +- .../descriptors/HiddenColumnsDescriptor.java | 20 +- .../version2/descriptors/JGroupDescriptor.java | 20 +- .../version2/descriptors/JSeqDescriptor.java | 20 +- .../descriptors/JalviewModelDescriptor.java | 20 +- .../JalviewModelSequenceDescriptor.java | 20 +- .../descriptors/JalviewUserColoursDescriptor.java | 20 +- .../descriptors/MapListFromDescriptor.java | 20 +- .../version2/descriptors/MapListToDescriptor.java | 20 +- .../descriptors/MapListTypeDescriptor.java | 20 +- .../descriptors/MappingChoiceDescriptor.java | 20 +- .../version2/descriptors/MappingDescriptor.java | 20 +- .../version2/descriptors/OtherDataDescriptor.java | 20 +- .../version2/descriptors/PdbentryDescriptor.java | 20 +- .../descriptors/PdbentryItemDescriptor.java | 20 +- .../version2/descriptors/PdbidsDescriptor.java | 20 +- .../version2/descriptors/PropertyDescriptor.java | 20 +- .../version2/descriptors/SequenceDescriptor.java | 20 +- .../descriptors/SequenceSetDescriptor.java | 20 +- .../SequenceSetPropertiesDescriptor.java | 20 +- .../descriptors/SequenceTypeDescriptor.java | 20 +- .../version2/descriptors/SettingDescriptor.java | 20 +- .../descriptors/StructureStateDescriptor.java | 20 +- .../descriptors/ThresholdLineDescriptor.java | 20 +- .../version2/descriptors/TreeDescriptor.java | 20 +- .../descriptors/UserColourSchemeDescriptor.java | 20 +- .../descriptors/UserColoursDescriptor.java | 20 +- .../version2/descriptors/VAMSASDescriptor.java | 20 +- .../descriptors/VamsasModelDescriptor.java | 20 +- .../version2/descriptors/ViewportDescriptor.java | 20 +- .../WebServiceParameterSetDescriptor.java | 20 +- src/jalview/schemes/AnnotationColourGradient.java | 6 +- src/jalview/schemes/Blosum62ColourScheme.java | 6 +- src/jalview/schemes/BuriedColourScheme.java | 6 +- src/jalview/schemes/ClustalxColourScheme.java | 6 +- src/jalview/schemes/ColourSchemeI.java | 6 +- src/jalview/schemes/ColourSchemeProperty.java | 20 +- src/jalview/schemes/Consensus.java | 6 +- src/jalview/schemes/CovariationColourScheme.java | 6 +- src/jalview/schemes/GraduatedColor.java | 6 +- src/jalview/schemes/HelixColourScheme.java | 6 +- src/jalview/schemes/HydrophobicColourScheme.java | 6 +- src/jalview/schemes/NucleotideColourScheme.java | 6 +- src/jalview/schemes/PIDColourScheme.java | 6 +- .../schemes/PurinePyrimidineColourScheme.java | 6 +- src/jalview/schemes/RNAHelicesColour.java | 6 +- src/jalview/schemes/RNAHelicesColourChooser.java | 6 +- src/jalview/schemes/ResidueColourScheme.java | 6 +- src/jalview/schemes/ResidueProperties.java | 6 +- src/jalview/schemes/ScoreColourScheme.java | 6 +- src/jalview/schemes/ScoreMatrix.java | 294 +- src/jalview/schemes/StrandColourScheme.java | 6 +- src/jalview/schemes/TCoffeeColourScheme.java | 17 + src/jalview/schemes/TaylorColourScheme.java | 6 +- src/jalview/schemes/TurnColourScheme.java | 6 +- src/jalview/schemes/UserColourScheme.java | 6 +- src/jalview/schemes/ZappoColourScheme.java | 6 +- .../structure/AlignmentViewPanelListener.java | 16 +- .../structure/SecondaryStructureListener.java | 6 +- src/jalview/structure/SelectionListener.java | 6 +- src/jalview/structure/SelectionSource.java | 6 +- src/jalview/structure/SequenceListener.java | 6 +- src/jalview/structure/StructureListener.java | 6 +- src/jalview/structure/StructureMapping.java | 6 +- .../structure/StructureMappingcommandSet.java | 16 +- .../structure/StructureSelectionManager.java | 6 +- src/jalview/structure/VamsasListener.java | 74 +- src/jalview/structure/VamsasSource.java | 16 +- src/jalview/util/AWTConsole.java | 6 +- src/jalview/util/BrowserLauncher.java | 6 +- src/jalview/util/ColorUtils.java | 7 +- src/jalview/util/Comparison.java | 6 +- src/jalview/util/DBRefUtils.java | 6 +- src/jalview/util/Format.java | 6 +- src/jalview/util/GroupUrlLink.java | 6 +- src/jalview/util/ImageMaker.java | 6 +- src/jalview/util/MapList.java | 6 +- src/jalview/util/ParseHtmlBodyAndLinks.java | 16 +- src/jalview/util/Platform.java | 148 +- src/jalview/util/QuickSort.java | 6 +- src/jalview/util/ShiftList.java | 286 +- src/jalview/util/TableSorter.java | 1194 ++-- src/jalview/util/UrlLink.java | 796 +-- src/jalview/util/jarInputStreamProvider.java | 90 +- src/jalview/viewmodel/AlignmentViewport.java | 18 +- src/jalview/viewmodel/PCAModel.java | 17 + src/jalview/workers/AlignCalcManager.java | 17 + src/jalview/workers/AlignCalcWorker.java | 16 +- src/jalview/workers/ConsensusThread.java | 17 + src/jalview/workers/ConservationThread.java | 20 +- src/jalview/workers/StrucConsensusThread.java | 19 +- src/jalview/ws/AWSThread.java | 6 +- src/jalview/ws/AWsJob.java | 6 +- src/jalview/ws/DBRefFetcher.java | 1448 ++-- src/jalview/ws/DasSequenceFeatureFetcher.java | 1826 ++--- src/jalview/ws/EnfinEnvision2OneWay.java | 6 +- src/jalview/ws/JobStateSummary.java | 6 +- src/jalview/ws/SequenceFetcher.java | 34 +- src/jalview/ws/WSClient.java | 6 +- src/jalview/ws/WSClientI.java | 6 +- src/jalview/ws/WSMenuEntryProviderI.java | 6 +- .../ws/dbsources/EbiFileRetrievedProxy.java | 128 +- src/jalview/ws/dbsources/EmblCdsSouce.java | 176 +- src/jalview/ws/dbsources/EmblSource.java | 254 +- src/jalview/ws/dbsources/EmblXmlSource.java | 324 +- src/jalview/ws/dbsources/GeneDbSource.java | 260 +- src/jalview/ws/dbsources/Pdb.java | 436 +- src/jalview/ws/dbsources/Pfam.java | 324 +- src/jalview/ws/dbsources/PfamFull.java | 136 +- src/jalview/ws/dbsources/PfamSeed.java | 130 +- src/jalview/ws/dbsources/Rfam.java | 6 +- src/jalview/ws/dbsources/RfamFull.java | 7 +- src/jalview/ws/dbsources/RfamSeed.java | 6 +- src/jalview/ws/dbsources/Uniprot.java | 6 +- src/jalview/ws/dbsources/UnprotName.java | 82 +- src/jalview/ws/dbsources/Xfam.java | 8 +- .../ws/dbsources/das/api/DasSourceRegistryI.java | 17 + .../ws/dbsources/das/api/jalviewSourceI.java | 17 + .../dbsources/das/datamodel/DasSequenceSource.java | 676 +- .../dbsources/das/datamodel/DasSourceRegistry.java | 16 +- .../ws/dbsources/das/datamodel/JalviewSource.java | 17 + src/jalview/ws/ebi/EBIFetchClient.java | 35 +- src/jalview/ws/io/mime/HttpContentHandler.java | 16 +- .../ws/io/mime/JalviewMimeContentHandler.java | 16 +- src/jalview/ws/io/mime/MimeTypes.java | 18 +- src/jalview/ws/jws1/Discoverer.java | 6 +- src/jalview/ws/jws1/JPredClient.java | 6 +- src/jalview/ws/jws1/JPredThread.java | 6 +- src/jalview/ws/jws1/JWS1Thread.java | 6 +- src/jalview/ws/jws1/MsaWSClient.java | 6 +- src/jalview/ws/jws1/MsaWSThread.java | 6 +- src/jalview/ws/jws1/SeqSearchWSClient.java | 6 +- src/jalview/ws/jws1/SeqSearchWSThread.java | 6 +- src/jalview/ws/jws1/WS1Client.java | 6 +- src/jalview/ws/jws1/WSJob.java | 6 +- src/jalview/ws/jws2/AAConClient.java | 17 + src/jalview/ws/jws2/AADisorderClient.java | 17 + src/jalview/ws/jws2/AWS2Thread.java | 6 +- src/jalview/ws/jws2/JWs2Job.java | 6 +- src/jalview/ws/jws2/JabaParamStore.java | 6 +- src/jalview/ws/jws2/JabaPreset.java | 6 +- src/jalview/ws/jws2/JabaWsServerQuery.java | 16 +- src/jalview/ws/jws2/JabawsAlignCalcWorker.java | 17 + src/jalview/ws/jws2/Jws2Client.java | 6 +- src/jalview/ws/jws2/Jws2Discoverer.java | 6 +- src/jalview/ws/jws2/MsaWSClient.java | 6 +- src/jalview/ws/jws2/MsaWSThread.java | 6 +- src/jalview/ws/jws2/ParameterUtils.java | 6 +- .../ws/jws2/SequenceAnnotationWSClient.java | 16 +- src/jalview/ws/jws2/dm/AAConSettings.java | 17 + src/jalview/ws/jws2/dm/JabaOption.java | 6 +- src/jalview/ws/jws2/dm/JabaParameter.java | 6 +- src/jalview/ws/jws2/dm/JabaValueConstrain.java | 6 +- src/jalview/ws/jws2/dm/JabaWsParamSet.java | 6 +- src/jalview/ws/jws2/jabaws2/Jws2Instance.java | 19 +- src/jalview/ws/params/ArgumentI.java | 6 +- src/jalview/ws/params/AutoCalcSetting.java | 17 + .../ws/params/InvalidArgumentException.java | 18 +- src/jalview/ws/params/OptionI.java | 6 +- src/jalview/ws/params/ParamDatastoreI.java | 6 +- src/jalview/ws/params/ParamManager.java | 6 +- src/jalview/ws/params/ParameterI.java | 6 +- src/jalview/ws/params/ValueConstrainI.java | 6 +- src/jalview/ws/params/WsParamSetI.java | 6 +- src/jalview/ws/params/simple/BooleanOption.java | 16 +- src/jalview/ws/params/simple/IntegerParameter.java | 18 +- src/jalview/ws/params/simple/Option.java | 18 +- src/jalview/ws/params/simple/Parameter.java | 18 +- .../ws/params/simple/StringChoiceParameter.java | 16 +- src/jalview/ws/rest/AlignmentProcessor.java | 18 +- src/jalview/ws/rest/HttpResultSet.java | 16 +- src/jalview/ws/rest/InputType.java | 18 +- src/jalview/ws/rest/NoValidInputDataException.java | 16 +- src/jalview/ws/rest/RestClient.java | 17 +- src/jalview/ws/rest/RestJob.java | 16 +- src/jalview/ws/rest/RestJobThread.java | 16 +- src/jalview/ws/rest/RestServiceDescription.java | 6 +- src/jalview/ws/rest/params/Alignment.java | 18 +- src/jalview/ws/rest/params/AnnotationFile.java | 16 +- src/jalview/ws/rest/params/JobConstant.java | 16 +- .../ws/rest/params/SeqGroupIndexVector.java | 16 +- src/jalview/ws/rest/params/SeqIdVector.java | 16 +- src/jalview/ws/rest/params/SeqVector.java | 18 +- src/jalview/ws/rest/params/Tree.java | 18 +- src/jalview/ws/seqfetcher/ASequenceFetcher.java | 880 +-- src/jalview/ws/seqfetcher/DbSourceProxy.java | 274 +- src/jalview/ws/seqfetcher/DbSourceProxyImpl.java | 276 +- src/uk/ac/ebi/picr/model/CrossReference.java | 660 +- .../ac/ebi/picr/model/CrossReference_Helper.java | 250 +- src/uk/ac/ebi/picr/model/UPEntry.java | 580 +- src/uk/ac/ebi/picr/model/UPEntry_Helper.java | 212 +- src/uk/ac/ebi/www/Data.java | 6 +- src/uk/ac/ebi/www/InputParams.java | 6 +- src/uk/ac/ebi/www/WSFile.java | 6 +- src/uk/ac/ebi/www/WSWUBlast.java | 6 +- src/uk/ac/ebi/www/WSWUBlastService.java | 6 +- src/uk/ac/ebi/www/WSWUBlastServiceLocator.java | 6 +- src/uk/ac/ebi/www/WSWUBlastSoapBindingStub.java | 6 +- .../AccessionMapperBindingStub.java | 794 +-- .../AccessionMapperInterface.java | 68 +- .../AccessionMapperService.java | 58 +- .../AccessionMapperServiceLocator.java | 378 +- src/vamsas/IMsaWS.java | 6 +- src/vamsas/objects/simple/Alignment.java | 6 +- src/vamsas/objects/simple/Alignment_Helper.java | 6 +- src/vamsas/objects/simple/JpredResult.java | 6 +- src/vamsas/objects/simple/JpredResult_Helper.java | 6 +- src/vamsas/objects/simple/MsaResult.java | 6 +- src/vamsas/objects/simple/MsaResult_Helper.java | 6 +- src/vamsas/objects/simple/Msfalignment.java | 6 +- src/vamsas/objects/simple/Msfalignment_Helper.java | 6 +- src/vamsas/objects/simple/Object.java | 6 +- src/vamsas/objects/simple/Object_Helper.java | 6 +- src/vamsas/objects/simple/Result.java | 6 +- src/vamsas/objects/simple/Result_Helper.java | 6 +- src/vamsas/objects/simple/Secstructpred.java | 6 +- .../objects/simple/Secstructpred_Helper.java | 6 +- src/vamsas/objects/simple/SeqSearchResult.java | 370 +- .../objects/simple/SeqSearchResult_Helper.java | 172 +- src/vamsas/objects/simple/Sequence.java | 6 +- src/vamsas/objects/simple/SequenceSet.java | 6 +- src/vamsas/objects/simple/SequenceSet_Helper.java | 6 +- src/vamsas/objects/simple/Sequence_Helper.java | 6 +- src/vamsas/objects/simple/WsJobId.java | 6 +- src/vamsas/objects/simple/WsJobId_Helper.java | 6 +- test/jalview/io/TCoffeeScoreFileTest.java | 17 + test/jalview/schemes/ScoreMatrixPrinter.java | 17 + test/jalview/ws/gui/Jws2ParamView.java | 17 + utils/InstallAnywhere/jalview_buildinstaller.xml | 30 +- utils/eclipse/JalviewCodeStyle.xml | 30 +- utils/getJavaVersion.java | 6 +- utils/gff2annot.pl | 22 +- utils/help2Website.java | 6 +- utils/jalopy/readme.html | 20 +- utils/jarunsigner.pl | 23 +- utils/patchGt.pl | 6 +- utils/splitstockholm.pl | 3 +- 758 files changed, 35513 insertions(+), 33444 deletions(-) diff --git a/doc/AddingGroovySupport.html b/doc/AddingGroovySupport.html index ff9af07..fe7cf6b 100644 --- a/doc/AddingGroovySupport.html +++ b/doc/AddingGroovySupport.html @@ -1,14 +1,14 @@ - - Developing Jalview - -

Developing Jalview

-

- - - + + + + Developing Jalview + +

Developing Jalview

+

+ + + diff --git a/doc/index.html b/doc/index.html index d694c67..e22099c 100644 --- a/doc/index.html +++ b/doc/index.html @@ -1,153 +1,153 @@ - - - - -Jalview Source Documentation - - -

Jalview Source Documentation

-

The file structure of the Jalview Source tree is as follows: -

- - - + + + + +Jalview Source Documentation + + +

Jalview Source Documentation

+

The file structure of the Jalview Source tree is as follows: +

+ + + diff --git a/doc/newdmobj.html b/doc/newdmobj.html index c03b21d..91ab3e1 100644 --- a/doc/newdmobj.html +++ b/doc/newdmobj.html @@ -1,36 +1,36 @@ - - - -Adding New Datamodel Objects To Jalview - - -

Adding New Datamodel Objects To Jalview

-

There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.

-

The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular method. But generally, it is best to stick to 1.1 coding style - that is no generics, no fancy Iterators or use of specific JRE object methods and interfaces introduced after 1.1 (such as the get method for java.util.Vector).

-

Steps for integrating a new class into the datamodel

-
  1. Implement in Java 1.1 compatible source.
  2. -
  3. Implement copy constructors for the benefit of any datamodel classes that reference it: -
      -
    • If it is referenced by AlignmentI or SequenceI
      -The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object. -
    • -
  4. -
  5. - - + + + +Adding New Datamodel Objects To Jalview + + +

    Adding New Datamodel Objects To Jalview

    +

    There are some basic requirements for all Jalview datamodel objects. None of them are mandatory, but each one makes it easier to integrate a new datamodel object into Jalview.

    +

    The primary requirement of classes within jalview.datamodel is that all class implementations must be byte-code compatible with a java 1.1 runtime environment. This is an imposition from the Jalview applet, which is dependent on the core jalview.datamodel package. It is possible to include dependencies to objects which are not available to the JRE1.1 environment, providing you ensure that a test is made at run-time to decide if these dependencies are followed within any particular method. But generally, it is best to stick to 1.1 coding style - that is no generics, no fancy Iterators or use of specific JRE object methods and interfaces introduced after 1.1 (such as the get method for java.util.Vector).

    +

    Steps for integrating a new class into the datamodel

    +
    1. Implement in Java 1.1 compatible source.
    2. +
    3. Implement copy constructors for the benefit of any datamodel classes that reference it: +
        +
      • If it is referenced by AlignmentI or SequenceI
        +The jalview cut and paste mechanism relies on copy constructors and a 'pseudo-copy constructor' method to make new versions of datamodel objects which correctly inherit references to a subset of attributes referenced by the original objects, and otherwise contain complete duplicates of data (sequence characters, annotation and sequence features) local to that object. +
      • +
    4. +
    5. + + diff --git a/examples/appletParameters.html b/examples/appletParameters.html index 106d977..ff41cb6 100644 --- a/examples/appletParameters.html +++ b/examples/appletParameters.html @@ -1,8 +1,25 @@ + - -Applet Parameters + +Applet Parameters @@ -129,7 +146,7 @@ pageTracker._trackPageview(); - +

      Quick Links:

      • Download the applet jar file from here @@ -151,8 +168,8 @@ pageTracker._trackPageview();
      • Use Jalview for input to a HTML form. For an example of how to code this using Javascript, click here. -
        -
      • +
        +
      • Embed Jalview into the web page, without the "Start Jalview" button by setting the embed parameter to true;
        <param name="embedded" @@ -224,7 +241,7 @@ pageTracker._trackPageview(); <param name="PDBFile3" value="Third.pdb D=SeqX B=SeqY C=SeqZ">
      • -
      • Note parameter "PDBSeq" is no longer required.
        +
      • Note parameter "PDBSeq" is no longer required.
      • Jalview 2.3 was updated to work with Jmol 11. See the versions archive if you want to download the old Jmol applet.
      •  

        diff --git a/examples/applets.html b/examples/applets.html index 1086416..2af2591 100755 --- a/examples/applets.html +++ b/examples/applets.html @@ -1,6 +1,152 @@ - + + + + + Jalview - Applets -
               
        + + + + + + + + + + + +
        + + + + +
               
        + + + +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Home
        Overview
        Download
        Applet + Version
        Screenshots
        FAQ
        Documentation
        Release + history
        Source + Code
        Development Version
        Links
        News + Mailing List
        Discussion Mailing List

        Please send problems
        and + bug reports to the discussion list.
        + +
        + +

        +
        +
        +

        Jalview comes in two distinct flavours.

        The main application allows connection to multiple web services provided @@ -29,10 +175,15 @@

        - + + - + + + + + @@ -80,8 +231,10 @@ - + + + @@ -100,5 +253,77 @@
        -

         

        Displays a Multiple Sequence Alignment Based JNet Prediction for a Sequence

         

        Displays an RFAM RNA fold family with secondary structure annotation

         

        For more JalviewLite examples, follow the links below.

        - \ No newline at end of file +

         

        + + + + +
        + + + + +
        + + + + + + + + + + + + + + + + + Displays a Multiple Sequence Alignment + Based JNet Prediction for a Sequence
        +

         

        + + + + +
        + + + + +
        + + + + + + + + + + + + Displays an RFAM RNA fold family with secondary structure annotation
        + +

         

        +

        For more JalviewLite examples, follow the links below. +

        + + + + + + diff --git a/examples/embedded.html b/examples/embedded.html index 3f61c17..415e77b 100644 --- a/examples/embedded.html +++ b/examples/embedded.html @@ -1,38 +1,55 @@ - - - -Embedded viewing of Alignments - - -

        Embedded viewing of Alignments

        -

        The alignment below was generated from the following files: -

        - - - - - - - - - - - - - - -

        - - + + + + +Embedded viewing of Alignments + + +

        Embedded viewing of Alignments

        +

        The alignment below was generated from the following files: +

        + + + + + + + + + + + + + + +

        + + diff --git a/examples/embeddedWJmol.html b/examples/embeddedWJmol.html index 083e802..35c6e15 100644 --- a/examples/embeddedWJmol.html +++ b/examples/embeddedWJmol.html @@ -1,243 +1,260 @@ - - - - -Embedded JalviewLite talking to externally managed Jmol - - - - - - - - - - - - - - - - - - - - - -
        - - - - -
               
        - - - - - -
        - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Home
        Overview
        Download
        Applet - Version
        Screenshots
        FAQ
        Documentation
        Release - history
        Source - Code
        Development Version
        Links
        News - Mailing List
        Discussion Mailing List

        Please send problems
        and - bug reports to the discussion list.
        -
        -

        -
        -
        -
        - -
        - - -
        -
        -
        - - - - - - - \ No newline at end of file + + + + + +Embedded JalviewLite talking to externally managed Jmol + + + + + + + + + + + + + + + + + + + + + +
        + + + + +
               
        + + + + + +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Home
        Overview
        Download
        Applet + Version
        Screenshots
        FAQ
        Documentation
        Release + history
        Source + Code
        Development Version
        Links
        News + Mailing List
        Discussion Mailing List

        Please send problems
        and + bug reports to the discussion list.
        +
        +

        +
        +
        +
        + +
        + + +
        +
        +
        + + + + + + + diff --git a/examples/exampleFeatures.txt b/examples/exampleFeatures.txt index c7b8b64..ed69412 100755 --- a/examples/exampleFeatures.txt +++ b/examples/exampleFeatures.txt @@ -1,311 +1,328 @@ -ST-TURN-IIL 705b23 -GAMMA-TURN-CLASSIC 788763 -BETA-TURN-IR 9a6a94 -BETA-TURN-IL d6a6ca -BETA-BULGE 1dc451 -Pfam dc206a -PHOSPHORYLATION (S) b974a5 -PHOSPHORYLATION (Y) 7d3881 -Cath 93b1d2 -ASX-TURN-IR 4ccc6e -BETA-BULGE-LOOP-5 4066da -CATMAT-4 4dc465 -CATMAT-3 3eb555 -GAMMA-TURN-INVERSE 7881c7 -SCHELLMANN-LOOP-6 a28bbb -METAL cc9900 -ALPHA-BETA-MOTIF 7bd649 -ASX-MOTIF 6addbb -NEST-LR 3e16d0 -ASX-TURN-IIR 6a4062 -NEST-RL 3e16b2 -ASX-TURN-IIL a67c98 -BETA-TURN-IIR c79792 -PHOSPHORYLATION (T) c88395 -BETA-TURN-IIL 8b5b50 -ST-MOTIF ac25a1 - -STARTGROUP uniprot -Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL -Iron-sulfur (2Fe-2S) FER_CAPAA -1 44 44 METAL -Iron-sulfur (2Fe-2S) FER_CAPAA -1 47 47 METAL -Iron-sulfur (2Fe-2S) FER_CAPAA -1 77 77 METAL -Fer2 Status: True Positive Pfam 8_8 FER_CAPAA -1 8 83 Pfam -Ferredoxin_fold Status: True Positive FER_CAPAA -1 3 93 Cath -Iron-sulfur (2Fe-2S) FER_CAPAN -1 86 86 METAL -Iron-sulfur (2Fe-2S) FER_CAPAN -1 91 91 METAL -Iron-sulfur (2Fe-2S) FER_CAPAN -1 94 94 METAL -Iron-sulfur (2Fe-2S) FER_CAPAN -1 124 124 METAL -Fer2 Status: True Positive Pfam 55_13 FER_CAPAN -1 55 130 Pfam -Ferredoxin_fold Status: True Positive FER_CAPAN -1 45 140 Cath -Iron-sulfur (2Fe-2S) FER1_SOLLC -1 86 86 METAL -Iron-sulfur (2Fe-2S) FER1_SOLLC -1 91 91 METAL -Iron-sulfur (2Fe-2S) FER1_SOLLC -1 94 94 METAL -Iron-sulfur (2Fe-2S) FER1_SOLLC -1 124 124 METAL -Fer2 Status: True Positive Pfam 55_13 FER1_SOLLC -1 55 130 Pfam -Ferredoxin_fold Status: True Positive FER1_SOLLC -1 45 140 Cath -Fer2 Status: True Positive Pfam 55_13 Q93XJ9_SOLTU -1 55 130 Pfam -Ferredoxin_fold Status: True Positive Q93XJ9_SOLTU -1 45 140 Cath -Iron-sulfur (2Fe-2S) FER1_PEA -1 91 91 METAL -Iron-sulfur (2Fe-2S) FER1_PEA -1 96 96 METAL -Iron-sulfur (2Fe-2S) FER1_PEA -1 99 99 METAL -Iron-sulfur (2Fe-2S) FER1_PEA -1 129 129 METAL -Fer2 Status: True Positive Pfam 60_13 FER1_PEA -1 60 135 Pfam -Ferredoxin_fold Status: True Positive FER1_PEA -1 50 145 Cath -Fer2 Status: True Positive Pfam 63_13 Q7XA98_TRIPR -1 63 138 Pfam -Ferredoxin_fold Status: True Positive Q7XA98_TRIPR -1 53 148 Cath -Iron-sulfur (2Fe-2S) FER1_MESCR -1 90 90 METAL -Iron-sulfur (2Fe-2S) FER1_MESCR -1 95 95 METAL -Iron-sulfur (2Fe-2S) FER1_MESCR -1 98 98 METAL -Iron-sulfur (2Fe-2S) FER1_MESCR -1 128 128 METAL -Fer2 Status: True Positive Pfam 59_13 FER1_MESCR -1 59 134 Pfam -Ferredoxin_fold Status: True Positive FER1_MESCR -1 49 144 Cath -Iron-sulfur (2Fe-2S) FER1_SPIOL -1 89 89 METAL -Iron-sulfur (2Fe-2S) FER1_SPIOL -1 94 94 METAL -Iron-sulfur (2Fe-2S) FER1_SPIOL -1 97 97 METAL -Iron-sulfur (2Fe-2S) FER1_SPIOL -1 127 127 METAL -Fer2 Status: True Positive Pfam 58_13 FER1_SPIOL -1 58 133 Pfam -Ferredoxin_fold Status: True Positive FER1_SPIOL -1 48 143 Cath -Iron-sulfur (2Fe-2S) FER3_RAPSA -1 39 39 METAL -Iron-sulfur (2Fe-2S) FER3_RAPSA -1 44 44 METAL -Iron-sulfur (2Fe-2S) FER3_RAPSA -1 47 47 METAL -Iron-sulfur (2Fe-2S) FER3_RAPSA -1 77 77 METAL -Fer2 Status: True Positive Pfam 8_8 FER3_RAPSA -1 8 83 Pfam -Ferredoxin_fold Status: True Positive FER3_RAPSA -1 3 93 Cath -Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL -Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL -Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL -Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL -Fer2 Status: True Positive Pfam 8_8 FER_BRANA -1 8 83 Pfam -Ferredoxin_fold Status: True Positive FER_BRANA -1 2 96 Cath -Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL -Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL -Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL -Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL -Fer2 Status: True Positive Pfam 60_13 FER2_ARATH -1 60 135 Pfam -Ferredoxin_fold Status: True Positive FER2_ARATH -1 50 145 Cath -Fer2 Status: True Positive Pfam 60_11 Q93Z60_ARATH -1 60 118 Pfam -Ferredoxin_fold Status: True Positive Q93Z60_ARATH -1 52 118 Cath -Iron-sulfur (2Fe-2S) FER1_MAIZE -1 91 91 METAL -Iron-sulfur (2Fe-2S) FER1_MAIZE -1 96 96 METAL -Iron-sulfur (2Fe-2S) FER1_MAIZE -1 99 99 METAL -Iron-sulfur (2Fe-2S) FER1_MAIZE -1 129 129 METAL -Fer2 Status: True Positive Pfam 60_13 FER1_MAIZE -1 60 135 Pfam -Ferredoxin_fold Status: True Positive FER1_MAIZE -1 50 145 Cath -Fer2 Status: True Positive Pfam 52_12 O80429_MAIZE -1 52 127 Pfam -Ferredoxin_fold Status: True Positive O80429_MAIZE -1 42 137 Cath -ENDGROUP uniprot - - -STARTGROUP netphos -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 89_8 FER_CAPAA -1 89 89 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 22_2 FER1_SOLLC -1 22 22 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 FER1_SOLLC -1 38 38 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 102_10 FER1_SOLLC -1 102 102 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 136_13 FER1_SOLLC -1 136 136 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 136_13 Q93XJ9_SOLTU -1 136 136 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 22_2 Q93XJ9_SOLTU -1 22 22 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 Q93XJ9_SOLTU -1 38 38 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 33_3 FER1_PEA -1 33 33 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 42_4 FER1_PEA -1 42 42 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_PEA -1 90 90 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_PEA -1 114 114 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 4_ FER1_PEA -1 4 4 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 28_2 FER1_PEA -1 28 28 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_PEA -1 141 141 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 117_11 Q7XA98_TRIPR -1 117 117 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 137_13 Q7XA98_TRIPR -1 137 137 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 144_14 Q7XA98_TRIPR -1 144 144 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 30_3 Q7XA98_TRIPR -1 30 30 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 31_3 Q7XA98_TRIPR -1 31 31 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 4_ Q7XA98_TRIPR -1 4 4 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 45_4 Q7XA98_TRIPR -1 45 45 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 46_4 Q7XA98_TRIPR -1 46 46 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 93_9 Q7XA98_TRIPR -1 93 93 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 88_8 FER1_SPIOL -1 88 88 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 112_11 FER1_SPIOL -1 112 112 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 139_13 FER1_SPIOL -1 139 139 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 73_7 FER1_SPIOL -1 73 73 PHOSPHORYLATION (Y) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 19_1 FER1_ARATH -1 19 19 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 24_2 FER1_ARATH -1 24 24 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_ARATH -1 90 90 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 FER1_ARATH -1 107 107 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_ARATH -1 114 114 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_ARATH -1 141 141 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 75_7 FER1_ARATH -1 75 75 PHOSPHORYLATION (Y) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 FER_BRANA -1 38 38 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 62_6 FER_BRANA -1 62 62 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 89_8 FER_BRANA -1 89 89 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 23_2 FER_BRANA -1 23 23 PHOSPHORYLATION (Y) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 Q93Z60_ARATH -1 107 107 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 Q93Z60_ARATH -1 114 114 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 21_2 Q93Z60_ARATH -1 21 21 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 24_2 Q93Z60_ARATH -1 24 24 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 75_7 Q93Z60_ARATH -1 75 75 PHOSPHORYLATION (Y) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 7_ FER1_MAIZE -1 7 7 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 19_1 FER1_MAIZE -1 19 19 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 44_4 FER1_MAIZE -1 44 44 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 45_4 FER1_MAIZE -1 45 45 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_MAIZE -1 90 90 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 FER1_MAIZE -1 107 107 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_MAIZE -1 114 114 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 134_13 FER1_MAIZE -1 134 134 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_MAIZE -1 141 141 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 115_11 FER1_MAIZE -1 115 115 PHOSPHORYLATION (Y) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 133_13 O80429_MAIZE -1 133 133 PHOSPHORYLATION (T) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 82_8 O80429_MAIZE -1 82 82 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 9_ O80429_MAIZE -1 9 9 PHOSPHORYLATION (S) -High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 99_9 O80429_MAIZE -1 99 99 PHOSPHORYLATION (S) -ENDGROUP netphos - -STARTGROUP s3dm -Found in PDBs: 1a70.,1a70. ALPHA-BETA-MOTIF 115_11 FER1_SPIOL -1 115 119 ALPHA-BETA-MOTIF -Found in PDBs: 1a70. ASX-TURN-IIL 107_10 FER1_SPIOL -1 107 109 ASX-TURN-IIL -Found in PDBs: 1a70. ASX-TURN-IR 115_11 FER1_SPIOL -1 115 117 ASX-TURN-IR -Found in PDBs: 1a70. BETA-BULGE 102_10 FER1_SPIOL -1 102 103 BETA-BULGE -Found in PDBs: 1a70. BETA-TURN-IR 59_6 FER1_SPIOL -1 59 62 BETA-TURN-IR -Found in PDBs: 1a70. BETA-TURN-IR 69_7 FER1_SPIOL -1 69 72 BETA-TURN-IR -Found in PDBs: 1a70. BETA-TURN-IR 95_9 FER1_SPIOL -1 95 98 BETA-TURN-IR -Found in PDBs: 1a70. BETA-TURN-IR 108_11 FER1_SPIOL -1 108 111 BETA-TURN-IR -Found in PDBs: 1a70. BETA-TURN-IR 125_12 FER1_SPIOL -1 125 128 BETA-TURN-IR -Found in PDBs: 1a70. BETA-TURN-IR 141_14 FER1_SPIOL -1 141 144 BETA-TURN-IR -Found in PDBs: 1a70. NEST-LR 90_9 FER1_SPIOL -1 90 92 NEST-LR -Found in PDBs: 1a70. NEST-LR 92_9 FER1_SPIOL -1 92 94 NEST-LR -Found in PDBs: 1a70. NEST-LR 140_14 FER1_SPIOL -1 140 142 NEST-LR -Found in PDBs: 1a70. NEST-RL 81_8 FER1_SPIOL -1 81 83 NEST-RL -Found in PDBs: 1a70. NEST-RL 89_9 FER1_SPIOL -1 89 91 NEST-RL -Found in PDBs: 1a70. NEST-RL 91_9 FER1_SPIOL -1 91 93 NEST-RL -Found in PDBs: 1a70. NEST-RL 121_12 FER1_SPIOL -1 121 123 NEST-RL -Found in PDBs: 1a70. SCHELLMANN-LOOP-6 78_8 FER1_SPIOL -1 78 83 SCHELLMANN-LOOP-6 -Found in PDBs: 1a70. SCHELLMANN-LOOP-6 118_12 FER1_SPIOL -1 118 123 SCHELLMANN-LOOP-6 -Found in PDBs: 1a70. ST-MOTIF 59_6 FER1_SPIOL -1 59 63 ST-MOTIF -ALPHA-BETA-MOTIF FER1_SPIOL -1 65 69 ALPHA-BETA-MOTIF -ASX-MOTIF FER1_SPIOL -1 65 69 ASX-MOTIF -ASX-TURN-IIL FER1_SPIOL -1 57 59 ASX-TURN-IIL -ASX-TURN-IR FER1_SPIOL -1 65 67 ASX-TURN-IR -BETA-BULGE FER1_SPIOL -1 52 53 BETA-BULGE -BETA-TURN-IR FER1_SPIOL -1 9 12 BETA-TURN-IR -BETA-TURN-IR FER1_SPIOL -1 19 22 BETA-TURN-IR -BETA-TURN-IR FER1_SPIOL -1 45 48 BETA-TURN-IR -BETA-TURN-IR FER1_SPIOL -1 58 61 BETA-TURN-IR -BETA-TURN-IR FER1_SPIOL -1 75 78 BETA-TURN-IR -BETA-TURN-IR FER1_SPIOL -1 91 94 BETA-TURN-IR -NEST-LR FER1_SPIOL -1 40 42 NEST-LR -NEST-LR FER1_SPIOL -1 42 44 NEST-LR -NEST-LR FER1_SPIOL -1 90 92 NEST-LR -NEST-RL FER1_SPIOL -1 31 33 NEST-RL -NEST-RL FER1_SPIOL -1 39 41 NEST-RL -NEST-RL FER1_SPIOL -1 41 43 NEST-RL -NEST-RL FER1_SPIOL -1 71 73 NEST-RL -SCHELLMANN-LOOP-6 FER1_SPIOL -1 28 33 SCHELLMANN-LOOP-6 -SCHELLMANN-LOOP-6 FER1_SPIOL -1 68 73 SCHELLMANN-LOOP-6 -ST-MOTIF FER1_SPIOL -1 9 13 ST-MOTIF -Found in PDBs: 1gaq.B ALPHA-BETA-MOTIF 76_8 FER1_MAIZE -1 76 80 ALPHA-BETA-MOTIF -Found in PDBs: 1gaq.B ALPHA-BETA-MOTIF 77_8 FER1_MAIZE -1 77 81 ALPHA-BETA-MOTIF -Found in PDBs: 1gaq.B BETA-TURN-IR 127_13 FER1_MAIZE -1 127 130 BETA-TURN-IR -Found in PDBs: 1gaq.B GAMMA-TURN-CLASSIC 113_11 FER1_MAIZE -1 113 115 GAMMA-TURN-CLASSIC -Found in PDBs: 1gaq.B GAMMA-TURN-INVERSE 59_6 FER1_MAIZE -1 59 61 GAMMA-TURN-INVERSE -Found in PDBs: 1gaq.B GAMMA-TURN-INVERSE 104_10 FER1_MAIZE -1 104 106 GAMMA-TURN-INVERSE -Found in PDBs: 1gaq.B NEST-LR 92_9 FER1_MAIZE -1 92 94 NEST-LR -Found in PDBs: 1gaq.B NEST-LR 94_9 FER1_MAIZE -1 94 96 NEST-LR -Found in PDBs: 1gaq.B NEST-RL 83_8 FER1_MAIZE -1 83 85 NEST-RL -Found in PDBs: 1gaq.B NEST-RL 91_9 FER1_MAIZE -1 91 93 NEST-RL -Found in PDBs: 1gaq.B NEST-RL 93_9 FER1_MAIZE -1 93 95 NEST-RL -Found in PDBs: 1gaq.B NEST-RL 123_12 FER1_MAIZE -1 123 125 NEST-RL -ALPHA-BETA-MOTIF FER1_MAIZE -1 132 136 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 174 178 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 175 179 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 180 184 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 181 185 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 214 218 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 215 219 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 218 222 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 223 227 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 246 250 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 251 255 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 254 258 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 258 262 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 279 283 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 280 284 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 289 293 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 296 300 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 299 303 ALPHA-BETA-MOTIF -ASX-TURN-IIL FER1_MAIZE -1 160 162 ASX-TURN-IIL -ASX-TURN-IIR FER1_MAIZE -1 107 109 ASX-TURN-IIR -BETA-BULGE FER1_MAIZE -1 31 32 BETA-BULGE -BETA-BULGE FER1_MAIZE -1 43 44 BETA-BULGE -BETA-TURN-IIL FER1_MAIZE -1 170 173 BETA-TURN-IIL -BETA-TURN-IIR FER1_MAIZE -1 71 74 BETA-TURN-IIR -BETA-TURN-IIR FER1_MAIZE -1 140 143 BETA-TURN-IIR -BETA-TURN-IIR FER1_MAIZE -1 274 277 BETA-TURN-IIR -BETA-TURN-IL FER1_MAIZE -1 64 67 BETA-TURN-IL -BETA-TURN-IR FER1_MAIZE -1 33 36 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 50 53 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 100 103 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 103 106 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 136 139 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 171 174 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 172 175 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 206 209 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 207 210 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 223 226 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 233 236 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 252 255 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 264 267 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 289 292 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 295 298 BETA-TURN-IR -CATMAT-3 FER1_MAIZE -1 20 22 CATMAT-3 -CATMAT-3 FER1_MAIZE -1 47 49 CATMAT-3 -CATMAT-3 FER1_MAIZE -1 97 99 CATMAT-3 -CATMAT-4 FER1_MAIZE -1 189 192 CATMAT-4 -GAMMA-TURN-INVERSE FER1_MAIZE -1 68 70 GAMMA-TURN-INVERSE -GAMMA-TURN-INVERSE FER1_MAIZE -1 84 86 GAMMA-TURN-INVERSE -GAMMA-TURN-INVERSE FER1_MAIZE -1 232 234 GAMMA-TURN-INVERSE -GAMMA-TURN-INVERSE FER1_MAIZE -1 240 242 GAMMA-TURN-INVERSE -GAMMA-TURN-INVERSE FER1_MAIZE -1 244 246 GAMMA-TURN-INVERSE -NEST-LR FER1_MAIZE -1 30 32 NEST-LR -NEST-LR FER1_MAIZE -1 66 68 NEST-LR -NEST-LR FER1_MAIZE -1 106 108 NEST-LR -NEST-LR FER1_MAIZE -1 108 110 NEST-LR -NEST-LR FER1_MAIZE -1 212 214 NEST-LR -NEST-LR FER1_MAIZE -1 276 278 NEST-LR -NEST-LR FER1_MAIZE -1 307 309 NEST-LR -NEST-RL FER1_MAIZE -1 64 66 NEST-RL -NEST-RL FER1_MAIZE -1 105 107 NEST-RL -NEST-RL FER1_MAIZE -1 107 109 NEST-RL -NEST-RL FER1_MAIZE -1 306 308 NEST-RL -ST-TURN-IIL FER1_MAIZE -1 20 22 ST-TURN-IIL -ALPHA-BETA-MOTIF FER1_MAIZE -1 24 28 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 25 29 ALPHA-BETA-MOTIF -BETA-TURN-IR FER1_MAIZE -1 75 78 BETA-TURN-IR -GAMMA-TURN-CLASSIC FER1_MAIZE -1 61 63 GAMMA-TURN-CLASSIC -GAMMA-TURN-INVERSE FER1_MAIZE -1 7 9 GAMMA-TURN-INVERSE -GAMMA-TURN-INVERSE FER1_MAIZE -1 52 54 GAMMA-TURN-INVERSE -NEST-LR FER1_MAIZE -1 40 42 NEST-LR -NEST-LR FER1_MAIZE -1 42 44 NEST-LR -NEST-RL FER1_MAIZE -1 31 33 NEST-RL -NEST-RL FER1_MAIZE -1 39 41 NEST-RL -NEST-RL FER1_MAIZE -1 41 43 NEST-RL -NEST-RL FER1_MAIZE -1 71 73 NEST-RL -ALPHA-BETA-MOTIF FER1_MAIZE -1 176 180 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 233 237 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 247 251 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 278 282 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 286 290 ALPHA-BETA-MOTIF -ALPHA-BETA-MOTIF FER1_MAIZE -1 295 299 ALPHA-BETA-MOTIF -ASX-MOTIF FER1_MAIZE -1 122 126 ASX-MOTIF -ASX-MOTIF FER1_MAIZE -1 160 164 ASX-MOTIF -ASX-TURN-IR FER1_MAIZE -1 122 124 ASX-TURN-IR -BETA-BULGE-LOOP-5 FER1_MAIZE -1 122 126 BETA-BULGE-LOOP-5 -BETA-BULGE-LOOP-5 FER1_MAIZE -1 239 243 BETA-BULGE-LOOP-5 -BETA-TURN-IR FER1_MAIZE -1 122 125 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 160 163 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 239 242 BETA-TURN-IR -BETA-TURN-IR FER1_MAIZE -1 261 264 BETA-TURN-IR -CATMAT-3 FER1_MAIZE -1 80 82 CATMAT-3 -CATMAT-3 FER1_MAIZE -1 87 89 CATMAT-3 -CATMAT-3 FER1_MAIZE -1 262 264 CATMAT-3 -NEST-RL FER1_MAIZE -1 124 126 NEST-RL -NEST-RL FER1_MAIZE -1 241 243 NEST-RL -NEST-RL FER1_MAIZE -1 292 294 NEST-RL -ENDGROUP s3dm +#------------------------------------------------------------------------------- +# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) +# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle +# +# This file is part of Jalview. +# +# Jalview is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. +# +# Jalview is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty +# of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with Jalview. If not, see . +#------------------------------------------------------------------------------- +ST-TURN-IIL 705b23 +GAMMA-TURN-CLASSIC 788763 +BETA-TURN-IR 9a6a94 +BETA-TURN-IL d6a6ca +BETA-BULGE 1dc451 +Pfam dc206a +PHOSPHORYLATION (S) b974a5 +PHOSPHORYLATION (Y) 7d3881 +Cath 93b1d2 +ASX-TURN-IR 4ccc6e +BETA-BULGE-LOOP-5 4066da +CATMAT-4 4dc465 +CATMAT-3 3eb555 +GAMMA-TURN-INVERSE 7881c7 +SCHELLMANN-LOOP-6 a28bbb +METAL cc9900 +ALPHA-BETA-MOTIF 7bd649 +ASX-MOTIF 6addbb +NEST-LR 3e16d0 +ASX-TURN-IIR 6a4062 +NEST-RL 3e16b2 +ASX-TURN-IIL a67c98 +BETA-TURN-IIR c79792 +PHOSPHORYLATION (T) c88395 +BETA-TURN-IIL 8b5b50 +ST-MOTIF ac25a1 + +STARTGROUP uniprot +Iron-sulfur (2Fe-2S) FER_CAPAA -1 39 39 METAL +Iron-sulfur (2Fe-2S) FER_CAPAA -1 44 44 METAL +Iron-sulfur (2Fe-2S) FER_CAPAA -1 47 47 METAL +Iron-sulfur (2Fe-2S) FER_CAPAA -1 77 77 METAL +Fer2 Status: True Positive Pfam 8_8 FER_CAPAA -1 8 83 Pfam +Ferredoxin_fold Status: True Positive FER_CAPAA -1 3 93 Cath +Iron-sulfur (2Fe-2S) FER_CAPAN -1 86 86 METAL +Iron-sulfur (2Fe-2S) FER_CAPAN -1 91 91 METAL +Iron-sulfur (2Fe-2S) FER_CAPAN -1 94 94 METAL +Iron-sulfur (2Fe-2S) FER_CAPAN -1 124 124 METAL +Fer2 Status: True Positive Pfam 55_13 FER_CAPAN -1 55 130 Pfam +Ferredoxin_fold Status: True Positive FER_CAPAN -1 45 140 Cath +Iron-sulfur (2Fe-2S) FER1_SOLLC -1 86 86 METAL +Iron-sulfur (2Fe-2S) FER1_SOLLC -1 91 91 METAL +Iron-sulfur (2Fe-2S) FER1_SOLLC -1 94 94 METAL +Iron-sulfur (2Fe-2S) FER1_SOLLC -1 124 124 METAL +Fer2 Status: True Positive Pfam 55_13 FER1_SOLLC -1 55 130 Pfam +Ferredoxin_fold Status: True Positive FER1_SOLLC -1 45 140 Cath +Fer2 Status: True Positive Pfam 55_13 Q93XJ9_SOLTU -1 55 130 Pfam +Ferredoxin_fold Status: True Positive Q93XJ9_SOLTU -1 45 140 Cath +Iron-sulfur (2Fe-2S) FER1_PEA -1 91 91 METAL +Iron-sulfur (2Fe-2S) FER1_PEA -1 96 96 METAL +Iron-sulfur (2Fe-2S) FER1_PEA -1 99 99 METAL +Iron-sulfur (2Fe-2S) FER1_PEA -1 129 129 METAL +Fer2 Status: True Positive Pfam 60_13 FER1_PEA -1 60 135 Pfam +Ferredoxin_fold Status: True Positive FER1_PEA -1 50 145 Cath +Fer2 Status: True Positive Pfam 63_13 Q7XA98_TRIPR -1 63 138 Pfam +Ferredoxin_fold Status: True Positive Q7XA98_TRIPR -1 53 148 Cath +Iron-sulfur (2Fe-2S) FER1_MESCR -1 90 90 METAL +Iron-sulfur (2Fe-2S) FER1_MESCR -1 95 95 METAL +Iron-sulfur (2Fe-2S) FER1_MESCR -1 98 98 METAL +Iron-sulfur (2Fe-2S) FER1_MESCR -1 128 128 METAL +Fer2 Status: True Positive Pfam 59_13 FER1_MESCR -1 59 134 Pfam +Ferredoxin_fold Status: True Positive FER1_MESCR -1 49 144 Cath +Iron-sulfur (2Fe-2S) FER1_SPIOL -1 89 89 METAL +Iron-sulfur (2Fe-2S) FER1_SPIOL -1 94 94 METAL +Iron-sulfur (2Fe-2S) FER1_SPIOL -1 97 97 METAL +Iron-sulfur (2Fe-2S) FER1_SPIOL -1 127 127 METAL +Fer2 Status: True Positive Pfam 58_13 FER1_SPIOL -1 58 133 Pfam +Ferredoxin_fold Status: True Positive FER1_SPIOL -1 48 143 Cath +Iron-sulfur (2Fe-2S) FER3_RAPSA -1 39 39 METAL +Iron-sulfur (2Fe-2S) FER3_RAPSA -1 44 44 METAL +Iron-sulfur (2Fe-2S) FER3_RAPSA -1 47 47 METAL +Iron-sulfur (2Fe-2S) FER3_RAPSA -1 77 77 METAL +Fer2 Status: True Positive Pfam 8_8 FER3_RAPSA -1 8 83 Pfam +Ferredoxin_fold Status: True Positive FER3_RAPSA -1 3 93 Cath +Iron-sulfur (2Fe-2S) FER_BRANA -1 39 39 METAL +Iron-sulfur (2Fe-2S) FER_BRANA -1 44 44 METAL +Iron-sulfur (2Fe-2S) FER_BRANA -1 47 47 METAL +Iron-sulfur (2Fe-2S) FER_BRANA -1 77 77 METAL +Fer2 Status: True Positive Pfam 8_8 FER_BRANA -1 8 83 Pfam +Ferredoxin_fold Status: True Positive FER_BRANA -1 2 96 Cath +Iron-sulfur (2Fe-2S) FER2_ARATH -1 91 91 METAL +Iron-sulfur (2Fe-2S) FER2_ARATH -1 96 96 METAL +Iron-sulfur (2Fe-2S) FER2_ARATH -1 99 99 METAL +Iron-sulfur (2Fe-2S) FER2_ARATH -1 129 129 METAL +Fer2 Status: True Positive Pfam 60_13 FER2_ARATH -1 60 135 Pfam +Ferredoxin_fold Status: True Positive FER2_ARATH -1 50 145 Cath +Fer2 Status: True Positive Pfam 60_11 Q93Z60_ARATH -1 60 118 Pfam +Ferredoxin_fold Status: True Positive Q93Z60_ARATH -1 52 118 Cath +Iron-sulfur (2Fe-2S) FER1_MAIZE -1 91 91 METAL +Iron-sulfur (2Fe-2S) FER1_MAIZE -1 96 96 METAL +Iron-sulfur (2Fe-2S) FER1_MAIZE -1 99 99 METAL +Iron-sulfur (2Fe-2S) FER1_MAIZE -1 129 129 METAL +Fer2 Status: True Positive Pfam 60_13 FER1_MAIZE -1 60 135 Pfam +Ferredoxin_fold Status: True Positive FER1_MAIZE -1 50 145 Cath +Fer2 Status: True Positive Pfam 52_12 O80429_MAIZE -1 52 127 Pfam +Ferredoxin_fold Status: True Positive O80429_MAIZE -1 42 137 Cath +ENDGROUP uniprot + + +STARTGROUP netphos +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 89_8 FER_CAPAA -1 89 89 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 22_2 FER1_SOLLC -1 22 22 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 FER1_SOLLC -1 38 38 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 102_10 FER1_SOLLC -1 102 102 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 136_13 FER1_SOLLC -1 136 136 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 136_13 Q93XJ9_SOLTU -1 136 136 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 22_2 Q93XJ9_SOLTU -1 22 22 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 Q93XJ9_SOLTU -1 38 38 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 33_3 FER1_PEA -1 33 33 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 42_4 FER1_PEA -1 42 42 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_PEA -1 90 90 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_PEA -1 114 114 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 4_ FER1_PEA -1 4 4 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 28_2 FER1_PEA -1 28 28 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_PEA -1 141 141 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 117_11 Q7XA98_TRIPR -1 117 117 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 137_13 Q7XA98_TRIPR -1 137 137 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 144_14 Q7XA98_TRIPR -1 144 144 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 30_3 Q7XA98_TRIPR -1 30 30 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 31_3 Q7XA98_TRIPR -1 31 31 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 4_ Q7XA98_TRIPR -1 4 4 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 45_4 Q7XA98_TRIPR -1 45 45 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 46_4 Q7XA98_TRIPR -1 46 46 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 93_9 Q7XA98_TRIPR -1 93 93 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 88_8 FER1_SPIOL -1 88 88 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 112_11 FER1_SPIOL -1 112 112 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 139_13 FER1_SPIOL -1 139 139 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 73_7 FER1_SPIOL -1 73 73 PHOSPHORYLATION (Y) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 19_1 FER1_ARATH -1 19 19 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 24_2 FER1_ARATH -1 24 24 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_ARATH -1 90 90 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 FER1_ARATH -1 107 107 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_ARATH -1 114 114 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_ARATH -1 141 141 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 75_7 FER1_ARATH -1 75 75 PHOSPHORYLATION (Y) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 38_3 FER_BRANA -1 38 38 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 62_6 FER_BRANA -1 62 62 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 89_8 FER_BRANA -1 89 89 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 23_2 FER_BRANA -1 23 23 PHOSPHORYLATION (Y) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 Q93Z60_ARATH -1 107 107 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 Q93Z60_ARATH -1 114 114 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 21_2 Q93Z60_ARATH -1 21 21 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 24_2 Q93Z60_ARATH -1 24 24 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 75_7 Q93Z60_ARATH -1 75 75 PHOSPHORYLATION (Y) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 7_ FER1_MAIZE -1 7 7 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 19_1 FER1_MAIZE -1 19 19 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 44_4 FER1_MAIZE -1 44 44 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 45_4 FER1_MAIZE -1 45 45 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 90_9 FER1_MAIZE -1 90 90 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 107_10 FER1_MAIZE -1 107 107 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 114_11 FER1_MAIZE -1 114 114 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 134_13 FER1_MAIZE -1 134 134 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 141_14 FER1_MAIZE -1 141 141 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (Y) 115_11 FER1_MAIZE -1 115 115 PHOSPHORYLATION (Y) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (T) 133_13 O80429_MAIZE -1 133 133 PHOSPHORYLATION (T) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 82_8 O80429_MAIZE -1 82 82 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 9_ O80429_MAIZE -1 9 9 PHOSPHORYLATION (S) +High confidence server. Only hits with scores over 0.8 are reported. PHOSPHORYLATION (S) 99_9 O80429_MAIZE -1 99 99 PHOSPHORYLATION (S) +ENDGROUP netphos + +STARTGROUP s3dm +Found in PDBs: 1a70.,1a70. ALPHA-BETA-MOTIF 115_11 FER1_SPIOL -1 115 119 ALPHA-BETA-MOTIF +Found in PDBs: 1a70. ASX-TURN-IIL 107_10 FER1_SPIOL -1 107 109 ASX-TURN-IIL +Found in PDBs: 1a70. ASX-TURN-IR 115_11 FER1_SPIOL -1 115 117 ASX-TURN-IR +Found in PDBs: 1a70. BETA-BULGE 102_10 FER1_SPIOL -1 102 103 BETA-BULGE +Found in PDBs: 1a70. BETA-TURN-IR 59_6 FER1_SPIOL -1 59 62 BETA-TURN-IR +Found in PDBs: 1a70. BETA-TURN-IR 69_7 FER1_SPIOL -1 69 72 BETA-TURN-IR +Found in PDBs: 1a70. BETA-TURN-IR 95_9 FER1_SPIOL -1 95 98 BETA-TURN-IR +Found in PDBs: 1a70. BETA-TURN-IR 108_11 FER1_SPIOL -1 108 111 BETA-TURN-IR +Found in PDBs: 1a70. BETA-TURN-IR 125_12 FER1_SPIOL -1 125 128 BETA-TURN-IR +Found in PDBs: 1a70. BETA-TURN-IR 141_14 FER1_SPIOL -1 141 144 BETA-TURN-IR +Found in PDBs: 1a70. NEST-LR 90_9 FER1_SPIOL -1 90 92 NEST-LR +Found in PDBs: 1a70. NEST-LR 92_9 FER1_SPIOL -1 92 94 NEST-LR +Found in PDBs: 1a70. NEST-LR 140_14 FER1_SPIOL -1 140 142 NEST-LR +Found in PDBs: 1a70. NEST-RL 81_8 FER1_SPIOL -1 81 83 NEST-RL +Found in PDBs: 1a70. NEST-RL 89_9 FER1_SPIOL -1 89 91 NEST-RL +Found in PDBs: 1a70. NEST-RL 91_9 FER1_SPIOL -1 91 93 NEST-RL +Found in PDBs: 1a70. NEST-RL 121_12 FER1_SPIOL -1 121 123 NEST-RL +Found in PDBs: 1a70. SCHELLMANN-LOOP-6 78_8 FER1_SPIOL -1 78 83 SCHELLMANN-LOOP-6 +Found in PDBs: 1a70. SCHELLMANN-LOOP-6 118_12 FER1_SPIOL -1 118 123 SCHELLMANN-LOOP-6 +Found in PDBs: 1a70. ST-MOTIF 59_6 FER1_SPIOL -1 59 63 ST-MOTIF +ALPHA-BETA-MOTIF FER1_SPIOL -1 65 69 ALPHA-BETA-MOTIF +ASX-MOTIF FER1_SPIOL -1 65 69 ASX-MOTIF +ASX-TURN-IIL FER1_SPIOL -1 57 59 ASX-TURN-IIL +ASX-TURN-IR FER1_SPIOL -1 65 67 ASX-TURN-IR +BETA-BULGE FER1_SPIOL -1 52 53 BETA-BULGE +BETA-TURN-IR FER1_SPIOL -1 9 12 BETA-TURN-IR +BETA-TURN-IR FER1_SPIOL -1 19 22 BETA-TURN-IR +BETA-TURN-IR FER1_SPIOL -1 45 48 BETA-TURN-IR +BETA-TURN-IR FER1_SPIOL -1 58 61 BETA-TURN-IR +BETA-TURN-IR FER1_SPIOL -1 75 78 BETA-TURN-IR +BETA-TURN-IR FER1_SPIOL -1 91 94 BETA-TURN-IR +NEST-LR FER1_SPIOL -1 40 42 NEST-LR +NEST-LR FER1_SPIOL -1 42 44 NEST-LR +NEST-LR FER1_SPIOL -1 90 92 NEST-LR +NEST-RL FER1_SPIOL -1 31 33 NEST-RL +NEST-RL FER1_SPIOL -1 39 41 NEST-RL +NEST-RL FER1_SPIOL -1 41 43 NEST-RL +NEST-RL FER1_SPIOL -1 71 73 NEST-RL +SCHELLMANN-LOOP-6 FER1_SPIOL -1 28 33 SCHELLMANN-LOOP-6 +SCHELLMANN-LOOP-6 FER1_SPIOL -1 68 73 SCHELLMANN-LOOP-6 +ST-MOTIF FER1_SPIOL -1 9 13 ST-MOTIF +Found in PDBs: 1gaq.B ALPHA-BETA-MOTIF 76_8 FER1_MAIZE -1 76 80 ALPHA-BETA-MOTIF +Found in PDBs: 1gaq.B ALPHA-BETA-MOTIF 77_8 FER1_MAIZE -1 77 81 ALPHA-BETA-MOTIF +Found in PDBs: 1gaq.B BETA-TURN-IR 127_13 FER1_MAIZE -1 127 130 BETA-TURN-IR +Found in PDBs: 1gaq.B GAMMA-TURN-CLASSIC 113_11 FER1_MAIZE -1 113 115 GAMMA-TURN-CLASSIC +Found in PDBs: 1gaq.B GAMMA-TURN-INVERSE 59_6 FER1_MAIZE -1 59 61 GAMMA-TURN-INVERSE +Found in PDBs: 1gaq.B GAMMA-TURN-INVERSE 104_10 FER1_MAIZE -1 104 106 GAMMA-TURN-INVERSE +Found in PDBs: 1gaq.B NEST-LR 92_9 FER1_MAIZE -1 92 94 NEST-LR +Found in PDBs: 1gaq.B NEST-LR 94_9 FER1_MAIZE -1 94 96 NEST-LR +Found in PDBs: 1gaq.B NEST-RL 83_8 FER1_MAIZE -1 83 85 NEST-RL +Found in PDBs: 1gaq.B NEST-RL 91_9 FER1_MAIZE -1 91 93 NEST-RL +Found in PDBs: 1gaq.B NEST-RL 93_9 FER1_MAIZE -1 93 95 NEST-RL +Found in PDBs: 1gaq.B NEST-RL 123_12 FER1_MAIZE -1 123 125 NEST-RL +ALPHA-BETA-MOTIF FER1_MAIZE -1 132 136 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 174 178 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 175 179 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 180 184 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 181 185 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 214 218 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 215 219 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 218 222 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 223 227 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 246 250 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 251 255 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 254 258 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 258 262 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 279 283 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 280 284 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 289 293 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 296 300 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 299 303 ALPHA-BETA-MOTIF +ASX-TURN-IIL FER1_MAIZE -1 160 162 ASX-TURN-IIL +ASX-TURN-IIR FER1_MAIZE -1 107 109 ASX-TURN-IIR +BETA-BULGE FER1_MAIZE -1 31 32 BETA-BULGE +BETA-BULGE FER1_MAIZE -1 43 44 BETA-BULGE +BETA-TURN-IIL FER1_MAIZE -1 170 173 BETA-TURN-IIL +BETA-TURN-IIR FER1_MAIZE -1 71 74 BETA-TURN-IIR +BETA-TURN-IIR FER1_MAIZE -1 140 143 BETA-TURN-IIR +BETA-TURN-IIR FER1_MAIZE -1 274 277 BETA-TURN-IIR +BETA-TURN-IL FER1_MAIZE -1 64 67 BETA-TURN-IL +BETA-TURN-IR FER1_MAIZE -1 33 36 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 50 53 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 100 103 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 103 106 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 136 139 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 171 174 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 172 175 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 206 209 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 207 210 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 223 226 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 233 236 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 252 255 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 264 267 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 289 292 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 295 298 BETA-TURN-IR +CATMAT-3 FER1_MAIZE -1 20 22 CATMAT-3 +CATMAT-3 FER1_MAIZE -1 47 49 CATMAT-3 +CATMAT-3 FER1_MAIZE -1 97 99 CATMAT-3 +CATMAT-4 FER1_MAIZE -1 189 192 CATMAT-4 +GAMMA-TURN-INVERSE FER1_MAIZE -1 68 70 GAMMA-TURN-INVERSE +GAMMA-TURN-INVERSE FER1_MAIZE -1 84 86 GAMMA-TURN-INVERSE +GAMMA-TURN-INVERSE FER1_MAIZE -1 232 234 GAMMA-TURN-INVERSE +GAMMA-TURN-INVERSE FER1_MAIZE -1 240 242 GAMMA-TURN-INVERSE +GAMMA-TURN-INVERSE FER1_MAIZE -1 244 246 GAMMA-TURN-INVERSE +NEST-LR FER1_MAIZE -1 30 32 NEST-LR +NEST-LR FER1_MAIZE -1 66 68 NEST-LR +NEST-LR FER1_MAIZE -1 106 108 NEST-LR +NEST-LR FER1_MAIZE -1 108 110 NEST-LR +NEST-LR FER1_MAIZE -1 212 214 NEST-LR +NEST-LR FER1_MAIZE -1 276 278 NEST-LR +NEST-LR FER1_MAIZE -1 307 309 NEST-LR +NEST-RL FER1_MAIZE -1 64 66 NEST-RL +NEST-RL FER1_MAIZE -1 105 107 NEST-RL +NEST-RL FER1_MAIZE -1 107 109 NEST-RL +NEST-RL FER1_MAIZE -1 306 308 NEST-RL +ST-TURN-IIL FER1_MAIZE -1 20 22 ST-TURN-IIL +ALPHA-BETA-MOTIF FER1_MAIZE -1 24 28 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 25 29 ALPHA-BETA-MOTIF +BETA-TURN-IR FER1_MAIZE -1 75 78 BETA-TURN-IR +GAMMA-TURN-CLASSIC FER1_MAIZE -1 61 63 GAMMA-TURN-CLASSIC +GAMMA-TURN-INVERSE FER1_MAIZE -1 7 9 GAMMA-TURN-INVERSE +GAMMA-TURN-INVERSE FER1_MAIZE -1 52 54 GAMMA-TURN-INVERSE +NEST-LR FER1_MAIZE -1 40 42 NEST-LR +NEST-LR FER1_MAIZE -1 42 44 NEST-LR +NEST-RL FER1_MAIZE -1 31 33 NEST-RL +NEST-RL FER1_MAIZE -1 39 41 NEST-RL +NEST-RL FER1_MAIZE -1 41 43 NEST-RL +NEST-RL FER1_MAIZE -1 71 73 NEST-RL +ALPHA-BETA-MOTIF FER1_MAIZE -1 176 180 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 233 237 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 247 251 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 278 282 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 286 290 ALPHA-BETA-MOTIF +ALPHA-BETA-MOTIF FER1_MAIZE -1 295 299 ALPHA-BETA-MOTIF +ASX-MOTIF FER1_MAIZE -1 122 126 ASX-MOTIF +ASX-MOTIF FER1_MAIZE -1 160 164 ASX-MOTIF +ASX-TURN-IR FER1_MAIZE -1 122 124 ASX-TURN-IR +BETA-BULGE-LOOP-5 FER1_MAIZE -1 122 126 BETA-BULGE-LOOP-5 +BETA-BULGE-LOOP-5 FER1_MAIZE -1 239 243 BETA-BULGE-LOOP-5 +BETA-TURN-IR FER1_MAIZE -1 122 125 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 160 163 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 239 242 BETA-TURN-IR +BETA-TURN-IR FER1_MAIZE -1 261 264 BETA-TURN-IR +CATMAT-3 FER1_MAIZE -1 80 82 CATMAT-3 +CATMAT-3 FER1_MAIZE -1 87 89 CATMAT-3 +CATMAT-3 FER1_MAIZE -1 262 264 CATMAT-3 +NEST-RL FER1_MAIZE -1 124 126 NEST-RL +NEST-RL FER1_MAIZE -1 241 243 NEST-RL +NEST-RL FER1_MAIZE -1 292 294 NEST-RL +ENDGROUP s3dm diff --git a/examples/formComplete.html b/examples/formComplete.html index 5da0fbf..ab9b853 100644 --- a/examples/formComplete.html +++ b/examples/formComplete.html @@ -1,4 +1,21 @@ + diff --git a/examples/jalviewLiteJs.html b/examples/jalviewLiteJs.html index 197ef56..2580a69 100644 --- a/examples/jalviewLiteJs.html +++ b/examples/jalviewLiteJs.html @@ -1,4 +1,21 @@ + diff --git a/examples/javascript/jalview.js b/examples/javascript/jalview.js index 5d648cc..34f72eb 100644 --- a/examples/javascript/jalview.js +++ b/examples/javascript/jalview.js @@ -1,326 +1,326 @@ -/******************************************************************************* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle - * +/** + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ -// default console to report messages -var _console = document.getElementById("stdout"); -var _jvapps = new Array(); -// jvjmols is a list associating a jmol id to { modelstofiles } -var _jvjmols = new Hashtable(); -// array of model names used to lookup index in Jmol -var _modeltofiles = new Array(); -// counter for jmol structures -var mnum = 1; - -function setConsole(console) { - _console = console; -} - -function getDestinationFrms(source, frames) { - var frms = new Array(); - var frid = ""; - for (frm in frames) { - try { - frid = (source!=null) && (("" + source.getSequenceSetId()) == ("" + frames[frm].currentAlignFrame - .getSequenceSetId())); - } catch (q) { - }; - - if (!frames[frm].equals(source) && !frid - && !frames[frm].currentAlignFrame.equals(source)) { - frms[frms.length] = frames[frm]; - } - } - return frms; -} - -function mouseover(list1, list2, list3, list4) { - // list1 = new Object(list1); - var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); - var msg = "Mouse over :\n" + "AlignFrame obj: " + list1 + " Seq : " - + list[1] + "\nPos: " + list[2] + "(" + list[3] + ")\n"; - - var flist = getDestinationFrms(list1, _jvapps); - if (_console) { - _console.value = msg + "\n"; - } - - for (follower in flist) { - if (_console) { - _console.value += "Sending to " + flist[follower] + "\n"; - } - flist[follower].highlight(list[1], list[2], "true"); - } - return true; -} - -function sellist(list1, list2, list3, list4) { - // list1 = new Object(list1); - var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); - var msg = "Selection:\n" + "AlignFrame obj: " + list[0] + " id : " - + list[1] + "\nSeqs " + list[2] + "\nColumns " + list[3] + "\n"; - var flist = getDestinationFrms(list1, _jvapps); - if (_console) { - _console.value = msg + "\n"; - } - - for (follower in flist) { - if (_console) { - _console.value += "Sending to " + flist[follower] + "\n"; - } - flist[follower].selectIn(flist[follower].getDefaultTargetFrame(), - list[2], list[3]) - } - return true; -} - -function viewlist(list1, list2, list3, list4) { - // list1 = new Object(list1); - var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); - var msg = "Viewport extent change::\n" + "AlignFrame obj: " + list[0] - + " id : " + list[1] + "\nRow from " + list[2] + " and to " - + list[3] + "\nVisible columns: " + list[4] + "\n"; - var flist = getDestinationFrms(list1, _jvapps); - if (_console) { - _console.value = msg + "\n"; - } - - for (follower in flist) { - if (_console) { - _console.value += "Sending to " + flist[follower] + "\n"; - } - flist[follower].scrollToViewIn(flist[follower].getDefaultTargetFrame(), - list[2], "-1"); - } - return true; -} - -// register a jalview applet and add some handlers to it -// jmolView is a reference to a jmol applet that is displaying the PDB files listed (in order) in the modeltofiles Array -function linkJvJmol(applet, jmolView, modeltofiles) { - var i = _jvapps.length; - while (i--) { - if (_jvapps[i].equals(applet)) { - throw ("Ignoring additional linkJvJmol call for " - + applet.getName() + "."); - } - } - _jvapps[_jvapps.length] = applet; - applet.setMouseoverListener("mouseover"); - applet.setSelectionListener("sellist"); - // viewListener not fully implemented in 2.7 - // try { applet.setViewListener("viewlist"); } catch (err) {}; - if (jmolView) - { - var sep = applet.getSeparator(); - var oldjm=jmolView; - // recover full id of Jmol applet - jmolView=_jmolGetApplet(jmolView).id; - var jmbinding=_jvjmols.get(jmolView); - if (!jmbinding) - { - jmbinding=new Object(); - jmbinding._modelstofiles=new Array(); - jmbinding._fullmpath=new Array(); - jmbinding._filetonum=new Hashtable(); - jmbinding._jmol=jmolView; - jmbinding._jmhandle=oldjm; - _jvjmols.put(jmolView,jmbinding); - } - - jmbinding._modelstofiles=jmbinding._modelstofiles.concat(jmbinding._modelstofiles,modeltofiles); - jmbinding._jmol=jmolView; - // now update structureListener list - mtf=""; - var dbase = document.baseURI.substring(0,document.baseURI.lastIndexOf("/")+1); - for (m in jmbinding._modelstofiles) - { if (m>0) { mtf+=sep; } - mtf+=jmbinding._modelstofiles[m]; - if (jmbinding._modelstofiles[m].indexOf("//")==-1) - { jmbinding._fullmpath[m] = dbase+((jmbinding._modelstofiles[m].indexOf("/")==0) ? jmbinding._modelstofiles[m].substring(1) : jmbinding._modelstofiles[m]); } - jmbinding._filetonum.put(jmbinding._modelstofiles[m], m+1); - jmbinding._filetonum.put(jmbinding._fullmpath[m], m+1); - - } - applet.setStructureListener("_structure", mtf); - } -} - -/*function _addJmolModel(jmolid, modelname) { - modelname=""+modelname; - var jminf = _jvjmols[jmolid]; - if (!jminf) { - jminf = new Object(); - jminf._modelstofiles = new Array(); //new Hashtable(); - jminf._jmol = jmolid; - jminf._modellist=new Array(); - _jvjmols[jmolid] = jminf; - } - var obj = new Object(); - jminf._modeltofiles[modelname] = obj; // .put(modelname, obj); - obj.id = modelname; - obj.mnum = jminf._modeltofiles.length; - jminf._modellist+=modelname; -}*/ - - - -// jmol Jalview Methods - -function _structure(list1, list2, list3, list4) { - var follower; - // if (_console) { if (!_console.value) { _console.value="";} } - if (list1 == "mouseover") { - var list = new Array(("" + list1), ("" + list2), ("" + list3), - ("" + list4)); - // 1 is pdb file, 2 is residue number, 3 is chain - // list1 = new Object(list1); - var base = list[1].indexOf(document.baseURI - .substring(0, document.baseURI.lastIndexOf('/')) - ); // .indexOf(_path); - if (base==0) { base = document.baseURI.lastIndexOf('/'); } - var sid = list[1]; // .substring(base); - base = list[1].substring(0, base); - if (_console) { - _console.value += "Model is " + list[1] + ", Structure id is : " - + sid + "\n"; - } - ; - var siddat; - for ( var jmolappi in _jvjmols.values()) { - var jmolapp=_jvjmols.values()[jmolappi]; - var msg = ""; - if (siddat = jmolapp._filetonum.get(sid)) { - // we don't putin chain number because there isn't one ? - // skip select 0 bit - var ch = ""+list[3]; - if ((""+list[2]).trim().length==1) - { - ch+=":"+list[2]; - } - msg = "select (" + ch + " /" + siddat + ") ;"; - } - if (msg) { - if (_console) { - _console.value += "Sending '" + msg + "' to jmol." + "\n"; - } - } - jmolScriptWait(msg, "" + jmolapp._jmhandle); - // only do highlight for one jmol ? - // return 1; - } - } - if (list1 == "colourstruct") { - if (_console) { - _console.value += 'colourStruct("' + list1 + '","' + list2 - + '") [' + list4 + ']' + "\n"; - } - setTimeout('colourStruct("'+list4+'","' + list1 + '","' + list2 + '")', 1); - return 1; - } - return 1; -} -// last colour message -var _lastMsg = ""; -// indicator - if _colourStruct==0 then no colouring is going on -var _colourStruct = 0; - -function colourStruct(involves, msg, handle) { - if (_colourStruct == 0) { - _colourStruct = 1; - for (ap in _jvapps) { - var _msg = ""; - do { - if (_msg.match(/\S/)) { - _lastMsg += _msg; - } - _msg = "" + _jvapps[ap].getJsMessage(msg, handle); - } while (_msg.match(/\S/)); - } - // locate the jmol that should get the message - for (var jmol in _jvjmols.values()) - { - var jml=_jvjmols.values()[jmol]; - if (jml._filetonum.get(involves)) - { - colourStructs(jml._jmhandle); - } - } - _colourStruct = 0; - } else { - // setTimeout('colourStruct("'+msg+'","'+handle+'")',3); - } -} - -function colourStructs(jmolapp) { - dbg(0, "Colouring the structures\n"); - jmolScriptWait("set selectionhalos false;" + _lastMsg - + "; select 0; set selectionhalos true;", jmolapp); - _lastMsg = ""; -} -var _jmolhovermsg=""; -function _jmolhover(jmid, atomlabel, atomidx) { - var msg=""+jmid+" "+atomlabel+" "+atomidx; - if (_jmolhovermsg==msg) - { - return; - } - _jmolhovermsg=msg; - modeltofiles = _jvjmols.get(jmid)._modelstofiles; - // atomlabel=(""+atomlabel).match(/\[(.+)\](\d+):(.)\.(\S+)\s*\/(\d+)\..+/); - // relaxed third parameter - may be null or a model number for multi model - // views - atomlabel = ("" + atomlabel) - .match(/\[(.+)\](\d+):(.)\.([^\/]+)(\/\d+\.|).+/); - atomidx = "" + atomidx; - if (atomlabel[5]) { - atomlabel[5] = atomlabel[5].match(/\/(.+)\./)[1]; - atomlabel[5] = parseInt(atomlabel[5])-1; - } else { - // default - first model - atomlabel[5] = 0; - } - // use atomlabel[5] to look up model filename so we can highlight associated positions in any jalviews - for (ap in _jvapps) { - _jvapps[ap].mouseOverStructure(atomlabel[2], atomlabel[3], - document.baseURI - .substring(0, document.baseURI.lastIndexOf('/')) - + "/" + - modeltofiles[atomlabel[5]]); - msg = _jmolhovermsg; - } -} -function _jmolpick(jmid, atomlabel, atomidx) { - atomlabel = "" + atomlabel; - atomidx = "" + atomidx; - // label is atom id, atom number, and xyz coordinates in the form: - // C6 #6 -0.30683374 -1.6836332 -0.716934 - // atom index, starting with 0. - -} -function _jmolMessagecallback(jmid, statmess) { - // if (statmess.indexOf("Script Terminated")==0) - { - var thisTime = new Date(); - if (_console) { - _console.value += "Last script execution took : " - + (thisTime.valueOf() - _lastTime.valueOf()) / 1000.0 - + " seconds."; - } - _lastTime = thisTime; - - } -} + */ +// default console to report messages +var _console = document.getElementById("stdout"); +var _jvapps = new Array(); +// jvjmols is a list associating a jmol id to { modelstofiles } +var _jvjmols = new Hashtable(); +// array of model names used to lookup index in Jmol +var _modeltofiles = new Array(); +// counter for jmol structures +var mnum = 1; + +function setConsole(console) { + _console = console; +} + +function getDestinationFrms(source, frames) { + var frms = new Array(); + var frid = ""; + for (frm in frames) { + try { + frid = (source!=null) && (("" + source.getSequenceSetId()) == ("" + frames[frm].currentAlignFrame + .getSequenceSetId())); + } catch (q) { + }; + + if (!frames[frm].equals(source) && !frid + && !frames[frm].currentAlignFrame.equals(source)) { + frms[frms.length] = frames[frm]; + } + } + return frms; +} + +function mouseover(list1, list2, list3, list4) { + // list1 = new Object(list1); + var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); + var msg = "Mouse over :\n" + "AlignFrame obj: " + list1 + " Seq : " + + list[1] + "\nPos: " + list[2] + "(" + list[3] + ")\n"; + + var flist = getDestinationFrms(list1, _jvapps); + if (_console) { + _console.value = msg + "\n"; + } + + for (follower in flist) { + if (_console) { + _console.value += "Sending to " + flist[follower] + "\n"; + } + flist[follower].highlight(list[1], list[2], "true"); + } + return true; +} + +function sellist(list1, list2, list3, list4) { + // list1 = new Object(list1); + var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); + var msg = "Selection:\n" + "AlignFrame obj: " + list[0] + " id : " + + list[1] + "\nSeqs " + list[2] + "\nColumns " + list[3] + "\n"; + var flist = getDestinationFrms(list1, _jvapps); + if (_console) { + _console.value = msg + "\n"; + } + + for (follower in flist) { + if (_console) { + _console.value += "Sending to " + flist[follower] + "\n"; + } + flist[follower].selectIn(flist[follower].getDefaultTargetFrame(), + list[2], list[3]) + } + return true; +} + +function viewlist(list1, list2, list3, list4) { + // list1 = new Object(list1); + var list = new Array(("" + list1), ("" + list2), ("" + list3), ("" + list4)); + var msg = "Viewport extent change::\n" + "AlignFrame obj: " + list[0] + + " id : " + list[1] + "\nRow from " + list[2] + " and to " + + list[3] + "\nVisible columns: " + list[4] + "\n"; + var flist = getDestinationFrms(list1, _jvapps); + if (_console) { + _console.value = msg + "\n"; + } + + for (follower in flist) { + if (_console) { + _console.value += "Sending to " + flist[follower] + "\n"; + } + flist[follower].scrollToViewIn(flist[follower].getDefaultTargetFrame(), + list[2], "-1"); + } + return true; +} + +// register a jalview applet and add some handlers to it +// jmolView is a reference to a jmol applet that is displaying the PDB files listed (in order) in the modeltofiles Array +function linkJvJmol(applet, jmolView, modeltofiles) { + var i = _jvapps.length; + while (i--) { + if (_jvapps[i].equals(applet)) { + throw ("Ignoring additional linkJvJmol call for " + + applet.getName() + "."); + } + } + _jvapps[_jvapps.length] = applet; + applet.setMouseoverListener("mouseover"); + applet.setSelectionListener("sellist"); + // viewListener not fully implemented in 2.7 + // try { applet.setViewListener("viewlist"); } catch (err) {}; + if (jmolView) + { + var sep = applet.getSeparator(); + var oldjm=jmolView; + // recover full id of Jmol applet + jmolView=_jmolGetApplet(jmolView).id; + var jmbinding=_jvjmols.get(jmolView); + if (!jmbinding) + { + jmbinding=new Object(); + jmbinding._modelstofiles=new Array(); + jmbinding._fullmpath=new Array(); + jmbinding._filetonum=new Hashtable(); + jmbinding._jmol=jmolView; + jmbinding._jmhandle=oldjm; + _jvjmols.put(jmolView,jmbinding); + } + + jmbinding._modelstofiles=jmbinding._modelstofiles.concat(jmbinding._modelstofiles,modeltofiles); + jmbinding._jmol=jmolView; + // now update structureListener list + mtf=""; + var dbase = document.baseURI.substring(0,document.baseURI.lastIndexOf("/")+1); + for (m in jmbinding._modelstofiles) + { if (m>0) { mtf+=sep; } + mtf+=jmbinding._modelstofiles[m]; + if (jmbinding._modelstofiles[m].indexOf("//")==-1) + { jmbinding._fullmpath[m] = dbase+((jmbinding._modelstofiles[m].indexOf("/")==0) ? jmbinding._modelstofiles[m].substring(1) : jmbinding._modelstofiles[m]); } + jmbinding._filetonum.put(jmbinding._modelstofiles[m], m+1); + jmbinding._filetonum.put(jmbinding._fullmpath[m], m+1); + + } + applet.setStructureListener("_structure", mtf); + } +} + +/*function _addJmolModel(jmolid, modelname) { + modelname=""+modelname; + var jminf = _jvjmols[jmolid]; + if (!jminf) { + jminf = new Object(); + jminf._modelstofiles = new Array(); //new Hashtable(); + jminf._jmol = jmolid; + jminf._modellist=new Array(); + _jvjmols[jmolid] = jminf; + } + var obj = new Object(); + jminf._modeltofiles[modelname] = obj; // .put(modelname, obj); + obj.id = modelname; + obj.mnum = jminf._modeltofiles.length; + jminf._modellist+=modelname; +}*/ + + + +// jmol Jalview Methods + +function _structure(list1, list2, list3, list4) { + var follower; + // if (_console) { if (!_console.value) { _console.value="";} } + if (list1 == "mouseover") { + var list = new Array(("" + list1), ("" + list2), ("" + list3), + ("" + list4)); + // 1 is pdb file, 2 is residue number, 3 is chain + // list1 = new Object(list1); + var base = list[1].indexOf(document.baseURI + .substring(0, document.baseURI.lastIndexOf('/')) + ); // .indexOf(_path); + if (base==0) { base = document.baseURI.lastIndexOf('/'); } + var sid = list[1]; // .substring(base); + base = list[1].substring(0, base); + if (_console) { + _console.value += "Model is " + list[1] + ", Structure id is : " + + sid + "\n"; + } + ; + var siddat; + for ( var jmolappi in _jvjmols.values()) { + var jmolapp=_jvjmols.values()[jmolappi]; + var msg = ""; + if (siddat = jmolapp._filetonum.get(sid)) { + // we don't putin chain number because there isn't one ? + // skip select 0 bit + var ch = ""+list[3]; + if ((""+list[2]).trim().length==1) + { + ch+=":"+list[2]; + } + msg = "select (" + ch + " /" + siddat + ") ;"; + } + if (msg) { + if (_console) { + _console.value += "Sending '" + msg + "' to jmol." + "\n"; + } + } + jmolScriptWait(msg, "" + jmolapp._jmhandle); + // only do highlight for one jmol ? + // return 1; + } + } + if (list1 == "colourstruct") { + if (_console) { + _console.value += 'colourStruct("' + list1 + '","' + list2 + + '") [' + list4 + ']' + "\n"; + } + setTimeout('colourStruct("'+list4+'","' + list1 + '","' + list2 + '")', 1); + return 1; + } + return 1; +} +// last colour message +var _lastMsg = ""; +// indicator - if _colourStruct==0 then no colouring is going on +var _colourStruct = 0; + +function colourStruct(involves, msg, handle) { + if (_colourStruct == 0) { + _colourStruct = 1; + for (ap in _jvapps) { + var _msg = ""; + do { + if (_msg.match(/\S/)) { + _lastMsg += _msg; + } + _msg = "" + _jvapps[ap].getJsMessage(msg, handle); + } while (_msg.match(/\S/)); + } + // locate the jmol that should get the message + for (var jmol in _jvjmols.values()) + { + var jml=_jvjmols.values()[jmol]; + if (jml._filetonum.get(involves)) + { + colourStructs(jml._jmhandle); + } + } + _colourStruct = 0; + } else { + // setTimeout('colourStruct("'+msg+'","'+handle+'")',3); + } +} + +function colourStructs(jmolapp) { + dbg(0, "Colouring the structures\n"); + jmolScriptWait("set selectionhalos false;" + _lastMsg + + "; select 0; set selectionhalos true;", jmolapp); + _lastMsg = ""; +} +var _jmolhovermsg=""; +function _jmolhover(jmid, atomlabel, atomidx) { + var msg=""+jmid+" "+atomlabel+" "+atomidx; + if (_jmolhovermsg==msg) + { + return; + } + _jmolhovermsg=msg; + modeltofiles = _jvjmols.get(jmid)._modelstofiles; + // atomlabel=(""+atomlabel).match(/\[(.+)\](\d+):(.)\.(\S+)\s*\/(\d+)\..+/); + // relaxed third parameter - may be null or a model number for multi model + // views + atomlabel = ("" + atomlabel) + .match(/\[(.+)\](\d+):(.)\.([^\/]+)(\/\d+\.|).+/); + atomidx = "" + atomidx; + if (atomlabel[5]) { + atomlabel[5] = atomlabel[5].match(/\/(.+)\./)[1]; + atomlabel[5] = parseInt(atomlabel[5])-1; + } else { + // default - first model + atomlabel[5] = 0; + } + // use atomlabel[5] to look up model filename so we can highlight associated positions in any jalviews + for (ap in _jvapps) { + _jvapps[ap].mouseOverStructure(atomlabel[2], atomlabel[3], + document.baseURI + .substring(0, document.baseURI.lastIndexOf('/')) + + "/" + + modeltofiles[atomlabel[5]]); + msg = _jmolhovermsg; + } +} +function _jmolpick(jmid, atomlabel, atomidx) { + atomlabel = "" + atomlabel; + atomidx = "" + atomidx; + // label is atom id, atom number, and xyz coordinates in the form: + // C6 #6 -0.30683374 -1.6836332 -0.716934 + // atom index, starting with 0. + +} +function _jmolMessagecallback(jmid, statmess) { + // if (statmess.indexOf("Script Terminated")==0) + { + var thisTime = new Date(); + if (_console) { + _console.value += "Last script execution took : " + + (thisTime.valueOf() - _lastTime.valueOf()) / 1000.0 + + " seconds."; + } + _lastTime = thisTime; + + } +} diff --git a/examples/javascriptLaunch.html b/examples/javascriptLaunch.html index b6b4da1..2a0e1c6 100644 --- a/examples/javascriptLaunch.html +++ b/examples/javascriptLaunch.html @@ -1,4 +1,21 @@ + Opening JalviewLite from Javascript @@ -99,4 +116,4 @@ onClick="startJalview('plantfdx.fa','Button1.alignment','alwvar')"/> - \ No newline at end of file + diff --git a/examples/linkedapplets_ng.html b/examples/linkedapplets_ng.html index 01f867a..cbb66a8 100644 --- a/examples/linkedapplets_ng.html +++ b/examples/linkedapplets_ng.html @@ -1,236 +1,253 @@ - - - - -Linked Jalview Applets Demo - - - - - - - - - - - - - - -
        - - - - -
               
        - - - -
        - -
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        Home
        Overview
        Download
        Applet - Version
        Screenshots
        FAQ
        Documentation
        Release - history
        Source - Code
        Development Version
        Links
        News - Mailing List
        Discussion Mailing List

        Please send problems
        and - bug reports to the discussion list.
        -
        -

        -
        -
        -
        -

         

        - JalviewLite Linked Applets Demo
        -

        The two applets below use JalviewLite's javascript API to exchange events about the currently selected region and mouse position in the alignment. -

        -

        See the other demonstration pages below to see the API in action:

        - - - -

        -

        -
        -

        - - - \ No newline at end of file + + + + + +Linked Jalview Applets Demo + + + + + + + + + + + + + + +
        + + + + +
               
        + + + +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        Home
        Overview
        Download
        Applet + Version
        Screenshots
        FAQ
        Documentation
        Release + history
        Source + Code
        Development Version
        Links
        News + Mailing List
        Discussion Mailing List

        Please send problems
        and + bug reports to the discussion list.
        +
        +

        +
        +
        +
        +

         

        + JalviewLite Linked Applets Demo
        +

        The two applets below use JalviewLite's javascript API to exchange events about the currently selected region and mouse position in the alignment. +

        +

        See the other demonstration pages below to see the API in action:

        + + + +

        +

        +
        +

        + + + diff --git a/help/help.hs b/help/help.hs index 8241afe..65756b7 100755 --- a/help/help.hs +++ b/help/help.hs @@ -1,4 +1,21 @@ + diff --git a/help/help.jhm b/help/help.jhm index 095196f..9560ecf 100755 --- a/help/help.jhm +++ b/help/help.jhm @@ -1,4 +1,21 @@ + diff --git a/help/helpTOC.xml b/help/helpTOC.xml index f59dd70..0d2e096 100755 --- a/help/helpTOC.xml +++ b/help/helpTOC.xml @@ -1,20 +1,20 @@ diff --git a/help/html/calculations/consensus.html b/help/html/calculations/consensus.html index d0c524f..290c805 100644 --- a/help/html/calculations/consensus.html +++ b/help/html/calculations/consensus.html @@ -1,14 +1,14 @@ Substitution matrices in Jalview @@ -92,4 +109,4 @@ In addition, it encodes weak equivalence between R and Y with AG and CTU, respec and ambiguity codes - \ No newline at end of file + diff --git a/help/html/calculations/sorting.html b/help/html/calculations/sorting.html index 262b2b0..374da24 100755 --- a/help/html/calculations/sorting.html +++ b/help/html/calculations/sorting.html @@ -1,14 +1,14 @@ - -DNA Sequence Coding Region Definition - - -

        DNA Sequence Coding Region Definition

        -

        Jalview includes the standard DNA codon translation table in -order to be able to dynamically translate cDNA to its expressed -protein sequence. DNA Sequence Coding Regions are sequence -features that can be defined on any DNA sequence in order to -mark stretches of cDNA that will be concatenated to form the -series of codons that are translated by the " -Calculate→Translate cDNA" menu function. -

        - - + + + +DNA Sequence Coding Region Definition + + +

        DNA Sequence Coding Region Definition

        +

        Jalview includes the standard DNA codon translation table in +order to be able to dynamically translate cDNA to its expressed +protein sequence. DNA Sequence Coding Regions are sequence +features that can be defined on any DNA sequence in order to +mark stretches of cDNA that will be concatenated to form the +series of codons that are translated by the " +Calculate→Translate cDNA" menu function. +

        + + diff --git a/help/html/features/commandline.html b/help/html/features/commandline.html index 368698b..cbe5a1c 100644 --- a/help/html/features/commandline.html +++ b/help/html/features/commandline.html @@ -1,14 +1,14 @@ - -Groovy Shell - - -

        - The Groovy Shell -

        -

        - Groovy is an "agile - and dynamic language for the Java platform". The groovy - scripting language makes it extremely easy to programmatically - interact with Java programs, in much the same way that Javascript is - used to generate and interact with applets and other objects on the - page. -

        -

        - Getting Groovy... -
        Jalview Groovy support is only possible if the core groovy - jars which include the GroovyShell are present on the CLASSPATH when - Jalview is started. -

        -

        - The jars are obtained from the embedded directory within the - groovy - distribution. The easiest way of adding them to the Jalview classpath - is to download and build jalview from it's source distribution, and - then add the groovy-all-*.jar to the lib directory whose path is given - in the java.ext.dirs property. -

        -

        - Opening Jalview's Groovy Console
        If groovy is - available, then the Tools→Groovy Console... - menu entry will be available from the Jalview Desktop's drop-down - menu. Selecting this will open the Groovy Console - which allows you to interactively execute Groovy scripts within the - Jalview run-time environment. -

        -

        - Executing groovy scripts on Jalview startup
        - The -groovy <script> option on the - Jalview command line will execute the contents of <script>. - <script> may be a file, a URL, or alternatively if it is - "STDIN" then the standard input will be used.
        - Note: The groovy script will be executed after - any data is loaded, and before images or any output - files are written. This allows you to perform customised jalview - analysis workflows with groovy. -

        -

        - Access to Jalview's functions from Groovy Scripts
        - There is as yet no properly defined scripting interface to Jalview, - but all the public methods of the jalview class hierarchy can be - called from Groovy scripts. The access point for this is the Jalview - object defined in the groovy environent which corresponds to the -

        jalview.gui.Desktop
        - object which manages all the Jalview windows. -

        - Here's an example to get you started: -
        -
          -
        • Getting the title, alignment and first sequence from the - current alignFrame
          -def alf = Jalview.getAlignframes();
          -print alf[0].getTitle();
          -def alignment = alf[0].viewport.alignment;
          -def seq = alignment.getSequenceAt(0);
          -
        • -
        • When running a groovy script from the command line, the alignment that was just loaded can be referred to like so:
          -print currentAlFrame.getTitle();
          -
        -

        - -

         

        - - + + + +Groovy Shell + + +

        + The Groovy Shell +

        +

        + Groovy is an "agile + and dynamic language for the Java platform". The groovy + scripting language makes it extremely easy to programmatically + interact with Java programs, in much the same way that Javascript is + used to generate and interact with applets and other objects on the + page. +

        +

        + Getting Groovy... +
        Jalview Groovy support is only possible if the core groovy + jars which include the GroovyShell are present on the CLASSPATH when + Jalview is started. +

        +

        + The jars are obtained from the embedded directory within the + groovy + distribution. The easiest way of adding them to the Jalview classpath + is to download and build jalview from it's source distribution, and + then add the groovy-all-*.jar to the lib directory whose path is given + in the java.ext.dirs property. +

        +

        + Opening Jalview's Groovy Console
        If groovy is + available, then the Tools→Groovy Console... + menu entry will be available from the Jalview Desktop's drop-down + menu. Selecting this will open the Groovy Console + which allows you to interactively execute Groovy scripts within the + Jalview run-time environment. +

        +

        + Executing groovy scripts on Jalview startup
        + The -groovy <script> option on the + Jalview command line will execute the contents of <script>. + <script> may be a file, a URL, or alternatively if it is + "STDIN" then the standard input will be used.
        + Note: The groovy script will be executed after + any data is loaded, and before images or any output + files are written. This allows you to perform customised jalview + analysis workflows with groovy. +

        +

        + Access to Jalview's functions from Groovy Scripts
        + There is as yet no properly defined scripting interface to Jalview, + but all the public methods of the jalview class hierarchy can be + called from Groovy scripts. The access point for this is the Jalview + object defined in the groovy environent which corresponds to the +

        jalview.gui.Desktop
        + object which manages all the Jalview windows. +

        + Here's an example to get you started: +
        +
          +
        • Getting the title, alignment and first sequence from the + current alignFrame
          +def alf = Jalview.getAlignframes();
          +print alf[0].getTitle();
          +def alignment = alf[0].viewport.alignment;
          +def seq = alignment.getSequenceAt(0);
          +
        • +
        • When running a groovy script from the command line, the alignment that was just loaded can be referred to like so:
          +print currentAlFrame.getTitle();
          +
        +

        + +

         

        + + diff --git a/help/html/features/hiddenRegions.html b/help/html/features/hiddenRegions.html index 606083c..7418f0f 100644 --- a/help/html/features/hiddenRegions.html +++ b/help/html/features/hiddenRegions.html @@ -1,14 +1,14 @@ - -The Jmol PDB Viewer - - -

        The Jmol PDB Viewer

        -

        Since Jalview 2.3, Jmol -has been integrated into Jalview for interactively viewing structures -opened by selecting the "Structure→View PDB -entry:" option in the sequence -id pop-up menu (if you can't see this, then you need to associate a PDB structure with the -sequence). Jmol is available from the Jalview desktop and should also -run in the JalviewLite applet, providing the browser supports Java 1.5. -If Jmol is not available, then the original internal -pdb viewer will be used as a fallback.

        -

        Superposing structures based -on their aligned sequences
        -If several structures are available on the alignment, you may add -additional structures to an existing Jmol view by selecting their entry -in the appropriate pop-up menu. Jalview will ask you if you wish to add -the structure to the existing alignment, and if you do, it will import -and superimpose the new PDB file using the corresponding positions from -the alignment. If the alignment is subsequently edited, you can use the -Jmol→Align menu option from the -menu bar of the structure view window to superpose the structures using -the updated alignment.
        -Sequence based structure superposition was added in Jalview 2.6 -

        -

        Controls
        -The structure is by default rendered as a ribbon diagram. Moving the -mouse over the structure brings up tooltips giving the residue name, PDB -residue number and chain code, atom name and number -([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a residue -in any associated sequences, then this will be highlighted in each one's -alignment window. The converse also occurs - moving the mouse over an -associated residue in an alignment window highlights the associated -atoms in the displayed structures.

        -

        Selecting a residue highlights its associated sequence residue -and alpha carbon location. Double clicking an atom allows distances to -be measured from it to any other atom in the structure.

        -

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        ActionWindowsUnixMac/OSX
        Rotate ViewLeft Click and DragLeft Click and DragClick and Drag
        ZoomShift + Left Click
        - drag mouse up or down
        Shift + Left Click
        - or middle button
        - drag mouse up or down
        Left-Alt + Click and drag mouse up or down
        Select/
        - Deselect
        - Residue
        Left ClickLeft ClickClick
        Roll ViewShift + Left Click
        - drag mouse to left or right
        Shift + Left Click
        - or middle button
        - drag mouse to left or right
        Left-Alt + Click and drag mouse to left or right
        Move OriginShift+Control+Left Click
        - or Middle Button
        - + Drag
        Middle-Button
        - and
        - drag
        Shift+Control+Left Click
        - or Middle Button
        - and drag
        Jmol MenuRight-ClickRight-ClickApple-Click
        -

        -

        The window has up to five menus: -

          -
        • File
          -
          -
            -
          • Save As
            -
            Save the displayed PDB File, or the current view as an EPS or - PNG file.
          • -
          • View Mapping
            -
            Opens a text window showing the alignment between the - residues corresponding to alpha-carbon atoms in the PDB structure and - the residues in the associated sequence.
          • -
          -
        • -
        • View -
            -
          • Show Chains
            -
            Select which of the PDB file's chains are to be displayed.
          • -
          • Colour by ..
            Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries: -
            • Select many views
              When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view. -
            • -
            • Select all views
              This is only enabled when Select many views is also enabled, and will add all associated views to the set used to colour the structure display. -
            • -
            • Invert selection
              This is only enabled when Select many views is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display. -
          • -
          • Colours
            -
            -
              -
            • By Sequence
              -
              Colours each residue in the structure with the colour of its - corresponding residue in the associated sequence as rendered in the - associated alignment views, including any Uniprot sequence features or - region colourings.
              Pick which of the associated alignment views are used to colour the structures using the View→Colour by .. sub menu.

              - Residues which only exist in the PDB structure are coloured white if - they are insertions (relative to the associated sequence in the - alignment) and grey if they are N or C terminal flanks outside the - region mapped to the alignment window's sequence.
            • -
            • By Chain
              -
              Assigns a random colour to each PDB chain. -
            • Charge & Cysteine
              -
              Highlights cysteines in yellow, anionic (Aspartic Acid or - Glutamic Acid) residues in red, and cationic (Lysine or Arginine) - residues in blue.
            • -
            • Colour with Jmol
              Defers any colouring operations to Jmol. Select this if you want to use the Jmol scripting interface or menu to modify the view directly.
            • -
            • Standard and User Defined Jalview - colourschemes.
              -
              The remaining entries apply the colourschemes available from - the standard and user defined amino - acid colours.
            • -
            -
          • -
          • Jmol
            -
            This pulldown menu is only displayed if there are multiple - structures shown in the Jmol window, and Jalview can also locate at - least two of the structures in the currently associated alignment view. -
              -
            • Align
              -
              When selected, the associated alignment will be used to - superimpose all the structures in the view onto the first structure in - the alignment. The regions used to calculate the superposition will be - highlighted using the 'Cartoon' rendering style, and the remaining - data shown as a chain trace.
              - (This option was introduced in Jalview 2.6)
            • -
            -
          • -
          • Help
            -
            -
              -
            • Jmol Help
              -
              Access the Jmol Help documentation in a new browser window.
            • -
            -
          • -
          -

          -

          Functionality provided by Jmol

          -

          Jmol's own functions are accessed by clicking the 'Jmol' logo or -right-clicking in the structure display area. Either way will open the -Jmol pop-up menu, which provides access to a number of features for -controlling the colour and display of molecules, adding measurements and -labels, plotting surfaces, and display animation. The 'Set Picking' menu -controls the behaviour of single and double mouse clicking on the -structure, and the 'Console' option opens the Jmol scripting console.

          -

          The state of each Jmol display is stored within jalview archives as a Jmol state recovery -script file. This means that any Jmol visualization effects that you add -beyond those provided by Jalview will be able to be stored and recovered -along with the displayed alignments in Jalview.

          -

          More Information

          -

          Jmol is a sophisticated program in its own right, with its own -command console and scripting language. Only the essentials have been -described here - the interested reader is referred to Jmol's own comprehensive -online documentation.

          -

          - - + + + +The Jmol PDB Viewer + + +

          The Jmol PDB Viewer

          +

          Since Jalview 2.3, Jmol +has been integrated into Jalview for interactively viewing structures +opened by selecting the "Structure→View PDB +entry:" option in the sequence +id pop-up menu (if you can't see this, then you need to associate a PDB structure with the +sequence). Jmol is available from the Jalview desktop and should also +run in the JalviewLite applet, providing the browser supports Java 1.5. +If Jmol is not available, then the original internal +pdb viewer will be used as a fallback.

          +

          Superposing structures based +on their aligned sequences
          +If several structures are available on the alignment, you may add +additional structures to an existing Jmol view by selecting their entry +in the appropriate pop-up menu. Jalview will ask you if you wish to add +the structure to the existing alignment, and if you do, it will import +and superimpose the new PDB file using the corresponding positions from +the alignment. If the alignment is subsequently edited, you can use the +Jmol→Align menu option from the +menu bar of the structure view window to superpose the structures using +the updated alignment.
          +Sequence based structure superposition was added in Jalview 2.6 +

          +

          Controls
          +The structure is by default rendered as a ribbon diagram. Moving the +mouse over the structure brings up tooltips giving the residue name, PDB +residue number and chain code, atom name and number +([RES]Num:Chain.AtomName#AtomNumber). If a mapping exists to a residue +in any associated sequences, then this will be highlighted in each one's +alignment window. The converse also occurs - moving the mouse over an +associated residue in an alignment window highlights the associated +atoms in the displayed structures.

          +

          Selecting a residue highlights its associated sequence residue +and alpha carbon location. Double clicking an atom allows distances to +be measured from it to any other atom in the structure.

          +

          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          ActionWindowsUnixMac/OSX
          Rotate ViewLeft Click and DragLeft Click and DragClick and Drag
          ZoomShift + Left Click
          + drag mouse up or down
          Shift + Left Click
          + or middle button
          + drag mouse up or down
          Left-Alt + Click and drag mouse up or down
          Select/
          + Deselect
          + Residue
          Left ClickLeft ClickClick
          Roll ViewShift + Left Click
          + drag mouse to left or right
          Shift + Left Click
          + or middle button
          + drag mouse to left or right
          Left-Alt + Click and drag mouse to left or right
          Move OriginShift+Control+Left Click
          + or Middle Button
          + + Drag
          Middle-Button
          + and
          + drag
          Shift+Control+Left Click
          + or Middle Button
          + and drag
          Jmol MenuRight-ClickRight-ClickApple-Click
          +

          +

          The window has up to five menus: +

            +
          • File
            +
            +
              +
            • Save As
              +
              Save the displayed PDB File, or the current view as an EPS or + PNG file.
            • +
            • View Mapping
              +
              Opens a text window showing the alignment between the + residues corresponding to alpha-carbon atoms in the PDB structure and + the residues in the associated sequence.
            • +
            +
          • +
          • View +
              +
            • Show Chains
              +
              Select which of the PDB file's chains are to be displayed.
            • +
            • Colour by ..
              Submenu allowing specific alignment views to be selected for colouring associated chains in the structure display. This menu contains all the alignment views associated with the structure view, with those used to colour the view indicated by ticks. Addditionally, it contains the following menu entries: +
              • Select many views
                When this option is enabled, selecting an alignment view adds it to the set used to colour the structures. Use this when colouring structures related to a number of alignments involving different domains or chains which are shown in the same structure view. +
              • +
              • Select all views
                This is only enabled when Select many views is also enabled, and will add all associated views to the set used to colour the structure display. +
              • +
              • Invert selection
                This is only enabled when Select many views is also enabled, and will replace the current set of views with any remaining views not currently used to colour the structure display. +
            • +
            • Colours
              +
              +
                +
              • By Sequence
                +
                Colours each residue in the structure with the colour of its + corresponding residue in the associated sequence as rendered in the + associated alignment views, including any Uniprot sequence features or + region colourings.
                Pick which of the associated alignment views are used to colour the structures using the View→Colour by .. sub menu.

                + Residues which only exist in the PDB structure are coloured white if + they are insertions (relative to the associated sequence in the + alignment) and grey if they are N or C terminal flanks outside the + region mapped to the alignment window's sequence.
              • +
              • By Chain
                +
                Assigns a random colour to each PDB chain. +
              • Charge & Cysteine
                +
                Highlights cysteines in yellow, anionic (Aspartic Acid or + Glutamic Acid) residues in red, and cationic (Lysine or Arginine) + residues in blue.
              • +
              • Colour with Jmol
                Defers any colouring operations to Jmol. Select this if you want to use the Jmol scripting interface or menu to modify the view directly.
              • +
              • Standard and User Defined Jalview + colourschemes.
                +
                The remaining entries apply the colourschemes available from + the standard and user defined amino + acid colours.
              • +
              +
            • +
            • Jmol
              +
              This pulldown menu is only displayed if there are multiple + structures shown in the Jmol window, and Jalview can also locate at + least two of the structures in the currently associated alignment view. +
                +
              • Align
                +
                When selected, the associated alignment will be used to + superimpose all the structures in the view onto the first structure in + the alignment. The regions used to calculate the superposition will be + highlighted using the 'Cartoon' rendering style, and the remaining + data shown as a chain trace.
                + (This option was introduced in Jalview 2.6)
              • +
              +
            • +
            • Help
              +
              +
                +
              • Jmol Help
                +
                Access the Jmol Help documentation in a new browser window.
              • +
              +
            • +
            +

            +

            Functionality provided by Jmol

            +

            Jmol's own functions are accessed by clicking the 'Jmol' logo or +right-clicking in the structure display area. Either way will open the +Jmol pop-up menu, which provides access to a number of features for +controlling the colour and display of molecules, adding measurements and +labels, plotting surfaces, and display animation. The 'Set Picking' menu +controls the behaviour of single and double mouse clicking on the +structure, and the 'Console' option opens the Jmol scripting console.

            +

            The state of each Jmol display is stored within jalview archives as a Jmol state recovery +script file. This means that any Jmol visualization effects that you add +beyond those provided by Jalview will be able to be stored and recovered +along with the displayed alignments in Jalview.

            +

            More Information

            +

            Jmol is a sophisticated program in its own right, with its own +command console and scripting language. Only the essentials have been +described here - the interested reader is referred to Jmol's own comprehensive +online documentation.

            +

            + + diff --git a/help/html/features/multipleViews.html b/help/html/features/multipleViews.html index 06841df..367e9e8 100644 --- a/help/html/features/multipleViews.html +++ b/help/html/features/multipleViews.html @@ -1,14 +1,14 @@ - -Mapping Between Different Sequences - - -

            Mapping Between Different Sequences

            -

            A new feature in Jalview 2.3 is the ability to map between sequences in different - domains, based on alignment, or by the use of explicit mappings provided by - databases.

            -

            The most familiar mapping is the one used to identify -the coordinates corresponding to a displayed sequence when -viewing a PDB file associated with a sequence (see -"Viewing PDB Files" -for more information.

            -

            The newest form of mapping supported by Jalview is the -correspondence between DNA and protein sequences. This mapping -can be imported directly from EMBL and EMBLCDS database records -retrieved by the Sequence Fetcher, -and allows sequence features to be mapped directly from Uniprot -das sources to their coding region on EMBL sequence records. - - + + + +Mapping Between Different Sequences + + +

            Mapping Between Different Sequences

            +

            A new feature in Jalview 2.3 is the ability to map between sequences in different + domains, based on alignment, or by the use of explicit mappings provided by + databases.

            +

            The most familiar mapping is the one used to identify +the coordinates corresponding to a displayed sequence when +viewing a PDB file associated with a sequence (see +"Viewing PDB Files" +for more information.

            +

            The newest form of mapping supported by Jalview is the +correspondence between DNA and protein sequences. This mapping +can be imported directly from EMBL and EMBLCDS database records +retrieved by the Sequence Fetcher, +and allows sequence features to be mapped directly from Uniprot +das sources to their coding region on EMBL sequence records. + + diff --git a/help/html/features/varna.html b/help/html/features/varna.html index 507b26f..9cf574a 100644 --- a/help/html/features/varna.html +++ b/help/html/features/varna.html @@ -1,74 +1,74 @@ - - - -The VARNA RNA Viewer - - -

            The VARNA RNA Viewer

            -

            Since Jalview -2.7.1, VARNA has been -integrated into Jalview for interactively viewing structures opened by -selecting the "Structure→View -Structure:" option in -the sequence id pop-up menu (if -you can't see this, then no RNA structure is associated with your -sequence or alignment. In the pop-up menu all structures that -are associated with this sequence and all sequences that are -associated with the alignment are available. - -

            Different structures

            -
              -
            • - Alignment structures: - Structures associated with the alignment are marked by having "consensus" attached to their name. VARNA contains two different entries for consensus structures. -
                -
              • Consensus structure: the individual sequence folded into the consensus structure
              • -
              • Trimmed consensus structure: the individual sequence - folded into the the gap-free consensus structure. That means all - columns that contained gaps in the individual sequence were - removed. If this breaks a base-pair the pairing is removed also. - This can be considered as an approximation for the individual structure. -
              -
            • -
            • - Individual structures: - this is a structure associated with the individual sequence and therefore not related to the alignment -
            • - -

              Controls
              -

                -
              • Rotate view - Left Click and drag
              • -
              • Zoom in - Press '+'
              • -
              • Zoom out - Press '-'
              • -
              • Choose a different structure - Left click on structure in the left hand panel
              • -
              • Highlighting bases - Move mouse over columns in the Jalview alignment panel
              • -
              - -

              Functionality provided by VARNA

              -

              VARNA's own functions are accessed by right-clicking in the -structure display area. That will open the VARNA pop-up menu, -which provides access to a number of features like different draw algorithm, color highlighting or annotations. -

              -

              More Information

              -

              VARNA is a very powerful RNA viewer on its own. Only the -essentials have been described here - the interested reader is -referred to VARNA's own -comprehensive online documentation.

              - - + + + +The VARNA RNA Viewer + + +

              The VARNA RNA Viewer

              +

              Since Jalview +2.7.1, VARNA has been +integrated into Jalview for interactively viewing structures opened by +selecting the "Structure→View +Structure:" option in +the sequence id pop-up menu (if +you can't see this, then no RNA structure is associated with your +sequence or alignment. In the pop-up menu all structures that +are associated with this sequence and all sequences that are +associated with the alignment are available. + +

              Different structures

              +
                +
              • + Alignment structures: + Structures associated with the alignment are marked by having "consensus" attached to their name. VARNA contains two different entries for consensus structures. +
                  +
                • Consensus structure: the individual sequence folded into the consensus structure
                • +
                • Trimmed consensus structure: the individual sequence + folded into the the gap-free consensus structure. That means all + columns that contained gaps in the individual sequence were + removed. If this breaks a base-pair the pairing is removed also. + This can be considered as an approximation for the individual structure. +
                +
              • +
              • + Individual structures: + this is a structure associated with the individual sequence and therefore not related to the alignment +
              • + +

                Controls
                +

                  +
                • Rotate view - Left Click and drag
                • +
                • Zoom in - Press '+'
                • +
                • Zoom out - Press '-'
                • +
                • Choose a different structure - Left click on structure in the left hand panel
                • +
                • Highlighting bases - Move mouse over columns in the Jalview alignment panel
                • +
                + +

                Functionality provided by VARNA

                +

                VARNA's own functions are accessed by right-clicking in the +structure display area. That will open the VARNA pop-up menu, +which provides access to a number of features like different draw algorithm, color highlighting or annotations. +

                +

                More Information

                +

                VARNA is a very powerful RNA viewer on its own. Only the +essentials have been described here - the interested reader is +referred to VARNA's own +comprehensive online documentation.

                + + diff --git a/help/html/features/viewingpdbs.html b/help/html/features/viewingpdbs.html index 1460e8a..4904856 100755 --- a/help/html/features/viewingpdbs.html +++ b/help/html/features/viewingpdbs.html @@ -1,14 +1,14 @@ - - -Database Reference Fetching - -

                -

                Discovering Database References for Sequences
                -Database references are associated with a sequence are displayed as a -list in the tooltip shown when mousing over its sequence ID. Jalview -uses references for the retrieval of PDB structures and DAS features, and for -retrieving sequence cross-references such as the protein products of a -DNA sequence.

                -

                Initiating reference retrieval
                -The application provides three ways to access the retrieval function. Either: -

                • select the Discover PDB IDs option from the structure submenu of the sequence's popup menu
                • -
                • Choose one of the options from the 'Fetch DB Refs' submenu in the alignment window's Web Services menu:
                    -
                  • Standard Databases will fetch references from the EBI databases plus currently selected DAS sources
                  • -
                  • The other entries submenus leading to lists of individual database sources that Jalview can access.
                • -
                • Answer 'Yes' when asked if you wish to retrieve database references for your sequences after initiating a DAS Sequence Feature fetch.
                • -
                -

                Jalview discovers references for a sequence by generating a set -of ID queries from the ID string of each sequence in the alignment. It -then tries to query a subset of all the databases it can access in order to match -the alignment sequence to any records retrieved from the database. If a -match is found, then the sequence is annotated with that database's -reference, and any cross-references that it's records contain.

                -

                The Sequence Identification Process
                -The method of accession id discovery is derived from the method which -earlier Jalview versions used for Uniprot sequence feature retrieval, -and was originally restricted to the identifaction of valid Uniprot -accessions.
                -Essentially, Jalview will try to retrieve records from a subset of the databases -accessible by the sequence -fetcher using each sequence's ID string (or each string in the ID -separated by the '∣' symbol).

                -

                If a record (or set of records) is retrieved by any query derived -from the ID string of a sequence, then the sequence is aligned to the -ones retrieved to determine the correct start and end residue positions -(which are displayed when the 'Show Full Sequence ID' option). This is -important for the correct display of the location of any features -associated with that database.

                -

                If the alignment reveals differences between the sequence in the -alignment and the one in the record, then Jalview will assume that the -aligned sequence is not the one in the retrieved record.

                -

                In some cases, the ID used to retrieve records may be out -of date and a dialog box will be opened indicating that a 100% match -between the sequence and the record was identified, but the -sequence name is different. In this case, the can be manually -changed (by right clicking on the sequence ID and selecting Sequence→Edit -Name). -

                  -
                • Note
                  - Please remember to save your alignment if either the start/end - numbering, or the sequence IDs were updated during the ID - retrieval process.
                • -
                - - + + + + + +Database Reference Fetching + +

                +

                Discovering Database References for Sequences
                +Database references are associated with a sequence are displayed as a +list in the tooltip shown when mousing over its sequence ID. Jalview +uses references for the retrieval of PDB structures and DAS features, and for +retrieving sequence cross-references such as the protein products of a +DNA sequence.

                +

                Initiating reference retrieval
                +The application provides three ways to access the retrieval function. Either: +

                • select the Discover PDB IDs option from the structure submenu of the sequence's popup menu
                • +
                • Choose one of the options from the 'Fetch DB Refs' submenu in the alignment window's Web Services menu:
                    +
                  • Standard Databases will fetch references from the EBI databases plus currently selected DAS sources
                  • +
                  • The other entries submenus leading to lists of individual database sources that Jalview can access.
                • +
                • Answer 'Yes' when asked if you wish to retrieve database references for your sequences after initiating a DAS Sequence Feature fetch.
                • +
                +

                Jalview discovers references for a sequence by generating a set +of ID queries from the ID string of each sequence in the alignment. It +then tries to query a subset of all the databases it can access in order to match +the alignment sequence to any records retrieved from the database. If a +match is found, then the sequence is annotated with that database's +reference, and any cross-references that it's records contain.

                +

                The Sequence Identification Process
                +The method of accession id discovery is derived from the method which +earlier Jalview versions used for Uniprot sequence feature retrieval, +and was originally restricted to the identifaction of valid Uniprot +accessions.
                +Essentially, Jalview will try to retrieve records from a subset of the databases +accessible by the sequence +fetcher using each sequence's ID string (or each string in the ID +separated by the '∣' symbol).

                +

                If a record (or set of records) is retrieved by any query derived +from the ID string of a sequence, then the sequence is aligned to the +ones retrieved to determine the correct start and end residue positions +(which are displayed when the 'Show Full Sequence ID' option). This is +important for the correct display of the location of any features +associated with that database.

                +

                If the alignment reveals differences between the sequence in the +alignment and the one in the record, then Jalview will assume that the +aligned sequence is not the one in the retrieved record.

                +

                In some cases, the ID used to retrieve records may be out +of date and a dialog box will be opened indicating that a 100% match +between the sequence and the record was identified, but the +sequence name is different. In this case, the can be manually +changed (by right clicking on the sequence ID and selecting Sequence→Edit +Name). +

                  +
                • Note
                  + Please remember to save your alignment if either the start/end + numbering, or the sequence IDs were updated during the ID + retrieval process.
                • +
                + + diff --git a/help/html/webServices/index.html b/help/html/webServices/index.html index b41e643..cff22eb 100755 --- a/help/html/webServices/index.html +++ b/help/html/webServices/index.html @@ -1,14 +1,13 @@ - Jalview Desktop RSS News Reader diff --git a/help/html/webServices/proteinDisorder.html b/help/html/webServices/proteinDisorder.html index c12d2f6..83e6184 100644 --- a/help/html/webServices/proteinDisorder.html +++ b/help/html/webServices/proteinDisorder.html @@ -1,14 +1,14 @@ - + Jalview is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty + of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with Jalview. If not, see . +--> org.netbeans.modules.java.j2seproject diff --git a/resources/embl_mapping.xml b/resources/embl_mapping.xml index 7a1f585..5159256 100644 --- a/resources/embl_mapping.xml +++ b/resources/embl_mapping.xml @@ -1,158 +1,158 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/uniprot_mapping.xml b/resources/uniprot_mapping.xml index 337ec44..83cc41a 100755 --- a/resources/uniprot_mapping.xml +++ b/resources/uniprot_mapping.xml @@ -1,20 +1,20 @@ diff --git a/schemas/JalviewUserColours.xsd b/schemas/JalviewUserColours.xsd index 7268b0e..bd43e9d 100755 --- a/schemas/JalviewUserColours.xsd +++ b/schemas/JalviewUserColours.xsd @@ -1,20 +1,20 @@ diff --git a/schemas/JalviewWsParamSet.xsd b/schemas/JalviewWsParamSet.xsd index 506c9f2..56476fb 100644 --- a/schemas/JalviewWsParamSet.xsd +++ b/schemas/JalviewWsParamSet.xsd @@ -1,20 +1,20 @@ diff --git a/schemas/castor-mapping.xsd b/schemas/castor-mapping.xsd index 63d02b7..98104fb 100644 --- a/schemas/castor-mapping.xsd +++ b/schemas/castor-mapping.xsd @@ -1,314 +1,314 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The 'bind-xml' element is used for specifying XML specific databinding - properties and behavior for a specific field. 'bind-xml' may only appear - as a child of a 'field' element. - - - - - - - - - - - - - - An optional attribute used for specifying the XML name for the - field associated with the 'bind-xml' element. - - - - - - - - - - - Allows specifying how Castor should automatically determines - the XML name of this field when no name has been specified. - In most cases the XML name is determined by using the field name, - but in some cases the user may want to use the Class name of - the field type. This attribute allows choosing between the - two approaches. If this attribute is not specified, the field - name is used as the XML name. - - - - - - - - - - - - - - - Allows specifying a nested location path for this field, - the value should just be a simplified XPath like value - where names are separated by "/". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The 'bind-xml' element is used for specifying XML specific databinding + properties and behavior for a specific field. 'bind-xml' may only appear + as a child of a 'field' element. + + + + + + + + + + + + + + An optional attribute used for specifying the XML name for the + field associated with the 'bind-xml' element. + + + + + + + + + + + Allows specifying how Castor should automatically determines + the XML name of this field when no name has been specified. + In most cases the XML name is determined by using the field name, + but in some cases the user may want to use the Class name of + the field type. This attribute allows choosing between the + two approaches. If this attribute is not specified, the field + name is used as the XML name. + + + + + + + + + + + + + + + Allows specifying a nested location path for this field, + the value should just be a simplified XPath like value + where names are separated by "/". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schemas/jalview.nodesc.properties b/schemas/jalview.nodesc.properties index ed37efc..9213ae0 100644 --- a/schemas/jalview.nodesc.properties +++ b/schemas/jalview.nodesc.properties @@ -1,30 +1,30 @@ ############################################################################### -# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) -# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle -# +# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) +# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle +# # This file is part of Jalview. -# +# # Jalview is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# +# # Jalview is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along with Jalview. If not, see . ############################################################################### -# -# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors -# - -#org.exolab.castor.builder.superclass=com.xyz.BaseObject - -# XML namespace mapping to Java packages -# -org.exolab.castor.builder.nspackages=\ - www.vamsas.ac.uk/jalview/version2=jalview.binding,\ - www.jalview.org/colours=jalview.binding,\ - www.jalview.org=jalview.binding - +# +# Property file for SourceCodeGenerator for jalview project XML for parsing without descriptors +# + +#org.exolab.castor.builder.superclass=com.xyz.BaseObject + +# XML namespace mapping to Java packages +# +org.exolab.castor.builder.nspackages=\ + www.vamsas.ac.uk/jalview/version2=jalview.binding,\ + www.jalview.org/colours=jalview.binding,\ + www.jalview.org=jalview.binding + diff --git a/schemas/jalview.properties b/schemas/jalview.properties index 236a53f..d482595 100644 --- a/schemas/jalview.properties +++ b/schemas/jalview.properties @@ -1,30 +1,30 @@ ############################################################################### -# Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) -# Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle -# +# Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) +# Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle +# # This file is part of Jalview. -# +# # Jalview is free software: you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -# +# # Jalview is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along with Jalview. If not, see . ############################################################################### -# -# Property file for SourceCodeGenerator for jalview project XML -# - -#org.exolab.castor.builder.superclass=com.xyz.BaseObject - -# XML namespace mapping to Java packages -# -org.exolab.castor.builder.nspackages=\ - www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\ - www.jalview.org/colours=jalview.schemabinding.version2,\ - www.jalview.org=jalview.schemabinding.version2 - +# +# Property file for SourceCodeGenerator for jalview project XML +# + +#org.exolab.castor.builder.superclass=com.xyz.BaseObject + +# XML namespace mapping to Java packages +# +org.exolab.castor.builder.nspackages=\ + www.vamsas.ac.uk/jalview/version2=jalview.schemabinding.version2,\ + www.jalview.org/colours=jalview.schemabinding.version2,\ + www.jalview.org=jalview.schemabinding.version2 + diff --git a/schemas/jalview.xsd b/schemas/jalview.xsd index eef8675..03c5728 100755 --- a/schemas/jalview.xsd +++ b/schemas/jalview.xsd @@ -1,20 +1,20 @@ diff --git a/schemas/jalviewJvV1.xsd b/schemas/jalviewJvV1.xsd index a453b97..c037b1a 100644 --- a/schemas/jalviewJvV1.xsd +++ b/schemas/jalviewJvV1.xsd @@ -1,162 +1,162 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/schemas/vamsas.xsd b/schemas/vamsas.xsd index 9d4b679..ec6ec7c 100755 --- a/schemas/vamsas.xsd +++ b/schemas/vamsas.xsd @@ -1,20 +1,20 @@ diff --git a/schemas/vamsasJvV1.xsd b/schemas/vamsasJvV1.xsd index 7742e6a..29d1a16 100644 --- a/schemas/vamsasJvV1.xsd +++ b/schemas/vamsasJvV1.xsd @@ -1,91 +1,91 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index 6703192..714c33f 100644 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java index cebd6a9..2872320 100755 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/Atom.java b/src/MCview/Atom.java index 47c8453..b1fe59f 100755 --- a/src/MCview/Atom.java +++ b/src/MCview/Atom.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/Bond.java b/src/MCview/Bond.java index 2979cd1..813442b 100755 --- a/src/MCview/Bond.java +++ b/src/MCview/Bond.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/MCMatrix.java b/src/MCview/MCMatrix.java index 500e203..dafabba 100755 --- a/src/MCview/MCMatrix.java +++ b/src/MCview/MCMatrix.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index 11272d1..60f7ec9 100644 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java index 8944f23..cc71355 100755 --- a/src/MCview/PDBChain.java +++ b/src/MCview/PDBChain.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index c3ab9d7..3c4698f 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index f246b8c..a6ad951 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/Residue.java b/src/MCview/Residue.java index 041277d..09aba33 100755 --- a/src/MCview/Residue.java +++ b/src/MCview/Residue.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/MCview/Zsort.java b/src/MCview/Zsort.java index a5d7905..e31c9b8 100755 --- a/src/MCview/Zsort.java +++ b/src/MCview/Zsort.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/IRegistry.java b/src/ext/vamsas/IRegistry.java index 7ea16ce..53d3abd 100755 --- a/src/ext/vamsas/IRegistry.java +++ b/src/ext/vamsas/IRegistry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/IRegistryService.java b/src/ext/vamsas/IRegistryService.java index e582b59..b7fff55 100755 --- a/src/ext/vamsas/IRegistryService.java +++ b/src/ext/vamsas/IRegistryService.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/IRegistryServiceLocator.java b/src/ext/vamsas/IRegistryServiceLocator.java index 885c62d..e82f839 100755 --- a/src/ext/vamsas/IRegistryServiceLocator.java +++ b/src/ext/vamsas/IRegistryServiceLocator.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/Jpred.java b/src/ext/vamsas/Jpred.java index d8ed0e4..2c214a4 100755 --- a/src/ext/vamsas/Jpred.java +++ b/src/ext/vamsas/Jpred.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/JpredService.java b/src/ext/vamsas/JpredService.java index 3e539d5..8758bae 100755 --- a/src/ext/vamsas/JpredService.java +++ b/src/ext/vamsas/JpredService.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/JpredServiceLocator.java b/src/ext/vamsas/JpredServiceLocator.java index 5f1f636..cf3e35f 100755 --- a/src/ext/vamsas/JpredServiceLocator.java +++ b/src/ext/vamsas/JpredServiceLocator.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/JpredSoapBindingStub.java b/src/ext/vamsas/JpredSoapBindingStub.java index 724a7d9..67f81c1 100755 --- a/src/ext/vamsas/JpredSoapBindingStub.java +++ b/src/ext/vamsas/JpredSoapBindingStub.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/MuscleWS.java b/src/ext/vamsas/MuscleWS.java index f6cc6a5..e66f93f 100755 --- a/src/ext/vamsas/MuscleWS.java +++ b/src/ext/vamsas/MuscleWS.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/MuscleWSService.java b/src/ext/vamsas/MuscleWSService.java index 0c9bd24..0f34260 100755 --- a/src/ext/vamsas/MuscleWSService.java +++ b/src/ext/vamsas/MuscleWSService.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/MuscleWSServiceLocator.java b/src/ext/vamsas/MuscleWSServiceLocator.java index 538be42..94fee1b 100755 --- a/src/ext/vamsas/MuscleWSServiceLocator.java +++ b/src/ext/vamsas/MuscleWSServiceLocator.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/MuscleWSSoapBindingStub.java b/src/ext/vamsas/MuscleWSSoapBindingStub.java index f148589..b2849df 100755 --- a/src/ext/vamsas/MuscleWSSoapBindingStub.java +++ b/src/ext/vamsas/MuscleWSSoapBindingStub.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/RegistryServiceSoapBindingStub.java b/src/ext/vamsas/RegistryServiceSoapBindingStub.java index fecd11c..138ed6d 100755 --- a/src/ext/vamsas/RegistryServiceSoapBindingStub.java +++ b/src/ext/vamsas/RegistryServiceSoapBindingStub.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/SeqSearchI.java b/src/ext/vamsas/SeqSearchI.java index e366cbb..948b978 100644 --- a/src/ext/vamsas/SeqSearchI.java +++ b/src/ext/vamsas/SeqSearchI.java @@ -1,37 +1,37 @@ -/* - * 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 . - */ -package ext.vamsas; - -public interface SeqSearchI extends java.rmi.Remote -{ - public java.lang.String getDatabase() throws java.rmi.RemoteException; - - public vamsas.objects.simple.SeqSearchResult getResult( - java.lang.String job_id) throws java.rmi.RemoteException; - - public vamsas.objects.simple.WsJobId psearch( - vamsas.objects.simple.Alignment al, java.lang.String database) - throws java.rmi.RemoteException; - - public vamsas.objects.simple.WsJobId search( - vamsas.objects.simple.Sequence s, java.lang.String database) - throws java.rmi.RemoteException; - - public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) - throws java.rmi.RemoteException; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package ext.vamsas; + +public interface SeqSearchI extends java.rmi.Remote +{ + public java.lang.String getDatabase() throws java.rmi.RemoteException; + + public vamsas.objects.simple.SeqSearchResult getResult( + java.lang.String job_id) throws java.rmi.RemoteException; + + public vamsas.objects.simple.WsJobId psearch( + vamsas.objects.simple.Alignment al, java.lang.String database) + throws java.rmi.RemoteException; + + public vamsas.objects.simple.WsJobId search( + vamsas.objects.simple.Sequence s, java.lang.String database) + throws java.rmi.RemoteException; + + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) + throws java.rmi.RemoteException; +} diff --git a/src/ext/vamsas/SeqSearchServiceLocator.java b/src/ext/vamsas/SeqSearchServiceLocator.java index e424865..e9d944e 100644 --- a/src/ext/vamsas/SeqSearchServiceLocator.java +++ b/src/ext/vamsas/SeqSearchServiceLocator.java @@ -1,183 +1,183 @@ -/* - * 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 . - */ -package ext.vamsas; - -public class SeqSearchServiceLocator extends org.apache.axis.client.Service - implements ext.vamsas.SeqSearchServiceService -{ - - public SeqSearchServiceLocator() - { - } - - public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config) - { - super(config); - } - - // Use to get a proxy class for ScanPSService - private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService"; - - public java.lang.String getSeqSeachServiceAddress() - { - return ScanPSService_address; - } - - // The WSDD service name defaults to the port name. - private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService"; - - public java.lang.String getScanPSServiceWSDDServiceName() - { - return ScanPSServiceWSDDServiceName; - } - - public void setScanPSServiceWSDDServiceName(java.lang.String name) - { - ScanPSServiceWSDDServiceName = name; - } - - public ext.vamsas.SeqSearchI getSeqSearchService() - throws javax.xml.rpc.ServiceException - { - java.net.URL endpoint; - try - { - endpoint = new java.net.URL(ScanPSService_address); - } catch (java.net.MalformedURLException e) - { - throw new javax.xml.rpc.ServiceException(e); - } - return getSeqSearchService(endpoint); - } - - public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) - throws javax.xml.rpc.ServiceException - { - try - { - ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub( - portAddress, this); - _stub.setPortName(getScanPSServiceWSDDServiceName()); - return _stub; - } catch (org.apache.axis.AxisFault e) - { - return null; - } - } - - public void setScanPSServiceEndpointAddress(java.lang.String address) - { - ScanPSService_address = address; - } - - /** - * For the given interface, get the stub implementation. If this service has - * no port for the given interface, then ServiceException is thrown. - */ - public java.rmi.Remote getPort(Class serviceEndpointInterface) - throws javax.xml.rpc.ServiceException - { - try - { - if (ext.vamsas.SeqSearchI.class - .isAssignableFrom(serviceEndpointInterface)) - { - ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub( - new java.net.URL(ScanPSService_address), this); - _stub.setPortName(getScanPSServiceWSDDServiceName()); - return _stub; - } - } catch (java.lang.Throwable t) - { - throw new javax.xml.rpc.ServiceException(t); - } - throw new javax.xml.rpc.ServiceException( - "There is no stub implementation for the interface: " - + (serviceEndpointInterface == null ? "null" - : serviceEndpointInterface.getName())); - } - - /** - * For the given interface, get the stub implementation. If this service has - * no port for the given interface, then ServiceException is thrown. - */ - public java.rmi.Remote getPort(javax.xml.namespace.QName portName, - Class serviceEndpointInterface) - throws javax.xml.rpc.ServiceException - { - if (portName == null) - { - return getPort(serviceEndpointInterface); - } - java.lang.String inputPortName = portName.getLocalPart(); - if ("ScanPSService".equals(inputPortName)) - { - return getSeqSearchService(); - } - else - { - java.rmi.Remote _stub = getPort(serviceEndpointInterface); - ((org.apache.axis.client.Stub) _stub).setPortName(portName); - return _stub; - } - } - - public javax.xml.namespace.QName getServiceName() - { - return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService"); - } - - private java.util.HashSet ports = null; - - public java.util.Iterator getPorts() - { - if (ports == null) - { - ports = new java.util.HashSet(); - ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService")); - } - return ports.iterator(); - } - - /** - * Set the endpoint address for the specified port name. - */ - public void setEndpointAddress(java.lang.String portName, - java.lang.String address) throws javax.xml.rpc.ServiceException - { - if ("ScanPSService".equals(portName)) - { - setScanPSServiceEndpointAddress(address); - } - else - { // Unknown Port Name - throw new javax.xml.rpc.ServiceException( - " Cannot set Endpoint Address for Unknown Port" + portName); - } - } - - /** - * Set the endpoint address for the specified port name. - */ - public void setEndpointAddress(javax.xml.namespace.QName portName, - java.lang.String address) throws javax.xml.rpc.ServiceException - { - setEndpointAddress(portName.getLocalPart(), address); - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package ext.vamsas; + +public class SeqSearchServiceLocator extends org.apache.axis.client.Service + implements ext.vamsas.SeqSearchServiceService +{ + + public SeqSearchServiceLocator() + { + } + + public SeqSearchServiceLocator(org.apache.axis.EngineConfiguration config) + { + super(config); + } + + // Use to get a proxy class for ScanPSService + private java.lang.String ScanPSService_address = "http://localhost:8080/TestJWS/services/ScanPSService"; + + public java.lang.String getSeqSeachServiceAddress() + { + return ScanPSService_address; + } + + // The WSDD service name defaults to the port name. + private java.lang.String ScanPSServiceWSDDServiceName = "ScanPSService"; + + public java.lang.String getScanPSServiceWSDDServiceName() + { + return ScanPSServiceWSDDServiceName; + } + + public void setScanPSServiceWSDDServiceName(java.lang.String name) + { + ScanPSServiceWSDDServiceName = name; + } + + public ext.vamsas.SeqSearchI getSeqSearchService() + throws javax.xml.rpc.ServiceException + { + java.net.URL endpoint; + try + { + endpoint = new java.net.URL(ScanPSService_address); + } catch (java.net.MalformedURLException e) + { + throw new javax.xml.rpc.ServiceException(e); + } + return getSeqSearchService(endpoint); + } + + public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) + throws javax.xml.rpc.ServiceException + { + try + { + ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub( + portAddress, this); + _stub.setPortName(getScanPSServiceWSDDServiceName()); + return _stub; + } catch (org.apache.axis.AxisFault e) + { + return null; + } + } + + public void setScanPSServiceEndpointAddress(java.lang.String address) + { + ScanPSService_address = address; + } + + /** + * For the given interface, get the stub implementation. If this service has + * no port for the given interface, then ServiceException is thrown. + */ + public java.rmi.Remote getPort(Class serviceEndpointInterface) + throws javax.xml.rpc.ServiceException + { + try + { + if (ext.vamsas.SeqSearchI.class + .isAssignableFrom(serviceEndpointInterface)) + { + ext.vamsas.SeqSearchServiceSoapBindingStub _stub = new ext.vamsas.SeqSearchServiceSoapBindingStub( + new java.net.URL(ScanPSService_address), this); + _stub.setPortName(getScanPSServiceWSDDServiceName()); + return _stub; + } + } catch (java.lang.Throwable t) + { + throw new javax.xml.rpc.ServiceException(t); + } + throw new javax.xml.rpc.ServiceException( + "There is no stub implementation for the interface: " + + (serviceEndpointInterface == null ? "null" + : serviceEndpointInterface.getName())); + } + + /** + * For the given interface, get the stub implementation. If this service has + * no port for the given interface, then ServiceException is thrown. + */ + public java.rmi.Remote getPort(javax.xml.namespace.QName portName, + Class serviceEndpointInterface) + throws javax.xml.rpc.ServiceException + { + if (portName == null) + { + return getPort(serviceEndpointInterface); + } + java.lang.String inputPortName = portName.getLocalPart(); + if ("ScanPSService".equals(inputPortName)) + { + return getSeqSearchService(); + } + else + { + java.rmi.Remote _stub = getPort(serviceEndpointInterface); + ((org.apache.axis.client.Stub) _stub).setPortName(portName); + return _stub; + } + } + + public javax.xml.namespace.QName getServiceName() + { + return new javax.xml.namespace.QName("vamsas", "ScanPSServiceService"); + } + + private java.util.HashSet ports = null; + + public java.util.Iterator getPorts() + { + if (ports == null) + { + ports = new java.util.HashSet(); + ports.add(new javax.xml.namespace.QName("vamsas", "ScanPSService")); + } + return ports.iterator(); + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(java.lang.String portName, + java.lang.String address) throws javax.xml.rpc.ServiceException + { + if ("ScanPSService".equals(portName)) + { + setScanPSServiceEndpointAddress(address); + } + else + { // Unknown Port Name + throw new javax.xml.rpc.ServiceException( + " Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + /** + * Set the endpoint address for the specified port name. + */ + public void setEndpointAddress(javax.xml.namespace.QName portName, + java.lang.String address) throws javax.xml.rpc.ServiceException + { + setEndpointAddress(portName.getLocalPart(), address); + } + +} diff --git a/src/ext/vamsas/SeqSearchServiceService.java b/src/ext/vamsas/SeqSearchServiceService.java index 48f99cb..98f5c46 100644 --- a/src/ext/vamsas/SeqSearchServiceService.java +++ b/src/ext/vamsas/SeqSearchServiceService.java @@ -1,29 +1,29 @@ -/* - * 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 . - */ -package ext.vamsas; - -public interface SeqSearchServiceService extends javax.xml.rpc.Service -{ - public java.lang.String getSeqSeachServiceAddress(); - - public ext.vamsas.SeqSearchI getSeqSearchService() - throws javax.xml.rpc.ServiceException; - - public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) - throws javax.xml.rpc.ServiceException; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package ext.vamsas; + +public interface SeqSearchServiceService extends javax.xml.rpc.Service +{ + public java.lang.String getSeqSeachServiceAddress(); + + public ext.vamsas.SeqSearchI getSeqSearchService() + throws javax.xml.rpc.ServiceException; + + public ext.vamsas.SeqSearchI getSeqSearchService(java.net.URL portAddress) + throws javax.xml.rpc.ServiceException; +} diff --git a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java index 979a855..09d8c12 100644 --- a/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java +++ b/src/ext/vamsas/SeqSearchServiceSoapBindingStub.java @@ -1,488 +1,488 @@ -/* - * 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 . - */ -package ext.vamsas; - -public class SeqSearchServiceSoapBindingStub extends - org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI -{ - private java.util.Vector cachedSerClasses = new java.util.Vector(); - - private java.util.Vector cachedSerQNames = new java.util.Vector(); - - private java.util.Vector cachedSerFactories = new java.util.Vector(); - - private java.util.Vector cachedDeserFactories = new java.util.Vector(); - - static org.apache.axis.description.OperationDesc[] _operations; - - static - { - _operations = new org.apache.axis.description.OperationDesc[5]; - _initOperationDesc1(); - } - - private static void _initOperationDesc1() - { - org.apache.axis.description.OperationDesc oper; - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("getDatabase"); - oper.setReturnType(new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", "string")); - oper.setReturnClass(java.lang.String.class); - oper.setReturnQName(new javax.xml.namespace.QName("", - "getDatabaseReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[0] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("getResult"); - oper.addParameter(new javax.xml.namespace.QName("", "job_id"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", "string"), - java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "SeqSearchResult")); - oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[1] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("psearch"); - oper.addParameter(new javax.xml.namespace.QName("", "al"), - new javax.xml.namespace.QName("simple.objects.vamsas", - "Alignment"), vamsas.objects.simple.Alignment.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.addParameter(new javax.xml.namespace.QName("", "database"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", "string"), - java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "WsJobId")); - oper.setReturnClass(vamsas.objects.simple.WsJobId.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "psearchReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[2] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("search"); - oper.addParameter(new javax.xml.namespace.QName("", "s"), - new javax.xml.namespace.QName("simple.objects.vamsas", - "Sequence"), vamsas.objects.simple.Sequence.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.addParameter(new javax.xml.namespace.QName("", "database"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", "string"), - java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "WsJobId")); - oper.setReturnClass(vamsas.objects.simple.WsJobId.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "searchReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[3] = oper; - - oper = new org.apache.axis.description.OperationDesc(); - oper.setName("cancel"); - oper.addParameter(new javax.xml.namespace.QName("", "jobId"), - new javax.xml.namespace.QName( - "http://www.w3.org/2001/XMLSchema", "string"), - java.lang.String.class, - org.apache.axis.description.ParameterDesc.IN, false, false); - oper.setReturnType(new javax.xml.namespace.QName( - "simple.objects.vamsas", "WsJobId")); - oper.setReturnClass(vamsas.objects.simple.WsJobId.class); - oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn")); - oper.setStyle(org.apache.axis.constants.Style.RPC); - oper.setUse(org.apache.axis.constants.Use.ENCODED); - _operations[4] = oper; - - } - - public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault - { - this(null); - } - - public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL, - javax.xml.rpc.Service service) throws org.apache.axis.AxisFault - { - this(service); - super.cachedEndpoint = endpointURL; - } - - public SeqSearchServiceSoapBindingStub(javax.xml.rpc.Service service) - throws org.apache.axis.AxisFault - { - if (service == null) - { - super.service = new org.apache.axis.client.Service(); - } - else - { - super.service = service; - } - java.lang.Class cls; - javax.xml.namespace.QName qName; - java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; - java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class; - java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class; - java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class; - java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class; - java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class; - java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class; - java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class; - java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class; - java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class; - qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Result.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "WsJobId"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.WsJobId.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", - "Object"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Object.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string"); - cachedSerQNames.add(qName); - cls = java.lang.String[].class; - cachedSerClasses.add(cls); - cachedSerFactories.add(arraysf); - cachedDeserFactories.add(arraydf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "Alignment"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Alignment.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "Sequence"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Sequence.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.Sequence[].class; - cachedSerClasses.add(cls); - cachedSerFactories.add(arraysf); - cachedDeserFactories.add(arraydf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "SeqSearchResult"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.SeqSearchResult.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - qName = new javax.xml.namespace.QName("simple.objects.vamsas", - "SequenceSet"); - cachedSerQNames.add(qName); - cls = vamsas.objects.simple.SequenceSet.class; - cachedSerClasses.add(cls); - cachedSerFactories.add(beansf); - cachedDeserFactories.add(beandf); - - } - - protected org.apache.axis.client.Call createCall() - throws java.rmi.RemoteException - { - try - { - org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service - .createCall(); - if (super.maintainSessionSet) - { - _call.setMaintainSession(super.maintainSession); - } - if (super.cachedUsername != null) - { - _call.setUsername(super.cachedUsername); - } - if (super.cachedPassword != null) - { - _call.setPassword(super.cachedPassword); - } - if (super.cachedEndpoint != null) - { - _call.setTargetEndpointAddress(super.cachedEndpoint); - } - if (super.cachedTimeout != null) - { - _call.setTimeout(super.cachedTimeout); - } - if (super.cachedPortName != null) - { - _call.setPortName(super.cachedPortName); - } - java.util.Enumeration keys = super.cachedProperties.keys(); - while (keys.hasMoreElements()) - { - java.lang.String key = (java.lang.String) keys.nextElement(); - _call.setProperty(key, super.cachedProperties.get(key)); - } - // All the type mapping information is registered - // when the first call is made. - // The type mapping information is actually registered in - // the TypeMappingRegistry of the service, which - // is the reason why registration is only needed for the first call. - synchronized (this) - { - if (firstCall()) - { - // must set encoding style before registering serializers - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); - for (int i = 0; i < cachedSerFactories.size(); ++i) - { - java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); - javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames - .get(i); - java.lang.Class sf = (java.lang.Class) cachedSerFactories - .get(i); - java.lang.Class df = (java.lang.Class) cachedDeserFactories - .get(i); - _call.registerTypeMapping(cls, qName, sf, df, false); - } - } - } - return _call; - } catch (java.lang.Throwable _t) - { - throw new org.apache.axis.AxisFault( - "Failure trying to get the Call object", _t); - } - } - - public java.lang.String getDatabase() throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[0]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", - "getDatabase")); - - setRequestHeaders(_call); - setAttachments(_call); - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - {}); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - try - { - return (java.lang.String) _resp; - } catch (java.lang.Exception _exception) - { - return (java.lang.String) org.apache.axis.utils.JavaUtils.convert( - _resp, java.lang.String.class); - } - } - } - - public vamsas.objects.simple.SeqSearchResult getResult( - java.lang.String job_id) throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[1]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", - "getResult")); - - setRequestHeaders(_call); - setAttachments(_call); - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - { job_id }); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - try - { - return (vamsas.objects.simple.SeqSearchResult) _resp; - } catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils - .convert(_resp, vamsas.objects.simple.SeqSearchResult.class); - } - } - } - - public vamsas.objects.simple.WsJobId psearch( - vamsas.objects.simple.Alignment al, java.lang.String database) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[2]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", - "psearch")); - - setRequestHeaders(_call); - setAttachments(_call); - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - { al, database }); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - try - { - return (vamsas.objects.simple.WsJobId) _resp; - } catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils - .convert(_resp, vamsas.objects.simple.WsJobId.class); - } - } - } - - public vamsas.objects.simple.WsJobId search( - vamsas.objects.simple.Sequence s, java.lang.String database) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[3]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", "search")); - - setRequestHeaders(_call); - setAttachments(_call); - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - { s, database }); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - try - { - return (vamsas.objects.simple.WsJobId) _resp; - } catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils - .convert(_resp, vamsas.objects.simple.WsJobId.class); - } - } - } - - public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) - throws java.rmi.RemoteException - { - if (super.cachedEndpoint == null) - { - throw new org.apache.axis.NoEndPointException(); - } - org.apache.axis.client.Call _call = createCall(); - _call.setOperation(_operations[4]); - _call.setUseSOAPAction(true); - _call.setSOAPActionURI(""); - _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); - _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel")); - - setRequestHeaders(_call); - setAttachments(_call); - java.lang.Object _resp = _call.invoke(new java.lang.Object[] - { jobId }); - - if (_resp instanceof java.rmi.RemoteException) - { - throw (java.rmi.RemoteException) _resp; - } - else - { - extractAttachments(_call); - try - { - return (vamsas.objects.simple.WsJobId) _resp; - } catch (java.lang.Exception _exception) - { - return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils - .convert(_resp, vamsas.objects.simple.WsJobId.class); - } - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package ext.vamsas; + +public class SeqSearchServiceSoapBindingStub extends + org.apache.axis.client.Stub implements ext.vamsas.SeqSearchI +{ + private java.util.Vector cachedSerClasses = new java.util.Vector(); + + private java.util.Vector cachedSerQNames = new java.util.Vector(); + + private java.util.Vector cachedSerFactories = new java.util.Vector(); + + private java.util.Vector cachedDeserFactories = new java.util.Vector(); + + static org.apache.axis.description.OperationDesc[] _operations; + + static + { + _operations = new org.apache.axis.description.OperationDesc[5]; + _initOperationDesc1(); + } + + private static void _initOperationDesc1() + { + org.apache.axis.description.OperationDesc oper; + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getDatabase"); + oper.setReturnType(new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", "string")); + oper.setReturnClass(java.lang.String.class); + oper.setReturnQName(new javax.xml.namespace.QName("", + "getDatabaseReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[0] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("getResult"); + oper.addParameter(new javax.xml.namespace.QName("", "job_id"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", "string"), + java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "SeqSearchResult")); + oper.setReturnClass(vamsas.objects.simple.SeqSearchResult.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[1] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("psearch"); + oper.addParameter(new javax.xml.namespace.QName("", "al"), + new javax.xml.namespace.QName("simple.objects.vamsas", + "Alignment"), vamsas.objects.simple.Alignment.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.addParameter(new javax.xml.namespace.QName("", "database"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", "string"), + java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "psearchReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[2] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("search"); + oper.addParameter(new javax.xml.namespace.QName("", "s"), + new javax.xml.namespace.QName("simple.objects.vamsas", + "Sequence"), vamsas.objects.simple.Sequence.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.addParameter(new javax.xml.namespace.QName("", "database"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", "string"), + java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "searchReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[3] = oper; + + oper = new org.apache.axis.description.OperationDesc(); + oper.setName("cancel"); + oper.addParameter(new javax.xml.namespace.QName("", "jobId"), + new javax.xml.namespace.QName( + "http://www.w3.org/2001/XMLSchema", "string"), + java.lang.String.class, + org.apache.axis.description.ParameterDesc.IN, false, false); + oper.setReturnType(new javax.xml.namespace.QName( + "simple.objects.vamsas", "WsJobId")); + oper.setReturnClass(vamsas.objects.simple.WsJobId.class); + oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn")); + oper.setStyle(org.apache.axis.constants.Style.RPC); + oper.setUse(org.apache.axis.constants.Use.ENCODED); + _operations[4] = oper; + + } + + public SeqSearchServiceSoapBindingStub() throws org.apache.axis.AxisFault + { + this(null); + } + + public SeqSearchServiceSoapBindingStub(java.net.URL endpointURL, + javax.xml.rpc.Service service) throws org.apache.axis.AxisFault + { + this(service); + super.cachedEndpoint = endpointURL; + } + + public SeqSearchServiceSoapBindingStub(javax.xml.rpc.Service service) + throws org.apache.axis.AxisFault + { + if (service == null) + { + super.service = new org.apache.axis.client.Service(); + } + else + { + super.service = service; + } + java.lang.Class cls; + javax.xml.namespace.QName qName; + java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class; + java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class; + java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class; + java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class; + java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class; + java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class; + java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class; + java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class; + java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class; + java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class; + qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Result.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "WsJobId"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.WsJobId.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", + "Object"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Object.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string"); + cachedSerQNames.add(qName); + cls = java.lang.String[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "Alignment"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Alignment.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.Sequence[].class; + cachedSerClasses.add(cls); + cachedSerFactories.add(arraysf); + cachedDeserFactories.add(arraydf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "SeqSearchResult"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.SeqSearchResult.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + qName = new javax.xml.namespace.QName("simple.objects.vamsas", + "SequenceSet"); + cachedSerQNames.add(qName); + cls = vamsas.objects.simple.SequenceSet.class; + cachedSerClasses.add(cls); + cachedSerFactories.add(beansf); + cachedDeserFactories.add(beandf); + + } + + protected org.apache.axis.client.Call createCall() + throws java.rmi.RemoteException + { + try + { + org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service + .createCall(); + if (super.maintainSessionSet) + { + _call.setMaintainSession(super.maintainSession); + } + if (super.cachedUsername != null) + { + _call.setUsername(super.cachedUsername); + } + if (super.cachedPassword != null) + { + _call.setPassword(super.cachedPassword); + } + if (super.cachedEndpoint != null) + { + _call.setTargetEndpointAddress(super.cachedEndpoint); + } + if (super.cachedTimeout != null) + { + _call.setTimeout(super.cachedTimeout); + } + if (super.cachedPortName != null) + { + _call.setPortName(super.cachedPortName); + } + java.util.Enumeration keys = super.cachedProperties.keys(); + while (keys.hasMoreElements()) + { + java.lang.String key = (java.lang.String) keys.nextElement(); + _call.setProperty(key, super.cachedProperties.get(key)); + } + // All the type mapping information is registered + // when the first call is made. + // The type mapping information is actually registered in + // the TypeMappingRegistry of the service, which + // is the reason why registration is only needed for the first call. + synchronized (this) + { + if (firstCall()) + { + // must set encoding style before registering serializers + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC); + for (int i = 0; i < cachedSerFactories.size(); ++i) + { + java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i); + javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames + .get(i); + java.lang.Class sf = (java.lang.Class) cachedSerFactories + .get(i); + java.lang.Class df = (java.lang.Class) cachedDeserFactories + .get(i); + _call.registerTypeMapping(cls, qName, sf, df, false); + } + } + } + return _call; + } catch (java.lang.Throwable _t) + { + throw new org.apache.axis.AxisFault( + "Failure trying to get the Call object", _t); + } + } + + public java.lang.String getDatabase() throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", + "getDatabase")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + {}); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + try + { + return (java.lang.String) _resp; + } catch (java.lang.Exception _exception) + { + return (java.lang.String) org.apache.axis.utils.JavaUtils.convert( + _resp, java.lang.String.class); + } + } + } + + public vamsas.objects.simple.SeqSearchResult getResult( + java.lang.String job_id) throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[1]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", + "getResult")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + { job_id }); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + try + { + return (vamsas.objects.simple.SeqSearchResult) _resp; + } catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.SeqSearchResult) org.apache.axis.utils.JavaUtils + .convert(_resp, vamsas.objects.simple.SeqSearchResult.class); + } + } + } + + public vamsas.objects.simple.WsJobId psearch( + vamsas.objects.simple.Alignment al, java.lang.String database) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[2]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", + "psearch")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + { al, database }); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + try + { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils + .convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + + public vamsas.objects.simple.WsJobId search( + vamsas.objects.simple.Sequence s, java.lang.String database) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[3]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "search")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + { s, database }); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + try + { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils + .convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + + public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) + throws java.rmi.RemoteException + { + if (super.cachedEndpoint == null) + { + throw new org.apache.axis.NoEndPointException(); + } + org.apache.axis.client.Call _call = createCall(); + _call.setOperation(_operations[4]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel")); + + setRequestHeaders(_call); + setAttachments(_call); + java.lang.Object _resp = _call.invoke(new java.lang.Object[] + { jobId }); + + if (_resp instanceof java.rmi.RemoteException) + { + throw (java.rmi.RemoteException) _resp; + } + else + { + extractAttachments(_call); + try + { + return (vamsas.objects.simple.WsJobId) _resp; + } catch (java.lang.Exception _exception) + { + return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils + .convert(_resp, vamsas.objects.simple.WsJobId.class); + } + } + } + +} diff --git a/src/ext/vamsas/ServiceHandle.java b/src/ext/vamsas/ServiceHandle.java index b649c99..02ad6d6 100755 --- a/src/ext/vamsas/ServiceHandle.java +++ b/src/ext/vamsas/ServiceHandle.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/ext/vamsas/ServiceHandles.java b/src/ext/vamsas/ServiceHandles.java index eefbac5..a9912e1 100755 --- a/src/ext/vamsas/ServiceHandles.java +++ b/src/ext/vamsas/ServiceHandles.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/analysis/AAFrequency.java b/src/jalview/analysis/AAFrequency.java index f7ad5f6..50b1b4b 100755 --- a/src/jalview/analysis/AAFrequency.java +++ b/src/jalview/analysis/AAFrequency.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.analysis; diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index e96d208..4a8955b 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 71e9bd1..48dbb6a 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.analysis; diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 7140f39..910279f 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index 6c63f1c..09f1bc6 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -1,602 +1,602 @@ -/* - * 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 . - */ -package jalview.analysis; - -import java.util.Enumeration; -import java.util.List; -import java.util.Vector; -import java.util.Hashtable; - -import jalview.datamodel.AlignedCodonFrame; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefSource; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceI; -import jalview.ws.SequenceFetcher; -import jalview.ws.seqfetcher.ASequenceFetcher; - -/** - * Functions for cross-referencing sequence databases. user must first specify - * if cross-referencing from protein or dna (set dna==true) - * - * @author JimP - * - */ -public class CrossRef -{ - /** - * get the DNA or protein references for a protein or dna sequence - * - * @param dna - * @param rfs - * @return - */ - public static DBRefEntry[] findXDbRefs(boolean dna, DBRefEntry[] rfs) - { - if (dna) - { - rfs = jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS); - } - else - { - rfs = jalview.util.DBRefUtils.selectRefs(rfs, - DBRefSource.DNACODINGDBS); // could attempt to find other cross - // refs and return here - ie PDB xrefs - // (not dna, not protein seq) - } - return rfs; - } - - public static Hashtable classifyDbRefs(DBRefEntry[] rfs) - { - Hashtable classes = new Hashtable(); - classes.put(DBRefSource.PROTEINDBS, - jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS)); - classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils - .selectRefs(rfs, DBRefSource.DNACODINGDBS)); - classes.put(DBRefSource.DOMAINDBS, - jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS)); - // classes.put(OTHER, ) - return classes; - } - - /** - * @param dna - * true if seqs are DNA seqs - * @param seqs - * @return a list of sequence database cross reference source types - */ - public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs) - { - return findSequenceXrefTypes(dna, seqs, null); - } - - /** - * Indirect references are references from other sequences from the dataset to - * any of the direct DBRefEntrys on the given sequences. - * - * @param dna - * true if seqs are DNA seqs - * @param seqs - * @return a list of sequence database cross reference source types - */ - public static String[] findSequenceXrefTypes(boolean dna, - SequenceI[] seqs, AlignmentI dataset) - { - String[] dbrefs = null; - Vector refs = new Vector(); - for (int s = 0; s < seqs.length; s++) - { - if (seqs[s] != null) - { - - SequenceI dss = seqs[s]; - while (dss.getDatasetSequence() != null) - { - dss = dss.getDatasetSequence(); - } - DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef()); - for (int r = 0; rfs != null && r < rfs.length; r++) - { - if (!refs.contains(rfs[r].getSource())) - { - refs.addElement(rfs[r].getSource()); - } - } - if (dataset != null) - { - // search for references to this sequence's direct references. - DBRefEntry[] lrfs = CrossRef - .findXDbRefs(!dna, seqs[s].getDBRef()); - Vector rseqs = new Vector(); - CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs, - null); // don't need to specify codon frame for mapping here - Enumeration lr = rseqs.elements(); - while (lr.hasMoreElements()) - { - SequenceI rs = (SequenceI) lr.nextElement(); - DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef()); - for (int r = 0; rfs != null && r < rfs.length; r++) - { - if (!refs.contains(rfs[r].getSource())) - { - refs.addElement(rfs[r].getSource()); - } - } - } - } - } - } - if (refs.size() > 0) - { - dbrefs = new String[refs.size()]; - refs.copyInto(dbrefs); - } - return dbrefs; - } - - /* - * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross - * reference if (!refs.contains(rfs[r].getSource())) { - * refs.addElement(rfs[r].getSource()); } } } - */ - public static boolean hasCdnaMap(SequenceI[] seqs) - { - String[] reftypes = findSequenceXrefTypes(false, seqs); - for (int s = 0; s < reftypes.length; s++) - { - if (reftypes.equals(DBRefSource.EMBLCDS)) - { - return true; - // no map - } - } - return false; - } - - public static SequenceI[] getCdnaMap(SequenceI[] seqs) - { - Vector cseqs = new Vector(); - for (int s = 0; s < seqs.length; s++) - { - DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef()); - for (int c = 0; c < cdna.length; c++) - { - if (cdna[c].getSource().equals(DBRefSource.EMBLCDS)) - { - System.err - .println("TODO: unimplemented sequence retrieval for coding region sequence."); - // TODO: retrieve CDS dataset sequences - // need global dataset sequence retriever/resolver to reuse refs - // and construct Mapping entry. - // insert gaps in CDS according to peptide gaps. - // add gapped sequence to cseqs - } - } - } - if (cseqs.size() > 0) - { - SequenceI[] rsqs = new SequenceI[cseqs.size()]; - cseqs.copyInto(rsqs); - return rsqs; - } - return null; - - } - - /** - * - * @param dna - * @param seqs - * @return - */ - public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna, - String source) - { - return findXrefSequences(seqs, dna, source, null); - } - - /** - * - * @param seqs - * @param dna - * @param source - * @param dataset - * alignment to search for product sequences. - * @return products (as dataset sequences) - */ - public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna, - String source, AlignmentI dataset) - { - Vector rseqs = new Vector(); - Alignment ral = null; - AlignedCodonFrame cf = new AlignedCodonFrame(0); // nominal width - for (int s = 0; s < seqs.length; s++) - { - SequenceI dss = seqs[s]; - while (dss.getDatasetSequence() != null) - { - dss = dss.getDatasetSequence(); - } - boolean found = false; - DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef()); - if ((xrfs == null || xrfs.length == 0) && dataset != null) - { - System.out.println("Attempting to find ds Xrefs refs."); - DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef()); // less - // ambiguous - // would - // be a - // 'find - // primary - // dbRefEntry' - // method. - // filter for desired source xref here - found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset, - rseqs, cf); - } - for (int r = 0; xrfs != null && r < xrfs.length; r++) - { - if (source != null && !source.equals(xrfs[r].getSource())) - continue; - if (xrfs[r].hasMap()) - { - if (xrfs[r].getMap().getTo() != null) - { - Sequence rsq = new Sequence(xrfs[r].getMap().getTo()); - rseqs.addElement(rsq); - if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r] - .getMap().getMap().getToRatio()) - { - // get sense of map correct for adding to product alignment. - if (dna) - { - // map is from dna seq to a protein product - cf.addMap(dss, rsq, xrfs[r].getMap().getMap()); - } - else - { - // map should be from protein seq to its coding dna - cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse()); - } - } - found = true; - } - } - if (!found) - { - // do a bit more work - search for sequences with references matching - // xrefs on this sequence. - if (dataset != null) - { - found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna); - if (found) - xrfs[r] = null; // we've recovered seqs for this one. - } - } - } - if (!found) - { - if (xrfs != null && xrfs.length > 0) - { - // Try and get the sequence reference... - /* - * Ideal world - we ask for a sequence fetcher implementation here if - * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) ( - */ - ASequenceFetcher sftch = new SequenceFetcher(); - SequenceI[] retrieved = null; - int l = xrfs.length; - for (int r = 0; r < xrfs.length; r++) - { - // filter out any irrelevant or irretrievable references - if (xrfs[r] == null - || ((source != null && !source.equals(xrfs[r] - .getSource())) || !sftch.isFetchable(xrfs[r] - .getSource()))) - { - l--; - xrfs[r] = null; - } - } - if (l > 0) - { - System.out - .println("Attempting to retrieve cross referenced sequences."); - DBRefEntry[] t = new DBRefEntry[l]; - l = 0; - for (int r = 0; r < xrfs.length; r++) - { - if (xrfs[r] != null) - t[l++] = xrfs[r]; - } - xrfs = t; - try - { - retrieved = sftch.getSequences(xrfs); // problem here is we don't - // know which of xrfs - // resulted in which - // retrieved element - } catch (Exception e) - { - System.err - .println("Problem whilst retrieving cross references for Sequence : " - + seqs[s].getName()); - e.printStackTrace(); - } - if (retrieved != null) - { - for (int rs = 0; rs < retrieved.length; rs++) - { - // TODO: examine each sequence for 'redundancy' - jalview.datamodel.DBRefEntry[] dbr = retrieved[rs] - .getDBRef(); - if (dbr != null && dbr.length > 0) - { - for (int di = 0; di < dbr.length; di++) - { - // find any entry where we should put in the sequence being - // cross-referenced into the map - jalview.datamodel.Mapping map = dbr[di].getMap(); - if (map != null) - { - if (map.getTo() != null && map.getMap() != null) - { - // should search the local dataset to find any existing - // candidates for To ! - try - { - // compare ms with dss and replace with dss in mapping - // if map is congruent - SequenceI ms = map.getTo(); - int sf = map.getMap().getToLowest(); - int st = map.getMap().getToHighest(); - SequenceI mappedrg = ms.getSubSequence(sf, st); - SequenceI loc = dss.getSubSequence(sf, st); - if (mappedrg.getLength() > 0 - && mappedrg.getSequenceAsString().equals( - loc.getSequenceAsString())) - { - System.err - .println("Mapping updated for retrieved crossreference"); - // method to update all refs of existing To on - // retrieved sequence with dss and merge any props - // on To onto dss. - map.setTo(dss); - } - } catch (Exception e) - { - System.err - .println("Exception when consolidating Mapped sequence set..."); - e.printStackTrace(System.err); - } - } - } - } - } - retrieved[rs].updatePDBIds(); - rseqs.addElement(retrieved[rs]); - } - } - } - } - } - } - if (rseqs.size() > 0) - { - SequenceI[] rsqs = new SequenceI[rseqs.size()]; - rseqs.copyInto(rsqs); - ral = new Alignment(rsqs); - if (cf != null && cf.getProtMappings() != null) - { - ral.addCodonFrame(cf); - } - } - return ral; - } - - /** - * find references to lrfs in the cross-reference set of each sequence in - * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry - * based on source and accession string only - Map and Version are nulled. - * - * @param sequenceI - * @param lrfs - * @param dataset - * @param rseqs - * @return true if matches were found. - */ - private static boolean searchDatasetXrefs(SequenceI sequenceI, - boolean dna, DBRefEntry[] lrfs, AlignmentI dataset, Vector rseqs, - AlignedCodonFrame cf) - { - boolean found = false; - if (lrfs == null) - return false; - for (int i = 0; i < lrfs.length; i++) - { - DBRefEntry xref = new DBRefEntry(lrfs[i]); - // add in wildcards - xref.setVersion(null); - xref.setMap(null); - found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna); - } - return found; - } - - /** - * search a given sequence dataset for references matching cross-references to - * the given sequence - * - * @param sequenceI - * @param xrf - * @param dataset - * @param rseqs - * set of unique sequences - * @param cf - * @return true if one or more unique sequences were found and added - */ - public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf, - AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf) - { - return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false); - } - - /** - * TODO: generalise to different protein classifications Search dataset for - * DBRefEntrys matching the given one (xrf) and add the associated sequence to - * rseq. - * - * @param sequenceI - * @param xrf - * @param dataset - * @param rseqs - * @param direct - * - search all references or only subset - * @param dna - * search dna or protein xrefs (if direct=false) - * @return true if relationship found and sequence added. - */ - public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf, - AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf, - boolean direct, boolean dna) - { - boolean found = false; - SequenceI[] typer = new SequenceI[1]; - if (dataset == null) - return false; - if (dataset.getSequences() == null) - { - System.err.println("Empty dataset sequence set - NO VECTOR"); - return false; - } - List ds; - synchronized (ds = dataset.getSequences()) - { - for (SequenceI nxt : ds) - if (nxt != null) - { - if (nxt.getDatasetSequence() != null) - { - System.err - .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!"); - } - if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence()) - { - // check if this is the correct sequence type - { - typer[0] = nxt; - boolean isDna = jalview.util.Comparison.isNucleotide(typer); - if ((direct && isDna == dna) || (!direct && isDna != dna)) - { - // skip this sequence because it is same molecule type - continue; - } - } - - // look for direct or indirect references in common - DBRefEntry[] poss = nxt.getDBRef(), cands = null; - if (direct) - { - cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); - } - else - { - poss = CrossRef.findXDbRefs(dna, poss); // - cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); - } - if (cands != null) - { - if (!rseqs.contains(nxt)) - { - rseqs.addElement(nxt); - boolean foundmap = cf != null; // don't search if we aren't - // given - // a codon map object - for (int r = 0; foundmap && r < cands.length; r++) - { - if (cands[r].hasMap()) - { - if (cands[r].getMap().getTo() != null - && cands[r].getMap().getMap().getFromRatio() != cands[r] - .getMap().getMap().getToRatio()) - { - foundmap = true; - // get sense of map correct for adding to product - // alignment. - if (dna) - { - // map is from dna seq to a protein product - cf.addMap(sequenceI, nxt, cands[r].getMap() - .getMap()); - } - else - { - // map should be from protein seq to its coding dna - cf.addMap(nxt, sequenceI, cands[r].getMap() - .getMap().getInverse()); - } - } - } - } - // TODO: add mapping between sequences if necessary - found = true; - } - } - - } - } - } - return found; - } - - /** - * precalculate different products that can be found for seqs in dataset and - * return them. - * - * @param dna - * @param seqs - * @param dataset - * @param fake - * - don't actually build lists - just get types - * @return public static Object[] buildXProductsList(boolean dna, SequenceI[] - * seqs, AlignmentI dataset, boolean fake) { String types[] = - * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs, - * dataset); if (types != null) { System.out.println("Xref Types for: - * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) { - * System.out.println("Type: " + types[t]); SequenceI[] prod = - * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]); - * System.out.println("Found " + ((prod == null) ? "no" : "" + - * prod.length) + " products"); if (prod!=null) { for (int p=0; - * p. + */ +package jalview.analysis; + +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; +import java.util.Hashtable; + +import jalview.datamodel.AlignedCodonFrame; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefSource; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.ws.SequenceFetcher; +import jalview.ws.seqfetcher.ASequenceFetcher; + +/** + * Functions for cross-referencing sequence databases. user must first specify + * if cross-referencing from protein or dna (set dna==true) + * + * @author JimP + * + */ +public class CrossRef +{ + /** + * get the DNA or protein references for a protein or dna sequence + * + * @param dna + * @param rfs + * @return + */ + public static DBRefEntry[] findXDbRefs(boolean dna, DBRefEntry[] rfs) + { + if (dna) + { + rfs = jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS); + } + else + { + rfs = jalview.util.DBRefUtils.selectRefs(rfs, + DBRefSource.DNACODINGDBS); // could attempt to find other cross + // refs and return here - ie PDB xrefs + // (not dna, not protein seq) + } + return rfs; + } + + public static Hashtable classifyDbRefs(DBRefEntry[] rfs) + { + Hashtable classes = new Hashtable(); + classes.put(DBRefSource.PROTEINDBS, + jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.PROTEINDBS)); + classes.put(DBRefSource.DNACODINGDBS, jalview.util.DBRefUtils + .selectRefs(rfs, DBRefSource.DNACODINGDBS)); + classes.put(DBRefSource.DOMAINDBS, + jalview.util.DBRefUtils.selectRefs(rfs, DBRefSource.DOMAINDBS)); + // classes.put(OTHER, ) + return classes; + } + + /** + * @param dna + * true if seqs are DNA seqs + * @param seqs + * @return a list of sequence database cross reference source types + */ + public static String[] findSequenceXrefTypes(boolean dna, SequenceI[] seqs) + { + return findSequenceXrefTypes(dna, seqs, null); + } + + /** + * Indirect references are references from other sequences from the dataset to + * any of the direct DBRefEntrys on the given sequences. + * + * @param dna + * true if seqs are DNA seqs + * @param seqs + * @return a list of sequence database cross reference source types + */ + public static String[] findSequenceXrefTypes(boolean dna, + SequenceI[] seqs, AlignmentI dataset) + { + String[] dbrefs = null; + Vector refs = new Vector(); + for (int s = 0; s < seqs.length; s++) + { + if (seqs[s] != null) + { + + SequenceI dss = seqs[s]; + while (dss.getDatasetSequence() != null) + { + dss = dss.getDatasetSequence(); + } + DBRefEntry[] rfs = findXDbRefs(dna, dss.getDBRef()); + for (int r = 0; rfs != null && r < rfs.length; r++) + { + if (!refs.contains(rfs[r].getSource())) + { + refs.addElement(rfs[r].getSource()); + } + } + if (dataset != null) + { + // search for references to this sequence's direct references. + DBRefEntry[] lrfs = CrossRef + .findXDbRefs(!dna, seqs[s].getDBRef()); + Vector rseqs = new Vector(); + CrossRef.searchDatasetXrefs(seqs[s], !dna, lrfs, dataset, rseqs, + null); // don't need to specify codon frame for mapping here + Enumeration lr = rseqs.elements(); + while (lr.hasMoreElements()) + { + SequenceI rs = (SequenceI) lr.nextElement(); + DBRefEntry[] xrs = findXDbRefs(dna, rs.getDBRef()); + for (int r = 0; rfs != null && r < rfs.length; r++) + { + if (!refs.contains(rfs[r].getSource())) + { + refs.addElement(rfs[r].getSource()); + } + } + } + } + } + } + if (refs.size() > 0) + { + dbrefs = new String[refs.size()]; + refs.copyInto(dbrefs); + } + return dbrefs; + } + + /* + * if (dna) { if (rfs[r].hasMap()) { // most likely this is a protein cross + * reference if (!refs.contains(rfs[r].getSource())) { + * refs.addElement(rfs[r].getSource()); } } } + */ + public static boolean hasCdnaMap(SequenceI[] seqs) + { + String[] reftypes = findSequenceXrefTypes(false, seqs); + for (int s = 0; s < reftypes.length; s++) + { + if (reftypes.equals(DBRefSource.EMBLCDS)) + { + return true; + // no map + } + } + return false; + } + + public static SequenceI[] getCdnaMap(SequenceI[] seqs) + { + Vector cseqs = new Vector(); + for (int s = 0; s < seqs.length; s++) + { + DBRefEntry[] cdna = findXDbRefs(true, seqs[s].getDBRef()); + for (int c = 0; c < cdna.length; c++) + { + if (cdna[c].getSource().equals(DBRefSource.EMBLCDS)) + { + System.err + .println("TODO: unimplemented sequence retrieval for coding region sequence."); + // TODO: retrieve CDS dataset sequences + // need global dataset sequence retriever/resolver to reuse refs + // and construct Mapping entry. + // insert gaps in CDS according to peptide gaps. + // add gapped sequence to cseqs + } + } + } + if (cseqs.size() > 0) + { + SequenceI[] rsqs = new SequenceI[cseqs.size()]; + cseqs.copyInto(rsqs); + return rsqs; + } + return null; + + } + + /** + * + * @param dna + * @param seqs + * @return + */ + public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna, + String source) + { + return findXrefSequences(seqs, dna, source, null); + } + + /** + * + * @param seqs + * @param dna + * @param source + * @param dataset + * alignment to search for product sequences. + * @return products (as dataset sequences) + */ + public static Alignment findXrefSequences(SequenceI[] seqs, boolean dna, + String source, AlignmentI dataset) + { + Vector rseqs = new Vector(); + Alignment ral = null; + AlignedCodonFrame cf = new AlignedCodonFrame(0); // nominal width + for (int s = 0; s < seqs.length; s++) + { + SequenceI dss = seqs[s]; + while (dss.getDatasetSequence() != null) + { + dss = dss.getDatasetSequence(); + } + boolean found = false; + DBRefEntry[] xrfs = CrossRef.findXDbRefs(dna, dss.getDBRef()); + if ((xrfs == null || xrfs.length == 0) && dataset != null) + { + System.out.println("Attempting to find ds Xrefs refs."); + DBRefEntry[] lrfs = CrossRef.findXDbRefs(!dna, seqs[s].getDBRef()); // less + // ambiguous + // would + // be a + // 'find + // primary + // dbRefEntry' + // method. + // filter for desired source xref here + found = CrossRef.searchDatasetXrefs(dss, !dna, lrfs, dataset, + rseqs, cf); + } + for (int r = 0; xrfs != null && r < xrfs.length; r++) + { + if (source != null && !source.equals(xrfs[r].getSource())) + continue; + if (xrfs[r].hasMap()) + { + if (xrfs[r].getMap().getTo() != null) + { + Sequence rsq = new Sequence(xrfs[r].getMap().getTo()); + rseqs.addElement(rsq); + if (xrfs[r].getMap().getMap().getFromRatio() != xrfs[r] + .getMap().getMap().getToRatio()) + { + // get sense of map correct for adding to product alignment. + if (dna) + { + // map is from dna seq to a protein product + cf.addMap(dss, rsq, xrfs[r].getMap().getMap()); + } + else + { + // map should be from protein seq to its coding dna + cf.addMap(rsq, dss, xrfs[r].getMap().getMap().getInverse()); + } + } + found = true; + } + } + if (!found) + { + // do a bit more work - search for sequences with references matching + // xrefs on this sequence. + if (dataset != null) + { + found |= searchDataset(dss, xrfs[r], dataset, rseqs, cf); // ,false,!dna); + if (found) + xrfs[r] = null; // we've recovered seqs for this one. + } + } + } + if (!found) + { + if (xrfs != null && xrfs.length > 0) + { + // Try and get the sequence reference... + /* + * Ideal world - we ask for a sequence fetcher implementation here if + * (jalview.io.RunTimeEnvironment.getSequenceFetcher()) ( + */ + ASequenceFetcher sftch = new SequenceFetcher(); + SequenceI[] retrieved = null; + int l = xrfs.length; + for (int r = 0; r < xrfs.length; r++) + { + // filter out any irrelevant or irretrievable references + if (xrfs[r] == null + || ((source != null && !source.equals(xrfs[r] + .getSource())) || !sftch.isFetchable(xrfs[r] + .getSource()))) + { + l--; + xrfs[r] = null; + } + } + if (l > 0) + { + System.out + .println("Attempting to retrieve cross referenced sequences."); + DBRefEntry[] t = new DBRefEntry[l]; + l = 0; + for (int r = 0; r < xrfs.length; r++) + { + if (xrfs[r] != null) + t[l++] = xrfs[r]; + } + xrfs = t; + try + { + retrieved = sftch.getSequences(xrfs); // problem here is we don't + // know which of xrfs + // resulted in which + // retrieved element + } catch (Exception e) + { + System.err + .println("Problem whilst retrieving cross references for Sequence : " + + seqs[s].getName()); + e.printStackTrace(); + } + if (retrieved != null) + { + for (int rs = 0; rs < retrieved.length; rs++) + { + // TODO: examine each sequence for 'redundancy' + jalview.datamodel.DBRefEntry[] dbr = retrieved[rs] + .getDBRef(); + if (dbr != null && dbr.length > 0) + { + for (int di = 0; di < dbr.length; di++) + { + // find any entry where we should put in the sequence being + // cross-referenced into the map + jalview.datamodel.Mapping map = dbr[di].getMap(); + if (map != null) + { + if (map.getTo() != null && map.getMap() != null) + { + // should search the local dataset to find any existing + // candidates for To ! + try + { + // compare ms with dss and replace with dss in mapping + // if map is congruent + SequenceI ms = map.getTo(); + int sf = map.getMap().getToLowest(); + int st = map.getMap().getToHighest(); + SequenceI mappedrg = ms.getSubSequence(sf, st); + SequenceI loc = dss.getSubSequence(sf, st); + if (mappedrg.getLength() > 0 + && mappedrg.getSequenceAsString().equals( + loc.getSequenceAsString())) + { + System.err + .println("Mapping updated for retrieved crossreference"); + // method to update all refs of existing To on + // retrieved sequence with dss and merge any props + // on To onto dss. + map.setTo(dss); + } + } catch (Exception e) + { + System.err + .println("Exception when consolidating Mapped sequence set..."); + e.printStackTrace(System.err); + } + } + } + } + } + retrieved[rs].updatePDBIds(); + rseqs.addElement(retrieved[rs]); + } + } + } + } + } + } + if (rseqs.size() > 0) + { + SequenceI[] rsqs = new SequenceI[rseqs.size()]; + rseqs.copyInto(rsqs); + ral = new Alignment(rsqs); + if (cf != null && cf.getProtMappings() != null) + { + ral.addCodonFrame(cf); + } + } + return ral; + } + + /** + * find references to lrfs in the cross-reference set of each sequence in + * dataset (that is not equal to sequenceI) Identifies matching DBRefEntry + * based on source and accession string only - Map and Version are nulled. + * + * @param sequenceI + * @param lrfs + * @param dataset + * @param rseqs + * @return true if matches were found. + */ + private static boolean searchDatasetXrefs(SequenceI sequenceI, + boolean dna, DBRefEntry[] lrfs, AlignmentI dataset, Vector rseqs, + AlignedCodonFrame cf) + { + boolean found = false; + if (lrfs == null) + return false; + for (int i = 0; i < lrfs.length; i++) + { + DBRefEntry xref = new DBRefEntry(lrfs[i]); + // add in wildcards + xref.setVersion(null); + xref.setMap(null); + found = searchDataset(sequenceI, xref, dataset, rseqs, cf, false, dna); + } + return found; + } + + /** + * search a given sequence dataset for references matching cross-references to + * the given sequence + * + * @param sequenceI + * @param xrf + * @param dataset + * @param rseqs + * set of unique sequences + * @param cf + * @return true if one or more unique sequences were found and added + */ + public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf, + AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf) + { + return searchDataset(sequenceI, xrf, dataset, rseqs, cf, true, false); + } + + /** + * TODO: generalise to different protein classifications Search dataset for + * DBRefEntrys matching the given one (xrf) and add the associated sequence to + * rseq. + * + * @param sequenceI + * @param xrf + * @param dataset + * @param rseqs + * @param direct + * - search all references or only subset + * @param dna + * search dna or protein xrefs (if direct=false) + * @return true if relationship found and sequence added. + */ + public static boolean searchDataset(SequenceI sequenceI, DBRefEntry xrf, + AlignmentI dataset, Vector rseqs, AlignedCodonFrame cf, + boolean direct, boolean dna) + { + boolean found = false; + SequenceI[] typer = new SequenceI[1]; + if (dataset == null) + return false; + if (dataset.getSequences() == null) + { + System.err.println("Empty dataset sequence set - NO VECTOR"); + return false; + } + List ds; + synchronized (ds = dataset.getSequences()) + { + for (SequenceI nxt : ds) + if (nxt != null) + { + if (nxt.getDatasetSequence() != null) + { + System.err + .println("Implementation warning: getProducts passed a dataset alignment without dataset sequences in it!"); + } + if (nxt != sequenceI && nxt != sequenceI.getDatasetSequence()) + { + // check if this is the correct sequence type + { + typer[0] = nxt; + boolean isDna = jalview.util.Comparison.isNucleotide(typer); + if ((direct && isDna == dna) || (!direct && isDna != dna)) + { + // skip this sequence because it is same molecule type + continue; + } + } + + // look for direct or indirect references in common + DBRefEntry[] poss = nxt.getDBRef(), cands = null; + if (direct) + { + cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); + } + else + { + poss = CrossRef.findXDbRefs(dna, poss); // + cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); + } + if (cands != null) + { + if (!rseqs.contains(nxt)) + { + rseqs.addElement(nxt); + boolean foundmap = cf != null; // don't search if we aren't + // given + // a codon map object + for (int r = 0; foundmap && r < cands.length; r++) + { + if (cands[r].hasMap()) + { + if (cands[r].getMap().getTo() != null + && cands[r].getMap().getMap().getFromRatio() != cands[r] + .getMap().getMap().getToRatio()) + { + foundmap = true; + // get sense of map correct for adding to product + // alignment. + if (dna) + { + // map is from dna seq to a protein product + cf.addMap(sequenceI, nxt, cands[r].getMap() + .getMap()); + } + else + { + // map should be from protein seq to its coding dna + cf.addMap(nxt, sequenceI, cands[r].getMap() + .getMap().getInverse()); + } + } + } + } + // TODO: add mapping between sequences if necessary + found = true; + } + } + + } + } + } + return found; + } + + /** + * precalculate different products that can be found for seqs in dataset and + * return them. + * + * @param dna + * @param seqs + * @param dataset + * @param fake + * - don't actually build lists - just get types + * @return public static Object[] buildXProductsList(boolean dna, SequenceI[] + * seqs, AlignmentI dataset, boolean fake) { String types[] = + * jalview.analysis.CrossRef.findSequenceXrefTypes( dna, seqs, + * dataset); if (types != null) { System.out.println("Xref Types for: + * "+(dna ? "dna" : "prot")); for (int t = 0; t < types.length; t++) { + * System.out.println("Type: " + types[t]); SequenceI[] prod = + * jalview.analysis.CrossRef.findXrefSequences(seqs, dna, types[t]); + * System.out.println("Found " + ((prod == null) ? "no" : "" + + * prod.length) + " products"); if (prod!=null) { for (int p=0; + * p. - */ -package jalview.analysis; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import jalview.datamodel.AlignedCodonFrame; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.Annotation; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.FeatureProperties; -import jalview.datamodel.Mapping; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceI; -import jalview.schemes.ResidueProperties; -import jalview.util.MapList; -import jalview.util.ShiftList; - -public class Dna -{ - /** - * - * @param cdp1 - * @param cdp2 - * @return -1 if cdp1 aligns before cdp2, 0 if in the same column or cdp2 is - * null, +1 if after cdp2 - */ - private static int compare_codonpos(int[] cdp1, int[] cdp2) - { - if (cdp2 == null - || (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2])) - return 0; - if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2]) - return -1; // one base in cdp1 precedes the corresponding base in the - // other codon - return 1; // one base in cdp1 appears after the corresponding base in the - // other codon. - } - - /** - * DNA->mapped protein sequence alignment translation given set of sequences - * 1. id distinct coding regions within selected region for each sequence 2. - * generate peptides based on inframe (or given) translation or (optionally - * and where specified) out of frame translations (annotated appropriately) 3. - * align peptides based on codon alignment - */ - /** - * id potential products from dna 1. search for distinct products within - * selected region for each selected sequence 2. group by associated DB type. - * 3. return as form for input into above function - */ - /** - * - */ - /** - * create a new alignment of protein sequences by an inframe translation of - * the provided NA sequences - * - * @param selection - * @param seqstring - * @param viscontigs - * @param gapCharacter - * @param annotations - * @param aWidth - * @param dataset - * destination dataset for translated sequences and mappings - * @return - */ - public static AlignmentI CdnaTranslate(SequenceI[] selection, - String[] seqstring, int viscontigs[], char gapCharacter, - AlignmentAnnotation[] annotations, int aWidth, Alignment dataset) - { - return CdnaTranslate(selection, seqstring, null, viscontigs, - gapCharacter, annotations, aWidth, dataset); - } - - /** - * - * @param selection - * @param seqstring - * @param product - * - array of DbRefEntry objects from which exon map in seqstring is - * derived - * @param viscontigs - * @param gapCharacter - * @param annotations - * @param aWidth - * @param dataset - * @return - */ - public static AlignmentI CdnaTranslate(SequenceI[] selection, - String[] seqstring, DBRefEntry[] product, int viscontigs[], - char gapCharacter, AlignmentAnnotation[] annotations, int aWidth, - Alignment dataset) - { - AlignedCodonFrame codons = new AlignedCodonFrame(aWidth); // stores hash of - // subsequent - // positions for - // each codon - // start position - // in alignment - int s, sSize = selection.length; - Vector pepseqs = new Vector(); - for (s = 0; s < sSize; s++) - { - SequenceI newseq = translateCodingRegion(selection[s], seqstring[s], - viscontigs, codons, gapCharacter, - (product != null) ? product[s] : null); // possibly anonymous - // product - if (newseq != null) - { - pepseqs.addElement(newseq); - SequenceI ds = newseq; - while (ds.getDatasetSequence() != null) - { - ds = ds.getDatasetSequence(); - } - dataset.addSequence(ds); - } - } - if (codons.aaWidth == 0) - return null; - SequenceI[] newseqs = new SequenceI[pepseqs.size()]; - pepseqs.copyInto(newseqs); - AlignmentI al = new Alignment(newseqs); - al.padGaps(); // ensure we look aligned. - al.setDataset(dataset); - translateAlignedAnnotations(annotations, al, codons); - al.addCodonFrame(codons); - return al; - } - - /** - * fake the collection of DbRefs with associated exon mappings to identify if - * a translation would generate distinct product in the currently selected - * region. - * - * @param selection - * @param viscontigs - * @return - */ - public static boolean canTranslate(SequenceI[] selection, - int viscontigs[]) - { - for (int gd = 0; gd < selection.length; gd++) - { - SequenceI dna = selection[gd]; - jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils - .selectRefs(dna.getDBRef(), - jalview.datamodel.DBRefSource.DNACODINGDBS); - if (dnarefs != null) - { - // intersect with pep - // intersect with pep - Vector mappedrefs = new Vector(); - DBRefEntry[] refs = dna.getDBRef(); - for (int d = 0; d < refs.length; d++) - { - if (refs[d].getMap() != null && refs[d].getMap().getMap() != null - && refs[d].getMap().getMap().getFromRatio() == 3 - && refs[d].getMap().getMap().getToRatio() == 1) - { - mappedrefs.addElement(refs[d]); // add translated protein maps - } - } - dnarefs = new DBRefEntry[mappedrefs.size()]; - mappedrefs.copyInto(dnarefs); - for (int d = 0; d < dnarefs.length; d++) - { - Mapping mp = dnarefs[d].getMap(); - if (mp != null) - { - for (int vc = 0; vc < viscontigs.length; vc += 2) - { - int[] mpr = mp.locateMappedRange(viscontigs[vc], - viscontigs[vc + 1]); - if (mpr != null) - { - return true; - } - } - } - } - } - } - return false; - } - - /** - * generate a set of translated protein products from annotated sequenceI - * - * @param selection - * @param viscontigs - * @param gapCharacter - * @param dataset - * destination dataset for translated sequences - * @param annotations - * @param aWidth - * @return - */ - public static AlignmentI CdnaTranslate(SequenceI[] selection, - int viscontigs[], char gapCharacter, Alignment dataset) - { - int alwidth = 0; - Vector cdnasqs = new Vector(); - Vector cdnasqi = new Vector(); - Vector cdnaprod = new Vector(); - for (int gd = 0; gd < selection.length; gd++) - { - SequenceI dna = selection[gd]; - jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils - .selectRefs(dna.getDBRef(), - jalview.datamodel.DBRefSource.DNACODINGDBS); - if (dnarefs != null) - { - // intersect with pep - Vector mappedrefs = new Vector(); - DBRefEntry[] refs = dna.getDBRef(); - for (int d = 0; d < refs.length; d++) - { - if (refs[d].getMap() != null && refs[d].getMap().getMap() != null - && refs[d].getMap().getMap().getFromRatio() == 3 - && refs[d].getMap().getMap().getToRatio() == 1) - { - mappedrefs.addElement(refs[d]); // add translated protein maps - } - } - dnarefs = new DBRefEntry[mappedrefs.size()]; - mappedrefs.copyInto(dnarefs); - for (int d = 0; d < dnarefs.length; d++) - { - Mapping mp = dnarefs[d].getMap(); - StringBuffer sqstr = new StringBuffer(); - if (mp != null) - { - Mapping intersect = mp.intersectVisContigs(viscontigs); - // generate seqstring for this sequence based on mapping - - if (sqstr.length() > alwidth) - alwidth = sqstr.length(); - cdnasqs.addElement(sqstr.toString()); - cdnasqi.addElement(dna); - cdnaprod.addElement(intersect); - } - } - } - SequenceI[] cdna = new SequenceI[cdnasqs.size()]; - DBRefEntry[] prods = new DBRefEntry[cdnaprod.size()]; - String[] xons = new String[cdnasqs.size()]; - cdnasqs.copyInto(xons); - cdnaprod.copyInto(prods); - cdnasqi.copyInto(cdna); - return CdnaTranslate(cdna, xons, prods, viscontigs, gapCharacter, - null, alwidth, dataset); - } - return null; - } - - /** - * translate na alignment annotations onto translated amino acid alignment al - * using codon mapping codons - * - * @param annotations - * @param al - * @param codons - */ - public static void translateAlignedAnnotations( - AlignmentAnnotation[] annotations, AlignmentI al, - AlignedCodonFrame codons) - { - // ////////////////////////////// - // Copy annotations across - // - // Can only do this for columns with consecutive codons, or where - // annotation is sequence associated. - - int pos, a, aSize; - if (annotations != null) - { - for (int i = 0; i < annotations.length; i++) - { - // Skip any autogenerated annotation - if (annotations[i].autoCalculated) - { - continue; - } - - aSize = codons.getaaWidth(); // aa alignment width. - jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null - : new jalview.datamodel.Annotation[aSize]; - if (anots != null) - { - for (a = 0; a < aSize; a++) - { - // process through codon map. - if (codons.codons[a] != null - && codons.codons[a][0] == (codons.codons[a][2] - 2)) - { - anots[a] = getCodonAnnotation(codons.codons[a], - annotations[i].annotations); - } - } - } - - jalview.datamodel.AlignmentAnnotation aa = new jalview.datamodel.AlignmentAnnotation( - annotations[i].label, annotations[i].description, anots); - aa.graph = annotations[i].graph; - aa.graphGroup = annotations[i].graphGroup; - aa.graphHeight = annotations[i].graphHeight; - if (annotations[i].getThreshold() != null) - { - aa.setThreshold(new jalview.datamodel.GraphLine(annotations[i] - .getThreshold())); - } - if (annotations[i].hasScore) - { - aa.setScore(annotations[i].getScore()); - } - if (annotations[i].sequenceRef != null) - { - SequenceI aaSeq = codons - .getAaForDnaSeq(annotations[i].sequenceRef); - if (aaSeq != null) - { - // aa.compactAnnotationArray(); // throw away alignment annotation - // positioning - aa.setSequenceRef(aaSeq); - aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true); // rebuild - // mapping - aa.adjustForAlignment(); - aaSeq.addAlignmentAnnotation(aa); - } - - } - al.addAnnotation(aa); - } - } - } - - private static Annotation getCodonAnnotation(int[] is, - Annotation[] annotations) - { - // Have a look at all the codon positions for annotation and put the first - // one found into the translated annotation pos. - int contrib = 0; - Annotation annot = null; - for (int p = 0; p < 3; p++) - { - if (annotations[is[p]] != null) - { - if (annot == null) - { - annot = new Annotation(annotations[is[p]]); - contrib = 1; - } - else - { - // merge with last - Annotation cpy = new Annotation(annotations[is[p]]); - if (annot.colour == null) - { - annot.colour = cpy.colour; - } - if (annot.description == null || annot.description.length() == 0) - { - annot.description = cpy.description; - } - if (annot.displayCharacter == null) - { - annot.displayCharacter = cpy.displayCharacter; - } - if (annot.secondaryStructure == 0) - { - annot.secondaryStructure = cpy.secondaryStructure; - } - annot.value += cpy.value; - contrib++; - } - } - } - if (contrib > 1) - { - annot.value /= (float) contrib; - } - return annot; - } - - /** - * Translate a na sequence - * - * @param selection - * sequence displayed under viscontigs visible columns - * @param seqstring - * ORF read in some global alignment reference frame - * @param viscontigs - * mapping from global reference frame to visible seqstring ORF read - * @param codons - * Definition of global ORF alignment reference frame - * @param gapCharacter - * @param newSeq - * @return sequence ready to be added to alignment. - */ - public static SequenceI translateCodingRegion(SequenceI selection, - String seqstring, int[] viscontigs, AlignedCodonFrame codons, - char gapCharacter, DBRefEntry product) - { - Vector skip = new Vector(); - int skipint[] = null; - ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring - // intervals - int vc, scontigs[] = new int[viscontigs.length]; - int npos = 0; - for (vc = 0; vc < viscontigs.length; vc += 2) - { - if (vc == 0) - { - vismapping.addShift(npos, viscontigs[vc]); - } - else - { - // hidden region - vismapping.addShift(npos, viscontigs[vc] - viscontigs[vc - 1] + 1); - } - scontigs[vc] = viscontigs[vc]; - scontigs[vc + 1] = viscontigs[vc + 1]; - } - - StringBuffer protein = new StringBuffer(); - String seq = seqstring.replace('U', 'T'); - char codon[] = new char[3]; - int cdp[] = new int[3], rf = 0, lastnpos = 0, nend; - int aspos = 0; - int resSize = 0; - for (npos = 0, nend = seq.length(); npos < nend; npos++) - { - if (!jalview.util.Comparison.isGap(seq.charAt(npos))) - { - cdp[rf] = npos; // store position - codon[rf++] = seq.charAt(npos); // store base - } - // filled an RF yet ? - if (rf == 3) - { - String aa = ResidueProperties.codonTranslate(new String(codon)); - rf = 0; - if (aa == null) - { - aa = String.valueOf(gapCharacter); - if (skipint == null) - { - skipint = new int[] - { cdp[0], cdp[2] }; - } - skipint[1] = cdp[2]; - } - else - { - if (skipint != null) - { - // edit scontigs - skipint[0] = vismapping.shift(skipint[0]); - skipint[1] = vismapping.shift(skipint[1]); - for (vc = 0; vc < scontigs.length; vc += 2) - { - if (scontigs[vc + 1] < skipint[0]) - { - continue; - } - if (scontigs[vc] <= skipint[0]) - { - if (skipint[0] == scontigs[vc]) - { - - } - else - { - int[] t = new int[scontigs.length + 2]; - System.arraycopy(scontigs, 0, t, 0, vc - 1); - // scontigs[vc]; // - } - } - } - skip.addElement(skipint); - skipint = null; - } - if (aa.equals("STOP")) - { - aa = "X"; - } - resSize++; - } - // insert/delete gaps prior to this codon - if necessary - boolean findpos = true; - while (findpos) - { - // first ensure that the codons array is long enough. - codons.checkCodonFrameWidth(aspos); - // now check to see if we place the aa at the current aspos in the - // protein alignment - switch (Dna.compare_codonpos(cdp, codons.codons[aspos])) - { - case -1: - codons.insertAAGap(aspos, gapCharacter); - findpos = false; - break; - case +1: - // this aa appears after the aligned codons at aspos, so prefix it - // with a gap - aa = "" + gapCharacter + aa; - aspos++; - // if (aspos >= codons.aaWidth) - // codons.aaWidth = aspos + 1; - break; // check the next position for alignment - case 0: - // codon aligns at aspos position. - findpos = false; - } - } - // codon aligns with all other sequence residues found at aspos - protein.append(aa); - lastnpos = npos; - if (codons.codons[aspos] == null) - { - // mark this column as aligning to this aligned reading frame - codons.codons[aspos] = new int[] - { cdp[0], cdp[1], cdp[2] }; - } - if (aspos >= codons.aaWidth) - { - // update maximum alignment width - // (we can do this without calling checkCodonFrameWidth because it was - // already done above) - codons.setAaWidth(aspos); - } - // ready for next translated reading frame alignment position (if any) - aspos++; - } - } - if (resSize > 0) - { - SequenceI newseq = new Sequence(selection.getName(), - protein.toString()); - if (rf != 0) - { - jalview.bin.Cache.log - .debug("trimming contigs for incomplete terminal codon."); - // map and trim contigs to ORF region - vc = scontigs.length - 1; - lastnpos = vismapping.shift(lastnpos); // place npos in context of - // whole dna alignment (rather - // than visible contigs) - // incomplete ORF could be broken over one or two visible contig - // intervals. - while (vc >= 0 && scontigs[vc] > lastnpos) - { - if (vc > 0 && scontigs[vc - 1] > lastnpos) - { - vc -= 2; - } - else - { - // correct last interval in list. - scontigs[vc] = lastnpos; - } - } - - if (vc > 0 && (vc + 1) < scontigs.length) - { - // truncate map list to just vc elements - int t[] = new int[vc + 1]; - System.arraycopy(scontigs, 0, t, 0, vc + 1); - scontigs = t; - } - if (vc <= 0) - scontigs = null; - } - if (scontigs != null) - { - npos = 0; - // map scontigs to actual sequence positions on selection - for (vc = 0; vc < scontigs.length; vc += 2) - { - scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1! - scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive - if (scontigs[vc + 1] == selection.getEnd()) - break; - } - // trim trailing empty intervals. - if ((vc + 2) < scontigs.length) - { - int t[] = new int[vc + 2]; - System.arraycopy(scontigs, 0, t, 0, vc + 2); - scontigs = t; - } - /* - * delete intervals in scontigs which are not translated. 1. map skip - * into sequence position intervals 2. truncate existing ranges and add - * new ranges to exclude untranslated regions. if (skip.size()>0) { - * Vector narange = new Vector(); for (vc=0; vc=skipint[0] && - * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of - * range } else { // truncate range and create new one if necessary iv = - * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate - * range iv[0] = skipint[1]; } else { } } } else if (iv[0]. + */ +package jalview.analysis; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import jalview.datamodel.AlignedCodonFrame; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.FeatureProperties; +import jalview.datamodel.Mapping; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.schemes.ResidueProperties; +import jalview.util.MapList; +import jalview.util.ShiftList; + +public class Dna +{ + /** + * + * @param cdp1 + * @param cdp2 + * @return -1 if cdp1 aligns before cdp2, 0 if in the same column or cdp2 is + * null, +1 if after cdp2 + */ + private static int compare_codonpos(int[] cdp1, int[] cdp2) + { + if (cdp2 == null + || (cdp1[0] == cdp2[0] && cdp1[1] == cdp2[1] && cdp1[2] == cdp2[2])) + return 0; + if (cdp1[0] < cdp2[0] || cdp1[1] < cdp2[1] || cdp1[2] < cdp2[2]) + return -1; // one base in cdp1 precedes the corresponding base in the + // other codon + return 1; // one base in cdp1 appears after the corresponding base in the + // other codon. + } + + /** + * DNA->mapped protein sequence alignment translation given set of sequences + * 1. id distinct coding regions within selected region for each sequence 2. + * generate peptides based on inframe (or given) translation or (optionally + * and where specified) out of frame translations (annotated appropriately) 3. + * align peptides based on codon alignment + */ + /** + * id potential products from dna 1. search for distinct products within + * selected region for each selected sequence 2. group by associated DB type. + * 3. return as form for input into above function + */ + /** + * + */ + /** + * create a new alignment of protein sequences by an inframe translation of + * the provided NA sequences + * + * @param selection + * @param seqstring + * @param viscontigs + * @param gapCharacter + * @param annotations + * @param aWidth + * @param dataset + * destination dataset for translated sequences and mappings + * @return + */ + public static AlignmentI CdnaTranslate(SequenceI[] selection, + String[] seqstring, int viscontigs[], char gapCharacter, + AlignmentAnnotation[] annotations, int aWidth, Alignment dataset) + { + return CdnaTranslate(selection, seqstring, null, viscontigs, + gapCharacter, annotations, aWidth, dataset); + } + + /** + * + * @param selection + * @param seqstring + * @param product + * - array of DbRefEntry objects from which exon map in seqstring is + * derived + * @param viscontigs + * @param gapCharacter + * @param annotations + * @param aWidth + * @param dataset + * @return + */ + public static AlignmentI CdnaTranslate(SequenceI[] selection, + String[] seqstring, DBRefEntry[] product, int viscontigs[], + char gapCharacter, AlignmentAnnotation[] annotations, int aWidth, + Alignment dataset) + { + AlignedCodonFrame codons = new AlignedCodonFrame(aWidth); // stores hash of + // subsequent + // positions for + // each codon + // start position + // in alignment + int s, sSize = selection.length; + Vector pepseqs = new Vector(); + for (s = 0; s < sSize; s++) + { + SequenceI newseq = translateCodingRegion(selection[s], seqstring[s], + viscontigs, codons, gapCharacter, + (product != null) ? product[s] : null); // possibly anonymous + // product + if (newseq != null) + { + pepseqs.addElement(newseq); + SequenceI ds = newseq; + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); + } + dataset.addSequence(ds); + } + } + if (codons.aaWidth == 0) + return null; + SequenceI[] newseqs = new SequenceI[pepseqs.size()]; + pepseqs.copyInto(newseqs); + AlignmentI al = new Alignment(newseqs); + al.padGaps(); // ensure we look aligned. + al.setDataset(dataset); + translateAlignedAnnotations(annotations, al, codons); + al.addCodonFrame(codons); + return al; + } + + /** + * fake the collection of DbRefs with associated exon mappings to identify if + * a translation would generate distinct product in the currently selected + * region. + * + * @param selection + * @param viscontigs + * @return + */ + public static boolean canTranslate(SequenceI[] selection, + int viscontigs[]) + { + for (int gd = 0; gd < selection.length; gd++) + { + SequenceI dna = selection[gd]; + jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils + .selectRefs(dna.getDBRef(), + jalview.datamodel.DBRefSource.DNACODINGDBS); + if (dnarefs != null) + { + // intersect with pep + // intersect with pep + Vector mappedrefs = new Vector(); + DBRefEntry[] refs = dna.getDBRef(); + for (int d = 0; d < refs.length; d++) + { + if (refs[d].getMap() != null && refs[d].getMap().getMap() != null + && refs[d].getMap().getMap().getFromRatio() == 3 + && refs[d].getMap().getMap().getToRatio() == 1) + { + mappedrefs.addElement(refs[d]); // add translated protein maps + } + } + dnarefs = new DBRefEntry[mappedrefs.size()]; + mappedrefs.copyInto(dnarefs); + for (int d = 0; d < dnarefs.length; d++) + { + Mapping mp = dnarefs[d].getMap(); + if (mp != null) + { + for (int vc = 0; vc < viscontigs.length; vc += 2) + { + int[] mpr = mp.locateMappedRange(viscontigs[vc], + viscontigs[vc + 1]); + if (mpr != null) + { + return true; + } + } + } + } + } + } + return false; + } + + /** + * generate a set of translated protein products from annotated sequenceI + * + * @param selection + * @param viscontigs + * @param gapCharacter + * @param dataset + * destination dataset for translated sequences + * @param annotations + * @param aWidth + * @return + */ + public static AlignmentI CdnaTranslate(SequenceI[] selection, + int viscontigs[], char gapCharacter, Alignment dataset) + { + int alwidth = 0; + Vector cdnasqs = new Vector(); + Vector cdnasqi = new Vector(); + Vector cdnaprod = new Vector(); + for (int gd = 0; gd < selection.length; gd++) + { + SequenceI dna = selection[gd]; + jalview.datamodel.DBRefEntry[] dnarefs = jalview.util.DBRefUtils + .selectRefs(dna.getDBRef(), + jalview.datamodel.DBRefSource.DNACODINGDBS); + if (dnarefs != null) + { + // intersect with pep + Vector mappedrefs = new Vector(); + DBRefEntry[] refs = dna.getDBRef(); + for (int d = 0; d < refs.length; d++) + { + if (refs[d].getMap() != null && refs[d].getMap().getMap() != null + && refs[d].getMap().getMap().getFromRatio() == 3 + && refs[d].getMap().getMap().getToRatio() == 1) + { + mappedrefs.addElement(refs[d]); // add translated protein maps + } + } + dnarefs = new DBRefEntry[mappedrefs.size()]; + mappedrefs.copyInto(dnarefs); + for (int d = 0; d < dnarefs.length; d++) + { + Mapping mp = dnarefs[d].getMap(); + StringBuffer sqstr = new StringBuffer(); + if (mp != null) + { + Mapping intersect = mp.intersectVisContigs(viscontigs); + // generate seqstring for this sequence based on mapping + + if (sqstr.length() > alwidth) + alwidth = sqstr.length(); + cdnasqs.addElement(sqstr.toString()); + cdnasqi.addElement(dna); + cdnaprod.addElement(intersect); + } + } + } + SequenceI[] cdna = new SequenceI[cdnasqs.size()]; + DBRefEntry[] prods = new DBRefEntry[cdnaprod.size()]; + String[] xons = new String[cdnasqs.size()]; + cdnasqs.copyInto(xons); + cdnaprod.copyInto(prods); + cdnasqi.copyInto(cdna); + return CdnaTranslate(cdna, xons, prods, viscontigs, gapCharacter, + null, alwidth, dataset); + } + return null; + } + + /** + * translate na alignment annotations onto translated amino acid alignment al + * using codon mapping codons + * + * @param annotations + * @param al + * @param codons + */ + public static void translateAlignedAnnotations( + AlignmentAnnotation[] annotations, AlignmentI al, + AlignedCodonFrame codons) + { + // ////////////////////////////// + // Copy annotations across + // + // Can only do this for columns with consecutive codons, or where + // annotation is sequence associated. + + int pos, a, aSize; + if (annotations != null) + { + for (int i = 0; i < annotations.length; i++) + { + // Skip any autogenerated annotation + if (annotations[i].autoCalculated) + { + continue; + } + + aSize = codons.getaaWidth(); // aa alignment width. + jalview.datamodel.Annotation[] anots = (annotations[i].annotations == null) ? null + : new jalview.datamodel.Annotation[aSize]; + if (anots != null) + { + for (a = 0; a < aSize; a++) + { + // process through codon map. + if (codons.codons[a] != null + && codons.codons[a][0] == (codons.codons[a][2] - 2)) + { + anots[a] = getCodonAnnotation(codons.codons[a], + annotations[i].annotations); + } + } + } + + jalview.datamodel.AlignmentAnnotation aa = new jalview.datamodel.AlignmentAnnotation( + annotations[i].label, annotations[i].description, anots); + aa.graph = annotations[i].graph; + aa.graphGroup = annotations[i].graphGroup; + aa.graphHeight = annotations[i].graphHeight; + if (annotations[i].getThreshold() != null) + { + aa.setThreshold(new jalview.datamodel.GraphLine(annotations[i] + .getThreshold())); + } + if (annotations[i].hasScore) + { + aa.setScore(annotations[i].getScore()); + } + if (annotations[i].sequenceRef != null) + { + SequenceI aaSeq = codons + .getAaForDnaSeq(annotations[i].sequenceRef); + if (aaSeq != null) + { + // aa.compactAnnotationArray(); // throw away alignment annotation + // positioning + aa.setSequenceRef(aaSeq); + aa.createSequenceMapping(aaSeq, aaSeq.getStart(), true); // rebuild + // mapping + aa.adjustForAlignment(); + aaSeq.addAlignmentAnnotation(aa); + } + + } + al.addAnnotation(aa); + } + } + } + + private static Annotation getCodonAnnotation(int[] is, + Annotation[] annotations) + { + // Have a look at all the codon positions for annotation and put the first + // one found into the translated annotation pos. + int contrib = 0; + Annotation annot = null; + for (int p = 0; p < 3; p++) + { + if (annotations[is[p]] != null) + { + if (annot == null) + { + annot = new Annotation(annotations[is[p]]); + contrib = 1; + } + else + { + // merge with last + Annotation cpy = new Annotation(annotations[is[p]]); + if (annot.colour == null) + { + annot.colour = cpy.colour; + } + if (annot.description == null || annot.description.length() == 0) + { + annot.description = cpy.description; + } + if (annot.displayCharacter == null) + { + annot.displayCharacter = cpy.displayCharacter; + } + if (annot.secondaryStructure == 0) + { + annot.secondaryStructure = cpy.secondaryStructure; + } + annot.value += cpy.value; + contrib++; + } + } + } + if (contrib > 1) + { + annot.value /= (float) contrib; + } + return annot; + } + + /** + * Translate a na sequence + * + * @param selection + * sequence displayed under viscontigs visible columns + * @param seqstring + * ORF read in some global alignment reference frame + * @param viscontigs + * mapping from global reference frame to visible seqstring ORF read + * @param codons + * Definition of global ORF alignment reference frame + * @param gapCharacter + * @param newSeq + * @return sequence ready to be added to alignment. + */ + public static SequenceI translateCodingRegion(SequenceI selection, + String seqstring, int[] viscontigs, AlignedCodonFrame codons, + char gapCharacter, DBRefEntry product) + { + Vector skip = new Vector(); + int skipint[] = null; + ShiftList vismapping = new ShiftList(); // map from viscontigs to seqstring + // intervals + int vc, scontigs[] = new int[viscontigs.length]; + int npos = 0; + for (vc = 0; vc < viscontigs.length; vc += 2) + { + if (vc == 0) + { + vismapping.addShift(npos, viscontigs[vc]); + } + else + { + // hidden region + vismapping.addShift(npos, viscontigs[vc] - viscontigs[vc - 1] + 1); + } + scontigs[vc] = viscontigs[vc]; + scontigs[vc + 1] = viscontigs[vc + 1]; + } + + StringBuffer protein = new StringBuffer(); + String seq = seqstring.replace('U', 'T'); + char codon[] = new char[3]; + int cdp[] = new int[3], rf = 0, lastnpos = 0, nend; + int aspos = 0; + int resSize = 0; + for (npos = 0, nend = seq.length(); npos < nend; npos++) + { + if (!jalview.util.Comparison.isGap(seq.charAt(npos))) + { + cdp[rf] = npos; // store position + codon[rf++] = seq.charAt(npos); // store base + } + // filled an RF yet ? + if (rf == 3) + { + String aa = ResidueProperties.codonTranslate(new String(codon)); + rf = 0; + if (aa == null) + { + aa = String.valueOf(gapCharacter); + if (skipint == null) + { + skipint = new int[] + { cdp[0], cdp[2] }; + } + skipint[1] = cdp[2]; + } + else + { + if (skipint != null) + { + // edit scontigs + skipint[0] = vismapping.shift(skipint[0]); + skipint[1] = vismapping.shift(skipint[1]); + for (vc = 0; vc < scontigs.length; vc += 2) + { + if (scontigs[vc + 1] < skipint[0]) + { + continue; + } + if (scontigs[vc] <= skipint[0]) + { + if (skipint[0] == scontigs[vc]) + { + + } + else + { + int[] t = new int[scontigs.length + 2]; + System.arraycopy(scontigs, 0, t, 0, vc - 1); + // scontigs[vc]; // + } + } + } + skip.addElement(skipint); + skipint = null; + } + if (aa.equals("STOP")) + { + aa = "X"; + } + resSize++; + } + // insert/delete gaps prior to this codon - if necessary + boolean findpos = true; + while (findpos) + { + // first ensure that the codons array is long enough. + codons.checkCodonFrameWidth(aspos); + // now check to see if we place the aa at the current aspos in the + // protein alignment + switch (Dna.compare_codonpos(cdp, codons.codons[aspos])) + { + case -1: + codons.insertAAGap(aspos, gapCharacter); + findpos = false; + break; + case +1: + // this aa appears after the aligned codons at aspos, so prefix it + // with a gap + aa = "" + gapCharacter + aa; + aspos++; + // if (aspos >= codons.aaWidth) + // codons.aaWidth = aspos + 1; + break; // check the next position for alignment + case 0: + // codon aligns at aspos position. + findpos = false; + } + } + // codon aligns with all other sequence residues found at aspos + protein.append(aa); + lastnpos = npos; + if (codons.codons[aspos] == null) + { + // mark this column as aligning to this aligned reading frame + codons.codons[aspos] = new int[] + { cdp[0], cdp[1], cdp[2] }; + } + if (aspos >= codons.aaWidth) + { + // update maximum alignment width + // (we can do this without calling checkCodonFrameWidth because it was + // already done above) + codons.setAaWidth(aspos); + } + // ready for next translated reading frame alignment position (if any) + aspos++; + } + } + if (resSize > 0) + { + SequenceI newseq = new Sequence(selection.getName(), + protein.toString()); + if (rf != 0) + { + jalview.bin.Cache.log + .debug("trimming contigs for incomplete terminal codon."); + // map and trim contigs to ORF region + vc = scontigs.length - 1; + lastnpos = vismapping.shift(lastnpos); // place npos in context of + // whole dna alignment (rather + // than visible contigs) + // incomplete ORF could be broken over one or two visible contig + // intervals. + while (vc >= 0 && scontigs[vc] > lastnpos) + { + if (vc > 0 && scontigs[vc - 1] > lastnpos) + { + vc -= 2; + } + else + { + // correct last interval in list. + scontigs[vc] = lastnpos; + } + } + + if (vc > 0 && (vc + 1) < scontigs.length) + { + // truncate map list to just vc elements + int t[] = new int[vc + 1]; + System.arraycopy(scontigs, 0, t, 0, vc + 1); + scontigs = t; + } + if (vc <= 0) + scontigs = null; + } + if (scontigs != null) + { + npos = 0; + // map scontigs to actual sequence positions on selection + for (vc = 0; vc < scontigs.length; vc += 2) + { + scontigs[vc] = selection.findPosition(scontigs[vc]); // not from 1! + scontigs[vc + 1] = selection.findPosition(scontigs[vc + 1]); // exclusive + if (scontigs[vc + 1] == selection.getEnd()) + break; + } + // trim trailing empty intervals. + if ((vc + 2) < scontigs.length) + { + int t[] = new int[vc + 2]; + System.arraycopy(scontigs, 0, t, 0, vc + 2); + scontigs = t; + } + /* + * delete intervals in scontigs which are not translated. 1. map skip + * into sequence position intervals 2. truncate existing ranges and add + * new ranges to exclude untranslated regions. if (skip.size()>0) { + * Vector narange = new Vector(); for (vc=0; vc=skipint[0] && + * iv[0]<=skipint[1]) { if (iv[0]==skipint[0]) { // delete beginning of + * range } else { // truncate range and create new one if necessary iv = + * (int[]) narange.elementAt(vc+1); if (iv[0]<=skipint[1]) { // truncate + * range iv[0] = skipint[1]; } else { } } } else if (iv[0]. */ - /* Author: Lauren Michelle Lui * Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/ * */ diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 21dea57..8b84a86 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index eb912c8..d2bdaa2 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 33a08e6..08bb3fd 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -1,21 +1,22 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ + package jalview.analysis; import java.util.*; diff --git a/src/jalview/analysis/WUSSParseException.java b/src/jalview/analysis/WUSSParseException.java index 7d2a33d..226ae43 100644 --- a/src/jalview/analysis/WUSSParseException.java +++ b/src/jalview/analysis/WUSSParseException.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.analysis; public class WUSSParseException extends Exception @@ -20,4 +37,4 @@ public class WUSSParseException extends Exception return problemPos; } -} \ No newline at end of file +} diff --git a/src/jalview/api/AlignCalcManagerI.java b/src/jalview/api/AlignCalcManagerI.java index 815cc20..64a314e 100644 --- a/src/jalview/api/AlignCalcManagerI.java +++ b/src/jalview/api/AlignCalcManagerI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.api; import jalview.datamodel.AlignmentAnnotation; diff --git a/src/jalview/api/AlignCalcWorkerI.java b/src/jalview/api/AlignCalcWorkerI.java index 7c14786..74724ed 100644 --- a/src/jalview/api/AlignCalcWorkerI.java +++ b/src/jalview/api/AlignCalcWorkerI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.api; import jalview.datamodel.AlignmentAnnotation; diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index 244cc74..f3b0274 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -1,5 +1,19 @@ -/** +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.api; diff --git a/src/jalview/api/AlignmentViewPanel.java b/src/jalview/api/AlignmentViewPanel.java index 010fb3d..eb4b994 100644 --- a/src/jalview/api/AlignmentViewPanel.java +++ b/src/jalview/api/AlignmentViewPanel.java @@ -1,21 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ - + */ package jalview.api; import jalview.datamodel.AlignmentI; diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index 5e237ff..2de27de 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/api/OOMHandlerI.java b/src/jalview/api/OOMHandlerI.java index c14b4f7..cc578bf 100644 --- a/src/jalview/api/OOMHandlerI.java +++ b/src/jalview/api/OOMHandlerI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.api; public interface OOMHandlerI diff --git a/src/jalview/api/RotatableCanvasI.java b/src/jalview/api/RotatableCanvasI.java index 72a51d3..735d3d0 100644 --- a/src/jalview/api/RotatableCanvasI.java +++ b/src/jalview/api/RotatableCanvasI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.api; import jalview.datamodel.SequencePoint; diff --git a/src/jalview/api/SequenceRenderer.java b/src/jalview/api/SequenceRenderer.java index dcc50d5..11ccf1a 100644 --- a/src/jalview/api/SequenceRenderer.java +++ b/src/jalview/api/SequenceRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/api/SequenceStructureBinding.java b/src/jalview/api/SequenceStructureBinding.java index 89cebe5..e8908f8 100644 --- a/src/jalview/api/SequenceStructureBinding.java +++ b/src/jalview/api/SequenceStructureBinding.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/api/StructureSelectionManagerProvider.java b/src/jalview/api/StructureSelectionManagerProvider.java index c7ff628..9c61f1a 100644 --- a/src/jalview/api/StructureSelectionManagerProvider.java +++ b/src/jalview/api/StructureSelectionManagerProvider.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.api; diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 0fcb1c0..c71818e 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 700c229..5d4617e 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -1,3756 +1,3756 @@ -/* - * 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 . - */ -package jalview.appletgui; - -import jalview.analysis.AAFrequency; -import jalview.analysis.AlignmentSorter; -import jalview.analysis.Conservation; -import jalview.api.SequenceStructureBinding; -import jalview.bin.JalviewLite; -import jalview.commands.CommandI; -import jalview.commands.EditCommand; -import jalview.commands.OrderCommand; -import jalview.commands.RemoveGapColCommand; -import jalview.commands.RemoveGapsCommand; -import jalview.commands.SlideSequencesCommand; -import jalview.commands.TrimRegionCommand; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentOrder; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceCollectionI; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.AnnotationFile; -import jalview.io.AppletFormatAdapter; -import jalview.io.FeaturesFile; -import jalview.io.TCoffeeScoreFile; -import jalview.schemes.Blosum62ColourScheme; -import jalview.schemes.BuriedColourScheme; -import jalview.schemes.ClustalxColourScheme; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.HelixColourScheme; -import jalview.schemes.HydrophobicColourScheme; -import jalview.schemes.NucleotideColourScheme; -import jalview.schemes.PIDColourScheme; -import jalview.schemes.PurinePyrimidineColourScheme; -import jalview.schemes.RNAHelicesColourChooser; -import jalview.schemes.ResidueProperties; -import jalview.schemes.StrandColourScheme; -import jalview.schemes.TCoffeeColourScheme; -import jalview.schemes.TaylorColourScheme; -import jalview.schemes.TurnColourScheme; -import jalview.schemes.ZappoColourScheme; -import jalview.structure.StructureSelectionManager; - -import java.awt.BorderLayout; -import java.awt.Canvas; -import java.awt.CheckboxMenuItem; -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.Label; -import java.awt.Menu; -import java.awt.MenuBar; -import java.awt.MenuItem; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.net.URLEncoder; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.List; -import java.util.StringTokenizer; -import java.util.Vector; - -public class AlignFrame extends EmbmenuFrame implements ActionListener, - ItemListener, KeyListener -{ - public AlignmentPanel alignPanel; - - public AlignViewport viewport; - - int DEFAULT_WIDTH = 700; - - int DEFAULT_HEIGHT = 500; - - String jalviewServletURL; - - public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, - String title, boolean embedded) - { - if (applet != null) - { - jalviewServletURL = applet.getParameter("APPLICATION_URL"); - } - - try - { - jbInit(); - } catch (Exception ex) - { - ex.printStackTrace(); - } - - viewport = new AlignViewport(al, applet); - alignPanel = new AlignmentPanel(this, viewport); - - viewport.updateConservation(alignPanel); - viewport.updateConsensus(alignPanel); - - annotationPanelMenuItem.setState(viewport.showAnnotation); - displayNonconservedMenuItem.setState(viewport.getShowUnconserved()); - followMouseOverFlag.setState(viewport.getFollowHighlight()); - showGroupConsensus.setState(viewport.isShowGroupConsensus()); - showGroupConservation.setState(viewport.isShowGroupConservation()); - showConsensusHistogram.setState(viewport.isShowConsensusHistogram()); - showSequenceLogo.setState(viewport.isShowSequenceLogo()); - normSequenceLogo.setState(viewport.isNormaliseSequenceLogo()); - - seqLimits.setState(viewport.showJVSuffix); - - if (applet != null) - { - String param = applet.getParameter("sortBy"); - if (param != null) - { - if (param.equalsIgnoreCase("Id")) - { - sortIDMenuItem_actionPerformed(); - } - else if (param.equalsIgnoreCase("Pairwise Identity")) - { - sortPairwiseMenuItem_actionPerformed(); - } - else if (param.equalsIgnoreCase("Length")) - { - sortLengthMenuItem_actionPerformed(); - } - } - - param = applet.getParameter("wrap"); - if (param != null) - { - if (param.equalsIgnoreCase("true")) - { - wrapMenuItem.setState(true); - wrapMenuItem_actionPerformed(); - } - } - param = applet.getParameter("centrecolumnlabels"); - if (param != null) - { - centreColumnLabelFlag.setState(true); - centreColumnLabelFlag_stateChanged(); - } - try - { - param = applet.getParameter("windowWidth"); - if (param != null) - { - int width = Integer.parseInt(param); - DEFAULT_WIDTH = width; - } - param = applet.getParameter("windowHeight"); - if (param != null) - { - int height = Integer.parseInt(param); - DEFAULT_HEIGHT = height; - } - } catch (Exception ex) - { - } - - } - if (viewport.getAlignment().isNucleotide()) - { - viewport.updateStrucConsensus(alignPanel); - if (viewport.getAlignment().hasRNAStructure()) - { - RNAHelixColour.setEnabled(true); - } - else - { - RNAHelixColour.setEnabled(false); - } - } - else - { - RNAHelixColour.setEnabled(false); - purinePyrimidineColour.setEnabled(false); - } - // Some JVMS send keyevents to Top frame or lowest panel, - // Havent worked out why yet. So add to both this frame and seqCanvas for - // now - this.addKeyListener(this); - alignPanel.seqPanel.seqCanvas.addKeyListener(this); - alignPanel.idPanel.idCanvas.addKeyListener(this); - alignPanel.scalePanel.addKeyListener(this); - alignPanel.annotationPanel.addKeyListener(this); - alignPanel.annotationPanelHolder.addKeyListener(this); - alignPanel.annotationSpaceFillerHolder.addKeyListener(this); - alignPanel.alabels.addKeyListener(this); - createAlignFrameWindow(embedded, title); - - validate(); - alignPanel.adjustAnnotationHeight(); - alignPanel.paintAlignment(true); - } - - public AlignViewport getAlignViewport() - { - return viewport; - } - - public SeqCanvas getSeqcanvas() - { - return alignPanel.seqPanel.seqCanvas; - } - - /** - * Load a features file onto the alignment - * - * @param file - * file URL, content, or other resolvable path - * @param type - * is protocol for accessing data referred to by file - */ - - public boolean parseFeaturesFile(String file, String type) - { - return parseFeaturesFile(file, type, true); - } - - /** - * Load a features file onto the alignment - * - * @param file - * file URL, content, or other resolvable path - * @param type - * is protocol for accessing data referred to by file - * @param autoenabledisplay - * when true, display features flag will be automatically enabled if - * features are loaded - * @return true if data parsed as a features file - */ - public boolean parseFeaturesFile(String file, String type, - boolean autoenabledisplay) - { - // TODO: test if importing a features file onto an alignment which already - // has features with links overwrites the original links. - - Hashtable featureLinks = new Hashtable(); - boolean featuresFile = false; - try - { - featuresFile = new jalview.io.FeaturesFile(file, type) - .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas - .getFeatureRenderer().featureColours, featureLinks, - true, viewport.applet.getDefaultParameter( - "relaxedidmatch", false)); - } catch (Exception ex) - { - ex.printStackTrace(); - } - - if (featuresFile) - { - if (featureLinks.size() > 0) - { - alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks; - } - if (autoenabledisplay) - { - viewport.showSequenceFeatures = true; - sequenceFeatures.setState(true); - } - if (viewport.featureSettings != null) - { - viewport.featureSettings.refreshTable(); - } - alignPanel.paintAlignment(true); - statusBar.setText("Successfully added features to alignment."); - } - return featuresFile; - } - - @Override - public void keyPressed(KeyEvent evt) - { - if (viewport.cursorMode - && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt - .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt - .getKeyCode() <= KeyEvent.VK_NUMPAD9)) - && Character.isDigit(evt.getKeyChar())) - alignPanel.seqPanel.numberPressed(evt.getKeyChar()); - - switch (evt.getKeyCode()) - { - case 27: // escape key - deselectAllSequenceMenuItem_actionPerformed(); - - alignPanel.alabels.cancelDrag(); - break; - case KeyEvent.VK_X: - if (evt.isControlDown() || evt.isMetaDown()) - { - cut_actionPerformed(); - } - break; - case KeyEvent.VK_C: - if (viewport.cursorMode && !evt.isControlDown()) - { - alignPanel.seqPanel.setCursorColumn(); - } - if (evt.isControlDown() || evt.isMetaDown()) - { - copy_actionPerformed(); - } - break; - case KeyEvent.VK_V: - if (evt.isControlDown()) - { - paste(evt.isShiftDown()); - } - break; - case KeyEvent.VK_A: - if (evt.isControlDown() || evt.isMetaDown()) - { - selectAllSequenceMenuItem_actionPerformed(); - } - break; - case KeyEvent.VK_DOWN: - if (viewport.cursorMode) - { - alignPanel.seqPanel.moveCursor(0, 1); - } - else - { - moveSelectedSequences(false); - } - break; - - case KeyEvent.VK_UP: - if (viewport.cursorMode) - { - alignPanel.seqPanel.moveCursor(0, -1); - } - else - { - moveSelectedSequences(true); - } - break; - - case KeyEvent.VK_LEFT: - if (evt.isAltDown() || !viewport.cursorMode) - slideSequences(false, alignPanel.seqPanel.getKeyboardNo1()); - else - alignPanel.seqPanel.moveCursor(-1, 0); - break; - - case KeyEvent.VK_RIGHT: - if (evt.isAltDown() || !viewport.cursorMode) - slideSequences(true, alignPanel.seqPanel.getKeyboardNo1()); - else - alignPanel.seqPanel.moveCursor(1, 0); - break; - - case KeyEvent.VK_SPACE: - if (viewport.cursorMode) - { - alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown() - || evt.isShiftDown() || evt.isAltDown()); - } - break; - - case KeyEvent.VK_DELETE: - case KeyEvent.VK_BACK_SPACE: - if (viewport.cursorMode) - { - alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown() - || evt.isShiftDown() || evt.isAltDown()); - } - else - { - cut_actionPerformed(); - alignPanel.seqPanel.seqCanvas.repaint(); - } - break; - - case KeyEvent.VK_S: - if (viewport.cursorMode) - { - alignPanel.seqPanel.setCursorRow(); - } - break; - case KeyEvent.VK_P: - if (viewport.cursorMode) - { - alignPanel.seqPanel.setCursorPosition(); - } - break; - - case KeyEvent.VK_ENTER: - case KeyEvent.VK_COMMA: - if (viewport.cursorMode) - { - alignPanel.seqPanel.setCursorRowAndColumn(); - } - break; - - case KeyEvent.VK_Q: - if (viewport.cursorMode) - { - alignPanel.seqPanel.setSelectionAreaAtCursor(true); - } - break; - case KeyEvent.VK_M: - if (viewport.cursorMode) - { - alignPanel.seqPanel.setSelectionAreaAtCursor(false); - } - break; - - case KeyEvent.VK_F2: - viewport.cursorMode = !viewport.cursorMode; - statusBar.setText("Keyboard editing mode is " - + (viewport.cursorMode ? "on" : "off")); - if (viewport.cursorMode) - { - alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; - alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq; - } - break; - - case KeyEvent.VK_F: - if (evt.isControlDown()) - { - findMenuItem_actionPerformed(); - } - break; - - case KeyEvent.VK_H: - { - boolean toggleSeqs = !evt.isControlDown(); - boolean toggleCols = !evt.isShiftDown(); - toggleHiddenRegions(toggleSeqs, toggleCols); - break; - } - - case KeyEvent.VK_PAGE_UP: - if (viewport.wrapAlignment) - { - alignPanel.scrollUp(true); - } - else - { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - - viewport.endSeq + viewport.startSeq); - } - break; - - case KeyEvent.VK_PAGE_DOWN: - if (viewport.wrapAlignment) - { - alignPanel.scrollUp(false); - } - else - { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - + viewport.endSeq - viewport.startSeq); - } - break; - - case KeyEvent.VK_Z: - if (evt.isControlDown()) - { - undoMenuItem_actionPerformed(); - } - break; - - case KeyEvent.VK_Y: - if (evt.isControlDown()) - { - redoMenuItem_actionPerformed(); - } - break; - - case KeyEvent.VK_L: - if (evt.isControlDown()) - { - trimAlignment(true); - } - break; - - case KeyEvent.VK_R: - if (evt.isControlDown()) - { - trimAlignment(false); - } - break; - - case KeyEvent.VK_E: - if (evt.isControlDown()) - { - if (evt.isShiftDown()) - { - this.removeAllGapsMenuItem_actionPerformed(); - } - else - { - removeGappedColumnMenuItem_actionPerformed(); - } - } - break; - case KeyEvent.VK_I: - if (evt.isControlDown()) - { - if (evt.isAltDown()) - { - invertColSel_actionPerformed(); - } - else - { - invertSequenceMenuItem_actionPerformed(); - } - } - break; - - case KeyEvent.VK_U: - if (evt.isControlDown()) - { - this.deleteGroups_actionPerformed(); - } - break; - - case KeyEvent.VK_T: - if (evt.isControlDown()) - { - newView(null); - } - break; - - } - alignPanel.paintAlignment(true); - } - - /** - * called by key handler and the hide all/show all menu items - * - * @param toggleSeqs - * @param toggleCols - */ - private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) - { - boolean hide = false; - SequenceGroup sg = viewport.getSelectionGroup(); - if (!toggleSeqs && !toggleCols) - { - // Hide everything by the current selection - this is a hack - we do the - // invert and then hide - // first check that there will be visible columns after the invert. - if ((viewport.getColumnSelection() != null - && viewport.getColumnSelection().getSelected() != null && viewport - .getColumnSelection().getSelected().size() > 0) - || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg - .getEndRes())) - { - // now invert the sequence set, if required - empty selection implies - // that no hiding is required. - if (sg != null) - { - invertSequenceMenuItem_actionPerformed(); - sg = viewport.getSelectionGroup(); - toggleSeqs = true; - - } - viewport.expandColSelection(sg, true); - // finally invert the column selection and get the new sequence - // selection and indicate it should be hidden. - invertColSel_actionPerformed(); - toggleCols = true; - } - } - - if (toggleSeqs) - { - if (sg != null && sg.getSize() != viewport.getAlignment().getHeight()) - { - hide = true; - viewport.hideAllSelectedSeqs(); - } - else if (!(toggleCols && viewport.getColumnSelection().getSelected() - .size() > 0)) - { - viewport.showAllHiddenSeqs(); - } - } - - if (toggleCols) - { - if (viewport.getColumnSelection().getSelected().size() > 0) - { - viewport.hideSelectedColumns(); - if (!toggleSeqs) - { - viewport.setSelectionGroup(sg); - } - } - else if (!hide) - { - viewport.showAllHiddenColumns(); - } - } - } - - @Override - public void keyReleased(KeyEvent evt) - { - } - - @Override - public void keyTyped(KeyEvent evt) - { - } - - @Override - public void itemStateChanged(ItemEvent evt) - { - if (evt.getSource() == displayNonconservedMenuItem) - { - displayNonconservedMenuItem_actionPerformed(); - } - else if (evt.getSource() == colourTextMenuItem) - { - colourTextMenuItem_actionPerformed(); - } - else if (evt.getSource() == wrapMenuItem) - { - wrapMenuItem_actionPerformed(); - } - else if (evt.getSource() == scaleAbove) - { - viewport.setScaleAboveWrapped(scaleAbove.getState()); - } - else if (evt.getSource() == scaleLeft) - { - viewport.setScaleLeftWrapped(scaleLeft.getState()); - } - else if (evt.getSource() == scaleRight) - { - viewport.setScaleRightWrapped(scaleRight.getState()); - } - else if (evt.getSource() == seqLimits) - { - seqLimits_itemStateChanged(); - } - else if (evt.getSource() == viewBoxesMenuItem) - { - viewport.setShowBoxes(viewBoxesMenuItem.getState()); - } - else if (evt.getSource() == viewTextMenuItem) - { - viewport.setShowText(viewTextMenuItem.getState()); - } - else if (evt.getSource() == renderGapsMenuItem) - { - viewport.setRenderGaps(renderGapsMenuItem.getState()); - } - else if (evt.getSource() == annotationPanelMenuItem) - { - viewport.setShowAnnotation(annotationPanelMenuItem.getState()); - alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState()); - } - else if (evt.getSource() == sequenceFeatures) - { - viewport.showSequenceFeatures(sequenceFeatures.getState()); - alignPanel.seqPanel.seqCanvas.repaint(); - } - else if (evt.getSource() == conservationMenuItem) - { - conservationMenuItem_actionPerformed(); - } - else if (evt.getSource() == abovePIDThreshold) - { - abovePIDThreshold_actionPerformed(); - } - else if (evt.getSource() == applyToAllGroups) - { - viewport.setColourAppliesToAllGroups(applyToAllGroups.getState()); - } - else if (evt.getSource() == autoCalculate) - { - viewport.autoCalculateConsensus = autoCalculate.getState(); - } - else if (evt.getSource() == sortByTree) - { - viewport.sortByTree = sortByTree.getState(); - } - else if (evt.getSource() == this.centreColumnLabelFlag) - { - centreColumnLabelFlag_stateChanged(); - } - else if (evt.getSource() == this.followMouseOverFlag) - { - mouseOverFlag_stateChanged(); - } - else if (evt.getSource() == showGroupConsensus) - { - showGroupConsensus_actionPerformed(); - } - else if (evt.getSource() == showGroupConservation) - { - showGroupConservation_actionPerformed(); - } - else if (evt.getSource() == showSequenceLogo) - { - showSequenceLogo_actionPerformed(); - } - else if (evt.getSource() == normSequenceLogo) - { - normSequenceLogo_actionPerformed(); - } - else if (evt.getSource() == showConsensusHistogram) - { - showConsensusHistogram_actionPerformed(); - } - else if (evt.getSource() == applyAutoAnnotationSettings) - { - applyAutoAnnotationSettings_actionPerformed(); - } - alignPanel.paintAlignment(true); - } - - private void mouseOverFlag_stateChanged() - { - viewport.followHighlight = followMouseOverFlag.getState(); - // TODO: could kick the scrollTo mechanism to reset view for current - // searchresults. - } - - private void centreColumnLabelFlag_stateChanged() - { - viewport.centreColumnLabels = centreColumnLabelFlag.getState(); - this.alignPanel.annotationPanel.repaint(); - } - - @Override - public void actionPerformed(ActionEvent evt) - { - Object source = evt.getSource(); - - if (source == inputText) - { - inputText_actionPerformed(); - } - else if (source == loadTree) - { - loadTree_actionPerformed(); - } - else if (source == loadApplication) - { - launchFullApplication(); - } - else if (source == loadAnnotations) - { - loadAnnotations(); - } - else if (source == outputAnnotations) - { - outputAnnotations(true); - } - else if (source == outputFeatures) - { - outputFeatures(true, "Jalview"); - } - else if (source == closeMenuItem) - { - closeMenuItem_actionPerformed(); - } - else if (source == copy) - { - copy_actionPerformed(); - } - else if (source == undoMenuItem) - { - undoMenuItem_actionPerformed(); - } - else if (source == redoMenuItem) - { - redoMenuItem_actionPerformed(); - } - else if (source == inputText) - { - inputText_actionPerformed(); - } - else if (source == closeMenuItem) - { - closeMenuItem_actionPerformed(); - } - else if (source == undoMenuItem) - { - undoMenuItem_actionPerformed(); - } - else if (source == redoMenuItem) - { - redoMenuItem_actionPerformed(); - } - else if (source == copy) - { - copy_actionPerformed(); - } - else if (source == pasteNew) - { - pasteNew_actionPerformed(); - } - else if (source == pasteThis) - { - pasteThis_actionPerformed(); - } - else if (source == cut) - { - cut_actionPerformed(); - } - else if (source == delete) - { - delete_actionPerformed(); - } - else if (source == grpsFromSelection) - { - makeGrpsFromSelection_actionPerformed(); - } - else if (source == deleteGroups) - { - deleteGroups_actionPerformed(); - } - else if (source == selectAllSequenceMenuItem) - { - selectAllSequenceMenuItem_actionPerformed(); - } - else if (source == deselectAllSequenceMenuItem) - { - deselectAllSequenceMenuItem_actionPerformed(); - } - else if (source == invertSequenceMenuItem) - { - invertSequenceMenuItem_actionPerformed(); - } - else if (source == invertColSel) - { - viewport.invertColumnSelection(); - alignPanel.paintAlignment(true); - } - else if (source == remove2LeftMenuItem) - { - trimAlignment(true); - } - else if (source == remove2RightMenuItem) - { - trimAlignment(false); - } - else if (source == removeGappedColumnMenuItem) - { - removeGappedColumnMenuItem_actionPerformed(); - } - else if (source == removeAllGapsMenuItem) - { - removeAllGapsMenuItem_actionPerformed(); - } - else if (source == findMenuItem) - { - findMenuItem_actionPerformed(); - } - else if (source == font) - { - new FontChooser(alignPanel); - } - else if (source == newView) - { - newView(null); - } - else if (source == showColumns) - { - viewport.showAllHiddenColumns(); - alignPanel.paintAlignment(true); - } - else if (source == showSeqs) - { - viewport.showAllHiddenSeqs(); - alignPanel.paintAlignment(true); - } - else if (source == hideColumns) - { - viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); - } - else if (source == hideSequences - && viewport.getSelectionGroup() != null) - { - viewport.hideAllSelectedSeqs(); - alignPanel.paintAlignment(true); - } - else if (source == hideAllButSelection) - { - toggleHiddenRegions(false, false); - alignPanel.paintAlignment(true); - } - else if (source == hideAllSelection) - { - SequenceGroup sg = viewport.getSelectionGroup(); - viewport.expandColSelection(sg, false); - viewport.hideAllSelectedSeqs(); - viewport.hideSelectedColumns(); - alignPanel.paintAlignment(true); - } - else if (source == showAllHidden) - { - viewport.showAllHiddenColumns(); - viewport.showAllHiddenSeqs(); - alignPanel.paintAlignment(true); - } - else if (source == showGroupConsensus) - { - showGroupConsensus_actionPerformed(); - } - else if (source == showGroupConservation) - { - showGroupConservation_actionPerformed(); - } - else if (source == showSequenceLogo) - { - showSequenceLogo_actionPerformed(); - } - else if (source == normSequenceLogo) - { - normSequenceLogo_actionPerformed(); - } - else if (source == showConsensusHistogram) - { - showConsensusHistogram_actionPerformed(); - } - else if (source == applyAutoAnnotationSettings) - { - applyAutoAnnotationSettings_actionPerformed(); - } - else if (source == featureSettings) - { - new FeatureSettings(alignPanel); - } - else if (source == alProperties) - { - StringBuffer contents = new jalview.io.AlignmentProperties( - viewport.getAlignment()).formatAsString(); - CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this); - cap.setText(contents.toString()); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Alignment Properties: " - + getTitle(), 400, 250); - } - else if (source == overviewMenuItem) - { - overviewMenuItem_actionPerformed(); - } - else if (source == noColourmenuItem) - { - changeColour(null); - } - else if (source == clustalColour) - { - abovePIDThreshold.setState(false); - changeColour(new ClustalxColourScheme(viewport.getAlignment(), null)); - } - else if (source == zappoColour) - { - changeColour(new ZappoColourScheme()); - } - else if (source == taylorColour) - { - changeColour(new TaylorColourScheme()); - } - else if (source == hydrophobicityColour) - { - changeColour(new HydrophobicColourScheme()); - } - else if (source == helixColour) - { - changeColour(new HelixColourScheme()); - } - else if (source == strandColour) - { - changeColour(new StrandColourScheme()); - } - else if (source == turnColour) - { - changeColour(new TurnColourScheme()); - } - else if (source == buriedColour) - { - changeColour(new BuriedColourScheme()); - } - else if (source == nucleotideColour) - { - changeColour(new NucleotideColourScheme()); - } - else if (source == purinePyrimidineColour) - { - changeColour(new PurinePyrimidineColourScheme()); - } - else if (source == RNAHelixColour) - { - new RNAHelicesColourChooser(viewport, alignPanel); - } - else if (source == modifyPID) - { - modifyPID_actionPerformed(); - } - else if (source == modifyConservation) - { - modifyConservation_actionPerformed(); - } - else if (source == userDefinedColour) - { - new UserDefinedColours(alignPanel, null); - } - else if (source == PIDColour) - { - changeColour(new PIDColourScheme()); - } - else if (source == BLOSUM62Colour) - { - changeColour(new Blosum62ColourScheme()); - } - else if (source == tcoffeeColour) - { - changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); - } - else if (source == annotationColour) - { - new AnnotationColourChooser(viewport, alignPanel); - } - else if (source == sortPairwiseMenuItem) - { - sortPairwiseMenuItem_actionPerformed(); - } - else if (source == sortIDMenuItem) - { - sortIDMenuItem_actionPerformed(); - } - else if (source == sortLengthMenuItem) - { - sortLengthMenuItem_actionPerformed(); - } - else if (source == sortGroupMenuItem) - { - sortGroupMenuItem_actionPerformed(); - } - else if (source == removeRedundancyMenuItem) - { - removeRedundancyMenuItem_actionPerformed(); - } - else if (source == pairwiseAlignmentMenuItem) - { - pairwiseAlignmentMenuItem_actionPerformed(); - } - else if (source == PCAMenuItem) - { - PCAMenuItem_actionPerformed(); - } - else if (source == averageDistanceTreeMenuItem) - { - averageDistanceTreeMenuItem_actionPerformed(); - } - else if (source == neighbourTreeMenuItem) - { - neighbourTreeMenuItem_actionPerformed(); - } - else if (source == njTreeBlosumMenuItem) - { - njTreeBlosumMenuItem_actionPerformed(); - } - else if (source == avDistanceTreeBlosumMenuItem) - { - avTreeBlosumMenuItem_actionPerformed(); - } - else if (source == documentation) - { - documentation_actionPerformed(); - } - else if (source == about) - { - about_actionPerformed(); - } - - } - - public void inputText_actionPerformed() - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500); - } - - protected void outputText_actionPerformed(ActionEvent e) - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, - "Alignment output - " + e.getActionCommand(), 600, 500); - cap.setText(new AppletFormatAdapter().formatSequences( - e.getActionCommand(), viewport.getAlignment(), - viewport.showJVSuffix)); - } - - public void loadAnnotations() - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - cap.setText("Paste your features / annotations / T-coffee score file here."); - cap.setAnnotationImport(); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300); - - } - - public String outputAnnotations(boolean displayTextbox) - { - String annotation = new AnnotationFile().printAnnotations( - viewport.showAnnotation ? viewport.getAlignment() - .getAlignmentAnnotation() : null, viewport - .getAlignment().getGroups(), ((Alignment) viewport - .getAlignment()).alignmentProperties); - - if (displayTextbox) - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Annotations", 600, 500); - cap.setText(annotation); - } - - return annotation; - } - - private Hashtable getDisplayedFeatureCols() - { - if (alignPanel.getFeatureRenderer() != null - && viewport.featuresDisplayed != null) - { - FeatureRenderer fr = alignPanel.getFeatureRenderer(); - Hashtable fcols = new Hashtable(); - Enumeration en = viewport.featuresDisplayed.keys(); - while (en.hasMoreElements()) - { - Object col = en.nextElement(); - fcols.put(col, fr.featureColours.get(col)); - } - return fcols; - } - return null; - } - - public String outputFeatures(boolean displayTextbox, String format) - { - String features; - if (format.equalsIgnoreCase("Jalview")) - { - features = new FeaturesFile().printJalviewFormat(viewport - .getAlignment().getSequencesArray(), - getDisplayedFeatureCols()); - } - else - { - features = new FeaturesFile().printGFFFormat(viewport.getAlignment() - .getSequencesArray(), getDisplayedFeatureCols()); - } - - if (displayTextbox) - { - boolean frimport = false; - if (features == null || features.equals("No Features Visible")) - { - features = "# No features visible - paste some and import them here."; - frimport = true; - } - - CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this); - if (frimport) - { - cap.setAnnotationImport(); - } - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500); - cap.setText(features); - } - else - { - if (features == null) - features = ""; - } - - return features; - } - - void launchFullApplication() - { - StringBuffer url = new StringBuffer(jalviewServletURL); - - url.append("?open=" - + appendProtocol(viewport.applet.getParameter("file"))); - - if (viewport.applet.getParameter("features") != null) - { - url.append("&features="); - url.append(appendProtocol(viewport.applet.getParameter("features"))); - } - - if (viewport.applet.getParameter("annotations") != null) - { - url.append("&annotations="); - url.append(appendProtocol(viewport.applet.getParameter("annotations"))); - } - - if (viewport.applet.getParameter("jnetfile") != null) - { - url.append("&annotations="); - url.append(appendProtocol(viewport.applet.getParameter("jnetfile"))); - } - - if (viewport.applet.getParameter("defaultColour") != null) - { - url.append("&colour=" - + removeWhiteSpace(viewport.applet - .getParameter("defaultColour"))); - } - - if (viewport.applet.getParameter("userDefinedColour") != null) - { - url.append("&colour=" - + removeWhiteSpace(viewport.applet - .getParameter("userDefinedColour"))); - } - if (viewport.applet.getParameter("tree") != null) - { - url.append("&tree=" - + appendProtocol(viewport.applet.getParameter("tree"))); - } - if (viewport.applet.getParameter("treeFile") != null) - { - url.append("&tree=" - + appendProtocol(viewport.applet.getParameter("treeFile"))); - } - - showURL(url.toString(), "FULL_APP"); - } - - String removeWhiteSpace(String colour) - { - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < colour.length(); i++) - { - if (Character.isWhitespace(colour.charAt(i))) - { - sb.append("%20"); - } - else - { - sb.append(colour.charAt(i)); - } - } - - return sb.toString(); - } - - String appendProtocol(String url) - { - try - { - new URL(url); - url = URLEncoder.encode(url); - } - /* - * When we finally deprecate 1.1 compatibility, we can start to use - * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch - * (UnsupportedEncodingException ex) { System.err.println("WARNING - - * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url); - * ex.printStackTrace(); } - */ - catch (java.net.MalformedURLException ex) - { - url = viewport.applet.getCodeBase() + url; - } - return url; - } - - public void closeMenuItem_actionPerformed() - { - PaintRefresher.RemoveComponent(alignPanel); - if (alignPanel.seqPanel != null - && alignPanel.seqPanel.seqCanvas != null) - { - PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas); - } - if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null) - { - PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas); - } - - if (PaintRefresher.components.size() == 0 && viewport.applet == null) - { - System.exit(0); - } - else - { - } - viewport = null; - alignPanel = null; - this.dispose(); - } - - /** - * TODO: JAL-1104 - */ - void updateEditMenuBar() - { - - if (viewport.historyList.size() > 0) - { - undoMenuItem.setEnabled(true); - CommandI command = (CommandI) viewport.historyList.peek(); - undoMenuItem.setLabel("Undo " + command.getDescription()); - } - else - { - undoMenuItem.setEnabled(false); - undoMenuItem.setLabel("Undo"); - } - - if (viewport.redoList.size() > 0) - { - redoMenuItem.setEnabled(true); - - CommandI command = (CommandI) viewport.redoList.peek(); - redoMenuItem.setLabel("Redo " + command.getDescription()); - } - else - { - redoMenuItem.setEnabled(false); - redoMenuItem.setLabel("Redo"); - } - } - - /** - * TODO: JAL-1104 - */ - public void addHistoryItem(CommandI command) - { - if (command.getSize() > 0) - { - viewport.historyList.push(command); - viewport.redoList.removeAllElements(); - updateEditMenuBar(); - viewport.updateHiddenColumns(); - } - } - - /** - * TODO: JAL-1104 DOCUMENT ME! - * - * @param e - * DOCUMENT ME! - */ - protected void undoMenuItem_actionPerformed() - { - if (viewport.historyList.size() < 1) - { - return; - } - - CommandI command = (CommandI) viewport.historyList.pop(); - viewport.redoList.push(command); - command.undoCommand(null); - - AlignViewport originalSource = getOriginatingSource(command); - // JBPNote Test - if (originalSource != viewport) - { - System.err - .println("Warning: Viewport object mismatch whilst undoing"); - } - originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns = - // viewport.getColumnSelection().getHiddenColumns() - // != null; - updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); - } - - /** - * TODO: JAL-1104 DOCUMENT ME! - * - * @param e - * DOCUMENT ME! - */ - protected void redoMenuItem_actionPerformed() - { - if (viewport.redoList.size() < 1) - { - return; - } - - CommandI command = (CommandI) viewport.redoList.pop(); - viewport.historyList.push(command); - command.doCommand(null); - - AlignViewport originalSource = getOriginatingSource(command); - // JBPNote Test - if (originalSource != viewport) - { - System.err - .println("Warning: Viewport object mismatch whilst re-doing"); - } - originalSource.updateHiddenColumns(); // sethasHiddenColumns(); = - // viewport.getColumnSelection().getHiddenColumns() - // != null; - - updateEditMenuBar(); - originalSource.firePropertyChange("alignment", null, originalSource - .getAlignment().getSequences()); - } - - AlignViewport getOriginatingSource(CommandI command) - { - AlignViewport originalSource = null; - // For sequence removal and addition, we need to fire - // the property change event FROM the viewport where the - // original alignment was altered - AlignmentI al = null; - if (command instanceof EditCommand) - { - EditCommand editCommand = (EditCommand) command; - al = editCommand.getAlignment(); - Vector comps = (Vector) PaintRefresher.components.get(viewport - .getSequenceSetId()); - for (int i = 0; i < comps.size(); i++) - { - if (comps.elementAt(i) instanceof AlignmentPanel) - { - if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment()) - { - originalSource = ((AlignmentPanel) comps.elementAt(i)).av; - break; - } - } - } - } - - if (originalSource == null) - { - // The original view is closed, we must validate - // the current view against the closed view first - if (al != null) - { - PaintRefresher.validateSequences(al, viewport.getAlignment()); - } - - originalSource = viewport; - } - - return originalSource; - } - - public void moveSelectedSequences(boolean up) - { - SequenceGroup sg = viewport.getSelectionGroup(); - if (sg == null) - { - return; - } - viewport.getAlignment().moveSelectedSequencesByOne(sg, - up ? null : viewport.getHiddenRepSequences(), up); - alignPanel.paintAlignment(true); - } - - synchronized void slideSequences(boolean right, int size) - { - List sg = new Vector(); - if (viewport.cursorMode) - { - sg.add(viewport.getAlignment().getSequenceAt( - alignPanel.seqPanel.seqCanvas.cursorY)); - } - else if (viewport.getSelectionGroup() != null - && viewport.getSelectionGroup().getSize() != viewport - .getAlignment().getHeight()) - { - sg = viewport.getSelectionGroup().getSequences( - viewport.getHiddenRepSequences()); - } - - if (sg.size() < 1) - { - return; - } - - Vector invertGroup = new Vector(); - - for (int i = 0; i < viewport.getAlignment().getHeight(); i++) - { - if (!sg.contains(viewport.getAlignment().getSequenceAt(i))) - invertGroup.addElement(viewport.getAlignment().getSequenceAt(i)); - } - - SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]); - - SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup - .size()]); - for (int i = 0; i < invertGroup.size(); i++) - seqs2[i] = invertGroup.elementAt(i); - - SlideSequencesCommand ssc; - if (right) - ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, - size, viewport.getGapCharacter()); - else - ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, - size, viewport.getGapCharacter()); - - int groupAdjustment = 0; - if (ssc.getGapsInsertedBegin() && right) - { - if (viewport.cursorMode) - alignPanel.seqPanel.moveCursor(size, 0); - else - groupAdjustment = size; - } - else if (!ssc.getGapsInsertedBegin() && !right) - { - if (viewport.cursorMode) - alignPanel.seqPanel.moveCursor(-size, 0); - else - groupAdjustment = -size; - } - - if (groupAdjustment != 0) - { - viewport.getSelectionGroup().setStartRes( - viewport.getSelectionGroup().getStartRes() + groupAdjustment); - viewport.getSelectionGroup().setEndRes( - viewport.getSelectionGroup().getEndRes() + groupAdjustment); - } - - boolean appendHistoryItem = false; - if (viewport.historyList != null && viewport.historyList.size() > 0 - && viewport.historyList.peek() instanceof SlideSequencesCommand) - { - appendHistoryItem = ssc - .appendSlideCommand((SlideSequencesCommand) viewport.historyList - .peek()); - } - - if (!appendHistoryItem) - addHistoryItem(ssc); - - repaint(); - } - - static StringBuffer copiedSequences; - - static Vector copiedHiddenColumns; - - protected void copy_actionPerformed() - { - if (viewport.getSelectionGroup() == null) - { - return; - } - - SequenceGroup sg = viewport.getSelectionGroup(); - copiedSequences = new StringBuffer(); - Hashtable orderedSeqs = new Hashtable(); - for (int i = 0; i < sg.getSize(); i++) - { - SequenceI seq = sg.getSequenceAt(i); - int index = viewport.getAlignment().findIndex(seq); - orderedSeqs.put(index + "", seq); - } - - int index = 0, startRes, endRes; - char ch; - - if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null) - { - copiedHiddenColumns = new Vector(); - int hiddenOffset = viewport.getSelectionGroup().getStartRes(); - for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns() - .size(); i++) - { - int[] region = (int[]) viewport.getColumnSelection() - .getHiddenColumns().elementAt(i); - - copiedHiddenColumns.addElement(new int[] - { region[0] - hiddenOffset, region[1] - hiddenOffset }); - } - } - else - { - copiedHiddenColumns = null; - } - - for (int i = 0; i < sg.getSize(); i++) - { - SequenceI seq = null; - - while (seq == null) - { - if (orderedSeqs.containsKey(index + "")) - { - seq = (SequenceI) orderedSeqs.get(index + ""); - index++; - - break; - } - else - { - index++; - } - } - - // FIND START RES - // Returns residue following index if gap - startRes = seq.findPosition(sg.getStartRes()); - - // FIND END RES - // Need to find the residue preceeding index if gap - endRes = 0; - - for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++) - { - ch = seq.getCharAt(j); - if (!jalview.util.Comparison.isGap((ch))) - { - endRes++; - } - } - - if (endRes > 0) - { - endRes += seq.getStart() - 1; - } - - copiedSequences.append(seq.getName() - + "\t" - + startRes - + "\t" - + endRes - + "\t" - + seq.getSequenceAsString(sg.getStartRes(), - sg.getEndRes() + 1) + "\n"); - } - - } - - protected void pasteNew_actionPerformed() - { - paste(true); - } - - protected void pasteThis_actionPerformed() - { - paste(false); - } - - void paste(boolean newAlignment) - { - try - { - - if (copiedSequences == null) - { - return; - } - - StringTokenizer st = new StringTokenizer(copiedSequences.toString()); - Vector seqs = new Vector(); - while (st.hasMoreElements()) - { - String name = st.nextToken(); - int start = Integer.parseInt(st.nextToken()); - int end = Integer.parseInt(st.nextToken()); - seqs.addElement(new Sequence(name, st.nextToken(), start, end)); - } - SequenceI[] newSeqs = new SequenceI[seqs.size()]; - for (int i = 0; i < seqs.size(); i++) - { - newSeqs[i] = (SequenceI) seqs.elementAt(i); - } - - if (newAlignment) - { - String newtitle = new String("Copied sequences"); - if (getTitle().startsWith("Copied sequences")) - { - newtitle = getTitle(); - } - else - { - newtitle = newtitle.concat("- from " + getTitle()); - } - AlignFrame af = new AlignFrame(new Alignment(newSeqs), - viewport.applet, newtitle, false); - if (copiedHiddenColumns != null) - { - for (int i = 0; i < copiedHiddenColumns.size(); i++) - { - int[] region = (int[]) copiedHiddenColumns.elementAt(i); - af.viewport.hideColumns(region[0], region[1]); - } - } - - jalview.bin.JalviewLite.addFrame(af, newtitle, DEFAULT_WIDTH, - DEFAULT_HEIGHT); - } - else - { - addSequences(newSeqs); - } - - } catch (Exception ex) - { - } // could be anything being pasted in here - - } - - void addSequences(SequenceI[] seqs) - { - for (int i = 0; i < seqs.length; i++) - { - viewport.getAlignment().addSequence(seqs[i]); - } - - // !newAlignment - addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE, - seqs, 0, viewport.getAlignment().getWidth(), - viewport.getAlignment())); - - viewport.setEndSeq(viewport.getAlignment().getHeight()); - viewport.getAlignment().getWidth(); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); - - } - - protected void cut_actionPerformed() - { - copy_actionPerformed(); - delete_actionPerformed(); - } - - protected void delete_actionPerformed() - { - - SequenceGroup sg = viewport.getSelectionGroup(); - if (sg == null) - { - return; - } - - Vector seqs = new Vector(); - SequenceI seq; - for (int i = 0; i < sg.getSize(); i++) - { - seq = sg.getSequenceAt(i); - seqs.addElement(seq); - } - - // If the cut affects all sequences, remove highlighted columns - if (sg.getSize() == viewport.getAlignment().getHeight()) - { - viewport.getColumnSelection().removeElements(sg.getStartRes(), - sg.getEndRes() + 1); - } - - SequenceI[] cut = new SequenceI[seqs.size()]; - for (int i = 0; i < seqs.size(); i++) - { - cut[i] = (SequenceI) seqs.elementAt(i); - } - - /* - * //ADD HISTORY ITEM - */ - addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut, - sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1, - viewport.getAlignment())); - - viewport.setSelectionGroup(null); - viewport.getAlignment().deleteGroup(sg); - - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); - - if (viewport.getAlignment().getHeight() < 1) - { - this.setVisible(false); - } - viewport.sendSelection(); - } - - /** - * group consensus toggled - * - */ - protected void showGroupConsensus_actionPerformed() - { - viewport.setShowGroupConsensus(showGroupConsensus.getState()); - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - - } - - /** - * group conservation toggled. - */ - protected void showGroupConservation_actionPerformed() - { - viewport.setShowGroupConservation(showGroupConservation.getState()); - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt - * .event.ActionEvent) - */ - protected void showConsensusHistogram_actionPerformed() - { - viewport.setShowConsensusHistogram(showConsensusHistogram.getState()); - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt - * .event.ActionEvent) - */ - protected void showSequenceLogo_actionPerformed() - { - viewport.setShowSequenceLogo(showSequenceLogo.getState()); - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - } - - protected void normSequenceLogo_actionPerformed() - { - showSequenceLogo.setState(true); - viewport.setShowSequenceLogo(true); - viewport.setNormaliseSequenceLogo(normSequenceLogo.getState()); - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - } - - protected void applyAutoAnnotationSettings_actionPerformed() - { - alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); - } - - protected void makeGrpsFromSelection_actionPerformed() - { - if (viewport.getSelectionGroup() != null) - { - SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom( - viewport.getSequenceSelection(), - viewport.getAlignmentView(true).getSequenceStrings( - viewport.getGapCharacter()), viewport.getAlignment() - .getGroups()); - viewport.getAlignment().deleteAllGroups(); - viewport.sequenceColours = null; - viewport.setSelectionGroup(null); - // set view properties for each group - for (int g = 0; g < gps.length; g++) - { - // gps[g].setShowunconserved(viewport.getShowUnconserved()); - gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo()); - viewport.getAlignment().addGroup(gps[g]); - Color col = new Color((int) (Math.random() * 255), - (int) (Math.random() * 255), (int) (Math.random() * 255)); - col = col.brighter(); - for (SequenceI sq : gps[g].getSequences(null)) - viewport.setSequenceColour(sq, col); - } - PaintRefresher.Refresh(this, viewport.getSequenceSetId()); - alignPanel.updateAnnotation(); - alignPanel.paintAlignment(true); - } - } - - protected void deleteGroups_actionPerformed() - { - viewport.getAlignment().deleteAllGroups(); - viewport.sequenceColours = null; - viewport.setSelectionGroup(null); - - alignPanel.paintAlignment(true); - } - - public void selectAllSequenceMenuItem_actionPerformed() - { - SequenceGroup sg = new SequenceGroup(); - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) - { - sg.addSequence(viewport.getAlignment().getSequenceAt(i), false); - } - sg.setEndRes(viewport.getAlignment().getWidth() - 1); - viewport.setSelectionGroup(sg); - alignPanel.paintAlignment(true); - PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); - viewport.sendSelection(); - } - - public void deselectAllSequenceMenuItem_actionPerformed() - { - if (viewport.cursorMode) - { - alignPanel.seqPanel.keyboardNo1 = null; - alignPanel.seqPanel.keyboardNo2 = null; - } - viewport.setSelectionGroup(null); - viewport.getColumnSelection().clear(); - viewport.setSelectionGroup(null); - alignPanel.idPanel.idCanvas.searchResults = null; - alignPanel.seqPanel.seqCanvas.highlightSearchResults(null); - alignPanel.paintAlignment(true); - PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); - viewport.sendSelection(); - } - - public void invertSequenceMenuItem_actionPerformed() - { - SequenceGroup sg = viewport.getSelectionGroup(); - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) - { - sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); - } - - PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); - viewport.sendSelection(); - } - - public void invertColSel_actionPerformed() - { - viewport.invertColumnSelection(); - alignPanel.paintAlignment(true); - PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); - viewport.sendSelection(); - } - - void trimAlignment(boolean trimLeft) - { - ColumnSelection colSel = viewport.getColumnSelection(); - int column; - - if (colSel.size() > 0) - { - if (trimLeft) - { - column = colSel.getMin(); - } - else - { - column = colSel.getMax(); - } - - SequenceI[] seqs; - if (viewport.getSelectionGroup() != null) - { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); - } - else - { - seqs = viewport.getAlignment().getSequencesArray(); - } - - TrimRegionCommand trimRegion; - if (trimLeft) - { - trimRegion = new TrimRegionCommand("Remove Left", - TrimRegionCommand.TRIM_LEFT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); - viewport.setStartRes(0); - } - else - { - trimRegion = new TrimRegionCommand("Remove Right", - TrimRegionCommand.TRIM_RIGHT, seqs, column, - viewport.getAlignment(), viewport.getColumnSelection(), - viewport.getSelectionGroup()); - } - - statusBar.setText("Removed " + trimRegion.getSize() + " columns."); - - addHistoryItem(trimRegion); - - for (SequenceGroup sg : viewport.getAlignment().getGroups()) - { - if ((trimLeft && !sg.adjustForRemoveLeft(column)) - || (!trimLeft && !sg.adjustForRemoveRight(column))) - { - viewport.getAlignment().deleteGroup(sg); - } - } - - viewport.firePropertyChange("alignment", null, viewport - .getAlignment().getSequences()); - } - } - - public void removeGappedColumnMenuItem_actionPerformed() - { - int start = 0, end = viewport.getAlignment().getWidth() - 1; - - SequenceI[] seqs; - if (viewport.getSelectionGroup() != null) - { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); - start = viewport.getSelectionGroup().getStartRes(); - end = viewport.getSelectionGroup().getEndRes(); - } - else - { - seqs = viewport.getAlignment().getSequencesArray(); - } - - RemoveGapColCommand removeGapCols = new RemoveGapColCommand( - "Remove Gapped Columns", seqs, start, end, - viewport.getAlignment()); - - addHistoryItem(removeGapCols); - - statusBar.setText("Removed " + removeGapCols.getSize() - + " empty columns."); - - // This is to maintain viewport position on first residue - // of first sequence - SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); - // ShiftList shifts; - // viewport.getAlignment().removeGaps(shifts=new ShiftList()); - // edit.alColumnChanges=shifts.getInverse(); - // if (viewport.hasHiddenColumns) - // viewport.getColumnSelection().compensateForEdits(shifts); - viewport.setStartRes(seq.findIndex(startRes) - 1); - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); - - } - - public void removeAllGapsMenuItem_actionPerformed() - { - int start = 0, end = viewport.getAlignment().getWidth() - 1; - - SequenceI[] seqs; - if (viewport.getSelectionGroup() != null) - { - seqs = viewport.getSelectionGroup().getSequencesAsArray( - viewport.getHiddenRepSequences()); - start = viewport.getSelectionGroup().getStartRes(); - end = viewport.getSelectionGroup().getEndRes(); - } - else - { - seqs = viewport.getAlignment().getSequencesArray(); - } - - // This is to maintain viewport position on first residue - // of first sequence - SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); - - addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, - viewport.getAlignment())); - - viewport.setStartRes(seq.findIndex(startRes) - 1); - - viewport.firePropertyChange("alignment", null, viewport.getAlignment() - .getSequences()); - - } - - public void findMenuItem_actionPerformed() - { - new Finder(alignPanel); - } - - /** - * create a new view derived from the current view - * - * @param viewtitle - * @return frame for the new view - */ - public AlignFrame newView(String viewtitle) - { - AlignmentI newal; - if (viewport.hasHiddenRows()) - { - newal = new Alignment(viewport.getAlignment().getHiddenSequences() - .getFullAlignment().getSequencesArray()); - } - else - { - newal = new Alignment(viewport.getAlignment().getSequencesArray()); - } - - if (viewport.getAlignment().getAlignmentAnnotation() != null) - { - for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++) - { - if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated) - { - newal.addAnnotation(viewport.getAlignment() - .getAlignmentAnnotation()[i]); - } - } - } - - AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false); - - newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId()); - PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId()); - PaintRefresher.Register(newaf.alignPanel, - newaf.alignPanel.av.getSequenceSetId()); - - PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas, - newaf.alignPanel.av.getSequenceSetId()); - PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas, - newaf.alignPanel.av.getSequenceSetId()); - - Vector comps = (Vector) PaintRefresher.components.get(viewport - .getSequenceSetId()); - int viewSize = -1; - for (int i = 0; i < comps.size(); i++) - { - if (comps.elementAt(i) instanceof AlignmentPanel) - { - viewSize++; - } - } - - String title = new String(this.getTitle()); - if (viewtitle != null) - { - title = viewtitle + " ( " + title + ")"; - } - else - { - if (title.indexOf("(View") > -1) - { - title = title.substring(0, title.indexOf("(View")); - } - title += "(View " + viewSize + ")"; - } - - newaf.setTitle(title.toString()); - - newaf.viewport.historyList = viewport.historyList; - newaf.viewport.redoList = viewport.redoList; - return newaf; - } - - /** - * - * @return list of feature groups on the view - */ - public String[] getFeatureGroups() - { - FeatureRenderer fr = null; - if (alignPanel != null - && (fr = alignPanel.getFeatureRenderer()) != null) - { - return fr.getGroups(); - } - return null; - } - - /** - * get sequence feature groups that are hidden or shown - * - * @param visible - * true is visible - * @return list - */ - public String[] getFeatureGroupsOfState(boolean visible) - { - FeatureRenderer fr = null; - if (alignPanel != null - && (fr = alignPanel.getFeatureRenderer()) != null) - { - return fr.getGroups(visible); - } - return null; - } - - /** - * Change the display state for the given feature groups - * - * @param groups - * list of group strings - * @param state - * visible or invisible - */ - public void setFeatureGroupState(String[] groups, boolean state) - { - FeatureRenderer fr = null; - this.sequenceFeatures.setState(true); - viewport.showSequenceFeatures(true); - if (alignPanel != null - && (fr = alignPanel.getFeatureRenderer()) != null) - { - fr.setGroupState(groups, state); - alignPanel.seqPanel.seqCanvas.repaint(); - if (alignPanel.overviewPanel != null) - { - alignPanel.overviewPanel.updateOverviewImage(); - } - } - } - - public void seqLimits_itemStateChanged() - { - viewport.setShowJVSuffix(seqLimits.getState()); - alignPanel.fontChanged(); - alignPanel.paintAlignment(true); - } - - protected void colourTextMenuItem_actionPerformed() - { - viewport.setColourText(colourTextMenuItem.getState()); - alignPanel.paintAlignment(true); - } - - protected void displayNonconservedMenuItem_actionPerformed() - { - viewport.setShowunconserved(displayNonconservedMenuItem.getState()); - alignPanel.paintAlignment(true); - } - - protected void wrapMenuItem_actionPerformed() - { - viewport.setWrapAlignment(wrapMenuItem.getState()); - alignPanel.setWrapAlignment(wrapMenuItem.getState()); - scaleAbove.setEnabled(wrapMenuItem.getState()); - scaleLeft.setEnabled(wrapMenuItem.getState()); - scaleRight.setEnabled(wrapMenuItem.getState()); - alignPanel.paintAlignment(true); - } - - public void overviewMenuItem_actionPerformed() - { - if (alignPanel.overviewPanel != null) - { - return; - } - - Frame frame = new Frame(); - OverviewPanel overview = new OverviewPanel(alignPanel); - frame.add(overview); - // +50 must allow for applet frame window - jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(), - overview.getPreferredSize().width, - overview.getPreferredSize().height + 50); - - frame.pack(); - final AlignmentPanel ap = alignPanel; - frame.addWindowListener(new WindowAdapter() - { - @Override - public void windowClosing(WindowEvent e) - { - if (ap != null) - { - ap.setOverviewPanel(null); - } - }; - }); - - alignPanel.setOverviewPanel(overview); - - } - - void changeColour(ColourSchemeI cs) - { - int threshold = 0; - - if (cs != null) - { - if (viewport.getAbovePIDThreshold()) - { - threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, - "Background"); - - cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus()); - - viewport.setGlobalColourScheme(cs); - } - else - { - cs.setThreshold(0, viewport.getIgnoreGapsConsensus()); - } - - if (viewport.getConservationSelected()) - { - - Alignment al = (Alignment) viewport.getAlignment(); - Conservation c = new Conservation("All", - ResidueProperties.propHash, 3, al.getSequences(), 0, - al.getWidth() - 1); - - c.calculate(); - c.verdict(false, viewport.getConsPercGaps()); - - cs.setConservation(c); - - cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel, - cs, "Background")); - - } - else - { - cs.setConservation(null); - } - - cs.setConsensus(viewport.getSequenceConsensusHash()); - - } - viewport.setGlobalColourScheme(cs); - - if (alignPanel.getOverviewPanel() != null) - { - alignPanel.getOverviewPanel().updateOverviewImage(); - } - - jalview.structure.StructureSelectionManager - .getStructureSelectionManager(viewport.applet) - .sequenceColoursChanged(alignPanel); - - alignPanel.paintAlignment(true); - } - - protected void modifyPID_actionPerformed() - { - if (viewport.getAbovePIDThreshold() - && viewport.getGlobalColourScheme() != null) - { - SliderPanel.setPIDSliderSource(alignPanel, - viewport.getGlobalColourScheme(), "Background"); - SliderPanel.showPIDSlider(); - } - } - - protected void modifyConservation_actionPerformed() - { - if (viewport.getConservationSelected() - && viewport.getGlobalColourScheme() != null) - { - SliderPanel.setConservationSlider(alignPanel, - viewport.getGlobalColourScheme(), "Background"); - SliderPanel.showConservationSlider(); - } - } - - protected void conservationMenuItem_actionPerformed() - { - viewport.setConservationSelected(conservationMenuItem.getState()); - - viewport.setAbovePIDThreshold(false); - abovePIDThreshold.setState(false); - - changeColour(viewport.getGlobalColourScheme()); - - modifyConservation_actionPerformed(); - } - - public void abovePIDThreshold_actionPerformed() - { - viewport.setAbovePIDThreshold(abovePIDThreshold.getState()); - - conservationMenuItem.setState(false); - viewport.setConservationSelected(false); - - changeColour(viewport.getGlobalColourScheme()); - - modifyPID_actionPerformed(); - } - - public void sortPairwiseMenuItem_actionPerformed() - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByPID(viewport.getAlignment(), viewport - .getAlignment().getSequenceAt(0), null); - - addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, - viewport.getAlignment())); - alignPanel.paintAlignment(true); - } - - public void sortIDMenuItem_actionPerformed() - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByID(viewport.getAlignment()); - addHistoryItem(new OrderCommand("ID Sort", oldOrder, - viewport.getAlignment())); - alignPanel.paintAlignment(true); - } - - public void sortLengthMenuItem_actionPerformed() - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByLength(viewport.getAlignment()); - addHistoryItem(new OrderCommand("Length Sort", oldOrder, - viewport.getAlignment())); - alignPanel.paintAlignment(true); - } - - public void sortGroupMenuItem_actionPerformed() - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter.sortByGroup(viewport.getAlignment()); - addHistoryItem(new OrderCommand("Group Sort", oldOrder, - viewport.getAlignment())); - alignPanel.paintAlignment(true); - - } - - public void removeRedundancyMenuItem_actionPerformed() - { - new RedundancyPanel(alignPanel); - } - - public void pairwiseAlignmentMenuItem_actionPerformed() - { - if (viewport.getSelectionGroup() != null - && viewport.getSelectionGroup().getSize() > 1) - { - Frame frame = new Frame(); - frame.add(new PairwiseAlignPanel(alignPanel)); - jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600, - 500); - } - } - - public void PCAMenuItem_actionPerformed() - { - // are the sequences aligned? - if (!viewport.getAlignment().isAligned(false)) - { - SequenceI current; - int Width = viewport.getAlignment().getWidth(); - - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) - { - current = viewport.getAlignment().getSequenceAt(i); - - if (current.getLength() < Width) - { - current.insertCharAt(Width - 1, viewport.getGapCharacter()); - } - } - alignPanel.paintAlignment(true); - } - - if ((viewport.getSelectionGroup() != null - && viewport.getSelectionGroup().getSize() < 4 && viewport - .getSelectionGroup().getSize() > 0) - || viewport.getAlignment().getHeight() < 4) - { - return; - } - - try - { - new PCAPanel(viewport); - } catch (java.lang.OutOfMemoryError ex) - { - } - - } - - public void averageDistanceTreeMenuItem_actionPerformed() - { - NewTreePanel("AV", "PID", "Average distance tree using PID"); - } - - public void neighbourTreeMenuItem_actionPerformed() - { - NewTreePanel("NJ", "PID", "Neighbour joining tree using PID"); - } - - protected void njTreeBlosumMenuItem_actionPerformed() - { - NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62"); - } - - protected void avTreeBlosumMenuItem_actionPerformed() - { - NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62"); - } - - void NewTreePanel(String type, String pwType, String title) - { - // are the sequences aligned? - if (!viewport.getAlignment().isAligned(false)) - { - SequenceI current; - int Width = viewport.getAlignment().getWidth(); - - for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) - { - current = viewport.getAlignment().getSequenceAt(i); - - if (current.getLength() < Width) - { - current.insertCharAt(Width - 1, viewport.getGapCharacter()); - } - } - alignPanel.paintAlignment(true); - - } - - if ((viewport.getSelectionGroup() != null && viewport - .getSelectionGroup().getSize() > 1) - || (viewport.getAlignment().getHeight() > 1)) - { - final TreePanel tp = new TreePanel(alignPanel, type, pwType); - - addTreeMenuItem(tp, title); - - jalview.bin.JalviewLite.addFrame(tp, title, 600, 500); - } - } - - void loadTree_actionPerformed() - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - cap.setText("Paste your Newick tree file here."); - cap.setTreeImport(); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300); - } - - public void loadTree(jalview.io.NewickFile tree, String treeFile) - { - TreePanel tp = new TreePanel(alignPanel, treeFile, "From File - ", tree); - jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500); - addTreeMenuItem(tp, treeFile); - } - - /** - * sort the alignment using the given treePanel - * - * @param treePanel - * tree used to sort view - * @param title - * string used for undo event name - */ - public void sortByTree(TreePanel treePanel, String title) - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - AlignmentSorter - .sortByTree(viewport.getAlignment(), treePanel.getTree()); - // addHistoryItem(new HistoryItem("Sort", viewport.alignment, - // HistoryItem.SORT)); - addHistoryItem(new OrderCommand("Order by " + title, oldOrder, - viewport.getAlignment())); - alignPanel.paintAlignment(true); - } - - /** - * Do any automatic reordering of the alignment and add the necessary bits to - * the menu structure for the new tree - * - * @param treePanel - * @param title - */ - protected void addTreeMenuItem(final TreePanel treePanel, - final String title) - { - final MenuItem item = new MenuItem(title); - sortByTreeMenu.add(item); - item.addActionListener(new java.awt.event.ActionListener() - { - @Override - public void actionPerformed(ActionEvent evt) - { - sortByTree(treePanel, title); // treePanel.getTitle()); - } - }); - - treePanel.addWindowListener(new WindowAdapter() - { - @Override - public void windowOpened(WindowEvent e) - { - if (viewport.sortByTree) - { - sortByTree(treePanel, title); - } - super.windowOpened(e); - } - - @Override - public void windowClosing(WindowEvent e) - { - sortByTreeMenu.remove(item); - }; - }); - } - - public boolean sortBy(AlignmentOrder alorder, String undoname) - { - SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); - if (viewport.applet.debug) - { - System.err.println("Sorting " + alorder.getOrder().size() - + " in alignment '" + getTitle() + "'"); - } - AlignmentSorter.sortBy(viewport.getAlignment(), alorder); - if (undoname != null) - { - addHistoryItem(new OrderCommand(undoname, oldOrder, - viewport.getAlignment())); - } - alignPanel.paintAlignment(true); - return true; - } - - protected void documentation_actionPerformed() - { - alignPanel.av.applet.openJalviewHelpUrl(); - } - - protected void about_actionPerformed() - { - - class AboutPanel extends Canvas - { - String version; - - String builddate; - - public AboutPanel(String version, String builddate) - { - this.version = version; - this.builddate = builddate; - } - - @Override - public void paint(Graphics g) - { - g.setColor(Color.white); - g.fillRect(0, 0, getSize().width, getSize().height); - g.setFont(new Font("Helvetica", Font.PLAIN, 12)); - FontMetrics fm = g.getFontMetrics(); - int fh = fm.getHeight(); - int y = 5, x = 7; - g.setColor(Color.black); - // TODO: update this text for each release or centrally store it for - // lite and application - g.setFont(new Font("Helvetica", Font.BOLD, 14)); - g.drawString("JalviewLite - Release " + version, x, y += fh); - g.setFont(new Font("Helvetica", Font.BOLD, 12)); - g.drawString("Build date: " + builddate, x, y += fh); - g.setFont(new Font("Helvetica", Font.PLAIN, 12)); - g.drawString( - "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,", - x, y += fh * 1.5); - g.drawString("David Martin & Geoff Barton.", x + 50, y += fh); - g.drawString( - "Development managed by The Barton Group, University of Dundee, Scotland, UK.", - x, y += fh); - g.drawString( - "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list", - x, y += fh); - g.drawString("If you use Jalview, please cite:", x, y += fh + 8); - g.drawString( - "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)", - x, y += fh); - g.drawString( - "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench", - x, y += fh); - g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", - x, y += fh); - } - } - - Frame frame = new Frame(); - frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite - .getBuildDate())); - jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 220); - - } - - public void showURL(String url, String target) - { - if (viewport.applet == null) - { - System.out.println("Not running as applet - no browser available."); - } - else - { - viewport.applet.showURL(url, target); - } - } - - // //////////////////////////////////////////////////////////////////////////////// - // JBuilder Graphics here - - MenuBar alignFrameMenuBar = new MenuBar(); - - Menu fileMenu = new Menu("File"); - - MenuItem loadApplication = new MenuItem("View in Full Application"); - - MenuItem loadTree = new MenuItem("Load Associated Tree ..."); - - MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ..."); - - MenuItem outputFeatures = new MenuItem("Export Features ..."); - - MenuItem outputAnnotations = new MenuItem("Export Annotations ..."); - - MenuItem closeMenuItem = new MenuItem("Close"); - - Menu editMenu = new Menu("Edit"); - - Menu viewMenu = new Menu("View"); - - Menu colourMenu = new Menu("Colour"); - - Menu calculateMenu = new Menu("Calculate"); - - MenuItem selectAllSequenceMenuItem = new MenuItem("Select all"); - - MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All"); - - MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection"); - - MenuItem remove2LeftMenuItem = new MenuItem(); - - MenuItem remove2RightMenuItem = new MenuItem(); - - MenuItem removeGappedColumnMenuItem = new MenuItem(); - - MenuItem removeAllGapsMenuItem = new MenuItem(); - - CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem(); - - CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem(); - - MenuItem sortPairwiseMenuItem = new MenuItem(); - - MenuItem sortIDMenuItem = new MenuItem(); - - MenuItem sortLengthMenuItem = new MenuItem(); - - MenuItem sortGroupMenuItem = new MenuItem(); - - MenuItem removeRedundancyMenuItem = new MenuItem(); - - MenuItem pairwiseAlignmentMenuItem = new MenuItem(); - - MenuItem PCAMenuItem = new MenuItem(); - - MenuItem averageDistanceTreeMenuItem = new MenuItem(); - - MenuItem neighbourTreeMenuItem = new MenuItem(); - - BorderLayout borderLayout1 = new BorderLayout(); - - public Label statusBar = new Label(); - - Menu outputTextboxMenu = new Menu(); - - MenuItem clustalColour = new MenuItem(); - - MenuItem zappoColour = new MenuItem(); - - MenuItem taylorColour = new MenuItem(); - - MenuItem hydrophobicityColour = new MenuItem(); - - MenuItem helixColour = new MenuItem(); - - MenuItem strandColour = new MenuItem(); - - MenuItem turnColour = new MenuItem(); - - MenuItem buriedColour = new MenuItem(); - - MenuItem purinePyrimidineColour = new MenuItem(); - - MenuItem RNAHelixColour = new MenuItem(); - - MenuItem userDefinedColour = new MenuItem(); - - MenuItem PIDColour = new MenuItem(); - - MenuItem BLOSUM62Colour = new MenuItem(); - - MenuItem tcoffeeColour = new MenuItem(); - - MenuItem njTreeBlosumMenuItem = new MenuItem(); - - MenuItem avDistanceTreeBlosumMenuItem = new MenuItem(); - - CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem(); - - CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem(); - - CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem(); - - MenuItem alProperties = new MenuItem("Alignment Properties..."); - - MenuItem overviewMenuItem = new MenuItem(); - - MenuItem undoMenuItem = new MenuItem(); - - MenuItem redoMenuItem = new MenuItem(); - - CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem(); - - MenuItem noColourmenuItem = new MenuItem(); - - CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem(); - - CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem(); - - MenuItem findMenuItem = new MenuItem(); - - CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem(); - - MenuItem nucleotideColour = new MenuItem(); - - MenuItem deleteGroups = new MenuItem(); - - MenuItem grpsFromSelection = new MenuItem(); - - MenuItem delete = new MenuItem(); - - MenuItem copy = new MenuItem(); - - MenuItem cut = new MenuItem(); - - Menu pasteMenu = new Menu(); - - MenuItem pasteNew = new MenuItem(); - - MenuItem pasteThis = new MenuItem(); - - CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem(); - - MenuItem font = new MenuItem(); - - CheckboxMenuItem scaleAbove = new CheckboxMenuItem(); - - CheckboxMenuItem scaleLeft = new CheckboxMenuItem(); - - CheckboxMenuItem scaleRight = new CheckboxMenuItem(); - - MenuItem modifyPID = new MenuItem(); - - MenuItem modifyConservation = new MenuItem(); - - CheckboxMenuItem autoCalculate = new CheckboxMenuItem( - "Autocalculate Consensus", true); - - CheckboxMenuItem sortByTree = new CheckboxMenuItem( - "Sort Alignment With New Tree", true); - - Menu sortByTreeMenu = new Menu(); - - Menu sort = new Menu(); - - Menu calculate = new Menu(); - - MenuItem inputText = new MenuItem(); - - Menu helpMenu = new Menu(); - - MenuItem documentation = new MenuItem(); - - MenuItem about = new MenuItem(); - - CheckboxMenuItem seqLimits = new CheckboxMenuItem(); - - CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem(); - - CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem(); - - Menu autoAnnMenu = new Menu(); - - CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem(); - - CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem(); - - CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem(); - - CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem(); - - CheckboxMenuItem showGroupConservation = new CheckboxMenuItem(); - - CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem(); - - private void jbInit() throws Exception - { - - setMenuBar(alignFrameMenuBar); - - MenuItem item; - - // dynamically fill save as menu with available formats - for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++) - { - - item = new MenuItem( - jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]); - - item.addActionListener(new java.awt.event.ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - outputText_actionPerformed(e); - } - }); - - outputTextboxMenu.add(item); - } - closeMenuItem.addActionListener(this); - loadApplication.addActionListener(this); - - loadTree.addActionListener(this); - loadAnnotations.addActionListener(this); - outputFeatures.addActionListener(this); - outputAnnotations.addActionListener(this); - selectAllSequenceMenuItem.addActionListener(this); - deselectAllSequenceMenuItem.addActionListener(this); - invertSequenceMenuItem.addActionListener(this); - remove2LeftMenuItem.setLabel("Remove Left"); - remove2LeftMenuItem.addActionListener(this); - remove2RightMenuItem.setLabel("Remove Right"); - remove2RightMenuItem.addActionListener(this); - removeGappedColumnMenuItem.setLabel("Remove Empty Columns"); - removeGappedColumnMenuItem.addActionListener(this); - removeAllGapsMenuItem.setLabel("Remove All Gaps"); - removeAllGapsMenuItem.addActionListener(this); - viewBoxesMenuItem.setLabel("Boxes"); - viewBoxesMenuItem.setState(true); - viewBoxesMenuItem.addItemListener(this); - viewTextMenuItem.setLabel("Text"); - viewTextMenuItem.setState(true); - viewTextMenuItem.addItemListener(this); - sortPairwiseMenuItem.setLabel("by Pairwise Identity"); - sortPairwiseMenuItem.addActionListener(this); - sortIDMenuItem.setLabel("by ID"); - sortIDMenuItem.addActionListener(this); - sortLengthMenuItem.setLabel("by Length"); - sortLengthMenuItem.addActionListener(this); - sortGroupMenuItem.setLabel("by Group"); - sortGroupMenuItem.addActionListener(this); - removeRedundancyMenuItem.setLabel("Remove Redundancy..."); - removeRedundancyMenuItem.addActionListener(this); - pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments..."); - pairwiseAlignmentMenuItem.addActionListener(this); - PCAMenuItem.setLabel("Principal Component Analysis"); - PCAMenuItem.addActionListener(this); - averageDistanceTreeMenuItem - .setLabel("Average Distance Using % Identity"); - averageDistanceTreeMenuItem.addActionListener(this); - neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity"); - neighbourTreeMenuItem.addActionListener(this); - statusBar.setBackground(Color.white); - statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); - statusBar.setText("Status bar"); - outputTextboxMenu.setLabel("Output to Textbox"); - clustalColour.setLabel("Clustalx"); - - clustalColour.addActionListener(this); - zappoColour.setLabel("Zappo"); - zappoColour.addActionListener(this); - taylorColour.setLabel("Taylor"); - taylorColour.addActionListener(this); - hydrophobicityColour.setLabel("Hydrophobicity"); - hydrophobicityColour.addActionListener(this); - helixColour.setLabel("Helix Propensity"); - helixColour.addActionListener(this); - strandColour.setLabel("Strand Propensity"); - strandColour.addActionListener(this); - turnColour.setLabel("Turn Propensity"); - turnColour.addActionListener(this); - buriedColour.setLabel("Buried Index"); - buriedColour.addActionListener(this); - purinePyrimidineColour.setLabel("Purine/Pyrimidine"); - purinePyrimidineColour.addActionListener(this); - RNAHelixColour.setLabel("by RNA Helices"); - RNAHelixColour.addActionListener(this); - userDefinedColour.setLabel("User Defined..."); - userDefinedColour.addActionListener(this); - PIDColour.setLabel("Percentage Identity"); - PIDColour.addActionListener(this); - BLOSUM62Colour.setLabel("BLOSUM62 Score"); - BLOSUM62Colour.addActionListener(this); - tcoffeeColour.setLabel("T-Coffee Scores"); - tcoffeeColour.setEnabled(false); // it will enabled only if a score file is - // provided - tcoffeeColour.addActionListener(this); - avDistanceTreeBlosumMenuItem - .setLabel("Average Distance Using BLOSUM62"); - avDistanceTreeBlosumMenuItem.addActionListener(this); - njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62"); - njTreeBlosumMenuItem.addActionListener(this); - annotationPanelMenuItem.setLabel("Show Annotations"); - annotationPanelMenuItem.addItemListener(this); - colourTextMenuItem.setLabel("Colour Text"); - colourTextMenuItem.addItemListener(this); - displayNonconservedMenuItem.setLabel("Show nonconserved"); - displayNonconservedMenuItem.addItemListener(this); - alProperties.addActionListener(this); - overviewMenuItem.setLabel("Overview Window"); - overviewMenuItem.addActionListener(this); - undoMenuItem.setEnabled(false); - undoMenuItem.setLabel("Undo"); - undoMenuItem.addActionListener(this); - redoMenuItem.setEnabled(false); - redoMenuItem.setLabel("Redo"); - redoMenuItem.addActionListener(this); - conservationMenuItem.setLabel("by Conservation"); - conservationMenuItem.addItemListener(this); - noColourmenuItem.setLabel("None"); - noColourmenuItem.addActionListener(this); - wrapMenuItem.setLabel("Wrap"); - wrapMenuItem.addItemListener(this); - renderGapsMenuItem.setLabel("Show Gaps"); - renderGapsMenuItem.setState(true); - renderGapsMenuItem.addItemListener(this); - findMenuItem.setLabel("Find..."); - findMenuItem.addActionListener(this); - abovePIDThreshold.setLabel("Above Identity Threshold"); - abovePIDThreshold.addItemListener(this); - nucleotideColour.setLabel("Nucleotide"); - nucleotideColour.addActionListener(this); - deleteGroups.setLabel("Undefine Groups"); - deleteGroups.addActionListener(this); - grpsFromSelection.setLabel("Make Groups for selection"); - grpsFromSelection.addActionListener(this); - copy.setLabel("Copy"); - copy.addActionListener(this); - cut.setLabel("Cut"); - cut.addActionListener(this); - delete.setLabel("Delete"); - delete.addActionListener(this); - pasteMenu.setLabel("Paste"); - pasteNew.setLabel("To New Alignment"); - pasteNew.addActionListener(this); - pasteThis.setLabel("Add To This Alignment"); - pasteThis.addActionListener(this); - applyToAllGroups.setLabel("Apply Colour To All Groups"); - applyToAllGroups.setState(true); - applyToAllGroups.addItemListener(this); - font.setLabel("Font..."); - font.addActionListener(this); - scaleAbove.setLabel("Scale Above"); - scaleAbove.setState(true); - scaleAbove.setEnabled(false); - scaleAbove.addItemListener(this); - scaleLeft.setEnabled(false); - scaleLeft.setState(true); - scaleLeft.setLabel("Scale Left"); - scaleLeft.addItemListener(this); - scaleRight.setEnabled(false); - scaleRight.setState(true); - scaleRight.setLabel("Scale Right"); - scaleRight.addItemListener(this); - modifyPID.setLabel("Modify Identity Threshold..."); - modifyPID.addActionListener(this); - modifyConservation.setLabel("Modify Conservation Threshold..."); - modifyConservation.addActionListener(this); - sortByTreeMenu.setLabel("By Tree Order"); - sort.setLabel("Sort"); - calculate.setLabel("Calculate Tree"); - autoCalculate.addItemListener(this); - sortByTree.addItemListener(this); - inputText.setLabel("Input from textbox"); - inputText.addActionListener(this); - centreColumnLabelFlag.setLabel("Centre column labels"); - centreColumnLabelFlag.addItemListener(this); - followMouseOverFlag.setLabel("Automatic Scrolling"); - followMouseOverFlag.addItemListener(this); - helpMenu.setLabel("Help"); - documentation.setLabel("Documentation"); - documentation.addActionListener(this); - - about.setLabel("About..."); - about.addActionListener(this); - seqLimits.setState(true); - seqLimits.setLabel("Show Sequence Limits"); - seqLimits.addItemListener(this); - featureSettings.setLabel("Feature Settings..."); - featureSettings.addActionListener(this); - sequenceFeatures.setLabel("Sequence Features"); - sequenceFeatures.addItemListener(this); - sequenceFeatures.setState(false); - annotationColour.setLabel("by Annotation..."); - annotationColour.addActionListener(this); - invertSequenceMenuItem.setLabel("Invert Sequence Selection"); - invertColSel.setLabel("Invert Column Selection"); - menu1.setLabel("Show"); - showColumns.setLabel("All Columns "); - showSeqs.setLabel("All Sequences"); - menu2.setLabel("Hide"); - hideColumns.setLabel("Selected Columns"); - hideSequences.setLabel("Selected Sequences"); - hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)"); - hideAllSelection.setLabel("Selected Region"); - showAllHidden.setLabel("All Sequences and Columns"); - showGroupConsensus.setLabel("Group Consensus"); - showGroupConservation.setLabel("Group Conservation"); - showConsensusHistogram.setLabel("Show Consensus Histogram"); - showSequenceLogo.setLabel("Show Consensus Logo"); - normSequenceLogo.setLabel("Normalise Consensus Logo"); - applyAutoAnnotationSettings.setLabel("Apply to all groups"); - applyAutoAnnotationSettings.setState(true); - autoAnnMenu.setLabel("Autocalculated Annotation"); - - invertColSel.addActionListener(this); - showColumns.addActionListener(this); - showSeqs.addActionListener(this); - hideColumns.addActionListener(this); - hideSequences.addActionListener(this); - hideAllButSelection.addActionListener(this); - hideAllSelection.addActionListener(this); - showAllHidden.addActionListener(this); - showGroupConsensus.addItemListener(this); - showGroupConservation.addItemListener(this); - showConsensusHistogram.addItemListener(this); - showSequenceLogo.addItemListener(this); - normSequenceLogo.addItemListener(this); - - applyAutoAnnotationSettings.addItemListener(this); - formatMenu.setLabel("Format"); - selectMenu.setLabel("Select"); - newView.setLabel("New View"); - newView.addActionListener(this); - alignFrameMenuBar.add(fileMenu); - alignFrameMenuBar.add(editMenu); - alignFrameMenuBar.add(selectMenu); - alignFrameMenuBar.add(viewMenu); - alignFrameMenuBar.add(formatMenu); - alignFrameMenuBar.add(colourMenu); - alignFrameMenuBar.add(calculateMenu); - alignFrameMenuBar.add(helpMenu); - - fileMenu.add(inputText); - fileMenu.add(loadTree); - fileMenu.add(loadAnnotations); - - fileMenu.addSeparator(); - fileMenu.add(outputTextboxMenu); - fileMenu.add(outputFeatures); - fileMenu.add(outputAnnotations); - - if (jalviewServletURL != null) - { - fileMenu.add(loadApplication); - } - - fileMenu.addSeparator(); - fileMenu.add(closeMenuItem); - - editMenu.add(undoMenuItem); - editMenu.add(redoMenuItem); - editMenu.add(cut); - editMenu.add(copy); - editMenu.add(pasteMenu); - editMenu.add(delete); - editMenu.addSeparator(); - editMenu.add(remove2LeftMenuItem); - editMenu.add(remove2RightMenuItem); - editMenu.add(removeGappedColumnMenuItem); - editMenu.add(removeAllGapsMenuItem); - editMenu.add(removeRedundancyMenuItem); - viewMenu.add(newView); - viewMenu.addSeparator(); - viewMenu.add(menu1); - viewMenu.add(menu2); - viewMenu.addSeparator(); - viewMenu.add(followMouseOverFlag); - viewMenu.add(annotationPanelMenuItem); - autoAnnMenu.add(applyAutoAnnotationSettings); - autoAnnMenu.add(showConsensusHistogram); - autoAnnMenu.add(showSequenceLogo); - autoAnnMenu.add(normSequenceLogo); - autoAnnMenu.addSeparator(); - autoAnnMenu.add(showGroupConservation); - autoAnnMenu.add(showGroupConsensus); - viewMenu.add(autoAnnMenu); - viewMenu.addSeparator(); - viewMenu.add(sequenceFeatures); - viewMenu.add(featureSettings); - viewMenu.addSeparator(); - viewMenu.add(alProperties); - viewMenu.addSeparator(); - viewMenu.add(overviewMenuItem); - colourMenu.add(applyToAllGroups); - colourMenu.addSeparator(); - colourMenu.add(noColourmenuItem); - colourMenu.add(clustalColour); - colourMenu.add(BLOSUM62Colour); - colourMenu.add(PIDColour); - colourMenu.add(zappoColour); - colourMenu.add(taylorColour); - colourMenu.add(hydrophobicityColour); - colourMenu.add(helixColour); - colourMenu.add(strandColour); - colourMenu.add(turnColour); - colourMenu.add(buriedColour); - colourMenu.add(nucleotideColour); - colourMenu.add(purinePyrimidineColour); - colourMenu.add(tcoffeeColour); - colourMenu.add(userDefinedColour); - colourMenu.addSeparator(); - colourMenu.add(conservationMenuItem); - colourMenu.add(modifyConservation); - colourMenu.add(abovePIDThreshold); - colourMenu.add(modifyPID); - colourMenu.add(annotationColour); - colourMenu.add(RNAHelixColour); - calculateMenu.add(sort); - calculateMenu.add(calculate); - calculateMenu.addSeparator(); - calculateMenu.add(pairwiseAlignmentMenuItem); - calculateMenu.add(PCAMenuItem); - calculateMenu.add(autoCalculate); - calculateMenu.add(sortByTree); - this.add(statusBar, BorderLayout.SOUTH); - pasteMenu.add(pasteNew); - pasteMenu.add(pasteThis); - sort.add(sortIDMenuItem); - sort.add(sortLengthMenuItem); - sort.add(sortByTreeMenu); - sort.add(sortGroupMenuItem); - sort.add(sortPairwiseMenuItem); - calculate.add(averageDistanceTreeMenuItem); - calculate.add(neighbourTreeMenuItem); - calculate.add(avDistanceTreeBlosumMenuItem); - calculate.add(njTreeBlosumMenuItem); - helpMenu.add(documentation); - helpMenu.add(about); - menu1.add(showColumns); - menu1.add(showSeqs); - menu1.add(showAllHidden); - menu2.add(hideColumns); - menu2.add(hideSequences); - menu2.add(hideAllSelection); - menu2.add(hideAllButSelection); - formatMenu.add(font); - formatMenu.add(seqLimits); - formatMenu.add(wrapMenuItem); - formatMenu.add(scaleAbove); - formatMenu.add(scaleLeft); - formatMenu.add(scaleRight); - formatMenu.add(viewBoxesMenuItem); - formatMenu.add(viewTextMenuItem); - formatMenu.add(colourTextMenuItem); - formatMenu.add(displayNonconservedMenuItem); - formatMenu.add(renderGapsMenuItem); - formatMenu.add(centreColumnLabelFlag); - selectMenu.add(findMenuItem); - selectMenu.addSeparator(); - selectMenu.add(selectAllSequenceMenuItem); - selectMenu.add(deselectAllSequenceMenuItem); - selectMenu.add(invertSequenceMenuItem); - selectMenu.add(invertColSel); - selectMenu.add(grpsFromSelection); - selectMenu.add(deleteGroups); - - } - - MenuItem featureSettings = new MenuItem(); - - CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem(); - - MenuItem annotationColour = new MenuItem(); - - MenuItem invertColSel = new MenuItem(); - - Menu menu1 = new Menu(); - - MenuItem showColumns = new MenuItem(); - - MenuItem showSeqs = new MenuItem(); - - Menu menu2 = new Menu(); - - MenuItem hideColumns = new MenuItem(); - - MenuItem hideSequences = new MenuItem(); - - MenuItem hideAllButSelection = new MenuItem(); - - MenuItem hideAllSelection = new MenuItem(); - - MenuItem showAllHidden = new MenuItem(); - - Menu formatMenu = new Menu(); - - Menu selectMenu = new Menu(); - - MenuItem newView = new MenuItem(); - - /** - * Attach the alignFrame panels after embedding menus, if necessary. This used - * to be called setEmbedded, but is now creates the dropdown menus in a - * platform independent manner to avoid OSX/Mac menu appendage daftness. - * - * @param reallyEmbedded - * true to attach the view to the applet area on the page rather than - * in a new window - */ - public void createAlignFrameWindow(boolean reallyEmbedded, String title) - { - if (reallyEmbedded) - { - // //// - // Explicly build the embedded menu panel for the on-page applet - // - // view cannot be closed if its actually on the page - fileMenu.remove(closeMenuItem); - fileMenu.remove(3); // Remove Seperator - embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial", - Font.PLAIN, 10, false); // use our own fonts. - // and actually add the components to the applet area - viewport.applet.setLayout(new BorderLayout()); - viewport.applet.add(embeddedMenu, BorderLayout.NORTH); - viewport.applet.add(statusBar, BorderLayout.SOUTH); - alignPanel.setSize(viewport.applet.getSize().width, - viewport.applet.getSize().height - embeddedMenu.HEIGHT - - statusBar.HEIGHT); - viewport.applet.add(alignPanel, BorderLayout.CENTER); - final AlignFrame me = this; - viewport.applet.addFocusListener(new FocusListener() - { - - @Override - public void focusLost(FocusEvent e) - { - if (me.viewport.applet.currentAlignFrame == me) - { - me.viewport.applet.currentAlignFrame = null; - } - } - - @Override - public void focusGained(FocusEvent e) - { - me.viewport.applet.currentAlignFrame = me; - } - }); - viewport.applet.validate(); - } - else - { - // ////// - // test and embed menu bar if necessary. - // - if (embedMenuIfNeeded(alignPanel)) - { - // adjust for status bar height too - alignPanel.setSize(getSize().width, getSize().height - - statusBar.HEIGHT); - } - add(statusBar, BorderLayout.SOUTH); - add(alignPanel, BorderLayout.CENTER); - // and register with the applet so it can pass external API calls to us - jalview.bin.JalviewLite.addFrame(this, title, DEFAULT_WIDTH, - DEFAULT_HEIGHT); - } - } - - /** - * create a new binding between structures in an existing jmol viewer instance - * and an alignpanel with sequences that have existing PDBFile entries. Note, - * this does not open a new Jmol window, or modify the display of the - * structures in the original jmol window. Note This method doesn't work - * without an additional javascript library to exchange messages between the - * distinct applets. See http://issues.jalview.org/browse/JAL-621 - * - * @param viewer - * JmolViewer instance - * @param sequenceIds - * - sequence Ids to search for associations - */ - public SequenceStructureBinding addStructureViewInstance( - Object jmolviewer, String[] sequenceIds) - { - org.jmol.api.JmolViewer viewer = null; - try - { - viewer = (org.jmol.api.JmolViewer) jmolviewer; - } catch (ClassCastException ex) - { - System.err.println("Unsupported viewer object :" - + jmolviewer.getClass()); - } - if (viewer == null) - { - System.err.println("Can't use this object as a structure viewer:" - + jmolviewer.getClass()); - return null; - } - SequenceI[] seqs = null; - if (sequenceIds == null || sequenceIds.length == 0) - { - seqs = viewport.getAlignment().getSequencesArray(); - } - else - { - Vector sqi = new Vector(); - AlignmentI al = viewport.getAlignment(); - for (int sid = 0; sid < sequenceIds.length; sid++) - { - SequenceI sq = al.findName(sequenceIds[sid]); - if (sq != null) - { - sqi.addElement(sq); - } - } - if (sqi.size() > 0) - { - seqs = new SequenceI[sqi.size()]; - for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++) - { - seqs[sid] = (SequenceI) sqi.elementAt(sid); - } - } - else - { - return null; - } - } - ExtJmol jmv = null; - // TODO: search for a jmv that involves viewer - if (jmv == null) - { // create a new viewer/jalview binding. - jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][] - { seqs }); - } - return jmv; - - } - - /** - * bind a pdb file to a sequence in the current view - * - * @param sequenceId - * - sequenceId within the dataset. - * @param pdbEntryString - * - the short name for the PDB file - * @param pdbFile - * - pdb file - either a URL or a valid PDB file. - * @return true if binding was as success TODO: consider making an exception - * structure for indicating when PDB parsing or sequenceId location - * fails. - */ - public boolean addPdbFile(String sequenceId, String pdbEntryString, - String pdbFile) - { - SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId); - boolean needtoadd = false; - if (toaddpdb != null) - { - Vector pdbe = toaddpdb.getPDBId(); - PDBEntry pdbentry = null; - if (pdbe != null && pdbe.size() > 0) - { - for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++) - { - pdbentry = (PDBEntry) pdbe.elementAt(pe); - if (!pdbentry.getId().equals(pdbEntryString) - && !pdbentry.getFile().equals(pdbFile)) - { - pdbentry = null; - } - else - { - continue; - } - } - } - if (pdbentry == null) - { - pdbentry = new PDBEntry(); - pdbentry.setId(pdbEntryString); - pdbentry.setFile(pdbFile); - needtoadd = true; // add this new entry to sequence. - } - // resolve data source - // TODO: this code should be a refactored to an io package - String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB"); - if (protocol == null) - { - return false; - } - if (needtoadd) - { - // make a note of the access mode and add - if (pdbentry.getProperty() == null) - { - pdbentry.setProperty(new Hashtable()); - } - pdbentry.getProperty().put("protocol", protocol); - toaddpdb.addPDBId(pdbentry); - } - } - return true; - } - - private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains) - { - if (seqs != null) - { - Vector sequences = new Vector(); - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i] != null) - { - sequences.addElement(new Object[] - { seqs[i], (chains != null) ? chains[i] : null }); - } - } - seqs = new SequenceI[sequences.size()]; - chains = new String[sequences.size()]; - for (int i = 0, isize = sequences.size(); i < isize; i++) - { - Object[] oj = (Object[]) sequences.elementAt(i); - - seqs[i] = (SequenceI) oj[0]; - chains[i] = (String) oj[1]; - } - } - return new Object[] - { seqs, chains }; - - } - - public void newStructureView(JalviewLite applet, PDBEntry pdb, - SequenceI[] seqs, String[] chains, String protocol) - { - // Scrub any null sequences from the array - Object[] sqch = cleanSeqChainArrays(seqs, chains); - seqs = (SequenceI[]) sqch[0]; - chains = (String[]) sqch[1]; - if (seqs == null || seqs.length == 0) - { - System.err - .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to."); - } - if (protocol == null || protocol.trim().length() == 0 - || protocol.equals("null")) - { - protocol = (String) pdb.getProperty().get("protocol"); - if (protocol == null) - { - System.err.println("Couldn't work out protocol to open structure: " - + pdb.getId()); - return; - } - } - if (applet.useXtrnalSviewer) - { - // register the association(s) and quit, don't create any windows. - if (StructureSelectionManager.getStructureSelectionManager(applet) - .setMapping(seqs, chains, pdb.getFile(), protocol) == null) - { - System.err.println("Failed to map " + pdb.getFile() + " (" - + protocol + ") to any sequences"); - } - return; - } - if (applet.isAlignPdbStructures() && applet.jmolAvailable) - { - // can only do alignments with Jmol - // find the last jmol window assigned to this alignment - jalview.appletgui.AppletJmol ajm = null, tajm; - Vector jmols = applet - .getAppletWindow(jalview.appletgui.AppletJmol.class); - for (int i = 0, iSize = jmols.size(); i < iSize; i++) - { - tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i); - if (tajm.ap.alignFrame == this) - { - ajm = tajm; - break; - } - } - if (ajm != null) - { - System.err - .println("Incremental adding and aligning structure to existing Jmol view not yet implemented."); - // try and add the pdb structure - // ajm.addS - ajm = null; - } - } - // otherwise, create a new window - if (applet.jmolAvailable) - { - new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel, - protocol); - applet.lastFrameX += 40; - applet.lastFrameY += 40; - } - else - { - new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol); - } - - } - - public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb, - SequenceI[][] seqs, String[][] chains, String[] protocols) - { - // TODO Auto-generated method stub - System.err.println("Aligned Structure View: Not yet implemented."); - } - - /** - * modify the current selection, providing the user has not made a selection - * already. - * - * @param sel - * - sequences from this alignment - * @param csel - * - columns to be selected on the alignment - */ - public void select(SequenceGroup sel, ColumnSelection csel) - { - alignPanel.seqPanel.selection(sel, csel, null); - } - - public void scrollTo(int row, int column) - { - alignPanel.seqPanel.scrollTo(row, column); - } - - public void scrollToRow(int row) - { - alignPanel.seqPanel.scrollToRow(row); - } - - public void scrollToColumn(int column) - { - alignPanel.seqPanel.scrollToColumn(column); - } - - /** - * @return the alignments unique ID. - */ - public String getSequenceSetId() - { - return viewport.getSequenceSetId(); - } - - /** - * Load the (T-Coffee) score file from the specified url - * - * @param source - * File/URL/T-COFFEE score file contents - * @throws IOException - * @return true if alignment was annotated with data from source - */ - public boolean loadScoreFile(String source) throws IOException - { - - TCoffeeScoreFile file = new TCoffeeScoreFile(source, - AppletFormatAdapter.checkProtocol(source)); - if (!file.isValid()) - { - // TODO: raise dialog for gui - System.err.println("Problems parsing T-Coffee scores: " - + file.getWarningMessage()); - System.err.println("Origin was:\n" + source); - return false; - } - - /* - * check that the score matrix matches the alignment dimensions - */ - AlignmentI aln; - if ((aln = viewport.getAlignment()) != null - && (aln.getHeight() != file.getHeight() || aln.getWidth() != file - .getWidth())) - { - // TODO: raise a dialog box here rather than bomb out. - System.err - .println("The scores matrix does not match the alignment dimensions"); - - } - - // TODO add parameter to indicate if matching should be done - if (file.annotateAlignment(alignPanel.getAlignment(), false)) - { - alignPanel.fontChanged(); - tcoffeeColour.setEnabled(true); - // switch to this color - changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); - return true; - } - else - { - System.err.println("Problems resolving T-Coffee scores:"); - if (file.getWarningMessage() != null) - { - System.err.println(file.getWarningMessage()); - } - } - return false; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.appletgui; + +import jalview.analysis.AAFrequency; +import jalview.analysis.AlignmentSorter; +import jalview.analysis.Conservation; +import jalview.api.SequenceStructureBinding; +import jalview.bin.JalviewLite; +import jalview.commands.CommandI; +import jalview.commands.EditCommand; +import jalview.commands.OrderCommand; +import jalview.commands.RemoveGapColCommand; +import jalview.commands.RemoveGapsCommand; +import jalview.commands.SlideSequencesCommand; +import jalview.commands.TrimRegionCommand; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentOrder; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceCollectionI; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.AnnotationFile; +import jalview.io.AppletFormatAdapter; +import jalview.io.FeaturesFile; +import jalview.io.TCoffeeScoreFile; +import jalview.schemes.Blosum62ColourScheme; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.ClustalxColourScheme; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.NucleotideColourScheme; +import jalview.schemes.PIDColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.RNAHelicesColourChooser; +import jalview.schemes.ResidueProperties; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TCoffeeColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.ZappoColourScheme; +import jalview.structure.StructureSelectionManager; + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.CheckboxMenuItem; +import java.awt.Color; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLEncoder; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; + +public class AlignFrame extends EmbmenuFrame implements ActionListener, + ItemListener, KeyListener +{ + public AlignmentPanel alignPanel; + + public AlignViewport viewport; + + int DEFAULT_WIDTH = 700; + + int DEFAULT_HEIGHT = 500; + + String jalviewServletURL; + + public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, + String title, boolean embedded) + { + if (applet != null) + { + jalviewServletURL = applet.getParameter("APPLICATION_URL"); + } + + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + + viewport = new AlignViewport(al, applet); + alignPanel = new AlignmentPanel(this, viewport); + + viewport.updateConservation(alignPanel); + viewport.updateConsensus(alignPanel); + + annotationPanelMenuItem.setState(viewport.showAnnotation); + displayNonconservedMenuItem.setState(viewport.getShowUnconserved()); + followMouseOverFlag.setState(viewport.getFollowHighlight()); + showGroupConsensus.setState(viewport.isShowGroupConsensus()); + showGroupConservation.setState(viewport.isShowGroupConservation()); + showConsensusHistogram.setState(viewport.isShowConsensusHistogram()); + showSequenceLogo.setState(viewport.isShowSequenceLogo()); + normSequenceLogo.setState(viewport.isNormaliseSequenceLogo()); + + seqLimits.setState(viewport.showJVSuffix); + + if (applet != null) + { + String param = applet.getParameter("sortBy"); + if (param != null) + { + if (param.equalsIgnoreCase("Id")) + { + sortIDMenuItem_actionPerformed(); + } + else if (param.equalsIgnoreCase("Pairwise Identity")) + { + sortPairwiseMenuItem_actionPerformed(); + } + else if (param.equalsIgnoreCase("Length")) + { + sortLengthMenuItem_actionPerformed(); + } + } + + param = applet.getParameter("wrap"); + if (param != null) + { + if (param.equalsIgnoreCase("true")) + { + wrapMenuItem.setState(true); + wrapMenuItem_actionPerformed(); + } + } + param = applet.getParameter("centrecolumnlabels"); + if (param != null) + { + centreColumnLabelFlag.setState(true); + centreColumnLabelFlag_stateChanged(); + } + try + { + param = applet.getParameter("windowWidth"); + if (param != null) + { + int width = Integer.parseInt(param); + DEFAULT_WIDTH = width; + } + param = applet.getParameter("windowHeight"); + if (param != null) + { + int height = Integer.parseInt(param); + DEFAULT_HEIGHT = height; + } + } catch (Exception ex) + { + } + + } + if (viewport.getAlignment().isNucleotide()) + { + viewport.updateStrucConsensus(alignPanel); + if (viewport.getAlignment().hasRNAStructure()) + { + RNAHelixColour.setEnabled(true); + } + else + { + RNAHelixColour.setEnabled(false); + } + } + else + { + RNAHelixColour.setEnabled(false); + purinePyrimidineColour.setEnabled(false); + } + // Some JVMS send keyevents to Top frame or lowest panel, + // Havent worked out why yet. So add to both this frame and seqCanvas for + // now + this.addKeyListener(this); + alignPanel.seqPanel.seqCanvas.addKeyListener(this); + alignPanel.idPanel.idCanvas.addKeyListener(this); + alignPanel.scalePanel.addKeyListener(this); + alignPanel.annotationPanel.addKeyListener(this); + alignPanel.annotationPanelHolder.addKeyListener(this); + alignPanel.annotationSpaceFillerHolder.addKeyListener(this); + alignPanel.alabels.addKeyListener(this); + createAlignFrameWindow(embedded, title); + + validate(); + alignPanel.adjustAnnotationHeight(); + alignPanel.paintAlignment(true); + } + + public AlignViewport getAlignViewport() + { + return viewport; + } + + public SeqCanvas getSeqcanvas() + { + return alignPanel.seqPanel.seqCanvas; + } + + /** + * Load a features file onto the alignment + * + * @param file + * file URL, content, or other resolvable path + * @param type + * is protocol for accessing data referred to by file + */ + + public boolean parseFeaturesFile(String file, String type) + { + return parseFeaturesFile(file, type, true); + } + + /** + * Load a features file onto the alignment + * + * @param file + * file URL, content, or other resolvable path + * @param type + * is protocol for accessing data referred to by file + * @param autoenabledisplay + * when true, display features flag will be automatically enabled if + * features are loaded + * @return true if data parsed as a features file + */ + public boolean parseFeaturesFile(String file, String type, + boolean autoenabledisplay) + { + // TODO: test if importing a features file onto an alignment which already + // has features with links overwrites the original links. + + Hashtable featureLinks = new Hashtable(); + boolean featuresFile = false; + try + { + featuresFile = new jalview.io.FeaturesFile(file, type) + .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas + .getFeatureRenderer().featureColours, featureLinks, + true, viewport.applet.getDefaultParameter( + "relaxedidmatch", false)); + } catch (Exception ex) + { + ex.printStackTrace(); + } + + if (featuresFile) + { + if (featureLinks.size() > 0) + { + alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks; + } + if (autoenabledisplay) + { + viewport.showSequenceFeatures = true; + sequenceFeatures.setState(true); + } + if (viewport.featureSettings != null) + { + viewport.featureSettings.refreshTable(); + } + alignPanel.paintAlignment(true); + statusBar.setText("Successfully added features to alignment."); + } + return featuresFile; + } + + @Override + public void keyPressed(KeyEvent evt) + { + if (viewport.cursorMode + && ((evt.getKeyCode() >= KeyEvent.VK_0 && evt.getKeyCode() <= KeyEvent.VK_9) || (evt + .getKeyCode() >= KeyEvent.VK_NUMPAD0 && evt + .getKeyCode() <= KeyEvent.VK_NUMPAD9)) + && Character.isDigit(evt.getKeyChar())) + alignPanel.seqPanel.numberPressed(evt.getKeyChar()); + + switch (evt.getKeyCode()) + { + case 27: // escape key + deselectAllSequenceMenuItem_actionPerformed(); + + alignPanel.alabels.cancelDrag(); + break; + case KeyEvent.VK_X: + if (evt.isControlDown() || evt.isMetaDown()) + { + cut_actionPerformed(); + } + break; + case KeyEvent.VK_C: + if (viewport.cursorMode && !evt.isControlDown()) + { + alignPanel.seqPanel.setCursorColumn(); + } + if (evt.isControlDown() || evt.isMetaDown()) + { + copy_actionPerformed(); + } + break; + case KeyEvent.VK_V: + if (evt.isControlDown()) + { + paste(evt.isShiftDown()); + } + break; + case KeyEvent.VK_A: + if (evt.isControlDown() || evt.isMetaDown()) + { + selectAllSequenceMenuItem_actionPerformed(); + } + break; + case KeyEvent.VK_DOWN: + if (viewport.cursorMode) + { + alignPanel.seqPanel.moveCursor(0, 1); + } + else + { + moveSelectedSequences(false); + } + break; + + case KeyEvent.VK_UP: + if (viewport.cursorMode) + { + alignPanel.seqPanel.moveCursor(0, -1); + } + else + { + moveSelectedSequences(true); + } + break; + + case KeyEvent.VK_LEFT: + if (evt.isAltDown() || !viewport.cursorMode) + slideSequences(false, alignPanel.seqPanel.getKeyboardNo1()); + else + alignPanel.seqPanel.moveCursor(-1, 0); + break; + + case KeyEvent.VK_RIGHT: + if (evt.isAltDown() || !viewport.cursorMode) + slideSequences(true, alignPanel.seqPanel.getKeyboardNo1()); + else + alignPanel.seqPanel.moveCursor(1, 0); + break; + + case KeyEvent.VK_SPACE: + if (viewport.cursorMode) + { + alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown() + || evt.isShiftDown() || evt.isAltDown()); + } + break; + + case KeyEvent.VK_DELETE: + case KeyEvent.VK_BACK_SPACE: + if (viewport.cursorMode) + { + alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown() + || evt.isShiftDown() || evt.isAltDown()); + } + else + { + cut_actionPerformed(); + alignPanel.seqPanel.seqCanvas.repaint(); + } + break; + + case KeyEvent.VK_S: + if (viewport.cursorMode) + { + alignPanel.seqPanel.setCursorRow(); + } + break; + case KeyEvent.VK_P: + if (viewport.cursorMode) + { + alignPanel.seqPanel.setCursorPosition(); + } + break; + + case KeyEvent.VK_ENTER: + case KeyEvent.VK_COMMA: + if (viewport.cursorMode) + { + alignPanel.seqPanel.setCursorRowAndColumn(); + } + break; + + case KeyEvent.VK_Q: + if (viewport.cursorMode) + { + alignPanel.seqPanel.setSelectionAreaAtCursor(true); + } + break; + case KeyEvent.VK_M: + if (viewport.cursorMode) + { + alignPanel.seqPanel.setSelectionAreaAtCursor(false); + } + break; + + case KeyEvent.VK_F2: + viewport.cursorMode = !viewport.cursorMode; + statusBar.setText("Keyboard editing mode is " + + (viewport.cursorMode ? "on" : "off")); + if (viewport.cursorMode) + { + alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; + alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq; + } + break; + + case KeyEvent.VK_F: + if (evt.isControlDown()) + { + findMenuItem_actionPerformed(); + } + break; + + case KeyEvent.VK_H: + { + boolean toggleSeqs = !evt.isControlDown(); + boolean toggleCols = !evt.isShiftDown(); + toggleHiddenRegions(toggleSeqs, toggleCols); + break; + } + + case KeyEvent.VK_PAGE_UP: + if (viewport.wrapAlignment) + { + alignPanel.scrollUp(true); + } + else + { + alignPanel.setScrollValues(viewport.startRes, viewport.startSeq + - viewport.endSeq + viewport.startSeq); + } + break; + + case KeyEvent.VK_PAGE_DOWN: + if (viewport.wrapAlignment) + { + alignPanel.scrollUp(false); + } + else + { + alignPanel.setScrollValues(viewport.startRes, viewport.startSeq + + viewport.endSeq - viewport.startSeq); + } + break; + + case KeyEvent.VK_Z: + if (evt.isControlDown()) + { + undoMenuItem_actionPerformed(); + } + break; + + case KeyEvent.VK_Y: + if (evt.isControlDown()) + { + redoMenuItem_actionPerformed(); + } + break; + + case KeyEvent.VK_L: + if (evt.isControlDown()) + { + trimAlignment(true); + } + break; + + case KeyEvent.VK_R: + if (evt.isControlDown()) + { + trimAlignment(false); + } + break; + + case KeyEvent.VK_E: + if (evt.isControlDown()) + { + if (evt.isShiftDown()) + { + this.removeAllGapsMenuItem_actionPerformed(); + } + else + { + removeGappedColumnMenuItem_actionPerformed(); + } + } + break; + case KeyEvent.VK_I: + if (evt.isControlDown()) + { + if (evt.isAltDown()) + { + invertColSel_actionPerformed(); + } + else + { + invertSequenceMenuItem_actionPerformed(); + } + } + break; + + case KeyEvent.VK_U: + if (evt.isControlDown()) + { + this.deleteGroups_actionPerformed(); + } + break; + + case KeyEvent.VK_T: + if (evt.isControlDown()) + { + newView(null); + } + break; + + } + alignPanel.paintAlignment(true); + } + + /** + * called by key handler and the hide all/show all menu items + * + * @param toggleSeqs + * @param toggleCols + */ + private void toggleHiddenRegions(boolean toggleSeqs, boolean toggleCols) + { + boolean hide = false; + SequenceGroup sg = viewport.getSelectionGroup(); + if (!toggleSeqs && !toggleCols) + { + // Hide everything by the current selection - this is a hack - we do the + // invert and then hide + // first check that there will be visible columns after the invert. + if ((viewport.getColumnSelection() != null + && viewport.getColumnSelection().getSelected() != null && viewport + .getColumnSelection().getSelected().size() > 0) + || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg + .getEndRes())) + { + // now invert the sequence set, if required - empty selection implies + // that no hiding is required. + if (sg != null) + { + invertSequenceMenuItem_actionPerformed(); + sg = viewport.getSelectionGroup(); + toggleSeqs = true; + + } + viewport.expandColSelection(sg, true); + // finally invert the column selection and get the new sequence + // selection and indicate it should be hidden. + invertColSel_actionPerformed(); + toggleCols = true; + } + } + + if (toggleSeqs) + { + if (sg != null && sg.getSize() != viewport.getAlignment().getHeight()) + { + hide = true; + viewport.hideAllSelectedSeqs(); + } + else if (!(toggleCols && viewport.getColumnSelection().getSelected() + .size() > 0)) + { + viewport.showAllHiddenSeqs(); + } + } + + if (toggleCols) + { + if (viewport.getColumnSelection().getSelected().size() > 0) + { + viewport.hideSelectedColumns(); + if (!toggleSeqs) + { + viewport.setSelectionGroup(sg); + } + } + else if (!hide) + { + viewport.showAllHiddenColumns(); + } + } + } + + @Override + public void keyReleased(KeyEvent evt) + { + } + + @Override + public void keyTyped(KeyEvent evt) + { + } + + @Override + public void itemStateChanged(ItemEvent evt) + { + if (evt.getSource() == displayNonconservedMenuItem) + { + displayNonconservedMenuItem_actionPerformed(); + } + else if (evt.getSource() == colourTextMenuItem) + { + colourTextMenuItem_actionPerformed(); + } + else if (evt.getSource() == wrapMenuItem) + { + wrapMenuItem_actionPerformed(); + } + else if (evt.getSource() == scaleAbove) + { + viewport.setScaleAboveWrapped(scaleAbove.getState()); + } + else if (evt.getSource() == scaleLeft) + { + viewport.setScaleLeftWrapped(scaleLeft.getState()); + } + else if (evt.getSource() == scaleRight) + { + viewport.setScaleRightWrapped(scaleRight.getState()); + } + else if (evt.getSource() == seqLimits) + { + seqLimits_itemStateChanged(); + } + else if (evt.getSource() == viewBoxesMenuItem) + { + viewport.setShowBoxes(viewBoxesMenuItem.getState()); + } + else if (evt.getSource() == viewTextMenuItem) + { + viewport.setShowText(viewTextMenuItem.getState()); + } + else if (evt.getSource() == renderGapsMenuItem) + { + viewport.setRenderGaps(renderGapsMenuItem.getState()); + } + else if (evt.getSource() == annotationPanelMenuItem) + { + viewport.setShowAnnotation(annotationPanelMenuItem.getState()); + alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState()); + } + else if (evt.getSource() == sequenceFeatures) + { + viewport.showSequenceFeatures(sequenceFeatures.getState()); + alignPanel.seqPanel.seqCanvas.repaint(); + } + else if (evt.getSource() == conservationMenuItem) + { + conservationMenuItem_actionPerformed(); + } + else if (evt.getSource() == abovePIDThreshold) + { + abovePIDThreshold_actionPerformed(); + } + else if (evt.getSource() == applyToAllGroups) + { + viewport.setColourAppliesToAllGroups(applyToAllGroups.getState()); + } + else if (evt.getSource() == autoCalculate) + { + viewport.autoCalculateConsensus = autoCalculate.getState(); + } + else if (evt.getSource() == sortByTree) + { + viewport.sortByTree = sortByTree.getState(); + } + else if (evt.getSource() == this.centreColumnLabelFlag) + { + centreColumnLabelFlag_stateChanged(); + } + else if (evt.getSource() == this.followMouseOverFlag) + { + mouseOverFlag_stateChanged(); + } + else if (evt.getSource() == showGroupConsensus) + { + showGroupConsensus_actionPerformed(); + } + else if (evt.getSource() == showGroupConservation) + { + showGroupConservation_actionPerformed(); + } + else if (evt.getSource() == showSequenceLogo) + { + showSequenceLogo_actionPerformed(); + } + else if (evt.getSource() == normSequenceLogo) + { + normSequenceLogo_actionPerformed(); + } + else if (evt.getSource() == showConsensusHistogram) + { + showConsensusHistogram_actionPerformed(); + } + else if (evt.getSource() == applyAutoAnnotationSettings) + { + applyAutoAnnotationSettings_actionPerformed(); + } + alignPanel.paintAlignment(true); + } + + private void mouseOverFlag_stateChanged() + { + viewport.followHighlight = followMouseOverFlag.getState(); + // TODO: could kick the scrollTo mechanism to reset view for current + // searchresults. + } + + private void centreColumnLabelFlag_stateChanged() + { + viewport.centreColumnLabels = centreColumnLabelFlag.getState(); + this.alignPanel.annotationPanel.repaint(); + } + + @Override + public void actionPerformed(ActionEvent evt) + { + Object source = evt.getSource(); + + if (source == inputText) + { + inputText_actionPerformed(); + } + else if (source == loadTree) + { + loadTree_actionPerformed(); + } + else if (source == loadApplication) + { + launchFullApplication(); + } + else if (source == loadAnnotations) + { + loadAnnotations(); + } + else if (source == outputAnnotations) + { + outputAnnotations(true); + } + else if (source == outputFeatures) + { + outputFeatures(true, "Jalview"); + } + else if (source == closeMenuItem) + { + closeMenuItem_actionPerformed(); + } + else if (source == copy) + { + copy_actionPerformed(); + } + else if (source == undoMenuItem) + { + undoMenuItem_actionPerformed(); + } + else if (source == redoMenuItem) + { + redoMenuItem_actionPerformed(); + } + else if (source == inputText) + { + inputText_actionPerformed(); + } + else if (source == closeMenuItem) + { + closeMenuItem_actionPerformed(); + } + else if (source == undoMenuItem) + { + undoMenuItem_actionPerformed(); + } + else if (source == redoMenuItem) + { + redoMenuItem_actionPerformed(); + } + else if (source == copy) + { + copy_actionPerformed(); + } + else if (source == pasteNew) + { + pasteNew_actionPerformed(); + } + else if (source == pasteThis) + { + pasteThis_actionPerformed(); + } + else if (source == cut) + { + cut_actionPerformed(); + } + else if (source == delete) + { + delete_actionPerformed(); + } + else if (source == grpsFromSelection) + { + makeGrpsFromSelection_actionPerformed(); + } + else if (source == deleteGroups) + { + deleteGroups_actionPerformed(); + } + else if (source == selectAllSequenceMenuItem) + { + selectAllSequenceMenuItem_actionPerformed(); + } + else if (source == deselectAllSequenceMenuItem) + { + deselectAllSequenceMenuItem_actionPerformed(); + } + else if (source == invertSequenceMenuItem) + { + invertSequenceMenuItem_actionPerformed(); + } + else if (source == invertColSel) + { + viewport.invertColumnSelection(); + alignPanel.paintAlignment(true); + } + else if (source == remove2LeftMenuItem) + { + trimAlignment(true); + } + else if (source == remove2RightMenuItem) + { + trimAlignment(false); + } + else if (source == removeGappedColumnMenuItem) + { + removeGappedColumnMenuItem_actionPerformed(); + } + else if (source == removeAllGapsMenuItem) + { + removeAllGapsMenuItem_actionPerformed(); + } + else if (source == findMenuItem) + { + findMenuItem_actionPerformed(); + } + else if (source == font) + { + new FontChooser(alignPanel); + } + else if (source == newView) + { + newView(null); + } + else if (source == showColumns) + { + viewport.showAllHiddenColumns(); + alignPanel.paintAlignment(true); + } + else if (source == showSeqs) + { + viewport.showAllHiddenSeqs(); + alignPanel.paintAlignment(true); + } + else if (source == hideColumns) + { + viewport.hideSelectedColumns(); + alignPanel.paintAlignment(true); + } + else if (source == hideSequences + && viewport.getSelectionGroup() != null) + { + viewport.hideAllSelectedSeqs(); + alignPanel.paintAlignment(true); + } + else if (source == hideAllButSelection) + { + toggleHiddenRegions(false, false); + alignPanel.paintAlignment(true); + } + else if (source == hideAllSelection) + { + SequenceGroup sg = viewport.getSelectionGroup(); + viewport.expandColSelection(sg, false); + viewport.hideAllSelectedSeqs(); + viewport.hideSelectedColumns(); + alignPanel.paintAlignment(true); + } + else if (source == showAllHidden) + { + viewport.showAllHiddenColumns(); + viewport.showAllHiddenSeqs(); + alignPanel.paintAlignment(true); + } + else if (source == showGroupConsensus) + { + showGroupConsensus_actionPerformed(); + } + else if (source == showGroupConservation) + { + showGroupConservation_actionPerformed(); + } + else if (source == showSequenceLogo) + { + showSequenceLogo_actionPerformed(); + } + else if (source == normSequenceLogo) + { + normSequenceLogo_actionPerformed(); + } + else if (source == showConsensusHistogram) + { + showConsensusHistogram_actionPerformed(); + } + else if (source == applyAutoAnnotationSettings) + { + applyAutoAnnotationSettings_actionPerformed(); + } + else if (source == featureSettings) + { + new FeatureSettings(alignPanel); + } + else if (source == alProperties) + { + StringBuffer contents = new jalview.io.AlignmentProperties( + viewport.getAlignment()).formatAsString(); + CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this); + cap.setText(contents.toString()); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Alignment Properties: " + + getTitle(), 400, 250); + } + else if (source == overviewMenuItem) + { + overviewMenuItem_actionPerformed(); + } + else if (source == noColourmenuItem) + { + changeColour(null); + } + else if (source == clustalColour) + { + abovePIDThreshold.setState(false); + changeColour(new ClustalxColourScheme(viewport.getAlignment(), null)); + } + else if (source == zappoColour) + { + changeColour(new ZappoColourScheme()); + } + else if (source == taylorColour) + { + changeColour(new TaylorColourScheme()); + } + else if (source == hydrophobicityColour) + { + changeColour(new HydrophobicColourScheme()); + } + else if (source == helixColour) + { + changeColour(new HelixColourScheme()); + } + else if (source == strandColour) + { + changeColour(new StrandColourScheme()); + } + else if (source == turnColour) + { + changeColour(new TurnColourScheme()); + } + else if (source == buriedColour) + { + changeColour(new BuriedColourScheme()); + } + else if (source == nucleotideColour) + { + changeColour(new NucleotideColourScheme()); + } + else if (source == purinePyrimidineColour) + { + changeColour(new PurinePyrimidineColourScheme()); + } + else if (source == RNAHelixColour) + { + new RNAHelicesColourChooser(viewport, alignPanel); + } + else if (source == modifyPID) + { + modifyPID_actionPerformed(); + } + else if (source == modifyConservation) + { + modifyConservation_actionPerformed(); + } + else if (source == userDefinedColour) + { + new UserDefinedColours(alignPanel, null); + } + else if (source == PIDColour) + { + changeColour(new PIDColourScheme()); + } + else if (source == BLOSUM62Colour) + { + changeColour(new Blosum62ColourScheme()); + } + else if (source == tcoffeeColour) + { + changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); + } + else if (source == annotationColour) + { + new AnnotationColourChooser(viewport, alignPanel); + } + else if (source == sortPairwiseMenuItem) + { + sortPairwiseMenuItem_actionPerformed(); + } + else if (source == sortIDMenuItem) + { + sortIDMenuItem_actionPerformed(); + } + else if (source == sortLengthMenuItem) + { + sortLengthMenuItem_actionPerformed(); + } + else if (source == sortGroupMenuItem) + { + sortGroupMenuItem_actionPerformed(); + } + else if (source == removeRedundancyMenuItem) + { + removeRedundancyMenuItem_actionPerformed(); + } + else if (source == pairwiseAlignmentMenuItem) + { + pairwiseAlignmentMenuItem_actionPerformed(); + } + else if (source == PCAMenuItem) + { + PCAMenuItem_actionPerformed(); + } + else if (source == averageDistanceTreeMenuItem) + { + averageDistanceTreeMenuItem_actionPerformed(); + } + else if (source == neighbourTreeMenuItem) + { + neighbourTreeMenuItem_actionPerformed(); + } + else if (source == njTreeBlosumMenuItem) + { + njTreeBlosumMenuItem_actionPerformed(); + } + else if (source == avDistanceTreeBlosumMenuItem) + { + avTreeBlosumMenuItem_actionPerformed(); + } + else if (source == documentation) + { + documentation_actionPerformed(); + } + else if (source == about) + { + about_actionPerformed(); + } + + } + + public void inputText_actionPerformed() + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500); + } + + protected void outputText_actionPerformed(ActionEvent e) + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, + "Alignment output - " + e.getActionCommand(), 600, 500); + cap.setText(new AppletFormatAdapter().formatSequences( + e.getActionCommand(), viewport.getAlignment(), + viewport.showJVSuffix)); + } + + public void loadAnnotations() + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); + cap.setText("Paste your features / annotations / T-coffee score file here."); + cap.setAnnotationImport(); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Paste Annotations ", 400, 300); + + } + + public String outputAnnotations(boolean displayTextbox) + { + String annotation = new AnnotationFile().printAnnotations( + viewport.showAnnotation ? viewport.getAlignment() + .getAlignmentAnnotation() : null, viewport + .getAlignment().getGroups(), ((Alignment) viewport + .getAlignment()).alignmentProperties); + + if (displayTextbox) + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Annotations", 600, 500); + cap.setText(annotation); + } + + return annotation; + } + + private Hashtable getDisplayedFeatureCols() + { + if (alignPanel.getFeatureRenderer() != null + && viewport.featuresDisplayed != null) + { + FeatureRenderer fr = alignPanel.getFeatureRenderer(); + Hashtable fcols = new Hashtable(); + Enumeration en = viewport.featuresDisplayed.keys(); + while (en.hasMoreElements()) + { + Object col = en.nextElement(); + fcols.put(col, fr.featureColours.get(col)); + } + return fcols; + } + return null; + } + + public String outputFeatures(boolean displayTextbox, String format) + { + String features; + if (format.equalsIgnoreCase("Jalview")) + { + features = new FeaturesFile().printJalviewFormat(viewport + .getAlignment().getSequencesArray(), + getDisplayedFeatureCols()); + } + else + { + features = new FeaturesFile().printGFFFormat(viewport.getAlignment() + .getSequencesArray(), getDisplayedFeatureCols()); + } + + if (displayTextbox) + { + boolean frimport = false; + if (features == null || features.equals("No Features Visible")) + { + features = "# No features visible - paste some and import them here."; + frimport = true; + } + + CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this); + if (frimport) + { + cap.setAnnotationImport(); + } + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Features", 600, 500); + cap.setText(features); + } + else + { + if (features == null) + features = ""; + } + + return features; + } + + void launchFullApplication() + { + StringBuffer url = new StringBuffer(jalviewServletURL); + + url.append("?open=" + + appendProtocol(viewport.applet.getParameter("file"))); + + if (viewport.applet.getParameter("features") != null) + { + url.append("&features="); + url.append(appendProtocol(viewport.applet.getParameter("features"))); + } + + if (viewport.applet.getParameter("annotations") != null) + { + url.append("&annotations="); + url.append(appendProtocol(viewport.applet.getParameter("annotations"))); + } + + if (viewport.applet.getParameter("jnetfile") != null) + { + url.append("&annotations="); + url.append(appendProtocol(viewport.applet.getParameter("jnetfile"))); + } + + if (viewport.applet.getParameter("defaultColour") != null) + { + url.append("&colour=" + + removeWhiteSpace(viewport.applet + .getParameter("defaultColour"))); + } + + if (viewport.applet.getParameter("userDefinedColour") != null) + { + url.append("&colour=" + + removeWhiteSpace(viewport.applet + .getParameter("userDefinedColour"))); + } + if (viewport.applet.getParameter("tree") != null) + { + url.append("&tree=" + + appendProtocol(viewport.applet.getParameter("tree"))); + } + if (viewport.applet.getParameter("treeFile") != null) + { + url.append("&tree=" + + appendProtocol(viewport.applet.getParameter("treeFile"))); + } + + showURL(url.toString(), "FULL_APP"); + } + + String removeWhiteSpace(String colour) + { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < colour.length(); i++) + { + if (Character.isWhitespace(colour.charAt(i))) + { + sb.append("%20"); + } + else + { + sb.append(colour.charAt(i)); + } + } + + return sb.toString(); + } + + String appendProtocol(String url) + { + try + { + new URL(url); + url = URLEncoder.encode(url); + } + /* + * When we finally deprecate 1.1 compatibility, we can start to use + * URLEncoder.encode(url,"UTF-8") and then we'll need this catch: catch + * (UnsupportedEncodingException ex) { System.err.println("WARNING - + * IMPLEMENTATION ERROR - UNSUPPORTED ENCODING EXCEPTION FOR "+url); + * ex.printStackTrace(); } + */ + catch (java.net.MalformedURLException ex) + { + url = viewport.applet.getCodeBase() + url; + } + return url; + } + + public void closeMenuItem_actionPerformed() + { + PaintRefresher.RemoveComponent(alignPanel); + if (alignPanel.seqPanel != null + && alignPanel.seqPanel.seqCanvas != null) + { + PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas); + } + if (alignPanel.idPanel != null && alignPanel.idPanel.idCanvas != null) + { + PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas); + } + + if (PaintRefresher.components.size() == 0 && viewport.applet == null) + { + System.exit(0); + } + else + { + } + viewport = null; + alignPanel = null; + this.dispose(); + } + + /** + * TODO: JAL-1104 + */ + void updateEditMenuBar() + { + + if (viewport.historyList.size() > 0) + { + undoMenuItem.setEnabled(true); + CommandI command = (CommandI) viewport.historyList.peek(); + undoMenuItem.setLabel("Undo " + command.getDescription()); + } + else + { + undoMenuItem.setEnabled(false); + undoMenuItem.setLabel("Undo"); + } + + if (viewport.redoList.size() > 0) + { + redoMenuItem.setEnabled(true); + + CommandI command = (CommandI) viewport.redoList.peek(); + redoMenuItem.setLabel("Redo " + command.getDescription()); + } + else + { + redoMenuItem.setEnabled(false); + redoMenuItem.setLabel("Redo"); + } + } + + /** + * TODO: JAL-1104 + */ + public void addHistoryItem(CommandI command) + { + if (command.getSize() > 0) + { + viewport.historyList.push(command); + viewport.redoList.removeAllElements(); + updateEditMenuBar(); + viewport.updateHiddenColumns(); + } + } + + /** + * TODO: JAL-1104 DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ + protected void undoMenuItem_actionPerformed() + { + if (viewport.historyList.size() < 1) + { + return; + } + + CommandI command = (CommandI) viewport.historyList.pop(); + viewport.redoList.push(command); + command.undoCommand(null); + + AlignViewport originalSource = getOriginatingSource(command); + // JBPNote Test + if (originalSource != viewport) + { + System.err + .println("Warning: Viewport object mismatch whilst undoing"); + } + originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns = + // viewport.getColumnSelection().getHiddenColumns() + // != null; + updateEditMenuBar(); + originalSource.firePropertyChange("alignment", null, originalSource + .getAlignment().getSequences()); + } + + /** + * TODO: JAL-1104 DOCUMENT ME! + * + * @param e + * DOCUMENT ME! + */ + protected void redoMenuItem_actionPerformed() + { + if (viewport.redoList.size() < 1) + { + return; + } + + CommandI command = (CommandI) viewport.redoList.pop(); + viewport.historyList.push(command); + command.doCommand(null); + + AlignViewport originalSource = getOriginatingSource(command); + // JBPNote Test + if (originalSource != viewport) + { + System.err + .println("Warning: Viewport object mismatch whilst re-doing"); + } + originalSource.updateHiddenColumns(); // sethasHiddenColumns(); = + // viewport.getColumnSelection().getHiddenColumns() + // != null; + + updateEditMenuBar(); + originalSource.firePropertyChange("alignment", null, originalSource + .getAlignment().getSequences()); + } + + AlignViewport getOriginatingSource(CommandI command) + { + AlignViewport originalSource = null; + // For sequence removal and addition, we need to fire + // the property change event FROM the viewport where the + // original alignment was altered + AlignmentI al = null; + if (command instanceof EditCommand) + { + EditCommand editCommand = (EditCommand) command; + al = editCommand.getAlignment(); + Vector comps = (Vector) PaintRefresher.components.get(viewport + .getSequenceSetId()); + for (int i = 0; i < comps.size(); i++) + { + if (comps.elementAt(i) instanceof AlignmentPanel) + { + if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment()) + { + originalSource = ((AlignmentPanel) comps.elementAt(i)).av; + break; + } + } + } + } + + if (originalSource == null) + { + // The original view is closed, we must validate + // the current view against the closed view first + if (al != null) + { + PaintRefresher.validateSequences(al, viewport.getAlignment()); + } + + originalSource = viewport; + } + + return originalSource; + } + + public void moveSelectedSequences(boolean up) + { + SequenceGroup sg = viewport.getSelectionGroup(); + if (sg == null) + { + return; + } + viewport.getAlignment().moveSelectedSequencesByOne(sg, + up ? null : viewport.getHiddenRepSequences(), up); + alignPanel.paintAlignment(true); + } + + synchronized void slideSequences(boolean right, int size) + { + List sg = new Vector(); + if (viewport.cursorMode) + { + sg.add(viewport.getAlignment().getSequenceAt( + alignPanel.seqPanel.seqCanvas.cursorY)); + } + else if (viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() != viewport + .getAlignment().getHeight()) + { + sg = viewport.getSelectionGroup().getSequences( + viewport.getHiddenRepSequences()); + } + + if (sg.size() < 1) + { + return; + } + + Vector invertGroup = new Vector(); + + for (int i = 0; i < viewport.getAlignment().getHeight(); i++) + { + if (!sg.contains(viewport.getAlignment().getSequenceAt(i))) + invertGroup.addElement(viewport.getAlignment().getSequenceAt(i)); + } + + SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]); + + SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup + .size()]); + for (int i = 0; i < invertGroup.size(); i++) + seqs2[i] = invertGroup.elementAt(i); + + SlideSequencesCommand ssc; + if (right) + ssc = new SlideSequencesCommand("Slide Sequences", seqs2, seqs1, + size, viewport.getGapCharacter()); + else + ssc = new SlideSequencesCommand("Slide Sequences", seqs1, seqs2, + size, viewport.getGapCharacter()); + + int groupAdjustment = 0; + if (ssc.getGapsInsertedBegin() && right) + { + if (viewport.cursorMode) + alignPanel.seqPanel.moveCursor(size, 0); + else + groupAdjustment = size; + } + else if (!ssc.getGapsInsertedBegin() && !right) + { + if (viewport.cursorMode) + alignPanel.seqPanel.moveCursor(-size, 0); + else + groupAdjustment = -size; + } + + if (groupAdjustment != 0) + { + viewport.getSelectionGroup().setStartRes( + viewport.getSelectionGroup().getStartRes() + groupAdjustment); + viewport.getSelectionGroup().setEndRes( + viewport.getSelectionGroup().getEndRes() + groupAdjustment); + } + + boolean appendHistoryItem = false; + if (viewport.historyList != null && viewport.historyList.size() > 0 + && viewport.historyList.peek() instanceof SlideSequencesCommand) + { + appendHistoryItem = ssc + .appendSlideCommand((SlideSequencesCommand) viewport.historyList + .peek()); + } + + if (!appendHistoryItem) + addHistoryItem(ssc); + + repaint(); + } + + static StringBuffer copiedSequences; + + static Vector copiedHiddenColumns; + + protected void copy_actionPerformed() + { + if (viewport.getSelectionGroup() == null) + { + return; + } + + SequenceGroup sg = viewport.getSelectionGroup(); + copiedSequences = new StringBuffer(); + Hashtable orderedSeqs = new Hashtable(); + for (int i = 0; i < sg.getSize(); i++) + { + SequenceI seq = sg.getSequenceAt(i); + int index = viewport.getAlignment().findIndex(seq); + orderedSeqs.put(index + "", seq); + } + + int index = 0, startRes, endRes; + char ch; + + if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null) + { + copiedHiddenColumns = new Vector(); + int hiddenOffset = viewport.getSelectionGroup().getStartRes(); + for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns() + .size(); i++) + { + int[] region = (int[]) viewport.getColumnSelection() + .getHiddenColumns().elementAt(i); + + copiedHiddenColumns.addElement(new int[] + { region[0] - hiddenOffset, region[1] - hiddenOffset }); + } + } + else + { + copiedHiddenColumns = null; + } + + for (int i = 0; i < sg.getSize(); i++) + { + SequenceI seq = null; + + while (seq == null) + { + if (orderedSeqs.containsKey(index + "")) + { + seq = (SequenceI) orderedSeqs.get(index + ""); + index++; + + break; + } + else + { + index++; + } + } + + // FIND START RES + // Returns residue following index if gap + startRes = seq.findPosition(sg.getStartRes()); + + // FIND END RES + // Need to find the residue preceeding index if gap + endRes = 0; + + for (int j = 0; j < sg.getEndRes() + 1 && j < seq.getLength(); j++) + { + ch = seq.getCharAt(j); + if (!jalview.util.Comparison.isGap((ch))) + { + endRes++; + } + } + + if (endRes > 0) + { + endRes += seq.getStart() - 1; + } + + copiedSequences.append(seq.getName() + + "\t" + + startRes + + "\t" + + endRes + + "\t" + + seq.getSequenceAsString(sg.getStartRes(), + sg.getEndRes() + 1) + "\n"); + } + + } + + protected void pasteNew_actionPerformed() + { + paste(true); + } + + protected void pasteThis_actionPerformed() + { + paste(false); + } + + void paste(boolean newAlignment) + { + try + { + + if (copiedSequences == null) + { + return; + } + + StringTokenizer st = new StringTokenizer(copiedSequences.toString()); + Vector seqs = new Vector(); + while (st.hasMoreElements()) + { + String name = st.nextToken(); + int start = Integer.parseInt(st.nextToken()); + int end = Integer.parseInt(st.nextToken()); + seqs.addElement(new Sequence(name, st.nextToken(), start, end)); + } + SequenceI[] newSeqs = new SequenceI[seqs.size()]; + for (int i = 0; i < seqs.size(); i++) + { + newSeqs[i] = (SequenceI) seqs.elementAt(i); + } + + if (newAlignment) + { + String newtitle = new String("Copied sequences"); + if (getTitle().startsWith("Copied sequences")) + { + newtitle = getTitle(); + } + else + { + newtitle = newtitle.concat("- from " + getTitle()); + } + AlignFrame af = new AlignFrame(new Alignment(newSeqs), + viewport.applet, newtitle, false); + if (copiedHiddenColumns != null) + { + for (int i = 0; i < copiedHiddenColumns.size(); i++) + { + int[] region = (int[]) copiedHiddenColumns.elementAt(i); + af.viewport.hideColumns(region[0], region[1]); + } + } + + jalview.bin.JalviewLite.addFrame(af, newtitle, DEFAULT_WIDTH, + DEFAULT_HEIGHT); + } + else + { + addSequences(newSeqs); + } + + } catch (Exception ex) + { + } // could be anything being pasted in here + + } + + void addSequences(SequenceI[] seqs) + { + for (int i = 0; i < seqs.length; i++) + { + viewport.getAlignment().addSequence(seqs[i]); + } + + // !newAlignment + addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE, + seqs, 0, viewport.getAlignment().getWidth(), + viewport.getAlignment())); + + viewport.setEndSeq(viewport.getAlignment().getHeight()); + viewport.getAlignment().getWidth(); + viewport.firePropertyChange("alignment", null, viewport.getAlignment() + .getSequences()); + + } + + protected void cut_actionPerformed() + { + copy_actionPerformed(); + delete_actionPerformed(); + } + + protected void delete_actionPerformed() + { + + SequenceGroup sg = viewport.getSelectionGroup(); + if (sg == null) + { + return; + } + + Vector seqs = new Vector(); + SequenceI seq; + for (int i = 0; i < sg.getSize(); i++) + { + seq = sg.getSequenceAt(i); + seqs.addElement(seq); + } + + // If the cut affects all sequences, remove highlighted columns + if (sg.getSize() == viewport.getAlignment().getHeight()) + { + viewport.getColumnSelection().removeElements(sg.getStartRes(), + sg.getEndRes() + 1); + } + + SequenceI[] cut = new SequenceI[seqs.size()]; + for (int i = 0; i < seqs.size(); i++) + { + cut[i] = (SequenceI) seqs.elementAt(i); + } + + /* + * //ADD HISTORY ITEM + */ + addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut, + sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1, + viewport.getAlignment())); + + viewport.setSelectionGroup(null); + viewport.getAlignment().deleteGroup(sg); + + viewport.firePropertyChange("alignment", null, viewport.getAlignment() + .getSequences()); + + if (viewport.getAlignment().getHeight() < 1) + { + this.setVisible(false); + } + viewport.sendSelection(); + } + + /** + * group consensus toggled + * + */ + protected void showGroupConsensus_actionPerformed() + { + viewport.setShowGroupConsensus(showGroupConsensus.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + + } + + /** + * group conservation toggled. + */ + protected void showGroupConservation_actionPerformed() + { + viewport.setShowGroupConservation(showGroupConservation.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt + * .event.ActionEvent) + */ + protected void showConsensusHistogram_actionPerformed() + { + viewport.setShowConsensusHistogram(showConsensusHistogram.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt + * .event.ActionEvent) + */ + protected void showSequenceLogo_actionPerformed() + { + viewport.setShowSequenceLogo(showSequenceLogo.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + + protected void normSequenceLogo_actionPerformed() + { + showSequenceLogo.setState(true); + viewport.setShowSequenceLogo(true); + viewport.setNormaliseSequenceLogo(normSequenceLogo.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + + protected void applyAutoAnnotationSettings_actionPerformed() + { + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } + + protected void makeGrpsFromSelection_actionPerformed() + { + if (viewport.getSelectionGroup() != null) + { + SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom( + viewport.getSequenceSelection(), + viewport.getAlignmentView(true).getSequenceStrings( + viewport.getGapCharacter()), viewport.getAlignment() + .getGroups()); + viewport.getAlignment().deleteAllGroups(); + viewport.sequenceColours = null; + viewport.setSelectionGroup(null); + // set view properties for each group + for (int g = 0; g < gps.length; g++) + { + // gps[g].setShowunconserved(viewport.getShowUnconserved()); + gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo()); + viewport.getAlignment().addGroup(gps[g]); + Color col = new Color((int) (Math.random() * 255), + (int) (Math.random() * 255), (int) (Math.random() * 255)); + col = col.brighter(); + for (SequenceI sq : gps[g].getSequences(null)) + viewport.setSequenceColour(sq, col); + } + PaintRefresher.Refresh(this, viewport.getSequenceSetId()); + alignPanel.updateAnnotation(); + alignPanel.paintAlignment(true); + } + } + + protected void deleteGroups_actionPerformed() + { + viewport.getAlignment().deleteAllGroups(); + viewport.sequenceColours = null; + viewport.setSelectionGroup(null); + + alignPanel.paintAlignment(true); + } + + public void selectAllSequenceMenuItem_actionPerformed() + { + SequenceGroup sg = new SequenceGroup(); + for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + { + sg.addSequence(viewport.getAlignment().getSequenceAt(i), false); + } + sg.setEndRes(viewport.getAlignment().getWidth() - 1); + viewport.setSelectionGroup(sg); + alignPanel.paintAlignment(true); + PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); + viewport.sendSelection(); + } + + public void deselectAllSequenceMenuItem_actionPerformed() + { + if (viewport.cursorMode) + { + alignPanel.seqPanel.keyboardNo1 = null; + alignPanel.seqPanel.keyboardNo2 = null; + } + viewport.setSelectionGroup(null); + viewport.getColumnSelection().clear(); + viewport.setSelectionGroup(null); + alignPanel.idPanel.idCanvas.searchResults = null; + alignPanel.seqPanel.seqCanvas.highlightSearchResults(null); + alignPanel.paintAlignment(true); + PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); + viewport.sendSelection(); + } + + public void invertSequenceMenuItem_actionPerformed() + { + SequenceGroup sg = viewport.getSelectionGroup(); + for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + { + sg.addOrRemove(viewport.getAlignment().getSequenceAt(i), false); + } + + PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); + viewport.sendSelection(); + } + + public void invertColSel_actionPerformed() + { + viewport.invertColumnSelection(); + alignPanel.paintAlignment(true); + PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); + viewport.sendSelection(); + } + + void trimAlignment(boolean trimLeft) + { + ColumnSelection colSel = viewport.getColumnSelection(); + int column; + + if (colSel.size() > 0) + { + if (trimLeft) + { + column = colSel.getMin(); + } + else + { + column = colSel.getMax(); + } + + SequenceI[] seqs; + if (viewport.getSelectionGroup() != null) + { + seqs = viewport.getSelectionGroup().getSequencesAsArray( + viewport.getHiddenRepSequences()); + } + else + { + seqs = viewport.getAlignment().getSequencesArray(); + } + + TrimRegionCommand trimRegion; + if (trimLeft) + { + trimRegion = new TrimRegionCommand("Remove Left", + TrimRegionCommand.TRIM_LEFT, seqs, column, + viewport.getAlignment(), viewport.getColumnSelection(), + viewport.getSelectionGroup()); + viewport.setStartRes(0); + } + else + { + trimRegion = new TrimRegionCommand("Remove Right", + TrimRegionCommand.TRIM_RIGHT, seqs, column, + viewport.getAlignment(), viewport.getColumnSelection(), + viewport.getSelectionGroup()); + } + + statusBar.setText("Removed " + trimRegion.getSize() + " columns."); + + addHistoryItem(trimRegion); + + for (SequenceGroup sg : viewport.getAlignment().getGroups()) + { + if ((trimLeft && !sg.adjustForRemoveLeft(column)) + || (!trimLeft && !sg.adjustForRemoveRight(column))) + { + viewport.getAlignment().deleteGroup(sg); + } + } + + viewport.firePropertyChange("alignment", null, viewport + .getAlignment().getSequences()); + } + } + + public void removeGappedColumnMenuItem_actionPerformed() + { + int start = 0, end = viewport.getAlignment().getWidth() - 1; + + SequenceI[] seqs; + if (viewport.getSelectionGroup() != null) + { + seqs = viewport.getSelectionGroup().getSequencesAsArray( + viewport.getHiddenRepSequences()); + start = viewport.getSelectionGroup().getStartRes(); + end = viewport.getSelectionGroup().getEndRes(); + } + else + { + seqs = viewport.getAlignment().getSequencesArray(); + } + + RemoveGapColCommand removeGapCols = new RemoveGapColCommand( + "Remove Gapped Columns", seqs, start, end, + viewport.getAlignment()); + + addHistoryItem(removeGapCols); + + statusBar.setText("Removed " + removeGapCols.getSize() + + " empty columns."); + + // This is to maintain viewport position on first residue + // of first sequence + SequenceI seq = viewport.getAlignment().getSequenceAt(0); + int startRes = seq.findPosition(viewport.startRes); + // ShiftList shifts; + // viewport.getAlignment().removeGaps(shifts=new ShiftList()); + // edit.alColumnChanges=shifts.getInverse(); + // if (viewport.hasHiddenColumns) + // viewport.getColumnSelection().compensateForEdits(shifts); + viewport.setStartRes(seq.findIndex(startRes) - 1); + viewport.firePropertyChange("alignment", null, viewport.getAlignment() + .getSequences()); + + } + + public void removeAllGapsMenuItem_actionPerformed() + { + int start = 0, end = viewport.getAlignment().getWidth() - 1; + + SequenceI[] seqs; + if (viewport.getSelectionGroup() != null) + { + seqs = viewport.getSelectionGroup().getSequencesAsArray( + viewport.getHiddenRepSequences()); + start = viewport.getSelectionGroup().getStartRes(); + end = viewport.getSelectionGroup().getEndRes(); + } + else + { + seqs = viewport.getAlignment().getSequencesArray(); + } + + // This is to maintain viewport position on first residue + // of first sequence + SequenceI seq = viewport.getAlignment().getSequenceAt(0); + int startRes = seq.findPosition(viewport.startRes); + + addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, + viewport.getAlignment())); + + viewport.setStartRes(seq.findIndex(startRes) - 1); + + viewport.firePropertyChange("alignment", null, viewport.getAlignment() + .getSequences()); + + } + + public void findMenuItem_actionPerformed() + { + new Finder(alignPanel); + } + + /** + * create a new view derived from the current view + * + * @param viewtitle + * @return frame for the new view + */ + public AlignFrame newView(String viewtitle) + { + AlignmentI newal; + if (viewport.hasHiddenRows()) + { + newal = new Alignment(viewport.getAlignment().getHiddenSequences() + .getFullAlignment().getSequencesArray()); + } + else + { + newal = new Alignment(viewport.getAlignment().getSequencesArray()); + } + + if (viewport.getAlignment().getAlignmentAnnotation() != null) + { + for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++) + { + if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated) + { + newal.addAnnotation(viewport.getAlignment() + .getAlignmentAnnotation()[i]); + } + } + } + + AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false); + + newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId()); + PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId()); + PaintRefresher.Register(newaf.alignPanel, + newaf.alignPanel.av.getSequenceSetId()); + + PaintRefresher.Register(newaf.alignPanel.idPanel.idCanvas, + newaf.alignPanel.av.getSequenceSetId()); + PaintRefresher.Register(newaf.alignPanel.seqPanel.seqCanvas, + newaf.alignPanel.av.getSequenceSetId()); + + Vector comps = (Vector) PaintRefresher.components.get(viewport + .getSequenceSetId()); + int viewSize = -1; + for (int i = 0; i < comps.size(); i++) + { + if (comps.elementAt(i) instanceof AlignmentPanel) + { + viewSize++; + } + } + + String title = new String(this.getTitle()); + if (viewtitle != null) + { + title = viewtitle + " ( " + title + ")"; + } + else + { + if (title.indexOf("(View") > -1) + { + title = title.substring(0, title.indexOf("(View")); + } + title += "(View " + viewSize + ")"; + } + + newaf.setTitle(title.toString()); + + newaf.viewport.historyList = viewport.historyList; + newaf.viewport.redoList = viewport.redoList; + return newaf; + } + + /** + * + * @return list of feature groups on the view + */ + public String[] getFeatureGroups() + { + FeatureRenderer fr = null; + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + return fr.getGroups(); + } + return null; + } + + /** + * get sequence feature groups that are hidden or shown + * + * @param visible + * true is visible + * @return list + */ + public String[] getFeatureGroupsOfState(boolean visible) + { + FeatureRenderer fr = null; + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + return fr.getGroups(visible); + } + return null; + } + + /** + * Change the display state for the given feature groups + * + * @param groups + * list of group strings + * @param state + * visible or invisible + */ + public void setFeatureGroupState(String[] groups, boolean state) + { + FeatureRenderer fr = null; + this.sequenceFeatures.setState(true); + viewport.showSequenceFeatures(true); + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + fr.setGroupState(groups, state); + alignPanel.seqPanel.seqCanvas.repaint(); + if (alignPanel.overviewPanel != null) + { + alignPanel.overviewPanel.updateOverviewImage(); + } + } + } + + public void seqLimits_itemStateChanged() + { + viewport.setShowJVSuffix(seqLimits.getState()); + alignPanel.fontChanged(); + alignPanel.paintAlignment(true); + } + + protected void colourTextMenuItem_actionPerformed() + { + viewport.setColourText(colourTextMenuItem.getState()); + alignPanel.paintAlignment(true); + } + + protected void displayNonconservedMenuItem_actionPerformed() + { + viewport.setShowunconserved(displayNonconservedMenuItem.getState()); + alignPanel.paintAlignment(true); + } + + protected void wrapMenuItem_actionPerformed() + { + viewport.setWrapAlignment(wrapMenuItem.getState()); + alignPanel.setWrapAlignment(wrapMenuItem.getState()); + scaleAbove.setEnabled(wrapMenuItem.getState()); + scaleLeft.setEnabled(wrapMenuItem.getState()); + scaleRight.setEnabled(wrapMenuItem.getState()); + alignPanel.paintAlignment(true); + } + + public void overviewMenuItem_actionPerformed() + { + if (alignPanel.overviewPanel != null) + { + return; + } + + Frame frame = new Frame(); + OverviewPanel overview = new OverviewPanel(alignPanel); + frame.add(overview); + // +50 must allow for applet frame window + jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(), + overview.getPreferredSize().width, + overview.getPreferredSize().height + 50); + + frame.pack(); + final AlignmentPanel ap = alignPanel; + frame.addWindowListener(new WindowAdapter() + { + @Override + public void windowClosing(WindowEvent e) + { + if (ap != null) + { + ap.setOverviewPanel(null); + } + }; + }); + + alignPanel.setOverviewPanel(overview); + + } + + void changeColour(ColourSchemeI cs) + { + int threshold = 0; + + if (cs != null) + { + if (viewport.getAbovePIDThreshold()) + { + threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, + "Background"); + + cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus()); + + viewport.setGlobalColourScheme(cs); + } + else + { + cs.setThreshold(0, viewport.getIgnoreGapsConsensus()); + } + + if (viewport.getConservationSelected()) + { + + Alignment al = (Alignment) viewport.getAlignment(); + Conservation c = new Conservation("All", + ResidueProperties.propHash, 3, al.getSequences(), 0, + al.getWidth() - 1); + + c.calculate(); + c.verdict(false, viewport.getConsPercGaps()); + + cs.setConservation(c); + + cs.setConservationInc(SliderPanel.setConservationSlider(alignPanel, + cs, "Background")); + + } + else + { + cs.setConservation(null); + } + + cs.setConsensus(viewport.getSequenceConsensusHash()); + + } + viewport.setGlobalColourScheme(cs); + + if (alignPanel.getOverviewPanel() != null) + { + alignPanel.getOverviewPanel().updateOverviewImage(); + } + + jalview.structure.StructureSelectionManager + .getStructureSelectionManager(viewport.applet) + .sequenceColoursChanged(alignPanel); + + alignPanel.paintAlignment(true); + } + + protected void modifyPID_actionPerformed() + { + if (viewport.getAbovePIDThreshold() + && viewport.getGlobalColourScheme() != null) + { + SliderPanel.setPIDSliderSource(alignPanel, + viewport.getGlobalColourScheme(), "Background"); + SliderPanel.showPIDSlider(); + } + } + + protected void modifyConservation_actionPerformed() + { + if (viewport.getConservationSelected() + && viewport.getGlobalColourScheme() != null) + { + SliderPanel.setConservationSlider(alignPanel, + viewport.getGlobalColourScheme(), "Background"); + SliderPanel.showConservationSlider(); + } + } + + protected void conservationMenuItem_actionPerformed() + { + viewport.setConservationSelected(conservationMenuItem.getState()); + + viewport.setAbovePIDThreshold(false); + abovePIDThreshold.setState(false); + + changeColour(viewport.getGlobalColourScheme()); + + modifyConservation_actionPerformed(); + } + + public void abovePIDThreshold_actionPerformed() + { + viewport.setAbovePIDThreshold(abovePIDThreshold.getState()); + + conservationMenuItem.setState(false); + viewport.setConservationSelected(false); + + changeColour(viewport.getGlobalColourScheme()); + + modifyPID_actionPerformed(); + } + + public void sortPairwiseMenuItem_actionPerformed() + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter.sortByPID(viewport.getAlignment(), viewport + .getAlignment().getSequenceAt(0), null); + + addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder, + viewport.getAlignment())); + alignPanel.paintAlignment(true); + } + + public void sortIDMenuItem_actionPerformed() + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter.sortByID(viewport.getAlignment()); + addHistoryItem(new OrderCommand("ID Sort", oldOrder, + viewport.getAlignment())); + alignPanel.paintAlignment(true); + } + + public void sortLengthMenuItem_actionPerformed() + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter.sortByLength(viewport.getAlignment()); + addHistoryItem(new OrderCommand("Length Sort", oldOrder, + viewport.getAlignment())); + alignPanel.paintAlignment(true); + } + + public void sortGroupMenuItem_actionPerformed() + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter.sortByGroup(viewport.getAlignment()); + addHistoryItem(new OrderCommand("Group Sort", oldOrder, + viewport.getAlignment())); + alignPanel.paintAlignment(true); + + } + + public void removeRedundancyMenuItem_actionPerformed() + { + new RedundancyPanel(alignPanel); + } + + public void pairwiseAlignmentMenuItem_actionPerformed() + { + if (viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() > 1) + { + Frame frame = new Frame(); + frame.add(new PairwiseAlignPanel(alignPanel)); + jalview.bin.JalviewLite.addFrame(frame, "Pairwise Alignment", 600, + 500); + } + } + + public void PCAMenuItem_actionPerformed() + { + // are the sequences aligned? + if (!viewport.getAlignment().isAligned(false)) + { + SequenceI current; + int Width = viewport.getAlignment().getWidth(); + + for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + { + current = viewport.getAlignment().getSequenceAt(i); + + if (current.getLength() < Width) + { + current.insertCharAt(Width - 1, viewport.getGapCharacter()); + } + } + alignPanel.paintAlignment(true); + } + + if ((viewport.getSelectionGroup() != null + && viewport.getSelectionGroup().getSize() < 4 && viewport + .getSelectionGroup().getSize() > 0) + || viewport.getAlignment().getHeight() < 4) + { + return; + } + + try + { + new PCAPanel(viewport); + } catch (java.lang.OutOfMemoryError ex) + { + } + + } + + public void averageDistanceTreeMenuItem_actionPerformed() + { + NewTreePanel("AV", "PID", "Average distance tree using PID"); + } + + public void neighbourTreeMenuItem_actionPerformed() + { + NewTreePanel("NJ", "PID", "Neighbour joining tree using PID"); + } + + protected void njTreeBlosumMenuItem_actionPerformed() + { + NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62"); + } + + protected void avTreeBlosumMenuItem_actionPerformed() + { + NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62"); + } + + void NewTreePanel(String type, String pwType, String title) + { + // are the sequences aligned? + if (!viewport.getAlignment().isAligned(false)) + { + SequenceI current; + int Width = viewport.getAlignment().getWidth(); + + for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++) + { + current = viewport.getAlignment().getSequenceAt(i); + + if (current.getLength() < Width) + { + current.insertCharAt(Width - 1, viewport.getGapCharacter()); + } + } + alignPanel.paintAlignment(true); + + } + + if ((viewport.getSelectionGroup() != null && viewport + .getSelectionGroup().getSize() > 1) + || (viewport.getAlignment().getHeight() > 1)) + { + final TreePanel tp = new TreePanel(alignPanel, type, pwType); + + addTreeMenuItem(tp, title); + + jalview.bin.JalviewLite.addFrame(tp, title, 600, 500); + } + } + + void loadTree_actionPerformed() + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); + cap.setText("Paste your Newick tree file here."); + cap.setTreeImport(); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Paste Newick file ", 400, 300); + } + + public void loadTree(jalview.io.NewickFile tree, String treeFile) + { + TreePanel tp = new TreePanel(alignPanel, treeFile, "From File - ", tree); + jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500); + addTreeMenuItem(tp, treeFile); + } + + /** + * sort the alignment using the given treePanel + * + * @param treePanel + * tree used to sort view + * @param title + * string used for undo event name + */ + public void sortByTree(TreePanel treePanel, String title) + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + AlignmentSorter + .sortByTree(viewport.getAlignment(), treePanel.getTree()); + // addHistoryItem(new HistoryItem("Sort", viewport.alignment, + // HistoryItem.SORT)); + addHistoryItem(new OrderCommand("Order by " + title, oldOrder, + viewport.getAlignment())); + alignPanel.paintAlignment(true); + } + + /** + * Do any automatic reordering of the alignment and add the necessary bits to + * the menu structure for the new tree + * + * @param treePanel + * @param title + */ + protected void addTreeMenuItem(final TreePanel treePanel, + final String title) + { + final MenuItem item = new MenuItem(title); + sortByTreeMenu.add(item); + item.addActionListener(new java.awt.event.ActionListener() + { + @Override + public void actionPerformed(ActionEvent evt) + { + sortByTree(treePanel, title); // treePanel.getTitle()); + } + }); + + treePanel.addWindowListener(new WindowAdapter() + { + @Override + public void windowOpened(WindowEvent e) + { + if (viewport.sortByTree) + { + sortByTree(treePanel, title); + } + super.windowOpened(e); + } + + @Override + public void windowClosing(WindowEvent e) + { + sortByTreeMenu.remove(item); + }; + }); + } + + public boolean sortBy(AlignmentOrder alorder, String undoname) + { + SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray(); + if (viewport.applet.debug) + { + System.err.println("Sorting " + alorder.getOrder().size() + + " in alignment '" + getTitle() + "'"); + } + AlignmentSorter.sortBy(viewport.getAlignment(), alorder); + if (undoname != null) + { + addHistoryItem(new OrderCommand(undoname, oldOrder, + viewport.getAlignment())); + } + alignPanel.paintAlignment(true); + return true; + } + + protected void documentation_actionPerformed() + { + alignPanel.av.applet.openJalviewHelpUrl(); + } + + protected void about_actionPerformed() + { + + class AboutPanel extends Canvas + { + String version; + + String builddate; + + public AboutPanel(String version, String builddate) + { + this.version = version; + this.builddate = builddate; + } + + @Override + public void paint(Graphics g) + { + g.setColor(Color.white); + g.fillRect(0, 0, getSize().width, getSize().height); + g.setFont(new Font("Helvetica", Font.PLAIN, 12)); + FontMetrics fm = g.getFontMetrics(); + int fh = fm.getHeight(); + int y = 5, x = 7; + g.setColor(Color.black); + // TODO: update this text for each release or centrally store it for + // lite and application + g.setFont(new Font("Helvetica", Font.BOLD, 14)); + g.drawString("JalviewLite - Release " + version, x, y += fh); + g.setFont(new Font("Helvetica", Font.BOLD, 12)); + g.drawString("Build date: " + builddate, x, y += fh); + g.setFont(new Font("Helvetica", Font.PLAIN, 12)); + g.drawString( + "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,", + x, y += fh * 1.5); + g.drawString("David Martin & Geoff Barton.", x + 50, y += fh); + g.drawString( + "Development managed by The Barton Group, University of Dundee, Scotland, UK.", + x, y += fh); + g.drawString( + "For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list", + x, y += fh); + g.drawString("If you use Jalview, please cite:", x, y += fh + 8); + g.drawString( + "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)", + x, y += fh); + g.drawString( + "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench", + x, y += fh); + g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", + x, y += fh); + } + } + + Frame frame = new Frame(); + frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite + .getBuildDate())); + jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 220); + + } + + public void showURL(String url, String target) + { + if (viewport.applet == null) + { + System.out.println("Not running as applet - no browser available."); + } + else + { + viewport.applet.showURL(url, target); + } + } + + // //////////////////////////////////////////////////////////////////////////////// + // JBuilder Graphics here + + MenuBar alignFrameMenuBar = new MenuBar(); + + Menu fileMenu = new Menu("File"); + + MenuItem loadApplication = new MenuItem("View in Full Application"); + + MenuItem loadTree = new MenuItem("Load Associated Tree ..."); + + MenuItem loadAnnotations = new MenuItem("Load Features/Annotations ..."); + + MenuItem outputFeatures = new MenuItem("Export Features ..."); + + MenuItem outputAnnotations = new MenuItem("Export Annotations ..."); + + MenuItem closeMenuItem = new MenuItem("Close"); + + Menu editMenu = new Menu("Edit"); + + Menu viewMenu = new Menu("View"); + + Menu colourMenu = new Menu("Colour"); + + Menu calculateMenu = new Menu("Calculate"); + + MenuItem selectAllSequenceMenuItem = new MenuItem("Select all"); + + MenuItem deselectAllSequenceMenuItem = new MenuItem("Deselect All"); + + MenuItem invertSequenceMenuItem = new MenuItem("Invert Selection"); + + MenuItem remove2LeftMenuItem = new MenuItem(); + + MenuItem remove2RightMenuItem = new MenuItem(); + + MenuItem removeGappedColumnMenuItem = new MenuItem(); + + MenuItem removeAllGapsMenuItem = new MenuItem(); + + CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem(); + + CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem(); + + MenuItem sortPairwiseMenuItem = new MenuItem(); + + MenuItem sortIDMenuItem = new MenuItem(); + + MenuItem sortLengthMenuItem = new MenuItem(); + + MenuItem sortGroupMenuItem = new MenuItem(); + + MenuItem removeRedundancyMenuItem = new MenuItem(); + + MenuItem pairwiseAlignmentMenuItem = new MenuItem(); + + MenuItem PCAMenuItem = new MenuItem(); + + MenuItem averageDistanceTreeMenuItem = new MenuItem(); + + MenuItem neighbourTreeMenuItem = new MenuItem(); + + BorderLayout borderLayout1 = new BorderLayout(); + + public Label statusBar = new Label(); + + Menu outputTextboxMenu = new Menu(); + + MenuItem clustalColour = new MenuItem(); + + MenuItem zappoColour = new MenuItem(); + + MenuItem taylorColour = new MenuItem(); + + MenuItem hydrophobicityColour = new MenuItem(); + + MenuItem helixColour = new MenuItem(); + + MenuItem strandColour = new MenuItem(); + + MenuItem turnColour = new MenuItem(); + + MenuItem buriedColour = new MenuItem(); + + MenuItem purinePyrimidineColour = new MenuItem(); + + MenuItem RNAHelixColour = new MenuItem(); + + MenuItem userDefinedColour = new MenuItem(); + + MenuItem PIDColour = new MenuItem(); + + MenuItem BLOSUM62Colour = new MenuItem(); + + MenuItem tcoffeeColour = new MenuItem(); + + MenuItem njTreeBlosumMenuItem = new MenuItem(); + + MenuItem avDistanceTreeBlosumMenuItem = new MenuItem(); + + CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem(); + + CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem(); + + CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem(); + + MenuItem alProperties = new MenuItem("Alignment Properties..."); + + MenuItem overviewMenuItem = new MenuItem(); + + MenuItem undoMenuItem = new MenuItem(); + + MenuItem redoMenuItem = new MenuItem(); + + CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem(); + + MenuItem noColourmenuItem = new MenuItem(); + + CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem(); + + CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem(); + + MenuItem findMenuItem = new MenuItem(); + + CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem(); + + MenuItem nucleotideColour = new MenuItem(); + + MenuItem deleteGroups = new MenuItem(); + + MenuItem grpsFromSelection = new MenuItem(); + + MenuItem delete = new MenuItem(); + + MenuItem copy = new MenuItem(); + + MenuItem cut = new MenuItem(); + + Menu pasteMenu = new Menu(); + + MenuItem pasteNew = new MenuItem(); + + MenuItem pasteThis = new MenuItem(); + + CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem(); + + MenuItem font = new MenuItem(); + + CheckboxMenuItem scaleAbove = new CheckboxMenuItem(); + + CheckboxMenuItem scaleLeft = new CheckboxMenuItem(); + + CheckboxMenuItem scaleRight = new CheckboxMenuItem(); + + MenuItem modifyPID = new MenuItem(); + + MenuItem modifyConservation = new MenuItem(); + + CheckboxMenuItem autoCalculate = new CheckboxMenuItem( + "Autocalculate Consensus", true); + + CheckboxMenuItem sortByTree = new CheckboxMenuItem( + "Sort Alignment With New Tree", true); + + Menu sortByTreeMenu = new Menu(); + + Menu sort = new Menu(); + + Menu calculate = new Menu(); + + MenuItem inputText = new MenuItem(); + + Menu helpMenu = new Menu(); + + MenuItem documentation = new MenuItem(); + + MenuItem about = new MenuItem(); + + CheckboxMenuItem seqLimits = new CheckboxMenuItem(); + + CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem(); + + CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem(); + + Menu autoAnnMenu = new Menu(); + + CheckboxMenuItem showSequenceLogo = new CheckboxMenuItem(); + + CheckboxMenuItem applyAutoAnnotationSettings = new CheckboxMenuItem(); + + CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem(); + + CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem(); + + CheckboxMenuItem showGroupConservation = new CheckboxMenuItem(); + + CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem(); + + private void jbInit() throws Exception + { + + setMenuBar(alignFrameMenuBar); + + MenuItem item; + + // dynamically fill save as menu with available formats + for (int i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++) + { + + item = new MenuItem( + jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]); + + item.addActionListener(new java.awt.event.ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + outputText_actionPerformed(e); + } + }); + + outputTextboxMenu.add(item); + } + closeMenuItem.addActionListener(this); + loadApplication.addActionListener(this); + + loadTree.addActionListener(this); + loadAnnotations.addActionListener(this); + outputFeatures.addActionListener(this); + outputAnnotations.addActionListener(this); + selectAllSequenceMenuItem.addActionListener(this); + deselectAllSequenceMenuItem.addActionListener(this); + invertSequenceMenuItem.addActionListener(this); + remove2LeftMenuItem.setLabel("Remove Left"); + remove2LeftMenuItem.addActionListener(this); + remove2RightMenuItem.setLabel("Remove Right"); + remove2RightMenuItem.addActionListener(this); + removeGappedColumnMenuItem.setLabel("Remove Empty Columns"); + removeGappedColumnMenuItem.addActionListener(this); + removeAllGapsMenuItem.setLabel("Remove All Gaps"); + removeAllGapsMenuItem.addActionListener(this); + viewBoxesMenuItem.setLabel("Boxes"); + viewBoxesMenuItem.setState(true); + viewBoxesMenuItem.addItemListener(this); + viewTextMenuItem.setLabel("Text"); + viewTextMenuItem.setState(true); + viewTextMenuItem.addItemListener(this); + sortPairwiseMenuItem.setLabel("by Pairwise Identity"); + sortPairwiseMenuItem.addActionListener(this); + sortIDMenuItem.setLabel("by ID"); + sortIDMenuItem.addActionListener(this); + sortLengthMenuItem.setLabel("by Length"); + sortLengthMenuItem.addActionListener(this); + sortGroupMenuItem.setLabel("by Group"); + sortGroupMenuItem.addActionListener(this); + removeRedundancyMenuItem.setLabel("Remove Redundancy..."); + removeRedundancyMenuItem.addActionListener(this); + pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments..."); + pairwiseAlignmentMenuItem.addActionListener(this); + PCAMenuItem.setLabel("Principal Component Analysis"); + PCAMenuItem.addActionListener(this); + averageDistanceTreeMenuItem + .setLabel("Average Distance Using % Identity"); + averageDistanceTreeMenuItem.addActionListener(this); + neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity"); + neighbourTreeMenuItem.addActionListener(this); + statusBar.setBackground(Color.white); + statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); + statusBar.setText("Status bar"); + outputTextboxMenu.setLabel("Output to Textbox"); + clustalColour.setLabel("Clustalx"); + + clustalColour.addActionListener(this); + zappoColour.setLabel("Zappo"); + zappoColour.addActionListener(this); + taylorColour.setLabel("Taylor"); + taylorColour.addActionListener(this); + hydrophobicityColour.setLabel("Hydrophobicity"); + hydrophobicityColour.addActionListener(this); + helixColour.setLabel("Helix Propensity"); + helixColour.addActionListener(this); + strandColour.setLabel("Strand Propensity"); + strandColour.addActionListener(this); + turnColour.setLabel("Turn Propensity"); + turnColour.addActionListener(this); + buriedColour.setLabel("Buried Index"); + buriedColour.addActionListener(this); + purinePyrimidineColour.setLabel("Purine/Pyrimidine"); + purinePyrimidineColour.addActionListener(this); + RNAHelixColour.setLabel("by RNA Helices"); + RNAHelixColour.addActionListener(this); + userDefinedColour.setLabel("User Defined..."); + userDefinedColour.addActionListener(this); + PIDColour.setLabel("Percentage Identity"); + PIDColour.addActionListener(this); + BLOSUM62Colour.setLabel("BLOSUM62 Score"); + BLOSUM62Colour.addActionListener(this); + tcoffeeColour.setLabel("T-Coffee Scores"); + tcoffeeColour.setEnabled(false); // it will enabled only if a score file is + // provided + tcoffeeColour.addActionListener(this); + avDistanceTreeBlosumMenuItem + .setLabel("Average Distance Using BLOSUM62"); + avDistanceTreeBlosumMenuItem.addActionListener(this); + njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62"); + njTreeBlosumMenuItem.addActionListener(this); + annotationPanelMenuItem.setLabel("Show Annotations"); + annotationPanelMenuItem.addItemListener(this); + colourTextMenuItem.setLabel("Colour Text"); + colourTextMenuItem.addItemListener(this); + displayNonconservedMenuItem.setLabel("Show nonconserved"); + displayNonconservedMenuItem.addItemListener(this); + alProperties.addActionListener(this); + overviewMenuItem.setLabel("Overview Window"); + overviewMenuItem.addActionListener(this); + undoMenuItem.setEnabled(false); + undoMenuItem.setLabel("Undo"); + undoMenuItem.addActionListener(this); + redoMenuItem.setEnabled(false); + redoMenuItem.setLabel("Redo"); + redoMenuItem.addActionListener(this); + conservationMenuItem.setLabel("by Conservation"); + conservationMenuItem.addItemListener(this); + noColourmenuItem.setLabel("None"); + noColourmenuItem.addActionListener(this); + wrapMenuItem.setLabel("Wrap"); + wrapMenuItem.addItemListener(this); + renderGapsMenuItem.setLabel("Show Gaps"); + renderGapsMenuItem.setState(true); + renderGapsMenuItem.addItemListener(this); + findMenuItem.setLabel("Find..."); + findMenuItem.addActionListener(this); + abovePIDThreshold.setLabel("Above Identity Threshold"); + abovePIDThreshold.addItemListener(this); + nucleotideColour.setLabel("Nucleotide"); + nucleotideColour.addActionListener(this); + deleteGroups.setLabel("Undefine Groups"); + deleteGroups.addActionListener(this); + grpsFromSelection.setLabel("Make Groups for selection"); + grpsFromSelection.addActionListener(this); + copy.setLabel("Copy"); + copy.addActionListener(this); + cut.setLabel("Cut"); + cut.addActionListener(this); + delete.setLabel("Delete"); + delete.addActionListener(this); + pasteMenu.setLabel("Paste"); + pasteNew.setLabel("To New Alignment"); + pasteNew.addActionListener(this); + pasteThis.setLabel("Add To This Alignment"); + pasteThis.addActionListener(this); + applyToAllGroups.setLabel("Apply Colour To All Groups"); + applyToAllGroups.setState(true); + applyToAllGroups.addItemListener(this); + font.setLabel("Font..."); + font.addActionListener(this); + scaleAbove.setLabel("Scale Above"); + scaleAbove.setState(true); + scaleAbove.setEnabled(false); + scaleAbove.addItemListener(this); + scaleLeft.setEnabled(false); + scaleLeft.setState(true); + scaleLeft.setLabel("Scale Left"); + scaleLeft.addItemListener(this); + scaleRight.setEnabled(false); + scaleRight.setState(true); + scaleRight.setLabel("Scale Right"); + scaleRight.addItemListener(this); + modifyPID.setLabel("Modify Identity Threshold..."); + modifyPID.addActionListener(this); + modifyConservation.setLabel("Modify Conservation Threshold..."); + modifyConservation.addActionListener(this); + sortByTreeMenu.setLabel("By Tree Order"); + sort.setLabel("Sort"); + calculate.setLabel("Calculate Tree"); + autoCalculate.addItemListener(this); + sortByTree.addItemListener(this); + inputText.setLabel("Input from textbox"); + inputText.addActionListener(this); + centreColumnLabelFlag.setLabel("Centre column labels"); + centreColumnLabelFlag.addItemListener(this); + followMouseOverFlag.setLabel("Automatic Scrolling"); + followMouseOverFlag.addItemListener(this); + helpMenu.setLabel("Help"); + documentation.setLabel("Documentation"); + documentation.addActionListener(this); + + about.setLabel("About..."); + about.addActionListener(this); + seqLimits.setState(true); + seqLimits.setLabel("Show Sequence Limits"); + seqLimits.addItemListener(this); + featureSettings.setLabel("Feature Settings..."); + featureSettings.addActionListener(this); + sequenceFeatures.setLabel("Sequence Features"); + sequenceFeatures.addItemListener(this); + sequenceFeatures.setState(false); + annotationColour.setLabel("by Annotation..."); + annotationColour.addActionListener(this); + invertSequenceMenuItem.setLabel("Invert Sequence Selection"); + invertColSel.setLabel("Invert Column Selection"); + menu1.setLabel("Show"); + showColumns.setLabel("All Columns "); + showSeqs.setLabel("All Sequences"); + menu2.setLabel("Hide"); + hideColumns.setLabel("Selected Columns"); + hideSequences.setLabel("Selected Sequences"); + hideAllButSelection.setLabel("All but Selected Region (Shift+Ctrl+H)"); + hideAllSelection.setLabel("Selected Region"); + showAllHidden.setLabel("All Sequences and Columns"); + showGroupConsensus.setLabel("Group Consensus"); + showGroupConservation.setLabel("Group Conservation"); + showConsensusHistogram.setLabel("Show Consensus Histogram"); + showSequenceLogo.setLabel("Show Consensus Logo"); + normSequenceLogo.setLabel("Normalise Consensus Logo"); + applyAutoAnnotationSettings.setLabel("Apply to all groups"); + applyAutoAnnotationSettings.setState(true); + autoAnnMenu.setLabel("Autocalculated Annotation"); + + invertColSel.addActionListener(this); + showColumns.addActionListener(this); + showSeqs.addActionListener(this); + hideColumns.addActionListener(this); + hideSequences.addActionListener(this); + hideAllButSelection.addActionListener(this); + hideAllSelection.addActionListener(this); + showAllHidden.addActionListener(this); + showGroupConsensus.addItemListener(this); + showGroupConservation.addItemListener(this); + showConsensusHistogram.addItemListener(this); + showSequenceLogo.addItemListener(this); + normSequenceLogo.addItemListener(this); + + applyAutoAnnotationSettings.addItemListener(this); + formatMenu.setLabel("Format"); + selectMenu.setLabel("Select"); + newView.setLabel("New View"); + newView.addActionListener(this); + alignFrameMenuBar.add(fileMenu); + alignFrameMenuBar.add(editMenu); + alignFrameMenuBar.add(selectMenu); + alignFrameMenuBar.add(viewMenu); + alignFrameMenuBar.add(formatMenu); + alignFrameMenuBar.add(colourMenu); + alignFrameMenuBar.add(calculateMenu); + alignFrameMenuBar.add(helpMenu); + + fileMenu.add(inputText); + fileMenu.add(loadTree); + fileMenu.add(loadAnnotations); + + fileMenu.addSeparator(); + fileMenu.add(outputTextboxMenu); + fileMenu.add(outputFeatures); + fileMenu.add(outputAnnotations); + + if (jalviewServletURL != null) + { + fileMenu.add(loadApplication); + } + + fileMenu.addSeparator(); + fileMenu.add(closeMenuItem); + + editMenu.add(undoMenuItem); + editMenu.add(redoMenuItem); + editMenu.add(cut); + editMenu.add(copy); + editMenu.add(pasteMenu); + editMenu.add(delete); + editMenu.addSeparator(); + editMenu.add(remove2LeftMenuItem); + editMenu.add(remove2RightMenuItem); + editMenu.add(removeGappedColumnMenuItem); + editMenu.add(removeAllGapsMenuItem); + editMenu.add(removeRedundancyMenuItem); + viewMenu.add(newView); + viewMenu.addSeparator(); + viewMenu.add(menu1); + viewMenu.add(menu2); + viewMenu.addSeparator(); + viewMenu.add(followMouseOverFlag); + viewMenu.add(annotationPanelMenuItem); + autoAnnMenu.add(applyAutoAnnotationSettings); + autoAnnMenu.add(showConsensusHistogram); + autoAnnMenu.add(showSequenceLogo); + autoAnnMenu.add(normSequenceLogo); + autoAnnMenu.addSeparator(); + autoAnnMenu.add(showGroupConservation); + autoAnnMenu.add(showGroupConsensus); + viewMenu.add(autoAnnMenu); + viewMenu.addSeparator(); + viewMenu.add(sequenceFeatures); + viewMenu.add(featureSettings); + viewMenu.addSeparator(); + viewMenu.add(alProperties); + viewMenu.addSeparator(); + viewMenu.add(overviewMenuItem); + colourMenu.add(applyToAllGroups); + colourMenu.addSeparator(); + colourMenu.add(noColourmenuItem); + colourMenu.add(clustalColour); + colourMenu.add(BLOSUM62Colour); + colourMenu.add(PIDColour); + colourMenu.add(zappoColour); + colourMenu.add(taylorColour); + colourMenu.add(hydrophobicityColour); + colourMenu.add(helixColour); + colourMenu.add(strandColour); + colourMenu.add(turnColour); + colourMenu.add(buriedColour); + colourMenu.add(nucleotideColour); + colourMenu.add(purinePyrimidineColour); + colourMenu.add(tcoffeeColour); + colourMenu.add(userDefinedColour); + colourMenu.addSeparator(); + colourMenu.add(conservationMenuItem); + colourMenu.add(modifyConservation); + colourMenu.add(abovePIDThreshold); + colourMenu.add(modifyPID); + colourMenu.add(annotationColour); + colourMenu.add(RNAHelixColour); + calculateMenu.add(sort); + calculateMenu.add(calculate); + calculateMenu.addSeparator(); + calculateMenu.add(pairwiseAlignmentMenuItem); + calculateMenu.add(PCAMenuItem); + calculateMenu.add(autoCalculate); + calculateMenu.add(sortByTree); + this.add(statusBar, BorderLayout.SOUTH); + pasteMenu.add(pasteNew); + pasteMenu.add(pasteThis); + sort.add(sortIDMenuItem); + sort.add(sortLengthMenuItem); + sort.add(sortByTreeMenu); + sort.add(sortGroupMenuItem); + sort.add(sortPairwiseMenuItem); + calculate.add(averageDistanceTreeMenuItem); + calculate.add(neighbourTreeMenuItem); + calculate.add(avDistanceTreeBlosumMenuItem); + calculate.add(njTreeBlosumMenuItem); + helpMenu.add(documentation); + helpMenu.add(about); + menu1.add(showColumns); + menu1.add(showSeqs); + menu1.add(showAllHidden); + menu2.add(hideColumns); + menu2.add(hideSequences); + menu2.add(hideAllSelection); + menu2.add(hideAllButSelection); + formatMenu.add(font); + formatMenu.add(seqLimits); + formatMenu.add(wrapMenuItem); + formatMenu.add(scaleAbove); + formatMenu.add(scaleLeft); + formatMenu.add(scaleRight); + formatMenu.add(viewBoxesMenuItem); + formatMenu.add(viewTextMenuItem); + formatMenu.add(colourTextMenuItem); + formatMenu.add(displayNonconservedMenuItem); + formatMenu.add(renderGapsMenuItem); + formatMenu.add(centreColumnLabelFlag); + selectMenu.add(findMenuItem); + selectMenu.addSeparator(); + selectMenu.add(selectAllSequenceMenuItem); + selectMenu.add(deselectAllSequenceMenuItem); + selectMenu.add(invertSequenceMenuItem); + selectMenu.add(invertColSel); + selectMenu.add(grpsFromSelection); + selectMenu.add(deleteGroups); + + } + + MenuItem featureSettings = new MenuItem(); + + CheckboxMenuItem sequenceFeatures = new CheckboxMenuItem(); + + MenuItem annotationColour = new MenuItem(); + + MenuItem invertColSel = new MenuItem(); + + Menu menu1 = new Menu(); + + MenuItem showColumns = new MenuItem(); + + MenuItem showSeqs = new MenuItem(); + + Menu menu2 = new Menu(); + + MenuItem hideColumns = new MenuItem(); + + MenuItem hideSequences = new MenuItem(); + + MenuItem hideAllButSelection = new MenuItem(); + + MenuItem hideAllSelection = new MenuItem(); + + MenuItem showAllHidden = new MenuItem(); + + Menu formatMenu = new Menu(); + + Menu selectMenu = new Menu(); + + MenuItem newView = new MenuItem(); + + /** + * Attach the alignFrame panels after embedding menus, if necessary. This used + * to be called setEmbedded, but is now creates the dropdown menus in a + * platform independent manner to avoid OSX/Mac menu appendage daftness. + * + * @param reallyEmbedded + * true to attach the view to the applet area on the page rather than + * in a new window + */ + public void createAlignFrameWindow(boolean reallyEmbedded, String title) + { + if (reallyEmbedded) + { + // //// + // Explicly build the embedded menu panel for the on-page applet + // + // view cannot be closed if its actually on the page + fileMenu.remove(closeMenuItem); + fileMenu.remove(3); // Remove Seperator + embeddedMenu = makeEmbeddedPopupMenu(alignFrameMenuBar, "Arial", + Font.PLAIN, 10, false); // use our own fonts. + // and actually add the components to the applet area + viewport.applet.setLayout(new BorderLayout()); + viewport.applet.add(embeddedMenu, BorderLayout.NORTH); + viewport.applet.add(statusBar, BorderLayout.SOUTH); + alignPanel.setSize(viewport.applet.getSize().width, + viewport.applet.getSize().height - embeddedMenu.HEIGHT + - statusBar.HEIGHT); + viewport.applet.add(alignPanel, BorderLayout.CENTER); + final AlignFrame me = this; + viewport.applet.addFocusListener(new FocusListener() + { + + @Override + public void focusLost(FocusEvent e) + { + if (me.viewport.applet.currentAlignFrame == me) + { + me.viewport.applet.currentAlignFrame = null; + } + } + + @Override + public void focusGained(FocusEvent e) + { + me.viewport.applet.currentAlignFrame = me; + } + }); + viewport.applet.validate(); + } + else + { + // ////// + // test and embed menu bar if necessary. + // + if (embedMenuIfNeeded(alignPanel)) + { + // adjust for status bar height too + alignPanel.setSize(getSize().width, getSize().height + - statusBar.HEIGHT); + } + add(statusBar, BorderLayout.SOUTH); + add(alignPanel, BorderLayout.CENTER); + // and register with the applet so it can pass external API calls to us + jalview.bin.JalviewLite.addFrame(this, title, DEFAULT_WIDTH, + DEFAULT_HEIGHT); + } + } + + /** + * create a new binding between structures in an existing jmol viewer instance + * and an alignpanel with sequences that have existing PDBFile entries. Note, + * this does not open a new Jmol window, or modify the display of the + * structures in the original jmol window. Note This method doesn't work + * without an additional javascript library to exchange messages between the + * distinct applets. See http://issues.jalview.org/browse/JAL-621 + * + * @param viewer + * JmolViewer instance + * @param sequenceIds + * - sequence Ids to search for associations + */ + public SequenceStructureBinding addStructureViewInstance( + Object jmolviewer, String[] sequenceIds) + { + org.jmol.api.JmolViewer viewer = null; + try + { + viewer = (org.jmol.api.JmolViewer) jmolviewer; + } catch (ClassCastException ex) + { + System.err.println("Unsupported viewer object :" + + jmolviewer.getClass()); + } + if (viewer == null) + { + System.err.println("Can't use this object as a structure viewer:" + + jmolviewer.getClass()); + return null; + } + SequenceI[] seqs = null; + if (sequenceIds == null || sequenceIds.length == 0) + { + seqs = viewport.getAlignment().getSequencesArray(); + } + else + { + Vector sqi = new Vector(); + AlignmentI al = viewport.getAlignment(); + for (int sid = 0; sid < sequenceIds.length; sid++) + { + SequenceI sq = al.findName(sequenceIds[sid]); + if (sq != null) + { + sqi.addElement(sq); + } + } + if (sqi.size() > 0) + { + seqs = new SequenceI[sqi.size()]; + for (int sid = 0, sSize = sqi.size(); sid < sSize; sid++) + { + seqs[sid] = (SequenceI) sqi.elementAt(sid); + } + } + else + { + return null; + } + } + ExtJmol jmv = null; + // TODO: search for a jmv that involves viewer + if (jmv == null) + { // create a new viewer/jalview binding. + jmv = new ExtJmol(viewer, alignPanel, new SequenceI[][] + { seqs }); + } + return jmv; + + } + + /** + * bind a pdb file to a sequence in the current view + * + * @param sequenceId + * - sequenceId within the dataset. + * @param pdbEntryString + * - the short name for the PDB file + * @param pdbFile + * - pdb file - either a URL or a valid PDB file. + * @return true if binding was as success TODO: consider making an exception + * structure for indicating when PDB parsing or sequenceId location + * fails. + */ + public boolean addPdbFile(String sequenceId, String pdbEntryString, + String pdbFile) + { + SequenceI toaddpdb = viewport.getAlignment().findName(sequenceId); + boolean needtoadd = false; + if (toaddpdb != null) + { + Vector pdbe = toaddpdb.getPDBId(); + PDBEntry pdbentry = null; + if (pdbe != null && pdbe.size() > 0) + { + for (int pe = 0, peSize = pdbe.size(); pe < peSize; pe++) + { + pdbentry = (PDBEntry) pdbe.elementAt(pe); + if (!pdbentry.getId().equals(pdbEntryString) + && !pdbentry.getFile().equals(pdbFile)) + { + pdbentry = null; + } + else + { + continue; + } + } + } + if (pdbentry == null) + { + pdbentry = new PDBEntry(); + pdbentry.setId(pdbEntryString); + pdbentry.setFile(pdbFile); + needtoadd = true; // add this new entry to sequence. + } + // resolve data source + // TODO: this code should be a refactored to an io package + String protocol = AppletFormatAdapter.resolveProtocol(pdbFile, "PDB"); + if (protocol == null) + { + return false; + } + if (needtoadd) + { + // make a note of the access mode and add + if (pdbentry.getProperty() == null) + { + pdbentry.setProperty(new Hashtable()); + } + pdbentry.getProperty().put("protocol", protocol); + toaddpdb.addPDBId(pdbentry); + } + } + return true; + } + + private Object[] cleanSeqChainArrays(SequenceI[] seqs, String[] chains) + { + if (seqs != null) + { + Vector sequences = new Vector(); + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i] != null) + { + sequences.addElement(new Object[] + { seqs[i], (chains != null) ? chains[i] : null }); + } + } + seqs = new SequenceI[sequences.size()]; + chains = new String[sequences.size()]; + for (int i = 0, isize = sequences.size(); i < isize; i++) + { + Object[] oj = (Object[]) sequences.elementAt(i); + + seqs[i] = (SequenceI) oj[0]; + chains[i] = (String) oj[1]; + } + } + return new Object[] + { seqs, chains }; + + } + + public void newStructureView(JalviewLite applet, PDBEntry pdb, + SequenceI[] seqs, String[] chains, String protocol) + { + // Scrub any null sequences from the array + Object[] sqch = cleanSeqChainArrays(seqs, chains); + seqs = (SequenceI[]) sqch[0]; + chains = (String[]) sqch[1]; + if (seqs == null || seqs.length == 0) + { + System.err + .println("JalviewLite.AlignFrame:newStructureView: No sequence to bind structure to."); + } + if (protocol == null || protocol.trim().length() == 0 + || protocol.equals("null")) + { + protocol = (String) pdb.getProperty().get("protocol"); + if (protocol == null) + { + System.err.println("Couldn't work out protocol to open structure: " + + pdb.getId()); + return; + } + } + if (applet.useXtrnalSviewer) + { + // register the association(s) and quit, don't create any windows. + if (StructureSelectionManager.getStructureSelectionManager(applet) + .setMapping(seqs, chains, pdb.getFile(), protocol) == null) + { + System.err.println("Failed to map " + pdb.getFile() + " (" + + protocol + ") to any sequences"); + } + return; + } + if (applet.isAlignPdbStructures() && applet.jmolAvailable) + { + // can only do alignments with Jmol + // find the last jmol window assigned to this alignment + jalview.appletgui.AppletJmol ajm = null, tajm; + Vector jmols = applet + .getAppletWindow(jalview.appletgui.AppletJmol.class); + for (int i = 0, iSize = jmols.size(); i < iSize; i++) + { + tajm = (jalview.appletgui.AppletJmol) jmols.elementAt(i); + if (tajm.ap.alignFrame == this) + { + ajm = tajm; + break; + } + } + if (ajm != null) + { + System.err + .println("Incremental adding and aligning structure to existing Jmol view not yet implemented."); + // try and add the pdb structure + // ajm.addS + ajm = null; + } + } + // otherwise, create a new window + if (applet.jmolAvailable) + { + new jalview.appletgui.AppletJmol(pdb, seqs, chains, alignPanel, + protocol); + applet.lastFrameX += 40; + applet.lastFrameY += 40; + } + else + { + new MCview.AppletPDBViewer(pdb, seqs, chains, alignPanel, protocol); + } + + } + + public void alignedStructureView(JalviewLite applet, PDBEntry[] pdb, + SequenceI[][] seqs, String[][] chains, String[] protocols) + { + // TODO Auto-generated method stub + System.err.println("Aligned Structure View: Not yet implemented."); + } + + /** + * modify the current selection, providing the user has not made a selection + * already. + * + * @param sel + * - sequences from this alignment + * @param csel + * - columns to be selected on the alignment + */ + public void select(SequenceGroup sel, ColumnSelection csel) + { + alignPanel.seqPanel.selection(sel, csel, null); + } + + public void scrollTo(int row, int column) + { + alignPanel.seqPanel.scrollTo(row, column); + } + + public void scrollToRow(int row) + { + alignPanel.seqPanel.scrollToRow(row); + } + + public void scrollToColumn(int column) + { + alignPanel.seqPanel.scrollToColumn(column); + } + + /** + * @return the alignments unique ID. + */ + public String getSequenceSetId() + { + return viewport.getSequenceSetId(); + } + + /** + * Load the (T-Coffee) score file from the specified url + * + * @param source + * File/URL/T-COFFEE score file contents + * @throws IOException + * @return true if alignment was annotated with data from source + */ + public boolean loadScoreFile(String source) throws IOException + { + + TCoffeeScoreFile file = new TCoffeeScoreFile(source, + AppletFormatAdapter.checkProtocol(source)); + if (!file.isValid()) + { + // TODO: raise dialog for gui + System.err.println("Problems parsing T-Coffee scores: " + + file.getWarningMessage()); + System.err.println("Origin was:\n" + source); + return false; + } + + /* + * check that the score matrix matches the alignment dimensions + */ + AlignmentI aln; + if ((aln = viewport.getAlignment()) != null + && (aln.getHeight() != file.getHeight() || aln.getWidth() != file + .getWidth())) + { + // TODO: raise a dialog box here rather than bomb out. + System.err + .println("The scores matrix does not match the alignment dimensions"); + + } + + // TODO add parameter to indicate if matching should be done + if (file.annotateAlignment(alignPanel.getAlignment(), false)) + { + alignPanel.fontChanged(); + tcoffeeColour.setEnabled(true); + // switch to this color + changeColour(new TCoffeeColourScheme(alignPanel.getAlignment())); + return true; + } + else + { + System.err.println("Problems resolving T-Coffee scores:"); + if (file.getWarningMessage() != null) + { + System.err.println(file.getWarningMessage()); + } + } + return false; + } + +} diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index bf6cce3..5264019 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index 51ade37..6c866ee 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index 04864b1..8b891e5 100755 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 963efee..d20881b 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 59cdb11..4800a13 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.appletgui; diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 562ff72..299b70c 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 26a3636..6ee68e8 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 4cc0f44..c7a49f3 100755 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/EditNameDialog.java b/src/jalview/appletgui/EditNameDialog.java index 99ffbf6..7eaa6f5 100644 --- a/src/jalview/appletgui/EditNameDialog.java +++ b/src/jalview/appletgui/EditNameDialog.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/EmbmenuFrame.java b/src/jalview/appletgui/EmbmenuFrame.java index cdaca2b..858a5a3 100644 --- a/src/jalview/appletgui/EmbmenuFrame.java +++ b/src/jalview/appletgui/EmbmenuFrame.java @@ -1,314 +1,314 @@ -/* - * 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 . - */ -package jalview.appletgui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Container; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.Frame; -import java.awt.GraphicsConfiguration; -import java.awt.HeadlessException; -import java.awt.Label; -import java.awt.Menu; -import java.awt.MenuBar; -import java.awt.Panel; -import java.awt.PopupMenu; -import java.awt.event.ActionListener; -import java.awt.event.ItemListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.Enumeration; -import java.util.Hashtable; - -/** - * This class implements a pattern form embedding toolbars as a panel with - * popups for situations where the system menu bar is either invisible or - * inappropriate. It was derived from the code for embedding the jalview applet - * alignFrame as a component on the web-page, which requires the local - * alignFrame menu to be attached to that panel rather than placed on the parent - * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so - * it looks like a real toolbar menu TODO: modify click/mouse handler for - * embeddedMenu so it behaves more like a real pulldown menu toolbar - * - * @author Jim Procter and Andrew Waterhouse - * - */ -public class EmbmenuFrame extends Frame implements MouseListener -{ - /** - * map from labels to popup menus for the embedded menubar - */ - protected Hashtable embeddedPopup; - - /** - * the embedded menu is built on this and should be added to the frame at the - * appropriate position. - * - */ - protected Panel embeddedMenu; - - public EmbmenuFrame() throws HeadlessException - { - super(); - } - - public EmbmenuFrame(String title) throws HeadlessException - { - super(title); - } - - /** - * Check if the applet is running on a platform that requires the Frame - * menuBar to be embedded, and if so, embeds it. - * - * @param tobeAdjusted - * the panel that is to be reduced to make space for the embedded - * menu bar - * @return true if menuBar was embedded and tobeAdjusted's height modified - */ - protected boolean embedMenuIfNeeded(Panel tobeAdjusted) - { - MenuBar topMenuBar = getMenuBar(); - if (topMenuBar == null) - { - return false; - } - // DEBUG Hint: can test embedded menus by inserting true here. - if (new jalview.util.Platform().isAMac()) - { - // Build the embedded menu panel - embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, "Arial", Font.PLAIN, - 10, true); // try to pickup system font. - setMenuBar(null); - // add the components to the TreePanel area. - add(embeddedMenu, BorderLayout.NORTH); - tobeAdjusted.setSize(getSize().width, getSize().height - - embeddedMenu.HEIGHT); - return true; - } - return false; - } - - /** - * move all menus on menuBar onto embeddedMenu. embeddedPopup is used to store - * the popups for each menu removed from the menuBar and added to the panel. - * NOTE: it is up to the caller to remove menuBar from the Frame if it is - * already attached. - * - * @param menuBar - * @param fn - * @param fstyle - * @param fsz - * @param overrideFonts - * true if we take the menuBar fonts in preference to the supplied - * defaults - * @return the embedded menu instance to be added to the frame. - */ - protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, - int fstyle, int fsz, boolean overrideFonts) - { - return makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, overrideFonts, - false); - } - - /** - * Create or add elements to the embedded menu from menuBar. This removes all - * menu from menuBar and it is up to the caller to remove the now useless - * menuBar from the Frame if it is already attached. - * - * @param menuBar - * @param fn - * @param fstyle - * @param fsz - * @param overrideFonts - * @param append - * true means existing menu will be emptied before adding new - * elements - * @return - */ - protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, - int fstyle, int fsz, boolean overrideFonts, boolean append) - { - if (!append) - { - if (embeddedPopup != null) - { - embeddedPopup.clear(); // TODO: check if j1.1 - } - if (embeddedMenu != null) - { - embeddedMenu.removeAll(); - } - } - if (embeddedPopup == null) - { - embeddedPopup = new Hashtable(); - } - - embeddedMenu = makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, - overrideFonts, embeddedPopup, new Panel(), this); - return embeddedMenu; - } - - /** - * Generic method to move elements from menubar onto embeddedMenu using the - * existing or the supplied font, and adds binding from panel to attached - * menus in embeddedPopup This removes all menu from menuBar and it is up to - * the caller to remove the now useless menuBar from the Frame if it is - * already attached. - * - * @param menuBar - * must be non-null - * @param fn - * @param fstyle - * @param fsz - * @param overrideFonts - * @param embeddedPopup - * must be non-null - * @param embeddedMenu - * if null, a new panel will be created and returned - * @param clickHandler - * - usually the instance of EmbmenuFrame that holds references to - * embeddedPopup and embeddedMenu - * @return the panel instance for convenience. - */ - protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, - int fstyle, int fsz, boolean overrideFonts, - Hashtable embeddedPopup, Panel embeddedMenu, - MouseListener clickHandler) - { - if (embeddedPopup == null) - { - throw new Error( - "Implementation error - embeddedPopup must be non-null"); - } - if (overrideFonts) - { - Font mbf = menuBar.getFont(); - if (mbf != null) - { - fn = mbf.getName(); - fstyle = mbf.getStyle(); - fsz = mbf.getSize(); - } - } - if (embeddedMenu == null) - embeddedMenu = new Panel(); - FlowLayout flowLayout1 = new FlowLayout(); - embeddedMenu.setBackground(Color.lightGray); - embeddedMenu.setLayout(flowLayout1); - // loop thru - for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++) - { - Menu mi = menuBar.getMenu(mbi); - Label elab = new Label(mi.getLabel()); - elab.setFont(new java.awt.Font(fn, fstyle, fsz)); - // add the menu entries - PopupMenu popup = new PopupMenu(); - int m, mSize = mi.getItemCount(); - for (m = 0; m < mSize; m++) - { - popup.add(mi.getItem(m)); - mSize--; - m--; - } - embeddedPopup.put(elab, popup); - embeddedMenu.add(elab); - elab.addMouseListener(clickHandler); - } - flowLayout1.setAlignment(FlowLayout.LEFT); - flowLayout1.setHgap(2); - flowLayout1.setVgap(0); - return embeddedMenu; - } - - public void mousePressed(MouseEvent evt) - { - PopupMenu popup = null; - Label source = (Label) evt.getSource(); - popup = getPopupMenu(source); - if (popup != null) - { - embeddedMenu.add(popup); - popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y - + source.getBounds().getSize().height); - } - } - - /** - * get the menu for source from the hash. - * - * @param source - * what was clicked on. - */ - PopupMenu getPopupMenu(Label source) - { - return (PopupMenu) embeddedPopup.get(source); - } - - public void mouseClicked(MouseEvent evt) - { - } - - public void mouseReleased(MouseEvent evt) - { - } - - public void mouseEntered(MouseEvent evt) - { - } - - public void mouseExited(MouseEvent evt) - { - } - - /** - * called to clear the GUI resources taken up for embedding and remove any - * self references so we can be garbage collected. - */ - public void destroyMenus() - { - if (embeddedPopup != null) - { - Enumeration e = embeddedPopup.keys(); - while (e.hasMoreElements()) - { - Label lb = (Label) e.nextElement(); - lb.removeMouseListener(this); - } - embeddedPopup.clear(); - } - if (embeddedMenu != null) - { - embeddedMenu.removeAll(); - } - } - - /** - * calls destroyMenus() - */ - public void finalize() throws Throwable - { - destroyMenus(); - embeddedPopup = null; - embeddedMenu = null; - super.finalize(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.appletgui; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.HeadlessException; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.event.ActionListener; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Enumeration; +import java.util.Hashtable; + +/** + * This class implements a pattern form embedding toolbars as a panel with + * popups for situations where the system menu bar is either invisible or + * inappropriate. It was derived from the code for embedding the jalview applet + * alignFrame as a component on the web-page, which requires the local + * alignFrame menu to be attached to that panel rather than placed on the parent + * (which isn't allowed anyhow). TODO: try to modify the embeddedMenu display so + * it looks like a real toolbar menu TODO: modify click/mouse handler for + * embeddedMenu so it behaves more like a real pulldown menu toolbar + * + * @author Jim Procter and Andrew Waterhouse + * + */ +public class EmbmenuFrame extends Frame implements MouseListener +{ + /** + * map from labels to popup menus for the embedded menubar + */ + protected Hashtable embeddedPopup; + + /** + * the embedded menu is built on this and should be added to the frame at the + * appropriate position. + * + */ + protected Panel embeddedMenu; + + public EmbmenuFrame() throws HeadlessException + { + super(); + } + + public EmbmenuFrame(String title) throws HeadlessException + { + super(title); + } + + /** + * Check if the applet is running on a platform that requires the Frame + * menuBar to be embedded, and if so, embeds it. + * + * @param tobeAdjusted + * the panel that is to be reduced to make space for the embedded + * menu bar + * @return true if menuBar was embedded and tobeAdjusted's height modified + */ + protected boolean embedMenuIfNeeded(Panel tobeAdjusted) + { + MenuBar topMenuBar = getMenuBar(); + if (topMenuBar == null) + { + return false; + } + // DEBUG Hint: can test embedded menus by inserting true here. + if (new jalview.util.Platform().isAMac()) + { + // Build the embedded menu panel + embeddedMenu = makeEmbeddedPopupMenu(topMenuBar, "Arial", Font.PLAIN, + 10, true); // try to pickup system font. + setMenuBar(null); + // add the components to the TreePanel area. + add(embeddedMenu, BorderLayout.NORTH); + tobeAdjusted.setSize(getSize().width, getSize().height + - embeddedMenu.HEIGHT); + return true; + } + return false; + } + + /** + * move all menus on menuBar onto embeddedMenu. embeddedPopup is used to store + * the popups for each menu removed from the menuBar and added to the panel. + * NOTE: it is up to the caller to remove menuBar from the Frame if it is + * already attached. + * + * @param menuBar + * @param fn + * @param fstyle + * @param fsz + * @param overrideFonts + * true if we take the menuBar fonts in preference to the supplied + * defaults + * @return the embedded menu instance to be added to the frame. + */ + protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, + int fstyle, int fsz, boolean overrideFonts) + { + return makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, overrideFonts, + false); + } + + /** + * Create or add elements to the embedded menu from menuBar. This removes all + * menu from menuBar and it is up to the caller to remove the now useless + * menuBar from the Frame if it is already attached. + * + * @param menuBar + * @param fn + * @param fstyle + * @param fsz + * @param overrideFonts + * @param append + * true means existing menu will be emptied before adding new + * elements + * @return + */ + protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, + int fstyle, int fsz, boolean overrideFonts, boolean append) + { + if (!append) + { + if (embeddedPopup != null) + { + embeddedPopup.clear(); // TODO: check if j1.1 + } + if (embeddedMenu != null) + { + embeddedMenu.removeAll(); + } + } + if (embeddedPopup == null) + { + embeddedPopup = new Hashtable(); + } + + embeddedMenu = makeEmbeddedPopupMenu(menuBar, fn, fstyle, fsz, + overrideFonts, embeddedPopup, new Panel(), this); + return embeddedMenu; + } + + /** + * Generic method to move elements from menubar onto embeddedMenu using the + * existing or the supplied font, and adds binding from panel to attached + * menus in embeddedPopup This removes all menu from menuBar and it is up to + * the caller to remove the now useless menuBar from the Frame if it is + * already attached. + * + * @param menuBar + * must be non-null + * @param fn + * @param fstyle + * @param fsz + * @param overrideFonts + * @param embeddedPopup + * must be non-null + * @param embeddedMenu + * if null, a new panel will be created and returned + * @param clickHandler + * - usually the instance of EmbmenuFrame that holds references to + * embeddedPopup and embeddedMenu + * @return the panel instance for convenience. + */ + protected Panel makeEmbeddedPopupMenu(MenuBar menuBar, String fn, + int fstyle, int fsz, boolean overrideFonts, + Hashtable embeddedPopup, Panel embeddedMenu, + MouseListener clickHandler) + { + if (embeddedPopup == null) + { + throw new Error( + "Implementation error - embeddedPopup must be non-null"); + } + if (overrideFonts) + { + Font mbf = menuBar.getFont(); + if (mbf != null) + { + fn = mbf.getName(); + fstyle = mbf.getStyle(); + fsz = mbf.getSize(); + } + } + if (embeddedMenu == null) + embeddedMenu = new Panel(); + FlowLayout flowLayout1 = new FlowLayout(); + embeddedMenu.setBackground(Color.lightGray); + embeddedMenu.setLayout(flowLayout1); + // loop thru + for (int mbi = 0, nMbi = menuBar.getMenuCount(); mbi < nMbi; mbi++) + { + Menu mi = menuBar.getMenu(mbi); + Label elab = new Label(mi.getLabel()); + elab.setFont(new java.awt.Font(fn, fstyle, fsz)); + // add the menu entries + PopupMenu popup = new PopupMenu(); + int m, mSize = mi.getItemCount(); + for (m = 0; m < mSize; m++) + { + popup.add(mi.getItem(m)); + mSize--; + m--; + } + embeddedPopup.put(elab, popup); + embeddedMenu.add(elab); + elab.addMouseListener(clickHandler); + } + flowLayout1.setAlignment(FlowLayout.LEFT); + flowLayout1.setHgap(2); + flowLayout1.setVgap(0); + return embeddedMenu; + } + + public void mousePressed(MouseEvent evt) + { + PopupMenu popup = null; + Label source = (Label) evt.getSource(); + popup = getPopupMenu(source); + if (popup != null) + { + embeddedMenu.add(popup); + popup.show(embeddedMenu, source.getBounds().x, source.getBounds().y + + source.getBounds().getSize().height); + } + } + + /** + * get the menu for source from the hash. + * + * @param source + * what was clicked on. + */ + PopupMenu getPopupMenu(Label source) + { + return (PopupMenu) embeddedPopup.get(source); + } + + public void mouseClicked(MouseEvent evt) + { + } + + public void mouseReleased(MouseEvent evt) + { + } + + public void mouseEntered(MouseEvent evt) + { + } + + public void mouseExited(MouseEvent evt) + { + } + + /** + * called to clear the GUI resources taken up for embedding and remove any + * self references so we can be garbage collected. + */ + public void destroyMenus() + { + if (embeddedPopup != null) + { + Enumeration e = embeddedPopup.keys(); + while (e.hasMoreElements()) + { + Label lb = (Label) e.nextElement(); + lb.removeMouseListener(this); + } + embeddedPopup.clear(); + } + if (embeddedMenu != null) + { + embeddedMenu.removeAll(); + } + } + + /** + * calls destroyMenus() + */ + public void finalize() throws Throwable + { + destroyMenus(); + embeddedPopup = null; + embeddedMenu = null; + super.finalize(); + } +} diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index bbddd26..f73fb41 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 4f67357..20ecc8e 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 86d8b30..f5bc39b 100755 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index e8305b8..db7d9b3 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 45a9712..7722461 100755 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 69aca49..5df659b 100755 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index a3eac2d..a35be15 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index eaceacc..3adaa14 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/IdwidthAdjuster.java b/src/jalview/appletgui/IdwidthAdjuster.java index 6495750..24509a6 100755 --- a/src/jalview/appletgui/IdwidthAdjuster.java +++ b/src/jalview/appletgui/IdwidthAdjuster.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/JVDialog.java b/src/jalview/appletgui/JVDialog.java index a722458..c73fbc7 100644 --- a/src/jalview/appletgui/JVDialog.java +++ b/src/jalview/appletgui/JVDialog.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 68b3d01..ae8a85b 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.appletgui; diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 14f0a45..b6d3a9c 100755 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java index 9d6eba5..7cd5aff 100755 --- a/src/jalview/appletgui/PaintRefresher.java +++ b/src/jalview/appletgui/PaintRefresher.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.appletgui; diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index de6a53e..8841864 100755 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index bd4ac64..ef00017 100755 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index 978c52f..e8294ba 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index ab76f7f..baa4165 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 2dceac5..efe43b8 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index a5dfb83..5238750 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 5c159fb..d444630 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index dce39ea..90d5227 100755 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java index 52b40e5..be03c52 100755 --- a/src/jalview/appletgui/Tooltip.java +++ b/src/jalview/appletgui/Tooltip.java @@ -1,233 +1,233 @@ -/* - * 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 . - */ -package jalview.appletgui; - -import java.applet.*; -import java.util.*; - -import java.awt.*; -import java.awt.event.*; - -public class Tooltip extends Canvas implements MouseListener, - MouseMotionListener -{ - private String[] tip; - - private String lastTip = ""; - - private boolean setPosition = false; - - protected Component owner; - - private Container mainContainer; - - private LayoutManager mainLayout; - - private boolean shown; - - private final int VERTICAL_OFFSET = 20; - - private final int HORIZONTAL_ENLARGE = 10; - - int fontHeight = 0; - - Image linkImage; - - FontMetrics fm; - - public Tooltip(String tip, Component owner) - { - this.owner = owner; - owner.addMouseListener(this); - owner.addMouseMotionListener(this); - setBackground(new Color(255, 255, 220)); - setTip(tip); - java.net.URL url = getClass().getResource("/images/link.gif"); - if (url != null) - { - linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url); - } - } - - public void paint(Graphics g) - { - int w = getSize().width; - int h = getSize().height; - - g.drawRect(0, 0, w - 1, h - 1); - int lindex, x; - for (int i = 0; i < tip.length; i++) - { - x = 3; - lindex = tip[i].indexOf("%LINK%"); - if (lindex != -1) - { - if (lindex > 0) - { - g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight - - 3); - x += fm.stringWidth(tip[i].substring(0, lindex) + 3); - } - g.drawImage(linkImage, x, i * fontHeight + 1, this); - if (lindex + 6 < tip[i].length()) - { - g.drawString(tip[i].substring(lindex + 6), - x + linkImage.getWidth(this), (i + 1) * fontHeight - 3); - } - } - else - { - g.drawString(tip[i], 3, (i + 1) * fontHeight - 3); - } - } - } - - synchronized void setTip(String tip) - { - if (tip == null) - { - setTip(""); - return; - } - - if (lastTip.equals(tip)) - { - return; - } - - lastTip = tip; - setPosition = true; - - fm = getFontMetrics(owner.getFont()); - fontHeight = fm.getHeight(); - - int longestLine = 0; - StringTokenizer st = new StringTokenizer(tip, "\n"); - this.tip = new String[st.countTokens()]; - int index = 0; - while (st.hasMoreElements()) - { - this.tip[index] = st.nextToken(); - if (fm.stringWidth(this.tip[index]) > longestLine) - { - longestLine = fm.stringWidth(this.tip[index]); - } - index++; - } - - setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length); - - repaint(); - - } - - void setTipLocation(MouseEvent evt) - { - if (mainContainer == null || owner == null) - { - return; - } - setLocation( - (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x) - + evt.getX(), - (owner.getLocationOnScreen().y - - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET) - + evt.getY()); - - // correction, whole tool tip must be visible - if (mainContainer.getSize().width < (getLocation().x + getSize().width)) - { - setLocation(mainContainer.getSize().width - getSize().width, - getLocation().y); - } - } - - private void removeToolTip() - { - if (shown) - { - mainContainer.remove(0); - mainContainer.setLayout(mainLayout); - mainContainer.validate(); - } - shown = false; - } - - private void findMainContainer() - { - Container parent = owner.getParent(); - while (true) - { - if ((parent instanceof Applet) || (parent instanceof Frame)) - { - mainContainer = parent; - break; - } - else - { - parent = parent.getParent(); - } - } - mainLayout = mainContainer.getLayout(); - } - - public void mouseEntered(MouseEvent me) - { - setTipLocation(me); - } - - public void mouseExited(MouseEvent me) - { - removeToolTip(); - } - - public void mousePressed(MouseEvent me) - { - removeToolTip(); - } - - public void mouseReleased(MouseEvent me) - { - } - - public void mouseClicked(MouseEvent me) - { - } - - public void mouseMoved(MouseEvent me) - { - if (!shown) - { - findMainContainer(); - mainContainer.setLayout(null); - mainContainer.add(this, 0); - mainContainer.validate(); - shown = true; - setTipLocation(me); - } - else if (setPosition) - { - setTipLocation(me); - setPosition = false; - } - } - - public void mouseDragged(MouseEvent me) - { - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.appletgui; + +import java.applet.*; +import java.util.*; + +import java.awt.*; +import java.awt.event.*; + +public class Tooltip extends Canvas implements MouseListener, + MouseMotionListener +{ + private String[] tip; + + private String lastTip = ""; + + private boolean setPosition = false; + + protected Component owner; + + private Container mainContainer; + + private LayoutManager mainLayout; + + private boolean shown; + + private final int VERTICAL_OFFSET = 20; + + private final int HORIZONTAL_ENLARGE = 10; + + int fontHeight = 0; + + Image linkImage; + + FontMetrics fm; + + public Tooltip(String tip, Component owner) + { + this.owner = owner; + owner.addMouseListener(this); + owner.addMouseMotionListener(this); + setBackground(new Color(255, 255, 220)); + setTip(tip); + java.net.URL url = getClass().getResource("/images/link.gif"); + if (url != null) + { + linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url); + } + } + + public void paint(Graphics g) + { + int w = getSize().width; + int h = getSize().height; + + g.drawRect(0, 0, w - 1, h - 1); + int lindex, x; + for (int i = 0; i < tip.length; i++) + { + x = 3; + lindex = tip[i].indexOf("%LINK%"); + if (lindex != -1) + { + if (lindex > 0) + { + g.drawString(tip[i].substring(0, lindex), 3, (i + 1) * fontHeight + - 3); + x += fm.stringWidth(tip[i].substring(0, lindex) + 3); + } + g.drawImage(linkImage, x, i * fontHeight + 1, this); + if (lindex + 6 < tip[i].length()) + { + g.drawString(tip[i].substring(lindex + 6), + x + linkImage.getWidth(this), (i + 1) * fontHeight - 3); + } + } + else + { + g.drawString(tip[i], 3, (i + 1) * fontHeight - 3); + } + } + } + + synchronized void setTip(String tip) + { + if (tip == null) + { + setTip(""); + return; + } + + if (lastTip.equals(tip)) + { + return; + } + + lastTip = tip; + setPosition = true; + + fm = getFontMetrics(owner.getFont()); + fontHeight = fm.getHeight(); + + int longestLine = 0; + StringTokenizer st = new StringTokenizer(tip, "\n"); + this.tip = new String[st.countTokens()]; + int index = 0; + while (st.hasMoreElements()) + { + this.tip[index] = st.nextToken(); + if (fm.stringWidth(this.tip[index]) > longestLine) + { + longestLine = fm.stringWidth(this.tip[index]); + } + index++; + } + + setSize(longestLine + HORIZONTAL_ENLARGE, fontHeight * this.tip.length); + + repaint(); + + } + + void setTipLocation(MouseEvent evt) + { + if (mainContainer == null || owner == null) + { + return; + } + setLocation( + (owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x) + + evt.getX(), + (owner.getLocationOnScreen().y + - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET) + + evt.getY()); + + // correction, whole tool tip must be visible + if (mainContainer.getSize().width < (getLocation().x + getSize().width)) + { + setLocation(mainContainer.getSize().width - getSize().width, + getLocation().y); + } + } + + private void removeToolTip() + { + if (shown) + { + mainContainer.remove(0); + mainContainer.setLayout(mainLayout); + mainContainer.validate(); + } + shown = false; + } + + private void findMainContainer() + { + Container parent = owner.getParent(); + while (true) + { + if ((parent instanceof Applet) || (parent instanceof Frame)) + { + mainContainer = parent; + break; + } + else + { + parent = parent.getParent(); + } + } + mainLayout = mainContainer.getLayout(); + } + + public void mouseEntered(MouseEvent me) + { + setTipLocation(me); + } + + public void mouseExited(MouseEvent me) + { + removeToolTip(); + } + + public void mousePressed(MouseEvent me) + { + removeToolTip(); + } + + public void mouseReleased(MouseEvent me) + { + } + + public void mouseClicked(MouseEvent me) + { + } + + public void mouseMoved(MouseEvent me) + { + if (!shown) + { + findMainContainer(); + mainContainer.setLayout(null); + mainContainer.add(this, 0); + mainContainer.validate(); + shown = true; + setTipLocation(me); + } + else if (setPosition) + { + setTipLocation(me); + setPosition = false; + } + } + + public void mouseDragged(MouseEvent me) + { + } +} diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index 217217e..5c62234 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.appletgui; diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 28d101c..8c18b5b 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index 73df35f..4735006 100755 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 2ba6e3a..5d26b85 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index 7920fa9..717fa83 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 5f75c18..438bd7d 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -1,2747 +1,2747 @@ -/* - * 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 . - */ -package jalview.bin; - -import jalview.api.StructureSelectionManagerProvider; -import jalview.appletgui.AlignFrame; -import jalview.appletgui.AlignViewport; -import jalview.appletgui.EmbmenuFrame; -import jalview.appletgui.FeatureSettings; -import jalview.datamodel.Alignment; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentOrder; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.Sequence; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.io.AnnotationFile; -import jalview.io.AppletFormatAdapter; -import jalview.io.FileParse; -import jalview.io.IdentifyFile; -import jalview.io.JnetAnnotationMaker; -import jalview.javascript.JSFunctionExec; -import jalview.javascript.JalviewLiteJsApi; -import jalview.javascript.JsCallBack; -import jalview.structure.SelectionListener; -import jalview.structure.StructureSelectionManager; - -import java.applet.Applet; -import java.awt.Button; -import java.awt.Color; -import java.awt.Component; -import java.awt.EventQueue; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Graphics; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.Hashtable; -import java.util.StringTokenizer; -import java.util.Vector; - -import netscape.javascript.JSObject; - -/** - * Jalview Applet. Runs in Java 1.18 runtime - * - * @author $author$ - * @version $Revision: 1.92 $ - */ -public class JalviewLite extends Applet implements - StructureSelectionManagerProvider, JalviewLiteJsApi -{ - - public StructureSelectionManager getStructureSelectionManager() - { - return StructureSelectionManager.getStructureSelectionManager(this); - } - - // ///////////////////////////////////////// - // The following public methods maybe called - // externally, eg via javascript in HTML page - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences() - */ - public String getSelectedSequences() - { - return getSelectedSequencesFrom(getDefaultTargetFrame()); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String) - */ - public String getSelectedSequences(String sep) - { - return getSelectedSequencesFrom(getDefaultTargetFrame(), sep); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui - * .AlignFrame) - */ - public String getSelectedSequencesFrom(AlignFrame alf) - { - return getSelectedSequencesFrom(alf, separator); // ""+0x00AC); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui - * .AlignFrame, java.lang.String) - */ - public String getSelectedSequencesFrom(AlignFrame alf, String sep) - { - StringBuffer result = new StringBuffer(""); - if (sep == null || sep.length() == 0) - { - sep = separator; // "+0x00AC; - } - if (alf.viewport.getSelectionGroup() != null) - { - SequenceI[] seqs = alf.viewport.getSelectionGroup() - .getSequencesInOrder(alf.viewport.getAlignment()); - - for (int i = 0; i < seqs.length; i++) - { - result.append(seqs[i].getName()); - result.append(sep); - } - } - - return result.toString(); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void highlight(String sequenceId, String position, - String alignedPosition) - { - highlightIn(getDefaultTargetFrame(), sequenceId, position, - alignedPosition); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String, java.lang.String) - */ - public void highlightIn(final AlignFrame alf, final String sequenceId, - final String position, final String alignedPosition) - { - // TODO: could try to highlight in all alignments if alf==null - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - alf.viewport.getAlignment().getSequencesArray()); - final SequenceI sq = matcher.findIdMatch(sequenceId); - if (sq != null) - { - int apos = -1; - try - { - apos = new Integer(position).intValue(); - apos--; - } catch (NumberFormatException ex) - { - return; - } - final StructureSelectionManagerProvider me = this; - final int pos = apos; - // use vamsas listener to broadcast to all listeners in scope - if (alignedPosition != null - && (alignedPosition.trim().length() == 0 || alignedPosition - .toLowerCase().indexOf("false") > -1)) - { - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - StructureSelectionManager.getStructureSelectionManager(me) - .mouseOverVamsasSequence(sq, sq.findIndex(pos), null); - } - }); - } - else - { - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - StructureSelectionManager.getStructureSelectionManager(me) - .mouseOverVamsasSequence(sq, pos, null); - } - }); - } - } - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, - * java.lang.String) - */ - public void select(String sequenceIds, String columns) - { - selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void select(String sequenceIds, String columns, String sep) - { - selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String) - */ - public void selectIn(AlignFrame alf, String sequenceIds, String columns) - { - selectIn(alf, sequenceIds, columns, separator); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String, java.lang.String) - */ - public void selectIn(final AlignFrame alf, String sequenceIds, - String columns, String sep) - { - if (sep == null || sep.length() == 0) - { - sep = separator; - } - else - { - if (debug) - { - System.err.println("Selecting region using separator string '" - + separator + "'"); - } - } - // deparse fields - String[] ids = separatorListToArray(sequenceIds, sep); - String[] cols = separatorListToArray(columns, sep); - final SequenceGroup sel = new SequenceGroup(); - final ColumnSelection csel = new ColumnSelection(); - AlignmentI al = alf.viewport.getAlignment(); - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - alf.viewport.getAlignment().getSequencesArray()); - int start = 0, end = al.getWidth(), alw = al.getWidth(); - boolean seqsfound = true; - if (ids != null && ids.length > 0) - { - seqsfound = false; - for (int i = 0; i < ids.length; i++) - { - if (ids[i].trim().length() == 0) - { - continue; - } - SequenceI sq = matcher.findIdMatch(ids[i]); - if (sq != null) - { - seqsfound = true; - sel.addSequence(sq, false); - } - } - } - boolean inseqpos = false; - if (cols != null && cols.length > 0) - { - boolean seset = false; - for (int i = 0; i < cols.length; i++) - { - String cl = cols[i].trim(); - if (cl.length() == 0) - { - continue; - } - int p; - if ((p = cl.indexOf("-")) > -1) - { - int from = -1, to = -1; - try - { - from = new Integer(cl.substring(0, p)).intValue(); - from--; - } catch (NumberFormatException ex) - { - System.err - .println("ERROR: Couldn't parse first integer in range element column selection string '" - + cl + "' - format is 'from-to'"); - return; - } - try - { - to = new Integer(cl.substring(p + 1)).intValue(); - to--; - } catch (NumberFormatException ex) - { - System.err - .println("ERROR: Couldn't parse second integer in range element column selection string '" - + cl + "' - format is 'from-to'"); - return; - } - if (from >= 0 && to >= 0) - { - // valid range - if (from < to) - { - int t = to; - to = from; - to = t; - } - if (!seset) - { - start = from; - end = to; - seset = true; - } - else - { - // comment to prevent range extension - if (start > from) - { - start = from; - } - if (end < to) - { - end = to; - } - } - for (int r = from; r <= to; r++) - { - if (r >= 0 && r < alw) - { - csel.addElement(r); - } - } - if (debug) - { - System.err.println("Range '" + cl + "' deparsed as [" + from - + "," + to + "]"); - } - } - else - { - System.err.println("ERROR: Invalid Range '" + cl - + "' deparsed as [" + from + "," + to + "]"); - } - } - else - { - int r = -1; - try - { - r = new Integer(cl).intValue(); - r--; - } catch (NumberFormatException ex) - { - if (cl.toLowerCase().equals("sequence")) - { - // we are in the dataset sequence's coordinate frame. - inseqpos = true; - } - else - { - System.err - .println("ERROR: Couldn't parse integer from point selection element of column selection string '" - + cl + "'"); - return; - } - } - if (r >= 0 && r <= alw) - { - if (!seset) - { - start = r; - end = r; - seset = true; - } - else - { - // comment to prevent range extension - if (start > r) - { - start = r; - } - if (end < r) - { - end = r; - } - } - csel.addElement(r); - if (debug) - { - System.err.println("Point selection '" + cl - + "' deparsed as [" + r + "]"); - } - } - else - { - System.err.println("ERROR: Invalid Point selection '" + cl - + "' deparsed as [" + r + "]"); - } - } - } - } - if (seqsfound) - { - // we only propagate the selection when it was the null selection, or the - // given sequences were found in the alignment. - if (inseqpos && sel.getSize() > 0) - { - // assume first sequence provides reference frame ? - SequenceI rs = sel.getSequenceAt(0); - start = rs.findIndex(start); - end = rs.findIndex(end); - if (csel != null) - { - Vector cs = csel.getSelected(); - csel.clear(); - for (int csi = 0, csiS = cs.size(); csi < csiS; csi++) - { - csel.addElement(rs.findIndex(((Integer) cs.elementAt(csi)) - .intValue())); - } - } - } - sel.setStartRes(start); - sel.setEndRes(end); - EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - alf.select(sel, csel); - } - }); - } - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang. - * String, java.lang.String) - */ - public String getSelectedSequencesAsAlignment(String format, String suffix) - { - return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(), - format, suffix); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview - * .appletgui.AlignFrame, java.lang.String, java.lang.String) - */ - public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, - String format, String suffix) - { - try - { - boolean seqlimits = suffix.equalsIgnoreCase("true"); - if (alf.viewport.getSelectionGroup() != null) - { - // JBPNote: getSelectionAsNewSequence behaviour has changed - this - // method now returns a full copy of sequence data - // TODO consider using getSequenceSelection instead here - String reply = new AppletFormatAdapter().formatSequences(format, - new Alignment(alf.viewport.getSelectionAsNewSequence()), - seqlimits); - return reply; - } - } catch (Exception ex) - { - ex.printStackTrace(); - return "Error retrieving alignment in " + format + " format. "; - } - return ""; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder() - */ - public String getAlignmentOrder() - { - return getAlignmentOrderFrom(getDefaultTargetFrame()); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame - * ) - */ - public String getAlignmentOrderFrom(AlignFrame alf) - { - return getAlignmentOrderFrom(alf, separator); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame - * , java.lang.String) - */ - public String getAlignmentOrderFrom(AlignFrame alf, String sep) - { - AlignmentI alorder = alf.getAlignViewport().getAlignment(); - String[] order = new String[alorder.getHeight()]; - for (int i = 0; i < order.length; i++) - { - order[i] = alorder.getSequenceAt(i).getName(); - } - return arrayToSeparatorList(order); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, - * java.lang.String) - */ - public String orderBy(String order, String undoName) - { - return orderBy(order, undoName, separator); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, - * java.lang.String, java.lang.String) - */ - public String orderBy(String order, String undoName, String sep) - { - return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String, java.lang.String) - */ - public String orderAlignmentBy(AlignFrame alf, String order, - String undoName, String sep) - { - String[] ids = separatorListToArray(order, sep); - SequenceI[] sqs = null; - if (ids != null && ids.length > 0) - { - jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( - alf.viewport.getAlignment().getSequencesArray()); - int s = 0; - sqs = new SequenceI[ids.length]; - for (int i = 0; i < ids.length; i++) - { - if (ids[i].trim().length() == 0) - { - continue; - } - SequenceI sq = matcher.findIdMatch(ids[i]); - if (sq != null) - { - sqs[s++] = sq; - } - } - if (s > 0) - { - SequenceI[] sqq = new SequenceI[s]; - System.arraycopy(sqs, 0, sqq, 0, s); - sqs = sqq; - } - else - { - sqs = null; - } - } - if (sqs == null) - { - return ""; - } - ; - final AlignmentOrder aorder = new AlignmentOrder(sqs); - - if (undoName != null && undoName.trim().length() == 0) - { - undoName = null; - } - final String _undoName = undoName; - // TODO: deal with synchronization here: cannot raise any events until after - // this has returned. - return alf.sortBy(aorder, _undoName) ? "true" : ""; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String) - */ - public String getAlignment(String format) - { - return getAlignmentFrom(getDefaultTargetFrame(), format, "true"); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, - * java.lang.String) - */ - public String getAlignmentFrom(AlignFrame alf, String format) - { - return getAlignmentFrom(alf, format, "true"); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String, - * java.lang.String) - */ - public String getAlignment(String format, String suffix) - { - return getAlignmentFrom(getDefaultTargetFrame(), format, suffix); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String) - */ - public String getAlignmentFrom(AlignFrame alf, String format, - String suffix) - { - try - { - boolean seqlimits = suffix.equalsIgnoreCase("true"); - - String reply = new AppletFormatAdapter().formatSequences(format, - alf.viewport.getAlignment(), seqlimits); - return reply; - } catch (Exception ex) - { - ex.printStackTrace(); - return "Error retrieving alignment in " + format + " format. "; - } - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) - */ - public void loadAnnotation(String annotation) - { - loadAnnotationFrom(getDefaultTargetFrame(), annotation); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame - * , java.lang.String) - */ - public void loadAnnotationFrom(AlignFrame alf, String annotation) - { - if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport() - .getAlignment(), annotation, AppletFormatAdapter.PASTE)) - { - alf.alignPanel.fontChanged(); - alf.alignPanel.setScrollValues(0, 0); - } - else - { - alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE); - } - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) - */ - public void loadFeatures(String features, boolean autoenabledisplay) - { - loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame - * , java.lang.String) - */ - public boolean loadFeaturesFrom(AlignFrame alf, String features, - boolean autoenabledisplay) - { - return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, - autoenabledisplay); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String) - */ - public String getFeatures(String format) - { - return getFeaturesFrom(getDefaultTargetFrame(), format); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame, - * java.lang.String) - */ - public String getFeaturesFrom(AlignFrame alf, String format) - { - return alf.outputFeatures(false, format); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getAnnotation() - */ - public String getAnnotation() - { - return getAnnotationFrom(getDefaultTargetFrame()); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame - * ) - */ - public String getAnnotationFrom(AlignFrame alf) - { - return alf.outputAnnotations(false); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#newView() - */ - public AlignFrame newView() - { - return newViewFrom(getDefaultTargetFrame()); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String) - */ - public AlignFrame newView(String name) - { - return newViewFrom(getDefaultTargetFrame(), name); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame) - */ - public AlignFrame newViewFrom(AlignFrame alf) - { - return alf.newView(null); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame, - * java.lang.String) - */ - public AlignFrame newViewFrom(AlignFrame alf, String name) - { - return alf.newView(name); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String, - * java.lang.String) - */ - public AlignFrame loadAlignment(String text, String title) - { - Alignment al = null; - - String format = new IdentifyFile().Identify(text, - AppletFormatAdapter.PASTE); - try - { - al = new AppletFormatAdapter().readFile(text, - AppletFormatAdapter.PASTE, format); - if (al.getHeight() > 0) - { - return new AlignFrame(al, this, title, false); - } - } catch (java.io.IOException ex) - { - ex.printStackTrace(); - } - return null; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String) - */ - public void setMouseoverListener(String listener) - { - setMouseoverListener(currentAlignFrame, listener); - } - - private Vector javascriptListeners = new Vector(); - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame - * , java.lang.String) - */ - public void setMouseoverListener(AlignFrame af, String listener) - { - if (listener != null) - { - listener = listener.trim(); - if (listener.length() == 0) - { - System.err - .println("jalview Javascript error: Ignoring empty function for mouseover listener."); - return; - } - } - jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener( - this, af, listener); - javascriptListeners.addElement(mol); - StructureSelectionManager.getStructureSelectionManager(this) - .addStructureViewerListener(mol); - if (debug) - { - System.err.println("Added a mouseover listener for " - + ((af == null) ? "All frames" : "Just views for " - + af.getAlignViewport().getSequenceSetId())); - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); - } - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String) - */ - public void setSelectionListener(String listener) - { - setSelectionListener(null, listener); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame - * , java.lang.String) - */ - public void setSelectionListener(AlignFrame af, String listener) - { - if (listener != null) - { - listener = listener.trim(); - if (listener.length() == 0) - { - System.err - .println("jalview Javascript error: Ignoring empty function for selection listener."); - return; - } - } - jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender( - this, af, listener); - javascriptListeners.addElement(mol); - StructureSelectionManager.getStructureSelectionManager(this) - .addSelectionListener(mol); - if (debug) - { - System.err.println("Added a selection listener for " - + ((af == null) ? "All frames" : "Just views for " - + af.getAlignViewport().getSequenceSetId())); - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); - } - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String, - * java.lang.String) - */ - public void setStructureListener(String listener, String modelSet) - { - if (listener != null) - { - listener = listener.trim(); - if (listener.length() == 0) - { - System.err - .println("jalview Javascript error: Ignoring empty function for selection listener."); - return; - } - } - jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener( - this, listener, separatorListToArray(modelSet)); - javascriptListeners.addElement(mol); - StructureSelectionManager.getStructureSelectionManager(this) - .addStructureViewerListener(mol); - if (debug) - { - System.err.println("Added a javascript structure viewer listener '" - + listener + "'"); - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); - } - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui - * .AlignFrame, java.lang.String) - */ - public void removeJavascriptListener(AlignFrame af, String listener) - { - if (listener != null) - { - listener = listener.trim(); - if (listener.length() == 0) - { - listener = null; - } - } - boolean rprt = false; - for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;) - { - Object lstn = javascriptListeners.elementAt(ms); - JsCallBack lstner = (JsCallBack) lstn; - if ((af == null || lstner.getAlignFrame() == af) - && (listener == null || lstner.getListenerFunction().equals( - listener))) - { - javascriptListeners.removeElement(lstner); - msSize--; - if (lstner instanceof SelectionListener) - { - StructureSelectionManager.getStructureSelectionManager(this) - .removeSelectionListener((SelectionListener) lstner); - } - else - { - StructureSelectionManager.getStructureSelectionManager(this) - .removeStructureViewerListener(lstner, null); - } - rprt = debug; - if (debug) - { - System.err.println("Removed listener '" + listener + "'"); - } - } - else - { - ms++; - } - } - if (rprt) - { - System.err.println("There are now " + javascriptListeners.size() - + " listeners in total."); - } - } - - public void stop() - { - System.err.println("Applet " + getName() + " stop()."); - tidyUp(); - } - - public void destroy() - { - System.err.println("Applet " + getName() + " destroy()."); - tidyUp(); - } - - private void tidyUp() - { - removeAll(); - if (currentAlignFrame != null && currentAlignFrame.viewport != null - && currentAlignFrame.viewport.applet != null) - { - AlignViewport av = currentAlignFrame.viewport; - currentAlignFrame.closeMenuItem_actionPerformed(); - av.applet = null; - currentAlignFrame = null; - } - if (javascriptListeners != null) - { - while (javascriptListeners.size() > 0) - { - jalview.javascript.JSFunctionExec mol = javascriptListeners - .elementAt(0); - javascriptListeners.removeElement(mol); - if (mol instanceof SelectionListener) - { - StructureSelectionManager.getStructureSelectionManager(this) - .removeSelectionListener((SelectionListener) mol); - } - else - { - StructureSelectionManager.getStructureSelectionManager(this) - .removeStructureViewerListener(mol, null); - } - mol.jvlite = null; - } - } - if (jsFunctionExec != null) - { - jsFunctionExec.stopQueue(); - jsFunctionExec.jvlite = null; - } - initialAlignFrame = null; - jsFunctionExec = null; - javascriptListeners = null; - StructureSelectionManager.release(this); - } - - private jalview.javascript.JSFunctionExec jsFunctionExec; - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String, - * java.lang.String, java.lang.String) - */ - public void mouseOverStructure(final String pdbResNum, - final String chain, final String pdbfile) - { - final StructureSelectionManagerProvider me = this; - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - try - { - StructureSelectionManager.getStructureSelectionManager(me) - .mouseOverStructure(new Integer(pdbResNum).intValue(), - chain, pdbfile); - if (debug) - { - System.err.println("mouseOver for '" + pdbResNum - + "' in chain '" + chain + "' in structure '" + pdbfile - + "'"); - } - } catch (NumberFormatException e) - { - System.err.println("Ignoring invalid residue number string '" - + pdbResNum + "'"); - } - - } - }); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String) - */ - public void scrollViewToIn(final AlignFrame alf, final String topRow, - final String leftHandColumn) - { - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - try - { - alf.scrollTo(new Integer(topRow).intValue(), new Integer( - leftHandColumn).intValue()); - - } catch (Exception ex) - { - System.err.println("Couldn't parse integer arguments (topRow='" - + topRow + "' and leftHandColumn='" + leftHandColumn - + "')"); - ex.printStackTrace(); - } - } - }); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui - * .AlignFrame, java.lang.String) - */ - @Override - public void scrollViewToRowIn(final AlignFrame alf, final String topRow) - { - - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - try - { - alf.scrollToRow(new Integer(topRow).intValue()); - - } catch (Exception ex) - { - System.err.println("Couldn't parse integer arguments (topRow='" - + topRow + "')"); - ex.printStackTrace(); - } - - } - }); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui - * .AlignFrame, java.lang.String) - */ - @Override - public void scrollViewToColumnIn(final AlignFrame alf, - final String leftHandColumn) - { - java.awt.EventQueue.invokeLater(new Runnable() - { - - @Override - public void run() - { - try - { - alf.scrollToColumn(new Integer(leftHandColumn).intValue()); - - } catch (Exception ex) - { - System.err - .println("Couldn't parse integer arguments (leftHandColumn='" - + leftHandColumn + "')"); - ex.printStackTrace(); - } - } - }); - - } - - // ////////////////////////////////////////////// - // ////////////////////////////////////////////// - - public static int lastFrameX = 200; - - public static int lastFrameY = 200; - - boolean fileFound = true; - - String file = "No file"; - - Button launcher = new Button("Start Jalview"); - - /** - * The currentAlignFrame is static, it will change if and when the user - * selects a new window. Note that it will *never* point back to the embedded - * AlignFrame if the applet is started as embedded on the page and then - * afterwards a new view is created. - */ - public AlignFrame currentAlignFrame = null; - - /** - * This is the first frame to be displayed, and does not change. API calls - * will default to this instance if currentAlignFrame is null. - */ - AlignFrame initialAlignFrame = null; - - boolean embedded = false; - - private boolean checkForJmol = true; - - private boolean checkedForJmol = false; // ensure we don't check for jmol - - // every time the app is re-inited - - public boolean jmolAvailable = false; - - private boolean alignPdbStructures = false; - - /** - * use an external structure viewer exclusively (no jmols or MCViews will be - * opened by JalviewLite itself) - */ - public boolean useXtrnalSviewer = false; - - public static boolean debug = false; - - static String builddate = null, version = null; - - private static void initBuildDetails() - { - if (builddate == null) - { - builddate = "unknown"; - version = "test"; - java.net.URL url = JalviewLite.class - .getResource("/.build_properties"); - if (url != null) - { - try - { - BufferedReader reader = new BufferedReader(new InputStreamReader( - url.openStream())); - String line; - while ((line = reader.readLine()) != null) - { - if (line.indexOf("VERSION") > -1) - { - version = line.substring(line.indexOf("=") + 1); - } - if (line.indexOf("BUILD_DATE") > -1) - { - builddate = line.substring(line.indexOf("=") + 1); - } - } - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - } - } - - public static String getBuildDate() - { - initBuildDetails(); - return builddate; - } - - public static String getVersion() - { - initBuildDetails(); - return version; - } - - // public JSObject scriptObject = null; - - /** - * init method for Jalview Applet - */ - public void init() - { - // remove any handlers that might be hanging around from an earlier instance - try - { - if (debug) - { - System.err.println("Applet context is '" - + getAppletContext().getClass().toString() + "'"); - } - JSObject scriptObject = JSObject.getWindow(this); - if (debug && scriptObject != null) - { - System.err.println("Applet has Javascript callback support."); - } - - } catch (Exception ex) - { - System.err - .println("Warning: No JalviewLite javascript callbacks available."); - if (debug) - { - ex.printStackTrace(); - } - } - /** - * turn on extra applet debugging - */ - String dbg = getParameter("debug"); - if (dbg != null) - { - debug = dbg.toLowerCase().equals("true"); - } - if (debug) - { - - System.err.println("JalviewLite Version " + getVersion()); - System.err.println("Build Date : " + getBuildDate()); - - } - String externalsviewer = getParameter("externalstructureviewer"); - if (externalsviewer != null) - { - useXtrnalSviewer = externalsviewer.trim().toLowerCase() - .equals("true"); - } - /** - * if true disable the check for jmol - */ - String chkforJmol = getParameter("nojmol"); - if (chkforJmol != null) - { - checkForJmol = !chkforJmol.equals("true"); - } - /** - * get the separator parameter if present - */ - String sep = getParameter("separator"); - if (sep != null) - { - if (sep.length() > 0) - { - separator = sep; - if (debug) - { - System.err.println("Separator set to '" + separator + "'"); - } - } - else - { - throw new Error( - "Invalid separator parameter - must be non-zero length"); - } - } - int r = 255; - int g = 255; - int b = 255; - String param = getParameter("RGB"); - - if (param != null) - { - try - { - r = Integer.parseInt(param.substring(0, 2), 16); - g = Integer.parseInt(param.substring(2, 4), 16); - b = Integer.parseInt(param.substring(4, 6), 16); - } catch (Exception ex) - { - r = 255; - g = 255; - b = 255; - } - } - param = getParameter("label"); - if (param != null) - { - launcher.setLabel(param); - } - - setBackground(new Color(r, g, b)); - - file = getParameter("file"); - - if (file == null) - { - // Maybe the sequences are added as parameters - StringBuffer data = new StringBuffer("PASTE"); - int i = 1; - while ((file = getParameter("sequence" + i)) != null) - { - data.append(file.toString() + "\n"); - i++; - } - if (data.length() > 5) - { - file = data.toString(); - } - } - - final JalviewLite jvapplet = this; - if (getParameter("embedded") != null - && getParameter("embedded").equalsIgnoreCase("true")) - { - // Launch as embedded applet in page - embedded = true; - LoadingThread loader = new LoadingThread(file, jvapplet); - loader.start(); - } - else if (file != null) - { - if (getParameter("showbutton") == null - || !getParameter("showbutton").equalsIgnoreCase("false")) - { - // Add the JalviewLite 'Button' to the page - add(launcher); - launcher.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - LoadingThread loader = new LoadingThread(file, jvapplet); - loader.start(); - } - }); - } - else - { - // Open jalviewLite immediately. - LoadingThread loader = new LoadingThread(file, jvapplet); - loader.start(); - } - } - else - { - // jalview initialisation with no alignment. loadAlignment() method can - // still be called to open new alignments. - file = "NO FILE"; - fileFound = false; - // callInitCallback(); - } - } - - private void callInitCallback() - { - String initjscallback = getParameter("oninit"); - if (initjscallback == null) - { - return; - } - initjscallback = initjscallback.trim(); - if (initjscallback.length() > 0) - { - JSObject scriptObject = null; - try - { - scriptObject = JSObject.getWindow(this); - } catch (Exception ex) - { - } - ; - if (scriptObject != null) - { - try - { - // do onInit with the JS executor thread - new JSFunctionExec(this).executeJavascriptFunction(true, - initjscallback, null, "Calling oninit callback '" - + initjscallback + "'."); - } catch (Exception e) - { - System.err.println("Exception when executing _oninit callback '" - + initjscallback + "'."); - e.printStackTrace(); - } - } - else - { - System.err.println("Not executing _oninit callback '" - + initjscallback + "' - no scripting allowed."); - } - } - } - - /** - * Initialises and displays a new java.awt.Frame - * - * @param frame - * java.awt.Frame to be displayed - * @param title - * title of new frame - * @param width - * width if new frame - * @param height - * height of new frame - */ - public static void addFrame(final Frame frame, String title, int width, - int height) - { - frame.setLocation(lastFrameX, lastFrameY); - lastFrameX += 40; - lastFrameY += 40; - frame.setSize(width, height); - frame.setTitle(title); - frame.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - if (frame instanceof AlignFrame) - { - AlignViewport vp = ((AlignFrame) frame).viewport; - ((AlignFrame) frame).closeMenuItem_actionPerformed(); - if (vp.applet.currentAlignFrame == frame) - { - vp.applet.currentAlignFrame = null; - } - vp.applet = null; - vp = null; - - } - lastFrameX -= 40; - lastFrameY -= 40; - if (frame instanceof EmbmenuFrame) - { - ((EmbmenuFrame) frame).destroyMenus(); - } - frame.setMenuBar(null); - frame.dispose(); - } - - public void windowActivated(WindowEvent e) - { - if (frame instanceof AlignFrame) - { - ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame; - if (debug) - { - System.err.println("Activated window " + frame); - } - } - // be good. - super.windowActivated(e); - } - /* - * Probably not necessary to do this - see TODO above. (non-Javadoc) - * - * @see - * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent - * ) - * - * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame == - * frame) { currentAlignFrame = null; if (debug) { - * System.err.println("Deactivated window "+frame); } } - * super.windowDeactivated(e); } - */ - }); - frame.setVisible(true); - } - - /** - * This paints the background surrounding the "Launch Jalview button"
                - *
                - * If file given in parameter not found, displays error message - * - * @param g - * graphics context - */ - public void paint(Graphics g) - { - if (!fileFound) - { - g.setColor(new Color(200, 200, 200)); - g.setColor(Color.cyan); - g.fillRect(0, 0, getSize().width, getSize().height); - g.setColor(Color.red); - g.drawString("Jalview can't open file", 5, 15); - g.drawString("\"" + file + "\"", 5, 30); - } - else if (embedded) - { - g.setColor(Color.black); - g.setFont(new Font("Arial", Font.BOLD, 24)); - g.drawString("Jalview Applet", 50, getSize().height / 2 - 30); - g.drawString("Loading Data...", 50, getSize().height / 2); - } - } - - /** - * get all components associated with the applet of the given type - * - * @param class1 - * @return - */ - public Vector getAppletWindow(Class class1) - { - Vector wnds = new Vector(); - Component[] cmp = getComponents(); - if (cmp != null) - { - for (int i = 0; i < cmp.length; i++) - { - if (class1.isAssignableFrom(cmp[i].getClass())) - { - wnds.addElement(cmp); - } - } - } - return wnds; - } - - class LoadJmolThread extends Thread - { - private boolean running = false; - - public void run() - { - if (running || checkedForJmol) - { - return; - } - running = true; - if (checkForJmol) - { - try - { - if (!System.getProperty("java.version").startsWith("1.1")) - { - Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter"); - jmolAvailable = true; - } - if (!jmolAvailable) - { - System.out - .println("Jmol not available - Using MCview for structures"); - } - } catch (java.lang.ClassNotFoundException ex) - { - } - } - else - { - jmolAvailable = false; - if (debug) - { - System.err - .println("Skipping Jmol check. Will use MCView (probably)"); - } - } - checkedForJmol = true; - running = false; - } - - public boolean notFinished() - { - return running || !checkedForJmol; - } - } - - class LoadingThread extends Thread - { - /** - * State variable: File source - */ - String file; - - /** - * State variable: protocol for access to file source - */ - String protocol; - - /** - * State variable: format of file source - */ - String format; - - String _file; - - JalviewLite applet; - - private void dbgMsg(String msg) - { - if (applet.debug) - { - System.err.println(msg); - } - } - - /** - * update the protocol state variable for accessing the datasource located - * by file. - * - * @param file - * @return possibly updated datasource string - */ - public String setProtocolState(String file) - { - if (file.startsWith("PASTE")) - { - file = file.substring(5); - protocol = AppletFormatAdapter.PASTE; - } - else if (inArchive(file)) - { - protocol = AppletFormatAdapter.CLASSLOADER; - } - else - { - file = addProtocol(file); - protocol = AppletFormatAdapter.URL; - } - dbgMsg("Protocol identified as '" + protocol + "'"); - return file; - } - - public LoadingThread(String _file, JalviewLite _applet) - { - this._file = _file; - applet = _applet; - } - - public void run() - { - LoadJmolThread jmolchecker = new LoadJmolThread(); - jmolchecker.start(); - while (jmolchecker.notFinished()) - { - // wait around until the Jmol check is complete. - try - { - Thread.sleep(2); - } catch (Exception e) - { - } - ; - } - startLoading(); - // applet.callInitCallback(); - } - - private void startLoading() - { - AlignFrame newAlignFrame; - dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile"); - file = setProtocolState(_file); - - format = new jalview.io.IdentifyFile().Identify(file, protocol); - dbgMsg("File identified as '" + format + "'"); - dbgMsg("Loading started."); - Alignment al = null; - try - { - al = new AppletFormatAdapter().readFile(file, protocol, format); - } catch (java.io.IOException ex) - { - dbgMsg("File load exception."); - ex.printStackTrace(); - if (debug) - { - try - { - FileParse fp = new FileParse(file, protocol); - String ln = null; - dbgMsg(">>>Dumping contents of '" + file + "' " + "(" - + protocol + ")"); - while ((ln = fp.nextLine()) != null) - { - dbgMsg(ln); - } - dbgMsg(">>>Dump finished."); - } catch (Exception e) - { - System.err - .println("Exception when trying to dump the content of the file parameter."); - e.printStackTrace(); - } - } - } - if ((al != null) && (al.getHeight() > 0)) - { - dbgMsg("Successfully loaded file."); - newAlignFrame = new AlignFrame(al, applet, file, embedded); - if (initialAlignFrame == null) - { - initialAlignFrame = newAlignFrame; - } - // update the focus. - currentAlignFrame = newAlignFrame; - - if (protocol == jalview.io.AppletFormatAdapter.PASTE) - { - newAlignFrame.setTitle("Sequences from " - + applet.getDocumentBase()); - } - - newAlignFrame.statusBar.setText("Successfully loaded file " + file); - - String treeFile = applet.getParameter("tree"); - if (treeFile == null) - { - treeFile = applet.getParameter("treeFile"); - } - - if (treeFile != null) - { - try - { - treeFile = setProtocolState(treeFile); - /* - * if (inArchive(treeFile)) { protocol = - * AppletFormatAdapter.CLASSLOADER; } else { protocol = - * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); } - */ - jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile, - protocol); - - fin.parse(); - - if (fin.getTree() != null) - { - newAlignFrame.loadTree(fin, treeFile); - dbgMsg("Successfuly imported tree."); - } - else - { - dbgMsg("Tree parameter did not resolve to a valid tree."); - } - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /* - * Try to load T-Coffee score file - */ - String sScoreFile = applet.getParameter("scoreFile"); - if (sScoreFile != null && !"".equals(sScoreFile)) - { - try - { - if (debug) - { - System.err - .println("Attempting to load T-COFFEE score file from the scoreFile parameter"); - } - if (!newAlignFrame.loadScoreFile(sScoreFile)) - { - System.err - .println("Failed to parse T-COFFEE parameter as a valid score file ('" - + sScoreFile + "')"); - } - } catch (Exception e) - { - System.err.printf("Cannot read score file: '%s'. Cause: %s \n", - sScoreFile, e.getMessage()); - } - } - - // /////////////////////////// - // modify display of features - // we do this before any features have been loaded, ensuring any hidden - // groups are hidden when features first displayed - // - // hide specific groups - // - String param = applet.getParameter("hidefeaturegroups"); - if (param != null) - { - newAlignFrame.setFeatureGroupState(separatorListToArray(param), - false); - // applet.setFeatureGroupStateOn(newAlignFrame, param, false); - } - // show specific groups - param = applet.getParameter("showfeaturegroups"); - if (param != null) - { - newAlignFrame.setFeatureGroupState(separatorListToArray(param), - true); - // applet.setFeatureGroupStateOn(newAlignFrame, param, true); - } - // and now load features - param = applet.getParameter("features"); - if (param != null) - { - param = setProtocolState(param); - - newAlignFrame.parseFeaturesFile(param, protocol); - } - - param = applet.getParameter("showFeatureSettings"); - if (param != null && param.equalsIgnoreCase("true")) - { - newAlignFrame.viewport.showSequenceFeatures(true); - new FeatureSettings(newAlignFrame.alignPanel); - } - - param = applet.getParameter("annotations"); - if (param != null) - { - param = setProtocolState(param); - - if (new AnnotationFile().readAnnotationFile( - newAlignFrame.viewport.getAlignment(), param, protocol)) - { - newAlignFrame.alignPanel.fontChanged(); - newAlignFrame.alignPanel.setScrollValues(0, 0); - } - else - { - System.err - .println("Annotations were not added from annotation file '" - + param + "'"); - } - - } - - param = applet.getParameter("jnetfile"); - if (param != null) - { - try - { - param = setProtocolState(param); - jalview.io.JPredFile predictions = new jalview.io.JPredFile( - param, protocol); - JnetAnnotationMaker.add_annotation(predictions, - newAlignFrame.viewport.getAlignment(), 0, false); // false==do - // not - // add - // sequence - // profile - // from - // concise - // output - newAlignFrame.alignPanel.fontChanged(); - newAlignFrame.alignPanel.setScrollValues(0, 0); - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - /* - * Undocumented for 2.6 - * - related to JAL-434 - */ - applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles", - false)); - /* - * - * - * - * - * - */ - - int pdbFileCount = 0; - // Accumulate pdbs here if they are heading for the same view (if - // alignPdbStructures is true) - Vector pdbs = new Vector(); - // create a lazy matcher if we're asked to - jalview.analysis.SequenceIdMatcher matcher = (applet - .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher( - newAlignFrame.getAlignViewport().getAlignment() - .getSequencesArray()) : null; - - do - { - if (pdbFileCount > 0) - { - param = applet.getParameter("PDBFILE" + pdbFileCount); - } - else - { - param = applet.getParameter("PDBFILE"); - } - - if (param != null) - { - PDBEntry pdb = new PDBEntry(); - - String seqstring; - SequenceI[] seqs = null; - String[] chains = null; - - StringTokenizer st = new StringTokenizer(param, " "); - - if (st.countTokens() < 2) - { - String sequence = applet.getParameter("PDBSEQ"); - if (sequence != null) - seqs = new SequenceI[] - { matcher == null ? (Sequence) newAlignFrame - .getAlignViewport().getAlignment() - .findName(sequence) : matcher.findIdMatch(sequence) }; - - } - else - { - param = st.nextToken(); - Vector tmp = new Vector(); - Vector tmp2 = new Vector(); - - while (st.hasMoreTokens()) - { - seqstring = st.nextToken(); - StringTokenizer st2 = new StringTokenizer(seqstring, "="); - if (st2.countTokens() > 1) - { - // This is the chain - tmp2.addElement(st2.nextToken()); - seqstring = st2.nextToken(); - } - tmp.addElement(matcher == null ? (Sequence) newAlignFrame - .getAlignViewport().getAlignment() - .findName(seqstring) : matcher - .findIdMatch(seqstring)); - } - - seqs = new SequenceI[tmp.size()]; - tmp.copyInto(seqs); - if (tmp2.size() == tmp.size()) - { - chains = new String[tmp2.size()]; - tmp2.copyInto(chains); - } - } - param = setProtocolState(param); - - if (// !jmolAvailable - // && - protocol == AppletFormatAdapter.CLASSLOADER - && !useXtrnalSviewer) - { - // Re: JAL-357 : the bug isn't a problem if we are using an - // external viewer! - // TODO: verify this Re: - // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 - // This exception preserves the current behaviour where, even if - // the local pdb file was identified in the class loader - protocol = AppletFormatAdapter.URL; // this is probably NOT - // CORRECT! - param = addProtocol(param); // - } - - pdb.setFile(param); - - if (seqs != null) - { - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i] != null) - { - ((Sequence) seqs[i]).addPDBId(pdb); - } - else - { - if (JalviewLite.debug) - { - // this may not really be a problem but we give a warning - // anyway - System.err - .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence " - + i + ")"); - } - } - } - - if (!alignPdbStructures) - { - newAlignFrame.newStructureView(applet, pdb, seqs, chains, - protocol); - } - else - { - pdbs.addElement(new Object[] - { pdb, seqs, chains, new String(protocol) }); - } - } - } - - pdbFileCount++; - } while (param != null || pdbFileCount < 10); - if (pdbs.size() > 0) - { - SequenceI[][] seqs = new SequenceI[pdbs.size()][]; - PDBEntry[] pdb = new PDBEntry[pdbs.size()]; - String[][] chains = new String[pdbs.size()][]; - String[] protocols = new String[pdbs.size()]; - for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++) - { - Object[] o = (Object[]) pdbs.elementAt(pdbsi); - pdb[pdbsi] = (PDBEntry) o[0]; - seqs[pdbsi] = (SequenceI[]) o[1]; - chains[pdbsi] = (String[]) o[2]; - protocols[pdbsi] = (String) o[3]; - } - newAlignFrame.alignedStructureView(applet, pdb, seqs, chains, - protocols); - - } - } - else - { - fileFound = false; - applet.remove(launcher); - applet.repaint(); - } - callInitCallback(); - } - - /** - * Discovers whether the given file is in the Applet Archive - * - * @param file - * String - * @return boolean - */ - boolean inArchive(String file) - { - // This might throw a security exception in certain browsers - // Netscape Communicator for instance. - try - { - boolean rtn = (getClass().getResourceAsStream("/" + file) != null); - if (debug) - { - System.err.println("Resource '" + file + "' was " - + (rtn ? "" : "not") + " located by classloader."); - } - return rtn; - } catch (Exception ex) - { - System.out.println("Exception checking resources: " + file + " " - + ex); - return false; - } - } - - String addProtocol(String file) - { - if (file.indexOf("://") == -1) - { - String fl = applet.resolveUrlForLocalOrAbsolute(file, - getDocumentBase()); - try - { - if (new java.net.URL(fl).openStream() != null) - { - if (debug) - { - System.err.println("Prepended document base for resource: '" - + file + "'"); - } - return fl; - } - } catch (Exception x) - { - } - ; - fl = applet.resolveUrlForLocalOrAbsolute(file, getCodeBase()); - try - { - if (new java.net.URL(fl).openStream() != null) - { - if (debug) - { - System.err.println("Prepended codebase for resource: '" - + file + "'"); - } - return fl; - } - } catch (Exception x) - { - } - ; - - } - - return file; - } - } - - /** - * @return the default alignFrame acted on by the public applet methods. May - * return null with an error message on System.err indicating the - * fact. - */ - public AlignFrame getDefaultTargetFrame() - { - if (currentAlignFrame != null) - { - return currentAlignFrame; - } - if (initialAlignFrame != null) - { - return initialAlignFrame; - } - System.err - .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use."); - return null; - } - - /** - * separator used for separatorList - */ - protected String separator = "" + ((char) 0x00AC); // the default used to be - // '|' but many sequence - // IDS include pipes. - - /** - * set to enable the URL based javascript execution mechanism - */ - public boolean jsfallbackEnabled = false; - - /** - * parse the string into a list - * - * @param list - * @return elements separated by separator - */ - public String[] separatorListToArray(String list) - { - return separatorListToArray(list, separator); - } - - /** - * parse the string into a list - * - * @param list - * @param separator - * @return elements separated by separator - */ - public String[] separatorListToArray(String list, String separator) - { - // note separator local variable intentionally masks object field - int seplen = separator.length(); - if (list == null || list.equals("") || list.equals(separator)) - return null; - java.util.Vector jv = new Vector(); - int cp = 0, pos; - while ((pos = list.indexOf(separator, cp)) > cp) - { - jv.addElement(list.substring(cp, pos)); - cp = pos + seplen; - } - if (cp < list.length()) - { - String c = list.substring(cp); - if (!c.equals(separator)) - { - jv.addElement(c); - } - } - if (jv.size() > 0) - { - String[] v = new String[jv.size()]; - for (int i = 0; i < v.length; i++) - { - v[i] = (String) jv.elementAt(i); - } - jv.removeAllElements(); - if (debug) - { - System.err.println("Array from '" + separator - + "' separated List:\n" + v.length); - for (int i = 0; i < v.length; i++) - { - System.err.println("item " + i + " '" + v[i] + "'"); - } - } - return v; - } - if (debug) - { - System.err.println("Empty Array from '" + separator - + "' separated List"); - } - return null; - } - - /** - * concatenate the list with separator - * - * @param list - * @return concatenated string - */ - public String arrayToSeparatorList(String[] list) - { - return arrayToSeparatorList(list, separator); - } - - /** - * concatenate the list with separator - * - * @param list - * @param separator - * @return concatenated string - */ - public String arrayToSeparatorList(String[] list, String separator) - { - StringBuffer v = new StringBuffer(); - if (list != null && list.length > 0) - { - for (int i = 0, iSize = list.length; i < iSize; i++) - { - if (list[i] != null) - { - if (i > 0) - { - v.append(separator); - } - v.append(list[i]); - } - } - if (debug) - { - System.err.println("Returning '" + separator - + "' separated List:\n"); - System.err.println(v); - } - return v.toString(); - } - if (debug) - { - System.err.println("Returning empty '" + separator - + "' separated List\n"); - } - return "" + separator; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups() - */ - public String getFeatureGroups() - { - String lst = arrayToSeparatorList(getDefaultTargetFrame() - .getFeatureGroups()); - return lst; - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame - * ) - */ - public String getFeatureGroupsOn(AlignFrame alf) - { - String lst = arrayToSeparatorList(alf.getFeatureGroups()); - return lst; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean) - */ - public String getFeatureGroupsOfState(boolean visible) - { - return arrayToSeparatorList(getDefaultTargetFrame() - .getFeatureGroupsOfState(visible)); - } - - /* - * (non-Javadoc) - * - * @see - * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui - * .AlignFrame, boolean) - */ - public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) - { - return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible)); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui. - * AlignFrame, java.lang.String, boolean) - */ - public void setFeatureGroupStateOn(final AlignFrame alf, - final String groups, boolean state) - { - final boolean st = state;// !(state==null || state.equals("") || - // state.toLowerCase().equals("false")); - java.awt.EventQueue.invokeLater(new Runnable() - { - @Override - public void run() - { - alf.setFeatureGroupState(separatorListToArray(groups), st); - } - }); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String, - * boolean) - */ - public void setFeatureGroupState(String groups, boolean state) - { - setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getSeparator() - */ - public String getSeparator() - { - return separator; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String) - */ - public void setSeparator(String separator) - { - if (separator == null || separator.length() < 1) - { - // reset to default - separator = "" + ((char) 0x00AC); - } - this.separator = separator; - if (debug) - { - System.err.println("Default Separator now: '" + separator + "'"); - } - } - - /** - * get boolean value of applet parameter 'name' and return default if - * parameter is not set - * - * @param name - * name of paremeter - * @param def - * the value to return otherwise - * @return true or false - */ - public boolean getDefaultParameter(String name, boolean def) - { - String stn; - if ((stn = getParameter(name)) == null) - { - return def; - } - if (stn.toLowerCase().equals("true")) - { - return true; - } - return false; - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame, - * java.lang.String, java.lang.String, java.lang.String) - */ - public boolean addPdbFile(AlignFrame alFrame, String sequenceId, - String pdbEntryString, String pdbFile) - { - return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile); - } - - protected void setAlignPdbStructures(boolean alignPdbStructures) - { - this.alignPdbStructures = alignPdbStructures; - } - - public boolean isAlignPdbStructures() - { - return alignPdbStructures; - } - - public void start() - { - // callInitCallback(); - } - - private Hashtable jshashes = new Hashtable(); - - private Hashtable> jsmessages = new Hashtable>(); - - public void setJsMessageSet(String messageclass, String viewId, - String[] colcommands) - { - Hashtable msgset = jsmessages.get(messageclass); - if (msgset == null) - { - msgset = new Hashtable(); - jsmessages.put(messageclass, msgset); - } - msgset.put(viewId, colcommands); - long[] l = new long[colcommands.length]; - for (int i = 0; i < colcommands.length; i++) - { - l[i] = colcommands[i].hashCode(); - } - jshashes.put(messageclass + "|" + viewId, l); - } - - /* - * (non-Javadoc) - * - * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String, - * java.lang.String) - */ - public String getJsMessage(String messageclass, String viewId) - { - Hashtable msgset = jsmessages.get(messageclass); - if (msgset != null) - { - String[] msgs = msgset.get(viewId); - if (msgs != null) - { - for (int i = 0; i < msgs.length; i++) - { - if (msgs[i] != null) - { - String m = msgs[i]; - msgs[i] = null; - return m; - } - } - } - } - return ""; - } - - public boolean isJsMessageSetChanged(String string, String string2, - String[] colcommands) - { - long[] l = jshashes.get(string + "|" + string2); - if (l == null && colcommands != null) - { - return true; - } - for (int i = 0; i < colcommands.length; i++) - { - if (l[i] != colcommands[i].hashCode()) - { - return true; - } - } - return false; - } - - private Vector jsExecQueue = new Vector(); - - public Vector getJsExecQueue() - { - return jsExecQueue; - } - - public void setExecutor(JSFunctionExec jsFunctionExec2) - { - jsFunctionExec = jsFunctionExec2; - } - - /** - * return the given colour value parameter or the given default if parameter - * not given - * - * @param colparam - * @param defcolour - * @return - */ - public Color getDefaultColourParameter(String colparam, Color defcolour) - { - String colprop = getParameter(colparam); - if (colprop == null || colprop.trim().length() == 0) - { - return defcolour; - } - Color col = jalview.schemes.ColourSchemeProperty - .getAWTColorFromName(colprop); - if (col == null) - { - try - { - col = new jalview.schemes.UserColourScheme(colprop).findColour('A'); - } catch (Exception ex) - { - System.err.println("Couldn't parse '" + colprop - + "' as a colour for " + colparam); - col = null; - } - } - return (col == null) ? defcolour : col; - - } - - public void openJalviewHelpUrl() - { - String helpUrl = getParameter("jalviewhelpurl"); - if (helpUrl == null || helpUrl.trim().length() < 5) - { - helpUrl = "http://www.jalview.org/help.html"; - } - showURL(helpUrl, "HELP"); - } - - /** - * form a complete URL given a path to a resource and a reference location on - * the same server - * - * @param url - * - an absolute path on the same server as localref or a document - * located relative to localref - * @param localref - * - a URL on the same server as url - * @return a complete URL for the resource located by url - */ - private String resolveUrlForLocalOrAbsolute(String url, URL localref) - { - String codebase = localref.toString(); - if (url.indexOf("/") == 0) - { - url = codebase.substring(0, codebase.length() - - localref.getFile().length()) - + url; - } - else - { - url = localref + url; - } - return url; - } - - /** - * open a URL in the browser - resolving it according to relative refs and - * coping with javascript: protocol if necessary. - * - * @param url - * @param target - */ - public void showURL(String url, String target) - { - try - { - if (url.indexOf(":") == -1) - { - // TODO: verify (Bas Vroling bug) prepend codebase or server URL to - // form valid URL - // Should really use docbase, not codebase. - URL prepend; - url = resolveUrlForLocalOrAbsolute( - url, - prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase() - : getCodeBase()); - if (debug) - { - System.err - .println("Show url (prepended " - + prepend - + " - toggle resolvetocodebase if code/docbase resolution is wrong): " - + url); - } - } - else - { - if (debug) - { - System.err.println("Show url: " + url); - } - } - if (url.indexOf("javascript:") == 0) - { - // no target for the javascript context - getAppletContext().showDocument(new java.net.URL(url)); - } - else - { - getAppletContext().showDocument(new java.net.URL(url), target); - } - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - - /** - * bind structures in a viewer to any matching sequences in an alignFrame (use - * sequenceIds to limit scope of search to specific sequences) - * - * @param alFrame - * @param viewer - * @param sequenceIds - * @return TODO: consider making an exception structure for indicating when - * binding fails public SequenceStructureBinding - * addStructureViewInstance( AlignFrame alFrame, Object viewer, String - * sequenceIds) { - * - * if (sequenceIds != null && sequenceIds.length() > 0) { return - * alFrame.addStructureViewInstance(viewer, - * separatorListToArray(sequenceIds)); } else { return - * alFrame.addStructureViewInstance(viewer, null); } // return null; } - */ -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.bin; + +import jalview.api.StructureSelectionManagerProvider; +import jalview.appletgui.AlignFrame; +import jalview.appletgui.AlignViewport; +import jalview.appletgui.EmbmenuFrame; +import jalview.appletgui.FeatureSettings; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentOrder; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.io.AnnotationFile; +import jalview.io.AppletFormatAdapter; +import jalview.io.FileParse; +import jalview.io.IdentifyFile; +import jalview.io.JnetAnnotationMaker; +import jalview.javascript.JSFunctionExec; +import jalview.javascript.JalviewLiteJsApi; +import jalview.javascript.JsCallBack; +import jalview.structure.SelectionListener; +import jalview.structure.StructureSelectionManager; + +import java.applet.Applet; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.Hashtable; +import java.util.StringTokenizer; +import java.util.Vector; + +import netscape.javascript.JSObject; + +/** + * Jalview Applet. Runs in Java 1.18 runtime + * + * @author $author$ + * @version $Revision: 1.92 $ + */ +public class JalviewLite extends Applet implements + StructureSelectionManagerProvider, JalviewLiteJsApi +{ + + public StructureSelectionManager getStructureSelectionManager() + { + return StructureSelectionManager.getStructureSelectionManager(this); + } + + // ///////////////////////////////////////// + // The following public methods maybe called + // externally, eg via javascript in HTML page + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences() + */ + public String getSelectedSequences() + { + return getSelectedSequencesFrom(getDefaultTargetFrame()); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getSelectedSequences(java.lang.String) + */ + public String getSelectedSequences(String sep) + { + return getSelectedSequencesFrom(getDefaultTargetFrame(), sep); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui + * .AlignFrame) + */ + public String getSelectedSequencesFrom(AlignFrame alf) + { + return getSelectedSequencesFrom(alf, separator); // ""+0x00AC); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getSelectedSequencesFrom(jalview.appletgui + * .AlignFrame, java.lang.String) + */ + public String getSelectedSequencesFrom(AlignFrame alf, String sep) + { + StringBuffer result = new StringBuffer(""); + if (sep == null || sep.length() == 0) + { + sep = separator; // "+0x00AC; + } + if (alf.viewport.getSelectionGroup() != null) + { + SequenceI[] seqs = alf.viewport.getSelectionGroup() + .getSequencesInOrder(alf.viewport.getAlignment()); + + for (int i = 0; i < seqs.length; i++) + { + result.append(seqs[i].getName()); + result.append(sep); + } + } + + return result.toString(); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#highlight(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void highlight(String sequenceId, String position, + String alignedPosition) + { + highlightIn(getDefaultTargetFrame(), sequenceId, position, + alignedPosition); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#highlightIn(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String, java.lang.String) + */ + public void highlightIn(final AlignFrame alf, final String sequenceId, + final String position, final String alignedPosition) + { + // TODO: could try to highlight in all alignments if alf==null + jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + alf.viewport.getAlignment().getSequencesArray()); + final SequenceI sq = matcher.findIdMatch(sequenceId); + if (sq != null) + { + int apos = -1; + try + { + apos = new Integer(position).intValue(); + apos--; + } catch (NumberFormatException ex) + { + return; + } + final StructureSelectionManagerProvider me = this; + final int pos = apos; + // use vamsas listener to broadcast to all listeners in scope + if (alignedPosition != null + && (alignedPosition.trim().length() == 0 || alignedPosition + .toLowerCase().indexOf("false") > -1)) + { + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + StructureSelectionManager.getStructureSelectionManager(me) + .mouseOverVamsasSequence(sq, sq.findIndex(pos), null); + } + }); + } + else + { + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + StructureSelectionManager.getStructureSelectionManager(me) + .mouseOverVamsasSequence(sq, pos, null); + } + }); + } + } + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, + * java.lang.String) + */ + public void select(String sequenceIds, String columns) + { + selectIn(getDefaultTargetFrame(), sequenceIds, columns, separator); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#select(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void select(String sequenceIds, String columns, String sep) + { + selectIn(getDefaultTargetFrame(), sequenceIds, columns, sep); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String) + */ + public void selectIn(AlignFrame alf, String sequenceIds, String columns) + { + selectIn(alf, sequenceIds, columns, separator); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#selectIn(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String, java.lang.String) + */ + public void selectIn(final AlignFrame alf, String sequenceIds, + String columns, String sep) + { + if (sep == null || sep.length() == 0) + { + sep = separator; + } + else + { + if (debug) + { + System.err.println("Selecting region using separator string '" + + separator + "'"); + } + } + // deparse fields + String[] ids = separatorListToArray(sequenceIds, sep); + String[] cols = separatorListToArray(columns, sep); + final SequenceGroup sel = new SequenceGroup(); + final ColumnSelection csel = new ColumnSelection(); + AlignmentI al = alf.viewport.getAlignment(); + jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + alf.viewport.getAlignment().getSequencesArray()); + int start = 0, end = al.getWidth(), alw = al.getWidth(); + boolean seqsfound = true; + if (ids != null && ids.length > 0) + { + seqsfound = false; + for (int i = 0; i < ids.length; i++) + { + if (ids[i].trim().length() == 0) + { + continue; + } + SequenceI sq = matcher.findIdMatch(ids[i]); + if (sq != null) + { + seqsfound = true; + sel.addSequence(sq, false); + } + } + } + boolean inseqpos = false; + if (cols != null && cols.length > 0) + { + boolean seset = false; + for (int i = 0; i < cols.length; i++) + { + String cl = cols[i].trim(); + if (cl.length() == 0) + { + continue; + } + int p; + if ((p = cl.indexOf("-")) > -1) + { + int from = -1, to = -1; + try + { + from = new Integer(cl.substring(0, p)).intValue(); + from--; + } catch (NumberFormatException ex) + { + System.err + .println("ERROR: Couldn't parse first integer in range element column selection string '" + + cl + "' - format is 'from-to'"); + return; + } + try + { + to = new Integer(cl.substring(p + 1)).intValue(); + to--; + } catch (NumberFormatException ex) + { + System.err + .println("ERROR: Couldn't parse second integer in range element column selection string '" + + cl + "' - format is 'from-to'"); + return; + } + if (from >= 0 && to >= 0) + { + // valid range + if (from < to) + { + int t = to; + to = from; + to = t; + } + if (!seset) + { + start = from; + end = to; + seset = true; + } + else + { + // comment to prevent range extension + if (start > from) + { + start = from; + } + if (end < to) + { + end = to; + } + } + for (int r = from; r <= to; r++) + { + if (r >= 0 && r < alw) + { + csel.addElement(r); + } + } + if (debug) + { + System.err.println("Range '" + cl + "' deparsed as [" + from + + "," + to + "]"); + } + } + else + { + System.err.println("ERROR: Invalid Range '" + cl + + "' deparsed as [" + from + "," + to + "]"); + } + } + else + { + int r = -1; + try + { + r = new Integer(cl).intValue(); + r--; + } catch (NumberFormatException ex) + { + if (cl.toLowerCase().equals("sequence")) + { + // we are in the dataset sequence's coordinate frame. + inseqpos = true; + } + else + { + System.err + .println("ERROR: Couldn't parse integer from point selection element of column selection string '" + + cl + "'"); + return; + } + } + if (r >= 0 && r <= alw) + { + if (!seset) + { + start = r; + end = r; + seset = true; + } + else + { + // comment to prevent range extension + if (start > r) + { + start = r; + } + if (end < r) + { + end = r; + } + } + csel.addElement(r); + if (debug) + { + System.err.println("Point selection '" + cl + + "' deparsed as [" + r + "]"); + } + } + else + { + System.err.println("ERROR: Invalid Point selection '" + cl + + "' deparsed as [" + r + "]"); + } + } + } + } + if (seqsfound) + { + // we only propagate the selection when it was the null selection, or the + // given sequences were found in the alignment. + if (inseqpos && sel.getSize() > 0) + { + // assume first sequence provides reference frame ? + SequenceI rs = sel.getSequenceAt(0); + start = rs.findIndex(start); + end = rs.findIndex(end); + if (csel != null) + { + Vector cs = csel.getSelected(); + csel.clear(); + for (int csi = 0, csiS = cs.size(); csi < csiS; csi++) + { + csel.addElement(rs.findIndex(((Integer) cs.elementAt(csi)) + .intValue())); + } + } + } + sel.setStartRes(start); + sel.setEndRes(end); + EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + alf.select(sel, csel); + } + }); + } + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignment(java.lang. + * String, java.lang.String) + */ + public String getSelectedSequencesAsAlignment(String format, String suffix) + { + return getSelectedSequencesAsAlignmentFrom(getDefaultTargetFrame(), + format, suffix); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getSelectedSequencesAsAlignmentFrom(jalview + * .appletgui.AlignFrame, java.lang.String, java.lang.String) + */ + public String getSelectedSequencesAsAlignmentFrom(AlignFrame alf, + String format, String suffix) + { + try + { + boolean seqlimits = suffix.equalsIgnoreCase("true"); + if (alf.viewport.getSelectionGroup() != null) + { + // JBPNote: getSelectionAsNewSequence behaviour has changed - this + // method now returns a full copy of sequence data + // TODO consider using getSequenceSelection instead here + String reply = new AppletFormatAdapter().formatSequences(format, + new Alignment(alf.viewport.getSelectionAsNewSequence()), + seqlimits); + return reply; + } + } catch (Exception ex) + { + ex.printStackTrace(); + return "Error retrieving alignment in " + format + " format. "; + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getAlignmentOrder() + */ + public String getAlignmentOrder() + { + return getAlignmentOrderFrom(getDefaultTargetFrame()); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame + * ) + */ + public String getAlignmentOrderFrom(AlignFrame alf) + { + return getAlignmentOrderFrom(alf, separator); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getAlignmentOrderFrom(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public String getAlignmentOrderFrom(AlignFrame alf, String sep) + { + AlignmentI alorder = alf.getAlignViewport().getAlignment(); + String[] order = new String[alorder.getHeight()]; + for (int i = 0; i < order.length; i++) + { + order[i] = alorder.getSequenceAt(i).getName(); + } + return arrayToSeparatorList(order); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, + * java.lang.String) + */ + public String orderBy(String order, String undoName) + { + return orderBy(order, undoName, separator); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#orderBy(java.lang.String, + * java.lang.String, java.lang.String) + */ + public String orderBy(String order, String undoName, String sep) + { + return orderAlignmentBy(getDefaultTargetFrame(), order, undoName, sep); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#orderAlignmentBy(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String, java.lang.String) + */ + public String orderAlignmentBy(AlignFrame alf, String order, + String undoName, String sep) + { + String[] ids = separatorListToArray(order, sep); + SequenceI[] sqs = null; + if (ids != null && ids.length > 0) + { + jalview.analysis.SequenceIdMatcher matcher = new jalview.analysis.SequenceIdMatcher( + alf.viewport.getAlignment().getSequencesArray()); + int s = 0; + sqs = new SequenceI[ids.length]; + for (int i = 0; i < ids.length; i++) + { + if (ids[i].trim().length() == 0) + { + continue; + } + SequenceI sq = matcher.findIdMatch(ids[i]); + if (sq != null) + { + sqs[s++] = sq; + } + } + if (s > 0) + { + SequenceI[] sqq = new SequenceI[s]; + System.arraycopy(sqs, 0, sqq, 0, s); + sqs = sqq; + } + else + { + sqs = null; + } + } + if (sqs == null) + { + return ""; + } + ; + final AlignmentOrder aorder = new AlignmentOrder(sqs); + + if (undoName != null && undoName.trim().length() == 0) + { + undoName = null; + } + final String _undoName = undoName; + // TODO: deal with synchronization here: cannot raise any events until after + // this has returned. + return alf.sortBy(aorder, _undoName) ? "true" : ""; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String) + */ + public String getAlignment(String format) + { + return getAlignmentFrom(getDefaultTargetFrame(), format, "true"); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, + * java.lang.String) + */ + public String getAlignmentFrom(AlignFrame alf, String format) + { + return getAlignmentFrom(alf, format, "true"); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getAlignment(java.lang.String, + * java.lang.String) + */ + public String getAlignment(String format, String suffix) + { + return getAlignmentFrom(getDefaultTargetFrame(), format, suffix); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getAlignmentFrom(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String) + */ + public String getAlignmentFrom(AlignFrame alf, String format, + String suffix) + { + try + { + boolean seqlimits = suffix.equalsIgnoreCase("true"); + + String reply = new AppletFormatAdapter().formatSequences(format, + alf.viewport.getAlignment(), seqlimits); + return reply; + } catch (Exception ex) + { + ex.printStackTrace(); + return "Error retrieving alignment in " + format + " format. "; + } + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) + */ + public void loadAnnotation(String annotation) + { + loadAnnotationFrom(getDefaultTargetFrame(), annotation); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public void loadAnnotationFrom(AlignFrame alf, String annotation) + { + if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport() + .getAlignment(), annotation, AppletFormatAdapter.PASTE)) + { + alf.alignPanel.fontChanged(); + alf.alignPanel.setScrollValues(0, 0); + } + else + { + alf.parseFeaturesFile(annotation, AppletFormatAdapter.PASTE); + } + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#loadAnnotation(java.lang.String) + */ + public void loadFeatures(String features, boolean autoenabledisplay) + { + loadFeaturesFrom(getDefaultTargetFrame(), features, autoenabledisplay); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public boolean loadFeaturesFrom(AlignFrame alf, String features, + boolean autoenabledisplay) + { + return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, + autoenabledisplay); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getFeatures(java.lang.String) + */ + public String getFeatures(String format) + { + return getFeaturesFrom(getDefaultTargetFrame(), format); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getFeaturesFrom(jalview.appletgui.AlignFrame, + * java.lang.String) + */ + public String getFeaturesFrom(AlignFrame alf, String format) + { + return alf.outputFeatures(false, format); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getAnnotation() + */ + public String getAnnotation() + { + return getAnnotationFrom(getDefaultTargetFrame()); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getAnnotationFrom(jalview.appletgui.AlignFrame + * ) + */ + public String getAnnotationFrom(AlignFrame alf) + { + return alf.outputAnnotations(false); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#newView() + */ + public AlignFrame newView() + { + return newViewFrom(getDefaultTargetFrame()); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#newView(java.lang.String) + */ + public AlignFrame newView(String name) + { + return newViewFrom(getDefaultTargetFrame(), name); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame) + */ + public AlignFrame newViewFrom(AlignFrame alf) + { + return alf.newView(null); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#newViewFrom(jalview.appletgui.AlignFrame, + * java.lang.String) + */ + public AlignFrame newViewFrom(AlignFrame alf, String name) + { + return alf.newView(name); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#loadAlignment(java.lang.String, + * java.lang.String) + */ + public AlignFrame loadAlignment(String text, String title) + { + Alignment al = null; + + String format = new IdentifyFile().Identify(text, + AppletFormatAdapter.PASTE); + try + { + al = new AppletFormatAdapter().readFile(text, + AppletFormatAdapter.PASTE, format); + if (al.getHeight() > 0) + { + return new AlignFrame(al, this, title, false); + } + } catch (java.io.IOException ex) + { + ex.printStackTrace(); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setMouseoverListener(java.lang.String) + */ + public void setMouseoverListener(String listener) + { + setMouseoverListener(currentAlignFrame, listener); + } + + private Vector javascriptListeners = new Vector(); + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#setMouseoverListener(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public void setMouseoverListener(AlignFrame af, String listener) + { + if (listener != null) + { + listener = listener.trim(); + if (listener.length() == 0) + { + System.err + .println("jalview Javascript error: Ignoring empty function for mouseover listener."); + return; + } + } + jalview.javascript.MouseOverListener mol = new jalview.javascript.MouseOverListener( + this, af, listener); + javascriptListeners.addElement(mol); + StructureSelectionManager.getStructureSelectionManager(this) + .addStructureViewerListener(mol); + if (debug) + { + System.err.println("Added a mouseover listener for " + + ((af == null) ? "All frames" : "Just views for " + + af.getAlignViewport().getSequenceSetId())); + System.err.println("There are now " + javascriptListeners.size() + + " listeners in total."); + } + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setSelectionListener(java.lang.String) + */ + public void setSelectionListener(String listener) + { + setSelectionListener(null, listener); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#setSelectionListener(jalview.appletgui.AlignFrame + * , java.lang.String) + */ + public void setSelectionListener(AlignFrame af, String listener) + { + if (listener != null) + { + listener = listener.trim(); + if (listener.length() == 0) + { + System.err + .println("jalview Javascript error: Ignoring empty function for selection listener."); + return; + } + } + jalview.javascript.JsSelectionSender mol = new jalview.javascript.JsSelectionSender( + this, af, listener); + javascriptListeners.addElement(mol); + StructureSelectionManager.getStructureSelectionManager(this) + .addSelectionListener(mol); + if (debug) + { + System.err.println("Added a selection listener for " + + ((af == null) ? "All frames" : "Just views for " + + af.getAlignViewport().getSequenceSetId())); + System.err.println("There are now " + javascriptListeners.size() + + " listeners in total."); + } + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setStructureListener(java.lang.String, + * java.lang.String) + */ + public void setStructureListener(String listener, String modelSet) + { + if (listener != null) + { + listener = listener.trim(); + if (listener.length() == 0) + { + System.err + .println("jalview Javascript error: Ignoring empty function for selection listener."); + return; + } + } + jalview.javascript.MouseOverStructureListener mol = new jalview.javascript.MouseOverStructureListener( + this, listener, separatorListToArray(modelSet)); + javascriptListeners.addElement(mol); + StructureSelectionManager.getStructureSelectionManager(this) + .addStructureViewerListener(mol); + if (debug) + { + System.err.println("Added a javascript structure viewer listener '" + + listener + "'"); + System.err.println("There are now " + javascriptListeners.size() + + " listeners in total."); + } + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#removeJavascriptListener(jalview.appletgui + * .AlignFrame, java.lang.String) + */ + public void removeJavascriptListener(AlignFrame af, String listener) + { + if (listener != null) + { + listener = listener.trim(); + if (listener.length() == 0) + { + listener = null; + } + } + boolean rprt = false; + for (int ms = 0, msSize = javascriptListeners.size(); ms < msSize;) + { + Object lstn = javascriptListeners.elementAt(ms); + JsCallBack lstner = (JsCallBack) lstn; + if ((af == null || lstner.getAlignFrame() == af) + && (listener == null || lstner.getListenerFunction().equals( + listener))) + { + javascriptListeners.removeElement(lstner); + msSize--; + if (lstner instanceof SelectionListener) + { + StructureSelectionManager.getStructureSelectionManager(this) + .removeSelectionListener((SelectionListener) lstner); + } + else + { + StructureSelectionManager.getStructureSelectionManager(this) + .removeStructureViewerListener(lstner, null); + } + rprt = debug; + if (debug) + { + System.err.println("Removed listener '" + listener + "'"); + } + } + else + { + ms++; + } + } + if (rprt) + { + System.err.println("There are now " + javascriptListeners.size() + + " listeners in total."); + } + } + + public void stop() + { + System.err.println("Applet " + getName() + " stop()."); + tidyUp(); + } + + public void destroy() + { + System.err.println("Applet " + getName() + " destroy()."); + tidyUp(); + } + + private void tidyUp() + { + removeAll(); + if (currentAlignFrame != null && currentAlignFrame.viewport != null + && currentAlignFrame.viewport.applet != null) + { + AlignViewport av = currentAlignFrame.viewport; + currentAlignFrame.closeMenuItem_actionPerformed(); + av.applet = null; + currentAlignFrame = null; + } + if (javascriptListeners != null) + { + while (javascriptListeners.size() > 0) + { + jalview.javascript.JSFunctionExec mol = javascriptListeners + .elementAt(0); + javascriptListeners.removeElement(mol); + if (mol instanceof SelectionListener) + { + StructureSelectionManager.getStructureSelectionManager(this) + .removeSelectionListener((SelectionListener) mol); + } + else + { + StructureSelectionManager.getStructureSelectionManager(this) + .removeStructureViewerListener(mol, null); + } + mol.jvlite = null; + } + } + if (jsFunctionExec != null) + { + jsFunctionExec.stopQueue(); + jsFunctionExec.jvlite = null; + } + initialAlignFrame = null; + jsFunctionExec = null; + javascriptListeners = null; + StructureSelectionManager.release(this); + } + + private jalview.javascript.JSFunctionExec jsFunctionExec; + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#mouseOverStructure(java.lang.String, + * java.lang.String, java.lang.String) + */ + public void mouseOverStructure(final String pdbResNum, + final String chain, final String pdbfile) + { + final StructureSelectionManagerProvider me = this; + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + try + { + StructureSelectionManager.getStructureSelectionManager(me) + .mouseOverStructure(new Integer(pdbResNum).intValue(), + chain, pdbfile); + if (debug) + { + System.err.println("mouseOver for '" + pdbResNum + + "' in chain '" + chain + "' in structure '" + pdbfile + + "'"); + } + } catch (NumberFormatException e) + { + System.err.println("Ignoring invalid residue number string '" + + pdbResNum + "'"); + } + + } + }); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#scrollViewToIn(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String) + */ + public void scrollViewToIn(final AlignFrame alf, final String topRow, + final String leftHandColumn) + { + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + try + { + alf.scrollTo(new Integer(topRow).intValue(), new Integer( + leftHandColumn).intValue()); + + } catch (Exception ex) + { + System.err.println("Couldn't parse integer arguments (topRow='" + + topRow + "' and leftHandColumn='" + leftHandColumn + + "')"); + ex.printStackTrace(); + } + } + }); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.javascript.JalviewLiteJsApi#scrollViewToRowIn(jalview.appletgui + * .AlignFrame, java.lang.String) + */ + @Override + public void scrollViewToRowIn(final AlignFrame alf, final String topRow) + { + + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + try + { + alf.scrollToRow(new Integer(topRow).intValue()); + + } catch (Exception ex) + { + System.err.println("Couldn't parse integer arguments (topRow='" + + topRow + "')"); + ex.printStackTrace(); + } + + } + }); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.javascript.JalviewLiteJsApi#scrollViewToColumnIn(jalview.appletgui + * .AlignFrame, java.lang.String) + */ + @Override + public void scrollViewToColumnIn(final AlignFrame alf, + final String leftHandColumn) + { + java.awt.EventQueue.invokeLater(new Runnable() + { + + @Override + public void run() + { + try + { + alf.scrollToColumn(new Integer(leftHandColumn).intValue()); + + } catch (Exception ex) + { + System.err + .println("Couldn't parse integer arguments (leftHandColumn='" + + leftHandColumn + "')"); + ex.printStackTrace(); + } + } + }); + + } + + // ////////////////////////////////////////////// + // ////////////////////////////////////////////// + + public static int lastFrameX = 200; + + public static int lastFrameY = 200; + + boolean fileFound = true; + + String file = "No file"; + + Button launcher = new Button("Start Jalview"); + + /** + * The currentAlignFrame is static, it will change if and when the user + * selects a new window. Note that it will *never* point back to the embedded + * AlignFrame if the applet is started as embedded on the page and then + * afterwards a new view is created. + */ + public AlignFrame currentAlignFrame = null; + + /** + * This is the first frame to be displayed, and does not change. API calls + * will default to this instance if currentAlignFrame is null. + */ + AlignFrame initialAlignFrame = null; + + boolean embedded = false; + + private boolean checkForJmol = true; + + private boolean checkedForJmol = false; // ensure we don't check for jmol + + // every time the app is re-inited + + public boolean jmolAvailable = false; + + private boolean alignPdbStructures = false; + + /** + * use an external structure viewer exclusively (no jmols or MCViews will be + * opened by JalviewLite itself) + */ + public boolean useXtrnalSviewer = false; + + public static boolean debug = false; + + static String builddate = null, version = null; + + private static void initBuildDetails() + { + if (builddate == null) + { + builddate = "unknown"; + version = "test"; + java.net.URL url = JalviewLite.class + .getResource("/.build_properties"); + if (url != null) + { + try + { + BufferedReader reader = new BufferedReader(new InputStreamReader( + url.openStream())); + String line; + while ((line = reader.readLine()) != null) + { + if (line.indexOf("VERSION") > -1) + { + version = line.substring(line.indexOf("=") + 1); + } + if (line.indexOf("BUILD_DATE") > -1) + { + builddate = line.substring(line.indexOf("=") + 1); + } + } + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + } + } + + public static String getBuildDate() + { + initBuildDetails(); + return builddate; + } + + public static String getVersion() + { + initBuildDetails(); + return version; + } + + // public JSObject scriptObject = null; + + /** + * init method for Jalview Applet + */ + public void init() + { + // remove any handlers that might be hanging around from an earlier instance + try + { + if (debug) + { + System.err.println("Applet context is '" + + getAppletContext().getClass().toString() + "'"); + } + JSObject scriptObject = JSObject.getWindow(this); + if (debug && scriptObject != null) + { + System.err.println("Applet has Javascript callback support."); + } + + } catch (Exception ex) + { + System.err + .println("Warning: No JalviewLite javascript callbacks available."); + if (debug) + { + ex.printStackTrace(); + } + } + /** + * turn on extra applet debugging + */ + String dbg = getParameter("debug"); + if (dbg != null) + { + debug = dbg.toLowerCase().equals("true"); + } + if (debug) + { + + System.err.println("JalviewLite Version " + getVersion()); + System.err.println("Build Date : " + getBuildDate()); + + } + String externalsviewer = getParameter("externalstructureviewer"); + if (externalsviewer != null) + { + useXtrnalSviewer = externalsviewer.trim().toLowerCase() + .equals("true"); + } + /** + * if true disable the check for jmol + */ + String chkforJmol = getParameter("nojmol"); + if (chkforJmol != null) + { + checkForJmol = !chkforJmol.equals("true"); + } + /** + * get the separator parameter if present + */ + String sep = getParameter("separator"); + if (sep != null) + { + if (sep.length() > 0) + { + separator = sep; + if (debug) + { + System.err.println("Separator set to '" + separator + "'"); + } + } + else + { + throw new Error( + "Invalid separator parameter - must be non-zero length"); + } + } + int r = 255; + int g = 255; + int b = 255; + String param = getParameter("RGB"); + + if (param != null) + { + try + { + r = Integer.parseInt(param.substring(0, 2), 16); + g = Integer.parseInt(param.substring(2, 4), 16); + b = Integer.parseInt(param.substring(4, 6), 16); + } catch (Exception ex) + { + r = 255; + g = 255; + b = 255; + } + } + param = getParameter("label"); + if (param != null) + { + launcher.setLabel(param); + } + + setBackground(new Color(r, g, b)); + + file = getParameter("file"); + + if (file == null) + { + // Maybe the sequences are added as parameters + StringBuffer data = new StringBuffer("PASTE"); + int i = 1; + while ((file = getParameter("sequence" + i)) != null) + { + data.append(file.toString() + "\n"); + i++; + } + if (data.length() > 5) + { + file = data.toString(); + } + } + + final JalviewLite jvapplet = this; + if (getParameter("embedded") != null + && getParameter("embedded").equalsIgnoreCase("true")) + { + // Launch as embedded applet in page + embedded = true; + LoadingThread loader = new LoadingThread(file, jvapplet); + loader.start(); + } + else if (file != null) + { + if (getParameter("showbutton") == null + || !getParameter("showbutton").equalsIgnoreCase("false")) + { + // Add the JalviewLite 'Button' to the page + add(launcher); + launcher.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + LoadingThread loader = new LoadingThread(file, jvapplet); + loader.start(); + } + }); + } + else + { + // Open jalviewLite immediately. + LoadingThread loader = new LoadingThread(file, jvapplet); + loader.start(); + } + } + else + { + // jalview initialisation with no alignment. loadAlignment() method can + // still be called to open new alignments. + file = "NO FILE"; + fileFound = false; + // callInitCallback(); + } + } + + private void callInitCallback() + { + String initjscallback = getParameter("oninit"); + if (initjscallback == null) + { + return; + } + initjscallback = initjscallback.trim(); + if (initjscallback.length() > 0) + { + JSObject scriptObject = null; + try + { + scriptObject = JSObject.getWindow(this); + } catch (Exception ex) + { + } + ; + if (scriptObject != null) + { + try + { + // do onInit with the JS executor thread + new JSFunctionExec(this).executeJavascriptFunction(true, + initjscallback, null, "Calling oninit callback '" + + initjscallback + "'."); + } catch (Exception e) + { + System.err.println("Exception when executing _oninit callback '" + + initjscallback + "'."); + e.printStackTrace(); + } + } + else + { + System.err.println("Not executing _oninit callback '" + + initjscallback + "' - no scripting allowed."); + } + } + } + + /** + * Initialises and displays a new java.awt.Frame + * + * @param frame + * java.awt.Frame to be displayed + * @param title + * title of new frame + * @param width + * width if new frame + * @param height + * height of new frame + */ + public static void addFrame(final Frame frame, String title, int width, + int height) + { + frame.setLocation(lastFrameX, lastFrameY); + lastFrameX += 40; + lastFrameY += 40; + frame.setSize(width, height); + frame.setTitle(title); + frame.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + if (frame instanceof AlignFrame) + { + AlignViewport vp = ((AlignFrame) frame).viewport; + ((AlignFrame) frame).closeMenuItem_actionPerformed(); + if (vp.applet.currentAlignFrame == frame) + { + vp.applet.currentAlignFrame = null; + } + vp.applet = null; + vp = null; + + } + lastFrameX -= 40; + lastFrameY -= 40; + if (frame instanceof EmbmenuFrame) + { + ((EmbmenuFrame) frame).destroyMenus(); + } + frame.setMenuBar(null); + frame.dispose(); + } + + public void windowActivated(WindowEvent e) + { + if (frame instanceof AlignFrame) + { + ((AlignFrame) frame).viewport.applet.currentAlignFrame = (AlignFrame) frame; + if (debug) + { + System.err.println("Activated window " + frame); + } + } + // be good. + super.windowActivated(e); + } + /* + * Probably not necessary to do this - see TODO above. (non-Javadoc) + * + * @see + * java.awt.event.WindowAdapter#windowDeactivated(java.awt.event.WindowEvent + * ) + * + * public void windowDeactivated(WindowEvent e) { if (currentAlignFrame == + * frame) { currentAlignFrame = null; if (debug) { + * System.err.println("Deactivated window "+frame); } } + * super.windowDeactivated(e); } + */ + }); + frame.setVisible(true); + } + + /** + * This paints the background surrounding the "Launch Jalview button"
                + *
                + * If file given in parameter not found, displays error message + * + * @param g + * graphics context + */ + public void paint(Graphics g) + { + if (!fileFound) + { + g.setColor(new Color(200, 200, 200)); + g.setColor(Color.cyan); + g.fillRect(0, 0, getSize().width, getSize().height); + g.setColor(Color.red); + g.drawString("Jalview can't open file", 5, 15); + g.drawString("\"" + file + "\"", 5, 30); + } + else if (embedded) + { + g.setColor(Color.black); + g.setFont(new Font("Arial", Font.BOLD, 24)); + g.drawString("Jalview Applet", 50, getSize().height / 2 - 30); + g.drawString("Loading Data...", 50, getSize().height / 2); + } + } + + /** + * get all components associated with the applet of the given type + * + * @param class1 + * @return + */ + public Vector getAppletWindow(Class class1) + { + Vector wnds = new Vector(); + Component[] cmp = getComponents(); + if (cmp != null) + { + for (int i = 0; i < cmp.length; i++) + { + if (class1.isAssignableFrom(cmp[i].getClass())) + { + wnds.addElement(cmp); + } + } + } + return wnds; + } + + class LoadJmolThread extends Thread + { + private boolean running = false; + + public void run() + { + if (running || checkedForJmol) + { + return; + } + running = true; + if (checkForJmol) + { + try + { + if (!System.getProperty("java.version").startsWith("1.1")) + { + Class.forName("org.jmol.adapter.smarter.SmarterJmolAdapter"); + jmolAvailable = true; + } + if (!jmolAvailable) + { + System.out + .println("Jmol not available - Using MCview for structures"); + } + } catch (java.lang.ClassNotFoundException ex) + { + } + } + else + { + jmolAvailable = false; + if (debug) + { + System.err + .println("Skipping Jmol check. Will use MCView (probably)"); + } + } + checkedForJmol = true; + running = false; + } + + public boolean notFinished() + { + return running || !checkedForJmol; + } + } + + class LoadingThread extends Thread + { + /** + * State variable: File source + */ + String file; + + /** + * State variable: protocol for access to file source + */ + String protocol; + + /** + * State variable: format of file source + */ + String format; + + String _file; + + JalviewLite applet; + + private void dbgMsg(String msg) + { + if (applet.debug) + { + System.err.println(msg); + } + } + + /** + * update the protocol state variable for accessing the datasource located + * by file. + * + * @param file + * @return possibly updated datasource string + */ + public String setProtocolState(String file) + { + if (file.startsWith("PASTE")) + { + file = file.substring(5); + protocol = AppletFormatAdapter.PASTE; + } + else if (inArchive(file)) + { + protocol = AppletFormatAdapter.CLASSLOADER; + } + else + { + file = addProtocol(file); + protocol = AppletFormatAdapter.URL; + } + dbgMsg("Protocol identified as '" + protocol + "'"); + return file; + } + + public LoadingThread(String _file, JalviewLite _applet) + { + this._file = _file; + applet = _applet; + } + + public void run() + { + LoadJmolThread jmolchecker = new LoadJmolThread(); + jmolchecker.start(); + while (jmolchecker.notFinished()) + { + // wait around until the Jmol check is complete. + try + { + Thread.sleep(2); + } catch (Exception e) + { + } + ; + } + startLoading(); + // applet.callInitCallback(); + } + + private void startLoading() + { + AlignFrame newAlignFrame; + dbgMsg("Loading thread started with:\n>>file\n" + _file + ">>endfile"); + file = setProtocolState(_file); + + format = new jalview.io.IdentifyFile().Identify(file, protocol); + dbgMsg("File identified as '" + format + "'"); + dbgMsg("Loading started."); + Alignment al = null; + try + { + al = new AppletFormatAdapter().readFile(file, protocol, format); + } catch (java.io.IOException ex) + { + dbgMsg("File load exception."); + ex.printStackTrace(); + if (debug) + { + try + { + FileParse fp = new FileParse(file, protocol); + String ln = null; + dbgMsg(">>>Dumping contents of '" + file + "' " + "(" + + protocol + ")"); + while ((ln = fp.nextLine()) != null) + { + dbgMsg(ln); + } + dbgMsg(">>>Dump finished."); + } catch (Exception e) + { + System.err + .println("Exception when trying to dump the content of the file parameter."); + e.printStackTrace(); + } + } + } + if ((al != null) && (al.getHeight() > 0)) + { + dbgMsg("Successfully loaded file."); + newAlignFrame = new AlignFrame(al, applet, file, embedded); + if (initialAlignFrame == null) + { + initialAlignFrame = newAlignFrame; + } + // update the focus. + currentAlignFrame = newAlignFrame; + + if (protocol == jalview.io.AppletFormatAdapter.PASTE) + { + newAlignFrame.setTitle("Sequences from " + + applet.getDocumentBase()); + } + + newAlignFrame.statusBar.setText("Successfully loaded file " + file); + + String treeFile = applet.getParameter("tree"); + if (treeFile == null) + { + treeFile = applet.getParameter("treeFile"); + } + + if (treeFile != null) + { + try + { + treeFile = setProtocolState(treeFile); + /* + * if (inArchive(treeFile)) { protocol = + * AppletFormatAdapter.CLASSLOADER; } else { protocol = + * AppletFormatAdapter.URL; treeFile = addProtocol(treeFile); } + */ + jalview.io.NewickFile fin = new jalview.io.NewickFile(treeFile, + protocol); + + fin.parse(); + + if (fin.getTree() != null) + { + newAlignFrame.loadTree(fin, treeFile); + dbgMsg("Successfuly imported tree."); + } + else + { + dbgMsg("Tree parameter did not resolve to a valid tree."); + } + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + /* + * Try to load T-Coffee score file + */ + String sScoreFile = applet.getParameter("scoreFile"); + if (sScoreFile != null && !"".equals(sScoreFile)) + { + try + { + if (debug) + { + System.err + .println("Attempting to load T-COFFEE score file from the scoreFile parameter"); + } + if (!newAlignFrame.loadScoreFile(sScoreFile)) + { + System.err + .println("Failed to parse T-COFFEE parameter as a valid score file ('" + + sScoreFile + "')"); + } + } catch (Exception e) + { + System.err.printf("Cannot read score file: '%s'. Cause: %s \n", + sScoreFile, e.getMessage()); + } + } + + // /////////////////////////// + // modify display of features + // we do this before any features have been loaded, ensuring any hidden + // groups are hidden when features first displayed + // + // hide specific groups + // + String param = applet.getParameter("hidefeaturegroups"); + if (param != null) + { + newAlignFrame.setFeatureGroupState(separatorListToArray(param), + false); + // applet.setFeatureGroupStateOn(newAlignFrame, param, false); + } + // show specific groups + param = applet.getParameter("showfeaturegroups"); + if (param != null) + { + newAlignFrame.setFeatureGroupState(separatorListToArray(param), + true); + // applet.setFeatureGroupStateOn(newAlignFrame, param, true); + } + // and now load features + param = applet.getParameter("features"); + if (param != null) + { + param = setProtocolState(param); + + newAlignFrame.parseFeaturesFile(param, protocol); + } + + param = applet.getParameter("showFeatureSettings"); + if (param != null && param.equalsIgnoreCase("true")) + { + newAlignFrame.viewport.showSequenceFeatures(true); + new FeatureSettings(newAlignFrame.alignPanel); + } + + param = applet.getParameter("annotations"); + if (param != null) + { + param = setProtocolState(param); + + if (new AnnotationFile().readAnnotationFile( + newAlignFrame.viewport.getAlignment(), param, protocol)) + { + newAlignFrame.alignPanel.fontChanged(); + newAlignFrame.alignPanel.setScrollValues(0, 0); + } + else + { + System.err + .println("Annotations were not added from annotation file '" + + param + "'"); + } + + } + + param = applet.getParameter("jnetfile"); + if (param != null) + { + try + { + param = setProtocolState(param); + jalview.io.JPredFile predictions = new jalview.io.JPredFile( + param, protocol); + JnetAnnotationMaker.add_annotation(predictions, + newAlignFrame.viewport.getAlignment(), 0, false); // false==do + // not + // add + // sequence + // profile + // from + // concise + // output + newAlignFrame.alignPanel.fontChanged(); + newAlignFrame.alignPanel.setScrollValues(0, 0); + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + /* + * Undocumented for 2.6 + * - related to JAL-434 + */ + applet.setAlignPdbStructures(getDefaultParameter("alignpdbfiles", + false)); + /* + * + * + * + * + * + */ + + int pdbFileCount = 0; + // Accumulate pdbs here if they are heading for the same view (if + // alignPdbStructures is true) + Vector pdbs = new Vector(); + // create a lazy matcher if we're asked to + jalview.analysis.SequenceIdMatcher matcher = (applet + .getDefaultParameter("relaxedidmatch", false)) ? new jalview.analysis.SequenceIdMatcher( + newAlignFrame.getAlignViewport().getAlignment() + .getSequencesArray()) : null; + + do + { + if (pdbFileCount > 0) + { + param = applet.getParameter("PDBFILE" + pdbFileCount); + } + else + { + param = applet.getParameter("PDBFILE"); + } + + if (param != null) + { + PDBEntry pdb = new PDBEntry(); + + String seqstring; + SequenceI[] seqs = null; + String[] chains = null; + + StringTokenizer st = new StringTokenizer(param, " "); + + if (st.countTokens() < 2) + { + String sequence = applet.getParameter("PDBSEQ"); + if (sequence != null) + seqs = new SequenceI[] + { matcher == null ? (Sequence) newAlignFrame + .getAlignViewport().getAlignment() + .findName(sequence) : matcher.findIdMatch(sequence) }; + + } + else + { + param = st.nextToken(); + Vector tmp = new Vector(); + Vector tmp2 = new Vector(); + + while (st.hasMoreTokens()) + { + seqstring = st.nextToken(); + StringTokenizer st2 = new StringTokenizer(seqstring, "="); + if (st2.countTokens() > 1) + { + // This is the chain + tmp2.addElement(st2.nextToken()); + seqstring = st2.nextToken(); + } + tmp.addElement(matcher == null ? (Sequence) newAlignFrame + .getAlignViewport().getAlignment() + .findName(seqstring) : matcher + .findIdMatch(seqstring)); + } + + seqs = new SequenceI[tmp.size()]; + tmp.copyInto(seqs); + if (tmp2.size() == tmp.size()) + { + chains = new String[tmp2.size()]; + tmp2.copyInto(chains); + } + } + param = setProtocolState(param); + + if (// !jmolAvailable + // && + protocol == AppletFormatAdapter.CLASSLOADER + && !useXtrnalSviewer) + { + // Re: JAL-357 : the bug isn't a problem if we are using an + // external viewer! + // TODO: verify this Re: + // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 + // This exception preserves the current behaviour where, even if + // the local pdb file was identified in the class loader + protocol = AppletFormatAdapter.URL; // this is probably NOT + // CORRECT! + param = addProtocol(param); // + } + + pdb.setFile(param); + + if (seqs != null) + { + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i] != null) + { + ((Sequence) seqs[i]).addPDBId(pdb); + } + else + { + if (JalviewLite.debug) + { + // this may not really be a problem but we give a warning + // anyway + System.err + .println("Warning: Possible input parsing error: Null sequence for attachment of PDB (sequence " + + i + ")"); + } + } + } + + if (!alignPdbStructures) + { + newAlignFrame.newStructureView(applet, pdb, seqs, chains, + protocol); + } + else + { + pdbs.addElement(new Object[] + { pdb, seqs, chains, new String(protocol) }); + } + } + } + + pdbFileCount++; + } while (param != null || pdbFileCount < 10); + if (pdbs.size() > 0) + { + SequenceI[][] seqs = new SequenceI[pdbs.size()][]; + PDBEntry[] pdb = new PDBEntry[pdbs.size()]; + String[][] chains = new String[pdbs.size()][]; + String[] protocols = new String[pdbs.size()]; + for (int pdbsi = 0, pdbsiSize = pdbs.size(); pdbsi < pdbsiSize; pdbsi++) + { + Object[] o = (Object[]) pdbs.elementAt(pdbsi); + pdb[pdbsi] = (PDBEntry) o[0]; + seqs[pdbsi] = (SequenceI[]) o[1]; + chains[pdbsi] = (String[]) o[2]; + protocols[pdbsi] = (String) o[3]; + } + newAlignFrame.alignedStructureView(applet, pdb, seqs, chains, + protocols); + + } + } + else + { + fileFound = false; + applet.remove(launcher); + applet.repaint(); + } + callInitCallback(); + } + + /** + * Discovers whether the given file is in the Applet Archive + * + * @param file + * String + * @return boolean + */ + boolean inArchive(String file) + { + // This might throw a security exception in certain browsers + // Netscape Communicator for instance. + try + { + boolean rtn = (getClass().getResourceAsStream("/" + file) != null); + if (debug) + { + System.err.println("Resource '" + file + "' was " + + (rtn ? "" : "not") + " located by classloader."); + } + return rtn; + } catch (Exception ex) + { + System.out.println("Exception checking resources: " + file + " " + + ex); + return false; + } + } + + String addProtocol(String file) + { + if (file.indexOf("://") == -1) + { + String fl = applet.resolveUrlForLocalOrAbsolute(file, + getDocumentBase()); + try + { + if (new java.net.URL(fl).openStream() != null) + { + if (debug) + { + System.err.println("Prepended document base for resource: '" + + file + "'"); + } + return fl; + } + } catch (Exception x) + { + } + ; + fl = applet.resolveUrlForLocalOrAbsolute(file, getCodeBase()); + try + { + if (new java.net.URL(fl).openStream() != null) + { + if (debug) + { + System.err.println("Prepended codebase for resource: '" + + file + "'"); + } + return fl; + } + } catch (Exception x) + { + } + ; + + } + + return file; + } + } + + /** + * @return the default alignFrame acted on by the public applet methods. May + * return null with an error message on System.err indicating the + * fact. + */ + public AlignFrame getDefaultTargetFrame() + { + if (currentAlignFrame != null) + { + return currentAlignFrame; + } + if (initialAlignFrame != null) + { + return initialAlignFrame; + } + System.err + .println("Implementation error: Jalview Applet API cannot work out which AlignFrame to use."); + return null; + } + + /** + * separator used for separatorList + */ + protected String separator = "" + ((char) 0x00AC); // the default used to be + // '|' but many sequence + // IDS include pipes. + + /** + * set to enable the URL based javascript execution mechanism + */ + public boolean jsfallbackEnabled = false; + + /** + * parse the string into a list + * + * @param list + * @return elements separated by separator + */ + public String[] separatorListToArray(String list) + { + return separatorListToArray(list, separator); + } + + /** + * parse the string into a list + * + * @param list + * @param separator + * @return elements separated by separator + */ + public String[] separatorListToArray(String list, String separator) + { + // note separator local variable intentionally masks object field + int seplen = separator.length(); + if (list == null || list.equals("") || list.equals(separator)) + return null; + java.util.Vector jv = new Vector(); + int cp = 0, pos; + while ((pos = list.indexOf(separator, cp)) > cp) + { + jv.addElement(list.substring(cp, pos)); + cp = pos + seplen; + } + if (cp < list.length()) + { + String c = list.substring(cp); + if (!c.equals(separator)) + { + jv.addElement(c); + } + } + if (jv.size() > 0) + { + String[] v = new String[jv.size()]; + for (int i = 0; i < v.length; i++) + { + v[i] = (String) jv.elementAt(i); + } + jv.removeAllElements(); + if (debug) + { + System.err.println("Array from '" + separator + + "' separated List:\n" + v.length); + for (int i = 0; i < v.length; i++) + { + System.err.println("item " + i + " '" + v[i] + "'"); + } + } + return v; + } + if (debug) + { + System.err.println("Empty Array from '" + separator + + "' separated List"); + } + return null; + } + + /** + * concatenate the list with separator + * + * @param list + * @return concatenated string + */ + public String arrayToSeparatorList(String[] list) + { + return arrayToSeparatorList(list, separator); + } + + /** + * concatenate the list with separator + * + * @param list + * @param separator + * @return concatenated string + */ + public String arrayToSeparatorList(String[] list, String separator) + { + StringBuffer v = new StringBuffer(); + if (list != null && list.length > 0) + { + for (int i = 0, iSize = list.length; i < iSize; i++) + { + if (list[i] != null) + { + if (i > 0) + { + v.append(separator); + } + v.append(list[i]); + } + } + if (debug) + { + System.err.println("Returning '" + separator + + "' separated List:\n"); + System.err.println(v); + } + return v.toString(); + } + if (debug) + { + System.err.println("Returning empty '" + separator + + "' separated List\n"); + } + return "" + separator; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroups() + */ + public String getFeatureGroups() + { + String lst = arrayToSeparatorList(getDefaultTargetFrame() + .getFeatureGroups()); + return lst; + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOn(jalview.appletgui.AlignFrame + * ) + */ + public String getFeatureGroupsOn(AlignFrame alf) + { + String lst = arrayToSeparatorList(alf.getFeatureGroups()); + return lst; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfState(boolean) + */ + public String getFeatureGroupsOfState(boolean visible) + { + return arrayToSeparatorList(getDefaultTargetFrame() + .getFeatureGroupsOfState(visible)); + } + + /* + * (non-Javadoc) + * + * @see + * jalview.bin.JalviewLiteJsApi#getFeatureGroupsOfStateOn(jalview.appletgui + * .AlignFrame, boolean) + */ + public String getFeatureGroupsOfStateOn(AlignFrame alf, boolean visible) + { + return arrayToSeparatorList(alf.getFeatureGroupsOfState(visible)); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupStateOn(jalview.appletgui. + * AlignFrame, java.lang.String, boolean) + */ + public void setFeatureGroupStateOn(final AlignFrame alf, + final String groups, boolean state) + { + final boolean st = state;// !(state==null || state.equals("") || + // state.toLowerCase().equals("false")); + java.awt.EventQueue.invokeLater(new Runnable() + { + @Override + public void run() + { + alf.setFeatureGroupState(separatorListToArray(groups), st); + } + }); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setFeatureGroupState(java.lang.String, + * boolean) + */ + public void setFeatureGroupState(String groups, boolean state) + { + setFeatureGroupStateOn(getDefaultTargetFrame(), groups, state); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getSeparator() + */ + public String getSeparator() + { + return separator; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#setSeparator(java.lang.String) + */ + public void setSeparator(String separator) + { + if (separator == null || separator.length() < 1) + { + // reset to default + separator = "" + ((char) 0x00AC); + } + this.separator = separator; + if (debug) + { + System.err.println("Default Separator now: '" + separator + "'"); + } + } + + /** + * get boolean value of applet parameter 'name' and return default if + * parameter is not set + * + * @param name + * name of paremeter + * @param def + * the value to return otherwise + * @return true or false + */ + public boolean getDefaultParameter(String name, boolean def) + { + String stn; + if ((stn = getParameter(name)) == null) + { + return def; + } + if (stn.toLowerCase().equals("true")) + { + return true; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#addPdbFile(jalview.appletgui.AlignFrame, + * java.lang.String, java.lang.String, java.lang.String) + */ + public boolean addPdbFile(AlignFrame alFrame, String sequenceId, + String pdbEntryString, String pdbFile) + { + return alFrame.addPdbFile(sequenceId, pdbEntryString, pdbFile); + } + + protected void setAlignPdbStructures(boolean alignPdbStructures) + { + this.alignPdbStructures = alignPdbStructures; + } + + public boolean isAlignPdbStructures() + { + return alignPdbStructures; + } + + public void start() + { + // callInitCallback(); + } + + private Hashtable jshashes = new Hashtable(); + + private Hashtable> jsmessages = new Hashtable>(); + + public void setJsMessageSet(String messageclass, String viewId, + String[] colcommands) + { + Hashtable msgset = jsmessages.get(messageclass); + if (msgset == null) + { + msgset = new Hashtable(); + jsmessages.put(messageclass, msgset); + } + msgset.put(viewId, colcommands); + long[] l = new long[colcommands.length]; + for (int i = 0; i < colcommands.length; i++) + { + l[i] = colcommands[i].hashCode(); + } + jshashes.put(messageclass + "|" + viewId, l); + } + + /* + * (non-Javadoc) + * + * @see jalview.bin.JalviewLiteJsApi#getJsMessage(java.lang.String, + * java.lang.String) + */ + public String getJsMessage(String messageclass, String viewId) + { + Hashtable msgset = jsmessages.get(messageclass); + if (msgset != null) + { + String[] msgs = msgset.get(viewId); + if (msgs != null) + { + for (int i = 0; i < msgs.length; i++) + { + if (msgs[i] != null) + { + String m = msgs[i]; + msgs[i] = null; + return m; + } + } + } + } + return ""; + } + + public boolean isJsMessageSetChanged(String string, String string2, + String[] colcommands) + { + long[] l = jshashes.get(string + "|" + string2); + if (l == null && colcommands != null) + { + return true; + } + for (int i = 0; i < colcommands.length; i++) + { + if (l[i] != colcommands[i].hashCode()) + { + return true; + } + } + return false; + } + + private Vector jsExecQueue = new Vector(); + + public Vector getJsExecQueue() + { + return jsExecQueue; + } + + public void setExecutor(JSFunctionExec jsFunctionExec2) + { + jsFunctionExec = jsFunctionExec2; + } + + /** + * return the given colour value parameter or the given default if parameter + * not given + * + * @param colparam + * @param defcolour + * @return + */ + public Color getDefaultColourParameter(String colparam, Color defcolour) + { + String colprop = getParameter(colparam); + if (colprop == null || colprop.trim().length() == 0) + { + return defcolour; + } + Color col = jalview.schemes.ColourSchemeProperty + .getAWTColorFromName(colprop); + if (col == null) + { + try + { + col = new jalview.schemes.UserColourScheme(colprop).findColour('A'); + } catch (Exception ex) + { + System.err.println("Couldn't parse '" + colprop + + "' as a colour for " + colparam); + col = null; + } + } + return (col == null) ? defcolour : col; + + } + + public void openJalviewHelpUrl() + { + String helpUrl = getParameter("jalviewhelpurl"); + if (helpUrl == null || helpUrl.trim().length() < 5) + { + helpUrl = "http://www.jalview.org/help.html"; + } + showURL(helpUrl, "HELP"); + } + + /** + * form a complete URL given a path to a resource and a reference location on + * the same server + * + * @param url + * - an absolute path on the same server as localref or a document + * located relative to localref + * @param localref + * - a URL on the same server as url + * @return a complete URL for the resource located by url + */ + private String resolveUrlForLocalOrAbsolute(String url, URL localref) + { + String codebase = localref.toString(); + if (url.indexOf("/") == 0) + { + url = codebase.substring(0, codebase.length() + - localref.getFile().length()) + + url; + } + else + { + url = localref + url; + } + return url; + } + + /** + * open a URL in the browser - resolving it according to relative refs and + * coping with javascript: protocol if necessary. + * + * @param url + * @param target + */ + public void showURL(String url, String target) + { + try + { + if (url.indexOf(":") == -1) + { + // TODO: verify (Bas Vroling bug) prepend codebase or server URL to + // form valid URL + // Should really use docbase, not codebase. + URL prepend; + url = resolveUrlForLocalOrAbsolute( + url, + prepend = getDefaultParameter("resolvetocodebase", false) ? getDocumentBase() + : getCodeBase()); + if (debug) + { + System.err + .println("Show url (prepended " + + prepend + + " - toggle resolvetocodebase if code/docbase resolution is wrong): " + + url); + } + } + else + { + if (debug) + { + System.err.println("Show url: " + url); + } + } + if (url.indexOf("javascript:") == 0) + { + // no target for the javascript context + getAppletContext().showDocument(new java.net.URL(url)); + } + else + { + getAppletContext().showDocument(new java.net.URL(url), target); + } + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + /** + * bind structures in a viewer to any matching sequences in an alignFrame (use + * sequenceIds to limit scope of search to specific sequences) + * + * @param alFrame + * @param viewer + * @param sequenceIds + * @return TODO: consider making an exception structure for indicating when + * binding fails public SequenceStructureBinding + * addStructureViewInstance( AlignFrame alFrame, Object viewer, String + * sequenceIds) { + * + * if (sequenceIds != null && sequenceIds.length() > 0) { return + * alFrame.addStructureViewInstance(viewer, + * separatorListToArray(sequenceIds)); } else { return + * alFrame.addStructureViewInstance(viewer, null); } // return null; } + */ +} diff --git a/src/jalview/bin/JalviewLiteURLRetrieve.java b/src/jalview/bin/JalviewLiteURLRetrieve.java index 8ba113d..b8968d3 100644 --- a/src/jalview/bin/JalviewLiteURLRetrieve.java +++ b/src/jalview/bin/JalviewLiteURLRetrieve.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/binding/Alignment.java b/src/jalview/binding/Alignment.java index b8fcb2c..21dc74e 100644 --- a/src/jalview/binding/Alignment.java +++ b/src/jalview/binding/Alignment.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Annotation.java b/src/jalview/binding/Annotation.java index 86f1a63..31221c4 100644 --- a/src/jalview/binding/Annotation.java +++ b/src/jalview/binding/Annotation.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/AnnotationElement.java b/src/jalview/binding/AnnotationElement.java index 1f583c7..3c5e52d 100644 --- a/src/jalview/binding/AnnotationElement.java +++ b/src/jalview/binding/AnnotationElement.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Colour.java b/src/jalview/binding/Colour.java index c1de152..d29c1ed 100644 --- a/src/jalview/binding/Colour.java +++ b/src/jalview/binding/Colour.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java index 1cb6eee..acac8d7 100644 --- a/src/jalview/binding/Feature.java +++ b/src/jalview/binding/Feature.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/FeatureSettings.java b/src/jalview/binding/FeatureSettings.java index c4d5c4f..967020a 100644 --- a/src/jalview/binding/FeatureSettings.java +++ b/src/jalview/binding/FeatureSettings.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java index c730f4b..7babc37 100644 --- a/src/jalview/binding/Features.java +++ b/src/jalview/binding/Features.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JGroup.java b/src/jalview/binding/JGroup.java index 477cc30..c3ae6e9 100644 --- a/src/jalview/binding/JGroup.java +++ b/src/jalview/binding/JGroup.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 996a807..f32cd44 100644 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewModel.java b/src/jalview/binding/JalviewModel.java index 7141b27..11b33c6 100644 --- a/src/jalview/binding/JalviewModel.java +++ b/src/jalview/binding/JalviewModel.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewModelSequence.java b/src/jalview/binding/JalviewModelSequence.java index eb0716d..8e03945 100644 --- a/src/jalview/binding/JalviewModelSequence.java +++ b/src/jalview/binding/JalviewModelSequence.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/JalviewUserColours.java b/src/jalview/binding/JalviewUserColours.java index 02bb12e..64f5477 100644 --- a/src/jalview/binding/JalviewUserColours.java +++ b/src/jalview/binding/JalviewUserColours.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java index 6c0e745..00975c1 100644 --- a/src/jalview/binding/Pdbentry.java +++ b/src/jalview/binding/Pdbentry.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java index 93c46e0..733edba 100644 --- a/src/jalview/binding/PdbentryItem.java +++ b/src/jalview/binding/PdbentryItem.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; /** diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java index d821a6a..49d0aab 100644 --- a/src/jalview/binding/Pdbids.java +++ b/src/jalview/binding/Pdbids.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java index df3decf..93d7b2a 100644 --- a/src/jalview/binding/Property.java +++ b/src/jalview/binding/Property.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Sequence.java b/src/jalview/binding/Sequence.java index 5ab8a37..29e6eea 100644 --- a/src/jalview/binding/Sequence.java +++ b/src/jalview/binding/Sequence.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/SequenceSet.java b/src/jalview/binding/SequenceSet.java index c12934d..0ba0563 100644 --- a/src/jalview/binding/SequenceSet.java +++ b/src/jalview/binding/SequenceSet.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/SequenceType.java b/src/jalview/binding/SequenceType.java index d725405..5857595 100644 --- a/src/jalview/binding/SequenceType.java +++ b/src/jalview/binding/SequenceType.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Setting.java b/src/jalview/binding/Setting.java index 6641429..743227f 100644 --- a/src/jalview/binding/Setting.java +++ b/src/jalview/binding/Setting.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Tree.java b/src/jalview/binding/Tree.java index 04ea0a4..245dc84 100644 --- a/src/jalview/binding/Tree.java +++ b/src/jalview/binding/Tree.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/UserColourScheme.java b/src/jalview/binding/UserColourScheme.java index 555693c..493f519 100644 --- a/src/jalview/binding/UserColourScheme.java +++ b/src/jalview/binding/UserColourScheme.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/UserColours.java b/src/jalview/binding/UserColours.java index 6a8d73c..e2d750e 100644 --- a/src/jalview/binding/UserColours.java +++ b/src/jalview/binding/UserColours.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/VAMSAS.java b/src/jalview/binding/VAMSAS.java index c06de29..7856de9 100644 --- a/src/jalview/binding/VAMSAS.java +++ b/src/jalview/binding/VAMSAS.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/VamsasModel.java b/src/jalview/binding/VamsasModel.java index e4c5e0d..b48fc1e 100644 --- a/src/jalview/binding/VamsasModel.java +++ b/src/jalview/binding/VamsasModel.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/binding/Viewport.java b/src/jalview/binding/Viewport.java index d144378..5ccdc7b 100644 --- a/src/jalview/binding/Viewport.java +++ b/src/jalview/binding/Viewport.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.binding; //---------------------------------/ diff --git a/src/jalview/commands/ChangeCaseCommand.java b/src/jalview/commands/ChangeCaseCommand.java index 776d713..2651cd2 100644 --- a/src/jalview/commands/ChangeCaseCommand.java +++ b/src/jalview/commands/ChangeCaseCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/CommandI.java b/src/jalview/commands/CommandI.java index 388b0ff..edbde5c 100644 --- a/src/jalview/commands/CommandI.java +++ b/src/jalview/commands/CommandI.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java index c67ebf5..5c8f0be 100644 --- a/src/jalview/commands/EditCommand.java +++ b/src/jalview/commands/EditCommand.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.commands; diff --git a/src/jalview/commands/OrderCommand.java b/src/jalview/commands/OrderCommand.java index 02c4fd9..f9af2aa 100644 --- a/src/jalview/commands/OrderCommand.java +++ b/src/jalview/commands/OrderCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/RemoveGapColCommand.java b/src/jalview/commands/RemoveGapColCommand.java index 1dd4373..eacace0 100644 --- a/src/jalview/commands/RemoveGapColCommand.java +++ b/src/jalview/commands/RemoveGapColCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/RemoveGapsCommand.java b/src/jalview/commands/RemoveGapsCommand.java index 575b4ca..e3329ab 100644 --- a/src/jalview/commands/RemoveGapsCommand.java +++ b/src/jalview/commands/RemoveGapsCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/SlideSequencesCommand.java b/src/jalview/commands/SlideSequencesCommand.java index dc62666..7df24ba 100644 --- a/src/jalview/commands/SlideSequencesCommand.java +++ b/src/jalview/commands/SlideSequencesCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java index edb9b3e..1159ecf 100644 --- a/src/jalview/commands/TrimRegionCommand.java +++ b/src/jalview/commands/TrimRegionCommand.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 335621f..48b3346 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -1,318 +1,318 @@ -/* - * 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 . - */ -package jalview.datamodel; - -import java.util.Enumeration; -import java.util.Vector; - -import jalview.util.MapList; - -/** - * Stores mapping between the columns of a protein alignment and a DNA alignment - * and a list of individual codon to amino acid mappings between sequences. - */ - -public class AlignedCodonFrame -{ - /** - * array of nucleotide positions for aligned codons at column of aligned - * proteins. - */ - public int[][] codons = null; - - /** - * width of protein sequence alignement implicit assertion that codons.length - * >= aaWidth - */ - public int aaWidth = 0; - - /** - * initialise codon frame with a nominal alignment width - * - * @param aWidth - */ - public AlignedCodonFrame(int aWidth) - { - if (aWidth <= 0) - { - codons = null; - return; - } - codons = new int[aWidth][]; - for (int res = 0; res < aWidth; res++) - codons[res] = null; - } - - /** - * ensure that codons array is at least as wide as aslen residues - * - * @param aslen - * @return (possibly newly expanded) codon array - */ - public int[][] checkCodonFrameWidth(int aslen) - { - if (codons.length <= aslen + 1) - { - // probably never have to do this ? - int[][] c = new int[codons.length + 10][]; - for (int i = 0; i < codons.length; i++) - { - c[i] = codons[i]; - codons[i] = null; - } - codons = c; - } - return codons; - } - - /** - * @return width of aligned translated amino acid residues - */ - public int getaaWidth() - { - return aaWidth; - } - - /** - * TODO: not an ideal solution - we reference the aligned amino acid sequences - * in order to make insertions on them Better would be dnaAlignment and - * aaAlignment reference.... - */ - Vector a_aaSeqs = new Vector(); - - /** - * increase aaWidth by one and insert a new aligned codon position space at - * aspos. - * - * @param aspos - */ - public void insertAAGap(int aspos, char gapCharacter) - { - // this aa appears before the aligned codons at aspos - so shift them in - // each pair of mapped sequences - aaWidth++; - if (a_aaSeqs != null) - { - // we actually have to modify the aligned sequences here, so use the - // a_aaSeqs vector - Enumeration sq = a_aaSeqs.elements(); - while (sq.hasMoreElements()) - { - ((SequenceI) sq.nextElement()).insertCharAt(aspos, gapCharacter); - } - } - checkCodonFrameWidth(aspos); - if (aspos < aaWidth) - { - aaWidth++; - System.arraycopy(codons, aspos, codons, aspos + 1, aaWidth - aspos); - codons[aspos] = null; // clear so new codon position can be marked. - } - } - - public void setAaWidth(int aapos) - { - aaWidth = aapos; - } - - /** - * tied array of na Sequence objects. - */ - SequenceI[] dnaSeqs = null; - - /** - * tied array of Mappings to protein sequence Objects and SequenceI[] - * aaSeqs=null; MapLists where eac maps from the corresponding dnaSeqs element - * to corresponding aaSeqs element - */ - Mapping[] dnaToProt = null; - - /** - * add a mapping between the dataset sequences for the associated dna and - * protein sequence objects - * - * @param dnaseq - * @param aaseq - * @param map - */ - public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map) - { - int nlen = 1; - if (dnaSeqs != null) - { - nlen = dnaSeqs.length + 1; - } - SequenceI[] ndna = new SequenceI[nlen]; - Mapping[] ndtp = new Mapping[nlen]; - if (dnaSeqs != null) - { - System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length); - System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length); - } - dnaSeqs = ndna; - dnaToProt = ndtp; - nlen--; - dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq - .getDatasetSequence(); - Mapping mp = new Mapping(map); - // JBPNote DEBUG! THIS ! - // dnaseq.transferAnnotation(aaseq, mp); - // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse())); - mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq - .getDatasetSequence(); - a_aaSeqs.addElement(aaseq); - dnaToProt[nlen] = mp; - } - - public SequenceI[] getdnaSeqs() - { - return dnaSeqs; - } - - public SequenceI[] getAaSeqs() - { - if (dnaToProt == null) - return null; - SequenceI[] sqs = new SequenceI[dnaToProt.length]; - for (int sz = 0; sz < dnaToProt.length; sz++) - { - sqs[sz] = dnaToProt[sz].to; - } - return sqs; - } - - public MapList[] getdnaToProt() - { - if (dnaToProt == null) - return null; - MapList[] sqs = new MapList[dnaToProt.length]; - for (int sz = 0; sz < dnaToProt.length; sz++) - { - sqs[sz] = dnaToProt[sz].map; - } - return sqs; - } - - public Mapping[] getProtMappings() - { - return dnaToProt; - } - - /** - * - * @param sequenceRef - * @return null or corresponding aaSeq entry for dnaSeq entry - */ - public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef) - { - if (dnaSeqs == null) - { - return null; - } - SequenceI dnads = dnaSeqRef.getDatasetSequence(); - for (int ds = 0; ds < dnaSeqs.length; ds++) - { - if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads) - return dnaToProt[ds].to; - } - return null; - } - - /** - * - * @param sequenceRef - * @return null or corresponding aaSeq entry for dnaSeq entry - */ - public SequenceI getDnaForAaSeq(SequenceI aaSeqRef) - { - if (dnaToProt == null) - { - return null; - } - SequenceI aads = aaSeqRef.getDatasetSequence(); - for (int as = 0; as < dnaToProt.length; as++) - { - if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads) - return dnaSeqs[as]; - } - return null; - } - - /** - * test to see if codon frame involves seq in any way - * - * @param seq - * a nucleotide or protein sequence - * @return true if a mapping exists to or from this sequence to any translated - * sequence - */ - public boolean involvesSequence(SequenceI seq) - { - return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null; - } - - /** - * Add search results for regions in other sequences that translate or are - * translated from a particular position in seq - * - * @param seq - * @param index - * position in seq - * @param results - * where highlighted regions go - */ - public void markMappedRegion(SequenceI seq, int index, - SearchResults results) - { - if (dnaToProt == null) - { - return; - } - int[] codon; - SequenceI ds = seq.getDatasetSequence(); - for (int mi = 0; mi < dnaToProt.length; mi++) - { - if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds) - { - // DEBUG System.err.println("dna pos "+index); - codon = dnaToProt[mi].map.locateInTo(index, index); - if (codon != null) - { - for (int i = 0; i < codon.length; i += 2) - { - results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]); - } - } - } - else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds) - { - // DEBUG System.err.println("aa pos "+index); - { - codon = dnaToProt[mi].map.locateInFrom(index, index); - if (codon != null) - { - for (int i = 0; i < codon.length; i += 2) - { - results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]); - } - } - } - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +import java.util.Enumeration; +import java.util.Vector; + +import jalview.util.MapList; + +/** + * Stores mapping between the columns of a protein alignment and a DNA alignment + * and a list of individual codon to amino acid mappings between sequences. + */ + +public class AlignedCodonFrame +{ + /** + * array of nucleotide positions for aligned codons at column of aligned + * proteins. + */ + public int[][] codons = null; + + /** + * width of protein sequence alignement implicit assertion that codons.length + * >= aaWidth + */ + public int aaWidth = 0; + + /** + * initialise codon frame with a nominal alignment width + * + * @param aWidth + */ + public AlignedCodonFrame(int aWidth) + { + if (aWidth <= 0) + { + codons = null; + return; + } + codons = new int[aWidth][]; + for (int res = 0; res < aWidth; res++) + codons[res] = null; + } + + /** + * ensure that codons array is at least as wide as aslen residues + * + * @param aslen + * @return (possibly newly expanded) codon array + */ + public int[][] checkCodonFrameWidth(int aslen) + { + if (codons.length <= aslen + 1) + { + // probably never have to do this ? + int[][] c = new int[codons.length + 10][]; + for (int i = 0; i < codons.length; i++) + { + c[i] = codons[i]; + codons[i] = null; + } + codons = c; + } + return codons; + } + + /** + * @return width of aligned translated amino acid residues + */ + public int getaaWidth() + { + return aaWidth; + } + + /** + * TODO: not an ideal solution - we reference the aligned amino acid sequences + * in order to make insertions on them Better would be dnaAlignment and + * aaAlignment reference.... + */ + Vector a_aaSeqs = new Vector(); + + /** + * increase aaWidth by one and insert a new aligned codon position space at + * aspos. + * + * @param aspos + */ + public void insertAAGap(int aspos, char gapCharacter) + { + // this aa appears before the aligned codons at aspos - so shift them in + // each pair of mapped sequences + aaWidth++; + if (a_aaSeqs != null) + { + // we actually have to modify the aligned sequences here, so use the + // a_aaSeqs vector + Enumeration sq = a_aaSeqs.elements(); + while (sq.hasMoreElements()) + { + ((SequenceI) sq.nextElement()).insertCharAt(aspos, gapCharacter); + } + } + checkCodonFrameWidth(aspos); + if (aspos < aaWidth) + { + aaWidth++; + System.arraycopy(codons, aspos, codons, aspos + 1, aaWidth - aspos); + codons[aspos] = null; // clear so new codon position can be marked. + } + } + + public void setAaWidth(int aapos) + { + aaWidth = aapos; + } + + /** + * tied array of na Sequence objects. + */ + SequenceI[] dnaSeqs = null; + + /** + * tied array of Mappings to protein sequence Objects and SequenceI[] + * aaSeqs=null; MapLists where eac maps from the corresponding dnaSeqs element + * to corresponding aaSeqs element + */ + Mapping[] dnaToProt = null; + + /** + * add a mapping between the dataset sequences for the associated dna and + * protein sequence objects + * + * @param dnaseq + * @param aaseq + * @param map + */ + public void addMap(SequenceI dnaseq, SequenceI aaseq, MapList map) + { + int nlen = 1; + if (dnaSeqs != null) + { + nlen = dnaSeqs.length + 1; + } + SequenceI[] ndna = new SequenceI[nlen]; + Mapping[] ndtp = new Mapping[nlen]; + if (dnaSeqs != null) + { + System.arraycopy(dnaSeqs, 0, ndna, 0, dnaSeqs.length); + System.arraycopy(dnaToProt, 0, ndtp, 0, dnaSeqs.length); + } + dnaSeqs = ndna; + dnaToProt = ndtp; + nlen--; + dnaSeqs[nlen] = (dnaseq.getDatasetSequence() == null) ? dnaseq : dnaseq + .getDatasetSequence(); + Mapping mp = new Mapping(map); + // JBPNote DEBUG! THIS ! + // dnaseq.transferAnnotation(aaseq, mp); + // aaseq.transferAnnotation(dnaseq, new Mapping(map.getInverse())); + mp.to = (aaseq.getDatasetSequence() == null) ? aaseq : aaseq + .getDatasetSequence(); + a_aaSeqs.addElement(aaseq); + dnaToProt[nlen] = mp; + } + + public SequenceI[] getdnaSeqs() + { + return dnaSeqs; + } + + public SequenceI[] getAaSeqs() + { + if (dnaToProt == null) + return null; + SequenceI[] sqs = new SequenceI[dnaToProt.length]; + for (int sz = 0; sz < dnaToProt.length; sz++) + { + sqs[sz] = dnaToProt[sz].to; + } + return sqs; + } + + public MapList[] getdnaToProt() + { + if (dnaToProt == null) + return null; + MapList[] sqs = new MapList[dnaToProt.length]; + for (int sz = 0; sz < dnaToProt.length; sz++) + { + sqs[sz] = dnaToProt[sz].map; + } + return sqs; + } + + public Mapping[] getProtMappings() + { + return dnaToProt; + } + + /** + * + * @param sequenceRef + * @return null or corresponding aaSeq entry for dnaSeq entry + */ + public SequenceI getAaForDnaSeq(SequenceI dnaSeqRef) + { + if (dnaSeqs == null) + { + return null; + } + SequenceI dnads = dnaSeqRef.getDatasetSequence(); + for (int ds = 0; ds < dnaSeqs.length; ds++) + { + if (dnaSeqs[ds] == dnaSeqRef || dnaSeqs[ds] == dnads) + return dnaToProt[ds].to; + } + return null; + } + + /** + * + * @param sequenceRef + * @return null or corresponding aaSeq entry for dnaSeq entry + */ + public SequenceI getDnaForAaSeq(SequenceI aaSeqRef) + { + if (dnaToProt == null) + { + return null; + } + SequenceI aads = aaSeqRef.getDatasetSequence(); + for (int as = 0; as < dnaToProt.length; as++) + { + if (dnaToProt[as].to == aaSeqRef || dnaToProt[as].to == aads) + return dnaSeqs[as]; + } + return null; + } + + /** + * test to see if codon frame involves seq in any way + * + * @param seq + * a nucleotide or protein sequence + * @return true if a mapping exists to or from this sequence to any translated + * sequence + */ + public boolean involvesSequence(SequenceI seq) + { + return getAaForDnaSeq(seq) != null || getDnaForAaSeq(seq) != null; + } + + /** + * Add search results for regions in other sequences that translate or are + * translated from a particular position in seq + * + * @param seq + * @param index + * position in seq + * @param results + * where highlighted regions go + */ + public void markMappedRegion(SequenceI seq, int index, + SearchResults results) + { + if (dnaToProt == null) + { + return; + } + int[] codon; + SequenceI ds = seq.getDatasetSequence(); + for (int mi = 0; mi < dnaToProt.length; mi++) + { + if (dnaSeqs[mi] == seq || dnaSeqs[mi] == ds) + { + // DEBUG System.err.println("dna pos "+index); + codon = dnaToProt[mi].map.locateInTo(index, index); + if (codon != null) + { + for (int i = 0; i < codon.length; i += 2) + { + results.addResult(dnaToProt[mi].to, codon[i], codon[i + 1]); + } + } + } + else if (dnaToProt[mi].to == seq || dnaToProt[mi].to == ds) + { + // DEBUG System.err.println("aa pos "+index); + { + codon = dnaToProt[mi].map.locateInFrom(index, index); + if (codon != null) + { + for (int i = 0; i < codon.length; i += 2) + { + results.addResult(dnaSeqs[mi], codon[i], codon[i + 1]); + } + } + } + } + } + } +} diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index c48bb7f..83aab4e 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.datamodel; diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 59cb02b..0a8e087 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index d35d3f7..06026ef 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.datamodel; diff --git a/src/jalview/datamodel/AlignmentOrder.java b/src/jalview/datamodel/AlignmentOrder.java index 9ba8586..fce2776 100755 --- a/src/jalview/datamodel/AlignmentOrder.java +++ b/src/jalview/datamodel/AlignmentOrder.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index f1fa3d4..37f5e5c 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -1,1176 +1,1176 @@ -/* - * 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 . - */ -package jalview.datamodel; - -import jalview.util.ShiftList; - -import java.io.PrintStream; -import java.util.Enumeration; -import java.util.List; -import java.util.Vector; - -/** - * Transient object compactly representing a 'view' of an alignment - with - * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence - * groups and specific selected regions on the alignment. - */ -public class AlignmentView -{ - private SeqCigar[] sequences = null; - - private int[] contigs = null; - - private int width = 0; - - private int firstCol = 0; - - /** - * one or more ScGroup objects, which are referenced by each seqCigar's group - * membership - */ - private Vector scGroups; - - /** - * Group defined over SeqCigars. Unlike AlignmentI associated groups, each - * SequenceGroup hold just the essential properties for the group, but no - * references to the sequences involved. SeqCigars hold references to the - * seuqenceGroup entities themselves. - */ - private class ScGroup - { - public Vector seqs; - - public SequenceGroup sg; - - ScGroup() - { - seqs = new Vector(); - } - } - - /** - * vector of selected seqCigars. This vector is also referenced by each - * seqCigar contained in it. - */ - private Vector selected; - - /** - * Construct an alignmentView from a live jalview alignment view. Note - - * hidden rows will be excluded from alignmentView Note: JAL-1179 - * - * @param alignment - * - alignment as referenced by an AlignViewport - * @param columnSelection - * - - * @param selection - * @param hasHiddenColumns - * - mark the hidden columns in columnSelection as hidden in the view - * @param selectedRegionOnly - * - when set, only include the selected region in the view, - * otherwise just mark the selected region on the constructed view. - * @param recordGroups - * - when set, any groups on the given alignment will be marked on - * the view - */ - public AlignmentView(AlignmentI alignment, - ColumnSelection columnSelection, SequenceGroup selection, - boolean hasHiddenColumns, boolean selectedRegionOnly, - boolean recordGroups) - { - // refactored from AlignViewport.getAlignmentView(selectedOnly); - this(new jalview.datamodel.CigarArray(alignment, - (hasHiddenColumns ? columnSelection : null), - (selectedRegionOnly ? selection : null)), - (selectedRegionOnly && selection != null) ? selection - .getStartRes() : 0); - // walk down SeqCigar array and Alignment Array - optionally restricted by - // selected region. - // test group membership for each sequence in each group, store membership - // and record non-empty groups in group list. - // record / sub-select selected region on the alignment view - SequenceI[] selseqs; - if (selection != null && selection.getSize() > 0) - { - List sel = selection.getSequences(null); - this.selected = new Vector(); - selseqs = selection - .getSequencesInOrder(alignment, selectedRegionOnly); - } - else - { - selseqs = alignment.getSequencesArray(); - } - - // get the alignment's group list and make a copy - Vector grps = new Vector(); - List gg = alignment.getGroups(); - grps.addAll(gg); - ScGroup[] sgrps = null; - boolean addedgps[] = null; - if (grps != null) - { - SequenceGroup sg; - if (selection != null && selectedRegionOnly) - { - // trim annotation to the region being stored. - // strip out any groups that do not actually intersect with the - // visible and selected region - int ssel = selection.getStartRes(), esel = selection.getEndRes(); - Vector isg = new Vector(); - Enumeration en = grps.elements(); - while (en.hasMoreElements()) - { - sg = (SequenceGroup) en.nextElement(); - - if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel)) - { - // adjust bounds of new group, if necessary. - if (sg.getStartRes() < ssel) - { - sg.setStartRes(ssel); - } - if (sg.getEndRes() > esel) - { - sg.setEndRes(esel); - } - sg.setStartRes(sg.getStartRes() - ssel + 1); - sg.setEndRes(sg.getEndRes() - ssel + 1); - - isg.addElement(sg); - } - } - grps = isg; - } - - sgrps = new ScGroup[grps.size()]; - addedgps = new boolean[grps.size()]; - for (int g = 0; g < sgrps.length; g++) - { - sg = (SequenceGroup) grps.elementAt(g); - sgrps[g] = new ScGroup(); - sgrps[g].sg = new SequenceGroup(sg); - addedgps[g] = false; - grps.setElementAt(sg.getSequences(null), g); - } - // grps now contains vectors (should be sets) for each group, so we can - // track when we've done with the group - } - int csi = 0; - for (int i = 0; i < selseqs.length; i++) - { - if (selseqs[i] != null) - { - if (selection != null && selection.getSize() > 0 - && !selectedRegionOnly) - { - sequences[csi].setGroupMembership(selected); - selected.addElement(sequences[csi]); - } - if (grps != null) - { - for (int sg = 0; sg < sgrps.length; sg++) - { - if (((Vector) grps.elementAt(sg)).contains(selseqs[i])) - { - sequences[csi].setGroupMembership(sgrps[sg]); - sgrps[sg].sg.deleteSequence(selseqs[i], false); - sgrps[sg].seqs.addElement(sequences[csi]); - if (!addedgps[sg]) - { - if (scGroups == null) - { - scGroups = new Vector(); - } - addedgps[sg] = true; - scGroups.addElement(sgrps[sg]); - } - } - } - } - csi++; - } - } - // finally, delete the remaining sequences (if any) not selected - for (int sg = 0; sg < sgrps.length; sg++) - { - SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null); - for (int si = 0; si < sqs.length; si++) - { - sgrps[sg].sg.deleteSequence(sqs[si], false); - } - sgrps[sg] = null; - } - } - - /** - * construct an alignmentView from a SeqCigarArray. Errors are thrown if the - * seqcigararray.isSeqCigarArray() flag is not set. - */ - public AlignmentView(CigarArray seqcigararray) - { - if (!seqcigararray.isSeqCigarArray()) - { - throw new Error( - "Implementation Error - can only make an alignment view from a CigarArray of sequences."); - } - // contigs = seqcigararray.applyDeletions(); - contigs = seqcigararray.getDeletedRegions(); - sequences = seqcigararray.getSeqCigarArray(); - width = seqcigararray.getWidth(); // visible width - } - - /** - * Create an alignmentView where the first column corresponds with the - * 'firstcol' column of some reference alignment - * - * @param sdata - * @param firstcol - */ - public AlignmentView(CigarArray sdata, int firstcol) - { - this(sdata); - firstCol = firstcol; - } - - public void setSequences(SeqCigar[] sequences) - { - this.sequences = sequences; - } - - public void setContigs(int[] contigs) - { - this.contigs = contigs; - } - - public SeqCigar[] getSequences() - { - return sequences; - } - - /** - * @see CigarArray.getDeletedRegions - * @return int[] { vis_start, sym_start, length } - */ - public int[] getContigs() - { - return contigs; - } - - /** - * get the full alignment and a columnselection object marking the hidden - * regions - * - * @param gapCharacter - * char - * @return Object[] { SequenceI[], ColumnSelection} - */ - public Object[] getAlignmentAndColumnSelection(char gapCharacter) - { - ColumnSelection colsel = new ColumnSelection(); - - return new Object[] - { - SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, - contigs), colsel }; - } - - /** - * return the visible alignment corresponding to this view. Sequences in this - * alignment are edited versions of the parent sequences - where hidden - * regions have been removed. NOTE: the sequence data in this alignment is not - * complete! - * - * @param c - * @return - */ - public AlignmentI getVisibleAlignment(char c) - { - SequenceI[] aln = getVisibleSeqs(c); - - AlignmentI vcal = new Alignment(aln); - addPrunedGroupsInOrder(vcal, -1, -1, true); - return vcal; - } - - /** - * add groups from view to the given alignment - * - * @param vcal - * @param gstart - * -1 or 0 to width-1 - * @param gend - * -1 or gstart to width-1 - * @param viscontigs - * - true if vcal is alignment of the visible regions of the view - * (e.g. as returned from getVisibleAlignment) - */ - private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, - int gend, boolean viscontigs) - { - boolean r = false; - if (gstart > -1 && gstart <= gend) - { - r = true; - } - - SequenceI[] aln = vcal.getSequencesArray(); - { - /** - * prune any groups to the visible coordinates of the alignment. - */ - { - int nvg = (scGroups != null) ? scGroups.size() : 0; - if (nvg > 0) - { - SequenceGroup[] nsg = new SequenceGroup[nvg]; - for (int g = 0; g < nvg; g++) - { - SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg; - if (r) - { - if (sg.getStartRes() > gend || sg.getEndRes() < gstart) - { - // Skip this group - nsg[g] = null; - continue; - } - } - - // clone group properties - nsg[g] = new SequenceGroup(sg); - - // may need to shift/trim start and end ? - if (r && !viscontigs) - { - // Not fully tested code - routine not yet called with - // viscontigs==false - if (nsg[g].getStartRes() < gstart) - { - nsg[g].setStartRes(0); - } - else - { - nsg[g].setStartRes(nsg[g].getStartRes() - gstart); - nsg[g].setEndRes(nsg[g].getEndRes() - gstart); - } - if (nsg[g].getEndRes() > (gend - gstart)) - { - nsg[g].setEndRes(gend - gstart); - } - } - } - if (viscontigs) - { - // prune groups to cover just the visible positions between - // gstart/gend. - if (contigs != null) - { - int p = 0; - ShiftList prune = new ShiftList(); - if (r) - { - // adjust for start of alignment within visible window. - prune.addShift(gstart, -gstart); // - } - for (int h = 0; h < contigs.length; h += 3) - { - { - prune.addShift(p + contigs[h + 1], contigs[h + 2] - - contigs[h + 1]); - } - p = contigs[h + 1] + contigs[h + 2]; - } - for (int g = 0; g < nsg.length; g++) - { - if (nsg[g] != null) - { - int s = nsg[g].getStartRes(), t = nsg[g].getEndRes(); - int w = 1 + t - s; - if (r) - { - if (s < gstart) - { - s = gstart; - } - if (t > gend) - { - t = gend; - } - } - s = prune.shift(s); - t = prune.shift(t); - nsg[g].setStartRes(s); - nsg[g].setEndRes(t); - } - } - } - } - - for (int nsq = 0; nsq < aln.length; nsq++) - { - for (int g = 0; g < nvg; g++) - { - if (nsg[g] != null - && sequences[nsq].isMemberOf(scGroups.elementAt(g))) - { - nsg[g].addSequence(aln[nsq], false); - } - } - } - for (int g = 0; g < nvg; g++) - { - if (nsg[g] != null && nsg[g].getSize() > 0) - { - vcal.addGroup(nsg[g]); - } - nsg[g] = null; - } - } - } - } - } - - /** - * generate sequence array corresponding to the visible parts of the - * alignment. - * - * @param c - * @return - */ - private SequenceI[] getVisibleSeqs(char c) - { - SequenceI[] aln = new SequenceI[sequences.length]; - for (int i = 0, j = sequences.length; i < j; i++) - { - aln[i] = sequences[i].getSeq('-'); - } - // Remove hidden regions from sequence objects. - String seqs[] = getSequenceStrings('-'); - for (int i = 0, j = aln.length; i < j; i++) - { - aln[i].setSequence(seqs[i]); - } - return aln; - } - - /** - * creates new alignment objects for all contiguous visible segments - * - * @param c - * @param start - * @param end - * @param regionOfInterest - * specify which sequences to include (or null to include all - * sequences) - * @return AlignmentI[] - all alignments where each sequence is a subsequence - * constructed from visible contig regions of view - */ - public AlignmentI[] getVisibleContigAlignments(char c) - { - int nvc = 0; - int[] vcontigs = getVisibleContigs(); - SequenceI[][] contigviews = getVisibleContigs(c); - AlignmentI[] vcals = new AlignmentI[contigviews.length]; - for (nvc = 0; nvc < contigviews.length; nvc++) - { - vcals[nvc] = new Alignment(contigviews[nvc]); - if (scGroups != null && scGroups.size() > 0) - { - addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2], - vcontigs[nvc * 2 + 1], true); - } - } - return vcals; - } - - /** - * get an array of visible sequence strings for a view on an alignment using - * the given gap character - * - * @param c - * char - * @return String[] - */ - public String[] getSequenceStrings(char c) - { - String[] seqs = new String[sequences.length]; - for (int n = 0; n < sequences.length; n++) - { - String fullseq = sequences[n].getSequenceString(c); - if (contigs != null) - { - seqs[n] = ""; - int p = 0; - for (int h = 0; h < contigs.length; h += 3) - { - seqs[n] += fullseq.substring(p, contigs[h + 1]); - p = contigs[h + 1] + contigs[h + 2]; - } - seqs[n] += fullseq.substring(p); - } - else - { - seqs[n] = fullseq; - } - } - return seqs; - } - - /** - * - * @return visible number of columns in alignment view - */ - public int getWidth() - { - return width; - } - - protected void setWidth(int width) - { - this.width = width; - } - - /** - * get the contiguous subalignments in an alignment view. - * - * @param gapCharacter - * char - * @return SequenceI[][] - */ - public SequenceI[][] getVisibleContigs(char gapCharacter) - { - SequenceI[][] smsa; - int njobs = 1; - if (sequences == null || width <= 0) - { - return null; - } - if (contigs != null && contigs.length > 0) - { - int start = 0; - njobs = 0; - int fwidth = width; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ((contigs[contig + 1] - start) > 0) - { - njobs++; - } - fwidth += contigs[contig + 2]; // end up with full region width - // (including hidden regions) - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - njobs++; - } - smsa = new SequenceI[njobs][]; - start = 0; - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if (contigs[contig + 1] - start > 0) - { - SequenceI mseq[] = new SequenceI[sequences.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence( - start, contigs[contig + 1]); - } - smsa[j] = mseq; - j++; - } - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - SequenceI mseq[] = new SequenceI[sequences.length]; - for (int s = 0; s < mseq.length; s++) - { - mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, - fwidth + 1); - } - smsa[j] = mseq; - j++; - } - } - else - { - smsa = new SequenceI[1][]; - smsa[0] = new SequenceI[sequences.length]; - for (int s = 0; s < sequences.length; s++) - { - smsa[0][s] = sequences[s].getSeq(gapCharacter); - } - } - return smsa; - } - - /** - * return full msa and hidden regions with visible blocks replaced with new - * sub alignments - * - * @param nvismsa - * SequenceI[][] - * @param orders - * AlignmentOrder[] corresponding to each SequenceI[] block. - * @return Object[] - */ - public Object[] getUpdatedView(SequenceI[][] nvismsa, - AlignmentOrder[] orders, char gapCharacter) - { - if (sequences == null || width <= 0) - { - throw new Error("empty view cannot be updated."); - } - if (nvismsa == null) - { - throw new Error( - "nvismsa==null. use getAlignmentAndColumnSelection() instead."); - } - if (contigs != null && contigs.length > 0) - { - SequenceI[] alignment = new SequenceI[sequences.length]; - ColumnSelection columnselection = new ColumnSelection(); - if (contigs != null && contigs.length > 0) - { - int start = 0; - int nwidth = 0; - int owidth = width; - int j = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - owidth += contigs[contig + 2]; // recover final column width - if (contigs[contig + 1] - start > 0) - { - int swidth = 0; // subalignment width - if (nvismsa[j] != null) - { - SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order = (orders == null) ? null : orders[j]; - j++; - if (mseq.length != sequences.length) - { - throw new Error( - "Mismatch between number of sequences in block " - + j + " (" + mseq.length - + ") and the original view (" - + sequences.length + ")"); - } - swidth = mseq[0].getLength(); // JBPNote: could ensure padded - // here. - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + mseq[s].getSequenceAsString()); - if (mseq[s].getStart() <= mseq[s].getEnd()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - if (order != null) - { - order.updateSequence(mseq[s], alignment[s]); - } - } - } - } - else - { - // recover original alignment block or place gaps - if (true) - { - // recover input data - for (int s = 0; s < sequences.length; s++) - { - SequenceI oseq = sequences[s].getSeq(gapCharacter) - .getSubSequence(start, contigs[contig + 1]); - if (swidth < oseq.getLength()) - { - swidth = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + oseq.getSequenceAsString()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - - } - j++; - } - nwidth += swidth; - } - // advance to begining of visible region - start = contigs[contig + 1] + contigs[contig + 2]; - // add hidden segment to right of next region - for (int s = 0; s < sequences.length; s++) - { - SequenceI hseq = sequences[s].getSeq(gapCharacter) - .getSubSequence(contigs[contig + 1], start); - if (alignment[s] == null) - { - alignment[s] = hseq; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() - + hseq.getSequenceAsString()); - if (hseq.getEnd() >= hseq.getStart()) - { - alignment[s].setEnd(hseq.getEnd()); - } - } - } - // mark hidden segment as hidden in the new alignment - columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - - 1); - nwidth += contigs[contig + 2]; - } - // Do final segment - if it exists - if (j < nvismsa.length) - { - int swidth = 0; - if (nvismsa[j] != null) - { - SequenceI mseq[] = nvismsa[j]; - AlignmentOrder order = (orders != null) ? orders[j] : null; - swidth = mseq[0].getLength(); - for (int s = 0; s < mseq.length; s++) - { - if (alignment[s] == null) - { - alignment[s] = mseq[s]; - } - else - { - alignment[s].setSequence(alignment[s].getSequenceAsString() - + mseq[s].getSequenceAsString()); - if (mseq[s].getEnd() >= mseq[s].getStart()) - { - alignment[s].setEnd(mseq[s].getEnd()); - } - if (order != null) - { - order.updateSequence(mseq[s], alignment[s]); - } - } - } - } - else - { - if (start < owidth) - { - // recover input data or place gaps - if (true) - { - // recover input data - for (int s = 0; s < sequences.length; s++) - { - SequenceI oseq = sequences[s].getSeq(gapCharacter) - .getSubSequence(start, owidth + 1); - if (swidth < oseq.getLength()) - { - swidth = oseq.getLength(); - } - if (alignment[s] == null) - { - alignment[s] = oseq; - } - else - { - alignment[s].setSequence(alignment[s] - .getSequenceAsString() - + oseq.getSequenceAsString()); - if (oseq.getEnd() >= oseq.getStart()) - { - alignment[s].setEnd(oseq.getEnd()); - } - } - } - nwidth += swidth; - } - else - { - // place gaps. - throw new Error("Padding not yet implemented."); - } - } - } - } - } - return new Object[] - { alignment, columnselection }; - } - else - { - if (nvismsa.length != 1) - { - throw new Error( - "Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" - + nvismsa.length); - } - if (nvismsa[0] != null) - { - return new Object[] - { nvismsa[0], new ColumnSelection() }; - } - else - { - return getAlignmentAndColumnSelection(gapCharacter); - } - } - } - - /** - * returns simple array of start end positions of visible range on alignment. - * vis_start and vis_end are inclusive - use - * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence - * from underlying alignment. - * - * @return int[] { start_i, end_i } for 1 0) - { - int start = 0; - int nvis = 0; - int fwidth = width; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ((contigs[contig + 1] - start) > 0) - { - nvis++; - } - fwidth += contigs[contig + 2]; // end up with full region width - // (including hidden regions) - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - nvis++; - } - int viscontigs[] = new int[nvis * 2]; - nvis = 0; - start = 0; - for (int contig = 0; contig < contigs.length; contig += 3) - { - if ((contigs[contig + 1] - start) > 0) - { - viscontigs[nvis] = start; - viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive - nvis += 2; - } - start = contigs[contig + 1] + contigs[contig + 2]; - } - if (start < fwidth) - { - viscontigs[nvis] = start; - viscontigs[nvis + 1] = fwidth; // end is inclusive - nvis += 2; - } - return viscontigs; - } - else - { - return new int[] - { 0, width }; - } - } - - /** - * - * @return position of first visible column of AlignmentView within its - * parent's alignment reference frame - */ - public int getAlignmentOrigin() - { - return firstCol; - } - - /** - * compute a deletion map for the current view according to the given - * gap/match map - * - * @param gapMap - * (as returned from SequenceI.gapMap()) - * @return int[] {intersection of visible regions with gapMap) - */ - public int[] getVisibleContigMapFor(int[] gapMap) - { - int[] delMap = null; - int[] viscontigs = getVisibleContigs(); - int spos = 0; - int i = 0; - if (viscontigs != null) - { - // viscontigs maps from a subset of the gapMap to the gapMap, so it will - // always be equal to or shorter than gapMap - delMap = new int[gapMap.length]; - for (int contig = 0; contig < viscontigs.length; contig += 2) - { - - while (spos < gapMap.length && gapMap[spos] < viscontigs[contig]) - { - spos++; - } - while (spos < gapMap.length - && gapMap[spos] <= viscontigs[contig + 1]) - { - delMap[i++] = spos++; - } - } - int tmap[] = new int[i]; - System.arraycopy(delMap, 0, tmap, 0, i); - delMap = tmap; - } - return delMap; - } - - /** - * apply the getSeq(gc) method to each sequence cigar, and return the array of - * edited sequences, optionally with hidden regions removed. - * - * @param gc - * gap character to use for insertions - * @param delete - * remove hidden regions from sequences. Note: currently implemented - * in a memory inefficient way - space needed is 2*result set for - * deletion - * - * @return SequenceI[] - */ - public SequenceI[] getEditedSequences(char gc, boolean delete) - { - SeqCigar[] msf = getSequences(); - SequenceI[] aln = new SequenceI[msf.length]; - for (int i = 0, j = msf.length; i < j; i++) - { - aln[i] = msf[i].getSeq(gc); - } - if (delete) - { - String[] sqs = getSequenceStrings(gc); - for (int i = 0; i < sqs.length; i++) - { - aln[i].setSequence(sqs[i]); - sqs[i] = null; - } - } - return aln; - } - - public static void summariseAlignmentView(AlignmentView view, - PrintStream os) - { - os.print("View has " + view.sequences.length + " of which "); - if (view.selected == null) - { - os.print("None"); - } - else - { - os.print(" " + view.selected.size()); - } - os.println(" are selected."); - os.print("View is " + view.getWidth() + " columns wide"); - int viswid = 0; - int[] contigs = view.getContigs(); - if (contigs != null) - { - viswid = view.width; - for (int i = 0; i < contigs.length; i += 3) - { - viswid += contigs[i + 2]; - } - os.println("with " + viswid + " visible columns spread over " - + contigs.length / 3 + " regions."); - } - else - { - viswid = view.width; - os.println("."); - } - if (view.scGroups != null) - { - os.println("There are " + view.scGroups.size() - + " groups defined on the view."); - for (int g = 0; g < view.scGroups.size(); g++) - { - ScGroup sgr = (ScGroup) view.scGroups.elementAt(g); - os.println("Group " + g + ": Name = " + sgr.sg.getName() - + " Contains " + sgr.seqs.size() + " Seqs."); - os.println("This group runs from " + sgr.sg.getStartRes() + " to " - + sgr.sg.getEndRes()); - for (int s = 0; s < sgr.seqs.size(); s++) - { - if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr)) - { - os.println("** WARNING: sequence " - + ((SeqCigar) sgr.seqs.elementAt(s)).toString() - + " is not marked as member of group."); - } - } - } - AlignmentI visal = view.getVisibleAlignment('-'); - if (visal != null) - { - os.println("Vis. alignment is " + visal.getWidth() - + " wide and has " + visal.getHeight() + " seqs."); - if (visal.getGroups() != null && visal.getGroups().size() > 0) - { - - int i = 1; - for (SequenceGroup sg : visal.getGroups()) - { - os.println("Group " + (i++) + " begins at column " - + sg.getStartRes() + " and ends at " + sg.getEndRes()); - } - } - } - } - } - - public static void testSelectionViews(AlignmentI alignment, - ColumnSelection csel, SequenceGroup selection) - { - System.out.println("Testing standard view creation:\n"); - AlignmentView view = null; - try - { - System.out - .println("View with no hidden columns, no limit to selection, no groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, false, false, - false); - summariseAlignmentView(view, System.out); - - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection but no groups marked."); - } - try - { - System.out - .println("View with no hidden columns, no limit to selection, and all groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, false, false, - true); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection marked but no groups marked."); - } - try - { - System.out - .println("View with no hidden columns, limited to selection and no groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, false, true, - false); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted but no groups marked."); - } - try - { - System.out - .println("View with no hidden columns, limited to selection, and all groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, false, true, - true); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted and groups marked."); - } - try - { - System.out - .println("View *with* hidden columns, no limit to selection, no groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, true, false, - false); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection but no groups marked."); - } - try - { - System.out - .println("View *with* hidden columns, no limit to selection, and all groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, true, false, - true); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection marked but no groups marked."); - } - try - { - System.out - .println("View *with* hidden columns, limited to selection and no groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, true, true, - false); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted but no groups marked."); - } - try - { - System.out - .println("View *with* hidden columns, limited to selection, and all groups to be collected:"); - view = new AlignmentView(alignment, csel, selection, true, true, true); - summariseAlignmentView(view, System.out); - } catch (Exception e) - { - e.printStackTrace(); - System.err - .println("Failed to generate alignment with selection restricted and groups marked."); - } - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +import jalview.util.ShiftList; + +import java.io.PrintStream; +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; + +/** + * Transient object compactly representing a 'view' of an alignment - with + * discontinuities marked. Extended in Jalview 2.7 to optionally record sequence + * groups and specific selected regions on the alignment. + */ +public class AlignmentView +{ + private SeqCigar[] sequences = null; + + private int[] contigs = null; + + private int width = 0; + + private int firstCol = 0; + + /** + * one or more ScGroup objects, which are referenced by each seqCigar's group + * membership + */ + private Vector scGroups; + + /** + * Group defined over SeqCigars. Unlike AlignmentI associated groups, each + * SequenceGroup hold just the essential properties for the group, but no + * references to the sequences involved. SeqCigars hold references to the + * seuqenceGroup entities themselves. + */ + private class ScGroup + { + public Vector seqs; + + public SequenceGroup sg; + + ScGroup() + { + seqs = new Vector(); + } + } + + /** + * vector of selected seqCigars. This vector is also referenced by each + * seqCigar contained in it. + */ + private Vector selected; + + /** + * Construct an alignmentView from a live jalview alignment view. Note - + * hidden rows will be excluded from alignmentView Note: JAL-1179 + * + * @param alignment + * - alignment as referenced by an AlignViewport + * @param columnSelection + * - + * @param selection + * @param hasHiddenColumns + * - mark the hidden columns in columnSelection as hidden in the view + * @param selectedRegionOnly + * - when set, only include the selected region in the view, + * otherwise just mark the selected region on the constructed view. + * @param recordGroups + * - when set, any groups on the given alignment will be marked on + * the view + */ + public AlignmentView(AlignmentI alignment, + ColumnSelection columnSelection, SequenceGroup selection, + boolean hasHiddenColumns, boolean selectedRegionOnly, + boolean recordGroups) + { + // refactored from AlignViewport.getAlignmentView(selectedOnly); + this(new jalview.datamodel.CigarArray(alignment, + (hasHiddenColumns ? columnSelection : null), + (selectedRegionOnly ? selection : null)), + (selectedRegionOnly && selection != null) ? selection + .getStartRes() : 0); + // walk down SeqCigar array and Alignment Array - optionally restricted by + // selected region. + // test group membership for each sequence in each group, store membership + // and record non-empty groups in group list. + // record / sub-select selected region on the alignment view + SequenceI[] selseqs; + if (selection != null && selection.getSize() > 0) + { + List sel = selection.getSequences(null); + this.selected = new Vector(); + selseqs = selection + .getSequencesInOrder(alignment, selectedRegionOnly); + } + else + { + selseqs = alignment.getSequencesArray(); + } + + // get the alignment's group list and make a copy + Vector grps = new Vector(); + List gg = alignment.getGroups(); + grps.addAll(gg); + ScGroup[] sgrps = null; + boolean addedgps[] = null; + if (grps != null) + { + SequenceGroup sg; + if (selection != null && selectedRegionOnly) + { + // trim annotation to the region being stored. + // strip out any groups that do not actually intersect with the + // visible and selected region + int ssel = selection.getStartRes(), esel = selection.getEndRes(); + Vector isg = new Vector(); + Enumeration en = grps.elements(); + while (en.hasMoreElements()) + { + sg = (SequenceGroup) en.nextElement(); + + if (!(sg.getStartRes() > esel || sg.getEndRes() < ssel)) + { + // adjust bounds of new group, if necessary. + if (sg.getStartRes() < ssel) + { + sg.setStartRes(ssel); + } + if (sg.getEndRes() > esel) + { + sg.setEndRes(esel); + } + sg.setStartRes(sg.getStartRes() - ssel + 1); + sg.setEndRes(sg.getEndRes() - ssel + 1); + + isg.addElement(sg); + } + } + grps = isg; + } + + sgrps = new ScGroup[grps.size()]; + addedgps = new boolean[grps.size()]; + for (int g = 0; g < sgrps.length; g++) + { + sg = (SequenceGroup) grps.elementAt(g); + sgrps[g] = new ScGroup(); + sgrps[g].sg = new SequenceGroup(sg); + addedgps[g] = false; + grps.setElementAt(sg.getSequences(null), g); + } + // grps now contains vectors (should be sets) for each group, so we can + // track when we've done with the group + } + int csi = 0; + for (int i = 0; i < selseqs.length; i++) + { + if (selseqs[i] != null) + { + if (selection != null && selection.getSize() > 0 + && !selectedRegionOnly) + { + sequences[csi].setGroupMembership(selected); + selected.addElement(sequences[csi]); + } + if (grps != null) + { + for (int sg = 0; sg < sgrps.length; sg++) + { + if (((Vector) grps.elementAt(sg)).contains(selseqs[i])) + { + sequences[csi].setGroupMembership(sgrps[sg]); + sgrps[sg].sg.deleteSequence(selseqs[i], false); + sgrps[sg].seqs.addElement(sequences[csi]); + if (!addedgps[sg]) + { + if (scGroups == null) + { + scGroups = new Vector(); + } + addedgps[sg] = true; + scGroups.addElement(sgrps[sg]); + } + } + } + } + csi++; + } + } + // finally, delete the remaining sequences (if any) not selected + for (int sg = 0; sg < sgrps.length; sg++) + { + SequenceI[] sqs = sgrps[sg].sg.getSequencesAsArray(null); + for (int si = 0; si < sqs.length; si++) + { + sgrps[sg].sg.deleteSequence(sqs[si], false); + } + sgrps[sg] = null; + } + } + + /** + * construct an alignmentView from a SeqCigarArray. Errors are thrown if the + * seqcigararray.isSeqCigarArray() flag is not set. + */ + public AlignmentView(CigarArray seqcigararray) + { + if (!seqcigararray.isSeqCigarArray()) + { + throw new Error( + "Implementation Error - can only make an alignment view from a CigarArray of sequences."); + } + // contigs = seqcigararray.applyDeletions(); + contigs = seqcigararray.getDeletedRegions(); + sequences = seqcigararray.getSeqCigarArray(); + width = seqcigararray.getWidth(); // visible width + } + + /** + * Create an alignmentView where the first column corresponds with the + * 'firstcol' column of some reference alignment + * + * @param sdata + * @param firstcol + */ + public AlignmentView(CigarArray sdata, int firstcol) + { + this(sdata); + firstCol = firstcol; + } + + public void setSequences(SeqCigar[] sequences) + { + this.sequences = sequences; + } + + public void setContigs(int[] contigs) + { + this.contigs = contigs; + } + + public SeqCigar[] getSequences() + { + return sequences; + } + + /** + * @see CigarArray.getDeletedRegions + * @return int[] { vis_start, sym_start, length } + */ + public int[] getContigs() + { + return contigs; + } + + /** + * get the full alignment and a columnselection object marking the hidden + * regions + * + * @param gapCharacter + * char + * @return Object[] { SequenceI[], ColumnSelection} + */ + public Object[] getAlignmentAndColumnSelection(char gapCharacter) + { + ColumnSelection colsel = new ColumnSelection(); + + return new Object[] + { + SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, + contigs), colsel }; + } + + /** + * return the visible alignment corresponding to this view. Sequences in this + * alignment are edited versions of the parent sequences - where hidden + * regions have been removed. NOTE: the sequence data in this alignment is not + * complete! + * + * @param c + * @return + */ + public AlignmentI getVisibleAlignment(char c) + { + SequenceI[] aln = getVisibleSeqs(c); + + AlignmentI vcal = new Alignment(aln); + addPrunedGroupsInOrder(vcal, -1, -1, true); + return vcal; + } + + /** + * add groups from view to the given alignment + * + * @param vcal + * @param gstart + * -1 or 0 to width-1 + * @param gend + * -1 or gstart to width-1 + * @param viscontigs + * - true if vcal is alignment of the visible regions of the view + * (e.g. as returned from getVisibleAlignment) + */ + private void addPrunedGroupsInOrder(AlignmentI vcal, int gstart, + int gend, boolean viscontigs) + { + boolean r = false; + if (gstart > -1 && gstart <= gend) + { + r = true; + } + + SequenceI[] aln = vcal.getSequencesArray(); + { + /** + * prune any groups to the visible coordinates of the alignment. + */ + { + int nvg = (scGroups != null) ? scGroups.size() : 0; + if (nvg > 0) + { + SequenceGroup[] nsg = new SequenceGroup[nvg]; + for (int g = 0; g < nvg; g++) + { + SequenceGroup sg = ((ScGroup) scGroups.elementAt(g)).sg; + if (r) + { + if (sg.getStartRes() > gend || sg.getEndRes() < gstart) + { + // Skip this group + nsg[g] = null; + continue; + } + } + + // clone group properties + nsg[g] = new SequenceGroup(sg); + + // may need to shift/trim start and end ? + if (r && !viscontigs) + { + // Not fully tested code - routine not yet called with + // viscontigs==false + if (nsg[g].getStartRes() < gstart) + { + nsg[g].setStartRes(0); + } + else + { + nsg[g].setStartRes(nsg[g].getStartRes() - gstart); + nsg[g].setEndRes(nsg[g].getEndRes() - gstart); + } + if (nsg[g].getEndRes() > (gend - gstart)) + { + nsg[g].setEndRes(gend - gstart); + } + } + } + if (viscontigs) + { + // prune groups to cover just the visible positions between + // gstart/gend. + if (contigs != null) + { + int p = 0; + ShiftList prune = new ShiftList(); + if (r) + { + // adjust for start of alignment within visible window. + prune.addShift(gstart, -gstart); // + } + for (int h = 0; h < contigs.length; h += 3) + { + { + prune.addShift(p + contigs[h + 1], contigs[h + 2] + - contigs[h + 1]); + } + p = contigs[h + 1] + contigs[h + 2]; + } + for (int g = 0; g < nsg.length; g++) + { + if (nsg[g] != null) + { + int s = nsg[g].getStartRes(), t = nsg[g].getEndRes(); + int w = 1 + t - s; + if (r) + { + if (s < gstart) + { + s = gstart; + } + if (t > gend) + { + t = gend; + } + } + s = prune.shift(s); + t = prune.shift(t); + nsg[g].setStartRes(s); + nsg[g].setEndRes(t); + } + } + } + } + + for (int nsq = 0; nsq < aln.length; nsq++) + { + for (int g = 0; g < nvg; g++) + { + if (nsg[g] != null + && sequences[nsq].isMemberOf(scGroups.elementAt(g))) + { + nsg[g].addSequence(aln[nsq], false); + } + } + } + for (int g = 0; g < nvg; g++) + { + if (nsg[g] != null && nsg[g].getSize() > 0) + { + vcal.addGroup(nsg[g]); + } + nsg[g] = null; + } + } + } + } + } + + /** + * generate sequence array corresponding to the visible parts of the + * alignment. + * + * @param c + * @return + */ + private SequenceI[] getVisibleSeqs(char c) + { + SequenceI[] aln = new SequenceI[sequences.length]; + for (int i = 0, j = sequences.length; i < j; i++) + { + aln[i] = sequences[i].getSeq('-'); + } + // Remove hidden regions from sequence objects. + String seqs[] = getSequenceStrings('-'); + for (int i = 0, j = aln.length; i < j; i++) + { + aln[i].setSequence(seqs[i]); + } + return aln; + } + + /** + * creates new alignment objects for all contiguous visible segments + * + * @param c + * @param start + * @param end + * @param regionOfInterest + * specify which sequences to include (or null to include all + * sequences) + * @return AlignmentI[] - all alignments where each sequence is a subsequence + * constructed from visible contig regions of view + */ + public AlignmentI[] getVisibleContigAlignments(char c) + { + int nvc = 0; + int[] vcontigs = getVisibleContigs(); + SequenceI[][] contigviews = getVisibleContigs(c); + AlignmentI[] vcals = new AlignmentI[contigviews.length]; + for (nvc = 0; nvc < contigviews.length; nvc++) + { + vcals[nvc] = new Alignment(contigviews[nvc]); + if (scGroups != null && scGroups.size() > 0) + { + addPrunedGroupsInOrder(vcals[nvc], vcontigs[nvc * 2], + vcontigs[nvc * 2 + 1], true); + } + } + return vcals; + } + + /** + * get an array of visible sequence strings for a view on an alignment using + * the given gap character + * + * @param c + * char + * @return String[] + */ + public String[] getSequenceStrings(char c) + { + String[] seqs = new String[sequences.length]; + for (int n = 0; n < sequences.length; n++) + { + String fullseq = sequences[n].getSequenceString(c); + if (contigs != null) + { + seqs[n] = ""; + int p = 0; + for (int h = 0; h < contigs.length; h += 3) + { + seqs[n] += fullseq.substring(p, contigs[h + 1]); + p = contigs[h + 1] + contigs[h + 2]; + } + seqs[n] += fullseq.substring(p); + } + else + { + seqs[n] = fullseq; + } + } + return seqs; + } + + /** + * + * @return visible number of columns in alignment view + */ + public int getWidth() + { + return width; + } + + protected void setWidth(int width) + { + this.width = width; + } + + /** + * get the contiguous subalignments in an alignment view. + * + * @param gapCharacter + * char + * @return SequenceI[][] + */ + public SequenceI[][] getVisibleContigs(char gapCharacter) + { + SequenceI[][] smsa; + int njobs = 1; + if (sequences == null || width <= 0) + { + return null; + } + if (contigs != null && contigs.length > 0) + { + int start = 0; + njobs = 0; + int fwidth = width; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ((contigs[contig + 1] - start) > 0) + { + njobs++; + } + fwidth += contigs[contig + 2]; // end up with full region width + // (including hidden regions) + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + njobs++; + } + smsa = new SequenceI[njobs][]; + start = 0; + int j = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if (contigs[contig + 1] - start > 0) + { + SequenceI mseq[] = new SequenceI[sequences.length]; + for (int s = 0; s < mseq.length; s++) + { + mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence( + start, contigs[contig + 1]); + } + smsa[j] = mseq; + j++; + } + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + SequenceI mseq[] = new SequenceI[sequences.length]; + for (int s = 0; s < mseq.length; s++) + { + mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start, + fwidth + 1); + } + smsa[j] = mseq; + j++; + } + } + else + { + smsa = new SequenceI[1][]; + smsa[0] = new SequenceI[sequences.length]; + for (int s = 0; s < sequences.length; s++) + { + smsa[0][s] = sequences[s].getSeq(gapCharacter); + } + } + return smsa; + } + + /** + * return full msa and hidden regions with visible blocks replaced with new + * sub alignments + * + * @param nvismsa + * SequenceI[][] + * @param orders + * AlignmentOrder[] corresponding to each SequenceI[] block. + * @return Object[] + */ + public Object[] getUpdatedView(SequenceI[][] nvismsa, + AlignmentOrder[] orders, char gapCharacter) + { + if (sequences == null || width <= 0) + { + throw new Error("empty view cannot be updated."); + } + if (nvismsa == null) + { + throw new Error( + "nvismsa==null. use getAlignmentAndColumnSelection() instead."); + } + if (contigs != null && contigs.length > 0) + { + SequenceI[] alignment = new SequenceI[sequences.length]; + ColumnSelection columnselection = new ColumnSelection(); + if (contigs != null && contigs.length > 0) + { + int start = 0; + int nwidth = 0; + int owidth = width; + int j = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + owidth += contigs[contig + 2]; // recover final column width + if (contigs[contig + 1] - start > 0) + { + int swidth = 0; // subalignment width + if (nvismsa[j] != null) + { + SequenceI mseq[] = nvismsa[j]; + AlignmentOrder order = (orders == null) ? null : orders[j]; + j++; + if (mseq.length != sequences.length) + { + throw new Error( + "Mismatch between number of sequences in block " + + j + " (" + mseq.length + + ") and the original view (" + + sequences.length + ")"); + } + swidth = mseq[0].getLength(); // JBPNote: could ensure padded + // here. + for (int s = 0; s < mseq.length; s++) + { + if (alignment[s] == null) + { + alignment[s] = mseq[s]; + } + else + { + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + mseq[s].getSequenceAsString()); + if (mseq[s].getStart() <= mseq[s].getEnd()) + { + alignment[s].setEnd(mseq[s].getEnd()); + } + if (order != null) + { + order.updateSequence(mseq[s], alignment[s]); + } + } + } + } + else + { + // recover original alignment block or place gaps + if (true) + { + // recover input data + for (int s = 0; s < sequences.length; s++) + { + SequenceI oseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(start, contigs[contig + 1]); + if (swidth < oseq.getLength()) + { + swidth = oseq.getLength(); + } + if (alignment[s] == null) + { + alignment[s] = oseq; + } + else + { + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + oseq.getSequenceAsString()); + if (oseq.getEnd() >= oseq.getStart()) + { + alignment[s].setEnd(oseq.getEnd()); + } + } + } + + } + j++; + } + nwidth += swidth; + } + // advance to begining of visible region + start = contigs[contig + 1] + contigs[contig + 2]; + // add hidden segment to right of next region + for (int s = 0; s < sequences.length; s++) + { + SequenceI hseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(contigs[contig + 1], start); + if (alignment[s] == null) + { + alignment[s] = hseq; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + hseq.getSequenceAsString()); + if (hseq.getEnd() >= hseq.getStart()) + { + alignment[s].setEnd(hseq.getEnd()); + } + } + } + // mark hidden segment as hidden in the new alignment + columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] + - 1); + nwidth += contigs[contig + 2]; + } + // Do final segment - if it exists + if (j < nvismsa.length) + { + int swidth = 0; + if (nvismsa[j] != null) + { + SequenceI mseq[] = nvismsa[j]; + AlignmentOrder order = (orders != null) ? orders[j] : null; + swidth = mseq[0].getLength(); + for (int s = 0; s < mseq.length; s++) + { + if (alignment[s] == null) + { + alignment[s] = mseq[s]; + } + else + { + alignment[s].setSequence(alignment[s].getSequenceAsString() + + mseq[s].getSequenceAsString()); + if (mseq[s].getEnd() >= mseq[s].getStart()) + { + alignment[s].setEnd(mseq[s].getEnd()); + } + if (order != null) + { + order.updateSequence(mseq[s], alignment[s]); + } + } + } + } + else + { + if (start < owidth) + { + // recover input data or place gaps + if (true) + { + // recover input data + for (int s = 0; s < sequences.length; s++) + { + SequenceI oseq = sequences[s].getSeq(gapCharacter) + .getSubSequence(start, owidth + 1); + if (swidth < oseq.getLength()) + { + swidth = oseq.getLength(); + } + if (alignment[s] == null) + { + alignment[s] = oseq; + } + else + { + alignment[s].setSequence(alignment[s] + .getSequenceAsString() + + oseq.getSequenceAsString()); + if (oseq.getEnd() >= oseq.getStart()) + { + alignment[s].setEnd(oseq.getEnd()); + } + } + } + nwidth += swidth; + } + else + { + // place gaps. + throw new Error("Padding not yet implemented."); + } + } + } + } + } + return new Object[] + { alignment, columnselection }; + } + else + { + if (nvismsa.length != 1) + { + throw new Error( + "Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks=" + + nvismsa.length); + } + if (nvismsa[0] != null) + { + return new Object[] + { nvismsa[0], new ColumnSelection() }; + } + else + { + return getAlignmentAndColumnSelection(gapCharacter); + } + } + } + + /** + * returns simple array of start end positions of visible range on alignment. + * vis_start and vis_end are inclusive - use + * SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence + * from underlying alignment. + * + * @return int[] { start_i, end_i } for 1 0) + { + int start = 0; + int nvis = 0; + int fwidth = width; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ((contigs[contig + 1] - start) > 0) + { + nvis++; + } + fwidth += contigs[contig + 2]; // end up with full region width + // (including hidden regions) + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + nvis++; + } + int viscontigs[] = new int[nvis * 2]; + nvis = 0; + start = 0; + for (int contig = 0; contig < contigs.length; contig += 3) + { + if ((contigs[contig + 1] - start) > 0) + { + viscontigs[nvis] = start; + viscontigs[nvis + 1] = contigs[contig + 1] - 1; // end is inclusive + nvis += 2; + } + start = contigs[contig + 1] + contigs[contig + 2]; + } + if (start < fwidth) + { + viscontigs[nvis] = start; + viscontigs[nvis + 1] = fwidth; // end is inclusive + nvis += 2; + } + return viscontigs; + } + else + { + return new int[] + { 0, width }; + } + } + + /** + * + * @return position of first visible column of AlignmentView within its + * parent's alignment reference frame + */ + public int getAlignmentOrigin() + { + return firstCol; + } + + /** + * compute a deletion map for the current view according to the given + * gap/match map + * + * @param gapMap + * (as returned from SequenceI.gapMap()) + * @return int[] {intersection of visible regions with gapMap) + */ + public int[] getVisibleContigMapFor(int[] gapMap) + { + int[] delMap = null; + int[] viscontigs = getVisibleContigs(); + int spos = 0; + int i = 0; + if (viscontigs != null) + { + // viscontigs maps from a subset of the gapMap to the gapMap, so it will + // always be equal to or shorter than gapMap + delMap = new int[gapMap.length]; + for (int contig = 0; contig < viscontigs.length; contig += 2) + { + + while (spos < gapMap.length && gapMap[spos] < viscontigs[contig]) + { + spos++; + } + while (spos < gapMap.length + && gapMap[spos] <= viscontigs[contig + 1]) + { + delMap[i++] = spos++; + } + } + int tmap[] = new int[i]; + System.arraycopy(delMap, 0, tmap, 0, i); + delMap = tmap; + } + return delMap; + } + + /** + * apply the getSeq(gc) method to each sequence cigar, and return the array of + * edited sequences, optionally with hidden regions removed. + * + * @param gc + * gap character to use for insertions + * @param delete + * remove hidden regions from sequences. Note: currently implemented + * in a memory inefficient way - space needed is 2*result set for + * deletion + * + * @return SequenceI[] + */ + public SequenceI[] getEditedSequences(char gc, boolean delete) + { + SeqCigar[] msf = getSequences(); + SequenceI[] aln = new SequenceI[msf.length]; + for (int i = 0, j = msf.length; i < j; i++) + { + aln[i] = msf[i].getSeq(gc); + } + if (delete) + { + String[] sqs = getSequenceStrings(gc); + for (int i = 0; i < sqs.length; i++) + { + aln[i].setSequence(sqs[i]); + sqs[i] = null; + } + } + return aln; + } + + public static void summariseAlignmentView(AlignmentView view, + PrintStream os) + { + os.print("View has " + view.sequences.length + " of which "); + if (view.selected == null) + { + os.print("None"); + } + else + { + os.print(" " + view.selected.size()); + } + os.println(" are selected."); + os.print("View is " + view.getWidth() + " columns wide"); + int viswid = 0; + int[] contigs = view.getContigs(); + if (contigs != null) + { + viswid = view.width; + for (int i = 0; i < contigs.length; i += 3) + { + viswid += contigs[i + 2]; + } + os.println("with " + viswid + " visible columns spread over " + + contigs.length / 3 + " regions."); + } + else + { + viswid = view.width; + os.println("."); + } + if (view.scGroups != null) + { + os.println("There are " + view.scGroups.size() + + " groups defined on the view."); + for (int g = 0; g < view.scGroups.size(); g++) + { + ScGroup sgr = (ScGroup) view.scGroups.elementAt(g); + os.println("Group " + g + ": Name = " + sgr.sg.getName() + + " Contains " + sgr.seqs.size() + " Seqs."); + os.println("This group runs from " + sgr.sg.getStartRes() + " to " + + sgr.sg.getEndRes()); + for (int s = 0; s < sgr.seqs.size(); s++) + { + if (!((SeqCigar) sgr.seqs.elementAt(s)).isMemberOf(sgr)) + { + os.println("** WARNING: sequence " + + ((SeqCigar) sgr.seqs.elementAt(s)).toString() + + " is not marked as member of group."); + } + } + } + AlignmentI visal = view.getVisibleAlignment('-'); + if (visal != null) + { + os.println("Vis. alignment is " + visal.getWidth() + + " wide and has " + visal.getHeight() + " seqs."); + if (visal.getGroups() != null && visal.getGroups().size() > 0) + { + + int i = 1; + for (SequenceGroup sg : visal.getGroups()) + { + os.println("Group " + (i++) + " begins at column " + + sg.getStartRes() + " and ends at " + sg.getEndRes()); + } + } + } + } + } + + public static void testSelectionViews(AlignmentI alignment, + ColumnSelection csel, SequenceGroup selection) + { + System.out.println("Testing standard view creation:\n"); + AlignmentView view = null; + try + { + System.out + .println("View with no hidden columns, no limit to selection, no groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, false, false, + false); + summariseAlignmentView(view, System.out); + + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection but no groups marked."); + } + try + { + System.out + .println("View with no hidden columns, no limit to selection, and all groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, false, false, + true); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection marked but no groups marked."); + } + try + { + System.out + .println("View with no hidden columns, limited to selection and no groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, false, true, + false); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection restricted but no groups marked."); + } + try + { + System.out + .println("View with no hidden columns, limited to selection, and all groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, false, true, + true); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection restricted and groups marked."); + } + try + { + System.out + .println("View *with* hidden columns, no limit to selection, no groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, true, false, + false); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection but no groups marked."); + } + try + { + System.out + .println("View *with* hidden columns, no limit to selection, and all groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, true, false, + true); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection marked but no groups marked."); + } + try + { + System.out + .println("View *with* hidden columns, limited to selection and no groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, true, true, + false); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection restricted but no groups marked."); + } + try + { + System.out + .println("View *with* hidden columns, limited to selection, and all groups to be collected:"); + view = new AlignmentView(alignment, csel, selection, true, true, true); + summariseAlignmentView(view, System.out); + } catch (Exception e) + { + e.printStackTrace(); + System.err + .println("Failed to generate alignment with selection restricted and groups marked."); + } + + } +} diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java index b882123..e73f0f4 100644 --- a/src/jalview/datamodel/AnnotatedCollectionI.java +++ b/src/jalview/datamodel/AnnotatedCollectionI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.datamodel; public interface AnnotatedCollectionI extends SequenceCollectionI diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index 6b22cad..73611bd 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/BinaryNode.java b/src/jalview/datamodel/BinaryNode.java index 6a1d2d2..d4335b3 100755 --- a/src/jalview/datamodel/BinaryNode.java +++ b/src/jalview/datamodel/BinaryNode.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/BinarySequence.java b/src/jalview/datamodel/BinarySequence.java index 62171f7..34e7cd0 100755 --- a/src/jalview/datamodel/BinarySequence.java +++ b/src/jalview/datamodel/BinarySequence.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index 6e0ab9f..ef0db4f 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -1,396 +1,396 @@ -/* - * 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 . - */ -package jalview.datamodel; - -import java.util.Vector; - -public class CigarArray extends CigarBase -{ - /** - * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS - * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is - * given a CIGARARRAY to insert gaps into. - */ - /** - * array of subject cigars - */ - public CigarSimple refCigars[] = null; - - private boolean seqcigararray = false; - - private CigarArray() - { - super(); - } - - /** - * isSeqCigarArray() - * - * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar - */ - public boolean isSeqCigarArray() - { - return seqcigararray; - } - - /** - * Apply CIGAR operations to several cigars in parallel will throw an error if - * any of cigar are actually CigarArrays. - * - * @param cigar - * Cigar[] - */ - public CigarArray(CigarSimple[] cigars) - { - super(); - seqcigararray = true; - if (cigars != null && cigars.length > 0) - { - refCigars = new CigarSimple[cigars.length]; - for (int c = 0; c < cigars.length; c++) - { - refCigars[c] = cigars[c]; - if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar)) - { - seqcigararray = false; - } - } - } - } - - /** - * construct a cigar array from the current alignment, or just the subset of - * the current alignment specified by selectionGroup. Any columns marked as - * hidden in columnSelection will be marked as deleted in the array. - * - * @param alignment - * @param columnSelection - * @param selectionGroup - */ - public CigarArray(AlignmentI alignment, ColumnSelection columnSelection, - SequenceGroup selectionGroup) - { - this(constructSeqCigarArray(alignment, selectionGroup)); - constructFromAlignment(alignment, - columnSelection != null ? columnSelection.getHiddenColumns() - : null, selectionGroup); - } - - private static int[] _calcStartEndBounds(AlignmentI alignment, - SequenceGroup selectionGroup) - { - int[] startend = new int[] - { 0, 0, 0 }; - if (selectionGroup != null) - { - startend[0] = selectionGroup.getSize(); - startend[1] = selectionGroup.getStartRes(); - startend[2] = selectionGroup.getEndRes(); // inclusive for start and end - // in - // SeqCigar constructor - } - else - { - startend[0] = alignment.getHeight(); - startend[2] = alignment.getWidth() - 1; - } - return startend; - } - - public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment, - SequenceGroup selectionGroup) - { - SequenceI[] seqs = null; - int i, iSize; - int _startend[] = _calcStartEndBounds(alignment, selectionGroup); - int start = _startend[1], end = _startend[2]; - if (selectionGroup != null) - { - iSize = selectionGroup.getSize(); - seqs = selectionGroup.getSequencesInOrder(alignment); - start = selectionGroup.getStartRes(); - end = selectionGroup.getEndRes(); // inclusive for start and end in - // SeqCigar constructor - } - else - { - iSize = alignment.getHeight(); - seqs = alignment.getSequencesArray(); - end = alignment.getWidth() - 1; - } - SeqCigar[] selseqs = new SeqCigar[iSize]; - for (i = 0; i < iSize; i++) - { - selseqs[i] = new SeqCigar(seqs[i], start, end); - } - return selseqs; - } - - /** - * internal constructor function - called by CigarArray(AlignmentI, ...); - * - * @param alignment - * @param columnSelection - * - vector of visible regions as returned from - * columnSelection.getHiddenColumns() - * @param selectionGroup - */ - private void constructFromAlignment(AlignmentI alignment, - Vector columnSelection, SequenceGroup selectionGroup) - { - int[] _startend = _calcStartEndBounds(alignment, selectionGroup); - int start = _startend[1], end = _startend[2]; - // now construct the CigarArray operations - if (columnSelection != null) - { - int[] region; - int hideStart, hideEnd; - int last = start; - for (int j = 0; last < end & j < columnSelection.size(); j++) - { - region = (int[]) columnSelection.elementAt(j); - hideStart = region[0]; - hideEnd = region[1]; - // edit hidden regions to selection range - if (hideStart < last) - { - if (hideEnd > last) - { - hideStart = last; - } - else - { - continue; - } - } - - if (hideStart > end) - { - break; - } - - if (hideEnd > end) - { - hideEnd = end; - } - - if (hideStart > hideEnd) - { - break; - } - /** - * form operations... - */ - if (last < hideStart) - { - addOperation(CigarArray.M, hideStart - last); - } - addOperation(CigarArray.D, 1 + hideEnd - hideStart); - last = hideEnd + 1; - } - // Final match if necessary. - if (last < end) - { - addOperation(CigarArray.M, end - last + 1); - } - } - else - { - addOperation(CigarArray.M, end - start + 1); - } - } - - /** - * @see Cigar.getSequenceAndDeletions - * @param GapChar - * char - * @return Object[][] - */ - protected Object[][] getArrayofSequenceAndDeletions(char GapChar) - { - if (refCigars == null || refCigars.length == 0 || length == 0) - { - return null; - } - Object[][] sqanddels = new Object[refCigars.length][]; - for (int c = 0; c < refCigars.length; c++) - { - String refString = refCigars[c].getSequenceString(GapChar); - if (refString != null) - { - sqanddels[c] = getSequenceAndDeletions(refString, GapChar); - } - else - { - sqanddels[c] = null; - } - } - return sqanddels; - } - - /** - * NOTE: this is an improper sequence string function - * - * @return String formed by newline concatenated results of applying CIGAR - * operations to each reference object in turn. - * @param GapChar - * char - * @return '\n' separated strings (empty results included as \n\n) - */ - public String getSequenceString(char GapChar) - { - if (length == 0 || refCigars == null) - { - return ""; - } - StringBuffer seqStrings = new StringBuffer(); - Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar); - for (int c = 0; c < refCigars.length; c++) - { - if (sqanddels[c] != null) - { - seqStrings.append((String) sqanddels[c][0]); - sqanddels[c][0] = null; - } - seqStrings.append('\n'); - } - return seqStrings.toString(); - } - - /** - * return string results of applying cigar string to all reference cigars - * - * @param GapChar - * char - * @return String[] - */ - public String[] getSequenceStrings(char GapChar) - { - - if (length == 0 || refCigars == null || refCigars.length == 0) - { - return null; - } - Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar); - String[] seqs = new String[sqanddels.length]; - for (int c = 0; c < refCigars.length; c++) - { - seqs[c] = (String) sqanddels[c][0]; - } - return seqs; - } - - /** - * Combines the CigarArray cigar operations with the operations in each - * reference cigar - creating a new reference cigar - * - * @return Cigar[] - * - * public CigarBase[] getEditedCigars() { - * - * return new CigarBase[] {}; } - */ - /** - * applyDeletions edits underlying refCigars to propagate deleted regions, and - * removes deletion operations from CigarArray operation list. - * - * @return int[] position after deletion occured and range of deletion in - * cigarArray or null if none occured - */ - public int[] applyDeletions() - { - java.util.Vector delpos = null; - if (length == 0) - { - return null; - } - int cursor = 0; // range counter for deletions - int vcursor = 0; // visible column index - int offset = 0; // shift in visible column index as deletions are made - int i = 0; - while (i < length) - { - if (operation[i] != D) - { - if (operation[i] == M) - { - cursor += range[i]; - } - vcursor += range[i++]; - } - else - { - if (delpos == null) - { - delpos = new java.util.Vector(); - } - int delstart = cursor, delend = cursor + range[i] - 1; // inclusive - delpos.addElement(new int[] - { vcursor + offset, range[i] }); // index of right hand column after - // hidden region boundary - offset += range[i] - 1; // shift in visible column coordinates - System.arraycopy(operation, i + 1, operation, i, length - i); - System.arraycopy(range, i + 1, range, i, length - i); - length--; - /* - * int dmax=0; for (int s=0; sdmax) dmax=d; } - * offset+=dmax; // shift in visible column coordinates - */ - for (int s = 0; s < refCigars.length; s++) - { - int d = refCigars[s].deleteRange(delstart, delend); - } - - } - } - if (delpos != null) - { - int[] pos = new int[delpos.size() * 2]; - for (int k = 0, l = delpos.size(); k < l; k++) - { - int[] dr = ((int[]) delpos.elementAt(k)); - pos[k * 2] = dr[0]; - pos[k * 2 + 1] = dr[1]; - delpos.setElementAt(null, k); - } - delpos = null; - return pos; - } - return null; - } - - /** - * - * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does - * not resolve to set of seqCigars) - */ - public SeqCigar[] getSeqCigarArray() - { - if (!isSeqCigarArray()) - { - return null; - } - SeqCigar[] sa = new SeqCigar[refCigars.length]; - for (int i = 0; i < refCigars.length; i++) - { - sa[i] = (SeqCigar) refCigars[i]; - } - return sa; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +import java.util.Vector; + +public class CigarArray extends CigarBase +{ + /** + * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS + * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is + * given a CIGARARRAY to insert gaps into. + */ + /** + * array of subject cigars + */ + public CigarSimple refCigars[] = null; + + private boolean seqcigararray = false; + + private CigarArray() + { + super(); + } + + /** + * isSeqCigarArray() + * + * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar + */ + public boolean isSeqCigarArray() + { + return seqcigararray; + } + + /** + * Apply CIGAR operations to several cigars in parallel will throw an error if + * any of cigar are actually CigarArrays. + * + * @param cigar + * Cigar[] + */ + public CigarArray(CigarSimple[] cigars) + { + super(); + seqcigararray = true; + if (cigars != null && cigars.length > 0) + { + refCigars = new CigarSimple[cigars.length]; + for (int c = 0; c < cigars.length; c++) + { + refCigars[c] = cigars[c]; + if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar)) + { + seqcigararray = false; + } + } + } + } + + /** + * construct a cigar array from the current alignment, or just the subset of + * the current alignment specified by selectionGroup. Any columns marked as + * hidden in columnSelection will be marked as deleted in the array. + * + * @param alignment + * @param columnSelection + * @param selectionGroup + */ + public CigarArray(AlignmentI alignment, ColumnSelection columnSelection, + SequenceGroup selectionGroup) + { + this(constructSeqCigarArray(alignment, selectionGroup)); + constructFromAlignment(alignment, + columnSelection != null ? columnSelection.getHiddenColumns() + : null, selectionGroup); + } + + private static int[] _calcStartEndBounds(AlignmentI alignment, + SequenceGroup selectionGroup) + { + int[] startend = new int[] + { 0, 0, 0 }; + if (selectionGroup != null) + { + startend[0] = selectionGroup.getSize(); + startend[1] = selectionGroup.getStartRes(); + startend[2] = selectionGroup.getEndRes(); // inclusive for start and end + // in + // SeqCigar constructor + } + else + { + startend[0] = alignment.getHeight(); + startend[2] = alignment.getWidth() - 1; + } + return startend; + } + + public static SeqCigar[] constructSeqCigarArray(AlignmentI alignment, + SequenceGroup selectionGroup) + { + SequenceI[] seqs = null; + int i, iSize; + int _startend[] = _calcStartEndBounds(alignment, selectionGroup); + int start = _startend[1], end = _startend[2]; + if (selectionGroup != null) + { + iSize = selectionGroup.getSize(); + seqs = selectionGroup.getSequencesInOrder(alignment); + start = selectionGroup.getStartRes(); + end = selectionGroup.getEndRes(); // inclusive for start and end in + // SeqCigar constructor + } + else + { + iSize = alignment.getHeight(); + seqs = alignment.getSequencesArray(); + end = alignment.getWidth() - 1; + } + SeqCigar[] selseqs = new SeqCigar[iSize]; + for (i = 0; i < iSize; i++) + { + selseqs[i] = new SeqCigar(seqs[i], start, end); + } + return selseqs; + } + + /** + * internal constructor function - called by CigarArray(AlignmentI, ...); + * + * @param alignment + * @param columnSelection + * - vector of visible regions as returned from + * columnSelection.getHiddenColumns() + * @param selectionGroup + */ + private void constructFromAlignment(AlignmentI alignment, + Vector columnSelection, SequenceGroup selectionGroup) + { + int[] _startend = _calcStartEndBounds(alignment, selectionGroup); + int start = _startend[1], end = _startend[2]; + // now construct the CigarArray operations + if (columnSelection != null) + { + int[] region; + int hideStart, hideEnd; + int last = start; + for (int j = 0; last < end & j < columnSelection.size(); j++) + { + region = (int[]) columnSelection.elementAt(j); + hideStart = region[0]; + hideEnd = region[1]; + // edit hidden regions to selection range + if (hideStart < last) + { + if (hideEnd > last) + { + hideStart = last; + } + else + { + continue; + } + } + + if (hideStart > end) + { + break; + } + + if (hideEnd > end) + { + hideEnd = end; + } + + if (hideStart > hideEnd) + { + break; + } + /** + * form operations... + */ + if (last < hideStart) + { + addOperation(CigarArray.M, hideStart - last); + } + addOperation(CigarArray.D, 1 + hideEnd - hideStart); + last = hideEnd + 1; + } + // Final match if necessary. + if (last < end) + { + addOperation(CigarArray.M, end - last + 1); + } + } + else + { + addOperation(CigarArray.M, end - start + 1); + } + } + + /** + * @see Cigar.getSequenceAndDeletions + * @param GapChar + * char + * @return Object[][] + */ + protected Object[][] getArrayofSequenceAndDeletions(char GapChar) + { + if (refCigars == null || refCigars.length == 0 || length == 0) + { + return null; + } + Object[][] sqanddels = new Object[refCigars.length][]; + for (int c = 0; c < refCigars.length; c++) + { + String refString = refCigars[c].getSequenceString(GapChar); + if (refString != null) + { + sqanddels[c] = getSequenceAndDeletions(refString, GapChar); + } + else + { + sqanddels[c] = null; + } + } + return sqanddels; + } + + /** + * NOTE: this is an improper sequence string function + * + * @return String formed by newline concatenated results of applying CIGAR + * operations to each reference object in turn. + * @param GapChar + * char + * @return '\n' separated strings (empty results included as \n\n) + */ + public String getSequenceString(char GapChar) + { + if (length == 0 || refCigars == null) + { + return ""; + } + StringBuffer seqStrings = new StringBuffer(); + Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar); + for (int c = 0; c < refCigars.length; c++) + { + if (sqanddels[c] != null) + { + seqStrings.append((String) sqanddels[c][0]); + sqanddels[c][0] = null; + } + seqStrings.append('\n'); + } + return seqStrings.toString(); + } + + /** + * return string results of applying cigar string to all reference cigars + * + * @param GapChar + * char + * @return String[] + */ + public String[] getSequenceStrings(char GapChar) + { + + if (length == 0 || refCigars == null || refCigars.length == 0) + { + return null; + } + Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar); + String[] seqs = new String[sqanddels.length]; + for (int c = 0; c < refCigars.length; c++) + { + seqs[c] = (String) sqanddels[c][0]; + } + return seqs; + } + + /** + * Combines the CigarArray cigar operations with the operations in each + * reference cigar - creating a new reference cigar + * + * @return Cigar[] + * + * public CigarBase[] getEditedCigars() { + * + * return new CigarBase[] {}; } + */ + /** + * applyDeletions edits underlying refCigars to propagate deleted regions, and + * removes deletion operations from CigarArray operation list. + * + * @return int[] position after deletion occured and range of deletion in + * cigarArray or null if none occured + */ + public int[] applyDeletions() + { + java.util.Vector delpos = null; + if (length == 0) + { + return null; + } + int cursor = 0; // range counter for deletions + int vcursor = 0; // visible column index + int offset = 0; // shift in visible column index as deletions are made + int i = 0; + while (i < length) + { + if (operation[i] != D) + { + if (operation[i] == M) + { + cursor += range[i]; + } + vcursor += range[i++]; + } + else + { + if (delpos == null) + { + delpos = new java.util.Vector(); + } + int delstart = cursor, delend = cursor + range[i] - 1; // inclusive + delpos.addElement(new int[] + { vcursor + offset, range[i] }); // index of right hand column after + // hidden region boundary + offset += range[i] - 1; // shift in visible column coordinates + System.arraycopy(operation, i + 1, operation, i, length - i); + System.arraycopy(range, i + 1, range, i, length - i); + length--; + /* + * int dmax=0; for (int s=0; sdmax) dmax=d; } + * offset+=dmax; // shift in visible column coordinates + */ + for (int s = 0; s < refCigars.length; s++) + { + int d = refCigars[s].deleteRange(delstart, delend); + } + + } + } + if (delpos != null) + { + int[] pos = new int[delpos.size() * 2]; + for (int k = 0, l = delpos.size(); k < l; k++) + { + int[] dr = ((int[]) delpos.elementAt(k)); + pos[k * 2] = dr[0]; + pos[k * 2 + 1] = dr[1]; + delpos.setElementAt(null, k); + } + delpos = null; + return pos; + } + return null; + } + + /** + * + * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does + * not resolve to set of seqCigars) + */ + public SeqCigar[] getSeqCigarArray() + { + if (!isSeqCigarArray()) + { + return null; + } + SeqCigar[] sa = new SeqCigar[refCigars.length]; + for (int i = 0; i < refCigars.length; i++) + { + sa[i] = (SeqCigar) refCigars[i]; + } + return sa; + } +} diff --git a/src/jalview/datamodel/CigarBase.java b/src/jalview/datamodel/CigarBase.java index 11f1c36..cb0bd12 100644 --- a/src/jalview/datamodel/CigarBase.java +++ b/src/jalview/datamodel/CigarBase.java @@ -1,646 +1,646 @@ -/* - * 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 . - */ -package jalview.datamodel; - -import java.util.*; - -public abstract class CigarBase -{ - /** - * Base class for compact idiosyncratic representation of gaps and aligned - * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006 - * Not thread safe. - */ - public CigarBase() - { - // nothing to be done (probably) - } - - protected int length = 0; - - protected int _inc_length = 10; // extension range for addition of new - - // operations - - protected char[] operation = null; - - protected int[] range = null; - - /** - * Range of Hidden residues in seq (translated as deleted in seq) - */ - public static final char D = 'D'; - - /** - * Range of insertions to seq - */ - public static final char I = 'I'; - - /** - * Range of aligned residues - */ - public static final char M = 'M'; - - static protected final char _case_shift = 'a' - 'A'; - - /** - * Ugly function to get edited sequence string, start and end symbol positions - * and the deletion regions as an array of int pairs May return null for an - * empty cigar string. May return null for deletion ranges if there are none. - * - * @param reference - * - the symbol sequence to apply the cigar operations to (or null if - * no sequence) - * @param GapChar - * - the symbol to use for Insert operations - * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3] - * {start, end, col} or null} the gapped sequence, first and last - * residue index, and the deletion ranges on the reference sequence - */ - public Object[] getSequenceAndDeletions(String reference, char GapChar) - { - int rlength = 0; - int[][] deletions = new int[length][]; - int[][] trunc_deletions = null; - StringBuffer sq = new StringBuffer(); - int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1; - boolean consecutive_del = false; - if (length == 0) - { - return null; - } - if (reference != null) - { - rlength = reference.length(); - } - boolean modstart = true; - for (int i = 0; i < length; i++) - { - switch (operation[i]) - { - case D: - if (!consecutive_del) - { - deletions[++delcount] = new int[] - { cursor, 0, alcursor }; - } - cursor += range[i]; - deletions[delcount][1] = cursor - 1; - consecutive_del = true; - break; - case I: - consecutive_del = false; - for (int r = 0; r < range[i]; r++) - { - sq.append(GapChar); - alcursor++; - } - break; - case M: - consecutive_del = false; - if (modstart) - { - start = cursor; - startpos = alcursor; - modstart = false; - } - if (reference != null) - { - int sbend = cursor + range[i]; - if (sbend > rlength) - { - sq.append(reference.substring(cursor, rlength)); - while (sbend-- >= rlength) - { - sq.append(GapChar); - } - } - else - { - sq.append(reference.substring(cursor, sbend)); - } - } - alcursor += range[i]; - cursor += range[i]; - end = cursor - 1; - endpos = alcursor; - break; - default: - throw new Error("Unknown SeqCigar operation '" + operation[i] + "'"); - } - } - if (++delcount > 0) - { - trunc_deletions = new int[delcount][]; - System.arraycopy(deletions, 0, trunc_deletions, 0, delcount); - } - deletions = null; - return new Object[] - { ((reference != null) ? sq.toString() : null), new int[] - { start, startpos, end, endpos }, trunc_deletions }; - } - - protected void compact_operations() - { - int i = 1; - if (operation == null) - { - return; - } - char last = operation[0]; - while (i < length) - { - if (last == operation[i]) - { - range[i - 1] += range[i]; - int r = length - i; - if (r > 0) - { - System.arraycopy(range, i + 1, range, i, r); - System.arraycopy(operation, i + 1, operation, i, r); - } - length--; - } - else - { - last = operation[i++]; - } - } - } - - /** - * turn a cigar string into a series of operation range pairs - * - * @param cigarString - * String - * @return object[] {char[] operation, int[] range} - * @throws java.lang.Exception - * for improperly formated cigar strings or ones with unknown - * operations - */ - public static Object[] parseCigarString(String cigarString) - throws Exception - { - int ops = 0; - for (int i = 0, l = cigarString.length(); i < l; i++) - { - char c = cigarString.charAt(i); - if (c == M || c == (M - _case_shift) || c == I - || c == (I - _case_shift) || c == D || c == (D - _case_shift)) - { - ops++; - } - } - char[] operation = new char[ops]; - int[] range = new int[ops]; - int op = 0; - int i = 0, l = cigarString.length(); - while (i < l) - { - char c; - int j = i; - do - { - c = cigarString.charAt(j++); - } while (c >= '0' && c <= '9' && j < l); - if (j >= l && c >= '0' && c <= '9') - { - throw new Exception("Unterminated cigar string."); - } - try - { - String rangeint = cigarString.substring(i, j - 1); - range[op] = Integer.parseInt(rangeint); - i = j; - } catch (Exception e) - { - throw new Error("Implementation bug in parseCigarString"); - } - if (c >= 'a' && c <= 'z') - { - c -= _case_shift; - } - if ((c == M || c == I || c == D)) - { - operation[op++] = c; - } - else - { - throw new Exception("Unexpected operation '" + c - + "' in cigar string (position " + i + " in '" - + cigarString + "'"); - } - } - return new Object[] - { operation, range }; - } - - /** - * add an operation to cigar string - * - * @param op - * char - * @param range - * int - */ - public void addOperation(char op, int range) - { - if (op >= 'a' && op <= 'z') - { - op -= _case_shift; - } - if (op != M && op != D && op != I) - { - throw new Error("Implementation error. Invalid operation string."); - } - if (range == 0) - { - return; // No Operation to add. - } - if (range < 0) - { - throw new Error( - "Invalid range string (must be zero or positive number)"); - } - int lngth = 0; - if (operation == null) - { - this.operation = new char[_inc_length]; - this.range = new int[_inc_length]; - } - if (length + 1 == operation.length) - { - char[] ops = this.operation; - this.operation = new char[length + 1 + _inc_length]; - System.arraycopy(ops, 0, this.operation, 0, length); - ops = null; - int[] rng = this.range; - this.range = new int[length + 1 + _inc_length]; - System.arraycopy(rng, 0, this.range, 0, length); - rng = null; - } - if ((length > 0) && (operation[length - 1] == op)) - { - length--; // modify existing operation. - } - else - { - this.range[length] = 0; // reset range - } - this.operation[length] = op; - this.range[length++] += range; - } - - /** - * semi-efficient insert an operation on the current cigar string set at - * column pos (from 1) NOTE: Insertion operations simply extend width of cigar - * result - affecting registration of alignment Deletion ops will shorten - * length of result - and affect registration of alignment Match ops will also - * affect length of result - affecting registration of alignment (ie - * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie - * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie - * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie - * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms - * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to - * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts - * sequence left by 1 residue and extends it by 3 ( - * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") ( - * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") ( - * "1M10D5M".insert(1,M,3)->" - * - * if pos is beyond width - I operations are added before the operation - * - * @param pos - * int -1, 0-length of visible region, or greater to append new ops - * (with insertions in between) - * @param op - * char - * @param range - * int public void addOperationAt(int pos, char op, int range) { int - * cursor = -1; // mark the position for the current operation being - * edited. int o = 0; boolean last_d = false; // previous op was a - * deletion. if (pos < -1) throw new - * Error("pos<-1 is not supported."); while (o0) addInsertion(pos-cursor); - * // then just add the new operation. Regardless of what it is. - * addOperation(op, range); } else { int diff = pos - cursor; - * - * int e_length = length-o; // new edit operation array length. // - * diff<0 - can only happen before first insertion or match. - - * affects op and all following // dif==0 - only when at first - * position of existing op - // diff>0 - must preserve some existing - * operations int[] e_range = new int[e_length]; - * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op - * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0, - * e_length); length = o; // can now use add_operation to extend - * list. int e_o=0; // current operation being edited. switch (op) { - * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { // - * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o - * - 1] -= range; } else { this.range[o-1]=0; } if - * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] += - * range; // just add more matched residues break; case I: // change - * from insertion to match if (last_d && diff<=0) { // reduce D's, if - * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range; - * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose - * this op. } e_range[e_o] break; default: throw new Inp } - * - * break; case I: break; case D: } break; default: throw new - * Error("Implementation Error: Unknown operation in addOperation!"); - * } // finally, add remaining ops. while (e_o end) - { - throw new Error( - "Implementation Error: deleteRange out of bounds: start must be non-negative and less than end."); - } - // find beginning - int cursor = 0; // mark the position for the current operation being edited. - int rlength = 1 + end - start; // number of positions to delete - int oldlen = length; - int o = 0; - boolean editing = false; - char[] oldops = operation; - int[] oldrange = range; - length = 0; - operation = null; - range = null; - compact_operations(); - while (o < oldlen && cursor <= end && rlength > 0) - { - if (oldops[o] == D) - { - // absorbed into new deleted region. - addDeleted(oldrange[o++]); - continue; - } - - int remain = oldrange[o]; // number of op characters left to edit - if (!editing) - { - if ((cursor + remain) <= start) - { - addOperation(oldops[o], oldrange[o]); - cursor += oldrange[o++]; - continue; // next operation - } - editing = true; - // add operations before hidden region - if (start - cursor > 0) - { - addOperation(oldops[o], start - cursor); - remain -= start - cursor; - } - } - // start inserting new ops - if (o < oldlen && editing && rlength > 0 && remain > 0) - { - switch (oldops[o]) - { - case M: - if (rlength > remain) - { - addDeleted(remain); - deleted += remain; - } - else - { - deleted += rlength; - addDeleted(rlength); - if (remain - rlength > 0) - { - this.addOperation(M, remain - rlength); // add remaining back. - } - rlength = 0; - remain = 0; - } - break; - case I: - if (remain - rlength > 0) - { - // only remove some gaps - addInsertion(remain - rlength); - rlength = 0; - } - break; - case D: - throw new Error("Implementation error."); // do nothing; - default: - throw new Error("Implementation Error! Unknown operation '" - + oldops[o] + "'"); - } - rlength -= remain; - remain = oldrange[++o]; // number of op characters left to edit - } - } - // add remaining - while (o < oldlen) - { - addOperation(oldops[o], oldrange[o++]); - } - // if (cursor<(start+1)) { - // ran out of ops - nothing to do here ? - // addInsertion(start-cursor); - // } - return deleted; - } - - /** - * Deleted regions mean that there will be discontinuous sequence numbering in - * the sequence returned by getSeq(char). - * - * @return true if there deletions - */ - public boolean hasDeletedRegions() - { - for (int i = 0; i < length; i++) - { - if (operation[i] == D) - { - return true; - } - } - return false; - } - - /** - * enumerate the ranges on seq that are marked as deleted in this cigar - * - * @return int[] { vis_start, sym_start, length } - */ - public int[] getDeletedRegions() - { - if (length == 0) - { - return null; - } - Vector dr = new Vector(); - int cursor = 0, vcursor = 0; - for (int i = 0; i < length; i++) - { - switch (operation[i]) - { - case M: - cursor += range[i]; - case I: - vcursor += range[i]; - break; - case D: - dr.addElement(new int[] - { vcursor, cursor, range[i] }); - cursor += range[i]; - } - } - if (dr.size() == 0) - { - return null; - } - int[] delregions = new int[dr.size() * 3]; - for (int i = 0, l = dr.size(); i < l; i++) - { - int[] reg = (int[]) dr.elementAt(i); - delregions[i * 3] = reg[0]; - delregions[i * 3 + 1] = reg[1]; - delregions[i * 3 + 2] = reg[2]; - } - return delregions; - } - - /** - * sum of ranges in cigar string - * - * @return int number of residues hidden, matched, or gaps inserted into - * sequence - */ - public int getFullWidth() - { - int w = 0; - if (range != null) - { - for (int i = 0; i < length; i++) - { - w += range[i]; - } - } - return w; - } - - /** - * Visible length of aligned sequence - * - * @return int length of including gaps and less hidden regions - */ - public int getWidth() - { - int w = 0; - if (range != null) - { - for (int i = 0; i < length; i++) - { - if (operation[i] == M || operation[i] == I) - { - w += range[i]; - } - } - } - return w; - } - - /** - * mark a range of inserted residues - * - * @param range - * int - */ - public void addInsertion(int range) - { - this.addOperation(I, range); - } - - /** - * mark the next range residues as hidden (not aligned) or deleted - * - * @param range - * int - */ - public void addDeleted(int range) - { - this.addOperation(D, range); - } - - /** - * Modifies operation list to delete columns from start to end (inclusive) - * editing will remove insertion operations, and convert matches to deletions - * - * @param start - * alignment column - * @param end - * alignment column - * @return boolean true if residues were marked as deleted. public boolean - * deleteRange(int start, int end) { boolean deleted = false; int op = - * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width = - * 0; // zero'th column if (length > 0) { // find operation bracketing - * start of the range do { if (operation[op] != D) { width += - * range[prevop = op]; } op++; } while (op < length && width < start); - * } if (width < start) { // run off end - add more operations up to - * deletion. addInsertion(start - width); } else { // edit existing - * operations. op = prevop; width -= range[prevop]; int[] oldrange = - * range; char[] oldops = operation; range = new int[oldrange.length]; - * operation = new char[oldops.length]; if (op < length) { do { if - * (operation[op] != D) { width += range[postop = op]; } op++; } while - * (op < length && width <= end); } } if (deleted == true) { - * addDeleted(end - start + 1); } return deleted; } - */ - /** - * Return an ENSEMBL style cigar string where D may indicates excluded parts - * of seq - * - * @return String of form ([0-9]+[IMD])+ - */ - public String getCigarstring() - { - StringBuffer cigarString = new StringBuffer(); - for (int i = 0; i < length; i++) - { - cigarString.append("" + range[i]); - cigarString.append(operation[i]); - } - return cigarString.toString(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +import java.util.*; + +public abstract class CigarBase +{ + /** + * Base class for compact idiosyncratic representation of gaps and aligned + * residues Regards to Tom Oldfield for his DynamicArray class. 17th July 2006 + * Not thread safe. + */ + public CigarBase() + { + // nothing to be done (probably) + } + + protected int length = 0; + + protected int _inc_length = 10; // extension range for addition of new + + // operations + + protected char[] operation = null; + + protected int[] range = null; + + /** + * Range of Hidden residues in seq (translated as deleted in seq) + */ + public static final char D = 'D'; + + /** + * Range of insertions to seq + */ + public static final char I = 'I'; + + /** + * Range of aligned residues + */ + public static final char M = 'M'; + + static protected final char _case_shift = 'a' - 'A'; + + /** + * Ugly function to get edited sequence string, start and end symbol positions + * and the deletion regions as an array of int pairs May return null for an + * empty cigar string. May return null for deletion ranges if there are none. + * + * @param reference + * - the symbol sequence to apply the cigar operations to (or null if + * no sequence) + * @param GapChar + * - the symbol to use for Insert operations + * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3] + * {start, end, col} or null} the gapped sequence, first and last + * residue index, and the deletion ranges on the reference sequence + */ + public Object[] getSequenceAndDeletions(String reference, char GapChar) + { + int rlength = 0; + int[][] deletions = new int[length][]; + int[][] trunc_deletions = null; + StringBuffer sq = new StringBuffer(); + int cursor = 0, alcursor = 0, start = 0, startpos = 0, end = 0, endpos = 0, delcount = -1; + boolean consecutive_del = false; + if (length == 0) + { + return null; + } + if (reference != null) + { + rlength = reference.length(); + } + boolean modstart = true; + for (int i = 0; i < length; i++) + { + switch (operation[i]) + { + case D: + if (!consecutive_del) + { + deletions[++delcount] = new int[] + { cursor, 0, alcursor }; + } + cursor += range[i]; + deletions[delcount][1] = cursor - 1; + consecutive_del = true; + break; + case I: + consecutive_del = false; + for (int r = 0; r < range[i]; r++) + { + sq.append(GapChar); + alcursor++; + } + break; + case M: + consecutive_del = false; + if (modstart) + { + start = cursor; + startpos = alcursor; + modstart = false; + } + if (reference != null) + { + int sbend = cursor + range[i]; + if (sbend > rlength) + { + sq.append(reference.substring(cursor, rlength)); + while (sbend-- >= rlength) + { + sq.append(GapChar); + } + } + else + { + sq.append(reference.substring(cursor, sbend)); + } + } + alcursor += range[i]; + cursor += range[i]; + end = cursor - 1; + endpos = alcursor; + break; + default: + throw new Error("Unknown SeqCigar operation '" + operation[i] + "'"); + } + } + if (++delcount > 0) + { + trunc_deletions = new int[delcount][]; + System.arraycopy(deletions, 0, trunc_deletions, 0, delcount); + } + deletions = null; + return new Object[] + { ((reference != null) ? sq.toString() : null), new int[] + { start, startpos, end, endpos }, trunc_deletions }; + } + + protected void compact_operations() + { + int i = 1; + if (operation == null) + { + return; + } + char last = operation[0]; + while (i < length) + { + if (last == operation[i]) + { + range[i - 1] += range[i]; + int r = length - i; + if (r > 0) + { + System.arraycopy(range, i + 1, range, i, r); + System.arraycopy(operation, i + 1, operation, i, r); + } + length--; + } + else + { + last = operation[i++]; + } + } + } + + /** + * turn a cigar string into a series of operation range pairs + * + * @param cigarString + * String + * @return object[] {char[] operation, int[] range} + * @throws java.lang.Exception + * for improperly formated cigar strings or ones with unknown + * operations + */ + public static Object[] parseCigarString(String cigarString) + throws Exception + { + int ops = 0; + for (int i = 0, l = cigarString.length(); i < l; i++) + { + char c = cigarString.charAt(i); + if (c == M || c == (M - _case_shift) || c == I + || c == (I - _case_shift) || c == D || c == (D - _case_shift)) + { + ops++; + } + } + char[] operation = new char[ops]; + int[] range = new int[ops]; + int op = 0; + int i = 0, l = cigarString.length(); + while (i < l) + { + char c; + int j = i; + do + { + c = cigarString.charAt(j++); + } while (c >= '0' && c <= '9' && j < l); + if (j >= l && c >= '0' && c <= '9') + { + throw new Exception("Unterminated cigar string."); + } + try + { + String rangeint = cigarString.substring(i, j - 1); + range[op] = Integer.parseInt(rangeint); + i = j; + } catch (Exception e) + { + throw new Error("Implementation bug in parseCigarString"); + } + if (c >= 'a' && c <= 'z') + { + c -= _case_shift; + } + if ((c == M || c == I || c == D)) + { + operation[op++] = c; + } + else + { + throw new Exception("Unexpected operation '" + c + + "' in cigar string (position " + i + " in '" + + cigarString + "'"); + } + } + return new Object[] + { operation, range }; + } + + /** + * add an operation to cigar string + * + * @param op + * char + * @param range + * int + */ + public void addOperation(char op, int range) + { + if (op >= 'a' && op <= 'z') + { + op -= _case_shift; + } + if (op != M && op != D && op != I) + { + throw new Error("Implementation error. Invalid operation string."); + } + if (range == 0) + { + return; // No Operation to add. + } + if (range < 0) + { + throw new Error( + "Invalid range string (must be zero or positive number)"); + } + int lngth = 0; + if (operation == null) + { + this.operation = new char[_inc_length]; + this.range = new int[_inc_length]; + } + if (length + 1 == operation.length) + { + char[] ops = this.operation; + this.operation = new char[length + 1 + _inc_length]; + System.arraycopy(ops, 0, this.operation, 0, length); + ops = null; + int[] rng = this.range; + this.range = new int[length + 1 + _inc_length]; + System.arraycopy(rng, 0, this.range, 0, length); + rng = null; + } + if ((length > 0) && (operation[length - 1] == op)) + { + length--; // modify existing operation. + } + else + { + this.range[length] = 0; // reset range + } + this.operation[length] = op; + this.range[length++] += range; + } + + /** + * semi-efficient insert an operation on the current cigar string set at + * column pos (from 1) NOTE: Insertion operations simply extend width of cigar + * result - affecting registration of alignment Deletion ops will shorten + * length of result - and affect registration of alignment Match ops will also + * affect length of result - affecting registration of alignment (ie + * "10M".insert(4,I,3)->"4M3I3M") - (replace?) (ie + * "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment) (ie + * "5I5M".insert(4,I,3)->"8I5M") - real insertion (ie + * "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms + * changed to Ds (ie "10M".insert(4,M,3)->"13M") - lengthens - Is changed to + * M, Ds changed to M. (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts + * sequence left by 1 residue and extends it by 3 ( + * "10D5M".insert(-1,M,3)->"3M7D5M") ( "10D5M".insert(0,M,3)->"7D8M") ( + * "10D5M".insert(1,M,3)->"10D8M") ( "1M10D5M".insert(0,M,3)->"1M10D8M") ( + * "1M10D5M".insert(1,M,3)->" + * + * if pos is beyond width - I operations are added before the operation + * + * @param pos + * int -1, 0-length of visible region, or greater to append new ops + * (with insertions in between) + * @param op + * char + * @param range + * int public void addOperationAt(int pos, char op, int range) { int + * cursor = -1; // mark the position for the current operation being + * edited. int o = 0; boolean last_d = false; // previous op was a + * deletion. if (pos < -1) throw new + * Error("pos<-1 is not supported."); while (o0) addInsertion(pos-cursor); + * // then just add the new operation. Regardless of what it is. + * addOperation(op, range); } else { int diff = pos - cursor; + * + * int e_length = length-o; // new edit operation array length. // + * diff<0 - can only happen before first insertion or match. - + * affects op and all following // dif==0 - only when at first + * position of existing op - // diff>0 - must preserve some existing + * operations int[] e_range = new int[e_length]; + * System.arraycopy(this.range, o, e_range, 0, e_length); char[] e_op + * = new char[e_length]; System.arraycopy(this.operation, o, e_op, 0, + * e_length); length = o; // can now use add_operation to extend + * list. int e_o=0; // current operation being edited. switch (op) { + * case M: switch (e_op[e_o]) { case M: if (last_d && diff <= 0) { // + * reduce D's, if possible if (range<=this.range[o-1]) { this.range[o + * - 1] -= range; } else { this.range[o-1]=0; } if + * (this.range[o-1]==0) o--; // lose this op. } e_range[e_o] += + * range; // just add more matched residues break; case I: // change + * from insertion to match if (last_d && diff<=0) { // reduce D's, if + * possible if (range<=this.range[o-1]) { this.range[o - 1] -= range; + * } else { this.range[o-1]=0; } if (this.range[o-1]==0) o--; // lose + * this op. } e_range[e_o] break; default: throw new Inp } + * + * break; case I: break; case D: } break; default: throw new + * Error("Implementation Error: Unknown operation in addOperation!"); + * } // finally, add remaining ops. while (e_o end) + { + throw new Error( + "Implementation Error: deleteRange out of bounds: start must be non-negative and less than end."); + } + // find beginning + int cursor = 0; // mark the position for the current operation being edited. + int rlength = 1 + end - start; // number of positions to delete + int oldlen = length; + int o = 0; + boolean editing = false; + char[] oldops = operation; + int[] oldrange = range; + length = 0; + operation = null; + range = null; + compact_operations(); + while (o < oldlen && cursor <= end && rlength > 0) + { + if (oldops[o] == D) + { + // absorbed into new deleted region. + addDeleted(oldrange[o++]); + continue; + } + + int remain = oldrange[o]; // number of op characters left to edit + if (!editing) + { + if ((cursor + remain) <= start) + { + addOperation(oldops[o], oldrange[o]); + cursor += oldrange[o++]; + continue; // next operation + } + editing = true; + // add operations before hidden region + if (start - cursor > 0) + { + addOperation(oldops[o], start - cursor); + remain -= start - cursor; + } + } + // start inserting new ops + if (o < oldlen && editing && rlength > 0 && remain > 0) + { + switch (oldops[o]) + { + case M: + if (rlength > remain) + { + addDeleted(remain); + deleted += remain; + } + else + { + deleted += rlength; + addDeleted(rlength); + if (remain - rlength > 0) + { + this.addOperation(M, remain - rlength); // add remaining back. + } + rlength = 0; + remain = 0; + } + break; + case I: + if (remain - rlength > 0) + { + // only remove some gaps + addInsertion(remain - rlength); + rlength = 0; + } + break; + case D: + throw new Error("Implementation error."); // do nothing; + default: + throw new Error("Implementation Error! Unknown operation '" + + oldops[o] + "'"); + } + rlength -= remain; + remain = oldrange[++o]; // number of op characters left to edit + } + } + // add remaining + while (o < oldlen) + { + addOperation(oldops[o], oldrange[o++]); + } + // if (cursor<(start+1)) { + // ran out of ops - nothing to do here ? + // addInsertion(start-cursor); + // } + return deleted; + } + + /** + * Deleted regions mean that there will be discontinuous sequence numbering in + * the sequence returned by getSeq(char). + * + * @return true if there deletions + */ + public boolean hasDeletedRegions() + { + for (int i = 0; i < length; i++) + { + if (operation[i] == D) + { + return true; + } + } + return false; + } + + /** + * enumerate the ranges on seq that are marked as deleted in this cigar + * + * @return int[] { vis_start, sym_start, length } + */ + public int[] getDeletedRegions() + { + if (length == 0) + { + return null; + } + Vector dr = new Vector(); + int cursor = 0, vcursor = 0; + for (int i = 0; i < length; i++) + { + switch (operation[i]) + { + case M: + cursor += range[i]; + case I: + vcursor += range[i]; + break; + case D: + dr.addElement(new int[] + { vcursor, cursor, range[i] }); + cursor += range[i]; + } + } + if (dr.size() == 0) + { + return null; + } + int[] delregions = new int[dr.size() * 3]; + for (int i = 0, l = dr.size(); i < l; i++) + { + int[] reg = (int[]) dr.elementAt(i); + delregions[i * 3] = reg[0]; + delregions[i * 3 + 1] = reg[1]; + delregions[i * 3 + 2] = reg[2]; + } + return delregions; + } + + /** + * sum of ranges in cigar string + * + * @return int number of residues hidden, matched, or gaps inserted into + * sequence + */ + public int getFullWidth() + { + int w = 0; + if (range != null) + { + for (int i = 0; i < length; i++) + { + w += range[i]; + } + } + return w; + } + + /** + * Visible length of aligned sequence + * + * @return int length of including gaps and less hidden regions + */ + public int getWidth() + { + int w = 0; + if (range != null) + { + for (int i = 0; i < length; i++) + { + if (operation[i] == M || operation[i] == I) + { + w += range[i]; + } + } + } + return w; + } + + /** + * mark a range of inserted residues + * + * @param range + * int + */ + public void addInsertion(int range) + { + this.addOperation(I, range); + } + + /** + * mark the next range residues as hidden (not aligned) or deleted + * + * @param range + * int + */ + public void addDeleted(int range) + { + this.addOperation(D, range); + } + + /** + * Modifies operation list to delete columns from start to end (inclusive) + * editing will remove insertion operations, and convert matches to deletions + * + * @param start + * alignment column + * @param end + * alignment column + * @return boolean true if residues were marked as deleted. public boolean + * deleteRange(int start, int end) { boolean deleted = false; int op = + * 0, prevop = -1, firstm = -1, lastm = -1, postop = -1; int width = + * 0; // zero'th column if (length > 0) { // find operation bracketing + * start of the range do { if (operation[op] != D) { width += + * range[prevop = op]; } op++; } while (op < length && width < start); + * } if (width < start) { // run off end - add more operations up to + * deletion. addInsertion(start - width); } else { // edit existing + * operations. op = prevop; width -= range[prevop]; int[] oldrange = + * range; char[] oldops = operation; range = new int[oldrange.length]; + * operation = new char[oldops.length]; if (op < length) { do { if + * (operation[op] != D) { width += range[postop = op]; } op++; } while + * (op < length && width <= end); } } if (deleted == true) { + * addDeleted(end - start + 1); } return deleted; } + */ + /** + * Return an ENSEMBL style cigar string where D may indicates excluded parts + * of seq + * + * @return String of form ([0-9]+[IMD])+ + */ + public String getCigarstring() + { + StringBuffer cigarString = new StringBuffer(); + for (int i = 0; i < length; i++) + { + cigarString.append("" + range[i]); + cigarString.append(operation[i]); + } + return cigarString.toString(); + } +} diff --git a/src/jalview/datamodel/CigarCigar.java b/src/jalview/datamodel/CigarCigar.java index b779498..bc89d2c 100644 --- a/src/jalview/datamodel/CigarCigar.java +++ b/src/jalview/datamodel/CigarCigar.java @@ -1,61 +1,61 @@ -/* - * 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 . - */ -package jalview.datamodel; - -public class CigarCigar extends CigarSimple -{ - SeqCigar refCigar; - - /** - * Apply CIGAR operations to the result of another cigar - * - * @param cigar - * Cigar - */ - CigarCigar(SeqCigar cigar) - { - super(); - refCigar = cigar; - } - - /** - * - * @return String formed by applying CIGAR operations to the reference object - * @param GapChar - * char - * @todo Implement this jalview.datamodel.Cigar method - */ - public String getSequenceString(char GapChar) - { - if (length == 0) - { - return ""; - } - String refString = refCigar.getSequenceString(GapChar); - if (refString != null) - { - return (length == 0) ? "" : (String) getSequenceAndDeletions( - refString, GapChar)[0]; - } - else - { - return null; - } - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +public class CigarCigar extends CigarSimple +{ + SeqCigar refCigar; + + /** + * Apply CIGAR operations to the result of another cigar + * + * @param cigar + * Cigar + */ + CigarCigar(SeqCigar cigar) + { + super(); + refCigar = cigar; + } + + /** + * + * @return String formed by applying CIGAR operations to the reference object + * @param GapChar + * char + * @todo Implement this jalview.datamodel.Cigar method + */ + public String getSequenceString(char GapChar) + { + if (length == 0) + { + return ""; + } + String refString = refCigar.getSequenceString(GapChar); + if (refString != null) + { + return (length == 0) ? "" : (String) getSequenceAndDeletions( + refString, GapChar)[0]; + } + else + { + return null; + } + } + +} diff --git a/src/jalview/datamodel/CigarSimple.java b/src/jalview/datamodel/CigarSimple.java index 9ea3a43..2fb52d3 100644 --- a/src/jalview/datamodel/CigarSimple.java +++ b/src/jalview/datamodel/CigarSimple.java @@ -1,32 +1,32 @@ -/* - * 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 . - */ -package jalview.datamodel; - -public abstract class CigarSimple extends CigarBase -{ - /** - * Return a symbol sequence with edits (gaps, insertions and deletions) - * applied - * - * @param GapChar - * char - * @return String - */ - public abstract String getSequenceString(char GapChar); - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +public abstract class CigarSimple extends CigarBase +{ + /** + * Return a symbol sequence with edits (gaps, insertions and deletions) + * applied + * + * @param GapChar + * char + * @return String + */ + public abstract String getSequenceString(char GapChar); + +} diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index fd3d897..775327ad 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -1,1258 +1,1258 @@ -/* - * 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 . - */ -package jalview.datamodel; - -import java.util.*; - -import jalview.util.*; - -/** - * NOTE: Columns are zero based. - */ -public class ColumnSelection -{ - Vector selected = new Vector(); - - // Vector of int [] {startCol, endCol} - Vector hiddenColumns; - - /** - * Add a column to the selection - * - * @param col - * index of column - */ - public void addElement(int col) - { - Integer column = new Integer(col); - if (!selected.contains(column)) - { - selected.addElement(column); - } - } - - /** - * clears column selection - */ - public void clear() - { - selected.removeAllElements(); - } - - /** - * removes col from selection - * - * @param col - * index of column to be removed - */ - public void removeElement(int col) - { - Integer colInt = new Integer(col); - - if (selected.contains(colInt)) - { - selected.removeElement(colInt); - } - } - - /** - * removes a range of columns from the selection - * - * @param start - * int - first column in range to be removed - * @param end - * int - last col - */ - public void removeElements(int start, int end) - { - Integer colInt; - for (int i = start; i < end; i++) - { - colInt = new Integer(i); - if (selected.contains(colInt)) - { - selected.removeElement(colInt); - } - } - } - - /** - * - * @return Vector containing selected columns as Integers - */ - public Vector getSelected() - { - return selected; - } - - /** - * - * @param col - * index to search for in column selection - * - * @return true if Integer(col) is in selection. - */ - public boolean contains(int col) - { - return selected.contains(new Integer(col)); - } - - /** - * Column number at position i in selection - * - * @param i - * index into selected columns - * - * @return column number in alignment - */ - public int columnAt(int i) - { - return ((Integer) selected.elementAt(i)).intValue(); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public int size() - { - return selected.size(); - } - - /** - * rightmost selected column - * - * @return rightmost column in alignment that is selected - */ - public int getMax() - { - int max = -1; - - for (int i = 0; i < selected.size(); i++) - { - if (columnAt(i) > max) - { - max = columnAt(i); - } - } - - return max; - } - - /** - * Leftmost column in selection - * - * @return column index of leftmost column in selection - */ - public int getMin() - { - int min = 1000000000; - - for (int i = 0; i < selected.size(); i++) - { - if (columnAt(i) < min) - { - min = columnAt(i); - } - } - - return min; - } - - /** - * propagate shift in alignment columns to column selection - * - * @param start - * beginning of edit - * @param left - * shift in edit (+ve for removal, or -ve for inserts) - */ - public Vector compensateForEdit(int start, int change) - { - Vector deletedHiddenColumns = null; - for (int i = 0; i < size(); i++) - { - int temp = columnAt(i); - - if (temp >= start) - { - selected.setElementAt(new Integer(temp - change), i); - } - } - - if (hiddenColumns != null) - { - deletedHiddenColumns = new Vector(); - int hSize = hiddenColumns.size(); - for (int i = 0; i < hSize; i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (region[0] > start && start + change > region[1]) - { - deletedHiddenColumns.addElement(hiddenColumns.elementAt(i)); - - hiddenColumns.removeElementAt(i); - i--; - hSize--; - continue; - } - - if (region[0] > start) - { - region[0] -= change; - region[1] -= change; - } - - if (region[0] < 0) - { - region[0] = 0; - } - - } - - this.revealHiddenColumns(0); - } - - return deletedHiddenColumns; - } - - /** - * propagate shift in alignment columns to column selection special version of - * compensateForEdit - allowing for edits within hidden regions - * - * @param start - * beginning of edit - * @param left - * shift in edit (+ve for removal, or -ve for inserts) - */ - private void compensateForDelEdits(int start, int change) - { - for (int i = 0; i < size(); i++) - { - int temp = columnAt(i); - - if (temp >= start) - { - selected.setElementAt(new Integer(temp - change), i); - } - } - - if (hiddenColumns != null) - { - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (region[0] >= start) - { - region[0] -= change; - } - if (region[1] >= start) - { - region[1] -= change; - } - if (region[1] < region[0]) - { - hiddenColumns.removeElementAt(i--); - } - - if (region[0] < 0) - { - region[0] = 0; - } - if (region[1] < 0) - { - region[1] = 0; - } - } - } - } - - /** - * Adjust hidden column boundaries based on a series of column additions or - * deletions in visible regions. - * - * @param shiftrecord - * @return - */ - public ShiftList compensateForEdits(ShiftList shiftrecord) - { - if (shiftrecord != null) - { - Vector shifts = shiftrecord.shifts; - if (shifts != null && shifts.size() > 0) - { - int shifted = 0; - for (int i = 0, j = shifts.size(); i < j; i++) - { - int[] sh = (int[]) shifts.elementAt(i); - // compensateForEdit(shifted+sh[0], sh[1]); - compensateForDelEdits(shifted + sh[0], sh[1]); - shifted -= sh[1]; - } - } - return shiftrecord.getInverse(); - } - return null; - } - - /** - * removes intersection of position,length ranges in deletions from the - * start,end regions marked in intervals. - * - * @param deletions - * @param intervals - * @return - */ - private boolean pruneIntervalVector(Vector deletions, Vector intervals) - { - boolean pruned = false; - int i = 0, j = intervals.size() - 1, s = 0, t = deletions.size() - 1; - int hr[] = (int[]) intervals.elementAt(i); - int sr[] = (int[]) deletions.elementAt(s); - while (i <= j && s <= t) - { - boolean trailinghn = hr[1] >= sr[0]; - if (!trailinghn) - { - if (i < j) - { - hr = (int[]) intervals.elementAt(++i); - } - else - { - i++; - } - continue; - } - int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert - if (endshift < hr[0] || endshift < sr[0]) - { // leadinghc disjoint or not a deletion - if (s < t) - { - sr = (int[]) deletions.elementAt(++s); - } - else - { - s++; - } - continue; - } - boolean leadinghn = hr[0] >= sr[0]; - boolean leadinghc = hr[0] < endshift; - boolean trailinghc = hr[1] < endshift; - if (leadinghn) - { - if (trailinghc) - { // deleted hidden region. - intervals.removeElementAt(i); - pruned = true; - j--; - if (i <= j) - { - hr = (int[]) intervals.elementAt(i); - } - continue; - } - if (leadinghc) - { - hr[0] = endshift; // clip c terminal region - leadinghn = !leadinghn; - pruned = true; - } - } - if (!leadinghn) - { - if (trailinghc) - { - if (trailinghn) - { - hr[1] = sr[0] - 1; - pruned = true; - } - } - else - { - // sr contained in hr - if (s < t) - { - sr = (int[]) deletions.elementAt(++s); - } - else - { - s++; - } - continue; - } - } - } - return pruned; // true if any interval was removed or modified by - // operations. - } - - private boolean pruneColumnList(Vector deletion, Vector list) - { - int s = 0, t = deletion.size(); - int[] sr = (int[]) list.elementAt(s++); - boolean pruned = false; - int i = 0, j = list.size(); - while (i < j && s <= t) - { - int c = ((Integer) list.elementAt(i++)).intValue(); - if (sr[0] <= c) - { - if (sr[1] + sr[0] >= c) - { // sr[1] -ve means inseriton. - list.removeElementAt(--i); - j--; - } - else - { - if (s < t) - { - sr = (int[]) deletion.elementAt(s); - } - s++; - } - } - } - return pruned; - } - - /** - * remove any hiddenColumns or selected columns and shift remaining based on a - * series of position, range deletions. - * - * @param deletions - */ - public void pruneDeletions(ShiftList deletions) - { - if (deletions != null) - { - Vector shifts = deletions.shifts; - if (shifts != null && shifts.size() > 0) - { - // delete any intervals intersecting. - if (hiddenColumns != null) - { - pruneIntervalVector(shifts, hiddenColumns); - if (hiddenColumns != null && hiddenColumns.size() == 0) - { - hiddenColumns = null; - } - } - if (selected != null && selected.size() > 0) - { - pruneColumnList(shifts, selected); - if (selected != null && selected.size() == 0) - { - selected = null; - } - } - // and shift the rest. - this.compensateForEdits(deletions); - } - } - } - - /** - * This Method is used to return all the HiddenColumn regions less than the - * given index. - * - * @param end - * int - * @return Vector - */ - public Vector getHiddenColumns() - { - return hiddenColumns; - } - - /** - * Return absolute column index for a visible column index - * - * @param column - * int column index in alignment view - * @return alignment column index for column - */ - public int adjustForHiddenColumns(int column) - { - int result = column; - if (hiddenColumns != null) - { - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (result >= region[0]) - { - result += region[1] - region[0] + 1; - } - } - } - return result; - } - - /** - * Use this method to find out where a column will appear in the visible - * alignment when hidden columns exist. If the column is not visible, then the - * left-most visible column will always be returned. - * - * @param hiddenColumn - * int - * @return int - */ - public int findColumnPosition(int hiddenColumn) - { - int result = hiddenColumn; - if (hiddenColumns != null) - { - int index = 0; - int[] region; - do - { - region = (int[]) hiddenColumns.elementAt(index++); - if (hiddenColumn > region[1]) - { - result -= region[1] + 1 - region[0]; - } - } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size())); - if (hiddenColumn > region[0] && hiddenColumn < region[1]) - { - return region[0] + hiddenColumn - result; - } - } - return result; // return the shifted position after removing hidden columns. - } - - /** - * Use this method to determine where the next hiddenRegion starts - */ - public int findHiddenRegionPosition(int hiddenRegion) - { - int result = 0; - if (hiddenColumns != null) - { - int index = 0; - int gaps = 0; - do - { - int[] region = (int[]) hiddenColumns.elementAt(index); - if (hiddenRegion == 0) - { - return region[0]; - } - - gaps += region[1] + 1 - region[0]; - result = region[1] + 1; - index++; - } while (index < hiddenRegion + 1); - - result -= gaps; - } - - return result; - } - - /** - * THis method returns the rightmost limit of a region of an alignment with - * hidden columns. In otherwords, the next hidden column. - * - * @param index - * int - */ - public int getHiddenBoundaryRight(int alPos) - { - if (hiddenColumns != null) - { - int index = 0; - do - { - int[] region = (int[]) hiddenColumns.elementAt(index); - if (alPos < region[0]) - { - return region[0]; - } - - index++; - } while (index < hiddenColumns.size()); - } - - return alPos; - - } - - /** - * This method returns the leftmost limit of a region of an alignment with - * hidden columns. In otherwords, the previous hidden column. - * - * @param index - * int - */ - public int getHiddenBoundaryLeft(int alPos) - { - if (hiddenColumns != null) - { - int index = hiddenColumns.size() - 1; - do - { - int[] region = (int[]) hiddenColumns.elementAt(index); - if (alPos > region[1]) - { - return region[1]; - } - - index--; - } while (index > -1); - } - - return alPos; - - } - - public void hideSelectedColumns() - { - while (size() > 0) - { - int column = ((Integer) getSelected().firstElement()).intValue(); - hideColumns(column); - } - - } - - public void hideColumns(int start, int end) - { - if (hiddenColumns == null) - { - hiddenColumns = new Vector(); - } - - boolean added = false; - boolean overlap = false; - - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (start <= region[1] && end >= region[0]) - { - hiddenColumns.removeElementAt(i); - overlap = true; - break; - } - else if (end < region[0] && start < region[0]) - { - hiddenColumns.insertElementAt(new int[] - { start, end }, i); - added = true; - break; - } - } - - if (overlap) - { - hideColumns(start, end); - } - else if (!added) - { - hiddenColumns.addElement(new int[] - { start, end }); - } - - } - - /** - * This method will find a range of selected columns around the column - * specified - * - * @param res - * int - */ - public void hideColumns(int col) - { - // First find out range of columns to hide - int min = col, max = col + 1; - while (contains(min)) - { - removeElement(min); - min--; - } - - while (contains(max)) - { - removeElement(max); - max++; - } - - min++; - max--; - if (min > max) - { - min = max; - } - - hideColumns(min, max); - } - - public void revealAllHiddenColumns() - { - if (hiddenColumns != null) - { - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - for (int j = region[0]; j < region[1] + 1; j++) - { - addElement(j); - } - } - } - - hiddenColumns = null; - } - - public void revealHiddenColumns(int res) - { - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (res == region[0]) - { - for (int j = region[0]; j < region[1] + 1; j++) - { - addElement(j); - } - - hiddenColumns.removeElement(region); - break; - } - } - if (hiddenColumns.size() == 0) - { - hiddenColumns = null; - } - } - - public boolean isVisible(int column) - { - if (hiddenColumns != null) - for (int i = 0; i < hiddenColumns.size(); i++) - { - int[] region = (int[]) hiddenColumns.elementAt(i); - if (column >= region[0] && column <= region[1]) - { - return false; - } - } - - return true; - } - - /** - * Copy constructor - * - * @param copy - */ - public ColumnSelection(ColumnSelection copy) - { - if (copy != null) - { - if (copy.selected != null) - { - selected = new Vector(); - for (int i = 0, j = copy.selected.size(); i < j; i++) - { - selected.addElement(copy.selected.elementAt(i)); - } - } - if (copy.hiddenColumns != null) - { - hiddenColumns = new Vector(copy.hiddenColumns.size()); - for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++) - { - int[] rh, cp; - rh = (int[]) copy.hiddenColumns.elementAt(i); - if (rh != null) - { - cp = new int[rh.length]; - System.arraycopy(rh, 0, cp, 0, rh.length); - hiddenColumns.addElement(cp); - } - } - } - } - } - - /** - * ColumnSelection - */ - public ColumnSelection() - { - } - - public String[] getVisibleSequenceStrings(int start, int end, - SequenceI[] seqs) - { - int i, iSize = seqs.length; - String selection[] = new String[iSize]; - if (hiddenColumns != null && hiddenColumns.size() > 0) - { - for (i = 0; i < iSize; i++) - { - StringBuffer visibleSeq = new StringBuffer(); - Vector regions = getHiddenColumns(); - - int blockStart = start, blockEnd = end; - int[] region; - int hideStart, hideEnd; - - for (int j = 0; j < regions.size(); j++) - { - region = (int[]) regions.elementAt(j); - hideStart = region[0]; - hideEnd = region[1]; - - if (hideStart < start) - { - continue; - } - - blockStart = Math.min(blockStart, hideEnd + 1); - blockEnd = Math.min(blockEnd, hideStart); - - if (blockStart > blockEnd) - { - break; - } - - visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd)); - - blockStart = hideEnd + 1; - blockEnd = end; - } - - if (end > blockStart) - { - visibleSeq.append(seqs[i].getSequence(blockStart, end)); - } - - selection[i] = visibleSeq.toString(); - } - } - else - { - for (i = 0; i < iSize; i++) - { - selection[i] = seqs[i].getSequenceAsString(start, end); - } - } - - return selection; - } - - /** - * return all visible segments between the given start and end boundaries - * - * @param start - * (first column inclusive from 0) - * @param end - * (last column - not inclusive) - * @return int[] {i_start, i_end, ..} where intervals lie in - * start<=i_start<=i_end 0) - { - Vector visiblecontigs = new Vector(); - Vector regions = getHiddenColumns(); - - int vstart = start; - int[] region; - int hideStart, hideEnd; - - for (int j = 0; vstart < end && j < regions.size(); j++) - { - region = (int[]) regions.elementAt(j); - hideStart = region[0]; - hideEnd = region[1]; - - if (hideEnd < vstart) - { - continue; - } - if (hideStart > vstart) - { - visiblecontigs.addElement(new int[] - { vstart, hideStart - 1 }); - } - vstart = hideEnd + 1; - } - - if (vstart < end) - { - visiblecontigs.addElement(new int[] - { vstart, end - 1 }); - } - int[] vcontigs = new int[visiblecontigs.size() * 2]; - for (int i = 0, j = visiblecontigs.size(); i < j; i++) - { - int[] vc = (int[]) visiblecontigs.elementAt(i); - visiblecontigs.setElementAt(null, i); - vcontigs[i * 2] = vc[0]; - vcontigs[i * 2 + 1] = vc[1]; - } - visiblecontigs.removeAllElements(); - return vcontigs; - } - else - { - return new int[] - { start, end - 1 }; - } - } - - /** - * delete any columns in alignmentAnnotation that are hidden (including - * sequence associated annotation). - * - * @param alignmentAnnotation - */ - public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation) - { - makeVisibleAnnotation(-1, -1, alignmentAnnotation); - } - - /** - * delete any columns in alignmentAnnotation that are hidden (including - * sequence associated annotation). - * - * @param start - * remove any annotation to the right of this column - * @param end - * remove any annotation to the left of this column - * @param alignmentAnnotation - * the annotation to operate on - */ - public void makeVisibleAnnotation(int start, int end, - AlignmentAnnotation alignmentAnnotation) - { - if (alignmentAnnotation.annotations == null) - { - return; - } - if (start == end && end == -1) - { - start = 0; - end = alignmentAnnotation.annotations.length; - } - if (hiddenColumns != null && hiddenColumns.size() > 0) - { - // then mangle the alignmentAnnotation annotation array - Vector annels = new Vector(); - Annotation[] els = null; - Vector regions = getHiddenColumns(); - int blockStart = start, blockEnd = end; - int[] region; - int hideStart, hideEnd, w = 0; - - for (int j = 0; j < regions.size(); j++) - { - region = (int[]) regions.elementAt(j); - hideStart = region[0]; - hideEnd = region[1]; - - if (hideStart < start) - { - continue; - } - - blockStart = Math.min(blockStart, hideEnd + 1); - blockEnd = Math.min(blockEnd, hideStart); - - if (blockStart > blockEnd) - { - break; - } - - annels.addElement(els = new Annotation[blockEnd - blockStart]); - System.arraycopy(alignmentAnnotation.annotations, blockStart, els, - 0, els.length); - w += els.length; - blockStart = hideEnd + 1; - blockEnd = end; - } - - if (end > blockStart) - { - annels.addElement(els = new Annotation[end - blockStart + 1]); - if ((els.length + blockStart) <= alignmentAnnotation.annotations.length) - { - // copy just the visible segment of the annotation row - System.arraycopy(alignmentAnnotation.annotations, blockStart, - els, 0, els.length); - } - else - { - // copy to the end of the annotation row - System.arraycopy(alignmentAnnotation.annotations, blockStart, - els, 0, - (alignmentAnnotation.annotations.length - blockStart)); - } - w += els.length; - } - if (w == 0) - return; - Enumeration e = annels.elements(); - alignmentAnnotation.annotations = new Annotation[w]; - w = 0; - while (e.hasMoreElements()) - { - Annotation[] chnk = (Annotation[]) e.nextElement(); - System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w, - chnk.length); - w += chnk.length; - } - } - else - { - alignmentAnnotation.restrict(start, end); - } - } - - /** - * Invert the column selection from first to end-1. leaves hiddenColumns - * untouched (and unselected) - * - * @param first - * @param end - */ - public void invertColumnSelection(int first, int width) - { - boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0; - for (int i = first; i < width; i++) - { - if (contains(i)) - { - removeElement(i); - } - else - { - if (!hasHidden || isVisible(i)) - { - addElement(i); - } - } - } - } - - /** - * add in any unselected columns from the given column selection, excluding - * any that are hidden. - * - * @param colsel - */ - public void addElementsFrom(ColumnSelection colsel) - { - if (colsel != null && colsel.size() > 0) - { - Enumeration e = colsel.getSelected().elements(); - while (e.hasMoreElements()) - { - Object eo = e.nextElement(); - if (hiddenColumns != null && isVisible(((Integer) eo).intValue())) - { - if (!selected.contains(eo)) - { - selected.addElement(eo); - } - } - } - } - } - - /** - * set the selected columns the given column selection, excluding any columns - * that are hidden. - * - * @param colsel - */ - public void setElementsFrom(ColumnSelection colsel) - { - selected = new Vector(); - if (colsel.selected != null && colsel.selected.size() > 0) - { - if (hiddenColumns != null && hiddenColumns.size() > 0) - { - // only select visible columns in this columns selection - selected = new Vector(); - addElementsFrom(colsel); - } - else - { - // add everything regardless - Enumeration en = colsel.selected.elements(); - while (en.hasMoreElements()) - { - selected.addElement(en.nextElement()); - } - } - } - } - - /** - * Add gaps into the sequences aligned to profileseq under the given - * AlignmentView - * - * @param profileseq - * @param al - * - alignment to have gaps inserted into it - * @param input - * - alignment view where sequence corresponding to profileseq is - * first entry - * @return new Column selection for new alignment view, with insertions into - * profileseq marked as hidden. - */ - public static ColumnSelection propagateInsertions(SequenceI profileseq, - Alignment al, AlignmentView input) - { - int profsqpos = 0; - - // return propagateInsertions(profileseq, al, ) - char gc = al.getGapCharacter(); - Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc); - ColumnSelection nview = (ColumnSelection) alandcolsel[1]; - SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos]; - nview.propagateInsertions(profileseq, al, origseq); - return nview; - } - - /** - * - * @param profileseq - * - sequence in al which corresponds to origseq - * @param al - * - alignment which is to have gaps inserted into it - * @param origseq - * - sequence corresponding to profileseq which defines gap map for - * modifying al - */ - public void propagateInsertions(SequenceI profileseq, AlignmentI al, - SequenceI origseq) - { - char gc = al.getGapCharacter(); - // recover mapping between sequence's non-gap positions and positions - // mapping to view. - pruneDeletions(ShiftList.parseMap(origseq.gapMap())); - int[] viscontigs = getVisibleContigs(0, profileseq.getLength()); - int spos = 0; - int offset = 0; - // input.pruneDeletions(ShiftList.parseMap(((SequenceI[]) - // alandcolsel[0])[0].gapMap())) - // add profile to visible contigs - for (int v = 0; v < viscontigs.length; v += 2) - { - if (viscontigs[v] > spos) - { - StringBuffer sb = new StringBuffer(); - for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++) - { - sb.append(gc); - } - for (int s = 0, ns = al.getHeight(); s < ns; s++) - { - SequenceI sqobj = al.getSequenceAt(s); - if (sqobj != profileseq) - { - String sq = al.getSequenceAt(s).getSequenceAsString(); - if (sq.length() <= spos + offset) - { - // pad sequence - int diff = spos + offset - sq.length() - 1; - if (diff > 0) - { - // pad gaps - sq = sq + sb; - while ((diff = spos + offset - sq.length() - 1) > 0) - { - // sq = sq - // + ((diff >= sb.length()) ? sb.toString() : sb - // .substring(0, diff)); - if (diff >= sb.length()) - { - sq += sb.toString(); - } - else - { - char[] buf = new char[diff]; - sb.getChars(0, diff, buf, 0); - sq += buf.toString(); - } - } - } - sq += sb.toString(); - } - else - { - al.getSequenceAt(s).setSequence( - sq.substring(0, spos + offset) + sb.toString() - + sq.substring(spos + offset)); - } - } - } - // offset+=sb.length(); - } - spos = viscontigs[v + 1] + 1; - } - if ((offset + spos) < profileseq.getLength()) - { - // pad the final region with gaps. - StringBuffer sb = new StringBuffer(); - for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++) - { - sb.append(gc); - } - for (int s = 0, ns = al.getHeight(); s < ns; s++) - { - SequenceI sqobj = al.getSequenceAt(s); - if (sqobj == profileseq) - { - continue; - } - String sq = sqobj.getSequenceAsString(); - // pad sequence - int diff = origseq.getLength() - sq.length(); - while (diff > 0) - { - // sq = sq - // + ((diff >= sb.length()) ? sb.toString() : sb - // .substring(0, diff)); - if (diff >= sb.length()) - { - sq += sb.toString(); - } - else - { - char[] buf = new char[diff]; - sb.getChars(0, diff, buf, 0); - sq += buf.toString(); - } - diff = origseq.getLength() - sq.length(); - } - } - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +import java.util.*; + +import jalview.util.*; + +/** + * NOTE: Columns are zero based. + */ +public class ColumnSelection +{ + Vector selected = new Vector(); + + // Vector of int [] {startCol, endCol} + Vector hiddenColumns; + + /** + * Add a column to the selection + * + * @param col + * index of column + */ + public void addElement(int col) + { + Integer column = new Integer(col); + if (!selected.contains(column)) + { + selected.addElement(column); + } + } + + /** + * clears column selection + */ + public void clear() + { + selected.removeAllElements(); + } + + /** + * removes col from selection + * + * @param col + * index of column to be removed + */ + public void removeElement(int col) + { + Integer colInt = new Integer(col); + + if (selected.contains(colInt)) + { + selected.removeElement(colInt); + } + } + + /** + * removes a range of columns from the selection + * + * @param start + * int - first column in range to be removed + * @param end + * int - last col + */ + public void removeElements(int start, int end) + { + Integer colInt; + for (int i = start; i < end; i++) + { + colInt = new Integer(i); + if (selected.contains(colInt)) + { + selected.removeElement(colInt); + } + } + } + + /** + * + * @return Vector containing selected columns as Integers + */ + public Vector getSelected() + { + return selected; + } + + /** + * + * @param col + * index to search for in column selection + * + * @return true if Integer(col) is in selection. + */ + public boolean contains(int col) + { + return selected.contains(new Integer(col)); + } + + /** + * Column number at position i in selection + * + * @param i + * index into selected columns + * + * @return column number in alignment + */ + public int columnAt(int i) + { + return ((Integer) selected.elementAt(i)).intValue(); + } + + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + public int size() + { + return selected.size(); + } + + /** + * rightmost selected column + * + * @return rightmost column in alignment that is selected + */ + public int getMax() + { + int max = -1; + + for (int i = 0; i < selected.size(); i++) + { + if (columnAt(i) > max) + { + max = columnAt(i); + } + } + + return max; + } + + /** + * Leftmost column in selection + * + * @return column index of leftmost column in selection + */ + public int getMin() + { + int min = 1000000000; + + for (int i = 0; i < selected.size(); i++) + { + if (columnAt(i) < min) + { + min = columnAt(i); + } + } + + return min; + } + + /** + * propagate shift in alignment columns to column selection + * + * @param start + * beginning of edit + * @param left + * shift in edit (+ve for removal, or -ve for inserts) + */ + public Vector compensateForEdit(int start, int change) + { + Vector deletedHiddenColumns = null; + for (int i = 0; i < size(); i++) + { + int temp = columnAt(i); + + if (temp >= start) + { + selected.setElementAt(new Integer(temp - change), i); + } + } + + if (hiddenColumns != null) + { + deletedHiddenColumns = new Vector(); + int hSize = hiddenColumns.size(); + for (int i = 0; i < hSize; i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (region[0] > start && start + change > region[1]) + { + deletedHiddenColumns.addElement(hiddenColumns.elementAt(i)); + + hiddenColumns.removeElementAt(i); + i--; + hSize--; + continue; + } + + if (region[0] > start) + { + region[0] -= change; + region[1] -= change; + } + + if (region[0] < 0) + { + region[0] = 0; + } + + } + + this.revealHiddenColumns(0); + } + + return deletedHiddenColumns; + } + + /** + * propagate shift in alignment columns to column selection special version of + * compensateForEdit - allowing for edits within hidden regions + * + * @param start + * beginning of edit + * @param left + * shift in edit (+ve for removal, or -ve for inserts) + */ + private void compensateForDelEdits(int start, int change) + { + for (int i = 0; i < size(); i++) + { + int temp = columnAt(i); + + if (temp >= start) + { + selected.setElementAt(new Integer(temp - change), i); + } + } + + if (hiddenColumns != null) + { + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (region[0] >= start) + { + region[0] -= change; + } + if (region[1] >= start) + { + region[1] -= change; + } + if (region[1] < region[0]) + { + hiddenColumns.removeElementAt(i--); + } + + if (region[0] < 0) + { + region[0] = 0; + } + if (region[1] < 0) + { + region[1] = 0; + } + } + } + } + + /** + * Adjust hidden column boundaries based on a series of column additions or + * deletions in visible regions. + * + * @param shiftrecord + * @return + */ + public ShiftList compensateForEdits(ShiftList shiftrecord) + { + if (shiftrecord != null) + { + Vector shifts = shiftrecord.shifts; + if (shifts != null && shifts.size() > 0) + { + int shifted = 0; + for (int i = 0, j = shifts.size(); i < j; i++) + { + int[] sh = (int[]) shifts.elementAt(i); + // compensateForEdit(shifted+sh[0], sh[1]); + compensateForDelEdits(shifted + sh[0], sh[1]); + shifted -= sh[1]; + } + } + return shiftrecord.getInverse(); + } + return null; + } + + /** + * removes intersection of position,length ranges in deletions from the + * start,end regions marked in intervals. + * + * @param deletions + * @param intervals + * @return + */ + private boolean pruneIntervalVector(Vector deletions, Vector intervals) + { + boolean pruned = false; + int i = 0, j = intervals.size() - 1, s = 0, t = deletions.size() - 1; + int hr[] = (int[]) intervals.elementAt(i); + int sr[] = (int[]) deletions.elementAt(s); + while (i <= j && s <= t) + { + boolean trailinghn = hr[1] >= sr[0]; + if (!trailinghn) + { + if (i < j) + { + hr = (int[]) intervals.elementAt(++i); + } + else + { + i++; + } + continue; + } + int endshift = sr[0] + sr[1]; // deletion ranges - -ve means an insert + if (endshift < hr[0] || endshift < sr[0]) + { // leadinghc disjoint or not a deletion + if (s < t) + { + sr = (int[]) deletions.elementAt(++s); + } + else + { + s++; + } + continue; + } + boolean leadinghn = hr[0] >= sr[0]; + boolean leadinghc = hr[0] < endshift; + boolean trailinghc = hr[1] < endshift; + if (leadinghn) + { + if (trailinghc) + { // deleted hidden region. + intervals.removeElementAt(i); + pruned = true; + j--; + if (i <= j) + { + hr = (int[]) intervals.elementAt(i); + } + continue; + } + if (leadinghc) + { + hr[0] = endshift; // clip c terminal region + leadinghn = !leadinghn; + pruned = true; + } + } + if (!leadinghn) + { + if (trailinghc) + { + if (trailinghn) + { + hr[1] = sr[0] - 1; + pruned = true; + } + } + else + { + // sr contained in hr + if (s < t) + { + sr = (int[]) deletions.elementAt(++s); + } + else + { + s++; + } + continue; + } + } + } + return pruned; // true if any interval was removed or modified by + // operations. + } + + private boolean pruneColumnList(Vector deletion, Vector list) + { + int s = 0, t = deletion.size(); + int[] sr = (int[]) list.elementAt(s++); + boolean pruned = false; + int i = 0, j = list.size(); + while (i < j && s <= t) + { + int c = ((Integer) list.elementAt(i++)).intValue(); + if (sr[0] <= c) + { + if (sr[1] + sr[0] >= c) + { // sr[1] -ve means inseriton. + list.removeElementAt(--i); + j--; + } + else + { + if (s < t) + { + sr = (int[]) deletion.elementAt(s); + } + s++; + } + } + } + return pruned; + } + + /** + * remove any hiddenColumns or selected columns and shift remaining based on a + * series of position, range deletions. + * + * @param deletions + */ + public void pruneDeletions(ShiftList deletions) + { + if (deletions != null) + { + Vector shifts = deletions.shifts; + if (shifts != null && shifts.size() > 0) + { + // delete any intervals intersecting. + if (hiddenColumns != null) + { + pruneIntervalVector(shifts, hiddenColumns); + if (hiddenColumns != null && hiddenColumns.size() == 0) + { + hiddenColumns = null; + } + } + if (selected != null && selected.size() > 0) + { + pruneColumnList(shifts, selected); + if (selected != null && selected.size() == 0) + { + selected = null; + } + } + // and shift the rest. + this.compensateForEdits(deletions); + } + } + } + + /** + * This Method is used to return all the HiddenColumn regions less than the + * given index. + * + * @param end + * int + * @return Vector + */ + public Vector getHiddenColumns() + { + return hiddenColumns; + } + + /** + * Return absolute column index for a visible column index + * + * @param column + * int column index in alignment view + * @return alignment column index for column + */ + public int adjustForHiddenColumns(int column) + { + int result = column; + if (hiddenColumns != null) + { + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (result >= region[0]) + { + result += region[1] - region[0] + 1; + } + } + } + return result; + } + + /** + * Use this method to find out where a column will appear in the visible + * alignment when hidden columns exist. If the column is not visible, then the + * left-most visible column will always be returned. + * + * @param hiddenColumn + * int + * @return int + */ + public int findColumnPosition(int hiddenColumn) + { + int result = hiddenColumn; + if (hiddenColumns != null) + { + int index = 0; + int[] region; + do + { + region = (int[]) hiddenColumns.elementAt(index++); + if (hiddenColumn > region[1]) + { + result -= region[1] + 1 - region[0]; + } + } while ((hiddenColumn > region[1]) && (index < hiddenColumns.size())); + if (hiddenColumn > region[0] && hiddenColumn < region[1]) + { + return region[0] + hiddenColumn - result; + } + } + return result; // return the shifted position after removing hidden columns. + } + + /** + * Use this method to determine where the next hiddenRegion starts + */ + public int findHiddenRegionPosition(int hiddenRegion) + { + int result = 0; + if (hiddenColumns != null) + { + int index = 0; + int gaps = 0; + do + { + int[] region = (int[]) hiddenColumns.elementAt(index); + if (hiddenRegion == 0) + { + return region[0]; + } + + gaps += region[1] + 1 - region[0]; + result = region[1] + 1; + index++; + } while (index < hiddenRegion + 1); + + result -= gaps; + } + + return result; + } + + /** + * THis method returns the rightmost limit of a region of an alignment with + * hidden columns. In otherwords, the next hidden column. + * + * @param index + * int + */ + public int getHiddenBoundaryRight(int alPos) + { + if (hiddenColumns != null) + { + int index = 0; + do + { + int[] region = (int[]) hiddenColumns.elementAt(index); + if (alPos < region[0]) + { + return region[0]; + } + + index++; + } while (index < hiddenColumns.size()); + } + + return alPos; + + } + + /** + * This method returns the leftmost limit of a region of an alignment with + * hidden columns. In otherwords, the previous hidden column. + * + * @param index + * int + */ + public int getHiddenBoundaryLeft(int alPos) + { + if (hiddenColumns != null) + { + int index = hiddenColumns.size() - 1; + do + { + int[] region = (int[]) hiddenColumns.elementAt(index); + if (alPos > region[1]) + { + return region[1]; + } + + index--; + } while (index > -1); + } + + return alPos; + + } + + public void hideSelectedColumns() + { + while (size() > 0) + { + int column = ((Integer) getSelected().firstElement()).intValue(); + hideColumns(column); + } + + } + + public void hideColumns(int start, int end) + { + if (hiddenColumns == null) + { + hiddenColumns = new Vector(); + } + + boolean added = false; + boolean overlap = false; + + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (start <= region[1] && end >= region[0]) + { + hiddenColumns.removeElementAt(i); + overlap = true; + break; + } + else if (end < region[0] && start < region[0]) + { + hiddenColumns.insertElementAt(new int[] + { start, end }, i); + added = true; + break; + } + } + + if (overlap) + { + hideColumns(start, end); + } + else if (!added) + { + hiddenColumns.addElement(new int[] + { start, end }); + } + + } + + /** + * This method will find a range of selected columns around the column + * specified + * + * @param res + * int + */ + public void hideColumns(int col) + { + // First find out range of columns to hide + int min = col, max = col + 1; + while (contains(min)) + { + removeElement(min); + min--; + } + + while (contains(max)) + { + removeElement(max); + max++; + } + + min++; + max--; + if (min > max) + { + min = max; + } + + hideColumns(min, max); + } + + public void revealAllHiddenColumns() + { + if (hiddenColumns != null) + { + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + for (int j = region[0]; j < region[1] + 1; j++) + { + addElement(j); + } + } + } + + hiddenColumns = null; + } + + public void revealHiddenColumns(int res) + { + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (res == region[0]) + { + for (int j = region[0]; j < region[1] + 1; j++) + { + addElement(j); + } + + hiddenColumns.removeElement(region); + break; + } + } + if (hiddenColumns.size() == 0) + { + hiddenColumns = null; + } + } + + public boolean isVisible(int column) + { + if (hiddenColumns != null) + for (int i = 0; i < hiddenColumns.size(); i++) + { + int[] region = (int[]) hiddenColumns.elementAt(i); + if (column >= region[0] && column <= region[1]) + { + return false; + } + } + + return true; + } + + /** + * Copy constructor + * + * @param copy + */ + public ColumnSelection(ColumnSelection copy) + { + if (copy != null) + { + if (copy.selected != null) + { + selected = new Vector(); + for (int i = 0, j = copy.selected.size(); i < j; i++) + { + selected.addElement(copy.selected.elementAt(i)); + } + } + if (copy.hiddenColumns != null) + { + hiddenColumns = new Vector(copy.hiddenColumns.size()); + for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++) + { + int[] rh, cp; + rh = (int[]) copy.hiddenColumns.elementAt(i); + if (rh != null) + { + cp = new int[rh.length]; + System.arraycopy(rh, 0, cp, 0, rh.length); + hiddenColumns.addElement(cp); + } + } + } + } + } + + /** + * ColumnSelection + */ + public ColumnSelection() + { + } + + public String[] getVisibleSequenceStrings(int start, int end, + SequenceI[] seqs) + { + int i, iSize = seqs.length; + String selection[] = new String[iSize]; + if (hiddenColumns != null && hiddenColumns.size() > 0) + { + for (i = 0; i < iSize; i++) + { + StringBuffer visibleSeq = new StringBuffer(); + Vector regions = getHiddenColumns(); + + int blockStart = start, blockEnd = end; + int[] region; + int hideStart, hideEnd; + + for (int j = 0; j < regions.size(); j++) + { + region = (int[]) regions.elementAt(j); + hideStart = region[0]; + hideEnd = region[1]; + + if (hideStart < start) + { + continue; + } + + blockStart = Math.min(blockStart, hideEnd + 1); + blockEnd = Math.min(blockEnd, hideStart); + + if (blockStart > blockEnd) + { + break; + } + + visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd)); + + blockStart = hideEnd + 1; + blockEnd = end; + } + + if (end > blockStart) + { + visibleSeq.append(seqs[i].getSequence(blockStart, end)); + } + + selection[i] = visibleSeq.toString(); + } + } + else + { + for (i = 0; i < iSize; i++) + { + selection[i] = seqs[i].getSequenceAsString(start, end); + } + } + + return selection; + } + + /** + * return all visible segments between the given start and end boundaries + * + * @param start + * (first column inclusive from 0) + * @param end + * (last column - not inclusive) + * @return int[] {i_start, i_end, ..} where intervals lie in + * start<=i_start<=i_end 0) + { + Vector visiblecontigs = new Vector(); + Vector regions = getHiddenColumns(); + + int vstart = start; + int[] region; + int hideStart, hideEnd; + + for (int j = 0; vstart < end && j < regions.size(); j++) + { + region = (int[]) regions.elementAt(j); + hideStart = region[0]; + hideEnd = region[1]; + + if (hideEnd < vstart) + { + continue; + } + if (hideStart > vstart) + { + visiblecontigs.addElement(new int[] + { vstart, hideStart - 1 }); + } + vstart = hideEnd + 1; + } + + if (vstart < end) + { + visiblecontigs.addElement(new int[] + { vstart, end - 1 }); + } + int[] vcontigs = new int[visiblecontigs.size() * 2]; + for (int i = 0, j = visiblecontigs.size(); i < j; i++) + { + int[] vc = (int[]) visiblecontigs.elementAt(i); + visiblecontigs.setElementAt(null, i); + vcontigs[i * 2] = vc[0]; + vcontigs[i * 2 + 1] = vc[1]; + } + visiblecontigs.removeAllElements(); + return vcontigs; + } + else + { + return new int[] + { start, end - 1 }; + } + } + + /** + * delete any columns in alignmentAnnotation that are hidden (including + * sequence associated annotation). + * + * @param alignmentAnnotation + */ + public void makeVisibleAnnotation(AlignmentAnnotation alignmentAnnotation) + { + makeVisibleAnnotation(-1, -1, alignmentAnnotation); + } + + /** + * delete any columns in alignmentAnnotation that are hidden (including + * sequence associated annotation). + * + * @param start + * remove any annotation to the right of this column + * @param end + * remove any annotation to the left of this column + * @param alignmentAnnotation + * the annotation to operate on + */ + public void makeVisibleAnnotation(int start, int end, + AlignmentAnnotation alignmentAnnotation) + { + if (alignmentAnnotation.annotations == null) + { + return; + } + if (start == end && end == -1) + { + start = 0; + end = alignmentAnnotation.annotations.length; + } + if (hiddenColumns != null && hiddenColumns.size() > 0) + { + // then mangle the alignmentAnnotation annotation array + Vector annels = new Vector(); + Annotation[] els = null; + Vector regions = getHiddenColumns(); + int blockStart = start, blockEnd = end; + int[] region; + int hideStart, hideEnd, w = 0; + + for (int j = 0; j < regions.size(); j++) + { + region = (int[]) regions.elementAt(j); + hideStart = region[0]; + hideEnd = region[1]; + + if (hideStart < start) + { + continue; + } + + blockStart = Math.min(blockStart, hideEnd + 1); + blockEnd = Math.min(blockEnd, hideStart); + + if (blockStart > blockEnd) + { + break; + } + + annels.addElement(els = new Annotation[blockEnd - blockStart]); + System.arraycopy(alignmentAnnotation.annotations, blockStart, els, + 0, els.length); + w += els.length; + blockStart = hideEnd + 1; + blockEnd = end; + } + + if (end > blockStart) + { + annels.addElement(els = new Annotation[end - blockStart + 1]); + if ((els.length + blockStart) <= alignmentAnnotation.annotations.length) + { + // copy just the visible segment of the annotation row + System.arraycopy(alignmentAnnotation.annotations, blockStart, + els, 0, els.length); + } + else + { + // copy to the end of the annotation row + System.arraycopy(alignmentAnnotation.annotations, blockStart, + els, 0, + (alignmentAnnotation.annotations.length - blockStart)); + } + w += els.length; + } + if (w == 0) + return; + Enumeration e = annels.elements(); + alignmentAnnotation.annotations = new Annotation[w]; + w = 0; + while (e.hasMoreElements()) + { + Annotation[] chnk = (Annotation[]) e.nextElement(); + System.arraycopy(chnk, 0, alignmentAnnotation.annotations, w, + chnk.length); + w += chnk.length; + } + } + else + { + alignmentAnnotation.restrict(start, end); + } + } + + /** + * Invert the column selection from first to end-1. leaves hiddenColumns + * untouched (and unselected) + * + * @param first + * @param end + */ + public void invertColumnSelection(int first, int width) + { + boolean hasHidden = hiddenColumns != null && hiddenColumns.size() > 0; + for (int i = first; i < width; i++) + { + if (contains(i)) + { + removeElement(i); + } + else + { + if (!hasHidden || isVisible(i)) + { + addElement(i); + } + } + } + } + + /** + * add in any unselected columns from the given column selection, excluding + * any that are hidden. + * + * @param colsel + */ + public void addElementsFrom(ColumnSelection colsel) + { + if (colsel != null && colsel.size() > 0) + { + Enumeration e = colsel.getSelected().elements(); + while (e.hasMoreElements()) + { + Object eo = e.nextElement(); + if (hiddenColumns != null && isVisible(((Integer) eo).intValue())) + { + if (!selected.contains(eo)) + { + selected.addElement(eo); + } + } + } + } + } + + /** + * set the selected columns the given column selection, excluding any columns + * that are hidden. + * + * @param colsel + */ + public void setElementsFrom(ColumnSelection colsel) + { + selected = new Vector(); + if (colsel.selected != null && colsel.selected.size() > 0) + { + if (hiddenColumns != null && hiddenColumns.size() > 0) + { + // only select visible columns in this columns selection + selected = new Vector(); + addElementsFrom(colsel); + } + else + { + // add everything regardless + Enumeration en = colsel.selected.elements(); + while (en.hasMoreElements()) + { + selected.addElement(en.nextElement()); + } + } + } + } + + /** + * Add gaps into the sequences aligned to profileseq under the given + * AlignmentView + * + * @param profileseq + * @param al + * - alignment to have gaps inserted into it + * @param input + * - alignment view where sequence corresponding to profileseq is + * first entry + * @return new Column selection for new alignment view, with insertions into + * profileseq marked as hidden. + */ + public static ColumnSelection propagateInsertions(SequenceI profileseq, + Alignment al, AlignmentView input) + { + int profsqpos = 0; + + // return propagateInsertions(profileseq, al, ) + char gc = al.getGapCharacter(); + Object[] alandcolsel = input.getAlignmentAndColumnSelection(gc); + ColumnSelection nview = (ColumnSelection) alandcolsel[1]; + SequenceI origseq = ((SequenceI[]) alandcolsel[0])[profsqpos]; + nview.propagateInsertions(profileseq, al, origseq); + return nview; + } + + /** + * + * @param profileseq + * - sequence in al which corresponds to origseq + * @param al + * - alignment which is to have gaps inserted into it + * @param origseq + * - sequence corresponding to profileseq which defines gap map for + * modifying al + */ + public void propagateInsertions(SequenceI profileseq, AlignmentI al, + SequenceI origseq) + { + char gc = al.getGapCharacter(); + // recover mapping between sequence's non-gap positions and positions + // mapping to view. + pruneDeletions(ShiftList.parseMap(origseq.gapMap())); + int[] viscontigs = getVisibleContigs(0, profileseq.getLength()); + int spos = 0; + int offset = 0; + // input.pruneDeletions(ShiftList.parseMap(((SequenceI[]) + // alandcolsel[0])[0].gapMap())) + // add profile to visible contigs + for (int v = 0; v < viscontigs.length; v += 2) + { + if (viscontigs[v] > spos) + { + StringBuffer sb = new StringBuffer(); + for (int s = 0, ns = viscontigs[v] - spos; s < ns; s++) + { + sb.append(gc); + } + for (int s = 0, ns = al.getHeight(); s < ns; s++) + { + SequenceI sqobj = al.getSequenceAt(s); + if (sqobj != profileseq) + { + String sq = al.getSequenceAt(s).getSequenceAsString(); + if (sq.length() <= spos + offset) + { + // pad sequence + int diff = spos + offset - sq.length() - 1; + if (diff > 0) + { + // pad gaps + sq = sq + sb; + while ((diff = spos + offset - sq.length() - 1) > 0) + { + // sq = sq + // + ((diff >= sb.length()) ? sb.toString() : sb + // .substring(0, diff)); + if (diff >= sb.length()) + { + sq += sb.toString(); + } + else + { + char[] buf = new char[diff]; + sb.getChars(0, diff, buf, 0); + sq += buf.toString(); + } + } + } + sq += sb.toString(); + } + else + { + al.getSequenceAt(s).setSequence( + sq.substring(0, spos + offset) + sb.toString() + + sq.substring(spos + offset)); + } + } + } + // offset+=sb.length(); + } + spos = viscontigs[v + 1] + 1; + } + if ((offset + spos) < profileseq.getLength()) + { + // pad the final region with gaps. + StringBuffer sb = new StringBuffer(); + for (int s = 0, ns = profileseq.getLength() - spos - offset; s < ns; s++) + { + sb.append(gc); + } + for (int s = 0, ns = al.getHeight(); s < ns; s++) + { + SequenceI sqobj = al.getSequenceAt(s); + if (sqobj == profileseq) + { + continue; + } + String sq = sqobj.getSequenceAsString(); + // pad sequence + int diff = origseq.getLength() - sq.length(); + while (diff > 0) + { + // sq = sq + // + ((diff >= sb.length()) ? sb.toString() : sb + // .substring(0, diff)); + if (diff >= sb.length()) + { + sq += sb.toString(); + } + else + { + char[] buf = new char[diff]; + sb.getChars(0, diff, buf, 0); + sq += buf.toString(); + } + diff = origseq.getLength() - sq.length(); + } + } + } + } +} diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index 115ef88..1fd52c3 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java index abcdc47..313e15d 100755 --- a/src/jalview/datamodel/DBRefSource.java +++ b/src/jalview/datamodel/DBRefSource.java @@ -1,138 +1,138 @@ -/* - * 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 . - */ -package jalview.datamodel; - -/** - * Defines internal constants for unambiguous annotation of DbRefEntry source - * strings and describing the data retrieved from external database sources (see - * jalview.ws.DbSourcProxy) - * - * @author JimP - * - */ -public class DBRefSource -{ - /** - * UNIPROT Accession Number - */ - public static String UNIPROT = "UNIPROT"; - - /** - * UNIPROT Entry Name - */ - public static String UP_NAME = "UNIPROT_NAME"; - - /** - * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products. - */ - public static final String UNIPROTKB = "UniProtKB/TrEMBL"; - - /** - * PDB Entry Code - */ - public static String PDB = "PDB"; - - /** - * EMBL ID - */ - public static String EMBL = "EMBL"; - - /** - * EMBLCDS ID - */ - public static String EMBLCDS = "EMBLCDS"; - - /** - * PFAM ID - */ - public static String PFAM = "PFAM"; - - /** - * RFAM ID - */ - public static String RFAM = "RFAM"; - - /** - * GeneDB ID - */ - public static final String GENEDB = "GeneDB"; - - /** - * List of databases whose sequences might have coding regions annotated - */ - public static final String[] DNACODINGDBS = - { EMBL, EMBLCDS, GENEDB }; - - public static final String[] CODINGDBS = - { EMBLCDS, GENEDB }; - - public static final String[] PROTEINDBS = - { UNIPROT, PDB, UNIPROTKB }; - - public static final String[] PROTEINSEQ = - { UNIPROT, UNIPROTKB }; - - public static final String[] PROTEINSTR = - { PDB }; - - public static final String[] DOMAINDBS = - { PFAM, RFAM }; - - /** - * set of unique DBRefSource property constants. These could be used to - * reconstruct the above groupings - */ - public static final Object SEQDB = "SQ"; - - /** - * database of nucleic acid sequences - */ - public static final Object DNASEQDB = "NASQ"; - - /** - * database of amino acid sequences - */ - public static final Object PROTSEQDB = "PROTSQ"; - - /** - * database of cDNA sequences - */ - public static final Object CODINGSEQDB = "CODING"; - - /** - * database of na sequences with exon annotation - */ - public static final Object DNACODINGSEQDB = "XONCODING"; - - /** - * DB returns several sequences associated with a protein/nucleotide domain - */ - public static final Object DOMAINDB = "DOMAIN"; - - /** - * DB query can take multiple accession codes concatenated by a separator. - * Value of property indicates maximum number of accession codes to send at a - * time. - */ - public static final Object MULTIACC = "MULTIACC"; - - /** - * DB query returns an alignment for each accession provided. - */ - public static final Object ALIGNMENTDB = "ALIGNMENTS"; -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +/** + * Defines internal constants for unambiguous annotation of DbRefEntry source + * strings and describing the data retrieved from external database sources (see + * jalview.ws.DbSourcProxy) + * + * @author JimP + * + */ +public class DBRefSource +{ + /** + * UNIPROT Accession Number + */ + public static String UNIPROT = "UNIPROT"; + + /** + * UNIPROT Entry Name + */ + public static String UP_NAME = "UNIPROT_NAME"; + + /** + * Uniprot Knowledgebase/TrEMBL as served from EMBL protein products. + */ + public static final String UNIPROTKB = "UniProtKB/TrEMBL"; + + /** + * PDB Entry Code + */ + public static String PDB = "PDB"; + + /** + * EMBL ID + */ + public static String EMBL = "EMBL"; + + /** + * EMBLCDS ID + */ + public static String EMBLCDS = "EMBLCDS"; + + /** + * PFAM ID + */ + public static String PFAM = "PFAM"; + + /** + * RFAM ID + */ + public static String RFAM = "RFAM"; + + /** + * GeneDB ID + */ + public static final String GENEDB = "GeneDB"; + + /** + * List of databases whose sequences might have coding regions annotated + */ + public static final String[] DNACODINGDBS = + { EMBL, EMBLCDS, GENEDB }; + + public static final String[] CODINGDBS = + { EMBLCDS, GENEDB }; + + public static final String[] PROTEINDBS = + { UNIPROT, PDB, UNIPROTKB }; + + public static final String[] PROTEINSEQ = + { UNIPROT, UNIPROTKB }; + + public static final String[] PROTEINSTR = + { PDB }; + + public static final String[] DOMAINDBS = + { PFAM, RFAM }; + + /** + * set of unique DBRefSource property constants. These could be used to + * reconstruct the above groupings + */ + public static final Object SEQDB = "SQ"; + + /** + * database of nucleic acid sequences + */ + public static final Object DNASEQDB = "NASQ"; + + /** + * database of amino acid sequences + */ + public static final Object PROTSEQDB = "PROTSQ"; + + /** + * database of cDNA sequences + */ + public static final Object CODINGSEQDB = "CODING"; + + /** + * database of na sequences with exon annotation + */ + public static final Object DNACODINGSEQDB = "XONCODING"; + + /** + * DB returns several sequences associated with a protein/nucleotide domain + */ + public static final Object DOMAINDB = "DOMAIN"; + + /** + * DB query can take multiple accession codes concatenated by a separator. + * Value of property indicates maximum number of accession codes to send at a + * time. + */ + public static final Object MULTIACC = "MULTIACC"; + + /** + * DB query returns an alignment for each accession provided. + */ + public static final Object ALIGNMENTDB = "ALIGNMENTS"; +} diff --git a/src/jalview/datamodel/FeatureProperties.java b/src/jalview/datamodel/FeatureProperties.java index 18ddb4c..b762648 100644 --- a/src/jalview/datamodel/FeatureProperties.java +++ b/src/jalview/datamodel/FeatureProperties.java @@ -1,48 +1,48 @@ -/* - * 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 . - */ -package jalview.datamodel; - -/** - * A set of feature property constants used by jalview - * - * @author JimP - * - */ -public class FeatureProperties -{ - - public static final String EXONPOS = "exon number"; - - public static final String EXONPRODUCT = "product"; - - /** - * lookup feature type for a particular database to see if its a coding region - * feature - * - * @param dbrefsource - * @param string - * @return - */ - public static boolean isCodingFeature(String dbrefsource, String type) - { - return ((dbrefsource == null - || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource - .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type - .equalsIgnoreCase("CDS")); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +/** + * A set of feature property constants used by jalview + * + * @author JimP + * + */ +public class FeatureProperties +{ + + public static final String EXONPOS = "exon number"; + + public static final String EXONPRODUCT = "product"; + + /** + * lookup feature type for a particular database to see if its a coding region + * feature + * + * @param dbrefsource + * @param string + * @return + */ + public static boolean isCodingFeature(String dbrefsource, String type) + { + return ((dbrefsource == null + || dbrefsource.equalsIgnoreCase(DBRefSource.EMBL) || dbrefsource + .equalsIgnoreCase(DBRefSource.EMBLCDS)) && type + .equalsIgnoreCase("CDS")); + } +} diff --git a/src/jalview/datamodel/GraphLine.java b/src/jalview/datamodel/GraphLine.java index 4af7ac4..494ffae 100755 --- a/src/jalview/datamodel/GraphLine.java +++ b/src/jalview/datamodel/GraphLine.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/HiddenSequences.java b/src/jalview/datamodel/HiddenSequences.java index 2a6b601..bb02919 100755 --- a/src/jalview/datamodel/HiddenSequences.java +++ b/src/jalview/datamodel/HiddenSequences.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.datamodel; diff --git a/src/jalview/datamodel/Mapping.java b/src/jalview/datamodel/Mapping.java index 01c5151..69555e6 100644 --- a/src/jalview/datamodel/Mapping.java +++ b/src/jalview/datamodel/Mapping.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/NodeTransformI.java b/src/jalview/datamodel/NodeTransformI.java index cea2fd9..a60bee3 100644 --- a/src/jalview/datamodel/NodeTransformI.java +++ b/src/jalview/datamodel/NodeTransformI.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index 734fb4d..12ed4e0 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/Provenance.java b/src/jalview/datamodel/Provenance.java index a05a6e9..366cbac 100755 --- a/src/jalview/datamodel/Provenance.java +++ b/src/jalview/datamodel/Provenance.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/ProvenanceEntry.java b/src/jalview/datamodel/ProvenanceEntry.java index 55d6c8b..8b620f3 100755 --- a/src/jalview/datamodel/ProvenanceEntry.java +++ b/src/jalview/datamodel/ProvenanceEntry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SearchResults.java b/src/jalview/datamodel/SearchResults.java index 0994f0f..c79972c 100755 --- a/src/jalview/datamodel/SearchResults.java +++ b/src/jalview/datamodel/SearchResults.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java index 46989bf..b18c047 100644 --- a/src/jalview/datamodel/SeqCigar.java +++ b/src/jalview/datamodel/SeqCigar.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index f14b5a5..580c850 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SequenceCollectionI.java b/src/jalview/datamodel/SequenceCollectionI.java index 34cf175..c5cee01 100644 --- a/src/jalview/datamodel/SequenceCollectionI.java +++ b/src/jalview/datamodel/SequenceCollectionI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.datamodel; import java.util.List; diff --git a/src/jalview/datamodel/SequenceFeature.java b/src/jalview/datamodel/SequenceFeature.java index 0879d96..61748c9 100755 --- a/src/jalview/datamodel/SequenceFeature.java +++ b/src/jalview/datamodel/SequenceFeature.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SequenceGroup.java b/src/jalview/datamodel/SequenceGroup.java index 693291f..c42a955 100755 --- a/src/jalview/datamodel/SequenceGroup.java +++ b/src/jalview/datamodel/SequenceGroup.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 8253531..aded6e8 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SequenceNode.java b/src/jalview/datamodel/SequenceNode.java index 0546065..3bd9211 100755 --- a/src/jalview/datamodel/SequenceNode.java +++ b/src/jalview/datamodel/SequenceNode.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/SequencePoint.java b/src/jalview/datamodel/SequencePoint.java index 2e6f175..8f591c7 100755 --- a/src/jalview/datamodel/SequencePoint.java +++ b/src/jalview/datamodel/SequencePoint.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/UniprotEntry.java b/src/jalview/datamodel/UniprotEntry.java index adb9484..e4a780a 100755 --- a/src/jalview/datamodel/UniprotEntry.java +++ b/src/jalview/datamodel/UniprotEntry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/UniprotFile.java b/src/jalview/datamodel/UniprotFile.java index cf82757..a5ed12b 100755 --- a/src/jalview/datamodel/UniprotFile.java +++ b/src/jalview/datamodel/UniprotFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/UniprotProteinName.java b/src/jalview/datamodel/UniprotProteinName.java index 578e60c..16c9f2d 100755 --- a/src/jalview/datamodel/UniprotProteinName.java +++ b/src/jalview/datamodel/UniprotProteinName.java @@ -1,37 +1,37 @@ -/* - * 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 . - */ -package jalview.datamodel; - -public class UniprotProteinName -{ - /** - * internal content storage - */ - private java.util.Vector names; - - public void setName(java.util.Vector names) - { - this.names = names; - } - - public java.util.Vector getName() - { - return names; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.datamodel; + +public class UniprotProteinName +{ + /** + * internal content storage + */ + private java.util.Vector names; + + public void setName(java.util.Vector names) + { + this.names = names; + } + + public java.util.Vector getName() + { + return names; + } + +} diff --git a/src/jalview/datamodel/UniprotSequence.java b/src/jalview/datamodel/UniprotSequence.java index 151e5b4..493841e 100755 --- a/src/jalview/datamodel/UniprotSequence.java +++ b/src/jalview/datamodel/UniprotSequence.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/BasePosition.java b/src/jalview/datamodel/xdb/embl/BasePosition.java index 0922b36..7aab6bd 100644 --- a/src/jalview/datamodel/xdb/embl/BasePosition.java +++ b/src/jalview/datamodel/xdb/embl/BasePosition.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblEntry.java b/src/jalview/datamodel/xdb/embl/EmblEntry.java index 4011e0b..0ae49b9 100644 --- a/src/jalview/datamodel/xdb/embl/EmblEntry.java +++ b/src/jalview/datamodel/xdb/embl/EmblEntry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblError.java b/src/jalview/datamodel/xdb/embl/EmblError.java index aab91ac..920abd4 100644 --- a/src/jalview/datamodel/xdb/embl/EmblError.java +++ b/src/jalview/datamodel/xdb/embl/EmblError.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblFeature.java b/src/jalview/datamodel/xdb/embl/EmblFeature.java index 04b88ba..aaae520 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeature.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeature.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java index 16784cc..35825bd 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocElement.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java index 43a6cef..6a69970 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java +++ b/src/jalview/datamodel/xdb/embl/EmblFeatureLocations.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblFile.java b/src/jalview/datamodel/xdb/embl/EmblFile.java index 111f816..4091222 100644 --- a/src/jalview/datamodel/xdb/embl/EmblFile.java +++ b/src/jalview/datamodel/xdb/embl/EmblFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/EmblSequence.java b/src/jalview/datamodel/xdb/embl/EmblSequence.java index 442147f..c266785 100644 --- a/src/jalview/datamodel/xdb/embl/EmblSequence.java +++ b/src/jalview/datamodel/xdb/embl/EmblSequence.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/datamodel/xdb/embl/Qualifier.java b/src/jalview/datamodel/xdb/embl/Qualifier.java index c0b0cf7..74edfc5 100644 --- a/src/jalview/datamodel/xdb/embl/Qualifier.java +++ b/src/jalview/datamodel/xdb/embl/Qualifier.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 6c50dfd..025b970 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -1,1610 +1,1610 @@ -/* - * 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 . - */ -package jalview.ext.jmol; - -import jalview.api.AlignmentViewPanel; -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.api.SequenceStructureBinding; -import jalview.api.StructureSelectionManagerProvider; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.PDBEntry; -import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; -import jalview.schemes.ColourSchemeI; -import jalview.schemes.ResidueProperties; -import jalview.structure.StructureListener; -import jalview.structure.StructureMapping; -import jalview.structure.StructureSelectionManager; - -import java.awt.Color; -import java.awt.Container; -import java.awt.event.ComponentEvent; -import java.awt.event.ComponentListener; -import java.io.File; -import java.net.URL; -import java.security.AccessControlException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Map; -import java.util.Vector; - -import org.jmol.adapter.smarter.SmarterJmolAdapter; -import org.jmol.api.JmolAppConsoleInterface; -import org.jmol.api.JmolSelectionListener; -import org.jmol.api.JmolStatusListener; -import org.jmol.api.JmolViewer; -import org.jmol.constant.EnumCallback; -import org.jmol.popup.JmolPopup; - -public abstract class JalviewJmolBinding implements StructureListener, - JmolStatusListener, SequenceStructureBinding, - JmolSelectionListener, ComponentListener, - StructureSelectionManagerProvider - -{ - /** - * set if Jmol state is being restored from some source - instructs binding - * not to apply default display style when structure set is updated for first - * time. - */ - private boolean loadingFromArchive = false; - - /** - * state flag used to check if the Jmol viewer's paint method can be called - */ - private boolean finishedInit = false; - - public boolean isFinishedInit() - { - return finishedInit; - } - - public void setFinishedInit(boolean finishedInit) - { - this.finishedInit = finishedInit; - } - - boolean allChainsSelected = false; - - /** - * when true, try to search the associated datamodel for sequences that are - * associated with any unknown structures in the Jmol view. - */ - private boolean associateNewStructs = false; - - Vector atomsPicked = new Vector(); - - public Vector chainNames; - - Hashtable chainFile; - - /** - * array of target chains for seuqences - tied to pdbentry and sequence[] - */ - protected String[][] chains; - - boolean colourBySequence = true; - - StringBuffer eval = new StringBuffer(); - - public String fileLoadingError; - - /** - * the default or current model displayed if the model cannot be identified - * from the selection message - */ - int frameNo = 0; - - protected JmolPopup jmolpopup; - - String lastCommand; - - String lastMessage; - - boolean loadedInline; - - /** - * current set of model filenames loaded in the Jmol instance - */ - String[] modelFileNames = null; - - public PDBEntry[] pdbentry; - - /** - * datasource protocol for access to PDBEntrylatest - */ - String protocol = null; - - StringBuffer resetLastRes = new StringBuffer(); - - /** - * sequences mapped to each pdbentry - */ - public SequenceI[][] sequence; - - public StructureSelectionManager ssm; - - public JmolViewer viewer; - - public JalviewJmolBinding(StructureSelectionManager ssm, - PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, - String protocol) - { - this.ssm = ssm; - this.sequence = sequenceIs; - this.chains = chains; - this.pdbentry = pdbentry; - this.protocol = protocol; - if (chains == null) - { - this.chains = new String[pdbentry.length][]; - } - /* - * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(), - * "jalviewJmol", ap.av.applet .getDocumentBase(), - * ap.av.applet.getCodeBase(), "", this); - * - * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true); - */ - } - - public JalviewJmolBinding(StructureSelectionManager ssm, - JmolViewer viewer2) - { - this.ssm = ssm; - viewer = viewer2; - viewer.setJmolStatusListener(this); - viewer.addSelectionListener(this); - } - - /** - * construct a title string for the viewer window based on the data jalview - * knows about - * - * @return - */ - public String getViewerTitle() - { - if (sequence == null || pdbentry == null || sequence.length < 1 - || pdbentry.length < 1 || sequence[0].length < 1) - { - return ("Jalview Jmol Window"); - } - // TODO: give a more informative title when multiple structures are - // displayed. - StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":" - + pdbentry[0].getId()); - - if (pdbentry[0].getProperty() != null) - { - if (pdbentry[0].getProperty().get("method") != null) - { - title.append(" Method: "); - title.append(pdbentry[0].getProperty().get("method")); - } - if (pdbentry[0].getProperty().get("chains") != null) - { - title.append(" Chain:"); - title.append(pdbentry[0].getProperty().get("chains")); - } - } - return title.toString(); - } - - /** - * prepare the view for a given set of models/chains. chainList contains - * strings of the form 'pdbfilename:Chaincode' - * - * @param chainList - * list of chains to make visible - */ - public void centerViewer(Vector chainList) - { - StringBuffer cmd = new StringBuffer(); - String lbl; - int mlength, p; - for (int i = 0, iSize = chainList.size(); i < iSize; i++) - { - mlength = 0; - lbl = (String) chainList.elementAt(i); - do - { - p = mlength; - mlength = lbl.indexOf(":", p); - } while (p < mlength && mlength < (lbl.length() - 2)); - // TODO: lookup each pdb id and recover proper model number for it. - cmd.append(":" + lbl.substring(mlength + 1) + " /" - + (1 + getModelNum((String) chainFile.get(lbl))) + " or "); - } - if (cmd.length() > 0) - cmd.setLength(cmd.length() - 4); - evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd); - } - - public void closeViewer() - { - viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE); - // remove listeners for all structures in viewer - ssm.removeStructureViewerListener(this, this.getPdbFile()); - // and shut down jmol - viewer.evalStringQuiet("zap"); - viewer.setJmolStatusListener(null); - lastCommand = null; - viewer = null; - releaseUIResources(); - } - - /** - * called by JalviewJmolbinding after closeViewer is called - release any - * resources and references so they can be garbage collected. - */ - protected abstract void releaseUIResources(); - - public void colourByChain() - { - colourBySequence = false; - // TODO: colour by chain should colour each chain distinctly across all - // visible models - // TODO: http://issues.jalview.org/browse/JAL-628 - evalStateCommand("select *;color chain"); - } - - public void colourByCharge() - { - colourBySequence = false; - evalStateCommand("select *;color white;select ASP,GLU;color red;" - + "select LYS,ARG;color blue;select CYS;color yellow"); - } - - /** - * superpose the structures associated with sequences in the alignment - * according to their corresponding positions. - */ - public void superposeStructures(AlignmentI alignment) - { - superposeStructures(alignment, -1, null); - } - - /** - * superpose the structures associated with sequences in the alignment - * according to their corresponding positions. ded) - * - * @param refStructure - * - select which pdb file to use as reference (default is -1 - the - * first structure in the alignment) - */ - public void superposeStructures(AlignmentI alignment, int refStructure) - { - superposeStructures(alignment, refStructure, null); - } - - /** - * superpose the structures associated with sequences in the alignment - * according to their corresponding positions. ded) - * - * @param refStructure - * - select which pdb file to use as reference (default is -1 - the - * first structure in the alignment) - * @param hiddenCols - * TODO - */ - public void superposeStructures(AlignmentI alignment, int refStructure, - ColumnSelection hiddenCols) - { - superposeStructures(new AlignmentI[] - { alignment }, new int[] - { refStructure }, new ColumnSelection[] - { hiddenCols }); - } - - public void superposeStructures(AlignmentI[] _alignment, - int[] _refStructure, ColumnSelection[] _hiddenCols) - { - String[] files = getPdbFile(); - StringBuffer selectioncom = new StringBuffer(); - assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length); - // union of all aligned positions are collected together. - for (int a = 0; a < _alignment.length; a++) - { - int refStructure = _refStructure[a]; - AlignmentI alignment = _alignment[a]; - ColumnSelection hiddenCols = _hiddenCols[a]; - if (a > 0 - && selectioncom.length() > 0 - && !selectioncom.substring(selectioncom.length() - 1).equals( - "|")) - { - selectioncom.append("|"); - } - // process this alignment - if (refStructure >= files.length) - { - System.err.println("Invalid reference structure value " - + refStructure); - refStructure = -1; - } - if (refStructure < -1) - { - refStructure = -1; - } - StringBuffer command = new StringBuffer(); - - boolean matched[] = new boolean[alignment.getWidth()]; - for (int m = 0; m < matched.length; m++) - { - - matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true; - } - - int commonrpositions[][] = new int[files.length][alignment.getWidth()]; - String isel[] = new String[files.length]; - // reference structure - all others are superposed in it - String[] targetC = new String[files.length]; - String[] chainNames = new String[files.length]; - for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) - { - StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); - // RACE CONDITION - getMapping only returns Jmol loaded filenames once - // Jmol callback has completed. - if (mapping == null || mapping.length < 1) - continue; - - int lastPos = -1; - for (int s = 0; s < sequence[pdbfnum].length; s++) - { - for (int sp, m = 0; m < mapping.length; m++) - { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) - { - if (refStructure == -1) - { - refStructure = pdbfnum; - } - SequenceI asp = alignment.getSequenceAt(sp); - for (int r = 0; r < matched.length; r++) - { - if (!matched[r]) - { - continue; - } - matched[r] = false; // assume this is not a good site - if (r >= asp.getLength()) - { - continue; - } - - if (jalview.util.Comparison.isGap(asp.getCharAt(r))) - { - // no mapping to gaps in sequence - continue; - } - int t = asp.findPosition(r); // sequence position - int apos = mapping[m].getAtomNum(t); - int pos = mapping[m].getPDBResNum(t); - - if (pos < 1 || pos == lastPos) - { - // can't align unmapped sequence - continue; - } - matched[r] = true; // this is a good ite - lastPos = pos; - // just record this residue position - commonrpositions[pdbfnum][r] = pos; - } - // create model selection suffix - isel[pdbfnum] = "/" + (pdbfnum + 1) + ".1"; - if (mapping[m].getChain() == null - || mapping[m].getChain().trim().length() == 0) - { - targetC[pdbfnum] = ""; - } - else - { - targetC[pdbfnum] = ":" + mapping[m].getChain(); - } - chainNames[pdbfnum] = mapping[m].getPdbId() - + targetC[pdbfnum]; - // move on to next pdb file - s = sequence[pdbfnum].length; - break; - } - } - } - } - String[] selcom = new String[files.length]; - int nmatched = 0; - // generate select statements to select regions to superimpose structures - { - for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) - { - String chainCd = targetC[pdbfnum]; - int lpos = -1; - boolean run = false; - StringBuffer molsel = new StringBuffer(); - molsel.append("{"); - for (int r = 0; r < matched.length; r++) - { - if (matched[r]) - { - if (pdbfnum == 0) - { - nmatched++; - } - if (lpos != commonrpositions[pdbfnum][r] - 1) - { - // discontinuity - if (lpos != -1) - { - molsel.append(lpos); - molsel.append(chainCd); - // molsel.append("} {"); - molsel.append("|"); - } - } - else - { - // continuous run - and lpos >-1 - if (!run) - { - // at the beginning, so add dash - molsel.append(lpos); - molsel.append("-"); - } - run = true; - } - lpos = commonrpositions[pdbfnum][r]; - // molsel.append(lpos); - } - } - // add final selection phrase - if (lpos != -1) - { - molsel.append(lpos); - molsel.append(chainCd); - molsel.append("}"); - } - selcom[pdbfnum] = molsel.toString(); - selectioncom.append("(("); - selectioncom.append(selcom[pdbfnum].substring(1, - selcom[pdbfnum].length() - 1)); - selectioncom.append(" )& "); - selectioncom.append(pdbfnum + 1); - selectioncom.append(".1)"); - if (pdbfnum < files.length - 1) - { - selectioncom.append("|"); - } - } - } - // TODO: consider bailing if nmatched less than 4 because superposition - // not - // well defined. - // TODO: refactor superposable position search (above) from jmol selection - // construction (below) - for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) - { - if (pdbfnum == refStructure) - { - continue; - } - command.append("echo "); - command.append("\"Superposing ("); - command.append(chainNames[pdbfnum]); - command.append(") against reference ("); - command.append(chainNames[refStructure]); - command.append(")\";\ncompare "); - command.append("{"); - command.append(1 + pdbfnum); - command.append(".1} {"); - command.append(1 + refStructure); - command.append(".1} SUBSET {*.CA | *.P} ATOMS "); - - // form the matched pair strings - String sep = ""; - for (int s = 0; s < 2; s++) - { - command.append(selcom[(s == 0 ? pdbfnum : refStructure)]); - } - command.append(" ROTATE TRANSLATE;\n"); - } - System.out.println("Select regions:\n" + selectioncom.toString()); - evalStateCommand("select *; cartoons off; backbone; select (" - + selectioncom.toString() + "); cartoons; "); - // selcom.append("; ribbons; "); - System.out.println("Superimpose command(s):\n" + command.toString()); - - evalStateCommand(command.toString()); - } - if (selectioncom.length() > 0) - {// finally, mark all regions that were superposed. - if (selectioncom.substring(selectioncom.length() - 1).equals("|")) - { - selectioncom.setLength(selectioncom.length() - 1); - } - System.out.println("Select regions:\n" + selectioncom.toString()); - evalStateCommand("select *; cartoons off; backbone; select (" - + selectioncom.toString() + "); cartoons; "); - // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString()); - } - } - - public void evalStateCommand(String command) - { - jmolHistory(false); - if (lastCommand == null || !lastCommand.equals(command)) - { - viewer.evalStringQuiet(command + "\n"); - } - jmolHistory(true); - lastCommand = command; - } - - /** - * colour any structures associated with sequences in the given alignment - * using the getFeatureRenderer() and getSequenceRenderer() renderers but only - * if colourBySequence is enabled. - */ - public void colourBySequence(boolean showFeatures, - jalview.api.AlignmentViewPanel alignmentv) - { - if (!colourBySequence) - return; - if (ssm == null) - { - return; - } - String[] files = getPdbFile(); - - SequenceRenderer sr = getSequenceRenderer(alignmentv); - - FeatureRenderer fr = null; - if (showFeatures) - { - fr = getFeatureRenderer(alignmentv); - } - AlignmentI alignment = alignmentv.getAlignment(); - - for (jalview.structure.StructureMappingcommandSet cpdbbyseq : JmolCommands - .getColourBySequenceCommand(ssm, files, sequence, sr, fr, - alignment)) - for (String cbyseq : cpdbbyseq.commands) - { - evalStateCommand(cbyseq); - } - } - - public boolean isColourBySequence() - { - return colourBySequence; - } - - public void setColourBySequence(boolean colourBySequence) - { - this.colourBySequence = colourBySequence; - } - - public void createImage(String file, String type, int quality) - { - System.out.println("JMOL CREATE IMAGE"); - } - - public String createImage(String fileName, String type, - Object textOrBytes, int quality) - { - System.out.println("JMOL CREATE IMAGE"); - return null; - } - - public String eval(String strEval) - { - // System.out.println(strEval); - // "# 'eval' is implemented only for the applet."; - return null; - } - - // End StructureListener - // ////////////////////////// - - public float[][] functionXY(String functionName, int x, int y) - { - return null; - } - - public float[][][] functionXYZ(String functionName, int nx, int ny, int nz) - { - // TODO Auto-generated method stub - return null; - } - - public Color getColour(int atomIndex, int pdbResNum, String chain, - String pdbfile) - { - if (getModelNum(pdbfile) < 0) - return null; - // TODO: verify atomIndex is selecting correct model. - return new Color(viewer.getAtomArgb(atomIndex)); - } - - /** - * returns the current featureRenderer that should be used to colour the - * structures - * - * @param alignment - * - * @return - */ - public abstract FeatureRenderer getFeatureRenderer( - AlignmentViewPanel alignment); - - /** - * instruct the Jalview binding to update the pdbentries vector if necessary - * prior to matching the jmol view's contents to the list of structure files - * Jalview knows about. - */ - public abstract void refreshPdbEntries(); - - private int getModelNum(String modelFileName) - { - String[] mfn = getPdbFile(); - if (mfn == null) - { - return -1; - } - for (int i = 0; i < mfn.length; i++) - { - if (mfn[i].equalsIgnoreCase(modelFileName)) - return i; - } - return -1; - } - - /** - * map between index of model filename returned from getPdbFile and the first - * index of models from this file in the viewer. Note - this is not trimmed - - * use getPdbFile to get number of unique models. - */ - private int _modelFileNameMap[]; - - // //////////////////////////////// - // /StructureListener - public synchronized String[] getPdbFile() - { - if (viewer == null) - { - return new String[0]; - } - if (modelFileNames == null) - { - - String mset[] = new String[viewer.getModelCount()]; - _modelFileNameMap = new int[mset.length]; - int j = 1; - String m = viewer.getModelFileName(0); - if (m != null) - { - try - { - mset[0] = new File(m).getAbsolutePath(); - } catch (AccessControlException x) - { - // usually not allowed to do this in applet, so keep raw handle - mset[0] = m; - // System.err.println("jmolBinding: Using local file string from Jmol: "+m); - } - } - for (int i = 1; i < mset.length; i++) - { - m = viewer.getModelFileName(i); - if (m != null) - { - try - { - mset[j] = new File(m).getAbsolutePath(); - } catch (AccessControlException x) - { - // usually not allowed to do this in applet, so keep raw handle - mset[j] = m; - // System.err.println("jmolBinding: Using local file string from Jmol: "+m); - } - } - _modelFileNameMap[j] = i; // record the model index for the filename - // skip any additional models in the same file (NMR structures) - if ((mset[j] == null ? mset[j] != mset[j - 1] - : (mset[j - 1] == null || !mset[j].equals(mset[j - 1])))) - { - j++; - } - } - modelFileNames = new String[j]; - System.arraycopy(mset, 0, modelFileNames, 0, j); - } - return modelFileNames; - } - - /** - * map from string to applet - */ - public Map getRegistryInfo() - { - // TODO Auto-generated method stub - return null; - } - - /** - * returns the current sequenceRenderer that should be used to colour the - * structures - * - * @param alignment - * - * @return - */ - public abstract SequenceRenderer getSequenceRenderer( - AlignmentViewPanel alignment); - - // /////////////////////////////// - // JmolStatusListener - - public void handlePopupMenu(int x, int y) - { - jmolpopup.show(x, y); - } - - // jmol/ssm only - public void highlightAtom(int atomIndex, int pdbResNum, String chain, - String pdbfile) - { - if (modelFileNames == null) - { - return; - } - - // look up file model number for this pdbfile - int mdlNum = 0; - String fn; - // may need to adjust for URLencoding here - we don't worry about that yet. - while (mdlNum < modelFileNames.length - && !pdbfile.equals(modelFileNames[mdlNum])) - { - // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn); - mdlNum++; - } - if (mdlNum == modelFileNames.length) - { - return; - } - - jmolHistory(false); - // if (!pdbfile.equals(pdbentry.getFile())) - // return; - if (resetLastRes.length() > 0) - { - viewer.evalStringQuiet(resetLastRes.toString()); - } - - eval.setLength(0); - eval.append("select " + pdbResNum); // +modelNum - - resetLastRes.setLength(0); - resetLastRes.append("select " + pdbResNum); // +modelNum - - eval.append(":"); - resetLastRes.append(":"); - if (!chain.equals(" ")) - { - eval.append(chain); - resetLastRes.append(chain); - } - { - eval.append(" /" + (mdlNum + 1)); - resetLastRes.append("/" + (mdlNum + 1)); - } - eval.append(";wireframe 100;" + eval.toString() + " and not hetero;"); - - resetLastRes.append(";wireframe 0;" + resetLastRes.toString() - + " and not hetero; spacefill 0;"); - - eval.append("spacefill 200;select none"); - - viewer.evalStringQuiet(eval.toString()); - jmolHistory(true); - - } - - boolean debug = true; - - private void jmolHistory(boolean enable) - { - viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off")); - } - - public void loadInline(String string) - { - loadedInline = true; - // TODO: re JAL-623 - // viewer.loadInline(strModel, isAppend); - // could do this: - // construct fake fullPathName and fileName so we can identify the file - // later. - // Then, construct pass a reader for the string to Jmol. - // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName, - // fileName, null, reader, false, null, null, 0); - viewer.openStringInline(string); - } - - public void mouseOverStructure(int atomIndex, String strInfo) - { - int pdbResNum; - int alocsep = strInfo.indexOf("^"); - int mdlSep = strInfo.indexOf("/"); - int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1; - - if (chainSeparator == -1) - { - chainSeparator = strInfo.indexOf("."); - if (mdlSep > -1 && mdlSep < chainSeparator) - { - chainSeparator1 = chainSeparator; - chainSeparator = mdlSep; - } - } - // handle insertion codes - if (alocsep != -1) - { - pdbResNum = Integer.parseInt(strInfo.substring( - strInfo.indexOf("]") + 1, alocsep)); - - } - else - { - pdbResNum = Integer.parseInt(strInfo.substring( - strInfo.indexOf("]") + 1, chainSeparator)); - } - String chainId; - - if (strInfo.indexOf(":") > -1) - chainId = strInfo.substring(strInfo.indexOf(":") + 1, - strInfo.indexOf(".")); - else - { - chainId = " "; - } - - String pdbfilename = modelFileNames[frameNo]; // default is first or current - // model - if (mdlSep > -1) - { - if (chainSeparator1 == -1) - { - chainSeparator1 = strInfo.indexOf(".", mdlSep); - } - String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1, - chainSeparator1) : strInfo.substring(mdlSep + 1); - try - { - // recover PDB filename for the model hovered over. - int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId) - .intValue() - 1; - while (mnumber < _modelFileNameMap[_mp]) - { - _mp--; - } - pdbfilename = modelFileNames[_mp]; - if (pdbfilename == null) - { - pdbfilename = new File(viewer.getModelFileName(mnumber)) - .getAbsolutePath(); - } - - } catch (Exception e) - { - } - ; - } - if (lastMessage == null || !lastMessage.equals(strInfo)) - ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename); - - lastMessage = strInfo; - } - - public void notifyAtomHovered(int atomIndex, String strInfo, String data) - { - if (data != null) - { - System.err.println("Ignoring additional hover info: " + data - + " (other info: '" + strInfo + "' pos " + atomIndex + ")"); - } - mouseOverStructure(atomIndex, strInfo); - } - - /* - * { if (history != null && strStatus != null && - * !strStatus.equals("Script completed")) { history.append("\n" + strStatus); - * } } - */ - - public void notifyAtomPicked(int atomIndex, String strInfo, String strData) - { - /** - * this implements the toggle label behaviour copied from the original - * structure viewer, MCView - */ - if (strData != null) - { - System.err.println("Ignoring additional pick data string " + strData); - } - int chainSeparator = strInfo.indexOf(":"); - int p = 0; - if (chainSeparator == -1) - chainSeparator = strInfo.indexOf("."); - - String picked = strInfo.substring(strInfo.indexOf("]") + 1, - chainSeparator); - String mdlString = ""; - if ((p = strInfo.indexOf(":")) > -1) - picked += strInfo.substring(p + 1, strInfo.indexOf(".")); - - if ((p = strInfo.indexOf("/")) > -1) - { - mdlString += strInfo.substring(p, strInfo.indexOf(" #")); - } - picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P" - + mdlString + "))"; - jmolHistory(false); - - if (!atomsPicked.contains(picked)) - { - viewer.evalStringQuiet("select " + picked + ";label %n %r:%c"); - atomsPicked.addElement(picked); - } - else - { - viewer.evalString("select " + picked + ";label off"); - atomsPicked.removeElement(picked); - } - jmolHistory(true); - // TODO: in application this happens - // - // if (scriptWindow != null) - // { - // scriptWindow.sendConsoleMessage(strInfo); - // scriptWindow.sendConsoleMessage("\n"); - // } - - } - - @Override - public void notifyCallback(EnumCallback type, Object[] data) - { - try - { - switch (type) - { - case LOADSTRUCT: - notifyFileLoaded((String) data[1], (String) data[2], - (String) data[3], (String) data[4], - ((Integer) data[5]).intValue()); - - break; - case PICK: - notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1], - (String) data[0]); - // also highlight in alignment - case HOVER: - notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1], - (String) data[0]); - break; - case SCRIPT: - notifyScriptTermination((String) data[2], - ((Integer) data[3]).intValue()); - break; - case ECHO: - sendConsoleEcho((String) data[1]); - break; - case MESSAGE: - sendConsoleMessage((data == null) ? ((String) null) - : (String) data[1]); - break; - case ERROR: - // System.err.println("Ignoring error callback."); - break; - case SYNC: - case RESIZE: - refreshGUI(); - break; - case MEASURE: - - case CLICK: - default: - System.err.println("Unhandled callback " + type + " " - + data[1].toString()); - break; - } - } catch (Exception e) - { - System.err.println("Squashed Jmol callback handler error:"); - e.printStackTrace(); - } - } - - @Override - public boolean notifyEnabled(EnumCallback callbackPick) - { - switch (callbackPick) - { - case ECHO: - case LOADSTRUCT: - case MEASURE: - case MESSAGE: - case PICK: - case SCRIPT: - case HOVER: - case ERROR: - return true; - case RESIZE: - case SYNC: - case CLICK: - case ANIMFRAME: - case MINIMIZATION: - } - return false; - } - - // incremented every time a load notification is successfully handled - - // lightweight mechanism for other threads to detect when they can start - // referrring to new structures. - private long loadNotifiesHandled = 0; - - public long getLoadNotifiesHandled() - { - return loadNotifiesHandled; - } - - public void notifyFileLoaded(String fullPathName, String fileName2, - String modelName, String errorMsg, int modelParts) - { - if (errorMsg != null) - { - fileLoadingError = errorMsg; - refreshGUI(); - return; - } - // TODO: deal sensibly with models loaded inLine: - // modelName will be null, as will fullPathName. - - // the rest of this routine ignores the arguments, and simply interrogates - // the Jmol view to find out what structures it contains, and adds them to - // the structure selection manager. - fileLoadingError = null; - String[] oldmodels = modelFileNames; - modelFileNames = null; - chainNames = new Vector(); - chainFile = new Hashtable(); - boolean notifyLoaded = false; - String[] modelfilenames = getPdbFile(); - // first check if we've lost any structures - if (oldmodels != null && oldmodels.length > 0) - { - int oldm = 0; - for (int i = 0; i < oldmodels.length; i++) - { - for (int n = 0; n < modelfilenames.length; n++) - { - if (modelfilenames[n] == oldmodels[i]) - { - oldmodels[i] = null; - break; - } - } - if (oldmodels[i] != null) - { - oldm++; - } - } - if (oldm > 0) - { - String[] oldmfn = new String[oldm]; - oldm = 0; - for (int i = 0; i < oldmodels.length; i++) - { - if (oldmodels[i] != null) - { - oldmfn[oldm++] = oldmodels[i]; - } - } - // deregister the Jmol instance for these structures - we'll add - // ourselves again at the end for the current structure set. - ssm.removeStructureViewerListener(this, oldmfn); - } - } - refreshPdbEntries(); - for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++) - { - String fileName = modelfilenames[modelnum]; - boolean foundEntry = false; - MCview.PDBfile pdb = null; - String pdbfile = null, pdbfhash = null; - // model was probably loaded inline - so check the pdb file hashcode - if (loadedInline) - { - // calculate essential attributes for the pdb data imported inline. - // prolly need to resolve modelnumber properly - for now just use our - // 'best guess' - pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum]) - + ".0", "PDB"); - pdbfhash = "" + pdbfile.hashCode(); - } - if (pdbentry != null) - { - // search pdbentries and sequences to find correct pdbentry for this - // model - for (int pe = 0; pe < pdbentry.length; pe++) - { - boolean matches = false; - if (fileName == null) - { - if (false) - // see JAL-623 - need method of matching pasted data up - { - pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile, - AppletFormatAdapter.PASTE); - pdbentry[modelnum].setFile("INLINE" + pdb.id); - matches = true; - foundEntry = true; - } - } - else - { - File fl; - if (matches = (fl = new File(pdbentry[pe].getFile())) - .equals(new File(fileName))) - { - foundEntry = true; - // TODO: Jmol can in principle retrieve from CLASSLOADER but - // this - // needs - // to be tested. See mantis bug - // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 - String protocol = AppletFormatAdapter.URL; - try - { - if (fl.exists()) - { - protocol = AppletFormatAdapter.FILE; - } - } catch (Exception e) - { - } catch (Error e) - { - } - // Explicitly map to the filename used by Jmol ; - pdb = ssm.setMapping(sequence[pe], chains[pe], fileName, - protocol); - // pdbentry[pe].getFile(), protocol); - - } - } - if (matches) - { - // add an entry for every chain in the model - for (int i = 0; i < pdb.chains.size(); i++) - { - String chid = new String(pdb.id + ":" - + ((MCview.PDBChain) pdb.chains.elementAt(i)).id); - chainFile.put(chid, fileName); - chainNames.addElement(chid); - } - notifyLoaded = true; - } - } - } - if (!foundEntry && associateNewStructs) - { - // this is a foreign pdb file that jalview doesn't know about - add - // it to the dataset and try to find a home - either on a matching - // sequence or as a new sequence. - String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1", - "PDB"); - // parse pdb file into a chain, etc. - // locate best match for pdb in associated views and add mapping to - // ssm - // if properly registered then - notifyLoaded = true; - - } - } - // FILE LOADED OK - // so finally, update the jmol bits and pieces - if (jmolpopup != null) - { - // potential for deadlock here: - // jmolpopup.updateComputedMenus(); - } - if (!isLoadingFromArchive()) - { - viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off"); - } - // register ourselves as a listener and notify the gui that it needs to - // update itself. - ssm.addStructureViewerListener(this); - if (notifyLoaded) - { - FeatureRenderer fr = getFeatureRenderer(null); - if (fr != null) - { - fr.featuresAdded(); - } - refreshGUI(); - loadNotifiesHandled++; - } - setLoadingFromArchive(false); - } - - public void notifyNewPickingModeMeasurement(int iatom, String strMeasure) - { - notifyAtomPicked(iatom, strMeasure, null); - } - - public abstract void notifyScriptTermination(String strStatus, - int msWalltime); - - /** - * display a message echoed from the jmol viewer - * - * @param strEcho - */ - public abstract void sendConsoleEcho(String strEcho); /* - * { showConsole(true); - * - * history.append("\n" + - * strEcho); } - */ - - // /End JmolStatusListener - // ///////////////////////////// - - /** - * @param strStatus - * status message - usually the response received after a script - * executed - */ - public abstract void sendConsoleMessage(String strStatus); - - public void setCallbackFunction(String callbackType, - String callbackFunction) - { - System.err.println("Ignoring set-callback request to associate " - + callbackType + " with function " + callbackFunction); - - } - - public void setJalviewColourScheme(ColourSchemeI cs) - { - colourBySequence = false; - - if (cs == null) - return; - - String res; - int index; - Color col; - jmolHistory(false); - // TODO: Switch between nucleotide or aa selection expressions - Enumeration en = ResidueProperties.aa3Hash.keys(); - StringBuffer command = new StringBuffer("select *;color white;"); - while (en.hasMoreElements()) - { - res = en.nextElement().toString(); - index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue(); - if (index > 20) - continue; - - col = cs.findColour(ResidueProperties.aa[index].charAt(0)); - - command.append("select " + res + ";color[" + col.getRed() + "," - + col.getGreen() + "," + col.getBlue() + "];"); - } - - evalStateCommand(command.toString()); - jmolHistory(true); - } - - public void showHelp() - { - showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp"); - } - - /** - * open the URL somehow - * - * @param target - */ - public abstract void showUrl(String url, String target); - - /** - * called when the binding thinks the UI needs to be refreshed after a Jmol - * state change. this could be because structures were loaded, or because an - * error has occured. - */ - public abstract void refreshGUI(); - - /** - * called to show or hide the associated console window container. - * - * @param show - */ - public abstract void showConsole(boolean show); - - /** - * @param renderPanel - * @param jmolfileio - * - when true will initialise jmol's file IO system (should be false - * in applet context) - * @param htmlName - * @param documentBase - * @param codeBase - * @param commandOptions - */ - public void allocateViewer(Container renderPanel, boolean jmolfileio, - String htmlName, URL documentBase, URL codeBase, - String commandOptions) - { - allocateViewer(renderPanel, jmolfileio, htmlName, documentBase, - codeBase, commandOptions, null, null); - } - - /** - * - * @param renderPanel - * @param jmolfileio - * - when true will initialise jmol's file IO system (should be false - * in applet context) - * @param htmlName - * @param documentBase - * @param codeBase - * @param commandOptions - * @param consolePanel - * - panel to contain Jmol console - * @param buttonsToShow - * - buttons to show on the console, in ordr - */ - public void allocateViewer(Container renderPanel, boolean jmolfileio, - String htmlName, URL documentBase, URL codeBase, - String commandOptions, final Container consolePanel, - String buttonsToShow) - { - if (commandOptions == null) - { - commandOptions = ""; - } - viewer = JmolViewer.allocateViewer(renderPanel, - (jmolfileio ? new SmarterJmolAdapter() : null), htmlName - + ((Object) this).toString(), documentBase, codeBase, - commandOptions, this); - - console = createJmolConsole(viewer, consolePanel, buttonsToShow); - if (consolePanel != null) - { - consolePanel.addComponentListener(this); - - } - - } - - protected abstract JmolAppConsoleInterface createJmolConsole( - JmolViewer viewer2, Container consolePanel, String buttonsToShow); - - protected org.jmol.api.JmolAppConsoleInterface console = null; - - public void componentResized(ComponentEvent e) - { - - } - - public void componentMoved(ComponentEvent e) - { - - } - - public void componentShown(ComponentEvent e) - { - showConsole(true); - } - - public void componentHidden(ComponentEvent e) - { - showConsole(false); - } - - public void setLoadingFromArchive(boolean loadingFromArchive) - { - this.loadingFromArchive = loadingFromArchive; - } - - public boolean isLoadingFromArchive() - { - return loadingFromArchive; - } - - public void setBackgroundColour(java.awt.Color col) - { - jmolHistory(false); - viewer.evalStringQuiet("background [" + col.getRed() + "," - + col.getGreen() + "," + col.getBlue() + "];"); - jmolHistory(true); - } - - /** - * add structures and any known sequence associations - * - * @returns the pdb entries added to the current set. - */ - public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe, - SequenceI[][] seq, String[][] chns) - { - int pe = -1; - Vector v = new Vector(); - Vector rtn = new Vector(); - for (int i = 0; i < pdbentry.length; i++) - { - v.addElement(pdbentry[i]); - } - for (int i = 0; i < pdbe.length; i++) - { - int r = v.indexOf(pdbe[i]); - if (r == -1 || r >= pdbentry.length) - { - rtn.addElement(new int[] - { v.size(), i }); - v.addElement(pdbe[i]); - } - else - { - // just make sure the sequence/chain entries are all up to date - addSequenceAndChain(r, seq[i], chns[i]); - } - } - pdbe = new PDBEntry[v.size()]; - v.copyInto(pdbe); - pdbentry = pdbe; - if (rtn.size() > 0) - { - // expand the tied seuqence[] and string[] arrays - SequenceI[][] sqs = new SequenceI[pdbentry.length][]; - String[][] sch = new String[pdbentry.length][]; - System.arraycopy(sequence, 0, sqs, 0, sequence.length); - System.arraycopy(chains, 0, sch, 0, this.chains.length); - sequence = sqs; - chains = sch; - pdbe = new PDBEntry[rtn.size()]; - for (int r = 0; r < pdbe.length; r++) - { - int[] stri = ((int[]) rtn.elementAt(r)); - // record the pdb file as a new addition - pdbe[r] = pdbentry[stri[0]]; - // and add the new sequence/chain entries - addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); - } - } - else - { - pdbe = null; - } - return pdbe; - } - - public void addSequence(int pe, SequenceI[] seq) - { - // add sequences to the pe'th pdbentry's seuqence set. - addSequenceAndChain(pe, seq, null); - } - - private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain) - { - if (pe < 0 || pe >= pdbentry.length) - { - throw new Error( - "Implementation error - no corresponding pdbentry (for index " - + pe + ") to add sequences mappings to"); - } - final String nullChain = "TheNullChain"; - Vector s = new Vector(); - Vector c = new Vector(); - if (chains == null) - { - chains = new String[pdbentry.length][]; - } - if (sequence[pe] != null) - { - for (int i = 0; i < sequence[pe].length; i++) - { - s.addElement(sequence[pe][i]); - if (chains[pe] != null) - { - if (i < chains[pe].length) - { - c.addElement(chains[pe][i]); - } - else - { - c.addElement(nullChain); - } - } - else - { - if (tchain != null && tchain.length > 0) - { - c.addElement(nullChain); - } - } - } - } - for (int i = 0; i < seq.length; i++) - { - if (!s.contains(seq[i])) - { - s.addElement(seq[i]); - if (tchain != null && i < tchain.length) - { - c.addElement(tchain[i] == null ? nullChain : tchain[i]); - } - } - } - SequenceI[] tmp = new SequenceI[s.size()]; - s.copyInto(tmp); - sequence[pe] = tmp; - if (c.size() > 0) - { - String[] tch = new String[c.size()]; - c.copyInto(tch); - for (int i = 0; i < tch.length; i++) - { - if (tch[i] == nullChain) - { - tch[i] = null; - } - } - chains[pe] = tch; - } - else - { - chains[pe] = null; - } - } - - /** - * - * @param pdbfile - * @return text report of alignment between pdbfile and any associated - * alignment sequences - */ - public String printMapping(String pdbfile) - { - return ssm.printMapping(pdbfile); - } - - @Override - public void resizeInnerPanel(String data) - { - // Jalview doesn't honour resize panel requests - - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.ext.jmol; + +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; +import jalview.api.SequenceRenderer; +import jalview.api.SequenceStructureBinding; +import jalview.api.StructureSelectionManagerProvider; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ResidueProperties; +import jalview.structure.StructureListener; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; + +import java.awt.Color; +import java.awt.Container; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.io.File; +import java.net.URL; +import java.security.AccessControlException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; + +import org.jmol.adapter.smarter.SmarterJmolAdapter; +import org.jmol.api.JmolAppConsoleInterface; +import org.jmol.api.JmolSelectionListener; +import org.jmol.api.JmolStatusListener; +import org.jmol.api.JmolViewer; +import org.jmol.constant.EnumCallback; +import org.jmol.popup.JmolPopup; + +public abstract class JalviewJmolBinding implements StructureListener, + JmolStatusListener, SequenceStructureBinding, + JmolSelectionListener, ComponentListener, + StructureSelectionManagerProvider + +{ + /** + * set if Jmol state is being restored from some source - instructs binding + * not to apply default display style when structure set is updated for first + * time. + */ + private boolean loadingFromArchive = false; + + /** + * state flag used to check if the Jmol viewer's paint method can be called + */ + private boolean finishedInit = false; + + public boolean isFinishedInit() + { + return finishedInit; + } + + public void setFinishedInit(boolean finishedInit) + { + this.finishedInit = finishedInit; + } + + boolean allChainsSelected = false; + + /** + * when true, try to search the associated datamodel for sequences that are + * associated with any unknown structures in the Jmol view. + */ + private boolean associateNewStructs = false; + + Vector atomsPicked = new Vector(); + + public Vector chainNames; + + Hashtable chainFile; + + /** + * array of target chains for seuqences - tied to pdbentry and sequence[] + */ + protected String[][] chains; + + boolean colourBySequence = true; + + StringBuffer eval = new StringBuffer(); + + public String fileLoadingError; + + /** + * the default or current model displayed if the model cannot be identified + * from the selection message + */ + int frameNo = 0; + + protected JmolPopup jmolpopup; + + String lastCommand; + + String lastMessage; + + boolean loadedInline; + + /** + * current set of model filenames loaded in the Jmol instance + */ + String[] modelFileNames = null; + + public PDBEntry[] pdbentry; + + /** + * datasource protocol for access to PDBEntrylatest + */ + String protocol = null; + + StringBuffer resetLastRes = new StringBuffer(); + + /** + * sequences mapped to each pdbentry + */ + public SequenceI[][] sequence; + + public StructureSelectionManager ssm; + + public JmolViewer viewer; + + public JalviewJmolBinding(StructureSelectionManager ssm, + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, + String protocol) + { + this.ssm = ssm; + this.sequence = sequenceIs; + this.chains = chains; + this.pdbentry = pdbentry; + this.protocol = protocol; + if (chains == null) + { + this.chains = new String[pdbentry.length][]; + } + /* + * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(), + * "jalviewJmol", ap.av.applet .getDocumentBase(), + * ap.av.applet.getCodeBase(), "", this); + * + * jmolpopup = JmolPopup.newJmolPopup(viewer, true, "Jmol", true); + */ + } + + public JalviewJmolBinding(StructureSelectionManager ssm, + JmolViewer viewer2) + { + this.ssm = ssm; + viewer = viewer2; + viewer.setJmolStatusListener(this); + viewer.addSelectionListener(this); + } + + /** + * construct a title string for the viewer window based on the data jalview + * knows about + * + * @return + */ + public String getViewerTitle() + { + if (sequence == null || pdbentry == null || sequence.length < 1 + || pdbentry.length < 1 || sequence[0].length < 1) + { + return ("Jalview Jmol Window"); + } + // TODO: give a more informative title when multiple structures are + // displayed. + StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":" + + pdbentry[0].getId()); + + if (pdbentry[0].getProperty() != null) + { + if (pdbentry[0].getProperty().get("method") != null) + { + title.append(" Method: "); + title.append(pdbentry[0].getProperty().get("method")); + } + if (pdbentry[0].getProperty().get("chains") != null) + { + title.append(" Chain:"); + title.append(pdbentry[0].getProperty().get("chains")); + } + } + return title.toString(); + } + + /** + * prepare the view for a given set of models/chains. chainList contains + * strings of the form 'pdbfilename:Chaincode' + * + * @param chainList + * list of chains to make visible + */ + public void centerViewer(Vector chainList) + { + StringBuffer cmd = new StringBuffer(); + String lbl; + int mlength, p; + for (int i = 0, iSize = chainList.size(); i < iSize; i++) + { + mlength = 0; + lbl = (String) chainList.elementAt(i); + do + { + p = mlength; + mlength = lbl.indexOf(":", p); + } while (p < mlength && mlength < (lbl.length() - 2)); + // TODO: lookup each pdb id and recover proper model number for it. + cmd.append(":" + lbl.substring(mlength + 1) + " /" + + (1 + getModelNum((String) chainFile.get(lbl))) + " or "); + } + if (cmd.length() > 0) + cmd.setLength(cmd.length() - 4); + evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd); + } + + public void closeViewer() + { + viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE); + // remove listeners for all structures in viewer + ssm.removeStructureViewerListener(this, this.getPdbFile()); + // and shut down jmol + viewer.evalStringQuiet("zap"); + viewer.setJmolStatusListener(null); + lastCommand = null; + viewer = null; + releaseUIResources(); + } + + /** + * called by JalviewJmolbinding after closeViewer is called - release any + * resources and references so they can be garbage collected. + */ + protected abstract void releaseUIResources(); + + public void colourByChain() + { + colourBySequence = false; + // TODO: colour by chain should colour each chain distinctly across all + // visible models + // TODO: http://issues.jalview.org/browse/JAL-628 + evalStateCommand("select *;color chain"); + } + + public void colourByCharge() + { + colourBySequence = false; + evalStateCommand("select *;color white;select ASP,GLU;color red;" + + "select LYS,ARG;color blue;select CYS;color yellow"); + } + + /** + * superpose the structures associated with sequences in the alignment + * according to their corresponding positions. + */ + public void superposeStructures(AlignmentI alignment) + { + superposeStructures(alignment, -1, null); + } + + /** + * superpose the structures associated with sequences in the alignment + * according to their corresponding positions. ded) + * + * @param refStructure + * - select which pdb file to use as reference (default is -1 - the + * first structure in the alignment) + */ + public void superposeStructures(AlignmentI alignment, int refStructure) + { + superposeStructures(alignment, refStructure, null); + } + + /** + * superpose the structures associated with sequences in the alignment + * according to their corresponding positions. ded) + * + * @param refStructure + * - select which pdb file to use as reference (default is -1 - the + * first structure in the alignment) + * @param hiddenCols + * TODO + */ + public void superposeStructures(AlignmentI alignment, int refStructure, + ColumnSelection hiddenCols) + { + superposeStructures(new AlignmentI[] + { alignment }, new int[] + { refStructure }, new ColumnSelection[] + { hiddenCols }); + } + + public void superposeStructures(AlignmentI[] _alignment, + int[] _refStructure, ColumnSelection[] _hiddenCols) + { + String[] files = getPdbFile(); + StringBuffer selectioncom = new StringBuffer(); + assert (_alignment.length == _refStructure.length && _alignment.length != _hiddenCols.length); + // union of all aligned positions are collected together. + for (int a = 0; a < _alignment.length; a++) + { + int refStructure = _refStructure[a]; + AlignmentI alignment = _alignment[a]; + ColumnSelection hiddenCols = _hiddenCols[a]; + if (a > 0 + && selectioncom.length() > 0 + && !selectioncom.substring(selectioncom.length() - 1).equals( + "|")) + { + selectioncom.append("|"); + } + // process this alignment + if (refStructure >= files.length) + { + System.err.println("Invalid reference structure value " + + refStructure); + refStructure = -1; + } + if (refStructure < -1) + { + refStructure = -1; + } + StringBuffer command = new StringBuffer(); + + boolean matched[] = new boolean[alignment.getWidth()]; + for (int m = 0; m < matched.length; m++) + { + + matched[m] = (hiddenCols != null) ? hiddenCols.isVisible(m) : true; + } + + int commonrpositions[][] = new int[files.length][alignment.getWidth()]; + String isel[] = new String[files.length]; + // reference structure - all others are superposed in it + String[] targetC = new String[files.length]; + String[] chainNames = new String[files.length]; + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) + { + StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + // RACE CONDITION - getMapping only returns Jmol loaded filenames once + // Jmol callback has completed. + if (mapping == null || mapping.length < 1) + continue; + + int lastPos = -1; + for (int s = 0; s < sequence[pdbfnum].length; s++) + { + for (int sp, m = 0; m < mapping.length; m++) + { + if (mapping[m].getSequence() == sequence[pdbfnum][s] + && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + { + if (refStructure == -1) + { + refStructure = pdbfnum; + } + SequenceI asp = alignment.getSequenceAt(sp); + for (int r = 0; r < matched.length; r++) + { + if (!matched[r]) + { + continue; + } + matched[r] = false; // assume this is not a good site + if (r >= asp.getLength()) + { + continue; + } + + if (jalview.util.Comparison.isGap(asp.getCharAt(r))) + { + // no mapping to gaps in sequence + continue; + } + int t = asp.findPosition(r); // sequence position + int apos = mapping[m].getAtomNum(t); + int pos = mapping[m].getPDBResNum(t); + + if (pos < 1 || pos == lastPos) + { + // can't align unmapped sequence + continue; + } + matched[r] = true; // this is a good ite + lastPos = pos; + // just record this residue position + commonrpositions[pdbfnum][r] = pos; + } + // create model selection suffix + isel[pdbfnum] = "/" + (pdbfnum + 1) + ".1"; + if (mapping[m].getChain() == null + || mapping[m].getChain().trim().length() == 0) + { + targetC[pdbfnum] = ""; + } + else + { + targetC[pdbfnum] = ":" + mapping[m].getChain(); + } + chainNames[pdbfnum] = mapping[m].getPdbId() + + targetC[pdbfnum]; + // move on to next pdb file + s = sequence[pdbfnum].length; + break; + } + } + } + } + String[] selcom = new String[files.length]; + int nmatched = 0; + // generate select statements to select regions to superimpose structures + { + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) + { + String chainCd = targetC[pdbfnum]; + int lpos = -1; + boolean run = false; + StringBuffer molsel = new StringBuffer(); + molsel.append("{"); + for (int r = 0; r < matched.length; r++) + { + if (matched[r]) + { + if (pdbfnum == 0) + { + nmatched++; + } + if (lpos != commonrpositions[pdbfnum][r] - 1) + { + // discontinuity + if (lpos != -1) + { + molsel.append(lpos); + molsel.append(chainCd); + // molsel.append("} {"); + molsel.append("|"); + } + } + else + { + // continuous run - and lpos >-1 + if (!run) + { + // at the beginning, so add dash + molsel.append(lpos); + molsel.append("-"); + } + run = true; + } + lpos = commonrpositions[pdbfnum][r]; + // molsel.append(lpos); + } + } + // add final selection phrase + if (lpos != -1) + { + molsel.append(lpos); + molsel.append(chainCd); + molsel.append("}"); + } + selcom[pdbfnum] = molsel.toString(); + selectioncom.append("(("); + selectioncom.append(selcom[pdbfnum].substring(1, + selcom[pdbfnum].length() - 1)); + selectioncom.append(" )& "); + selectioncom.append(pdbfnum + 1); + selectioncom.append(".1)"); + if (pdbfnum < files.length - 1) + { + selectioncom.append("|"); + } + } + } + // TODO: consider bailing if nmatched less than 4 because superposition + // not + // well defined. + // TODO: refactor superposable position search (above) from jmol selection + // construction (below) + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) + { + if (pdbfnum == refStructure) + { + continue; + } + command.append("echo "); + command.append("\"Superposing ("); + command.append(chainNames[pdbfnum]); + command.append(") against reference ("); + command.append(chainNames[refStructure]); + command.append(")\";\ncompare "); + command.append("{"); + command.append(1 + pdbfnum); + command.append(".1} {"); + command.append(1 + refStructure); + command.append(".1} SUBSET {*.CA | *.P} ATOMS "); + + // form the matched pair strings + String sep = ""; + for (int s = 0; s < 2; s++) + { + command.append(selcom[(s == 0 ? pdbfnum : refStructure)]); + } + command.append(" ROTATE TRANSLATE;\n"); + } + System.out.println("Select regions:\n" + selectioncom.toString()); + evalStateCommand("select *; cartoons off; backbone; select (" + + selectioncom.toString() + "); cartoons; "); + // selcom.append("; ribbons; "); + System.out.println("Superimpose command(s):\n" + command.toString()); + + evalStateCommand(command.toString()); + } + if (selectioncom.length() > 0) + {// finally, mark all regions that were superposed. + if (selectioncom.substring(selectioncom.length() - 1).equals("|")) + { + selectioncom.setLength(selectioncom.length() - 1); + } + System.out.println("Select regions:\n" + selectioncom.toString()); + evalStateCommand("select *; cartoons off; backbone; select (" + + selectioncom.toString() + "); cartoons; "); + // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString()); + } + } + + public void evalStateCommand(String command) + { + jmolHistory(false); + if (lastCommand == null || !lastCommand.equals(command)) + { + viewer.evalStringQuiet(command + "\n"); + } + jmolHistory(true); + lastCommand = command; + } + + /** + * colour any structures associated with sequences in the given alignment + * using the getFeatureRenderer() and getSequenceRenderer() renderers but only + * if colourBySequence is enabled. + */ + public void colourBySequence(boolean showFeatures, + jalview.api.AlignmentViewPanel alignmentv) + { + if (!colourBySequence) + return; + if (ssm == null) + { + return; + } + String[] files = getPdbFile(); + + SequenceRenderer sr = getSequenceRenderer(alignmentv); + + FeatureRenderer fr = null; + if (showFeatures) + { + fr = getFeatureRenderer(alignmentv); + } + AlignmentI alignment = alignmentv.getAlignment(); + + for (jalview.structure.StructureMappingcommandSet cpdbbyseq : JmolCommands + .getColourBySequenceCommand(ssm, files, sequence, sr, fr, + alignment)) + for (String cbyseq : cpdbbyseq.commands) + { + evalStateCommand(cbyseq); + } + } + + public boolean isColourBySequence() + { + return colourBySequence; + } + + public void setColourBySequence(boolean colourBySequence) + { + this.colourBySequence = colourBySequence; + } + + public void createImage(String file, String type, int quality) + { + System.out.println("JMOL CREATE IMAGE"); + } + + public String createImage(String fileName, String type, + Object textOrBytes, int quality) + { + System.out.println("JMOL CREATE IMAGE"); + return null; + } + + public String eval(String strEval) + { + // System.out.println(strEval); + // "# 'eval' is implemented only for the applet."; + return null; + } + + // End StructureListener + // ////////////////////////// + + public float[][] functionXY(String functionName, int x, int y) + { + return null; + } + + public float[][][] functionXYZ(String functionName, int nx, int ny, int nz) + { + // TODO Auto-generated method stub + return null; + } + + public Color getColour(int atomIndex, int pdbResNum, String chain, + String pdbfile) + { + if (getModelNum(pdbfile) < 0) + return null; + // TODO: verify atomIndex is selecting correct model. + return new Color(viewer.getAtomArgb(atomIndex)); + } + + /** + * returns the current featureRenderer that should be used to colour the + * structures + * + * @param alignment + * + * @return + */ + public abstract FeatureRenderer getFeatureRenderer( + AlignmentViewPanel alignment); + + /** + * instruct the Jalview binding to update the pdbentries vector if necessary + * prior to matching the jmol view's contents to the list of structure files + * Jalview knows about. + */ + public abstract void refreshPdbEntries(); + + private int getModelNum(String modelFileName) + { + String[] mfn = getPdbFile(); + if (mfn == null) + { + return -1; + } + for (int i = 0; i < mfn.length; i++) + { + if (mfn[i].equalsIgnoreCase(modelFileName)) + return i; + } + return -1; + } + + /** + * map between index of model filename returned from getPdbFile and the first + * index of models from this file in the viewer. Note - this is not trimmed - + * use getPdbFile to get number of unique models. + */ + private int _modelFileNameMap[]; + + // //////////////////////////////// + // /StructureListener + public synchronized String[] getPdbFile() + { + if (viewer == null) + { + return new String[0]; + } + if (modelFileNames == null) + { + + String mset[] = new String[viewer.getModelCount()]; + _modelFileNameMap = new int[mset.length]; + int j = 1; + String m = viewer.getModelFileName(0); + if (m != null) + { + try + { + mset[0] = new File(m).getAbsolutePath(); + } catch (AccessControlException x) + { + // usually not allowed to do this in applet, so keep raw handle + mset[0] = m; + // System.err.println("jmolBinding: Using local file string from Jmol: "+m); + } + } + for (int i = 1; i < mset.length; i++) + { + m = viewer.getModelFileName(i); + if (m != null) + { + try + { + mset[j] = new File(m).getAbsolutePath(); + } catch (AccessControlException x) + { + // usually not allowed to do this in applet, so keep raw handle + mset[j] = m; + // System.err.println("jmolBinding: Using local file string from Jmol: "+m); + } + } + _modelFileNameMap[j] = i; // record the model index for the filename + // skip any additional models in the same file (NMR structures) + if ((mset[j] == null ? mset[j] != mset[j - 1] + : (mset[j - 1] == null || !mset[j].equals(mset[j - 1])))) + { + j++; + } + } + modelFileNames = new String[j]; + System.arraycopy(mset, 0, modelFileNames, 0, j); + } + return modelFileNames; + } + + /** + * map from string to applet + */ + public Map getRegistryInfo() + { + // TODO Auto-generated method stub + return null; + } + + /** + * returns the current sequenceRenderer that should be used to colour the + * structures + * + * @param alignment + * + * @return + */ + public abstract SequenceRenderer getSequenceRenderer( + AlignmentViewPanel alignment); + + // /////////////////////////////// + // JmolStatusListener + + public void handlePopupMenu(int x, int y) + { + jmolpopup.show(x, y); + } + + // jmol/ssm only + public void highlightAtom(int atomIndex, int pdbResNum, String chain, + String pdbfile) + { + if (modelFileNames == null) + { + return; + } + + // look up file model number for this pdbfile + int mdlNum = 0; + String fn; + // may need to adjust for URLencoding here - we don't worry about that yet. + while (mdlNum < modelFileNames.length + && !pdbfile.equals(modelFileNames[mdlNum])) + { + // System.out.println("nomatch:"+pdbfile+"\nmodelfn:"+fn); + mdlNum++; + } + if (mdlNum == modelFileNames.length) + { + return; + } + + jmolHistory(false); + // if (!pdbfile.equals(pdbentry.getFile())) + // return; + if (resetLastRes.length() > 0) + { + viewer.evalStringQuiet(resetLastRes.toString()); + } + + eval.setLength(0); + eval.append("select " + pdbResNum); // +modelNum + + resetLastRes.setLength(0); + resetLastRes.append("select " + pdbResNum); // +modelNum + + eval.append(":"); + resetLastRes.append(":"); + if (!chain.equals(" ")) + { + eval.append(chain); + resetLastRes.append(chain); + } + { + eval.append(" /" + (mdlNum + 1)); + resetLastRes.append("/" + (mdlNum + 1)); + } + eval.append(";wireframe 100;" + eval.toString() + " and not hetero;"); + + resetLastRes.append(";wireframe 0;" + resetLastRes.toString() + + " and not hetero; spacefill 0;"); + + eval.append("spacefill 200;select none"); + + viewer.evalStringQuiet(eval.toString()); + jmolHistory(true); + + } + + boolean debug = true; + + private void jmolHistory(boolean enable) + { + viewer.evalStringQuiet("History " + ((debug || enable) ? "on" : "off")); + } + + public void loadInline(String string) + { + loadedInline = true; + // TODO: re JAL-623 + // viewer.loadInline(strModel, isAppend); + // could do this: + // construct fake fullPathName and fileName so we can identify the file + // later. + // Then, construct pass a reader for the string to Jmol. + // ((org.jmol.Viewer.Viewer) viewer).loadModelFromFile(fullPathName, + // fileName, null, reader, false, null, null, 0); + viewer.openStringInline(string); + } + + public void mouseOverStructure(int atomIndex, String strInfo) + { + int pdbResNum; + int alocsep = strInfo.indexOf("^"); + int mdlSep = strInfo.indexOf("/"); + int chainSeparator = strInfo.indexOf(":"), chainSeparator1 = -1; + + if (chainSeparator == -1) + { + chainSeparator = strInfo.indexOf("."); + if (mdlSep > -1 && mdlSep < chainSeparator) + { + chainSeparator1 = chainSeparator; + chainSeparator = mdlSep; + } + } + // handle insertion codes + if (alocsep != -1) + { + pdbResNum = Integer.parseInt(strInfo.substring( + strInfo.indexOf("]") + 1, alocsep)); + + } + else + { + pdbResNum = Integer.parseInt(strInfo.substring( + strInfo.indexOf("]") + 1, chainSeparator)); + } + String chainId; + + if (strInfo.indexOf(":") > -1) + chainId = strInfo.substring(strInfo.indexOf(":") + 1, + strInfo.indexOf(".")); + else + { + chainId = " "; + } + + String pdbfilename = modelFileNames[frameNo]; // default is first or current + // model + if (mdlSep > -1) + { + if (chainSeparator1 == -1) + { + chainSeparator1 = strInfo.indexOf(".", mdlSep); + } + String mdlId = (chainSeparator1 > -1) ? strInfo.substring(mdlSep + 1, + chainSeparator1) : strInfo.substring(mdlSep + 1); + try + { + // recover PDB filename for the model hovered over. + int _mp = _modelFileNameMap.length - 1, mnumber = new Integer(mdlId) + .intValue() - 1; + while (mnumber < _modelFileNameMap[_mp]) + { + _mp--; + } + pdbfilename = modelFileNames[_mp]; + if (pdbfilename == null) + { + pdbfilename = new File(viewer.getModelFileName(mnumber)) + .getAbsolutePath(); + } + + } catch (Exception e) + { + } + ; + } + if (lastMessage == null || !lastMessage.equals(strInfo)) + ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename); + + lastMessage = strInfo; + } + + public void notifyAtomHovered(int atomIndex, String strInfo, String data) + { + if (data != null) + { + System.err.println("Ignoring additional hover info: " + data + + " (other info: '" + strInfo + "' pos " + atomIndex + ")"); + } + mouseOverStructure(atomIndex, strInfo); + } + + /* + * { if (history != null && strStatus != null && + * !strStatus.equals("Script completed")) { history.append("\n" + strStatus); + * } } + */ + + public void notifyAtomPicked(int atomIndex, String strInfo, String strData) + { + /** + * this implements the toggle label behaviour copied from the original + * structure viewer, MCView + */ + if (strData != null) + { + System.err.println("Ignoring additional pick data string " + strData); + } + int chainSeparator = strInfo.indexOf(":"); + int p = 0; + if (chainSeparator == -1) + chainSeparator = strInfo.indexOf("."); + + String picked = strInfo.substring(strInfo.indexOf("]") + 1, + chainSeparator); + String mdlString = ""; + if ((p = strInfo.indexOf(":")) > -1) + picked += strInfo.substring(p + 1, strInfo.indexOf(".")); + + if ((p = strInfo.indexOf("/")) > -1) + { + mdlString += strInfo.substring(p, strInfo.indexOf(" #")); + } + picked = "((" + picked + ".CA" + mdlString + ")|(" + picked + ".P" + + mdlString + "))"; + jmolHistory(false); + + if (!atomsPicked.contains(picked)) + { + viewer.evalStringQuiet("select " + picked + ";label %n %r:%c"); + atomsPicked.addElement(picked); + } + else + { + viewer.evalString("select " + picked + ";label off"); + atomsPicked.removeElement(picked); + } + jmolHistory(true); + // TODO: in application this happens + // + // if (scriptWindow != null) + // { + // scriptWindow.sendConsoleMessage(strInfo); + // scriptWindow.sendConsoleMessage("\n"); + // } + + } + + @Override + public void notifyCallback(EnumCallback type, Object[] data) + { + try + { + switch (type) + { + case LOADSTRUCT: + notifyFileLoaded((String) data[1], (String) data[2], + (String) data[3], (String) data[4], + ((Integer) data[5]).intValue()); + + break; + case PICK: + notifyAtomPicked(((Integer) data[2]).intValue(), (String) data[1], + (String) data[0]); + // also highlight in alignment + case HOVER: + notifyAtomHovered(((Integer) data[2]).intValue(), (String) data[1], + (String) data[0]); + break; + case SCRIPT: + notifyScriptTermination((String) data[2], + ((Integer) data[3]).intValue()); + break; + case ECHO: + sendConsoleEcho((String) data[1]); + break; + case MESSAGE: + sendConsoleMessage((data == null) ? ((String) null) + : (String) data[1]); + break; + case ERROR: + // System.err.println("Ignoring error callback."); + break; + case SYNC: + case RESIZE: + refreshGUI(); + break; + case MEASURE: + + case CLICK: + default: + System.err.println("Unhandled callback " + type + " " + + data[1].toString()); + break; + } + } catch (Exception e) + { + System.err.println("Squashed Jmol callback handler error:"); + e.printStackTrace(); + } + } + + @Override + public boolean notifyEnabled(EnumCallback callbackPick) + { + switch (callbackPick) + { + case ECHO: + case LOADSTRUCT: + case MEASURE: + case MESSAGE: + case PICK: + case SCRIPT: + case HOVER: + case ERROR: + return true; + case RESIZE: + case SYNC: + case CLICK: + case ANIMFRAME: + case MINIMIZATION: + } + return false; + } + + // incremented every time a load notification is successfully handled - + // lightweight mechanism for other threads to detect when they can start + // referrring to new structures. + private long loadNotifiesHandled = 0; + + public long getLoadNotifiesHandled() + { + return loadNotifiesHandled; + } + + public void notifyFileLoaded(String fullPathName, String fileName2, + String modelName, String errorMsg, int modelParts) + { + if (errorMsg != null) + { + fileLoadingError = errorMsg; + refreshGUI(); + return; + } + // TODO: deal sensibly with models loaded inLine: + // modelName will be null, as will fullPathName. + + // the rest of this routine ignores the arguments, and simply interrogates + // the Jmol view to find out what structures it contains, and adds them to + // the structure selection manager. + fileLoadingError = null; + String[] oldmodels = modelFileNames; + modelFileNames = null; + chainNames = new Vector(); + chainFile = new Hashtable(); + boolean notifyLoaded = false; + String[] modelfilenames = getPdbFile(); + // first check if we've lost any structures + if (oldmodels != null && oldmodels.length > 0) + { + int oldm = 0; + for (int i = 0; i < oldmodels.length; i++) + { + for (int n = 0; n < modelfilenames.length; n++) + { + if (modelfilenames[n] == oldmodels[i]) + { + oldmodels[i] = null; + break; + } + } + if (oldmodels[i] != null) + { + oldm++; + } + } + if (oldm > 0) + { + String[] oldmfn = new String[oldm]; + oldm = 0; + for (int i = 0; i < oldmodels.length; i++) + { + if (oldmodels[i] != null) + { + oldmfn[oldm++] = oldmodels[i]; + } + } + // deregister the Jmol instance for these structures - we'll add + // ourselves again at the end for the current structure set. + ssm.removeStructureViewerListener(this, oldmfn); + } + } + refreshPdbEntries(); + for (int modelnum = 0; modelnum < modelfilenames.length; modelnum++) + { + String fileName = modelfilenames[modelnum]; + boolean foundEntry = false; + MCview.PDBfile pdb = null; + String pdbfile = null, pdbfhash = null; + // model was probably loaded inline - so check the pdb file hashcode + if (loadedInline) + { + // calculate essential attributes for the pdb data imported inline. + // prolly need to resolve modelnumber properly - for now just use our + // 'best guess' + pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum]) + + ".0", "PDB"); + pdbfhash = "" + pdbfile.hashCode(); + } + if (pdbentry != null) + { + // search pdbentries and sequences to find correct pdbentry for this + // model + for (int pe = 0; pe < pdbentry.length; pe++) + { + boolean matches = false; + if (fileName == null) + { + if (false) + // see JAL-623 - need method of matching pasted data up + { + pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile, + AppletFormatAdapter.PASTE); + pdbentry[modelnum].setFile("INLINE" + pdb.id); + matches = true; + foundEntry = true; + } + } + else + { + File fl; + if (matches = (fl = new File(pdbentry[pe].getFile())) + .equals(new File(fileName))) + { + foundEntry = true; + // TODO: Jmol can in principle retrieve from CLASSLOADER but + // this + // needs + // to be tested. See mantis bug + // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 + String protocol = AppletFormatAdapter.URL; + try + { + if (fl.exists()) + { + protocol = AppletFormatAdapter.FILE; + } + } catch (Exception e) + { + } catch (Error e) + { + } + // Explicitly map to the filename used by Jmol ; + pdb = ssm.setMapping(sequence[pe], chains[pe], fileName, + protocol); + // pdbentry[pe].getFile(), protocol); + + } + } + if (matches) + { + // add an entry for every chain in the model + for (int i = 0; i < pdb.chains.size(); i++) + { + String chid = new String(pdb.id + ":" + + ((MCview.PDBChain) pdb.chains.elementAt(i)).id); + chainFile.put(chid, fileName); + chainNames.addElement(chid); + } + notifyLoaded = true; + } + } + } + if (!foundEntry && associateNewStructs) + { + // this is a foreign pdb file that jalview doesn't know about - add + // it to the dataset and try to find a home - either on a matching + // sequence or as a new sequence. + String pdbcontent = viewer.getData("/" + (modelnum + 1) + ".1", + "PDB"); + // parse pdb file into a chain, etc. + // locate best match for pdb in associated views and add mapping to + // ssm + // if properly registered then + notifyLoaded = true; + + } + } + // FILE LOADED OK + // so finally, update the jmol bits and pieces + if (jmolpopup != null) + { + // potential for deadlock here: + // jmolpopup.updateComputedMenus(); + } + if (!isLoadingFromArchive()) + { + viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off"); + } + // register ourselves as a listener and notify the gui that it needs to + // update itself. + ssm.addStructureViewerListener(this); + if (notifyLoaded) + { + FeatureRenderer fr = getFeatureRenderer(null); + if (fr != null) + { + fr.featuresAdded(); + } + refreshGUI(); + loadNotifiesHandled++; + } + setLoadingFromArchive(false); + } + + public void notifyNewPickingModeMeasurement(int iatom, String strMeasure) + { + notifyAtomPicked(iatom, strMeasure, null); + } + + public abstract void notifyScriptTermination(String strStatus, + int msWalltime); + + /** + * display a message echoed from the jmol viewer + * + * @param strEcho + */ + public abstract void sendConsoleEcho(String strEcho); /* + * { showConsole(true); + * + * history.append("\n" + + * strEcho); } + */ + + // /End JmolStatusListener + // ///////////////////////////// + + /** + * @param strStatus + * status message - usually the response received after a script + * executed + */ + public abstract void sendConsoleMessage(String strStatus); + + public void setCallbackFunction(String callbackType, + String callbackFunction) + { + System.err.println("Ignoring set-callback request to associate " + + callbackType + " with function " + callbackFunction); + + } + + public void setJalviewColourScheme(ColourSchemeI cs) + { + colourBySequence = false; + + if (cs == null) + return; + + String res; + int index; + Color col; + jmolHistory(false); + // TODO: Switch between nucleotide or aa selection expressions + Enumeration en = ResidueProperties.aa3Hash.keys(); + StringBuffer command = new StringBuffer("select *;color white;"); + while (en.hasMoreElements()) + { + res = en.nextElement().toString(); + index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue(); + if (index > 20) + continue; + + col = cs.findColour(ResidueProperties.aa[index].charAt(0)); + + command.append("select " + res + ";color[" + col.getRed() + "," + + col.getGreen() + "," + col.getBlue() + "];"); + } + + evalStateCommand(command.toString()); + jmolHistory(true); + } + + public void showHelp() + { + showUrl("http://jmol.sourceforge.net/docs/JmolUserGuide/", "jmolHelp"); + } + + /** + * open the URL somehow + * + * @param target + */ + public abstract void showUrl(String url, String target); + + /** + * called when the binding thinks the UI needs to be refreshed after a Jmol + * state change. this could be because structures were loaded, or because an + * error has occured. + */ + public abstract void refreshGUI(); + + /** + * called to show or hide the associated console window container. + * + * @param show + */ + public abstract void showConsole(boolean show); + + /** + * @param renderPanel + * @param jmolfileio + * - when true will initialise jmol's file IO system (should be false + * in applet context) + * @param htmlName + * @param documentBase + * @param codeBase + * @param commandOptions + */ + public void allocateViewer(Container renderPanel, boolean jmolfileio, + String htmlName, URL documentBase, URL codeBase, + String commandOptions) + { + allocateViewer(renderPanel, jmolfileio, htmlName, documentBase, + codeBase, commandOptions, null, null); + } + + /** + * + * @param renderPanel + * @param jmolfileio + * - when true will initialise jmol's file IO system (should be false + * in applet context) + * @param htmlName + * @param documentBase + * @param codeBase + * @param commandOptions + * @param consolePanel + * - panel to contain Jmol console + * @param buttonsToShow + * - buttons to show on the console, in ordr + */ + public void allocateViewer(Container renderPanel, boolean jmolfileio, + String htmlName, URL documentBase, URL codeBase, + String commandOptions, final Container consolePanel, + String buttonsToShow) + { + if (commandOptions == null) + { + commandOptions = ""; + } + viewer = JmolViewer.allocateViewer(renderPanel, + (jmolfileio ? new SmarterJmolAdapter() : null), htmlName + + ((Object) this).toString(), documentBase, codeBase, + commandOptions, this); + + console = createJmolConsole(viewer, consolePanel, buttonsToShow); + if (consolePanel != null) + { + consolePanel.addComponentListener(this); + + } + + } + + protected abstract JmolAppConsoleInterface createJmolConsole( + JmolViewer viewer2, Container consolePanel, String buttonsToShow); + + protected org.jmol.api.JmolAppConsoleInterface console = null; + + public void componentResized(ComponentEvent e) + { + + } + + public void componentMoved(ComponentEvent e) + { + + } + + public void componentShown(ComponentEvent e) + { + showConsole(true); + } + + public void componentHidden(ComponentEvent e) + { + showConsole(false); + } + + public void setLoadingFromArchive(boolean loadingFromArchive) + { + this.loadingFromArchive = loadingFromArchive; + } + + public boolean isLoadingFromArchive() + { + return loadingFromArchive; + } + + public void setBackgroundColour(java.awt.Color col) + { + jmolHistory(false); + viewer.evalStringQuiet("background [" + col.getRed() + "," + + col.getGreen() + "," + col.getBlue() + "];"); + jmolHistory(true); + } + + /** + * add structures and any known sequence associations + * + * @returns the pdb entries added to the current set. + */ + public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe, + SequenceI[][] seq, String[][] chns) + { + int pe = -1; + Vector v = new Vector(); + Vector rtn = new Vector(); + for (int i = 0; i < pdbentry.length; i++) + { + v.addElement(pdbentry[i]); + } + for (int i = 0; i < pdbe.length; i++) + { + int r = v.indexOf(pdbe[i]); + if (r == -1 || r >= pdbentry.length) + { + rtn.addElement(new int[] + { v.size(), i }); + v.addElement(pdbe[i]); + } + else + { + // just make sure the sequence/chain entries are all up to date + addSequenceAndChain(r, seq[i], chns[i]); + } + } + pdbe = new PDBEntry[v.size()]; + v.copyInto(pdbe); + pdbentry = pdbe; + if (rtn.size() > 0) + { + // expand the tied seuqence[] and string[] arrays + SequenceI[][] sqs = new SequenceI[pdbentry.length][]; + String[][] sch = new String[pdbentry.length][]; + System.arraycopy(sequence, 0, sqs, 0, sequence.length); + System.arraycopy(chains, 0, sch, 0, this.chains.length); + sequence = sqs; + chains = sch; + pdbe = new PDBEntry[rtn.size()]; + for (int r = 0; r < pdbe.length; r++) + { + int[] stri = ((int[]) rtn.elementAt(r)); + // record the pdb file as a new addition + pdbe[r] = pdbentry[stri[0]]; + // and add the new sequence/chain entries + addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); + } + } + else + { + pdbe = null; + } + return pdbe; + } + + public void addSequence(int pe, SequenceI[] seq) + { + // add sequences to the pe'th pdbentry's seuqence set. + addSequenceAndChain(pe, seq, null); + } + + private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain) + { + if (pe < 0 || pe >= pdbentry.length) + { + throw new Error( + "Implementation error - no corresponding pdbentry (for index " + + pe + ") to add sequences mappings to"); + } + final String nullChain = "TheNullChain"; + Vector s = new Vector(); + Vector c = new Vector(); + if (chains == null) + { + chains = new String[pdbentry.length][]; + } + if (sequence[pe] != null) + { + for (int i = 0; i < sequence[pe].length; i++) + { + s.addElement(sequence[pe][i]); + if (chains[pe] != null) + { + if (i < chains[pe].length) + { + c.addElement(chains[pe][i]); + } + else + { + c.addElement(nullChain); + } + } + else + { + if (tchain != null && tchain.length > 0) + { + c.addElement(nullChain); + } + } + } + } + for (int i = 0; i < seq.length; i++) + { + if (!s.contains(seq[i])) + { + s.addElement(seq[i]); + if (tchain != null && i < tchain.length) + { + c.addElement(tchain[i] == null ? nullChain : tchain[i]); + } + } + } + SequenceI[] tmp = new SequenceI[s.size()]; + s.copyInto(tmp); + sequence[pe] = tmp; + if (c.size() > 0) + { + String[] tch = new String[c.size()]; + c.copyInto(tch); + for (int i = 0; i < tch.length; i++) + { + if (tch[i] == nullChain) + { + tch[i] = null; + } + } + chains[pe] = tch; + } + else + { + chains[pe] = null; + } + } + + /** + * + * @param pdbfile + * @return text report of alignment between pdbfile and any associated + * alignment sequences + */ + public String printMapping(String pdbfile) + { + return ssm.printMapping(pdbfile); + } + + @Override + public void resizeInnerPanel(String data) + { + // Jalview doesn't honour resize panel requests + + } +} diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index dd2bbfd..aa8cf0c 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -1,22 +1,19 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ -/** * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ package jalview.ext.jmol; diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java index 82ce978..003e6d7 100644 --- a/src/jalview/ext/varna/JalviewVarnaBinding.java +++ b/src/jalview/ext/varna/JalviewVarnaBinding.java @@ -1,56 +1,56 @@ -/* - * 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 . - */ -package jalview.ext.varna; - -import java.io.File; - -import java.net.URL; -import java.util.*; -import java.applet.Applet; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.JPanel; - -import jalview.api.AlignmentViewPanel; -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.api.SequenceStructureBinding; -import jalview.api.StructureSelectionManagerProvider; -import jalview.datamodel.*; -import jalview.structure.*; -import jalview.io.*; - -import org.jmol.api.*; -import org.jmol.adapter.smarter.SmarterJmolAdapter; - -import org.jmol.popup.*; -import org.jmol.viewer.JmolConstants; -import org.jmol.viewer.Viewer; - -import jalview.schemes.*; - -import fr.orsay.lri.varna.applications.*; - -public abstract class JalviewVarnaBinding implements StructureListener, - SequenceStructureBinding, ComponentListener, - StructureSelectionManagerProvider - -{ - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.ext.varna; + +import java.io.File; + +import java.net.URL; +import java.util.*; +import java.applet.Applet; +import java.awt.*; +import java.awt.event.*; + +import javax.swing.JPanel; + +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; +import jalview.api.SequenceRenderer; +import jalview.api.SequenceStructureBinding; +import jalview.api.StructureSelectionManagerProvider; +import jalview.datamodel.*; +import jalview.structure.*; +import jalview.io.*; + +import org.jmol.api.*; +import org.jmol.adapter.smarter.SmarterJmolAdapter; + +import org.jmol.popup.*; +import org.jmol.viewer.JmolConstants; +import org.jmol.viewer.Viewer; + +import jalview.schemes.*; + +import fr.orsay.lri.varna.applications.*; + +public abstract class JalviewVarnaBinding implements StructureListener, + SequenceStructureBinding, ComponentListener, + StructureSelectionManagerProvider + +{ + +} diff --git a/src/jalview/ext/varna/VarnaCommands.java b/src/jalview/ext/varna/VarnaCommands.java index a1d3a77..95f2fc1 100644 --- a/src/jalview/ext/varna/VarnaCommands.java +++ b/src/jalview/ext/varna/VarnaCommands.java @@ -1,154 +1,168 @@ -/** - * - */ -package jalview.ext.varna; - -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.structure.StructureMapping; -import jalview.structure.StructureSelectionManager; -import jalview.util.Comparison; - -import java.awt.Color; -import java.util.ArrayList; - -/** - * Routines for generating Jmol commands for Jalview/Jmol binding another - * cruisecontrol test. - * - * @author JimP - * - */ -public class VarnaCommands -{ - - /** - * Jmol utility which constructs the commands to colour chains by the given - * alignment - * - */ - public static String[] getColourBySequenceCommand( - StructureSelectionManager ssm, String[] files, - SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, - AlignmentI alignment) - { - ArrayList str = new ArrayList(); - StringBuffer command = new StringBuffer(); - - for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) - { - StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); - - if (mapping == null || mapping.length < 1) - continue; - - int lastPos = -1; - for (int s = 0; s < sequence[pdbfnum].length; s++) - { - for (int sp, m = 0; m < mapping.length; m++) - { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) - { - SequenceI asp = alignment.getSequenceAt(sp); - for (int r = 0; r < asp.getLength(); r++) - { - // no mapping to gaps in sequence - if (jalview.util.Comparison.isGap(asp.getCharAt(r))) - { - continue; - } - int pos = mapping[m].getPDBResNum(asp.findPosition(r)); - - if (pos < 1 || pos == lastPos) - continue; - - lastPos = pos; - - Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); - - if (fr != null) - col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); - String newSelcom = (mapping[m].getChain() != " " ? ":" - + mapping[m].getChain() : "") - + "/" - + (pdbfnum + 1) - + ".1" - + ";color[" - + col.getRed() - + "," - + col.getGreen() - + "," - + col.getBlue() + "]"; - if (command.length() > newSelcom.length() - && command.substring( - command.length() - newSelcom.length()) - .equals(newSelcom)) - { - command = VarnaCommands.condenseCommand(command, pos); - continue; - } - // TODO: deal with case when buffer is too large for Jmol to parse - // - execute command and flush - - command.append(";"); - if (command.length() > 51200) - { - // add another chunk - str.add(command.toString()); - command.setLength(0); - } - command.append("select " + pos); - command.append(newSelcom); - } - break; - } - } - } - } - { - // add final chunk - str.add(command.toString()); - command.setLength(0); - } - return str.toArray(new String[str.size()]); - } - - public static StringBuffer condenseCommand(StringBuffer command, int pos) - { - - // work back to last 'select' - int p = command.length(), q = p; - do - { - p -= 6; - if (p < 1) - { - p = 0; - } - ; - } while ((q = command.indexOf("select", p)) == -1 && p > 0); - - StringBuffer sb = new StringBuffer(command.substring(0, q + 7)); - - command = command.delete(0, q + 7); - - String start; - - if (command.indexOf("-") > -1) - { - start = command.substring(0, command.indexOf("-")); - } - else - { - start = command.substring(0, command.indexOf(":")); - } - - sb.append(start + "-" + pos + command.substring(command.indexOf(":"))); - - return sb; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.ext.varna; + +import jalview.api.FeatureRenderer; +import jalview.api.SequenceRenderer; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceI; +import jalview.structure.StructureMapping; +import jalview.structure.StructureSelectionManager; +import jalview.util.Comparison; + +import java.awt.Color; +import java.util.ArrayList; + +/** + * Routines for generating Jmol commands for Jalview/Jmol binding another + * cruisecontrol test. + * + * @author JimP + * + */ +public class VarnaCommands +{ + + /** + * Jmol utility which constructs the commands to colour chains by the given + * alignment + * + */ + public static String[] getColourBySequenceCommand( + StructureSelectionManager ssm, String[] files, + SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, + AlignmentI alignment) + { + ArrayList str = new ArrayList(); + StringBuffer command = new StringBuffer(); + + for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) + { + StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + + if (mapping == null || mapping.length < 1) + continue; + + int lastPos = -1; + for (int s = 0; s < sequence[pdbfnum].length; s++) + { + for (int sp, m = 0; m < mapping.length; m++) + { + if (mapping[m].getSequence() == sequence[pdbfnum][s] + && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + { + SequenceI asp = alignment.getSequenceAt(sp); + for (int r = 0; r < asp.getLength(); r++) + { + // no mapping to gaps in sequence + if (jalview.util.Comparison.isGap(asp.getCharAt(r))) + { + continue; + } + int pos = mapping[m].getPDBResNum(asp.findPosition(r)); + + if (pos < 1 || pos == lastPos) + continue; + + lastPos = pos; + + Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); + + if (fr != null) + col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); + String newSelcom = (mapping[m].getChain() != " " ? ":" + + mapping[m].getChain() : "") + + "/" + + (pdbfnum + 1) + + ".1" + + ";color[" + + col.getRed() + + "," + + col.getGreen() + + "," + + col.getBlue() + "]"; + if (command.length() > newSelcom.length() + && command.substring( + command.length() - newSelcom.length()) + .equals(newSelcom)) + { + command = VarnaCommands.condenseCommand(command, pos); + continue; + } + // TODO: deal with case when buffer is too large for Jmol to parse + // - execute command and flush + + command.append(";"); + if (command.length() > 51200) + { + // add another chunk + str.add(command.toString()); + command.setLength(0); + } + command.append("select " + pos); + command.append(newSelcom); + } + break; + } + } + } + } + { + // add final chunk + str.add(command.toString()); + command.setLength(0); + } + return str.toArray(new String[str.size()]); + } + + public static StringBuffer condenseCommand(StringBuffer command, int pos) + { + + // work back to last 'select' + int p = command.length(), q = p; + do + { + p -= 6; + if (p < 1) + { + p = 0; + } + ; + } while ((q = command.indexOf("select", p)) == -1 && p > 0); + + StringBuffer sb = new StringBuffer(command.substring(0, q + 7)); + + command = command.delete(0, q + 7); + + String start; + + if (command.indexOf("-") > -1) + { + start = command.substring(0, command.indexOf("-")); + } + else + { + start = command.substring(0, command.indexOf(":")); + } + + sb.append(start + "-" + pos + command.substring(command.indexOf(":"))); + + return sb; + } + +} diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index d984f3c..77c3b6a 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 49fe522..7a01b27 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index c681409..a283c01 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 5a942f1..599cf0b 100755 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index a0c1ecf..e255cd6 100755 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -1,305 +1,305 @@ -/* - * 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 . - */ -package jalview.gui; - -import java.util.*; -import java.util.List; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -import jalview.datamodel.*; -import jalview.io.*; - -/** - * - * GUI dialog for exporting features or alignment annotations depending upon - * which method is called. - * - * @author AMW - * - */ -public class AnnotationExporter extends JPanel -{ - JInternalFrame frame; - - AlignmentPanel ap; - - boolean features = true; - - AlignmentAnnotation[] annotations; - - List sequenceGroups; - - Hashtable alignmentProperties; - - public AnnotationExporter() - { - try - { - jbInit(); - } catch (Exception ex) - { - ex.printStackTrace(); - } - - frame = new JInternalFrame(); - frame.setContentPane(this); - frame.setLayer(JLayeredPane.PALETTE_LAYER); - Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width, - frame.getPreferredSize().height); - } - - public void exportFeatures(AlignmentPanel ap) - { - this.ap = ap; - features = true; - CSVFormat.setVisible(false); - frame.setTitle("Export Features"); - } - - public void exportAnnotations(AlignmentPanel ap, - AlignmentAnnotation[] annotations, List list, - Hashtable alProperties) - { - this.ap = ap; - features = false; - GFFFormat.setVisible(false); - CSVFormat.setVisible(true); - this.annotations = annotations; - this.sequenceGroups = list; - this.alignmentProperties = alProperties; - frame.setTitle("Export Annotations"); - } - - public void toFile_actionPerformed(ActionEvent e) - { - JalviewFileChooser chooser = new JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY")); - - chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(features ? "Save Features to File" - : "Save Annotation to File"); - chooser.setToolTipText("Save"); - - int value = chooser.showSaveDialog(this); - - if (value == JalviewFileChooser.APPROVE_OPTION) - { - String text = "No features found on alignment"; - if (features) - { - if (GFFFormat.isSelected()) - { - text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//); - } - else - { - text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed); - } - } - else - { - if (CSVFormat.isSelected()) - { - text = new AnnotationFile().printCSVAnnotations(annotations); - } - else - { - text = new AnnotationFile().printAnnotations(annotations, - sequenceGroups, alignmentProperties); - } - } - - try - { - java.io.PrintWriter out = new java.io.PrintWriter( - new java.io.FileWriter(chooser.getSelectedFile())); - - out.print(text); - out.close(); - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - - close_actionPerformed(null); - } - - public void toTextbox_actionPerformed(ActionEvent e) - { - String text = "No features found on alignment"; - if (features) - { - if (GFFFormat.isSelected()) - { - text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); - } - else - { - text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); - } - } - else if (!features) - { - if (CSVFormat.isSelected()) - { - text = new AnnotationFile().printCSVAnnotations(annotations); - } - else - { - text = new AnnotationFile().printAnnotations(annotations, - sequenceGroups, alignmentProperties); - } - } - - CutAndPasteTransfer cap = new CutAndPasteTransfer(); - try - { - cap.setText(text); - Desktop.addInternalFrame(cap, (features ? "Features for - " - : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500); - } catch (OutOfMemoryError oom) - { - new OOMWarning("generating " - + (features ? "Features for - " : "Annotations for - ") - + ap.alignFrame.getTitle(), oom); - cap.dispose(); - } - - close_actionPerformed(null); - } - - private Hashtable getDisplayedFeatureCols() - { - Hashtable fcols = new Hashtable(); - if (ap.av.featuresDisplayed == null) - { - return fcols; - } - Enumeration en = ap.av.featuresDisplayed.keys(); - FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider - // higher - // level - // method ? - while (en.hasMoreElements()) - { - Object col = en.nextElement(); - fcols.put(col, fr.featureColours.get(col)); - } - return fcols; - } - - public void close_actionPerformed(ActionEvent e) - { - try - { - frame.setClosed(true); - } catch (java.beans.PropertyVetoException ex) - { - } - } - - private void jbInit() throws Exception - { - this.setLayout(new BorderLayout()); - - toFile.setText("to File"); - toFile.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - toFile_actionPerformed(e); - } - }); - toTextbox.setText("to Textbox"); - toTextbox.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - toTextbox_actionPerformed(e); - } - }); - close.setText("Close"); - close.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - close_actionPerformed(e); - } - }); - jalviewFormat.setOpaque(false); - jalviewFormat.setSelected(true); - jalviewFormat.setText("Jalview"); - GFFFormat.setOpaque(false); - GFFFormat.setText("GFF"); - CSVFormat.setOpaque(false); - CSVFormat.setText("CSV(Spreadsheet)"); - jLabel1.setHorizontalAlignment(SwingConstants.TRAILING); - jLabel1.setText("Format: "); - this.setBackground(Color.white); - jPanel3.setBorder(BorderFactory.createEtchedBorder()); - jPanel3.setOpaque(false); - jPanel1.setOpaque(false); - jPanel1.add(toFile); - jPanel1.add(toTextbox); - jPanel1.add(close); - jPanel3.add(jLabel1); - jPanel3.add(jalviewFormat); - jPanel3.add(GFFFormat); - jPanel3.add(CSVFormat); - buttonGroup.add(jalviewFormat); - buttonGroup.add(GFFFormat); - buttonGroup.add(CSVFormat); - this.add(jPanel3, BorderLayout.CENTER); - this.add(jPanel1, BorderLayout.SOUTH); - } - - JPanel jPanel1 = new JPanel(); - - JButton toFile = new JButton(); - - JButton toTextbox = new JButton(); - - JButton close = new JButton(); - - ButtonGroup buttonGroup = new ButtonGroup(); - - JRadioButton jalviewFormat = new JRadioButton(); - - JRadioButton GFFFormat = new JRadioButton(); - - JRadioButton CSVFormat = new JRadioButton(); - - JLabel jLabel1 = new JLabel(); - - JPanel jPanel3 = new JPanel(); - - FlowLayout flowLayout1 = new FlowLayout(); - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +import java.util.*; +import java.util.List; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; + +import jalview.datamodel.*; +import jalview.io.*; + +/** + * + * GUI dialog for exporting features or alignment annotations depending upon + * which method is called. + * + * @author AMW + * + */ +public class AnnotationExporter extends JPanel +{ + JInternalFrame frame; + + AlignmentPanel ap; + + boolean features = true; + + AlignmentAnnotation[] annotations; + + List sequenceGroups; + + Hashtable alignmentProperties; + + public AnnotationExporter() + { + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + + frame = new JInternalFrame(); + frame.setContentPane(this); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + Desktop.addInternalFrame(frame, "", frame.getPreferredSize().width, + frame.getPreferredSize().height); + } + + public void exportFeatures(AlignmentPanel ap) + { + this.ap = ap; + features = true; + CSVFormat.setVisible(false); + frame.setTitle("Export Features"); + } + + public void exportAnnotations(AlignmentPanel ap, + AlignmentAnnotation[] annotations, List list, + Hashtable alProperties) + { + this.ap = ap; + features = false; + GFFFormat.setVisible(false); + CSVFormat.setVisible(true); + this.annotations = annotations; + this.sequenceGroups = list; + this.alignmentProperties = alProperties; + frame.setTitle("Export Annotations"); + } + + public void toFile_actionPerformed(ActionEvent e) + { + JalviewFileChooser chooser = new JalviewFileChooser( + jalview.bin.Cache.getProperty("LAST_DIRECTORY")); + + chooser.setFileView(new JalviewFileView()); + chooser.setDialogTitle(features ? "Save Features to File" + : "Save Annotation to File"); + chooser.setToolTipText("Save"); + + int value = chooser.showSaveDialog(this); + + if (value == JalviewFileChooser.APPROVE_OPTION) + { + String text = "No features found on alignment"; + if (features) + { + if (GFFFormat.isSelected()) + { + text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() + .getDataset().getSequencesArray(), + getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//); + } + else + { + text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() + .getDataset().getSequencesArray(), + getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed); + } + } + else + { + if (CSVFormat.isSelected()) + { + text = new AnnotationFile().printCSVAnnotations(annotations); + } + else + { + text = new AnnotationFile().printAnnotations(annotations, + sequenceGroups, alignmentProperties); + } + } + + try + { + java.io.PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter(chooser.getSelectedFile())); + + out.print(text); + out.close(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + close_actionPerformed(null); + } + + public void toTextbox_actionPerformed(ActionEvent e) + { + String text = "No features found on alignment"; + if (features) + { + if (GFFFormat.isSelected()) + { + text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() + .getDataset().getSequencesArray(), + getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); + } + else + { + text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() + .getDataset().getSequencesArray(), + getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); + } + } + else if (!features) + { + if (CSVFormat.isSelected()) + { + text = new AnnotationFile().printCSVAnnotations(annotations); + } + else + { + text = new AnnotationFile().printAnnotations(annotations, + sequenceGroups, alignmentProperties); + } + } + + CutAndPasteTransfer cap = new CutAndPasteTransfer(); + try + { + cap.setText(text); + Desktop.addInternalFrame(cap, (features ? "Features for - " + : "Annotations for - ") + ap.alignFrame.getTitle(), 600, 500); + } catch (OutOfMemoryError oom) + { + new OOMWarning("generating " + + (features ? "Features for - " : "Annotations for - ") + + ap.alignFrame.getTitle(), oom); + cap.dispose(); + } + + close_actionPerformed(null); + } + + private Hashtable getDisplayedFeatureCols() + { + Hashtable fcols = new Hashtable(); + if (ap.av.featuresDisplayed == null) + { + return fcols; + } + Enumeration en = ap.av.featuresDisplayed.keys(); + FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider + // higher + // level + // method ? + while (en.hasMoreElements()) + { + Object col = en.nextElement(); + fcols.put(col, fr.featureColours.get(col)); + } + return fcols; + } + + public void close_actionPerformed(ActionEvent e) + { + try + { + frame.setClosed(true); + } catch (java.beans.PropertyVetoException ex) + { + } + } + + private void jbInit() throws Exception + { + this.setLayout(new BorderLayout()); + + toFile.setText("to File"); + toFile.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + toFile_actionPerformed(e); + } + }); + toTextbox.setText("to Textbox"); + toTextbox.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + toTextbox_actionPerformed(e); + } + }); + close.setText("Close"); + close.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + close_actionPerformed(e); + } + }); + jalviewFormat.setOpaque(false); + jalviewFormat.setSelected(true); + jalviewFormat.setText("Jalview"); + GFFFormat.setOpaque(false); + GFFFormat.setText("GFF"); + CSVFormat.setOpaque(false); + CSVFormat.setText("CSV(Spreadsheet)"); + jLabel1.setHorizontalAlignment(SwingConstants.TRAILING); + jLabel1.setText("Format: "); + this.setBackground(Color.white); + jPanel3.setBorder(BorderFactory.createEtchedBorder()); + jPanel3.setOpaque(false); + jPanel1.setOpaque(false); + jPanel1.add(toFile); + jPanel1.add(toTextbox); + jPanel1.add(close); + jPanel3.add(jLabel1); + jPanel3.add(jalviewFormat); + jPanel3.add(GFFFormat); + jPanel3.add(CSVFormat); + buttonGroup.add(jalviewFormat); + buttonGroup.add(GFFFormat); + buttonGroup.add(CSVFormat); + this.add(jPanel3, BorderLayout.CENTER); + this.add(jPanel1, BorderLayout.SOUTH); + } + + JPanel jPanel1 = new JPanel(); + + JButton toFile = new JButton(); + + JButton toTextbox = new JButton(); + + JButton close = new JButton(); + + ButtonGroup buttonGroup = new ButtonGroup(); + + JRadioButton jalviewFormat = new JRadioButton(); + + JRadioButton GFFFormat = new JRadioButton(); + + JRadioButton CSVFormat = new JRadioButton(); + + JLabel jLabel1 = new JLabel(); + + JPanel jPanel3 = new JPanel(); + + FlowLayout flowLayout1 = new FlowLayout(); + +} diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 9c51810..1577477 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index ffb8e4e..d0af0a5 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index fd740b1..80bfcf3 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 14beaf8..b8b60bc 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index ce5c7b0..b37b374 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 02696ea..b114c59 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -942,4 +942,4 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding * 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 + */ diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index fc2766a..cb00e39 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import javax.swing.JOptionPane; diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 58db7c5..7b6567d 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import jalview.bin.Cache; diff --git a/src/jalview/gui/Console.java b/src/jalview/gui/Console.java index 603d418..19526aa 100644 --- a/src/jalview/gui/Console.java +++ b/src/jalview/gui/Console.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index 97f4f6a..8a7d6f8 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 0bdc910..cb71128 100755 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index acc9b09..3efde6a 100755 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -1,833 +1,833 @@ -/* - * 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 . - */ -package jalview.gui; - -import jalview.jbgui.GDasSourceBrowser; -import jalview.util.TableSorter; -import jalview.ws.dbsources.das.api.DasSourceRegistryI; -import jalview.ws.dbsources.das.api.jalviewSourceI; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.Vector; - -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.AbstractTableModel; - -import org.biodas.jdas.schema.sources.CAPABILITY; -import org.biodas.jdas.schema.sources.COORDINATES; -import org.biodas.jdas.schema.sources.PROP; -import org.biodas.jdas.schema.sources.VERSION; - -public class DasSourceBrowser extends GDasSourceBrowser implements - Runnable, ListSelectionListener -{ - DasSourceRegistryI sourceRegistry = null; - - Vector selectedSources; - - public DasSourceBrowser(FeatureSettings featureSettings) - { - fs = featureSettings; - // TODO DasSourceRegistryProvider API - sourceRegistry = jalview.bin.Cache.getDasSourceRegistry(); - String registry = sourceRegistry.getDasRegistryURL(); - - registryURL.setText(registry); - - setSelectedFromProperties(); - - displayFullDetails(null); - table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - - filter1.addListSelectionListener(this); - filter2.addListSelectionListener(this); - filter3.addListSelectionListener(this); - - // Ask to be notified of selection changes. - ListSelectionModel rowSM = table.getSelectionModel(); - rowSM.addListSelectionListener(new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - ListSelectionModel lsm = (ListSelectionModel) e.getSource(); - if (!lsm.isSelectionEmpty()) - { - int selectedRow = lsm.getMinSelectionIndex(); - displayFullDetails(table.getValueAt(selectedRow, 0).toString()); - } - } - }); - - table.addMouseListener(new MouseAdapter() - { - public void mouseClicked(MouseEvent evt) - { - if (evt.getClickCount() == 2 - || SwingUtilities.isRightMouseButton(evt)) - { - editRemoveLocalSource(evt); - } - } - }); - - if (sourceRegistry.getSources() != null) - { - init(); - } - } - - FeatureSettings fs = null; - - private boolean loadingDasSources; - - public DasSourceBrowser() - { - this(null); - } - - public void paintComponent(java.awt.Graphics g) - { - if (sourceRegistry == null) - { - Thread worker = new Thread(this); - worker.start(); - } - } - - void init() - { - List sources = sourceRegistry.getSources(); - int dSize = sources.size(); - Object[][] data = new Object[dSize][2]; - for (int i = 0; i < dSize; i++) - { - data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname - data[i][1] = new Boolean(selectedSources.contains(sources.get(i) - .getTitle())); - } - - refreshTableData(data); - setCapabilities(sourceRegistry); - - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - TableSorter sorter = (TableSorter) table.getModel(); - sorter.setSortingStatus(1, TableSorter.DESCENDING); - sorter.setSortingStatus(1, TableSorter.NOT_SORTED); - } - }); - - progressBar.setIndeterminate(false); - progressBar.setVisible(false); - addLocal.setVisible(true); - refresh.setVisible(true); - } - - public void refreshTableData(Object[][] data) - { - TableSorter sorter = new TableSorter(new DASTableModel(data)); - sorter.setTableHeader(table.getTableHeader()); - table.setModel(sorter); - } - - void displayFullDetails(String nickName) - { - - StringBuffer text = new StringBuffer( - ""); - - if (nickName == null) - { - fullDetails.setText(text + "Select a DAS service from the table" - + " to read a full description here."); - return; - } - - int dSize = sourceRegistry.getSources().size(); - for (jalviewSourceI ds : sourceRegistry.getSources()) - { - if (!ds.getTitle().equals(nickName)) - { - continue; - } - - VERSION latest = ds.getVersion(); - text.append("Id: " + ds.getUri() - + "
                "); - text.append("Nickname: " - + ds.getTitle() + "
                "); - - text.append("URL: " + ds.getSourceURL() + "" - + "
                "); - if (!ds.isLocal()) - { - if (ds.getDocHref() != null && ds.getDocHref().length() > 0) - { - text.append("Site: " + ds.getDocHref() + "" - + "
                "); - } - - text.append("Description: " - + ds.getDescription() + "
                "); - - text.append("Admin Email: " + ds.getEmail() + "" + "
                "); - - text.append("Registered at: " - + latest.getCreated() + "
                "); - - // TODO: Identify last successful test date - // text.append("Last successful test: " - // + latest.dasSources[i].getLeaseDate() + "
                "); - } - else - { - text.append("Source was added manually.
                "); - } - text.append("Labels: "); - boolean b = false; - for (PROP labl : latest.getPROP()) - { - if (labl.getName().equalsIgnoreCase("LABEL")) - { - if (b) - { - text.append(","); - } - text.append(" "); - - text.append(labl.getValue()); - b = true; - } - ; - } - text.append("
                "); - - text.append("Capabilities: "); - CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]); - for (int j = 0; j < scap.length; j++) - { - text.append(scap[j].getType()); - if (j < scap.length - 1) - { - text.append(", "); - } - } - text.append("
                "); - - text.append("Coordinates:"); - int i = 1; - for (COORDINATES dcs : latest.getCOORDINATES()) - { - text.append("
                " + i++ + ". "); - text.append(dcs.getAuthority() + " : " + dcs.getSource()); - if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0) - { - text.append(" [TaxId:" + dcs.getTaxid() + "]"); - } - if (dcs.getVersion() != null - && dcs.getVersion().trim().length() > 0) - { - { - text.append(" {v. " + dcs.getVersion() + "}"); - } - } - text.append(" (" + dcs.getUri() - + ")"); - } - text.append(""); - - break; - } - - fullDetails.setText(text.toString()); - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - fullDetailsScrollpane.getVerticalScrollBar().setValue(0); - } - }); - } - - public void run() - { - loadingDasSources = true; - - addLocal.setVisible(false); - refresh.setVisible(false); - progressBar.setVisible(true); - progressBar.setIndeterminate(true); - setParentGuiEnabled(false); - // Refresh the source list. - sourceRegistry.refreshSources(); - - init(); - - setParentGuiEnabled(true); - loadingDasSources = false; - - } - - private void setParentGuiEnabled(boolean b) - { - if (fs != null) - { - fs.fetchDAS.setEnabled(b); - fs.saveDAS.setEnabled(b); - } - } - - public Vector getSelectedSources() - { - // wait around if we're still loading. - while (sourceRegistry == null) - { - if (!loadingDasSources) - { - new Thread(this).start(); - try - { - Thread.sleep(5); - } catch (Exception e) - { - } - ; - while (loadingDasSources) - { - try - { - Thread.sleep(5); - } catch (Exception e) - { - } - ; - } - ; - } - } - - Vector selected = new Vector(); - for (String source : selectedSources) - { - jalviewSourceI srce = sourceRegistry.getSource(source); - if (srce != null) - { - selected.addElement(srce); - } - } - return selected; - } - - public void refresh_actionPerformed(ActionEvent e) - { - saveProperties(jalview.bin.Cache.applicationProperties); - - Thread worker = new Thread(this); - worker.start(); - } - - private void setCapabilities(DasSourceRegistryI sourceRegistry2) - { - Vector authority = new Vector(); - Vector type = new Vector(); - Vector label = new Vector(); - Vector taxIds = new Vector(); - authority.add("Any"); - type.add("Any"); - label.add("Any"); - - for (jalviewSourceI ds : sourceRegistry2.getSources()) - { - VERSION latest = ds.getVersion(); - - for (COORDINATES cs : latest.getCOORDINATES()) - { - if (!type.contains(cs.getSource())) - { - type.add(cs.getSource()); // source==category - } - - if (!authority.contains(cs.getAuthority())) - { - authority.add(cs.getAuthority()); - } - } - - for (PROP slabel : latest.getPROP()) - { - if (slabel.getName().equalsIgnoreCase("LABEL") - && !label.contains(slabel.getValue())) - { - label.add(slabel.getValue()); - } - } - - } - - filter1.setListData(authority); - filter2.setListData(type); - filter3.setListData(label); - // filter4 taxIds - - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - filter1.setSelectedIndex(0); - filter2.setSelectedIndex(0); - filter3.setSelectedIndex(0); - } - }); - } - - public void amendLocal(boolean newSource) - { - String url = "http://localhost:8080/", nickname = ""; - boolean seqsrc = false; - if (!newSource) - { - int selectedRow = table.getSelectionModel().getMinSelectionIndex(); - nickname = table.getValueAt(selectedRow, 0).toString(); - jalviewSourceI source = sourceRegistry.getSource(nickname); - url = source.getUri(); - seqsrc = source.isSequenceSource(); - } - - JTextField nametf = new JTextField(nickname, 40); - JTextField urltf = new JTextField(url, 40); - JCheckBox seqs = new JCheckBox("Sequence Source"); - seqs.setSelected(seqsrc); - JPanel panel = new JPanel(new BorderLayout()); - JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER); - pane12.add(nametf, BorderLayout.EAST); - panel.add(pane12, BorderLayout.NORTH); - pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel("URL: "), BorderLayout.NORTH); - pane12.add(seqs, BorderLayout.SOUTH); - pane12.add(urltf, BorderLayout.EAST); - panel.add(pane12, BorderLayout.SOUTH); - - int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - panel, "Enter Nickname & URL of Local DAS Source", - JOptionPane.OK_CANCEL_OPTION); - - if (reply != JOptionPane.OK_OPTION) - { - return; - } - - if (!urltf.getText().endsWith("/")) - { - urltf.setText(urltf.getText() + "/"); - } - - jalviewSourceI local = sourceRegistry.createLocalSource( - urltf.getText(), nametf.getText(), seqs.isSelected(), true); - List sources = sourceRegistry.getSources(); - int osize = sources.size(); - int size = osize + (newSource ? 1 : 0); - - Object[][] data = new Object[size][2]; - DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table - .getModel()).getTableModel() : null; - for (int i = 0; i < osize; i++) - { - String osrc = (dtm == null || i >= osize) ? null : (String) dtm - .getValueAt(i, 0); - if (!newSource && osrc != null - && dtm.getValueAt(i, 0).equals(nickname)) - { - data[i][0] = local.getTitle(); - data[i][1] = new Boolean(true); - } - else - { - data[i][0] = osrc; - data[i][1] = new Boolean(selectedSources.contains(osrc)); - } - } - // Always add a new source at the end - if (newSource) - { - data[osize][0] = local.getTitle(); - data[osize][1] = new Boolean(true); - selectedSources.add(local.getTitle()); - } - - refreshTableData(data); - - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - scrollPane.getVerticalScrollBar().setValue( - scrollPane.getVerticalScrollBar().getMaximum()); - } - }); - - displayFullDetails(local.getTitle()); - } - - public void editRemoveLocalSource(MouseEvent evt) - { - int selectedRow = table.getSelectionModel().getMinSelectionIndex(); - if (selectedRow == -1) - { - return; - } - - String nickname = table.getValueAt(selectedRow, 0).toString(); - - if (!sourceRegistry.getSource(nickname).isLocal()) - { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "You can only edit or remove local DAS Sources!", - "Public DAS source - not editable", - JOptionPane.WARNING_MESSAGE); - return; - } - - Object[] options = - { "Edit", "Remove", "Cancel" }; - int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop, - "Do you want to edit or remove " + nickname + "?", - "Edit / Remove Local DAS Source", - JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, - null, options, options[2]); - - switch (choice) - { - case 0: - amendLocal(false); - break; - case 1: - sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname)); - selectedSources.remove(nickname); - Object[][] data = new Object[sourceRegistry.getSources().size()][2]; - int index = 0, - l = table.getRowCount(); - - for (int i = 0; i < l; i++) - { - String nm; - if ((nm = (String) table.getValueAt(i, 0)).equals(nickname)) - { - continue; - } - else - { - data[index][0] = nm; - data[index][1] = new Boolean(selectedSources.contains(nm)); - index++; - } - } - refreshTableData(data); - SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - scrollPane.getVerticalScrollBar().setValue( - scrollPane.getVerticalScrollBar().getMaximum()); - } - }); - - break; - } - } - - public void valueChanged(ListSelectionEvent evt) - { - // Called when the MainTable selection changes - if (evt.getValueIsAdjusting()) - { - return; - } - - displayFullDetails(null); - - // Filter the displayed data sources - - ArrayList names = new ArrayList(); - ArrayList selected = new ArrayList(); - - // The features filter is not visible, but we must still - // filter the das source list here. - // July 2006 - only 6 sources fo not serve features - Object[] dummyFeatureList = new Object[] - { "features" }; - List srcs = sourceRegistry.getSources(); - for (jalviewSourceI ds : srcs) - { - - VERSION v = ds.getVersion(); - List coords = v.getCOORDINATES(); - if (ds.isLocal() - || ((coords == null || coords.size() == 0) - && filter1.getSelectedIndex() == 0 - && filter2.getSelectedIndex() == 0 && filter3 - .getSelectedIndex() == 0)) - { - // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT - // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT - // IS ADDED FROM THE REGISTRY - names.add(ds.getTitle()); - selected.add(new Boolean(selectedSources.contains(ds.getTitle()))); - continue; - } - - if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v)) - || !selectedInList(filter3.getSelectedValues(), - ds.getLabelsFor(v))) - { - continue; - } - - for (int j = 0; j < coords.size(); j++) - { - if (selectedInList(filter1.getSelectedValues(), new String[] - { coords.get(j).getAuthority() }) - && selectedInList(filter2.getSelectedValues(), new String[] - { coords.get(j).getSource() })) - { - names.add(ds.getTitle()); - selected.add(new Boolean(selectedSources.contains(ds.getTitle()))); - break; - } - } - } - - int dSize = names.size(); - Object[][] data = new Object[dSize][2]; - for (int d = 0; d < dSize; d++) - { - data[d][0] = names.get(d); - data[d][1] = selected.get(d); - } - - refreshTableData(data); - } - - private boolean selectedInList(Object[] selection, String[] items) - { - for (int i = 0; i < selection.length; i++) - { - if (selection[i].equals("Any")) - { - return true; - } - if (items == null || items.length == 0) - { - return false; - } - String sel = (items[0].startsWith("das1:") ? "das1:" : "") - + selection[i]; - for (int j = 0; j < items.length; j++) - { - if (sel.equals(items[j])) - { - return true; - } - } - } - - return false; - } - - void setSelectedFromProperties() - { - String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", - "uniprot"); - StringTokenizer st = new StringTokenizer(active, "\t"); - selectedSources = new Vector(); - while (st.hasMoreTokens()) - { - selectedSources.addElement(st.nextToken()); - } - } - - public void reset_actionPerformed(ActionEvent e) - { - registryURL.setText(sourceRegistry.getDasRegistryURL()); - } - - /** - * set the DAS source settings in the given jalview properties. - * - * @param properties - */ - public void saveProperties(Properties properties) - { - if (registryURL.getText() == null || registryURL.getText().length() < 1) - { - properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL); - } - else - { - properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, - registryURL.getText()); - } - - StringBuffer sb = new StringBuffer(); - for (int r = 0; r < table.getModel().getRowCount(); r++) - { - if (((Boolean) table.getValueAt(r, 1)).booleanValue()) - { - sb.append(table.getValueAt(r, 0) + "\t"); - } - } - - properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE, - sb.toString()); - - String sourceprop = sourceRegistry.getLocalSourceString(); - properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop); - } - - class DASTableModel extends AbstractTableModel - { - - public DASTableModel(Object[][] data) - { - this.data = data; - } - - private String[] columnNames = new String[] - { "Nickname", "Use Source" }; - - private Object[][] data; - - public int getColumnCount() - { - return columnNames.length; - } - - public int getRowCount() - { - return data.length; - } - - public String getColumnName(int col) - { - return columnNames[col]; - } - - public Object getValueAt(int row, int col) - { - return data[row][col]; - } - - /* - * JTable uses this method to determine the default renderer/ editor for - * each cell. If we didn't implement this method, then the last column would - * contain text ("true"/"false"), rather than a check box. - */ - public Class getColumnClass(int c) - { - return getValueAt(0, c).getClass(); - } - - /* - * Don't need to implement this method unless your table's editable. - */ - public boolean isCellEditable(int row, int col) - { - // Note that the data/cell address is constant, - // no matter where the cell appears onscreen. - return col == 1; - - } - - /* - * Don't need to implement this method unless your table's data can change. - */ - public void setValueAt(Object value, int row, int col) - { - data[row][col] = value; - fireTableCellUpdated(row, col); - - String name = getValueAt(row, 0).toString(); - boolean selected = ((Boolean) value).booleanValue(); - - if (selectedSources.contains(name) && !selected) - { - selectedSources.remove(name); - } - - if (!selectedSources.contains(name) && selected) - { - selectedSources.add(name); - } - } - } - - public void initDasSources() - { - - Thread thr = new Thread(new Runnable() - { - public void run() - { - // this actually initialises the das source list - paintComponent(null); // yuk - } - }); - thr.start(); - while (loadingDasSources || sourceRegistry == null) - { - try - { - Thread.sleep(10); - } catch (Exception e) - { - } - ; - } - } - - /** - * disable or enable the buttons on the source browser - * - * @param b - */ - public void setGuiEnabled(boolean b) - { - refresh.setEnabled(b); - addLocal.setEnabled(b); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +import jalview.jbgui.GDasSourceBrowser; +import jalview.util.TableSorter; +import jalview.ws.dbsources.das.api.DasSourceRegistryI; +import jalview.ws.dbsources.das.api.jalviewSourceI; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.AbstractTableModel; + +import org.biodas.jdas.schema.sources.CAPABILITY; +import org.biodas.jdas.schema.sources.COORDINATES; +import org.biodas.jdas.schema.sources.PROP; +import org.biodas.jdas.schema.sources.VERSION; + +public class DasSourceBrowser extends GDasSourceBrowser implements + Runnable, ListSelectionListener +{ + DasSourceRegistryI sourceRegistry = null; + + Vector selectedSources; + + public DasSourceBrowser(FeatureSettings featureSettings) + { + fs = featureSettings; + // TODO DasSourceRegistryProvider API + sourceRegistry = jalview.bin.Cache.getDasSourceRegistry(); + String registry = sourceRegistry.getDasRegistryURL(); + + registryURL.setText(registry); + + setSelectedFromProperties(); + + displayFullDetails(null); + table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + + filter1.addListSelectionListener(this); + filter2.addListSelectionListener(this); + filter3.addListSelectionListener(this); + + // Ask to be notified of selection changes. + ListSelectionModel rowSM = table.getSelectionModel(); + rowSM.addListSelectionListener(new ListSelectionListener() + { + public void valueChanged(ListSelectionEvent e) + { + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + if (!lsm.isSelectionEmpty()) + { + int selectedRow = lsm.getMinSelectionIndex(); + displayFullDetails(table.getValueAt(selectedRow, 0).toString()); + } + } + }); + + table.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent evt) + { + if (evt.getClickCount() == 2 + || SwingUtilities.isRightMouseButton(evt)) + { + editRemoveLocalSource(evt); + } + } + }); + + if (sourceRegistry.getSources() != null) + { + init(); + } + } + + FeatureSettings fs = null; + + private boolean loadingDasSources; + + public DasSourceBrowser() + { + this(null); + } + + public void paintComponent(java.awt.Graphics g) + { + if (sourceRegistry == null) + { + Thread worker = new Thread(this); + worker.start(); + } + } + + void init() + { + List sources = sourceRegistry.getSources(); + int dSize = sources.size(); + Object[][] data = new Object[dSize][2]; + for (int i = 0; i < dSize; i++) + { + data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname + data[i][1] = new Boolean(selectedSources.contains(sources.get(i) + .getTitle())); + } + + refreshTableData(data); + setCapabilities(sourceRegistry); + + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + TableSorter sorter = (TableSorter) table.getModel(); + sorter.setSortingStatus(1, TableSorter.DESCENDING); + sorter.setSortingStatus(1, TableSorter.NOT_SORTED); + } + }); + + progressBar.setIndeterminate(false); + progressBar.setVisible(false); + addLocal.setVisible(true); + refresh.setVisible(true); + } + + public void refreshTableData(Object[][] data) + { + TableSorter sorter = new TableSorter(new DASTableModel(data)); + sorter.setTableHeader(table.getTableHeader()); + table.setModel(sorter); + } + + void displayFullDetails(String nickName) + { + + StringBuffer text = new StringBuffer( + ""); + + if (nickName == null) + { + fullDetails.setText(text + "Select a DAS service from the table" + + " to read a full description here."); + return; + } + + int dSize = sourceRegistry.getSources().size(); + for (jalviewSourceI ds : sourceRegistry.getSources()) + { + if (!ds.getTitle().equals(nickName)) + { + continue; + } + + VERSION latest = ds.getVersion(); + text.append("Id: " + ds.getUri() + + "
                "); + text.append("Nickname: " + + ds.getTitle() + "
                "); + + text.append("URL: " + ds.getSourceURL() + "" + + "
                "); + if (!ds.isLocal()) + { + if (ds.getDocHref() != null && ds.getDocHref().length() > 0) + { + text.append("Site: " + ds.getDocHref() + "" + + "
                "); + } + + text.append("Description: " + + ds.getDescription() + "
                "); + + text.append("Admin Email: " + ds.getEmail() + "" + "
                "); + + text.append("Registered at: " + + latest.getCreated() + "
                "); + + // TODO: Identify last successful test date + // text.append("Last successful test: " + // + latest.dasSources[i].getLeaseDate() + "
                "); + } + else + { + text.append("Source was added manually.
                "); + } + text.append("Labels: "); + boolean b = false; + for (PROP labl : latest.getPROP()) + { + if (labl.getName().equalsIgnoreCase("LABEL")) + { + if (b) + { + text.append(","); + } + text.append(" "); + + text.append(labl.getValue()); + b = true; + } + ; + } + text.append("
                "); + + text.append("Capabilities: "); + CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]); + for (int j = 0; j < scap.length; j++) + { + text.append(scap[j].getType()); + if (j < scap.length - 1) + { + text.append(", "); + } + } + text.append("
                "); + + text.append("Coordinates:"); + int i = 1; + for (COORDINATES dcs : latest.getCOORDINATES()) + { + text.append("
                " + i++ + ". "); + text.append(dcs.getAuthority() + " : " + dcs.getSource()); + if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0) + { + text.append(" [TaxId:" + dcs.getTaxid() + "]"); + } + if (dcs.getVersion() != null + && dcs.getVersion().trim().length() > 0) + { + { + text.append(" {v. " + dcs.getVersion() + "}"); + } + } + text.append(" (" + dcs.getUri() + + ")"); + } + text.append(""); + + break; + } + + fullDetails.setText(text.toString()); + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + fullDetailsScrollpane.getVerticalScrollBar().setValue(0); + } + }); + } + + public void run() + { + loadingDasSources = true; + + addLocal.setVisible(false); + refresh.setVisible(false); + progressBar.setVisible(true); + progressBar.setIndeterminate(true); + setParentGuiEnabled(false); + // Refresh the source list. + sourceRegistry.refreshSources(); + + init(); + + setParentGuiEnabled(true); + loadingDasSources = false; + + } + + private void setParentGuiEnabled(boolean b) + { + if (fs != null) + { + fs.fetchDAS.setEnabled(b); + fs.saveDAS.setEnabled(b); + } + } + + public Vector getSelectedSources() + { + // wait around if we're still loading. + while (sourceRegistry == null) + { + if (!loadingDasSources) + { + new Thread(this).start(); + try + { + Thread.sleep(5); + } catch (Exception e) + { + } + ; + while (loadingDasSources) + { + try + { + Thread.sleep(5); + } catch (Exception e) + { + } + ; + } + ; + } + } + + Vector selected = new Vector(); + for (String source : selectedSources) + { + jalviewSourceI srce = sourceRegistry.getSource(source); + if (srce != null) + { + selected.addElement(srce); + } + } + return selected; + } + + public void refresh_actionPerformed(ActionEvent e) + { + saveProperties(jalview.bin.Cache.applicationProperties); + + Thread worker = new Thread(this); + worker.start(); + } + + private void setCapabilities(DasSourceRegistryI sourceRegistry2) + { + Vector authority = new Vector(); + Vector type = new Vector(); + Vector label = new Vector(); + Vector taxIds = new Vector(); + authority.add("Any"); + type.add("Any"); + label.add("Any"); + + for (jalviewSourceI ds : sourceRegistry2.getSources()) + { + VERSION latest = ds.getVersion(); + + for (COORDINATES cs : latest.getCOORDINATES()) + { + if (!type.contains(cs.getSource())) + { + type.add(cs.getSource()); // source==category + } + + if (!authority.contains(cs.getAuthority())) + { + authority.add(cs.getAuthority()); + } + } + + for (PROP slabel : latest.getPROP()) + { + if (slabel.getName().equalsIgnoreCase("LABEL") + && !label.contains(slabel.getValue())) + { + label.add(slabel.getValue()); + } + } + + } + + filter1.setListData(authority); + filter2.setListData(type); + filter3.setListData(label); + // filter4 taxIds + + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + filter1.setSelectedIndex(0); + filter2.setSelectedIndex(0); + filter3.setSelectedIndex(0); + } + }); + } + + public void amendLocal(boolean newSource) + { + String url = "http://localhost:8080/", nickname = ""; + boolean seqsrc = false; + if (!newSource) + { + int selectedRow = table.getSelectionModel().getMinSelectionIndex(); + nickname = table.getValueAt(selectedRow, 0).toString(); + jalviewSourceI source = sourceRegistry.getSource(nickname); + url = source.getUri(); + seqsrc = source.isSequenceSource(); + } + + JTextField nametf = new JTextField(nickname, 40); + JTextField urltf = new JTextField(url, 40); + JCheckBox seqs = new JCheckBox("Sequence Source"); + seqs.setSelected(seqsrc); + JPanel panel = new JPanel(new BorderLayout()); + JPanel pane12 = new JPanel(new BorderLayout()); + pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER); + pane12.add(nametf, BorderLayout.EAST); + panel.add(pane12, BorderLayout.NORTH); + pane12 = new JPanel(new BorderLayout()); + pane12.add(new JLabel("URL: "), BorderLayout.NORTH); + pane12.add(seqs, BorderLayout.SOUTH); + pane12.add(urltf, BorderLayout.EAST); + panel.add(pane12, BorderLayout.SOUTH); + + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + panel, "Enter Nickname & URL of Local DAS Source", + JOptionPane.OK_CANCEL_OPTION); + + if (reply != JOptionPane.OK_OPTION) + { + return; + } + + if (!urltf.getText().endsWith("/")) + { + urltf.setText(urltf.getText() + "/"); + } + + jalviewSourceI local = sourceRegistry.createLocalSource( + urltf.getText(), nametf.getText(), seqs.isSelected(), true); + List sources = sourceRegistry.getSources(); + int osize = sources.size(); + int size = osize + (newSource ? 1 : 0); + + Object[][] data = new Object[size][2]; + DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table + .getModel()).getTableModel() : null; + for (int i = 0; i < osize; i++) + { + String osrc = (dtm == null || i >= osize) ? null : (String) dtm + .getValueAt(i, 0); + if (!newSource && osrc != null + && dtm.getValueAt(i, 0).equals(nickname)) + { + data[i][0] = local.getTitle(); + data[i][1] = new Boolean(true); + } + else + { + data[i][0] = osrc; + data[i][1] = new Boolean(selectedSources.contains(osrc)); + } + } + // Always add a new source at the end + if (newSource) + { + data[osize][0] = local.getTitle(); + data[osize][1] = new Boolean(true); + selectedSources.add(local.getTitle()); + } + + refreshTableData(data); + + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + scrollPane.getVerticalScrollBar().setValue( + scrollPane.getVerticalScrollBar().getMaximum()); + } + }); + + displayFullDetails(local.getTitle()); + } + + public void editRemoveLocalSource(MouseEvent evt) + { + int selectedRow = table.getSelectionModel().getMinSelectionIndex(); + if (selectedRow == -1) + { + return; + } + + String nickname = table.getValueAt(selectedRow, 0).toString(); + + if (!sourceRegistry.getSource(nickname).isLocal()) + { + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "You can only edit or remove local DAS Sources!", + "Public DAS source - not editable", + JOptionPane.WARNING_MESSAGE); + return; + } + + Object[] options = + { "Edit", "Remove", "Cancel" }; + int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop, + "Do you want to edit or remove " + nickname + "?", + "Edit / Remove Local DAS Source", + JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, + null, options, options[2]); + + switch (choice) + { + case 0: + amendLocal(false); + break; + case 1: + sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname)); + selectedSources.remove(nickname); + Object[][] data = new Object[sourceRegistry.getSources().size()][2]; + int index = 0, + l = table.getRowCount(); + + for (int i = 0; i < l; i++) + { + String nm; + if ((nm = (String) table.getValueAt(i, 0)).equals(nickname)) + { + continue; + } + else + { + data[index][0] = nm; + data[index][1] = new Boolean(selectedSources.contains(nm)); + index++; + } + } + refreshTableData(data); + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + scrollPane.getVerticalScrollBar().setValue( + scrollPane.getVerticalScrollBar().getMaximum()); + } + }); + + break; + } + } + + public void valueChanged(ListSelectionEvent evt) + { + // Called when the MainTable selection changes + if (evt.getValueIsAdjusting()) + { + return; + } + + displayFullDetails(null); + + // Filter the displayed data sources + + ArrayList names = new ArrayList(); + ArrayList selected = new ArrayList(); + + // The features filter is not visible, but we must still + // filter the das source list here. + // July 2006 - only 6 sources fo not serve features + Object[] dummyFeatureList = new Object[] + { "features" }; + List srcs = sourceRegistry.getSources(); + for (jalviewSourceI ds : srcs) + { + + VERSION v = ds.getVersion(); + List coords = v.getCOORDINATES(); + if (ds.isLocal() + || ((coords == null || coords.size() == 0) + && filter1.getSelectedIndex() == 0 + && filter2.getSelectedIndex() == 0 && filter3 + .getSelectedIndex() == 0)) + { + // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT + // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT + // IS ADDED FROM THE REGISTRY + names.add(ds.getTitle()); + selected.add(new Boolean(selectedSources.contains(ds.getTitle()))); + continue; + } + + if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v)) + || !selectedInList(filter3.getSelectedValues(), + ds.getLabelsFor(v))) + { + continue; + } + + for (int j = 0; j < coords.size(); j++) + { + if (selectedInList(filter1.getSelectedValues(), new String[] + { coords.get(j).getAuthority() }) + && selectedInList(filter2.getSelectedValues(), new String[] + { coords.get(j).getSource() })) + { + names.add(ds.getTitle()); + selected.add(new Boolean(selectedSources.contains(ds.getTitle()))); + break; + } + } + } + + int dSize = names.size(); + Object[][] data = new Object[dSize][2]; + for (int d = 0; d < dSize; d++) + { + data[d][0] = names.get(d); + data[d][1] = selected.get(d); + } + + refreshTableData(data); + } + + private boolean selectedInList(Object[] selection, String[] items) + { + for (int i = 0; i < selection.length; i++) + { + if (selection[i].equals("Any")) + { + return true; + } + if (items == null || items.length == 0) + { + return false; + } + String sel = (items[0].startsWith("das1:") ? "das1:" : "") + + selection[i]; + for (int j = 0; j < items.length; j++) + { + if (sel.equals(items[j])) + { + return true; + } + } + } + + return false; + } + + void setSelectedFromProperties() + { + String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", + "uniprot"); + StringTokenizer st = new StringTokenizer(active, "\t"); + selectedSources = new Vector(); + while (st.hasMoreTokens()) + { + selectedSources.addElement(st.nextToken()); + } + } + + public void reset_actionPerformed(ActionEvent e) + { + registryURL.setText(sourceRegistry.getDasRegistryURL()); + } + + /** + * set the DAS source settings in the given jalview properties. + * + * @param properties + */ + public void saveProperties(Properties properties) + { + if (registryURL.getText() == null || registryURL.getText().length() < 1) + { + properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL); + } + else + { + properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL, + registryURL.getText()); + } + + StringBuffer sb = new StringBuffer(); + for (int r = 0; r < table.getModel().getRowCount(); r++) + { + if (((Boolean) table.getValueAt(r, 1)).booleanValue()) + { + sb.append(table.getValueAt(r, 0) + "\t"); + } + } + + properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE, + sb.toString()); + + String sourceprop = sourceRegistry.getLocalSourceString(); + properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop); + } + + class DASTableModel extends AbstractTableModel + { + + public DASTableModel(Object[][] data) + { + this.data = data; + } + + private String[] columnNames = new String[] + { "Nickname", "Use Source" }; + + private Object[][] data; + + public int getColumnCount() + { + return columnNames.length; + } + + public int getRowCount() + { + return data.length; + } + + public String getColumnName(int col) + { + return columnNames[col]; + } + + public Object getValueAt(int row, int col) + { + return data[row][col]; + } + + /* + * JTable uses this method to determine the default renderer/ editor for + * each cell. If we didn't implement this method, then the last column would + * contain text ("true"/"false"), rather than a check box. + */ + public Class getColumnClass(int c) + { + return getValueAt(0, c).getClass(); + } + + /* + * Don't need to implement this method unless your table's editable. + */ + public boolean isCellEditable(int row, int col) + { + // Note that the data/cell address is constant, + // no matter where the cell appears onscreen. + return col == 1; + + } + + /* + * Don't need to implement this method unless your table's data can change. + */ + public void setValueAt(Object value, int row, int col) + { + data[row][col] = value; + fireTableCellUpdated(row, col); + + String name = getValueAt(row, 0).toString(); + boolean selected = ((Boolean) value).booleanValue(); + + if (selectedSources.contains(name) && !selected) + { + selectedSources.remove(name); + } + + if (!selectedSources.contains(name) && selected) + { + selectedSources.add(name); + } + } + } + + public void initDasSources() + { + + Thread thr = new Thread(new Runnable() + { + public void run() + { + // this actually initialises the das source list + paintComponent(null); // yuk + } + }); + thr.start(); + while (loadingDasSources || sourceRegistry == null) + { + try + { + Thread.sleep(10); + } catch (Exception e) + { + } + ; + } + } + + /** + * disable or enable the buttons on the source browser + * + * @param b + */ + public void setGuiEnabled(boolean b) + { + refresh.setEnabled(b); + addLocal.setEnabled(b); + } +} diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index bb490ae..c9b8de2 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java index 277cffb..127e5cf 100755 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/EditNameDialog.java b/src/jalview/gui/EditNameDialog.java index ecc78b0..18076e6 100644 --- a/src/jalview/gui/EditNameDialog.java +++ b/src/jalview/gui/EditNameDialog.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 744f52f..1fb53e4 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 3c89d43..9df0b28 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 95edd5a..3ce17e2 100755 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 3bcb2c0..909b55d 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index 7521736..d0782b9 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/IProgressIndicator.java b/src/jalview/gui/IProgressIndicator.java index 5ce8daf..95b3ced 100644 --- a/src/jalview/gui/IProgressIndicator.java +++ b/src/jalview/gui/IProgressIndicator.java @@ -1,55 +1,55 @@ -/* - * 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 . - */ -package jalview.gui; - -/** - * Visual progress indicator interface. - * - * @author JimP - * - */ -public interface IProgressIndicator -{ - /** - * Visual indication of some operation taking place. On first call with a - * particular ID an indicator with the given message is added. The indicator - * is removed with a second call with same ID. - * - * @param message - * - displayed message for operation - * @param id - * - unique handle for this indicator - */ - public abstract void setProgressBar(String message, long id); - - /** - * register a handler for the progress bar identified by id - * - * @param id - * @param handler - */ - public abstract void registerHandler(long id, - IProgressIndicatorHandler handler); - - /** - * - * @return true if any progress bars are still active - */ - boolean operationInProgress(); - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +/** + * Visual progress indicator interface. + * + * @author JimP + * + */ +public interface IProgressIndicator +{ + /** + * Visual indication of some operation taking place. On first call with a + * particular ID an indicator with the given message is added. The indicator + * is removed with a second call with same ID. + * + * @param message + * - displayed message for operation + * @param id + * - unique handle for this indicator + */ + public abstract void setProgressBar(String message, long id); + + /** + * register a handler for the progress bar identified by id + * + * @param id + * @param handler + */ + public abstract void registerHandler(long id, + IProgressIndicatorHandler handler); + + /** + * + * @return true if any progress bars are still active + */ + boolean operationInProgress(); + +} diff --git a/src/jalview/gui/IProgressIndicatorHandler.java b/src/jalview/gui/IProgressIndicatorHandler.java index 08445a9..2fa56db 100644 --- a/src/jalview/gui/IProgressIndicatorHandler.java +++ b/src/jalview/gui/IProgressIndicatorHandler.java @@ -1,35 +1,35 @@ -/* - * 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 . - */ -package jalview.gui; - -public interface IProgressIndicatorHandler -{ - /** - * - * @return true if a cancel button can be shown - */ - public boolean canCancel(); - - /** - * Callback to cancel activity if the cancel button is pressed. - * - * @param id - * @return true if activity was cancelled - */ - public boolean cancelActivity(long id); -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +public interface IProgressIndicatorHandler +{ + /** + * + * @return true if a cancel button can be shown + */ + public boolean canCancel(); + + /** + * Callback to cancel activity if the cancel button is pressed. + * + * @param id + * @return true if activity was cancelled + */ + public boolean cancelActivity(long id); +} diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 235747c..5b589bb 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 4a540e0..b5fd0c1 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 15faa74..4fc8d95 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index 612b83e..69f0fef 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.gui; import jalview.bin.Cache; diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 40448d2..b4bc3c7 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 6c53074..e50c149 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -1,468 +1,468 @@ -/* - * 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 . - */ -package jalview.gui; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.util.jar.*; - -import javax.swing.*; - -import org.exolab.castor.xml.*; -import jalview.binding.*; -import jalview.schemes.*; -import jalview.util.jarInputStreamProvider; - -/** - * DOCUMENT ME! - * - * @author $author$ - * @version $Revision$ - */ -public class Jalview2XML_V1 -{ - boolean raiseGUI = true; - - public Jalview2XML_V1() - { - - }; - - public Jalview2XML_V1(boolean raiseGUI) - { - this.raiseGUI = raiseGUI; - }; - - jalview.schemes.UserColourScheme GetUserColourScheme( - JalviewModelSequence jms, String id) - { - UserColours[] uc = jms.getUserColours(); - UserColours colours = null; - - for (int i = 0; i < uc.length; i++) - { - if (uc[i].getId().equals(id)) - { - colours = uc[i]; - - break; - } - } - - int csize = colours.getUserColourScheme().getColourCount(); - java.awt.Color[] newColours = new java.awt.Color[csize]; - - for (int i = 0; i < csize; i++) - { - newColours[i] = new java.awt.Color(Integer.parseInt(colours - .getUserColourScheme().getColour(i).getRGB(), 16)); - } - - return new jalview.schemes.UserColourScheme(newColours); - } - - /** - * DOCUMENT ME! - * - * @param file - * DOCUMENT ME! - */ - public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider) - { - final String file = jprovider.getFilename(); - jalview.gui.AlignFrame af = null; - - try - { - JarInputStream jin = null; - JarEntry jarentry = null; - int entryCount = 1; - - do - { - jin = jprovider.getJarInputStream(); - - for (int i = 0; i < entryCount; i++) - { - jarentry = jin.getNextJarEntry(); - } - - class NoDescIDResolver implements IDResolver - { - public Object resolve(String idref) - { - System.out.println(idref + " used"); - return null; - } - } - - if (jarentry != null) - { - InputStreamReader in = new InputStreamReader(jin, "UTF-8"); - JalviewModel object = new JalviewModel(); - - object = (JalviewModel) object.unmarshal(in); - - af = LoadFromObject(object, file); - entryCount++; - } - } while (jarentry != null); - } catch (final java.net.UnknownHostException ex) - { - ex.printStackTrace(); - if (raiseGUI) - { - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - - System.err.println("Couldn't locate Jalview XML file : " + ex - + "\n"); - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Couldn't locate " + file, "URL not found", - JOptionPane.WARNING_MESSAGE); - } - }); - } - ; - } catch (Exception ex) - { - System.err.println("Exception whilst loading jalview XML file : "); - ex.printStackTrace(); - if (raiseGUI) - { - javax.swing.SwingUtilities.invokeLater(new Runnable() - { - public void run() - { - - JOptionPane.showInternalMessageDialog(Desktop.desktop, - "Error loading " + file, "Error loading Jalview file", - JOptionPane.WARNING_MESSAGE); - } - }); - } - } - - return af; - } - - AlignFrame LoadFromObject(JalviewModel object, String file) - { - Vector seqids = new Vector(); - SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0); - Sequence[] vamsasSeq = vamsasSet.getSequence(); - - JalviewModelSequence jms = object.getJalviewModelSequence(); - - // //////////////////////////////// - // LOAD SEQUENCES - jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length]; - JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq(); - for (int i = 0; i < vamsasSeq.length; i++) - { - jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(), - vamsasSeq[i].getSequence()); - jseqs[i].setStart(JSEQ[i].getStart()); - jseqs[i].setEnd(JSEQ[i].getEnd()); - seqids.add(jseqs[i]); - } - - // /SequenceFeatures are added to the DatasetSequence, - // so we must create the dataset before loading features - // /////////////////////////////// - jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs); - al.setDataset(null); - // /////////////////////////////// - - for (int i = 0; i < vamsasSeq.length; i++) - { - if (JSEQ[i].getFeaturesCount() > 0) - { - Features[] features = JSEQ[i].getFeatures(); - for (int f = 0; f < features.length; f++) - { - jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature( - features[f].getType(), features[f].getDescription(), - features[f].getStatus(), features[f].getBegin(), - features[f].getEnd(), null); - - al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf); - } - } - if (JSEQ[i].getPdbidsCount() > 0) - { - Pdbids[] ids = JSEQ[i].getPdbids(); - for (int p = 0; p < ids.length; p++) - { - jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry(); - entry.setId(ids[p].getId()); - entry.setType(ids[p].getType()); - al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); - } - - } - } - - // /////////////////////////////// - // //////////////////////////////// - // LOAD ANNOTATIONS - if (vamsasSet.getAnnotation() != null) - { - Annotation[] an = vamsasSet.getAnnotation(); - - for (int i = 0; i < an.length; i++) - { - AnnotationElement[] ae = an[i].getAnnotationElement(); - jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al - .getWidth()]; - - for (int aa = 0; aa < ae.length; aa++) - { - anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation( - ae[aa].getDisplayCharacter(), ae[aa].getDescription(), - ae[aa].getSecondaryStructure().charAt(0), - ae[aa].getValue()); - } - - jalview.datamodel.AlignmentAnnotation jaa = null; - - if (an[i].getGraph()) - { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), - an[i].getDescription(), anot, 0, 0, - jalview.datamodel.AlignmentAnnotation.BAR_GRAPH); - } - else - { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), - an[i].getDescription(), anot); - } - - al.addAnnotation(jaa); - } - } - - // /////////////////////////////// - // LOAD VIEWPORT - Viewport[] views = jms.getViewport(); - Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER - - AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight()); - - af.setFileName(file, "Jalview"); - - for (int i = 0; i < JSEQ.length; i++) - { - af.viewport.setSequenceColour(af.viewport.getAlignment() - .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour())); - } - - // af.changeColour() ); - // /////////////////////// - // LOAD GROUPS - if (jms.getJGroupCount() > 0) - { - JGroup[] groups = jms.getJGroup(); - - for (int i = 0; i < groups.length; i++) - { - ColourSchemeI cs = null; - - if (groups[i].getColour() != null) - { - if (groups[i].getColour().startsWith("ucs")) - { - cs = GetUserColourScheme(jms, groups[i].getColour()); - } - else - { - cs = ColourSchemeProperty.getColour(al, groups[i].getColour()); - } - - if (cs != null) - { - cs.setThreshold(groups[i].getPidThreshold(), true); - } - - } - - Vector seqs = new Vector(); - int[] ids = groups[i].getSeq(); - - for (int s = 0; s < ids.length; s++) - { - seqs.addElement((jalview.datamodel.SequenceI) seqids - .elementAt(ids[s])); - } - - jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup( - seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(), - groups[i].getDisplayText(), groups[i].getColourText(), - groups[i].getStart(), groups[i].getEnd()); - - sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour())); - - if (groups[i].getConsThreshold() != 0) - { - jalview.analysis.Conservation c = new jalview.analysis.Conservation( - "All", ResidueProperties.propHash, 3, - sg.getSequences(null), 0, sg.getWidth() - 1); - c.calculate(); - c.verdict(false, 25); - sg.cs.setConservation(c); - } - - al.addGroup(sg); - } - } - - af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(), - view.getHeight()); - af.viewport.setStartRes(view.getStartRes()); - af.viewport.setStartSeq(view.getStartSeq()); - af.viewport.setShowAnnotation(view.getShowAnnotation()); - af.viewport.setAbovePIDThreshold(view.getPidSelected()); - af.viewport.setColourText(view.getShowColourText()); - af.viewport.setConservationSelected(view.getConservationSelected()); - af.viewport.setShowJVSuffix(view.getShowFullId()); - af.viewport.setFont(new java.awt.Font(view.getFontName(), view - .getFontStyle(), view.getFontSize())); - af.alignPanel.fontChanged(); - - af.viewport.setRenderGaps(view.getRenderGaps()); - af.viewport.setWrapAlignment(view.getWrapAlignment()); - af.alignPanel.setWrapAlignment(view.getWrapAlignment()); - af.viewport.setShowAnnotation(view.getShowAnnotation()); - af.alignPanel.setAnnotationVisible(view.getShowAnnotation()); - af.viewport.setShowBoxes(view.getShowBoxes()); - af.viewport.setShowText(view.getShowText()); - - ColourSchemeI cs = null; - - if (view.getBgColour() != null) - { - if (view.getBgColour().startsWith("ucs")) - { - cs = GetUserColourScheme(jms, view.getBgColour()); - } - else - { - cs = ColourSchemeProperty.getColour(al, view.getBgColour()); - } - - if (cs != null) - { - cs.setThreshold(view.getPidThreshold(), true); - cs.setConsensus(af.viewport.getSequenceConsensusHash()); - } - } - - af.viewport.setGlobalColourScheme(cs); - af.viewport.setColourAppliesToAllGroups(false); - af.changeColour(cs); - if (view.getConservationSelected() && cs != null) - { - cs.setConservationInc(view.getConsThreshold()); - } - - af.viewport.setColourAppliesToAllGroups(true); - af.viewport.showSequenceFeatures = view.getShowSequenceFeatures(); - - if (jms.getFeatureSettings() != null) - { - af.viewport.featuresDisplayed = new Hashtable(); - String[] renderOrder = new String[jms.getFeatureSettings() - .getSettingCount()]; - for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) - { - Setting setting = jms.getFeatureSettings().getSetting(fs); - - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( - setting.getType(), new java.awt.Color(setting.getColour())); - - renderOrder[fs] = setting.getType(); - - if (setting.getDisplay()) - { - af.viewport.featuresDisplayed.put(setting.getType(), new Integer( - setting.getColour())); - } - } - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder; - } - - af.setMenusFromViewport(af.viewport); - - Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), - view.getHeight()); - - // LOAD TREES - // ///////////////////////////////////// - if (jms.getTreeCount() > 0) - { - try - { - for (int t = 0; t < jms.getTreeCount(); t++) - { - - Tree tree = jms.getTree(t); - - TreePanel tp = af.ShowNewickTree( - new jalview.io.NewickFile(tree.getNewick()), - tree.getTitle(), tree.getWidth(), tree.getHeight(), - tree.getXpos(), tree.getYpos()); - - tp.fitToWindow.setState(tree.getFitToWindow()); - tp.fitToWindow_actionPerformed(null); - - if (tree.getFontName() != null) - { - tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree - .getFontStyle(), tree.getFontSize())); - } - else - { - tp.setTreeFont(new java.awt.Font(view.getFontName(), view - .getFontStyle(), tree.getFontSize())); - } - - tp.showPlaceholders(tree.getMarkUnlinked()); - tp.showBootstrap(tree.getShowBootstrap()); - tp.showDistances(tree.getShowDistances()); - - tp.treeCanvas.threshold = tree.getThreshold(); - - if (tree.getCurrentTree()) - { - af.viewport.setCurrentTree(tp.getTree()); - } - } - - } catch (Exception ex) - { - ex.printStackTrace(); - } - - } - - return af; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +import java.io.*; +import java.net.*; +import java.util.*; +import java.util.jar.*; + +import javax.swing.*; + +import org.exolab.castor.xml.*; +import jalview.binding.*; +import jalview.schemes.*; +import jalview.util.jarInputStreamProvider; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ +public class Jalview2XML_V1 +{ + boolean raiseGUI = true; + + public Jalview2XML_V1() + { + + }; + + public Jalview2XML_V1(boolean raiseGUI) + { + this.raiseGUI = raiseGUI; + }; + + jalview.schemes.UserColourScheme GetUserColourScheme( + JalviewModelSequence jms, String id) + { + UserColours[] uc = jms.getUserColours(); + UserColours colours = null; + + for (int i = 0; i < uc.length; i++) + { + if (uc[i].getId().equals(id)) + { + colours = uc[i]; + + break; + } + } + + int csize = colours.getUserColourScheme().getColourCount(); + java.awt.Color[] newColours = new java.awt.Color[csize]; + + for (int i = 0; i < csize; i++) + { + newColours[i] = new java.awt.Color(Integer.parseInt(colours + .getUserColourScheme().getColour(i).getRGB(), 16)); + } + + return new jalview.schemes.UserColourScheme(newColours); + } + + /** + * DOCUMENT ME! + * + * @param file + * DOCUMENT ME! + */ + public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider) + { + final String file = jprovider.getFilename(); + jalview.gui.AlignFrame af = null; + + try + { + JarInputStream jin = null; + JarEntry jarentry = null; + int entryCount = 1; + + do + { + jin = jprovider.getJarInputStream(); + + for (int i = 0; i < entryCount; i++) + { + jarentry = jin.getNextJarEntry(); + } + + class NoDescIDResolver implements IDResolver + { + public Object resolve(String idref) + { + System.out.println(idref + " used"); + return null; + } + } + + if (jarentry != null) + { + InputStreamReader in = new InputStreamReader(jin, "UTF-8"); + JalviewModel object = new JalviewModel(); + + object = (JalviewModel) object.unmarshal(in); + + af = LoadFromObject(object, file); + entryCount++; + } + } while (jarentry != null); + } catch (final java.net.UnknownHostException ex) + { + ex.printStackTrace(); + if (raiseGUI) + { + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + + System.err.println("Couldn't locate Jalview XML file : " + ex + + "\n"); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Couldn't locate " + file, "URL not found", + JOptionPane.WARNING_MESSAGE); + } + }); + } + ; + } catch (Exception ex) + { + System.err.println("Exception whilst loading jalview XML file : "); + ex.printStackTrace(); + if (raiseGUI) + { + javax.swing.SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + + JOptionPane.showInternalMessageDialog(Desktop.desktop, + "Error loading " + file, "Error loading Jalview file", + JOptionPane.WARNING_MESSAGE); + } + }); + } + } + + return af; + } + + AlignFrame LoadFromObject(JalviewModel object, String file) + { + Vector seqids = new Vector(); + SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0); + Sequence[] vamsasSeq = vamsasSet.getSequence(); + + JalviewModelSequence jms = object.getJalviewModelSequence(); + + // //////////////////////////////// + // LOAD SEQUENCES + jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length]; + JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq(); + for (int i = 0; i < vamsasSeq.length; i++) + { + jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(), + vamsasSeq[i].getSequence()); + jseqs[i].setStart(JSEQ[i].getStart()); + jseqs[i].setEnd(JSEQ[i].getEnd()); + seqids.add(jseqs[i]); + } + + // /SequenceFeatures are added to the DatasetSequence, + // so we must create the dataset before loading features + // /////////////////////////////// + jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs); + al.setDataset(null); + // /////////////////////////////// + + for (int i = 0; i < vamsasSeq.length; i++) + { + if (JSEQ[i].getFeaturesCount() > 0) + { + Features[] features = JSEQ[i].getFeatures(); + for (int f = 0; f < features.length; f++) + { + jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature( + features[f].getType(), features[f].getDescription(), + features[f].getStatus(), features[f].getBegin(), + features[f].getEnd(), null); + + al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf); + } + } + if (JSEQ[i].getPdbidsCount() > 0) + { + Pdbids[] ids = JSEQ[i].getPdbids(); + for (int p = 0; p < ids.length; p++) + { + jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry(); + entry.setId(ids[p].getId()); + entry.setType(ids[p].getType()); + al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); + } + + } + } + + // /////////////////////////////// + // //////////////////////////////// + // LOAD ANNOTATIONS + if (vamsasSet.getAnnotation() != null) + { + Annotation[] an = vamsasSet.getAnnotation(); + + for (int i = 0; i < an.length; i++) + { + AnnotationElement[] ae = an[i].getAnnotationElement(); + jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al + .getWidth()]; + + for (int aa = 0; aa < ae.length; aa++) + { + anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation( + ae[aa].getDisplayCharacter(), ae[aa].getDescription(), + ae[aa].getSecondaryStructure().charAt(0), + ae[aa].getValue()); + } + + jalview.datamodel.AlignmentAnnotation jaa = null; + + if (an[i].getGraph()) + { + jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + an[i].getDescription(), anot, 0, 0, + jalview.datamodel.AlignmentAnnotation.BAR_GRAPH); + } + else + { + jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + an[i].getDescription(), anot); + } + + al.addAnnotation(jaa); + } + } + + // /////////////////////////////// + // LOAD VIEWPORT + Viewport[] views = jms.getViewport(); + Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER + + AlignFrame af = new AlignFrame(al, view.getWidth(), view.getHeight()); + + af.setFileName(file, "Jalview"); + + for (int i = 0; i < JSEQ.length; i++) + { + af.viewport.setSequenceColour(af.viewport.getAlignment() + .getSequenceAt(i), new java.awt.Color(JSEQ[i].getColour())); + } + + // af.changeColour() ); + // /////////////////////// + // LOAD GROUPS + if (jms.getJGroupCount() > 0) + { + JGroup[] groups = jms.getJGroup(); + + for (int i = 0; i < groups.length; i++) + { + ColourSchemeI cs = null; + + if (groups[i].getColour() != null) + { + if (groups[i].getColour().startsWith("ucs")) + { + cs = GetUserColourScheme(jms, groups[i].getColour()); + } + else + { + cs = ColourSchemeProperty.getColour(al, groups[i].getColour()); + } + + if (cs != null) + { + cs.setThreshold(groups[i].getPidThreshold(), true); + } + + } + + Vector seqs = new Vector(); + int[] ids = groups[i].getSeq(); + + for (int s = 0; s < ids.length; s++) + { + seqs.addElement((jalview.datamodel.SequenceI) seqids + .elementAt(ids[s])); + } + + jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup( + seqs, groups[i].getName(), cs, groups[i].getDisplayBoxes(), + groups[i].getDisplayText(), groups[i].getColourText(), + groups[i].getStart(), groups[i].getEnd()); + + sg.setOutlineColour(new java.awt.Color(groups[i].getOutlineColour())); + + if (groups[i].getConsThreshold() != 0) + { + jalview.analysis.Conservation c = new jalview.analysis.Conservation( + "All", ResidueProperties.propHash, 3, + sg.getSequences(null), 0, sg.getWidth() - 1); + c.calculate(); + c.verdict(false, 25); + sg.cs.setConservation(c); + } + + al.addGroup(sg); + } + } + + af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(), + view.getHeight()); + af.viewport.setStartRes(view.getStartRes()); + af.viewport.setStartSeq(view.getStartSeq()); + af.viewport.setShowAnnotation(view.getShowAnnotation()); + af.viewport.setAbovePIDThreshold(view.getPidSelected()); + af.viewport.setColourText(view.getShowColourText()); + af.viewport.setConservationSelected(view.getConservationSelected()); + af.viewport.setShowJVSuffix(view.getShowFullId()); + af.viewport.setFont(new java.awt.Font(view.getFontName(), view + .getFontStyle(), view.getFontSize())); + af.alignPanel.fontChanged(); + + af.viewport.setRenderGaps(view.getRenderGaps()); + af.viewport.setWrapAlignment(view.getWrapAlignment()); + af.alignPanel.setWrapAlignment(view.getWrapAlignment()); + af.viewport.setShowAnnotation(view.getShowAnnotation()); + af.alignPanel.setAnnotationVisible(view.getShowAnnotation()); + af.viewport.setShowBoxes(view.getShowBoxes()); + af.viewport.setShowText(view.getShowText()); + + ColourSchemeI cs = null; + + if (view.getBgColour() != null) + { + if (view.getBgColour().startsWith("ucs")) + { + cs = GetUserColourScheme(jms, view.getBgColour()); + } + else + { + cs = ColourSchemeProperty.getColour(al, view.getBgColour()); + } + + if (cs != null) + { + cs.setThreshold(view.getPidThreshold(), true); + cs.setConsensus(af.viewport.getSequenceConsensusHash()); + } + } + + af.viewport.setGlobalColourScheme(cs); + af.viewport.setColourAppliesToAllGroups(false); + af.changeColour(cs); + if (view.getConservationSelected() && cs != null) + { + cs.setConservationInc(view.getConsThreshold()); + } + + af.viewport.setColourAppliesToAllGroups(true); + af.viewport.showSequenceFeatures = view.getShowSequenceFeatures(); + + if (jms.getFeatureSettings() != null) + { + af.viewport.featuresDisplayed = new Hashtable(); + String[] renderOrder = new String[jms.getFeatureSettings() + .getSettingCount()]; + for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) + { + Setting setting = jms.getFeatureSettings().getSetting(fs); + + af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( + setting.getType(), new java.awt.Color(setting.getColour())); + + renderOrder[fs] = setting.getType(); + + if (setting.getDisplay()) + { + af.viewport.featuresDisplayed.put(setting.getType(), new Integer( + setting.getColour())); + } + } + af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder; + } + + af.setMenusFromViewport(af.viewport); + + Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), + view.getHeight()); + + // LOAD TREES + // ///////////////////////////////////// + if (jms.getTreeCount() > 0) + { + try + { + for (int t = 0; t < jms.getTreeCount(); t++) + { + + Tree tree = jms.getTree(t); + + TreePanel tp = af.ShowNewickTree( + new jalview.io.NewickFile(tree.getNewick()), + tree.getTitle(), tree.getWidth(), tree.getHeight(), + tree.getXpos(), tree.getYpos()); + + tp.fitToWindow.setState(tree.getFitToWindow()); + tp.fitToWindow_actionPerformed(null); + + if (tree.getFontName() != null) + { + tp.setTreeFont(new java.awt.Font(tree.getFontName(), tree + .getFontStyle(), tree.getFontSize())); + } + else + { + tp.setTreeFont(new java.awt.Font(view.getFontName(), view + .getFontStyle(), tree.getFontSize())); + } + + tp.showPlaceholders(tree.getMarkUnlinked()); + tp.showBootstrap(tree.getShowBootstrap()); + tp.showDistances(tree.getShowDistances()); + + tp.treeCanvas.threshold = tree.getThreshold(); + + if (tree.getCurrentTree()) + { + af.viewport.setCurrentTree(tp.getTree()); + } + } + + } catch (Exception ex) + { + ex.printStackTrace(); + } + + } + + return af; + } +} diff --git a/src/jalview/gui/JalviewAppender.java b/src/jalview/gui/JalviewAppender.java index 8077e07..3797c51 100644 --- a/src/jalview/gui/JalviewAppender.java +++ b/src/jalview/gui/JalviewAppender.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/JalviewChangeSupport.java b/src/jalview/gui/JalviewChangeSupport.java index 7b0273d..3983992 100644 --- a/src/jalview/gui/JalviewChangeSupport.java +++ b/src/jalview/gui/JalviewChangeSupport.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import java.beans.PropertyChangeEvent; @@ -83,4 +83,4 @@ public class JalviewChangeSupport implements PropertyChangeListener changeSupport.removePropertyChangeListener(propertyName, listener); } -} \ No newline at end of file +} diff --git a/src/jalview/gui/JalviewDialog.java b/src/jalview/gui/JalviewDialog.java index d034fd2..a74c435 100644 --- a/src/jalview/gui/JalviewDialog.java +++ b/src/jalview/gui/JalviewDialog.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import java.awt.Container; diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index 90f11c3..ac455bb 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/OOMWarning.java b/src/jalview/gui/OOMWarning.java index 2195fb2..41d986f 100644 --- a/src/jalview/gui/OOMWarning.java +++ b/src/jalview/gui/OOMWarning.java @@ -1,88 +1,88 @@ -/* - * 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 . - */ -package jalview.gui; - -import java.awt.Component; - -public class OOMWarning implements Runnable -{ - String action = null; - - String instructions = ""; - - public static boolean oomInprogress = false; - - Component desktop = null; - - /** - * Raise an out of memory error. - * - * @param action - * - what was going on when OutOfMemory exception occured. - * @param instance - * - Window where the dialog will appear - * @param oomex - * - the actual exception - to be written to stderr or debugger. - */ - OOMWarning(final String action, final OutOfMemoryError oomex, - final Component instance) - { - if (!oomInprogress) - { - oomInprogress = true; - this.action = action; - desktop = instance; - if (oomex != null) - { - if (jalview.bin.Cache.log != null) - { - jalview.bin.Cache.log - .error("Out of Memory when " + action, oomex); - } - else - { - System.err.println("Out of Memory when " + action); - oomex.printStackTrace(); - } - } - javax.swing.SwingUtilities.invokeLater(this); - System.gc(); - } - } - - public OOMWarning(String string, OutOfMemoryError oomerror) - { - this(string, oomerror, Desktop.desktop); - } - - public void run() - { - javax.swing.JOptionPane - .showInternalMessageDialog( - desktop, - "Out of memory when " - + action - + "!!" - + "\nSee help files for increasing Java Virtual Machine memory.", - "Out of memory", - javax.swing.JOptionPane.WARNING_MESSAGE); - // hope that there's enough memory left that no more appear. - oomInprogress = false; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.gui; + +import java.awt.Component; + +public class OOMWarning implements Runnable +{ + String action = null; + + String instructions = ""; + + public static boolean oomInprogress = false; + + Component desktop = null; + + /** + * Raise an out of memory error. + * + * @param action + * - what was going on when OutOfMemory exception occured. + * @param instance + * - Window where the dialog will appear + * @param oomex + * - the actual exception - to be written to stderr or debugger. + */ + OOMWarning(final String action, final OutOfMemoryError oomex, + final Component instance) + { + if (!oomInprogress) + { + oomInprogress = true; + this.action = action; + desktop = instance; + if (oomex != null) + { + if (jalview.bin.Cache.log != null) + { + jalview.bin.Cache.log + .error("Out of Memory when " + action, oomex); + } + else + { + System.err.println("Out of Memory when " + action); + oomex.printStackTrace(); + } + } + javax.swing.SwingUtilities.invokeLater(this); + System.gc(); + } + } + + public OOMWarning(String string, OutOfMemoryError oomerror) + { + this(string, oomerror, Desktop.desktop); + } + + public void run() + { + javax.swing.JOptionPane + .showInternalMessageDialog( + desktop, + "Out of memory when " + + action + + "!!" + + "\nSee help files for increasing Java Virtual Machine memory.", + "Out of memory", + javax.swing.JOptionPane.WARNING_MESSAGE); + // hope that there's enough memory left that no more appear. + oomInprogress = false; + } + +} diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index a45fe1b..eab240f 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import jalview.ws.params.ArgumentI; diff --git a/src/jalview/gui/OptsParametersContainerI.java b/src/jalview/gui/OptsParametersContainerI.java index 6d653b3..11d14c7 100644 --- a/src/jalview/gui/OptsParametersContainerI.java +++ b/src/jalview/gui/OptsParametersContainerI.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import jalview.gui.OptsAndParamsPage.ParamBox; diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index cad0fc1..0b97682 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 4266c32..f423a43 100755 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index 4b40df0..014f076 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index fedd8d2..6041e7b 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 282378d..4d23429 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index ca8d5a4..69d3eb7 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/PromptUserConfig.java b/src/jalview/gui/PromptUserConfig.java index 90302f3..cfe9da4 100644 --- a/src/jalview/gui/PromptUserConfig.java +++ b/src/jalview/gui/PromptUserConfig.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 46cf18f..f994f4e 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/RestInputParamEditDialog.java b/src/jalview/gui/RestInputParamEditDialog.java index 7016398..fc27d76 100644 --- a/src/jalview/gui/RestInputParamEditDialog.java +++ b/src/jalview/gui/RestInputParamEditDialog.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import java.util.ArrayList; diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index f4c5484..907446b 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.gui; import jalview.io.packed.DataProvider.JvDataType; diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index fccbedf..9f9f39c 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index f4b313b..89d315c 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/ScriptWindow.java b/src/jalview/gui/ScriptWindow.java index adebec8..fd1e37a 100644 --- a/src/jalview/gui/ScriptWindow.java +++ b/src/jalview/gui/ScriptWindow.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index be5c7ae..63c6033 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 9e99bae..3095c47 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -1,20 +1,21 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ + package jalview.gui; import java.util.*; diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 5f3982b..faebb1a 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.gui; diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index f657597..a4325fe 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 40b2cac..d7e452a 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java index 02f6011..9e75474 100755 --- a/src/jalview/gui/SplashScreen.java +++ b/src/jalview/gui/SplashScreen.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -315,4 +315,4 @@ public class SplashScreen extends JPanel implements Runnable, Desktop.hyperlinkUpdate(e); } -} \ No newline at end of file +} diff --git a/src/jalview/gui/TextColourChooser.java b/src/jalview/gui/TextColourChooser.java index 56bc5fb..8bc01b8 100644 --- a/src/jalview/gui/TextColourChooser.java +++ b/src/jalview/gui/TextColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index f208d77..d1003e5 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 161937e..5b51919 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index 53e4ad3..60c45c5 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java index f06eaa6..a232987 100644 --- a/src/jalview/gui/UserQuestionnaireCheck.java +++ b/src/jalview/gui/UserQuestionnaireCheck.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/VamsasApplication.java b/src/jalview/gui/VamsasApplication.java index 05024ec..4ec2ad4 100644 --- a/src/jalview/gui/VamsasApplication.java +++ b/src/jalview/gui/VamsasApplication.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index a220ae7..37e93b2 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -1,20 +1,21 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ + package jalview.gui; import java.awt.Component; diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 4fba5a5..16670b9 100755 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 2266bf8..8abbcee 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/WsParamSetManager.java b/src/jalview/gui/WsParamSetManager.java index ab859bd..bd8e43e 100644 --- a/src/jalview/gui/WsParamSetManager.java +++ b/src/jalview/gui/WsParamSetManager.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index cffb1d8..6be5d44 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/AMSAFile.java b/src/jalview/io/AMSAFile.java index 373a918..f63b177 100644 --- a/src/jalview/io/AMSAFile.java +++ b/src/jalview/io/AMSAFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 36dbdb6..6c1a343 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/AlignmentProperties.java b/src/jalview/io/AlignmentProperties.java index 5c4604f..9eb6d25 100644 --- a/src/jalview/io/AlignmentProperties.java +++ b/src/jalview/io/AlignmentProperties.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 7855fe3..45e6c47 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -1,1479 +1,1479 @@ -/* - * 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 . - */ -package jalview.io; - -import java.io.*; -import java.net.*; -import java.util.*; - -import jalview.analysis.*; -import jalview.datamodel.*; -import jalview.schemes.*; - -public class AnnotationFile -{ - public AnnotationFile() - { - init(); - } - - /** - * character used to write newlines - */ - protected String newline = System.getProperty("line.separator"); - - /** - * set new line string and reset the output buffer - * - * @param nl - */ - public void setNewlineString(String nl) - { - newline = nl; - init(); - } - - public String getNewlineString() - { - return newline; - } - - StringBuffer text; - - private void init() - { - text = new StringBuffer("JALVIEW_ANNOTATION" + newline + "# Created: " - + new java.util.Date() + newline + newline); - refSeq = null; - refSeqId = null; - } - - /** - * convenience method for pre-2.4 feature files which have no view, hidden - * columns or hidden row keywords. - * - * @param annotations - * @param list - * @param properties - * @return feature file as a string. - */ - public String printAnnotations(AlignmentAnnotation[] annotations, - List list, Hashtable properties) - { - return printAnnotations(annotations, list, properties, null); - - } - - /** - * hold all the information about a particular view definition read from or - * written out in an annotations file. - */ - public class ViewDef - { - public String viewname; - - public HiddenSequences hidseqs; - - public ColumnSelection hiddencols; - - public Vector visibleGroups; - - public Hashtable hiddenRepSeqs; - - public ViewDef(String viewname, HiddenSequences hidseqs, - ColumnSelection hiddencols, Hashtable hiddenRepSeqs) - { - this.viewname = viewname; - this.hidseqs = hidseqs; - this.hiddencols = hiddencols; - this.hiddenRepSeqs = hiddenRepSeqs; - } - } - - /** - * Prepare an annotation file given a set of annotations, groups, alignment - * properties and views. - * - * @param annotations - * @param list - * @param properties - * @param views - * @return annotation file - */ - public String printAnnotations(AlignmentAnnotation[] annotations, - List list, Hashtable properties, ViewDef[] views) - { - // TODO: resolve views issue : annotationFile could contain visible region, - // or full data + hidden region specifications for a view. - if (annotations != null) - { - boolean oneColour = true; - AlignmentAnnotation row; - String comma; - SequenceI refSeq = null; - SequenceGroup refGroup = null; - - StringBuffer colours = new StringBuffer(); - StringBuffer graphLine = new StringBuffer(); - StringBuffer rowprops = new StringBuffer(); - Hashtable graphGroup = new Hashtable(); - - java.awt.Color color; - - for (int i = 0; i < annotations.length; i++) - { - row = annotations[i]; - - if (!row.visible && !row.hasScore()) - { - continue; - } - - color = null; - oneColour = true; - - if (row.sequenceRef == null) - { - if (refSeq != null) - { - text.append(newline); - text.append("SEQUENCE_REF\tALIGNMENT"); - text.append(newline); - } - - refSeq = null; - } - - else - { - if (refSeq == null || refSeq != row.sequenceRef) - { - refSeq = row.sequenceRef; - text.append(newline); - text.append("SEQUENCE_REF\t"); - text.append(refSeq.getName()); - text.append(newline); - } - } - // mark any group references for the row - if (row.groupRef == null) - { - - if (refGroup != null) - { - text.append(newline); - text.append("GROUP_REF\tALIGNMENT"); - text.append(newline); - } - - refGroup = null; - } - else - { - if (refGroup == null || refGroup != row.groupRef) - { - refGroup = row.groupRef; - text.append(newline); - text.append("GROUP_REF\t"); - text.append(refGroup.getName()); - text.append(newline); - } - } - - boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false; - // lookahead to check what the annotation row object actually contains. - for (int j = 0; row.annotations != null - && j < row.annotations.length - && (!hasGlyphs || !hasLabels || !hasValues); j++) - { - if (row.annotations[j] != null) - { - hasLabels |= (row.annotations[j].displayCharacter != null - && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter - .equals(" ")); - hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' '); - hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't - // be - // rendered.. - hasText |= (row.annotations[j].description != null && row.annotations[j].description - .length() > 0); - } - } - - if (row.graph == AlignmentAnnotation.NO_GRAPH) - { - text.append("NO_GRAPH\t"); - hasValues = false; // only secondary structure - // hasLabels = false; // and annotation description string. - } - else - { - if (row.graph == AlignmentAnnotation.BAR_GRAPH) - { - text.append("BAR_GRAPH\t"); - hasGlyphs = false; // no secondary structure - - } - else if (row.graph == AlignmentAnnotation.LINE_GRAPH) - { - hasGlyphs = false; // no secondary structure - text.append("LINE_GRAPH\t"); - } - - if (row.getThreshold() != null) - { - graphLine.append("GRAPHLINE\t"); - graphLine.append(row.label); - graphLine.append("\t"); - graphLine.append(row.getThreshold().value); - graphLine.append("\t"); - graphLine.append(row.getThreshold().label); - graphLine.append("\t"); - graphLine.append(jalview.util.Format.getHexString(row - .getThreshold().colour)); - graphLine.append(newline); - } - - if (row.graphGroup > -1) - { - String key = String.valueOf(row.graphGroup); - if (graphGroup.containsKey(key)) - { - graphGroup.put(key, graphGroup.get(key) + "\t" + row.label); - } - else - { - graphGroup.put(key, row.label); - } - } - } - - text.append(row.label + "\t"); - if (row.description != null) - { - text.append(row.description + "\t"); - } - for (int j = 0; row.annotations != null - && j < row.annotations.length; j++) - { - if (refSeq != null - && jalview.util.Comparison.isGap(refSeq.getCharAt(j))) - { - continue; - } - - if (row.annotations[j] != null) - { - comma = ""; - if (hasGlyphs) // could be also hasGlyphs || ... - { - - text.append(comma); - if (row.annotations[j].secondaryStructure != ' ') - { - // only write out the field if its not whitespace. - text.append(row.annotations[j].secondaryStructure); - } - comma = ","; - } - if (hasValues) - { - if (row.annotations[j].value != Float.NaN) - { - text.append(comma + row.annotations[j].value); - } - else - { - System.err.println("Skipping NaN - not valid value."); - text.append(comma + 0f);// row.annotations[j].value); - } - comma = ","; - } - if (hasLabels) - { - // TODO: labels are emitted after values for bar graphs. - if // empty labels are allowed, so - (row.annotations[j].displayCharacter != null - && row.annotations[j].displayCharacter.length() > 0 - && !row.annotations[j].displayCharacter.equals(" ")) - { - text.append(comma + row.annotations[j].displayCharacter); - comma = ","; - } - } - if (hasText) - { - if (row.annotations[j].description != null - && row.annotations[j].description.length() > 0 - && !row.annotations[j].description - .equals(row.annotations[j].displayCharacter)) - { - text.append(comma + row.annotations[j].description); - comma = ","; - } - } - if (color != null && !color.equals(row.annotations[j].colour)) - { - oneColour = false; - } - - color = row.annotations[j].colour; - - if (row.annotations[j].colour != null - && row.annotations[j].colour != java.awt.Color.black) - { - text.append(comma - + "[" - + jalview.util.Format - .getHexString(row.annotations[j].colour) - + "]"); - comma = ","; - } - } - text.append("|"); - } - - if (row.hasScore()) - text.append("\t" + row.score); - - text.append(newline); - - if (color != null && color != java.awt.Color.black && oneColour) - { - colours.append("COLOUR\t"); - colours.append(row.label); - colours.append("\t"); - colours.append(jalview.util.Format.getHexString(color)); - colours.append(newline); - } - if (row.scaleColLabel || row.showAllColLabels - || row.centreColLabels) - { - rowprops.append("ROWPROPERTIES\t"); - rowprops.append(row.label); - rowprops.append("\tscaletofit="); - rowprops.append(row.scaleColLabel); - rowprops.append("\tshowalllabs="); - rowprops.append(row.showAllColLabels); - rowprops.append("\tcentrelabs="); - rowprops.append(row.centreColLabels); - rowprops.append(newline); - } - } - - text.append(newline); - - text.append(colours.toString()); - text.append(graphLine.toString()); - if (graphGroup.size() > 0) - { - text.append("COMBINE\t"); - Enumeration en = graphGroup.elements(); - while (en.hasMoreElements()) - { - text.append(en.nextElement()); - text.append(newline); - } - } - text.append(rowprops.toString()); - } - - if (list != null) - { - printGroups(list); - } - - if (properties != null) - { - text.append(newline); - text.append(newline); - text.append("ALIGNMENT"); - Enumeration en = properties.keys(); - while (en.hasMoreElements()) - { - String key = en.nextElement().toString(); - text.append("\t"); - text.append(key); - text.append("="); - text.append(properties.get(key)); - } - // TODO: output alignment visualization settings here if required - - } - - return text.toString(); - } - - public void printGroups(List list) - { - SequenceI seqrep = null; - for (SequenceGroup sg : list) - { - if (!sg.hasSeqrep()) - { - text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t" - + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1) - + "\t" + "-1\t"); - seqrep = null; - } - else - { - seqrep = sg.getSeqrep(); - text.append("SEQUENCE_REF\t"); - text.append(seqrep.getName()); - text.append(newline); - text.append("SEQUENCE_GROUP\t"); - text.append(sg.getName()); - text.append("\t"); - text.append((seqrep.findPosition(sg.getStartRes()))); - text.append("\t"); - text.append((seqrep.findPosition(sg.getEndRes()))); - text.append("\t"); - text.append("-1\t"); - } - for (int s = 0; s < sg.getSize(); s++) - { - text.append(sg.getSequenceAt(s).getName()); - text.append("\t"); - } - text.append(newline); - text.append("PROPERTIES\t"); - text.append(sg.getName()); - text.append("\t"); - - if (sg.getDescription() != null) - { - text.append("description="); - text.append(sg.getDescription()); - text.append("\t"); - } - if (sg.cs != null) - { - text.append("colour="); - text.append(ColourSchemeProperty.getColourName(sg.cs)); - text.append("\t"); - if (sg.cs.getThreshold() != 0) - { - text.append("pidThreshold="); - text.append(sg.cs.getThreshold()); - } - if (sg.cs.conservationApplied()) - { - text.append("consThreshold="); - text.append(sg.cs.getConservationInc()); - text.append("\t"); - } - } - text.append("outlineColour="); - text.append(jalview.util.Format.getHexString(sg.getOutlineColour())); - text.append("\t"); - - text.append("displayBoxes="); - text.append(sg.getDisplayBoxes()); - text.append("\t"); - text.append("displayText="); - text.append(sg.getDisplayText()); - text.append("\t"); - text.append("colourText="); - text.append(sg.getColourText()); - text.append("\t"); - text.append("showUnconserved="); - text.append(sg.getShowNonconserved()); - text.append("\t"); - if (sg.textColour != java.awt.Color.black) - { - text.append("textCol1="); - text.append(jalview.util.Format.getHexString(sg.textColour)); - text.append("\t"); - } - if (sg.textColour2 != java.awt.Color.white) - { - text.append("textCol2="); - text.append(jalview.util.Format.getHexString(sg.textColour2)); - text.append("\t"); - } - if (sg.thresholdTextColour != 0) - { - text.append("textColThreshold="); - text.append(sg.thresholdTextColour); - text.append("\t"); - } - if (sg.idColour != null) - { - text.append("idColour="); - text.append(jalview.util.Format.getHexString(sg.idColour)); - text.append("\t"); - } - if (sg.isHidereps()) - { - text.append("hide=true\t"); - } - if (sg.isHideCols()) - { - text.append("hidecols=true\t"); - } - if (seqrep != null) - { - // terminate the last line and clear the sequence ref for the group - text.append(newline); - text.append("SEQUENCE_REF"); - } - text.append(newline); - text.append(newline); - - } - } - - SequenceI refSeq = null; - - String refSeqId = null; - - public boolean readAnnotationFile(AlignmentI al, String file, - String protocol) - { - BufferedReader in = null; - try - { - if (protocol.equals(AppletFormatAdapter.FILE)) - { - in = new BufferedReader(new FileReader(file)); - } - else if (protocol.equals(AppletFormatAdapter.URL)) - { - URL url = new URL(file); - in = new BufferedReader(new InputStreamReader(url.openStream())); - } - else if (protocol.equals(AppletFormatAdapter.PASTE)) - { - in = new BufferedReader(new StringReader(file)); - } - else if (protocol.equals(AppletFormatAdapter.CLASSLOADER)) - { - java.io.InputStream is = getClass().getResourceAsStream("/" + file); - if (is != null) - { - in = new BufferedReader(new java.io.InputStreamReader(is)); - } - } - if (in != null) - { - return parseAnnotationFrom(al, in); - } - - } catch (Exception ex) - { - ex.printStackTrace(); - System.out.println("Problem reading annotation file: " + ex); - return false; - } - return false; - } - - public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) - throws Exception - { - boolean modified = false; - String groupRef = null; - Hashtable groupRefRows = new Hashtable(); - - Hashtable autoAnnots = new Hashtable(); - { - String line, label, description, token; - int graphStyle, index; - int refSeqIndex = 1; - int existingAnnotations = 0; - // when true - will add new rows regardless of whether they are duplicate - // auto-annotation like consensus or conservation graphs - boolean overrideAutoAnnot = false; - if (al.getAlignmentAnnotation() != null) - { - existingAnnotations = al.getAlignmentAnnotation().length; - if (existingAnnotations > 0) - { - AlignmentAnnotation[] aa = al.getAlignmentAnnotation(); - for (int aai = 0; aai < aa.length; aai++) - { - if (aa[aai].autoCalculated) - { - // make a note of the name and description - autoAnnots.put( - autoAnnotsKey(aa[aai], aa[aai].sequenceRef, - (aa[aai].groupRef == null ? null - : aa[aai].groupRef.getName())), - new Integer(1)); - } - } - } - } - - int alWidth = al.getWidth(); - - StringTokenizer st; - Annotation[] annotations; - AlignmentAnnotation annotation = null; - - // First confirm this is an Annotation file - boolean jvAnnotationFile = false; - while ((line = in.readLine()) != null) - { - if (line.indexOf("#") == 0) - { - continue; - } - - if (line.indexOf("JALVIEW_ANNOTATION") > -1) - { - jvAnnotationFile = true; - break; - } - } - - if (!jvAnnotationFile) - { - in.close(); - return false; - } - - while ((line = in.readLine()) != null) - { - if (line.indexOf("#") == 0 - || line.indexOf("JALVIEW_ANNOTATION") > -1 - || line.length() == 0) - { - continue; - } - - st = new StringTokenizer(line, "\t"); - token = st.nextToken(); - if (token.equalsIgnoreCase("COLOUR")) - { - // TODO: use graduated colour def'n here too - colourAnnotations(al, st.nextToken(), st.nextToken()); - modified = true; - continue; - } - - else if (token.equalsIgnoreCase("COMBINE")) - { - combineAnnotations(al, st); - modified = true; - continue; - } - else if (token.equalsIgnoreCase("ROWPROPERTIES")) - { - addRowProperties(al, st); - modified = true; - continue; - } - else if (token.equalsIgnoreCase("GRAPHLINE")) - { - addLine(al, st); - modified = true; - continue; - } - - else if (token.equalsIgnoreCase("SEQUENCE_REF")) - { - if (st.hasMoreTokens()) - { - refSeq = al.findName(refSeqId = st.nextToken()); - if (refSeq == null) - { - refSeqId = null; - } - try - { - refSeqIndex = Integer.parseInt(st.nextToken()); - if (refSeqIndex < 1) - { - refSeqIndex = 1; - System.out - .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile"); - } - } catch (Exception ex) - { - refSeqIndex = 1; - } - } - else - { - refSeq = null; - refSeqId = null; - } - continue; - } - else if (token.equalsIgnoreCase("GROUP_REF")) - { - // Group references could be forward or backwards, so they are - // resolved after the whole file is read in - groupRef = null; - if (st.hasMoreTokens()) - { - groupRef = st.nextToken(); - if (groupRef.length() < 1) - { - groupRef = null; // empty string - } - else - { - if (groupRefRows.get(groupRef) == null) - { - groupRefRows.put(groupRef, new Vector()); - } - } - } - continue; - } - else if (token.equalsIgnoreCase("SEQUENCE_GROUP")) - { - addGroup(al, st); - continue; - } - - else if (token.equalsIgnoreCase("PROPERTIES")) - { - addProperties(al, st); - modified = true; - continue; - } - - else if (token.equalsIgnoreCase("BELOW_ALIGNMENT")) - { - setBelowAlignment(al, st); - modified = true; - continue; - } - else if (token.equalsIgnoreCase("ALIGNMENT")) - { - addAlignmentDetails(al, st); - modified = true; - continue; - } - - // Parse out the annotation row - graphStyle = AlignmentAnnotation.getGraphValueFromString(token); - label = st.nextToken(); - - index = 0; - annotations = new Annotation[alWidth]; - description = null; - float score = Float.NaN; - - if (st.hasMoreTokens()) - { - line = st.nextToken(); - - if (line.indexOf("|") == -1) - { - description = line; - if (st.hasMoreTokens()) - line = st.nextToken(); - } - - if (st.hasMoreTokens()) - { - // This must be the score - score = Float.valueOf(st.nextToken()).floatValue(); - } - - st = new StringTokenizer(line, "|", true); - - boolean emptyColumn = true; - boolean onlyOneElement = (st.countTokens() == 1); - - while (st.hasMoreElements() && index < alWidth) - { - token = st.nextToken().trim(); - - if (onlyOneElement) - { - try - { - score = Float.valueOf(token).floatValue(); - break; - } catch (NumberFormatException ex) - { - } - } - - if (token.equals("|")) - { - if (emptyColumn) - { - index++; - } - - emptyColumn = true; - } - else - { - annotations[index++] = parseAnnotation(token, graphStyle); - emptyColumn = false; - } - } - - } - - annotation = new AlignmentAnnotation(label, description, - (index == 0) ? null : annotations, 0, 0, graphStyle); - - annotation.score = score; - if (!overrideAutoAnnot - && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq, - groupRef))) - { - // skip - we've already got an automatic annotation of this type. - continue; - } - // otherwise add it! - if (refSeq != null) - { - - annotation.belowAlignment = false; - // make a copy of refSeq so we can find other matches in the alignment - SequenceI referedSeq = refSeq; - do - { - // copy before we do any mapping business. - // TODO: verify that undo/redo with 1:many sequence associated - // annotations can be undone correctly - AlignmentAnnotation ann = new AlignmentAnnotation(annotation); - annotation - .createSequenceMapping(referedSeq, refSeqIndex, false); - annotation.adjustForAlignment(); - referedSeq.addAlignmentAnnotation(annotation); - al.addAnnotation(annotation); - al.setAnnotationIndex(annotation, - al.getAlignmentAnnotation().length - - existingAnnotations - 1); - if (groupRef != null) - { - ((Vector) groupRefRows.get(groupRef)).addElement(annotation); - } - // and recover our virgin copy to use again if necessary. - annotation = ann; - - } while (refSeqId != null - && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null); - } - else - { - al.addAnnotation(annotation); - al.setAnnotationIndex(annotation, - al.getAlignmentAnnotation().length - existingAnnotations - - 1); - if (groupRef != null) - { - ((Vector) groupRefRows.get(groupRef)).addElement(annotation); - } - } - // and set modification flag - modified = true; - } - // Finally, resolve the groupRefs - Enumeration en = groupRefRows.keys(); - - while (en.hasMoreElements()) - { - groupRef = (String) en.nextElement(); - boolean matched = false; - // Resolve group: TODO: add a getGroupByName method to alignments - for (SequenceGroup theGroup : al.getGroups()) - { - if (theGroup.getName().equals(groupRef)) - { - if (matched) - { - // TODO: specify and implement duplication of alignment annotation - // for multiple group references. - System.err - .println("Ignoring 1:many group reference mappings for group name '" - + groupRef + "'"); - } - else - { - matched = true; - Vector rowset = (Vector) groupRefRows.get(groupRef); - if (rowset != null && rowset.size() > 0) - { - AlignmentAnnotation alan = null; - for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++) - { - alan = (AlignmentAnnotation) rowset.elementAt(elm); - alan.groupRef = theGroup; - } - } - } - } - } - ((Vector) groupRefRows.get(groupRef)).removeAllElements(); - } - } - return modified; - } - - private Object autoAnnotsKey(AlignmentAnnotation annotation, - SequenceI refSeq, String groupRef) - { - return annotation.graph + "\t" + annotation.label + "\t" - + annotation.description + "\t" - + (refSeq != null ? refSeq.getDisplayId(true) : ""); - } - - Annotation parseAnnotation(String string, int graphStyle) - { - boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't - // do the - // glyph - // test - // if we - // don't - // want - // secondary - // structure - String desc = null, displayChar = null; - char ss = ' '; // secondaryStructure - float value = 0; - boolean parsedValue = false, dcset = false; - - // find colour here - java.awt.Color colour = null; - int i = string.indexOf("["); - int j = string.indexOf("]"); - if (i > -1 && j > -1) - { - UserColourScheme ucs = new UserColourScheme(); - - colour = ucs.getColourFromString(string.substring(i + 1, j)); - if (i > 0 && string.charAt(i - 1) == ',') - { - // clip the preceding comma as well - i--; - } - string = string.substring(0, i) + string.substring(j + 1); - } - - StringTokenizer st = new StringTokenizer(string, ",", true); - String token; - boolean seenContent = false; - int pass = 0; - while (st.hasMoreTokens()) - { - pass++; - token = st.nextToken().trim(); - if (token.equals(",")) - { - if (!seenContent && parsedValue && !dcset) - { - // allow the value below the bar/line to be empty - dcset = true; - displayChar = " "; - } - seenContent = false; - continue; - } - else - { - seenContent = true; - } - - if (!parsedValue) - { - try - { - displayChar = token; - // foo - value = new Float(token).floatValue(); - parsedValue = true; - continue; - } catch (NumberFormatException ex) - { - } - } - else - { - if (token.length() == 1) - { - displayChar = token; - } - } - if (hasSymbols - && (token.equals("H") || token.equals("E") - || token.equals("S") || token.equals(" "))) - { - // Either this character represents a helix or sheet - // or an integer which can be displayed - ss = token.charAt(0); - if (displayChar.equals(token.substring(0, 1))) - { - displayChar = ""; - } - } - else if (desc == null || (parsedValue && pass > 2)) - { - desc = token; - } - - } - // if (!dcset && string.charAt(string.length() - 1) == ',') - // { - // displayChar = " "; // empty display char symbol. - // } - if (displayChar != null && desc != null && desc.length() == 1) - { - if (displayChar.length() > 1) - { - // switch desc and displayChar - legacy support - String tmp = displayChar; - displayChar = desc; - desc = tmp; - } - else - { - if (displayChar.equals(desc)) - { - // duplicate label - hangover from the 'robust parser' above - desc = null; - } - } - } - Annotation anot = new Annotation(displayChar, desc, ss, value); - - anot.colour = colour; - - return anot; - } - - void colourAnnotations(AlignmentI al, String label, String colour) - { - UserColourScheme ucs = new UserColourScheme(colour); - Annotation[] annotations; - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label)) - { - annotations = al.getAlignmentAnnotation()[i].annotations; - for (int j = 0; j < annotations.length; j++) - { - if (annotations[j] != null) - { - annotations[j].colour = ucs.findColour('A'); - } - } - } - } - } - - void combineAnnotations(AlignmentI al, StringTokenizer st) - { - int graphGroup = -1; - String group = st.nextToken(); - // First make sure we are not overwriting the graphIndex - if (al.getAlignmentAnnotation() != null) - { - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) - { - graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1; - al.getAlignmentAnnotation()[i].graphGroup = graphGroup; - break; - } - } - - // Now update groups - while (st.hasMoreTokens()) - { - group = st.nextToken(); - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) - { - al.getAlignmentAnnotation()[i].graphGroup = graphGroup; - break; - } - } - } - } - else - { - System.err - .println("Couldn't combine annotations. None are added to alignment yet!"); - } - } - - void addLine(AlignmentI al, StringTokenizer st) - { - String group = st.nextToken(); - AlignmentAnnotation annotation = null, alannot[] = al - .getAlignmentAnnotation(); - if (alannot != null) - { - for (int i = 0; i < alannot.length; i++) - { - if (alannot[i].label.equalsIgnoreCase(group)) - { - annotation = alannot[i]; - break; - } - } - } - if (annotation == null) - { - return; - } - float value = new Float(st.nextToken()).floatValue(); - String label = st.hasMoreTokens() ? st.nextToken() : null; - java.awt.Color colour = null; - if (st.hasMoreTokens()) - { - UserColourScheme ucs = new UserColourScheme(st.nextToken()); - colour = ucs.findColour('A'); - } - - annotation.setThreshold(new GraphLine(value, label, colour)); - } - - void addGroup(AlignmentI al, StringTokenizer st) - { - SequenceGroup sg = new SequenceGroup(); - sg.setName(st.nextToken()); - String rng = ""; - try - { - rng = st.nextToken(); - if (rng.length() > 0 && !rng.startsWith("*")) - { - sg.setStartRes(Integer.parseInt(rng) - 1); - } - else - { - sg.setStartRes(0); - } - rng = st.nextToken(); - if (rng.length() > 0 && !rng.startsWith("*")) - { - sg.setEndRes(Integer.parseInt(rng) - 1); - } - else - { - sg.setEndRes(al.getWidth() - 1); - } - } catch (Exception e) - { - System.err - .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '" - + rng + "' - assuming alignment width for group."); - // assume group is full width - sg.setStartRes(0); - sg.setEndRes(al.getWidth() - 1); - } - - String index = st.nextToken(); - if (index.equals("-1")) - { - while (st.hasMoreElements()) - { - sg.addSequence(al.findName(st.nextToken()), false); - } - } - else - { - StringTokenizer st2 = new StringTokenizer(index, ","); - - while (st2.hasMoreTokens()) - { - String tmp = st2.nextToken(); - if (tmp.equals("*")) - { - for (int i = 0; i < al.getHeight(); i++) - { - sg.addSequence(al.getSequenceAt(i), false); - } - } - else if (tmp.indexOf("-") >= 0) - { - StringTokenizer st3 = new StringTokenizer(tmp, "-"); - - int start = (Integer.parseInt(st3.nextToken())); - int end = (Integer.parseInt(st3.nextToken())); - - if (end > start) - { - for (int i = start; i <= end; i++) - { - sg.addSequence(al.getSequenceAt(i - 1), false); - } - } - } - else - { - sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false); - } - } - } - - if (refSeq != null) - { - sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1); - sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1); - sg.setSeqrep(refSeq); - } - - if (sg.getSize() > 0) - { - al.addGroup(sg); - } - } - - void addRowProperties(AlignmentI al, StringTokenizer st) - { - String label = st.nextToken(), keyValue, key, value; - boolean scaletofit = false, centerlab = false, showalllabs = false; - while (st.hasMoreTokens()) - { - keyValue = st.nextToken(); - key = keyValue.substring(0, keyValue.indexOf("=")); - value = keyValue.substring(keyValue.indexOf("=") + 1); - if (key.equalsIgnoreCase("scaletofit")) - { - scaletofit = Boolean.valueOf(value).booleanValue(); - } - if (key.equalsIgnoreCase("showalllabs")) - { - showalllabs = Boolean.valueOf(value).booleanValue(); - } - if (key.equalsIgnoreCase("centrelabs")) - { - centerlab = Boolean.valueOf(value).booleanValue(); - } - AlignmentAnnotation[] alr = al.getAlignmentAnnotation(); - if (alr != null) - { - for (int i = 0; i < alr.length; i++) - { - if (alr[i].label.equalsIgnoreCase(label)) - { - alr[i].centreColLabels = centerlab; - alr[i].scaleColLabel = scaletofit; - alr[i].showAllColLabels = showalllabs; - } - } - } - } - } - - void addProperties(AlignmentI al, StringTokenizer st) - { - - // So far we have only added groups to the annotationHash, - // the idea is in the future properties can be added to - // alignments, other annotations etc - if (al.getGroups() == null) - { - return; - } - - String name = st.nextToken(); - SequenceGroup sg = null; - for (SequenceGroup _sg : al.getGroups()) - { - if ((sg = _sg).getName().equals(name)) - { - break; - } - else - { - sg = null; - } - } - - if (sg != null) - { - String keyValue, key, value; - ColourSchemeI def = sg.cs; - sg.cs = null; - while (st.hasMoreTokens()) - { - keyValue = st.nextToken(); - key = keyValue.substring(0, keyValue.indexOf("=")); - value = keyValue.substring(keyValue.indexOf("=") + 1); - - if (key.equalsIgnoreCase("description")) - { - sg.setDescription(value); - } - else if (key.equalsIgnoreCase("colour")) - { - sg.cs = ColourSchemeProperty.getColour(al, value); - } - else if (key.equalsIgnoreCase("pidThreshold")) - { - sg.cs.setThreshold(Integer.parseInt(value), true); - - } - else if (key.equalsIgnoreCase("consThreshold")) - { - sg.cs.setConservationInc(Integer.parseInt(value)); - Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, sg.getSequences(null), - sg.getStartRes(), sg.getEndRes() + 1); - - c.calculate(); - c.verdict(false, 25); // TODO: refer to conservation percent threshold - - sg.cs.setConservation(c); - - } - else if (key.equalsIgnoreCase("outlineColour")) - { - sg.setOutlineColour(new UserColourScheme(value).findColour('A')); - } - else if (key.equalsIgnoreCase("displayBoxes")) - { - sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue()); - } - else if (key.equalsIgnoreCase("showUnconserved")) - { - sg.setShowNonconserved(Boolean.valueOf(value).booleanValue()); - } - else if (key.equalsIgnoreCase("displayText")) - { - sg.setDisplayText(Boolean.valueOf(value).booleanValue()); - } - else if (key.equalsIgnoreCase("colourText")) - { - sg.setColourText(Boolean.valueOf(value).booleanValue()); - } - else if (key.equalsIgnoreCase("textCol1")) - { - sg.textColour = new UserColourScheme(value).findColour('A'); - } - else if (key.equalsIgnoreCase("textCol2")) - { - sg.textColour2 = new UserColourScheme(value).findColour('A'); - } - else if (key.equalsIgnoreCase("textColThreshold")) - { - sg.thresholdTextColour = Integer.parseInt(value); - } - else if (key.equalsIgnoreCase("idColour")) - { - // consider warning if colour doesn't resolve to a real colour - sg.setIdColour((def = new UserColourScheme(value)) - .findColour('A')); - } - else if (key.equalsIgnoreCase("hide")) - { - // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847 - sg.setHidereps(true); - } - else if (key.equalsIgnoreCase("hidecols")) - { - // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847 - sg.setHideCols(true); - } - sg.recalcConservation(); - } - if (sg.cs == null) - { - sg.cs = def; - } - } - } - - void setBelowAlignment(AlignmentI al, StringTokenizer st) - { - String token; - AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation(); - if (ala == null) - { - System.err - .print("Warning - no annotation to set below for sequence associated annotation:"); - } - while (st.hasMoreTokens()) - { - token = st.nextToken(); - if (ala == null) - { - System.err.print(" " + token); - } - else - { - for (int i = 0; i < al.getAlignmentAnnotation().length; i++) - { - aa = al.getAlignmentAnnotation()[i]; - if (aa.sequenceRef == refSeq && aa.label.equals(token)) - { - aa.belowAlignment = true; - } - } - } - } - if (ala == null) - { - System.err.print("\n"); - } - } - - void addAlignmentDetails(AlignmentI al, StringTokenizer st) - { - String keyValue, key, value; - while (st.hasMoreTokens()) - { - keyValue = st.nextToken(); - key = keyValue.substring(0, keyValue.indexOf("=")); - value = keyValue.substring(keyValue.indexOf("=") + 1); - al.setProperty(key, value); - } - } - - /** - * Write annotations as a CSV file of the form 'label, value, value, ...' for - * each row. - * - * @param annotations - * @return CSV file as a string. - */ - public String printCSVAnnotations(AlignmentAnnotation[] annotations) - { - StringBuffer sp = new StringBuffer(); - for (int i = 0; i < annotations.length; i++) - { - String atos = annotations[i].toString(); - int p = 0; - do - { - int cp = atos.indexOf("\n", p); - sp.append(annotations[i].label); - sp.append(","); - if (cp > p) - { - sp.append(atos.substring(p, cp + 1)); - } - else - { - sp.append(atos.substring(p)); - sp.append(newline); - } - p = cp + 1; - } while (p > 0); - } - return sp.toString(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io; + +import java.io.*; +import java.net.*; +import java.util.*; + +import jalview.analysis.*; +import jalview.datamodel.*; +import jalview.schemes.*; + +public class AnnotationFile +{ + public AnnotationFile() + { + init(); + } + + /** + * character used to write newlines + */ + protected String newline = System.getProperty("line.separator"); + + /** + * set new line string and reset the output buffer + * + * @param nl + */ + public void setNewlineString(String nl) + { + newline = nl; + init(); + } + + public String getNewlineString() + { + return newline; + } + + StringBuffer text; + + private void init() + { + text = new StringBuffer("JALVIEW_ANNOTATION" + newline + "# Created: " + + new java.util.Date() + newline + newline); + refSeq = null; + refSeqId = null; + } + + /** + * convenience method for pre-2.4 feature files which have no view, hidden + * columns or hidden row keywords. + * + * @param annotations + * @param list + * @param properties + * @return feature file as a string. + */ + public String printAnnotations(AlignmentAnnotation[] annotations, + List list, Hashtable properties) + { + return printAnnotations(annotations, list, properties, null); + + } + + /** + * hold all the information about a particular view definition read from or + * written out in an annotations file. + */ + public class ViewDef + { + public String viewname; + + public HiddenSequences hidseqs; + + public ColumnSelection hiddencols; + + public Vector visibleGroups; + + public Hashtable hiddenRepSeqs; + + public ViewDef(String viewname, HiddenSequences hidseqs, + ColumnSelection hiddencols, Hashtable hiddenRepSeqs) + { + this.viewname = viewname; + this.hidseqs = hidseqs; + this.hiddencols = hiddencols; + this.hiddenRepSeqs = hiddenRepSeqs; + } + } + + /** + * Prepare an annotation file given a set of annotations, groups, alignment + * properties and views. + * + * @param annotations + * @param list + * @param properties + * @param views + * @return annotation file + */ + public String printAnnotations(AlignmentAnnotation[] annotations, + List list, Hashtable properties, ViewDef[] views) + { + // TODO: resolve views issue : annotationFile could contain visible region, + // or full data + hidden region specifications for a view. + if (annotations != null) + { + boolean oneColour = true; + AlignmentAnnotation row; + String comma; + SequenceI refSeq = null; + SequenceGroup refGroup = null; + + StringBuffer colours = new StringBuffer(); + StringBuffer graphLine = new StringBuffer(); + StringBuffer rowprops = new StringBuffer(); + Hashtable graphGroup = new Hashtable(); + + java.awt.Color color; + + for (int i = 0; i < annotations.length; i++) + { + row = annotations[i]; + + if (!row.visible && !row.hasScore()) + { + continue; + } + + color = null; + oneColour = true; + + if (row.sequenceRef == null) + { + if (refSeq != null) + { + text.append(newline); + text.append("SEQUENCE_REF\tALIGNMENT"); + text.append(newline); + } + + refSeq = null; + } + + else + { + if (refSeq == null || refSeq != row.sequenceRef) + { + refSeq = row.sequenceRef; + text.append(newline); + text.append("SEQUENCE_REF\t"); + text.append(refSeq.getName()); + text.append(newline); + } + } + // mark any group references for the row + if (row.groupRef == null) + { + + if (refGroup != null) + { + text.append(newline); + text.append("GROUP_REF\tALIGNMENT"); + text.append(newline); + } + + refGroup = null; + } + else + { + if (refGroup == null || refGroup != row.groupRef) + { + refGroup = row.groupRef; + text.append(newline); + text.append("GROUP_REF\t"); + text.append(refGroup.getName()); + text.append(newline); + } + } + + boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false; + // lookahead to check what the annotation row object actually contains. + for (int j = 0; row.annotations != null + && j < row.annotations.length + && (!hasGlyphs || !hasLabels || !hasValues); j++) + { + if (row.annotations[j] != null) + { + hasLabels |= (row.annotations[j].displayCharacter != null + && row.annotations[j].displayCharacter.length() > 0 && !row.annotations[j].displayCharacter + .equals(" ")); + hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' '); + hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't + // be + // rendered.. + hasText |= (row.annotations[j].description != null && row.annotations[j].description + .length() > 0); + } + } + + if (row.graph == AlignmentAnnotation.NO_GRAPH) + { + text.append("NO_GRAPH\t"); + hasValues = false; // only secondary structure + // hasLabels = false; // and annotation description string. + } + else + { + if (row.graph == AlignmentAnnotation.BAR_GRAPH) + { + text.append("BAR_GRAPH\t"); + hasGlyphs = false; // no secondary structure + + } + else if (row.graph == AlignmentAnnotation.LINE_GRAPH) + { + hasGlyphs = false; // no secondary structure + text.append("LINE_GRAPH\t"); + } + + if (row.getThreshold() != null) + { + graphLine.append("GRAPHLINE\t"); + graphLine.append(row.label); + graphLine.append("\t"); + graphLine.append(row.getThreshold().value); + graphLine.append("\t"); + graphLine.append(row.getThreshold().label); + graphLine.append("\t"); + graphLine.append(jalview.util.Format.getHexString(row + .getThreshold().colour)); + graphLine.append(newline); + } + + if (row.graphGroup > -1) + { + String key = String.valueOf(row.graphGroup); + if (graphGroup.containsKey(key)) + { + graphGroup.put(key, graphGroup.get(key) + "\t" + row.label); + } + else + { + graphGroup.put(key, row.label); + } + } + } + + text.append(row.label + "\t"); + if (row.description != null) + { + text.append(row.description + "\t"); + } + for (int j = 0; row.annotations != null + && j < row.annotations.length; j++) + { + if (refSeq != null + && jalview.util.Comparison.isGap(refSeq.getCharAt(j))) + { + continue; + } + + if (row.annotations[j] != null) + { + comma = ""; + if (hasGlyphs) // could be also hasGlyphs || ... + { + + text.append(comma); + if (row.annotations[j].secondaryStructure != ' ') + { + // only write out the field if its not whitespace. + text.append(row.annotations[j].secondaryStructure); + } + comma = ","; + } + if (hasValues) + { + if (row.annotations[j].value != Float.NaN) + { + text.append(comma + row.annotations[j].value); + } + else + { + System.err.println("Skipping NaN - not valid value."); + text.append(comma + 0f);// row.annotations[j].value); + } + comma = ","; + } + if (hasLabels) + { + // TODO: labels are emitted after values for bar graphs. + if // empty labels are allowed, so + (row.annotations[j].displayCharacter != null + && row.annotations[j].displayCharacter.length() > 0 + && !row.annotations[j].displayCharacter.equals(" ")) + { + text.append(comma + row.annotations[j].displayCharacter); + comma = ","; + } + } + if (hasText) + { + if (row.annotations[j].description != null + && row.annotations[j].description.length() > 0 + && !row.annotations[j].description + .equals(row.annotations[j].displayCharacter)) + { + text.append(comma + row.annotations[j].description); + comma = ","; + } + } + if (color != null && !color.equals(row.annotations[j].colour)) + { + oneColour = false; + } + + color = row.annotations[j].colour; + + if (row.annotations[j].colour != null + && row.annotations[j].colour != java.awt.Color.black) + { + text.append(comma + + "[" + + jalview.util.Format + .getHexString(row.annotations[j].colour) + + "]"); + comma = ","; + } + } + text.append("|"); + } + + if (row.hasScore()) + text.append("\t" + row.score); + + text.append(newline); + + if (color != null && color != java.awt.Color.black && oneColour) + { + colours.append("COLOUR\t"); + colours.append(row.label); + colours.append("\t"); + colours.append(jalview.util.Format.getHexString(color)); + colours.append(newline); + } + if (row.scaleColLabel || row.showAllColLabels + || row.centreColLabels) + { + rowprops.append("ROWPROPERTIES\t"); + rowprops.append(row.label); + rowprops.append("\tscaletofit="); + rowprops.append(row.scaleColLabel); + rowprops.append("\tshowalllabs="); + rowprops.append(row.showAllColLabels); + rowprops.append("\tcentrelabs="); + rowprops.append(row.centreColLabels); + rowprops.append(newline); + } + } + + text.append(newline); + + text.append(colours.toString()); + text.append(graphLine.toString()); + if (graphGroup.size() > 0) + { + text.append("COMBINE\t"); + Enumeration en = graphGroup.elements(); + while (en.hasMoreElements()) + { + text.append(en.nextElement()); + text.append(newline); + } + } + text.append(rowprops.toString()); + } + + if (list != null) + { + printGroups(list); + } + + if (properties != null) + { + text.append(newline); + text.append(newline); + text.append("ALIGNMENT"); + Enumeration en = properties.keys(); + while (en.hasMoreElements()) + { + String key = en.nextElement().toString(); + text.append("\t"); + text.append(key); + text.append("="); + text.append(properties.get(key)); + } + // TODO: output alignment visualization settings here if required + + } + + return text.toString(); + } + + public void printGroups(List list) + { + SequenceI seqrep = null; + for (SequenceGroup sg : list) + { + if (!sg.hasSeqrep()) + { + text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t" + + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1) + + "\t" + "-1\t"); + seqrep = null; + } + else + { + seqrep = sg.getSeqrep(); + text.append("SEQUENCE_REF\t"); + text.append(seqrep.getName()); + text.append(newline); + text.append("SEQUENCE_GROUP\t"); + text.append(sg.getName()); + text.append("\t"); + text.append((seqrep.findPosition(sg.getStartRes()))); + text.append("\t"); + text.append((seqrep.findPosition(sg.getEndRes()))); + text.append("\t"); + text.append("-1\t"); + } + for (int s = 0; s < sg.getSize(); s++) + { + text.append(sg.getSequenceAt(s).getName()); + text.append("\t"); + } + text.append(newline); + text.append("PROPERTIES\t"); + text.append(sg.getName()); + text.append("\t"); + + if (sg.getDescription() != null) + { + text.append("description="); + text.append(sg.getDescription()); + text.append("\t"); + } + if (sg.cs != null) + { + text.append("colour="); + text.append(ColourSchemeProperty.getColourName(sg.cs)); + text.append("\t"); + if (sg.cs.getThreshold() != 0) + { + text.append("pidThreshold="); + text.append(sg.cs.getThreshold()); + } + if (sg.cs.conservationApplied()) + { + text.append("consThreshold="); + text.append(sg.cs.getConservationInc()); + text.append("\t"); + } + } + text.append("outlineColour="); + text.append(jalview.util.Format.getHexString(sg.getOutlineColour())); + text.append("\t"); + + text.append("displayBoxes="); + text.append(sg.getDisplayBoxes()); + text.append("\t"); + text.append("displayText="); + text.append(sg.getDisplayText()); + text.append("\t"); + text.append("colourText="); + text.append(sg.getColourText()); + text.append("\t"); + text.append("showUnconserved="); + text.append(sg.getShowNonconserved()); + text.append("\t"); + if (sg.textColour != java.awt.Color.black) + { + text.append("textCol1="); + text.append(jalview.util.Format.getHexString(sg.textColour)); + text.append("\t"); + } + if (sg.textColour2 != java.awt.Color.white) + { + text.append("textCol2="); + text.append(jalview.util.Format.getHexString(sg.textColour2)); + text.append("\t"); + } + if (sg.thresholdTextColour != 0) + { + text.append("textColThreshold="); + text.append(sg.thresholdTextColour); + text.append("\t"); + } + if (sg.idColour != null) + { + text.append("idColour="); + text.append(jalview.util.Format.getHexString(sg.idColour)); + text.append("\t"); + } + if (sg.isHidereps()) + { + text.append("hide=true\t"); + } + if (sg.isHideCols()) + { + text.append("hidecols=true\t"); + } + if (seqrep != null) + { + // terminate the last line and clear the sequence ref for the group + text.append(newline); + text.append("SEQUENCE_REF"); + } + text.append(newline); + text.append(newline); + + } + } + + SequenceI refSeq = null; + + String refSeqId = null; + + public boolean readAnnotationFile(AlignmentI al, String file, + String protocol) + { + BufferedReader in = null; + try + { + if (protocol.equals(AppletFormatAdapter.FILE)) + { + in = new BufferedReader(new FileReader(file)); + } + else if (protocol.equals(AppletFormatAdapter.URL)) + { + URL url = new URL(file); + in = new BufferedReader(new InputStreamReader(url.openStream())); + } + else if (protocol.equals(AppletFormatAdapter.PASTE)) + { + in = new BufferedReader(new StringReader(file)); + } + else if (protocol.equals(AppletFormatAdapter.CLASSLOADER)) + { + java.io.InputStream is = getClass().getResourceAsStream("/" + file); + if (is != null) + { + in = new BufferedReader(new java.io.InputStreamReader(is)); + } + } + if (in != null) + { + return parseAnnotationFrom(al, in); + } + + } catch (Exception ex) + { + ex.printStackTrace(); + System.out.println("Problem reading annotation file: " + ex); + return false; + } + return false; + } + + public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) + throws Exception + { + boolean modified = false; + String groupRef = null; + Hashtable groupRefRows = new Hashtable(); + + Hashtable autoAnnots = new Hashtable(); + { + String line, label, description, token; + int graphStyle, index; + int refSeqIndex = 1; + int existingAnnotations = 0; + // when true - will add new rows regardless of whether they are duplicate + // auto-annotation like consensus or conservation graphs + boolean overrideAutoAnnot = false; + if (al.getAlignmentAnnotation() != null) + { + existingAnnotations = al.getAlignmentAnnotation().length; + if (existingAnnotations > 0) + { + AlignmentAnnotation[] aa = al.getAlignmentAnnotation(); + for (int aai = 0; aai < aa.length; aai++) + { + if (aa[aai].autoCalculated) + { + // make a note of the name and description + autoAnnots.put( + autoAnnotsKey(aa[aai], aa[aai].sequenceRef, + (aa[aai].groupRef == null ? null + : aa[aai].groupRef.getName())), + new Integer(1)); + } + } + } + } + + int alWidth = al.getWidth(); + + StringTokenizer st; + Annotation[] annotations; + AlignmentAnnotation annotation = null; + + // First confirm this is an Annotation file + boolean jvAnnotationFile = false; + while ((line = in.readLine()) != null) + { + if (line.indexOf("#") == 0) + { + continue; + } + + if (line.indexOf("JALVIEW_ANNOTATION") > -1) + { + jvAnnotationFile = true; + break; + } + } + + if (!jvAnnotationFile) + { + in.close(); + return false; + } + + while ((line = in.readLine()) != null) + { + if (line.indexOf("#") == 0 + || line.indexOf("JALVIEW_ANNOTATION") > -1 + || line.length() == 0) + { + continue; + } + + st = new StringTokenizer(line, "\t"); + token = st.nextToken(); + if (token.equalsIgnoreCase("COLOUR")) + { + // TODO: use graduated colour def'n here too + colourAnnotations(al, st.nextToken(), st.nextToken()); + modified = true; + continue; + } + + else if (token.equalsIgnoreCase("COMBINE")) + { + combineAnnotations(al, st); + modified = true; + continue; + } + else if (token.equalsIgnoreCase("ROWPROPERTIES")) + { + addRowProperties(al, st); + modified = true; + continue; + } + else if (token.equalsIgnoreCase("GRAPHLINE")) + { + addLine(al, st); + modified = true; + continue; + } + + else if (token.equalsIgnoreCase("SEQUENCE_REF")) + { + if (st.hasMoreTokens()) + { + refSeq = al.findName(refSeqId = st.nextToken()); + if (refSeq == null) + { + refSeqId = null; + } + try + { + refSeqIndex = Integer.parseInt(st.nextToken()); + if (refSeqIndex < 1) + { + refSeqIndex = 1; + System.out + .println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile"); + } + } catch (Exception ex) + { + refSeqIndex = 1; + } + } + else + { + refSeq = null; + refSeqId = null; + } + continue; + } + else if (token.equalsIgnoreCase("GROUP_REF")) + { + // Group references could be forward or backwards, so they are + // resolved after the whole file is read in + groupRef = null; + if (st.hasMoreTokens()) + { + groupRef = st.nextToken(); + if (groupRef.length() < 1) + { + groupRef = null; // empty string + } + else + { + if (groupRefRows.get(groupRef) == null) + { + groupRefRows.put(groupRef, new Vector()); + } + } + } + continue; + } + else if (token.equalsIgnoreCase("SEQUENCE_GROUP")) + { + addGroup(al, st); + continue; + } + + else if (token.equalsIgnoreCase("PROPERTIES")) + { + addProperties(al, st); + modified = true; + continue; + } + + else if (token.equalsIgnoreCase("BELOW_ALIGNMENT")) + { + setBelowAlignment(al, st); + modified = true; + continue; + } + else if (token.equalsIgnoreCase("ALIGNMENT")) + { + addAlignmentDetails(al, st); + modified = true; + continue; + } + + // Parse out the annotation row + graphStyle = AlignmentAnnotation.getGraphValueFromString(token); + label = st.nextToken(); + + index = 0; + annotations = new Annotation[alWidth]; + description = null; + float score = Float.NaN; + + if (st.hasMoreTokens()) + { + line = st.nextToken(); + + if (line.indexOf("|") == -1) + { + description = line; + if (st.hasMoreTokens()) + line = st.nextToken(); + } + + if (st.hasMoreTokens()) + { + // This must be the score + score = Float.valueOf(st.nextToken()).floatValue(); + } + + st = new StringTokenizer(line, "|", true); + + boolean emptyColumn = true; + boolean onlyOneElement = (st.countTokens() == 1); + + while (st.hasMoreElements() && index < alWidth) + { + token = st.nextToken().trim(); + + if (onlyOneElement) + { + try + { + score = Float.valueOf(token).floatValue(); + break; + } catch (NumberFormatException ex) + { + } + } + + if (token.equals("|")) + { + if (emptyColumn) + { + index++; + } + + emptyColumn = true; + } + else + { + annotations[index++] = parseAnnotation(token, graphStyle); + emptyColumn = false; + } + } + + } + + annotation = new AlignmentAnnotation(label, description, + (index == 0) ? null : annotations, 0, 0, graphStyle); + + annotation.score = score; + if (!overrideAutoAnnot + && autoAnnots.containsKey(autoAnnotsKey(annotation, refSeq, + groupRef))) + { + // skip - we've already got an automatic annotation of this type. + continue; + } + // otherwise add it! + if (refSeq != null) + { + + annotation.belowAlignment = false; + // make a copy of refSeq so we can find other matches in the alignment + SequenceI referedSeq = refSeq; + do + { + // copy before we do any mapping business. + // TODO: verify that undo/redo with 1:many sequence associated + // annotations can be undone correctly + AlignmentAnnotation ann = new AlignmentAnnotation(annotation); + annotation + .createSequenceMapping(referedSeq, refSeqIndex, false); + annotation.adjustForAlignment(); + referedSeq.addAlignmentAnnotation(annotation); + al.addAnnotation(annotation); + al.setAnnotationIndex(annotation, + al.getAlignmentAnnotation().length + - existingAnnotations - 1); + if (groupRef != null) + { + ((Vector) groupRefRows.get(groupRef)).addElement(annotation); + } + // and recover our virgin copy to use again if necessary. + annotation = ann; + + } while (refSeqId != null + && (referedSeq = al.findName(referedSeq, refSeqId, true)) != null); + } + else + { + al.addAnnotation(annotation); + al.setAnnotationIndex(annotation, + al.getAlignmentAnnotation().length - existingAnnotations + - 1); + if (groupRef != null) + { + ((Vector) groupRefRows.get(groupRef)).addElement(annotation); + } + } + // and set modification flag + modified = true; + } + // Finally, resolve the groupRefs + Enumeration en = groupRefRows.keys(); + + while (en.hasMoreElements()) + { + groupRef = (String) en.nextElement(); + boolean matched = false; + // Resolve group: TODO: add a getGroupByName method to alignments + for (SequenceGroup theGroup : al.getGroups()) + { + if (theGroup.getName().equals(groupRef)) + { + if (matched) + { + // TODO: specify and implement duplication of alignment annotation + // for multiple group references. + System.err + .println("Ignoring 1:many group reference mappings for group name '" + + groupRef + "'"); + } + else + { + matched = true; + Vector rowset = (Vector) groupRefRows.get(groupRef); + if (rowset != null && rowset.size() > 0) + { + AlignmentAnnotation alan = null; + for (int elm = 0, elmSize = rowset.size(); elm < elmSize; elm++) + { + alan = (AlignmentAnnotation) rowset.elementAt(elm); + alan.groupRef = theGroup; + } + } + } + } + } + ((Vector) groupRefRows.get(groupRef)).removeAllElements(); + } + } + return modified; + } + + private Object autoAnnotsKey(AlignmentAnnotation annotation, + SequenceI refSeq, String groupRef) + { + return annotation.graph + "\t" + annotation.label + "\t" + + annotation.description + "\t" + + (refSeq != null ? refSeq.getDisplayId(true) : ""); + } + + Annotation parseAnnotation(String string, int graphStyle) + { + boolean hasSymbols = (graphStyle == AlignmentAnnotation.NO_GRAPH); // don't + // do the + // glyph + // test + // if we + // don't + // want + // secondary + // structure + String desc = null, displayChar = null; + char ss = ' '; // secondaryStructure + float value = 0; + boolean parsedValue = false, dcset = false; + + // find colour here + java.awt.Color colour = null; + int i = string.indexOf("["); + int j = string.indexOf("]"); + if (i > -1 && j > -1) + { + UserColourScheme ucs = new UserColourScheme(); + + colour = ucs.getColourFromString(string.substring(i + 1, j)); + if (i > 0 && string.charAt(i - 1) == ',') + { + // clip the preceding comma as well + i--; + } + string = string.substring(0, i) + string.substring(j + 1); + } + + StringTokenizer st = new StringTokenizer(string, ",", true); + String token; + boolean seenContent = false; + int pass = 0; + while (st.hasMoreTokens()) + { + pass++; + token = st.nextToken().trim(); + if (token.equals(",")) + { + if (!seenContent && parsedValue && !dcset) + { + // allow the value below the bar/line to be empty + dcset = true; + displayChar = " "; + } + seenContent = false; + continue; + } + else + { + seenContent = true; + } + + if (!parsedValue) + { + try + { + displayChar = token; + // foo + value = new Float(token).floatValue(); + parsedValue = true; + continue; + } catch (NumberFormatException ex) + { + } + } + else + { + if (token.length() == 1) + { + displayChar = token; + } + } + if (hasSymbols + && (token.equals("H") || token.equals("E") + || token.equals("S") || token.equals(" "))) + { + // Either this character represents a helix or sheet + // or an integer which can be displayed + ss = token.charAt(0); + if (displayChar.equals(token.substring(0, 1))) + { + displayChar = ""; + } + } + else if (desc == null || (parsedValue && pass > 2)) + { + desc = token; + } + + } + // if (!dcset && string.charAt(string.length() - 1) == ',') + // { + // displayChar = " "; // empty display char symbol. + // } + if (displayChar != null && desc != null && desc.length() == 1) + { + if (displayChar.length() > 1) + { + // switch desc and displayChar - legacy support + String tmp = displayChar; + displayChar = desc; + desc = tmp; + } + else + { + if (displayChar.equals(desc)) + { + // duplicate label - hangover from the 'robust parser' above + desc = null; + } + } + } + Annotation anot = new Annotation(displayChar, desc, ss, value); + + anot.colour = colour; + + return anot; + } + + void colourAnnotations(AlignmentI al, String label, String colour) + { + UserColourScheme ucs = new UserColourScheme(colour); + Annotation[] annotations; + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label)) + { + annotations = al.getAlignmentAnnotation()[i].annotations; + for (int j = 0; j < annotations.length; j++) + { + if (annotations[j] != null) + { + annotations[j].colour = ucs.findColour('A'); + } + } + } + } + } + + void combineAnnotations(AlignmentI al, StringTokenizer st) + { + int graphGroup = -1; + String group = st.nextToken(); + // First make sure we are not overwriting the graphIndex + if (al.getAlignmentAnnotation() != null) + { + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) + { + graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1; + al.getAlignmentAnnotation()[i].graphGroup = graphGroup; + break; + } + } + + // Now update groups + while (st.hasMoreTokens()) + { + group = st.nextToken(); + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group)) + { + al.getAlignmentAnnotation()[i].graphGroup = graphGroup; + break; + } + } + } + } + else + { + System.err + .println("Couldn't combine annotations. None are added to alignment yet!"); + } + } + + void addLine(AlignmentI al, StringTokenizer st) + { + String group = st.nextToken(); + AlignmentAnnotation annotation = null, alannot[] = al + .getAlignmentAnnotation(); + if (alannot != null) + { + for (int i = 0; i < alannot.length; i++) + { + if (alannot[i].label.equalsIgnoreCase(group)) + { + annotation = alannot[i]; + break; + } + } + } + if (annotation == null) + { + return; + } + float value = new Float(st.nextToken()).floatValue(); + String label = st.hasMoreTokens() ? st.nextToken() : null; + java.awt.Color colour = null; + if (st.hasMoreTokens()) + { + UserColourScheme ucs = new UserColourScheme(st.nextToken()); + colour = ucs.findColour('A'); + } + + annotation.setThreshold(new GraphLine(value, label, colour)); + } + + void addGroup(AlignmentI al, StringTokenizer st) + { + SequenceGroup sg = new SequenceGroup(); + sg.setName(st.nextToken()); + String rng = ""; + try + { + rng = st.nextToken(); + if (rng.length() > 0 && !rng.startsWith("*")) + { + sg.setStartRes(Integer.parseInt(rng) - 1); + } + else + { + sg.setStartRes(0); + } + rng = st.nextToken(); + if (rng.length() > 0 && !rng.startsWith("*")) + { + sg.setEndRes(Integer.parseInt(rng) - 1); + } + else + { + sg.setEndRes(al.getWidth() - 1); + } + } catch (Exception e) + { + System.err + .println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '" + + rng + "' - assuming alignment width for group."); + // assume group is full width + sg.setStartRes(0); + sg.setEndRes(al.getWidth() - 1); + } + + String index = st.nextToken(); + if (index.equals("-1")) + { + while (st.hasMoreElements()) + { + sg.addSequence(al.findName(st.nextToken()), false); + } + } + else + { + StringTokenizer st2 = new StringTokenizer(index, ","); + + while (st2.hasMoreTokens()) + { + String tmp = st2.nextToken(); + if (tmp.equals("*")) + { + for (int i = 0; i < al.getHeight(); i++) + { + sg.addSequence(al.getSequenceAt(i), false); + } + } + else if (tmp.indexOf("-") >= 0) + { + StringTokenizer st3 = new StringTokenizer(tmp, "-"); + + int start = (Integer.parseInt(st3.nextToken())); + int end = (Integer.parseInt(st3.nextToken())); + + if (end > start) + { + for (int i = start; i <= end; i++) + { + sg.addSequence(al.getSequenceAt(i - 1), false); + } + } + } + else + { + sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false); + } + } + } + + if (refSeq != null) + { + sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1); + sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1); + sg.setSeqrep(refSeq); + } + + if (sg.getSize() > 0) + { + al.addGroup(sg); + } + } + + void addRowProperties(AlignmentI al, StringTokenizer st) + { + String label = st.nextToken(), keyValue, key, value; + boolean scaletofit = false, centerlab = false, showalllabs = false; + while (st.hasMoreTokens()) + { + keyValue = st.nextToken(); + key = keyValue.substring(0, keyValue.indexOf("=")); + value = keyValue.substring(keyValue.indexOf("=") + 1); + if (key.equalsIgnoreCase("scaletofit")) + { + scaletofit = Boolean.valueOf(value).booleanValue(); + } + if (key.equalsIgnoreCase("showalllabs")) + { + showalllabs = Boolean.valueOf(value).booleanValue(); + } + if (key.equalsIgnoreCase("centrelabs")) + { + centerlab = Boolean.valueOf(value).booleanValue(); + } + AlignmentAnnotation[] alr = al.getAlignmentAnnotation(); + if (alr != null) + { + for (int i = 0; i < alr.length; i++) + { + if (alr[i].label.equalsIgnoreCase(label)) + { + alr[i].centreColLabels = centerlab; + alr[i].scaleColLabel = scaletofit; + alr[i].showAllColLabels = showalllabs; + } + } + } + } + } + + void addProperties(AlignmentI al, StringTokenizer st) + { + + // So far we have only added groups to the annotationHash, + // the idea is in the future properties can be added to + // alignments, other annotations etc + if (al.getGroups() == null) + { + return; + } + + String name = st.nextToken(); + SequenceGroup sg = null; + for (SequenceGroup _sg : al.getGroups()) + { + if ((sg = _sg).getName().equals(name)) + { + break; + } + else + { + sg = null; + } + } + + if (sg != null) + { + String keyValue, key, value; + ColourSchemeI def = sg.cs; + sg.cs = null; + while (st.hasMoreTokens()) + { + keyValue = st.nextToken(); + key = keyValue.substring(0, keyValue.indexOf("=")); + value = keyValue.substring(keyValue.indexOf("=") + 1); + + if (key.equalsIgnoreCase("description")) + { + sg.setDescription(value); + } + else if (key.equalsIgnoreCase("colour")) + { + sg.cs = ColourSchemeProperty.getColour(al, value); + } + else if (key.equalsIgnoreCase("pidThreshold")) + { + sg.cs.setThreshold(Integer.parseInt(value), true); + + } + else if (key.equalsIgnoreCase("consThreshold")) + { + sg.cs.setConservationInc(Integer.parseInt(value)); + Conservation c = new Conservation("Group", + ResidueProperties.propHash, 3, sg.getSequences(null), + sg.getStartRes(), sg.getEndRes() + 1); + + c.calculate(); + c.verdict(false, 25); // TODO: refer to conservation percent threshold + + sg.cs.setConservation(c); + + } + else if (key.equalsIgnoreCase("outlineColour")) + { + sg.setOutlineColour(new UserColourScheme(value).findColour('A')); + } + else if (key.equalsIgnoreCase("displayBoxes")) + { + sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue()); + } + else if (key.equalsIgnoreCase("showUnconserved")) + { + sg.setShowNonconserved(Boolean.valueOf(value).booleanValue()); + } + else if (key.equalsIgnoreCase("displayText")) + { + sg.setDisplayText(Boolean.valueOf(value).booleanValue()); + } + else if (key.equalsIgnoreCase("colourText")) + { + sg.setColourText(Boolean.valueOf(value).booleanValue()); + } + else if (key.equalsIgnoreCase("textCol1")) + { + sg.textColour = new UserColourScheme(value).findColour('A'); + } + else if (key.equalsIgnoreCase("textCol2")) + { + sg.textColour2 = new UserColourScheme(value).findColour('A'); + } + else if (key.equalsIgnoreCase("textColThreshold")) + { + sg.thresholdTextColour = Integer.parseInt(value); + } + else if (key.equalsIgnoreCase("idColour")) + { + // consider warning if colour doesn't resolve to a real colour + sg.setIdColour((def = new UserColourScheme(value)) + .findColour('A')); + } + else if (key.equalsIgnoreCase("hide")) + { + // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847 + sg.setHidereps(true); + } + else if (key.equalsIgnoreCase("hidecols")) + { + // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847 + sg.setHideCols(true); + } + sg.recalcConservation(); + } + if (sg.cs == null) + { + sg.cs = def; + } + } + } + + void setBelowAlignment(AlignmentI al, StringTokenizer st) + { + String token; + AlignmentAnnotation aa, ala[] = al.getAlignmentAnnotation(); + if (ala == null) + { + System.err + .print("Warning - no annotation to set below for sequence associated annotation:"); + } + while (st.hasMoreTokens()) + { + token = st.nextToken(); + if (ala == null) + { + System.err.print(" " + token); + } + else + { + for (int i = 0; i < al.getAlignmentAnnotation().length; i++) + { + aa = al.getAlignmentAnnotation()[i]; + if (aa.sequenceRef == refSeq && aa.label.equals(token)) + { + aa.belowAlignment = true; + } + } + } + } + if (ala == null) + { + System.err.print("\n"); + } + } + + void addAlignmentDetails(AlignmentI al, StringTokenizer st) + { + String keyValue, key, value; + while (st.hasMoreTokens()) + { + keyValue = st.nextToken(); + key = keyValue.substring(0, keyValue.indexOf("=")); + value = keyValue.substring(keyValue.indexOf("=") + 1); + al.setProperty(key, value); + } + } + + /** + * Write annotations as a CSV file of the form 'label, value, value, ...' for + * each row. + * + * @param annotations + * @return CSV file as a string. + */ + public String printCSVAnnotations(AlignmentAnnotation[] annotations) + { + StringBuffer sp = new StringBuffer(); + for (int i = 0; i < annotations.length; i++) + { + String atos = annotations[i].toString(); + int p = 0; + do + { + int cp = atos.indexOf("\n", p); + sp.append(annotations[i].label); + sp.append(","); + if (cp > p) + { + sp.append(atos.substring(p, cp + 1)); + } + else + { + sp.append(atos.substring(p)); + sp.append(newline); + } + p = cp + 1; + } while (p > 0); + } + return sp.toString(); + } +} diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 4507019..11f5adb 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/BLCFile.java b/src/jalview/io/BLCFile.java index 03b2edf..5b02b59 100755 --- a/src/jalview/io/BLCFile.java +++ b/src/jalview/io/BLCFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/ClansFile.java b/src/jalview/io/ClansFile.java index a134cbb..4f5f8cc 100644 --- a/src/jalview/io/ClansFile.java +++ b/src/jalview/io/ClansFile.java @@ -1,27 +1,27 @@ -/* - * 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 . - */ -package jalview.io; - -/** - * Read or write a CLANS style score matrix file. - */ - -public class ClansFile extends FileParse -{ - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io; + +/** + * Read or write a CLANS style score matrix file. + */ + +public class ClansFile extends FileParse +{ + +} diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java index 83045a2..4ae5e77 100755 --- a/src/jalview/io/ClustalFile.java +++ b/src/jalview/io/ClustalFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/DBRefFile.java b/src/jalview/io/DBRefFile.java index 0249a32..7939a21 100644 --- a/src/jalview/io/DBRefFile.java +++ b/src/jalview/io/DBRefFile.java @@ -1,44 +1,44 @@ -/* - * 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 . - */ -package jalview.io; - -import java.io.IOException; - -/** - * jalview flatfile for io of sequence ID mapping data - * DATABASE\t\t\t... properties?jdbc, url, handler - * DBREF - * \tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...| - * - */ -public class DBRefFile extends AlignFile -{ - - public void parse() throws IOException - { - // TODO Auto-generated method stub - - } - - public String print() - { - // TODO Auto-generated method stub - return null; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io; + +import java.io.IOException; + +/** + * jalview flatfile for io of sequence ID mapping data + * DATABASE\t\t\t... properties?jdbc, url, handler + * DBREF + * \tDBID\taccno\t|seqstart,seqend,start,end...|\t|dbstart,dbend,...| + * + */ +public class DBRefFile extends AlignFile +{ + + public void parse() throws IOException + { + // TODO Auto-generated method stub + + } + + public String print() + { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java index 3b74855..0c0d186 100755 --- a/src/jalview/io/FastaFile.java +++ b/src/jalview/io/FastaFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index c5197e1..ea7ac70 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -1,1026 +1,1026 @@ -/* - * 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 . - */ -package jalview.io; - -import java.io.*; -import java.util.*; - -import jalview.analysis.SequenceIdMatcher; -import jalview.datamodel.*; -import jalview.schemes.*; -import jalview.util.Format; - -/** - * Parse and create Jalview Features files Detects GFF format features files and - * parses. Does not implement standard print() - call specific printFeatures or - * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object - * for the features annotation - this normally works on an exact match. - * - * @author AMW - * @version $Revision$ - */ -public class FeaturesFile extends AlignFile -{ - /** - * work around for GFF interpretation bug where source string becomes - * description rather than a group - */ - private boolean doGffSource = true; - - /** - * Creates a new FeaturesFile object. - */ - public FeaturesFile() - { - } - - /** - * Creates a new FeaturesFile object. - * - * @param inFile - * DOCUMENT ME! - * @param type - * DOCUMENT ME! - * - * @throws IOException - * DOCUMENT ME! - */ - public FeaturesFile(String inFile, String type) throws IOException - { - super(inFile, type); - } - - public FeaturesFile(FileParse source) throws IOException - { - super(source); - } - - /** - * Parse GFF or sequence features file using case-independent matching, - * discarding URLs - * - * @param align - * - alignment/dataset containing sequences that are to be annotated - * @param colours - * - hashtable to store feature colour definitions - * @param removeHTML - * - process html strings into plain text - * @return true if features were added - */ - public boolean parse(AlignmentI align, Hashtable colours, - boolean removeHTML) - { - return parse(align, colours, null, removeHTML, false); - } - - /** - * Parse GFF or sequence features file optionally using case-independent - * matching, discarding URLs - * - * @param align - * - alignment/dataset containing sequences that are to be annotated - * @param colours - * - hashtable to store feature colour definitions - * @param removeHTML - * - process html strings into plain text - * @param relaxedIdmatching - * - when true, ID matches to compound sequence IDs are allowed - * @return true if features were added - */ - public boolean parse(AlignmentI align, Map colours, boolean removeHTML, - boolean relaxedIdMatching) - { - return parse(align, colours, null, removeHTML, relaxedIdMatching); - } - - /** - * Parse GFF or sequence features file optionally using case-independent - * matching - * - * @param align - * - alignment/dataset containing sequences that are to be annotated - * @param colours - * - hashtable to store feature colour definitions - * @param featureLink - * - hashtable to store associated URLs - * @param removeHTML - * - process html strings into plain text - * @return true if features were added - */ - public boolean parse(AlignmentI align, Map colours, Map featureLink, - boolean removeHTML) - { - return parse(align, colours, featureLink, removeHTML, false); - } - - /** - * /** Parse GFF or sequence features file - * - * @param align - * - alignment/dataset containing sequences that are to be annotated - * @param colours - * - hashtable to store feature colour definitions - * @param featureLink - * - hashtable to store associated URLs - * @param removeHTML - * - process html strings into plain text - * @param relaxedIdmatching - * - when true, ID matches to compound sequence IDs are allowed - * @return true if features were added - */ - public boolean parse(AlignmentI align, Map colours, Map featureLink, - boolean removeHTML, boolean relaxedIdmatching) - { - - String line = null; - try - { - SequenceI seq = null; - String type, desc, token = null; - - int index, start, end; - float score; - StringTokenizer st; - SequenceFeature sf; - String featureGroup = null, groupLink = null; - Map typeLink = new Hashtable(); - /** - * when true, assume GFF style features rather than Jalview style. - */ - boolean GFFFile = true; - while ((line = nextLine()) != null) - { - if (line.startsWith("#")) - { - continue; - } - - st = new StringTokenizer(line, "\t"); - if (st.countTokens() == 1) - { - if (line.trim().equalsIgnoreCase("GFF")) - { - // Start parsing file as if it might be GFF again. - GFFFile = true; - continue; - } - } - if (st.countTokens() > 1 && st.countTokens() < 4) - { - GFFFile = false; - type = st.nextToken(); - if (type.equalsIgnoreCase("startgroup")) - { - featureGroup = st.nextToken(); - if (st.hasMoreElements()) - { - groupLink = st.nextToken(); - featureLink.put(featureGroup, groupLink); - } - } - else if (type.equalsIgnoreCase("endgroup")) - { - // We should check whether this is the current group, - // but at present theres no way of showing more than 1 group - st.nextToken(); - featureGroup = null; - groupLink = null; - } - else - { - Object colour = null; - String colscheme = st.nextToken(); - if (colscheme.indexOf("|") > -1 - || colscheme.trim().equalsIgnoreCase("label")) - { - // Parse '|' separated graduated colourscheme fields: - // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue] - // can either provide 'label' only, first is optional, next two - // colors are required (but may be - // left blank), next is optional, nxt two min/max are required. - // first is either 'label' - // first/second and third are both hexadecimal or word equivalent - // colour. - // next two are values parsed as floats. - // fifth is either 'above','below', or 'none'. - // sixth is a float value and only required when fifth is either - // 'above' or 'below'. - StringTokenizer gcol = new StringTokenizer(colscheme, "|", - true); - // set defaults - int threshtype = AnnotationColourGradient.NO_THRESHOLD; - float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN; - boolean labelCol = false; - // Parse spec line - String mincol = gcol.nextToken(); - if (mincol == "|") - { - System.err - .println("Expected either 'label' or a colour specification in the line: " - + line); - continue; - } - String maxcol = null; - if (mincol.toLowerCase().indexOf("label") == 0) - { - labelCol = true; - mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip - // '|' - mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); - } - String abso = null, minval, maxval; - if (mincol != null) - { - // at least four more tokens - if (mincol.equals("|")) - { - mincol = ""; - } - else - { - gcol.nextToken(); // skip next '|' - } - // continue parsing rest of line - maxcol = gcol.nextToken(); - if (maxcol.equals("|")) - { - maxcol = ""; - } - else - { - gcol.nextToken(); // skip next '|' - } - abso = gcol.nextToken(); - gcol.nextToken(); // skip next '|' - if (abso.toLowerCase().indexOf("abso") != 0) - { - minval = abso; - abso = null; - } - else - { - minval = gcol.nextToken(); - gcol.nextToken(); // skip next '|' - } - maxval = gcol.nextToken(); - if (gcol.hasMoreTokens()) - { - gcol.nextToken(); // skip next '|' - } - try - { - if (minval.length() > 0) - { - min = new Float(minval).floatValue(); - } - } catch (Exception e) - { - System.err - .println("Couldn't parse the minimum value for graduated colour for type (" - + colscheme - + ") - did you misspell 'auto' for the optional automatic colour switch ?"); - e.printStackTrace(); - } - try - { - if (maxval.length() > 0) - { - max = new Float(maxval).floatValue(); - } - } catch (Exception e) - { - System.err - .println("Couldn't parse the maximum value for graduated colour for type (" - + colscheme + ")"); - e.printStackTrace(); - } - } - else - { - // add in some dummy min/max colours for the label-only - // colourscheme. - mincol = "FFFFFF"; - maxcol = "000000"; - } - try - { - colour = new jalview.schemes.GraduatedColor( - new UserColourScheme(mincol).findColour('A'), - new UserColourScheme(maxcol).findColour('A'), min, - max); - } catch (Exception e) - { - System.err - .println("Couldn't parse the graduated colour scheme (" - + colscheme + ")"); - e.printStackTrace(); - } - if (colour != null) - { - ((jalview.schemes.GraduatedColor) colour) - .setColourByLabel(labelCol); - ((jalview.schemes.GraduatedColor) colour) - .setAutoScaled(abso == null); - // add in any additional parameters - String ttype = null, tval = null; - if (gcol.hasMoreTokens()) - { - // threshold type and possibly a threshold value - ttype = gcol.nextToken(); - if (ttype.toLowerCase().startsWith("below")) - { - ((jalview.schemes.GraduatedColor) colour) - .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD); - } - else if (ttype.toLowerCase().startsWith("above")) - { - ((jalview.schemes.GraduatedColor) colour) - .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD); - } - else - { - ((jalview.schemes.GraduatedColor) colour) - .setThreshType(AnnotationColourGradient.NO_THRESHOLD); - if (!ttype.toLowerCase().startsWith("no")) - { - System.err - .println("Ignoring unrecognised threshold type : " - + ttype); - } - } - } - if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD) - { - try - { - gcol.nextToken(); - tval = gcol.nextToken(); - ((jalview.schemes.GraduatedColor) colour) - .setThresh(new Float(tval).floatValue()); - } catch (Exception e) - { - System.err - .println("Couldn't parse threshold value as a float: (" - + tval + ")"); - e.printStackTrace(); - } - } - // parse the thresh-is-min token ? - if (gcol.hasMoreTokens()) - { - System.err - .println("Ignoring additional tokens in parameters in graduated colour specification\n"); - while (gcol.hasMoreTokens()) - { - System.err.println("|" + gcol.nextToken()); - } - System.err.println("\n"); - } - } - } - else - { - UserColourScheme ucs = new UserColourScheme(colscheme); - colour = ucs.findColour('A'); - } - if (colour != null) - { - colours.put(type, colour); - } - if (st.hasMoreElements()) - { - String link = st.nextToken(); - typeLink.put(type, link); - if (featureLink == null) - { - featureLink = new Hashtable(); - } - featureLink.put(type, link); - } - } - continue; - } - String seqId = ""; - while (st.hasMoreElements()) - { - - if (GFFFile) - { - // Still possible this is an old Jalview file, - // which does not have type colours at the beginning - seqId = token = st.nextToken(); - seq = findName(align, seqId, relaxedIdmatching); - if (seq != null) - { - desc = st.nextToken(); - String group = null; - if (doGffSource && desc.indexOf(' ') == -1) - { - // could also be a source term rather than description line - group = new String(desc); - } - type = st.nextToken(); - try - { - String stt = st.nextToken(); - if (stt.length() == 0 || stt.equals("-")) - { - start = 0; - } - else - { - start = Integer.parseInt(stt); - } - } catch (NumberFormatException ex) - { - start = 0; - } - try - { - String stt = st.nextToken(); - if (stt.length() == 0 || stt.equals("-")) - { - end = 0; - } - else - { - end = Integer.parseInt(stt); - } - } catch (NumberFormatException ex) - { - end = 0; - } - // TODO: decide if non positional feature assertion for input data - // where end==0 is generally valid - if (end == 0) - { - // treat as non-positional feature, regardless. - start = 0; - } - try - { - score = new Float(st.nextToken()).floatValue(); - } catch (NumberFormatException ex) - { - score = 0; - } - - sf = new SequenceFeature(type, desc, start, end, score, group); - - try - { - sf.setValue("STRAND", st.nextToken()); - sf.setValue("FRAME", st.nextToken()); - } catch (Exception ex) - { - } - - if (st.hasMoreTokens()) - { - StringBuffer attributes = new StringBuffer(); - while (st.hasMoreTokens()) - { - attributes.append("\t" + st.nextElement()); - } - // TODO validate and split GFF2 attributes field ? parse out - // ([A-Za-z][A-Za-z0-9_]*) ; and add as - // sf.setValue(attrib, val); - sf.setValue("ATTRIBUTES", attributes.toString()); - } - - seq.addSequenceFeature(sf); - while ((seq = align.findName(seq, seqId, true)) != null) - { - seq.addSequenceFeature(new SequenceFeature(sf)); - } - break; - } - } - - if (GFFFile && seq == null) - { - desc = token; - } - else - { - desc = st.nextToken(); - } - if (!st.hasMoreTokens()) - { - System.err - .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up."); - // in all probability, this isn't a file we understand, so bail - // quietly. - return false; - } - - token = st.nextToken(); - - if (!token.equals("ID_NOT_SPECIFIED")) - { - seq = findName(align, seqId = token, relaxedIdmatching); - st.nextToken(); - } - else - { - seqId = null; - try - { - index = Integer.parseInt(st.nextToken()); - seq = align.getSequenceAt(index); - } catch (NumberFormatException ex) - { - seq = null; - } - } - - if (seq == null) - { - System.out.println("Sequence not found: " + line); - break; - } - - start = Integer.parseInt(st.nextToken()); - end = Integer.parseInt(st.nextToken()); - - type = st.nextToken(); - - if (!colours.containsKey(type)) - { - // Probably the old style groups file - UserColourScheme ucs = new UserColourScheme(type); - colours.put(type, ucs.findColour('A')); - } - sf = new SequenceFeature(type, desc, "", start, end, featureGroup); - if (st.hasMoreTokens()) - { - try - { - score = new Float(st.nextToken()).floatValue(); - // update colourgradient bounds if allowed to - } catch (NumberFormatException ex) - { - score = 0; - } - sf.setScore(score); - } - if (groupLink != null && removeHTML) - { - sf.addLink(groupLink); - sf.description += "%LINK%"; - } - if (typeLink.containsKey(type) && removeHTML) - { - sf.addLink(typeLink.get(type).toString()); - sf.description += "%LINK%"; - } - - parseDescriptionHTML(sf, removeHTML); - - seq.addSequenceFeature(sf); - - while (seqId != null - && (seq = align.findName(seq, seqId, false)) != null) - { - seq.addSequenceFeature(new SequenceFeature(sf)); - } - // If we got here, its not a GFFFile - GFFFile = false; - } - } - resetMatcher(); - } catch (Exception ex) - { - System.out.println(line); - System.out.println("Error parsing feature file: " + ex + "\n" + line); - ex.printStackTrace(System.err); - resetMatcher(); - return false; - } - - return true; - } - - private AlignmentI lastmatchedAl = null; - - private SequenceIdMatcher matcher = null; - - /** - * clear any temporary handles used to speed up ID matching - */ - private void resetMatcher() - { - lastmatchedAl = null; - matcher = null; - } - - private SequenceI findName(AlignmentI align, String seqId, - boolean relaxedIdMatching) - { - SequenceI match = null; - if (relaxedIdMatching) - { - if (lastmatchedAl != align) - { - matcher = new SequenceIdMatcher( - (lastmatchedAl = align).getSequencesArray()); - } - match = matcher.findIdMatch(seqId); - } - else - { - match = align.findName(seqId, true); - } - return match; - } - - public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML) - { - if (sf.getDescription() == null) - { - return; - } - jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks( - sf.getDescription(), removeHTML, newline); - - sf.description = (removeHTML) ? parsed.getNonHtmlContent() - : sf.description; - for (String link : parsed.getLinks()) - { - sf.addLink(link); - } - - } - - /** - * generate a features file for seqs includes non-pos features by default. - * - * @param seqs - * source of sequence features - * @param visible - * hash of feature types and colours - * @return features file contents - */ - public String printJalviewFormat(SequenceI[] seqs, Hashtable visible) - { - return printJalviewFormat(seqs, visible, true, true); - } - - /** - * generate a features file for seqs with colours from visible (if any) - * - * @param seqs - * source of features - * @param visible - * hash of Colours for each feature type - * @param visOnly - * when true only feature types in 'visible' will be output - * @param nonpos - * indicates if non-positional features should be output (regardless - * of group or type) - * @return features file contents - */ - public String printJalviewFormat(SequenceI[] seqs, Hashtable visible, - boolean visOnly, boolean nonpos) - { - StringBuffer out = new StringBuffer(); - SequenceFeature[] next; - boolean featuresGen = false; - if (visOnly && !nonpos && (visible == null || visible.size() < 1)) - { - // no point continuing. - return "No Features Visible"; - } - - if (visible != null && visOnly) - { - // write feature colours only if we're given them and we are generating - // viewed features - // TODO: decide if feature links should also be written here ? - Enumeration en = visible.keys(); - String type, color; - while (en.hasMoreElements()) - { - type = en.nextElement().toString(); - - if (visible.get(type) instanceof GraduatedColor) - { - GraduatedColor gc = (GraduatedColor) visible.get(type); - color = (gc.isColourByLabel() ? "label|" : "") - + Format.getHexString(gc.getMinColor()) + "|" - + Format.getHexString(gc.getMaxColor()) - + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|" - + gc.getMax() + "|"; - if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD) - { - if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD) - { - color += "below"; - } - else - { - if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD) - { - System.err.println("WARNING: Unsupported threshold type (" - + gc.getThreshType() + ") : Assuming 'above'"); - } - color += "above"; - } - // add the value - color += "|" + gc.getThresh(); - } - else - { - color += "none"; - } - } - else if (visible.get(type) instanceof java.awt.Color) - { - color = Format.getHexString((java.awt.Color) visible.get(type)); - } - else - { - // legacy support for integer objects containing colour triplet values - color = Format.getHexString(new java.awt.Color(Integer - .parseInt(visible.get(type).toString()))); - } - out.append(type); - out.append("\t"); - out.append(color); - out.append(newline); - } - } - // Work out which groups are both present and visible - Vector groups = new Vector(); - int groupIndex = 0; - boolean isnonpos = false; - - for (int i = 0; i < seqs.length; i++) - { - next = seqs[i].getSequenceFeatures(); - if (next != null) - { - for (int j = 0; j < next.length; j++) - { - isnonpos = next[j].begin == 0 && next[j].end == 0; - if ((!nonpos && isnonpos) - || (!isnonpos && visOnly && !visible - .containsKey(next[j].type))) - { - continue; - } - - if (next[j].featureGroup != null - && !groups.contains(next[j].featureGroup)) - { - groups.addElement(next[j].featureGroup); - } - } - } - } - - String group = null; - do - { - - if (groups.size() > 0 && groupIndex < groups.size()) - { - group = groups.elementAt(groupIndex).toString(); - out.append(newline); - out.append("STARTGROUP\t"); - out.append(group); - out.append(newline); - } - else - { - group = null; - } - - for (int i = 0; i < seqs.length; i++) - { - next = seqs[i].getSequenceFeatures(); - if (next != null) - { - for (int j = 0; j < next.length; j++) - { - isnonpos = next[j].begin == 0 && next[j].end == 0; - if ((!nonpos && isnonpos) - || (!isnonpos && visOnly && !visible - .containsKey(next[j].type))) - { - // skip if feature is nonpos and we ignore them or if we only - // output visible and it isn't non-pos and it's not visible - continue; - } - - if (group != null - && (next[j].featureGroup == null || !next[j].featureGroup - .equals(group))) - { - continue; - } - - if (group == null && next[j].featureGroup != null) - { - continue; - } - // we have features to output - featuresGen = true; - if (next[j].description == null - || next[j].description.equals("")) - { - out.append(next[j].type + "\t"); - } - else - { - if (next[j].links != null - && next[j].getDescription().indexOf("") == -1) - { - out.append(""); - } - - out.append(next[j].description + " "); - if (next[j].links != null) - { - for (int l = 0; l < next[j].links.size(); l++) - { - String label = next[j].links.elementAt(l).toString(); - String href = label.substring(label.indexOf("|") + 1); - label = label.substring(0, label.indexOf("|")); - - if (next[j].description.indexOf(href) == -1) - { - out.append("" + label + ""); - } - } - - if (next[j].getDescription().indexOf("") == -1) - { - out.append(""); - } - } - - out.append("\t"); - } - out.append(seqs[i].getName()); - out.append("\t-1\t"); - out.append(next[j].begin); - out.append("\t"); - out.append(next[j].end); - out.append("\t"); - out.append(next[j].type); - if (next[j].score != Float.NaN) - { - out.append("\t"); - out.append(next[j].score); - } - out.append(newline); - } - } - } - - if (group != null) - { - out.append("ENDGROUP\t"); - out.append(group); - out.append(newline); - groupIndex++; - } - else - { - break; - } - - } while (groupIndex < groups.size() + 1); - - if (!featuresGen) - { - return "No Features Visible"; - } - - return out.toString(); - } - - /** - * generate a gff file for sequence features includes non-pos features by - * default. - * - * @param seqs - * @param visible - * @return - */ - public String printGFFFormat(SequenceI[] seqs, Hashtable visible) - { - return printGFFFormat(seqs, visible, true, true); - } - - public String printGFFFormat(SequenceI[] seqs, Hashtable visible, - boolean visOnly, boolean nonpos) - { - StringBuffer out = new StringBuffer(); - SequenceFeature[] next; - String source; - boolean isnonpos; - for (int i = 0; i < seqs.length; i++) - { - if (seqs[i].getSequenceFeatures() != null) - { - next = seqs[i].getSequenceFeatures(); - for (int j = 0; j < next.length; j++) - { - isnonpos = next[j].begin == 0 && next[j].end == 0; - if ((!nonpos && isnonpos) - || (!isnonpos && visOnly && !visible - .containsKey(next[j].type))) - { - continue; - } - - source = next[j].featureGroup; - if (source == null) - { - source = next[j].getDescription(); - } - - out.append(seqs[i].getName()); - out.append("\t"); - out.append(source); - out.append("\t"); - out.append(next[j].type); - out.append("\t"); - out.append(next[j].begin); - out.append("\t"); - out.append(next[j].end); - out.append("\t"); - out.append(next[j].score); - out.append("\t"); - - if (next[j].getValue("STRAND") != null) - { - out.append(next[j].getValue("STRAND")); - out.append("\t"); - } - else - { - out.append(".\t"); - } - - if (next[j].getValue("FRAME") != null) - { - out.append(next[j].getValue("FRAME")); - } - else - { - out.append("."); - } - // TODO: verify/check GFF - should there be a /t here before attribute - // output ? - - if (next[j].getValue("ATTRIBUTES") != null) - { - out.append(next[j].getValue("ATTRIBUTES")); - } - - out.append(newline); - - } - } - } - - return out.toString(); - } - - /** - * this is only for the benefit of object polymorphism - method does nothing. - */ - public void parse() - { - // IGNORED - } - - /** - * this is only for the benefit of object polymorphism - method does nothing. - * - * @return error message - */ - public String print() - { - return "USE printGFFFormat() or printJalviewFormat()"; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io; + +import java.io.*; +import java.util.*; + +import jalview.analysis.SequenceIdMatcher; +import jalview.datamodel.*; +import jalview.schemes.*; +import jalview.util.Format; + +/** + * Parse and create Jalview Features files Detects GFF format features files and + * parses. Does not implement standard print() - call specific printFeatures or + * printGFF. Uses AlignmentI.findSequence(String id) to find the sequence object + * for the features annotation - this normally works on an exact match. + * + * @author AMW + * @version $Revision$ + */ +public class FeaturesFile extends AlignFile +{ + /** + * work around for GFF interpretation bug where source string becomes + * description rather than a group + */ + private boolean doGffSource = true; + + /** + * Creates a new FeaturesFile object. + */ + public FeaturesFile() + { + } + + /** + * Creates a new FeaturesFile object. + * + * @param inFile + * DOCUMENT ME! + * @param type + * DOCUMENT ME! + * + * @throws IOException + * DOCUMENT ME! + */ + public FeaturesFile(String inFile, String type) throws IOException + { + super(inFile, type); + } + + public FeaturesFile(FileParse source) throws IOException + { + super(source); + } + + /** + * Parse GFF or sequence features file using case-independent matching, + * discarding URLs + * + * @param align + * - alignment/dataset containing sequences that are to be annotated + * @param colours + * - hashtable to store feature colour definitions + * @param removeHTML + * - process html strings into plain text + * @return true if features were added + */ + public boolean parse(AlignmentI align, Hashtable colours, + boolean removeHTML) + { + return parse(align, colours, null, removeHTML, false); + } + + /** + * Parse GFF or sequence features file optionally using case-independent + * matching, discarding URLs + * + * @param align + * - alignment/dataset containing sequences that are to be annotated + * @param colours + * - hashtable to store feature colour definitions + * @param removeHTML + * - process html strings into plain text + * @param relaxedIdmatching + * - when true, ID matches to compound sequence IDs are allowed + * @return true if features were added + */ + public boolean parse(AlignmentI align, Map colours, boolean removeHTML, + boolean relaxedIdMatching) + { + return parse(align, colours, null, removeHTML, relaxedIdMatching); + } + + /** + * Parse GFF or sequence features file optionally using case-independent + * matching + * + * @param align + * - alignment/dataset containing sequences that are to be annotated + * @param colours + * - hashtable to store feature colour definitions + * @param featureLink + * - hashtable to store associated URLs + * @param removeHTML + * - process html strings into plain text + * @return true if features were added + */ + public boolean parse(AlignmentI align, Map colours, Map featureLink, + boolean removeHTML) + { + return parse(align, colours, featureLink, removeHTML, false); + } + + /** + * /** Parse GFF or sequence features file + * + * @param align + * - alignment/dataset containing sequences that are to be annotated + * @param colours + * - hashtable to store feature colour definitions + * @param featureLink + * - hashtable to store associated URLs + * @param removeHTML + * - process html strings into plain text + * @param relaxedIdmatching + * - when true, ID matches to compound sequence IDs are allowed + * @return true if features were added + */ + public boolean parse(AlignmentI align, Map colours, Map featureLink, + boolean removeHTML, boolean relaxedIdmatching) + { + + String line = null; + try + { + SequenceI seq = null; + String type, desc, token = null; + + int index, start, end; + float score; + StringTokenizer st; + SequenceFeature sf; + String featureGroup = null, groupLink = null; + Map typeLink = new Hashtable(); + /** + * when true, assume GFF style features rather than Jalview style. + */ + boolean GFFFile = true; + while ((line = nextLine()) != null) + { + if (line.startsWith("#")) + { + continue; + } + + st = new StringTokenizer(line, "\t"); + if (st.countTokens() == 1) + { + if (line.trim().equalsIgnoreCase("GFF")) + { + // Start parsing file as if it might be GFF again. + GFFFile = true; + continue; + } + } + if (st.countTokens() > 1 && st.countTokens() < 4) + { + GFFFile = false; + type = st.nextToken(); + if (type.equalsIgnoreCase("startgroup")) + { + featureGroup = st.nextToken(); + if (st.hasMoreElements()) + { + groupLink = st.nextToken(); + featureLink.put(featureGroup, groupLink); + } + } + else if (type.equalsIgnoreCase("endgroup")) + { + // We should check whether this is the current group, + // but at present theres no way of showing more than 1 group + st.nextToken(); + featureGroup = null; + groupLink = null; + } + else + { + Object colour = null; + String colscheme = st.nextToken(); + if (colscheme.indexOf("|") > -1 + || colscheme.trim().equalsIgnoreCase("label")) + { + // Parse '|' separated graduated colourscheme fields: + // [label|][mincolour|maxcolour|[absolute|]minvalue|maxvalue|thresholdtype|thresholdvalue] + // can either provide 'label' only, first is optional, next two + // colors are required (but may be + // left blank), next is optional, nxt two min/max are required. + // first is either 'label' + // first/second and third are both hexadecimal or word equivalent + // colour. + // next two are values parsed as floats. + // fifth is either 'above','below', or 'none'. + // sixth is a float value and only required when fifth is either + // 'above' or 'below'. + StringTokenizer gcol = new StringTokenizer(colscheme, "|", + true); + // set defaults + int threshtype = AnnotationColourGradient.NO_THRESHOLD; + float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN; + boolean labelCol = false; + // Parse spec line + String mincol = gcol.nextToken(); + if (mincol == "|") + { + System.err + .println("Expected either 'label' or a colour specification in the line: " + + line); + continue; + } + String maxcol = null; + if (mincol.toLowerCase().indexOf("label") == 0) + { + labelCol = true; + mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip + // '|' + mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); + } + String abso = null, minval, maxval; + if (mincol != null) + { + // at least four more tokens + if (mincol.equals("|")) + { + mincol = ""; + } + else + { + gcol.nextToken(); // skip next '|' + } + // continue parsing rest of line + maxcol = gcol.nextToken(); + if (maxcol.equals("|")) + { + maxcol = ""; + } + else + { + gcol.nextToken(); // skip next '|' + } + abso = gcol.nextToken(); + gcol.nextToken(); // skip next '|' + if (abso.toLowerCase().indexOf("abso") != 0) + { + minval = abso; + abso = null; + } + else + { + minval = gcol.nextToken(); + gcol.nextToken(); // skip next '|' + } + maxval = gcol.nextToken(); + if (gcol.hasMoreTokens()) + { + gcol.nextToken(); // skip next '|' + } + try + { + if (minval.length() > 0) + { + min = new Float(minval).floatValue(); + } + } catch (Exception e) + { + System.err + .println("Couldn't parse the minimum value for graduated colour for type (" + + colscheme + + ") - did you misspell 'auto' for the optional automatic colour switch ?"); + e.printStackTrace(); + } + try + { + if (maxval.length() > 0) + { + max = new Float(maxval).floatValue(); + } + } catch (Exception e) + { + System.err + .println("Couldn't parse the maximum value for graduated colour for type (" + + colscheme + ")"); + e.printStackTrace(); + } + } + else + { + // add in some dummy min/max colours for the label-only + // colourscheme. + mincol = "FFFFFF"; + maxcol = "000000"; + } + try + { + colour = new jalview.schemes.GraduatedColor( + new UserColourScheme(mincol).findColour('A'), + new UserColourScheme(maxcol).findColour('A'), min, + max); + } catch (Exception e) + { + System.err + .println("Couldn't parse the graduated colour scheme (" + + colscheme + ")"); + e.printStackTrace(); + } + if (colour != null) + { + ((jalview.schemes.GraduatedColor) colour) + .setColourByLabel(labelCol); + ((jalview.schemes.GraduatedColor) colour) + .setAutoScaled(abso == null); + // add in any additional parameters + String ttype = null, tval = null; + if (gcol.hasMoreTokens()) + { + // threshold type and possibly a threshold value + ttype = gcol.nextToken(); + if (ttype.toLowerCase().startsWith("below")) + { + ((jalview.schemes.GraduatedColor) colour) + .setThreshType(AnnotationColourGradient.BELOW_THRESHOLD); + } + else if (ttype.toLowerCase().startsWith("above")) + { + ((jalview.schemes.GraduatedColor) colour) + .setThreshType(AnnotationColourGradient.ABOVE_THRESHOLD); + } + else + { + ((jalview.schemes.GraduatedColor) colour) + .setThreshType(AnnotationColourGradient.NO_THRESHOLD); + if (!ttype.toLowerCase().startsWith("no")) + { + System.err + .println("Ignoring unrecognised threshold type : " + + ttype); + } + } + } + if (((GraduatedColor) colour).getThreshType() != AnnotationColourGradient.NO_THRESHOLD) + { + try + { + gcol.nextToken(); + tval = gcol.nextToken(); + ((jalview.schemes.GraduatedColor) colour) + .setThresh(new Float(tval).floatValue()); + } catch (Exception e) + { + System.err + .println("Couldn't parse threshold value as a float: (" + + tval + ")"); + e.printStackTrace(); + } + } + // parse the thresh-is-min token ? + if (gcol.hasMoreTokens()) + { + System.err + .println("Ignoring additional tokens in parameters in graduated colour specification\n"); + while (gcol.hasMoreTokens()) + { + System.err.println("|" + gcol.nextToken()); + } + System.err.println("\n"); + } + } + } + else + { + UserColourScheme ucs = new UserColourScheme(colscheme); + colour = ucs.findColour('A'); + } + if (colour != null) + { + colours.put(type, colour); + } + if (st.hasMoreElements()) + { + String link = st.nextToken(); + typeLink.put(type, link); + if (featureLink == null) + { + featureLink = new Hashtable(); + } + featureLink.put(type, link); + } + } + continue; + } + String seqId = ""; + while (st.hasMoreElements()) + { + + if (GFFFile) + { + // Still possible this is an old Jalview file, + // which does not have type colours at the beginning + seqId = token = st.nextToken(); + seq = findName(align, seqId, relaxedIdmatching); + if (seq != null) + { + desc = st.nextToken(); + String group = null; + if (doGffSource && desc.indexOf(' ') == -1) + { + // could also be a source term rather than description line + group = new String(desc); + } + type = st.nextToken(); + try + { + String stt = st.nextToken(); + if (stt.length() == 0 || stt.equals("-")) + { + start = 0; + } + else + { + start = Integer.parseInt(stt); + } + } catch (NumberFormatException ex) + { + start = 0; + } + try + { + String stt = st.nextToken(); + if (stt.length() == 0 || stt.equals("-")) + { + end = 0; + } + else + { + end = Integer.parseInt(stt); + } + } catch (NumberFormatException ex) + { + end = 0; + } + // TODO: decide if non positional feature assertion for input data + // where end==0 is generally valid + if (end == 0) + { + // treat as non-positional feature, regardless. + start = 0; + } + try + { + score = new Float(st.nextToken()).floatValue(); + } catch (NumberFormatException ex) + { + score = 0; + } + + sf = new SequenceFeature(type, desc, start, end, score, group); + + try + { + sf.setValue("STRAND", st.nextToken()); + sf.setValue("FRAME", st.nextToken()); + } catch (Exception ex) + { + } + + if (st.hasMoreTokens()) + { + StringBuffer attributes = new StringBuffer(); + while (st.hasMoreTokens()) + { + attributes.append("\t" + st.nextElement()); + } + // TODO validate and split GFF2 attributes field ? parse out + // ([A-Za-z][A-Za-z0-9_]*) ; and add as + // sf.setValue(attrib, val); + sf.setValue("ATTRIBUTES", attributes.toString()); + } + + seq.addSequenceFeature(sf); + while ((seq = align.findName(seq, seqId, true)) != null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } + break; + } + } + + if (GFFFile && seq == null) + { + desc = token; + } + else + { + desc = st.nextToken(); + } + if (!st.hasMoreTokens()) + { + System.err + .println("DEBUG: Run out of tokens when trying to identify the destination for the feature.. giving up."); + // in all probability, this isn't a file we understand, so bail + // quietly. + return false; + } + + token = st.nextToken(); + + if (!token.equals("ID_NOT_SPECIFIED")) + { + seq = findName(align, seqId = token, relaxedIdmatching); + st.nextToken(); + } + else + { + seqId = null; + try + { + index = Integer.parseInt(st.nextToken()); + seq = align.getSequenceAt(index); + } catch (NumberFormatException ex) + { + seq = null; + } + } + + if (seq == null) + { + System.out.println("Sequence not found: " + line); + break; + } + + start = Integer.parseInt(st.nextToken()); + end = Integer.parseInt(st.nextToken()); + + type = st.nextToken(); + + if (!colours.containsKey(type)) + { + // Probably the old style groups file + UserColourScheme ucs = new UserColourScheme(type); + colours.put(type, ucs.findColour('A')); + } + sf = new SequenceFeature(type, desc, "", start, end, featureGroup); + if (st.hasMoreTokens()) + { + try + { + score = new Float(st.nextToken()).floatValue(); + // update colourgradient bounds if allowed to + } catch (NumberFormatException ex) + { + score = 0; + } + sf.setScore(score); + } + if (groupLink != null && removeHTML) + { + sf.addLink(groupLink); + sf.description += "%LINK%"; + } + if (typeLink.containsKey(type) && removeHTML) + { + sf.addLink(typeLink.get(type).toString()); + sf.description += "%LINK%"; + } + + parseDescriptionHTML(sf, removeHTML); + + seq.addSequenceFeature(sf); + + while (seqId != null + && (seq = align.findName(seq, seqId, false)) != null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } + // If we got here, its not a GFFFile + GFFFile = false; + } + } + resetMatcher(); + } catch (Exception ex) + { + System.out.println(line); + System.out.println("Error parsing feature file: " + ex + "\n" + line); + ex.printStackTrace(System.err); + resetMatcher(); + return false; + } + + return true; + } + + private AlignmentI lastmatchedAl = null; + + private SequenceIdMatcher matcher = null; + + /** + * clear any temporary handles used to speed up ID matching + */ + private void resetMatcher() + { + lastmatchedAl = null; + matcher = null; + } + + private SequenceI findName(AlignmentI align, String seqId, + boolean relaxedIdMatching) + { + SequenceI match = null; + if (relaxedIdMatching) + { + if (lastmatchedAl != align) + { + matcher = new SequenceIdMatcher( + (lastmatchedAl = align).getSequencesArray()); + } + match = matcher.findIdMatch(seqId); + } + else + { + match = align.findName(seqId, true); + } + return match; + } + + public void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML) + { + if (sf.getDescription() == null) + { + return; + } + jalview.util.ParseHtmlBodyAndLinks parsed = new jalview.util.ParseHtmlBodyAndLinks( + sf.getDescription(), removeHTML, newline); + + sf.description = (removeHTML) ? parsed.getNonHtmlContent() + : sf.description; + for (String link : parsed.getLinks()) + { + sf.addLink(link); + } + + } + + /** + * generate a features file for seqs includes non-pos features by default. + * + * @param seqs + * source of sequence features + * @param visible + * hash of feature types and colours + * @return features file contents + */ + public String printJalviewFormat(SequenceI[] seqs, Hashtable visible) + { + return printJalviewFormat(seqs, visible, true, true); + } + + /** + * generate a features file for seqs with colours from visible (if any) + * + * @param seqs + * source of features + * @param visible + * hash of Colours for each feature type + * @param visOnly + * when true only feature types in 'visible' will be output + * @param nonpos + * indicates if non-positional features should be output (regardless + * of group or type) + * @return features file contents + */ + public String printJalviewFormat(SequenceI[] seqs, Hashtable visible, + boolean visOnly, boolean nonpos) + { + StringBuffer out = new StringBuffer(); + SequenceFeature[] next; + boolean featuresGen = false; + if (visOnly && !nonpos && (visible == null || visible.size() < 1)) + { + // no point continuing. + return "No Features Visible"; + } + + if (visible != null && visOnly) + { + // write feature colours only if we're given them and we are generating + // viewed features + // TODO: decide if feature links should also be written here ? + Enumeration en = visible.keys(); + String type, color; + while (en.hasMoreElements()) + { + type = en.nextElement().toString(); + + if (visible.get(type) instanceof GraduatedColor) + { + GraduatedColor gc = (GraduatedColor) visible.get(type); + color = (gc.isColourByLabel() ? "label|" : "") + + Format.getHexString(gc.getMinColor()) + "|" + + Format.getHexString(gc.getMaxColor()) + + (gc.isAutoScale() ? "|" : "|abso|") + gc.getMin() + "|" + + gc.getMax() + "|"; + if (gc.getThreshType() != AnnotationColourGradient.NO_THRESHOLD) + { + if (gc.getThreshType() == AnnotationColourGradient.BELOW_THRESHOLD) + { + color += "below"; + } + else + { + if (gc.getThreshType() != AnnotationColourGradient.ABOVE_THRESHOLD) + { + System.err.println("WARNING: Unsupported threshold type (" + + gc.getThreshType() + ") : Assuming 'above'"); + } + color += "above"; + } + // add the value + color += "|" + gc.getThresh(); + } + else + { + color += "none"; + } + } + else if (visible.get(type) instanceof java.awt.Color) + { + color = Format.getHexString((java.awt.Color) visible.get(type)); + } + else + { + // legacy support for integer objects containing colour triplet values + color = Format.getHexString(new java.awt.Color(Integer + .parseInt(visible.get(type).toString()))); + } + out.append(type); + out.append("\t"); + out.append(color); + out.append(newline); + } + } + // Work out which groups are both present and visible + Vector groups = new Vector(); + int groupIndex = 0; + boolean isnonpos = false; + + for (int i = 0; i < seqs.length; i++) + { + next = seqs[i].getSequenceFeatures(); + if (next != null) + { + for (int j = 0; j < next.length; j++) + { + isnonpos = next[j].begin == 0 && next[j].end == 0; + if ((!nonpos && isnonpos) + || (!isnonpos && visOnly && !visible + .containsKey(next[j].type))) + { + continue; + } + + if (next[j].featureGroup != null + && !groups.contains(next[j].featureGroup)) + { + groups.addElement(next[j].featureGroup); + } + } + } + } + + String group = null; + do + { + + if (groups.size() > 0 && groupIndex < groups.size()) + { + group = groups.elementAt(groupIndex).toString(); + out.append(newline); + out.append("STARTGROUP\t"); + out.append(group); + out.append(newline); + } + else + { + group = null; + } + + for (int i = 0; i < seqs.length; i++) + { + next = seqs[i].getSequenceFeatures(); + if (next != null) + { + for (int j = 0; j < next.length; j++) + { + isnonpos = next[j].begin == 0 && next[j].end == 0; + if ((!nonpos && isnonpos) + || (!isnonpos && visOnly && !visible + .containsKey(next[j].type))) + { + // skip if feature is nonpos and we ignore them or if we only + // output visible and it isn't non-pos and it's not visible + continue; + } + + if (group != null + && (next[j].featureGroup == null || !next[j].featureGroup + .equals(group))) + { + continue; + } + + if (group == null && next[j].featureGroup != null) + { + continue; + } + // we have features to output + featuresGen = true; + if (next[j].description == null + || next[j].description.equals("")) + { + out.append(next[j].type + "\t"); + } + else + { + if (next[j].links != null + && next[j].getDescription().indexOf("") == -1) + { + out.append(""); + } + + out.append(next[j].description + " "); + if (next[j].links != null) + { + for (int l = 0; l < next[j].links.size(); l++) + { + String label = next[j].links.elementAt(l).toString(); + String href = label.substring(label.indexOf("|") + 1); + label = label.substring(0, label.indexOf("|")); + + if (next[j].description.indexOf(href) == -1) + { + out.append("" + label + ""); + } + } + + if (next[j].getDescription().indexOf("") == -1) + { + out.append(""); + } + } + + out.append("\t"); + } + out.append(seqs[i].getName()); + out.append("\t-1\t"); + out.append(next[j].begin); + out.append("\t"); + out.append(next[j].end); + out.append("\t"); + out.append(next[j].type); + if (next[j].score != Float.NaN) + { + out.append("\t"); + out.append(next[j].score); + } + out.append(newline); + } + } + } + + if (group != null) + { + out.append("ENDGROUP\t"); + out.append(group); + out.append(newline); + groupIndex++; + } + else + { + break; + } + + } while (groupIndex < groups.size() + 1); + + if (!featuresGen) + { + return "No Features Visible"; + } + + return out.toString(); + } + + /** + * generate a gff file for sequence features includes non-pos features by + * default. + * + * @param seqs + * @param visible + * @return + */ + public String printGFFFormat(SequenceI[] seqs, Hashtable visible) + { + return printGFFFormat(seqs, visible, true, true); + } + + public String printGFFFormat(SequenceI[] seqs, Hashtable visible, + boolean visOnly, boolean nonpos) + { + StringBuffer out = new StringBuffer(); + SequenceFeature[] next; + String source; + boolean isnonpos; + for (int i = 0; i < seqs.length; i++) + { + if (seqs[i].getSequenceFeatures() != null) + { + next = seqs[i].getSequenceFeatures(); + for (int j = 0; j < next.length; j++) + { + isnonpos = next[j].begin == 0 && next[j].end == 0; + if ((!nonpos && isnonpos) + || (!isnonpos && visOnly && !visible + .containsKey(next[j].type))) + { + continue; + } + + source = next[j].featureGroup; + if (source == null) + { + source = next[j].getDescription(); + } + + out.append(seqs[i].getName()); + out.append("\t"); + out.append(source); + out.append("\t"); + out.append(next[j].type); + out.append("\t"); + out.append(next[j].begin); + out.append("\t"); + out.append(next[j].end); + out.append("\t"); + out.append(next[j].score); + out.append("\t"); + + if (next[j].getValue("STRAND") != null) + { + out.append(next[j].getValue("STRAND")); + out.append("\t"); + } + else + { + out.append(".\t"); + } + + if (next[j].getValue("FRAME") != null) + { + out.append(next[j].getValue("FRAME")); + } + else + { + out.append("."); + } + // TODO: verify/check GFF - should there be a /t here before attribute + // output ? + + if (next[j].getValue("ATTRIBUTES") != null) + { + out.append(next[j].getValue("ATTRIBUTES")); + } + + out.append(newline); + + } + } + } + + return out.toString(); + } + + /** + * this is only for the benefit of object polymorphism - method does nothing. + */ + public void parse() + { + // IGNORED + } + + /** + * this is only for the benefit of object polymorphism - method does nothing. + * + * @return error message + */ + public String print() + { + return "USE printGFFFormat() or printJalviewFormat()"; + } + +} diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 24b6c61..975a1a3 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 2caf634..62237d9 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 81460eb..bdc015c 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 6be11a8..71c822c 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index d30ed20..2569f7d 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java index 396847d..0fae4ee 100755 --- a/src/jalview/io/JPredFile.java +++ b/src/jalview/io/JPredFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/JalviewFileChooser.java b/src/jalview/io/JalviewFileChooser.java index 1e76782..b0db2e0 100755 --- a/src/jalview/io/JalviewFileChooser.java +++ b/src/jalview/io/JalviewFileChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/JalviewFileFilter.java b/src/jalview/io/JalviewFileFilter.java index fad3dab..214fa34 100755 --- a/src/jalview/io/JalviewFileFilter.java +++ b/src/jalview/io/JalviewFileFilter.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/JalviewFileView.java b/src/jalview/io/JalviewFileView.java index a4db9f4..7f360c8 100755 --- a/src/jalview/io/JalviewFileView.java +++ b/src/jalview/io/JalviewFileView.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java index 7252e5d..957c5e7 100755 --- a/src/jalview/io/JnetAnnotationMaker.java +++ b/src/jalview/io/JnetAnnotationMaker.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index 32cbb02..7c70a09 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/MatrixFile.java b/src/jalview/io/MatrixFile.java index 1aa87a5..a8f13c3 100644 --- a/src/jalview/io/MatrixFile.java +++ b/src/jalview/io/MatrixFile.java @@ -1,34 +1,34 @@ -/* - * 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 . - */ -package jalview.io; - -import java.io.IOException; - -/** - * IO for asymmetric matrix with arbitrary dimension with labels, as displayed - * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle - * DESC\tdesc PROPERTY\t\tname\ttype\tvalue - * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t... - * COLUMN\t(similar, optional).. .. \t...(column-wise data for row - * i) - */ - -public class MatrixFile extends FileParse -{ - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io; + +import java.io.IOException; + +/** + * IO for asymmetric matrix with arbitrary dimension with labels, as displayed + * by PCA viewer. Form is: tab separated entity defs header line TITLE\ttitle + * DESC\tdesc PROPERTY\t\tname\ttype\tvalue + * ROW\tRow i label (ID)/tPrinciple text/tprinciple description/t... + * COLUMN\t(similar, optional).. .. \t...(column-wise data for row + * i) + */ + +public class MatrixFile extends FileParse +{ + +} diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java index e7e6a38..5c8231e 100755 --- a/src/jalview/io/ModellerDescription.java +++ b/src/jalview/io/ModellerDescription.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index 769f9bd..d664dcf 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/PIRFile.java b/src/jalview/io/PIRFile.java index 07dc6b5..9431cc5 100755 --- a/src/jalview/io/PIRFile.java +++ b/src/jalview/io/PIRFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/PfamFile.java b/src/jalview/io/PfamFile.java index f74a15a..527312b 100755 --- a/src/jalview/io/PfamFile.java +++ b/src/jalview/io/PfamFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/PileUpfile.java b/src/jalview/io/PileUpfile.java index 9c8815e..de0d8a3 100755 --- a/src/jalview/io/PileUpfile.java +++ b/src/jalview/io/PileUpfile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index ee8ac17..497e4c9 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.io; import java.util.ArrayList; diff --git a/src/jalview/io/SimpleBlastFile.java b/src/jalview/io/SimpleBlastFile.java index ec1cbd0..4deb3f1 100644 --- a/src/jalview/io/SimpleBlastFile.java +++ b/src/jalview/io/SimpleBlastFile.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index a9124d9..5ff3551 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -1,689 +1,689 @@ -/* - * 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 . - */ -/* - * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk - */ -package jalview.io; - -import java.io.*; -import java.util.*; - -import com.stevesoft.pat.*; -import jalview.datamodel.*; -import jalview.analysis.Rna; - -// import org.apache.log4j.*; - -/** - * This class is supposed to parse a Stockholm format file into Jalview There - * are TODOs in this class: we do not know what the database source and version - * is for the file when parsing the #GS= AC tag which associates accessions with - * sequences. Database references are also not parsed correctly: a separate - * reference string parser must be added to parse the database reference form - * into Jalview's local representation. - * - * @author bsb at sanger.ac.uk - * @version 0.3 + jalview mods - * - */ -public class StockholmFile extends AlignFile -{ - // static Logger logger = Logger.getLogger("jalview.io.StockholmFile"); - - public StockholmFile() - { - } - - public StockholmFile(String inFile, String type) throws IOException - { - super(inFile, type); - } - - public StockholmFile(FileParse source) throws IOException - { - super(source); - } - - public void initData() - { - super.initData(); - } - - /** - * Parse a file in Stockholm format into Jalview's data model. The file has to - * be passed at construction time - * - * @throws IOException - * If there is an error with the input file - */ - public void parse() throws IOException - { - StringBuffer treeString = new StringBuffer(); - String treeName = null; - // --------------- Variable Definitions ------------------- - String line; - String version; - // String id; - Hashtable seqAnn = new Hashtable(); // Sequence related annotations - Hashtable seqs = new Hashtable(); - Regex p, r, rend, s, x; - - // Temporary line for processing RNA annotation - // String RNAannot = ""; - - // ------------------ Parsing File ---------------------- - // First, we have to check that this file has STOCKHOLM format, i.e. the - // first line must match - r = new Regex("# STOCKHOLM ([\\d\\.]+)"); - if (!r.search(nextLine())) - { - throw new IOException( - "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'"); - } - else - { - version = r.stringMatched(1); - // logger.debug("Stockholm version: " + version); - } - - // We define some Regexes here that will be used regularily later - rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment - p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in - // id/from/to - s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype - r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line - x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence - - // Convert all bracket types to parentheses (necessary for passing to VARNA) - Regex openparen = new Regex("(<|\\[)", "("); - Regex closeparen = new Regex("(>|\\])", ")"); - - // Detect if file is RNA by looking for bracket types - Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); - - rend.optimize(); - p.optimize(); - s.optimize(); - r.optimize(); - x.optimize(); - openparen.optimize(); - closeparen.optimize(); - - while ((line = nextLine()) != null) - { - if (line.length() == 0) - { - continue; - } - if (rend.search(line)) - { - // End of the alignment, pass stuff back - - this.noSeqs = seqs.size(); - // logger.debug("Number of sequences: " + this.noSeqs); - Enumeration accs = seqs.keys(); - while (accs.hasMoreElements()) - { - String acc = (String) accs.nextElement(); - // logger.debug("Processing sequence " + acc); - String seq = (String) seqs.remove(acc); - if (maxLength < seq.length()) - { - maxLength = seq.length(); - } - int start = 1; - int end = -1; - String sid = acc; - /* - * Retrieve hash of annotations for this accession Associate - * Annotation with accession - */ - Hashtable accAnnotations = null; - - if (seqAnn != null && seqAnn.containsKey(acc)) - { - accAnnotations = (Hashtable) seqAnn.remove(acc); - // TODO: add structures to sequence - } - - // Split accession in id and from/to - if (p.search(acc)) - { - sid = p.stringMatched(1); - start = Integer.parseInt(p.stringMatched(2)); - end = Integer.parseInt(p.stringMatched(3)); - } - // logger.debug(sid + ", " + start + ", " + end); - - Sequence seqO = new Sequence(sid, seq, start, end); - // Add Description (if any) - if (accAnnotations != null && accAnnotations.containsKey("DE")) - { - String desc = (String) accAnnotations.get("DE"); - seqO.setDescription((desc == null) ? "" : desc); - } - // Add DB References (if any) - if (accAnnotations != null && accAnnotations.containsKey("DR")) - { - String dbr = (String) accAnnotations.get("DR"); - if (dbr != null && dbr.indexOf(";") > -1) - { - String src = dbr.substring(0, dbr.indexOf(";")); - String acn = dbr.substring(dbr.indexOf(";") + 1); - jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); - // seqO.addDBRef(dbref); - } - } - if (accAnnotations != null && accAnnotations.containsKey("SS")) - { - Vector v = (Vector) accAnnotations.get("SS"); - - for (int i = 0; i < v.size(); i++) - { - AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i); - seqO.addAlignmentAnnotation(an); - // annotations.add(an); - } - } - - Hashtable features = null; - // We need to adjust the positions of all features to account for gaps - try - { - features = (Hashtable) accAnnotations.remove("features"); - } catch (java.lang.NullPointerException e) - { - // loggerwarn("Getting Features for " + acc + ": " + - // e.getMessage()); - // continue; - } - // if we have features - if (features != null) - { - int posmap[] = seqO.findPositionMap(); - Enumeration i = features.keys(); - while (i.hasMoreElements()) - { - // TODO: parse out secondary structure annotation as annotation - // row - // TODO: parse out scores as annotation row - // TODO: map coding region to core jalview feature types - String type = i.nextElement().toString(); - Hashtable content = (Hashtable) features.remove(type); - Enumeration j = content.keys(); - while (j.hasMoreElements()) - { - String desc = j.nextElement().toString(); - String ns = content.get(desc).toString(); - char[] byChar = ns.toCharArray(); - for (int k = 0; k < byChar.length; k++) - { - char c = byChar[k]; - if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM - // uses - // '.' - // for - // feature - // background - { - int new_pos = posmap[k]; // look up nearest seqeunce - // position to this column - SequenceFeature feat = new SequenceFeature(type, desc, - new_pos, new_pos, 0f, null); - - seqO.addSequenceFeature(feat); - } - } - } - - } - - } - // garbage collect - - // logger.debug("Adding seq " + acc + " from " + start + " to " + end - // + ": " + seq); - this.seqs.addElement(seqO); - } - return; // finished parsing this segment of source - } - else if (!r.search(line)) - { - // System.err.println("Found sequence line: " + line); - - // Split sequence in sequence and accession parts - if (!x.search(line)) - { - // logger.error("Could not parse sequence line: " + line); - throw new IOException("Could not parse sequence line: " + line); - } - String ns = (String) seqs.get(x.stringMatched(1)); - if (ns == null) - { - ns = ""; - } - ns += x.stringMatched(2); - - seqs.put(x.stringMatched(1), ns); - } - else - { - String annType = r.stringMatched(1); - String annContent = r.stringMatched(2); - - // System.err.println("type:" + annType + " content: " + annContent); - - if (annType.equals("GF")) - { - /* - * Generic per-File annotation, free text Magic features: #=GF NH - * #=GF TN Pfam descriptions: 7. DESCRIPTION OF FIELDS - * - * Compulsory fields: ------------------ - * - * AC Accession number: Accession number in form PFxxxxx.version or - * PBxxxxxx. ID Identification: One word name for family. DE - * Definition: Short description of family. AU Author: Authors of the - * entry. SE Source of seed: The source suggesting the seed members - * belong to one family. GA Gathering method: Search threshold to - * build the full alignment. TC Trusted Cutoff: Lowest sequence score - * and domain score of match in the full alignment. NC Noise Cutoff: - * Highest sequence score and domain score of match not in full - * alignment. TP Type: Type of family -- presently Family, Domain, - * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM - * Alignment Method The order ls and fs hits are aligned to the model - * to build the full align. // End of alignment. - * - * Optional fields: ---------------- - * - * DC Database Comment: Comment about database reference. DR Database - * Reference: Reference to external database. RC Reference Comment: - * Comment about literature reference. RN Reference Number: Reference - * Number. RM Reference Medline: Eight digit medline UI number. RT - * Reference Title: Reference Title. RA Reference Author: Reference - * Author RL Reference Location: Journal location. PI Previous - * identifier: Record of all previous ID lines. KW Keywords: Keywords. - * CC Comment: Comments. NE Pfam accession: Indicates a nested domain. - * NL Location: Location of nested domains - sequence ID, start and - * end of insert. - * - * Obsolete fields: ----------- AL Alignment method of seed: The - * method used to align the seed members. - */ - // Let's save the annotations, maybe we'll be able to do something - // with them later... - Regex an = new Regex("(\\w+)\\s*(.*)"); - if (an.search(annContent)) - { - if (an.stringMatched(1).equals("NH")) - { - treeString.append(an.stringMatched(2)); - } - else if (an.stringMatched(1).equals("TN")) - { - if (treeString.length() > 0) - { - if (treeName == null) - { - treeName = "Tree " + (getTreeCount() + 1); - } - addNewickTree(treeName, treeString.toString()); - } - treeName = an.stringMatched(2); - treeString = new StringBuffer(); - } - setAlignmentProperty(an.stringMatched(1), an.stringMatched(2)); - } - } - else if (annType.equals("GS")) - { - // Generic per-Sequence annotation, free text - /* - * Pfam uses these features: Feature Description --------------------- - * ----------- AC ACcession number DE - * DEscription DR ; ; Database Reference OS - * OrganiSm (species) OC Organism Classification (clade, etc.) - * LO Look (Color, etc.) - */ - if (s.search(annContent)) - { - String acc = s.stringMatched(1); - String type = s.stringMatched(2); - String content = s.stringMatched(3); - // TODO: store DR in a vector. - // TODO: store AC according to generic file db annotation. - Hashtable ann; - if (seqAnn.containsKey(acc)) - { - ann = (Hashtable) seqAnn.get(acc); - } - else - { - ann = new Hashtable(); - } - ann.put(type, content); - seqAnn.put(acc, ann); - } - else - { - throw new IOException("Error parsing " + line); - } - } - else if (annType.equals("GC")) - { - // Generic per-Column annotation, exactly 1 char per column - // always need a label. - if (x.search(annContent)) - { - // parse out and create alignment annotation directly. - parseAnnotationRow(annotations, x.stringMatched(1), - x.stringMatched(2)); - } - } - else if (annType.equals("GR")) - { - // Generic per-Sequence AND per-Column markup, exactly 1 char per - // column - /* - * Feature Description Markup letters ------- ----------- - * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface - * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane - * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15; - * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in - * or after) [0-2] - */ - if (s.search(annContent)) - { - String acc = s.stringMatched(1); - String type = s.stringMatched(2); - String seq = new String(s.stringMatched(3)); - String description = null; - // Check for additional information about the current annotation - // We use a simple string tokenizer here for speed - StringTokenizer sep = new StringTokenizer(seq, " \t"); - description = sep.nextToken(); - if (sep.hasMoreTokens()) - { - seq = sep.nextToken(); - } - else - { - seq = description; - description = new String(); - } - // sequence id with from-to fields - - Hashtable ann; - // Get an object with all the annotations for this sequence - if (seqAnn.containsKey(acc)) - { - // logger.debug("Found annotations for " + acc); - ann = (Hashtable) seqAnn.get(acc); - } - else - { - // logger.debug("Creating new annotations holder for " + acc); - ann = new Hashtable(); - seqAnn.put(acc, ann); - } - // TODO test structure, call parseAnnotationRow with vector from - // hashtable for specific sequence - Hashtable features; - // Get an object with all the content for an annotation - if (ann.containsKey("features")) - { - // logger.debug("Found features for " + acc); - features = (Hashtable) ann.get("features"); - } - else - { - // logger.debug("Creating new features holder for " + acc); - features = new Hashtable(); - ann.put("features", features); - } - - Hashtable content; - if (features.containsKey(this.id2type(type))) - { - // logger.debug("Found content for " + this.id2type(type)); - content = (Hashtable) features.get(this.id2type(type)); - } - else - { - // logger.debug("Creating new content holder for " + - // this.id2type(type)); - content = new Hashtable(); - features.put(this.id2type(type), content); - } - String ns = (String) content.get(description); - if (ns == null) - { - ns = ""; - } - ns += seq; - content.put(description, ns); - - if (type.equals("SS")) - { - Hashtable strucAnn; - if (seqAnn.containsKey(acc)) - { - strucAnn = (Hashtable) seqAnn.get(acc); - } - else - { - strucAnn = new Hashtable(); - } - - Vector newStruc = new Vector(); - parseAnnotationRow(newStruc, type, ns); - - strucAnn.put(type, newStruc); - seqAnn.put(acc, strucAnn); - } - } - else - { - System.err - .println("Warning - couldn't parse sequence annotation row line:\n" - + line); - // throw new IOException("Error parsing " + line); - } - } - else - { - throw new IOException("Unknown annotation detected: " + annType - + " " + annContent); - } - } - } - if (treeString.length() > 0) - { - if (treeName == null) - { - treeName = "Tree " + (1 + getTreeCount()); - } - addNewickTree(treeName, treeString.toString()); - } - } - - protected static AlignmentAnnotation parseAnnotationRow( - Vector annotation, String label, String annots) - { - String convert1, convert2 = null; - - // Convert all bracket types to parentheses - Regex openparen = new Regex("(<|\\[)", "("); - Regex closeparen = new Regex("(>|\\])", ")"); - - // Detect if file is RNA by looking for bracket types - Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); - - convert1 = openparen.replaceAll(annots); - convert2 = closeparen.replaceAll(convert1); - annots = convert2; - - String type = (label.indexOf("_cons") == label.length() - 5) ? label - .substring(0, label.length() - 5) : label; - boolean ss = false; - type = id2type(type); - if (type.equals("secondary structure")) - { - ss = true; - } - // decide on secondary structure or not. - Annotation[] els = new Annotation[annots.length()]; - for (int i = 0; i < annots.length(); i++) - { - String pos = annots.substring(i, i + 1); - Annotation ann; - ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not - // be written out - if (ss) - { - if (detectbrackets.search(pos)) - { - ann.secondaryStructure = jalview.schemes.ResidueProperties - .getRNASecStrucState(pos).charAt(0); - } - else - { - ann.secondaryStructure = jalview.schemes.ResidueProperties - .getDssp3state(pos).charAt(0); - } - - if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C') - { - ann.displayCharacter = ""; // null; // " "; - } - else - { - ann.displayCharacter = " " + ann.displayCharacter; - } - } - - els[i] = ann; - } - AlignmentAnnotation annot = null; - Enumeration e = annotation.elements(); - while (e.hasMoreElements()) - { - annot = (AlignmentAnnotation) e.nextElement(); - if (annot.label.equals(type)) - break; - annot = null; - } - if (annot == null) - { - annot = new AlignmentAnnotation(type, type, els); - annotation.addElement(annot); - } - else - { - Annotation[] anns = new Annotation[annot.annotations.length - + els.length]; - System.arraycopy(annot.annotations, 0, anns, 0, - annot.annotations.length); - System.arraycopy(els, 0, anns, annot.annotations.length, els.length); - annot.annotations = anns; - // System.out.println("else: "); - } - return annot; - } - - public static String print(SequenceI[] s) - { - return "not yet implemented"; - } - - public String print() - { - return print(getSeqsAsArray()); - } - - private static Hashtable typeIds = null; - static - { - if (typeIds == null) - { - typeIds = new Hashtable(); - typeIds.put("SS", "secondary structure"); - typeIds.put("SA", "surface accessibility"); - typeIds.put("TM", "transmembrane"); - typeIds.put("PP", "posterior probability"); - typeIds.put("LI", "ligand binding"); - typeIds.put("AS", "active site"); - typeIds.put("IN", "intron"); - typeIds.put("IR", "interacting residue"); - typeIds.put("AC", "accession"); - typeIds.put("OS", "organism"); - typeIds.put("CL", "class"); - typeIds.put("DE", "description"); - typeIds.put("DR", "reference"); - typeIds.put("LO", "look"); - typeIds.put("RF", "reference positions"); - - } - } - - protected static String id2type(String id) - { - if (typeIds.containsKey(id)) - { - return (String) typeIds.get(id); - } - System.err.println("Warning : Unknown Stockholm annotation type code " - + id); - return id; - } - /** - * //ssline is complete secondary structure line private AlignmentAnnotation - * addHelices(Vector annotation, String label, String ssline) { - * - * // decide on secondary structure or not. Annotation[] els = new - * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) { - * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new - * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not - * - * ann.secondaryStructure = - * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0); - * - * ann.displayCharacter = "x" + ann.displayCharacter; - * - * System.out.println(ann.displayCharacter); - * - * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e = - * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot = - * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type)) - * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot = - * new AlignmentAnnotation(type, type, els); - * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new - * Annotation[helicesAnnot.annotations.length + els.length]; - * System.arraycopy(helicesAnnot.annotations, 0, anns, 0, - * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns, - * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations = - * anns; } - * - * helicesAnnot.features = Rna.GetBasePairs(ssline); - * Rna.HelixMap(helicesAnnot.features); - * - * - * return helicesAnnot; } - */ -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +/* + * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk + */ +package jalview.io; + +import java.io.*; +import java.util.*; + +import com.stevesoft.pat.*; +import jalview.datamodel.*; +import jalview.analysis.Rna; + +// import org.apache.log4j.*; + +/** + * This class is supposed to parse a Stockholm format file into Jalview There + * are TODOs in this class: we do not know what the database source and version + * is for the file when parsing the #GS= AC tag which associates accessions with + * sequences. Database references are also not parsed correctly: a separate + * reference string parser must be added to parse the database reference form + * into Jalview's local representation. + * + * @author bsb at sanger.ac.uk + * @version 0.3 + jalview mods + * + */ +public class StockholmFile extends AlignFile +{ + // static Logger logger = Logger.getLogger("jalview.io.StockholmFile"); + + public StockholmFile() + { + } + + public StockholmFile(String inFile, String type) throws IOException + { + super(inFile, type); + } + + public StockholmFile(FileParse source) throws IOException + { + super(source); + } + + public void initData() + { + super.initData(); + } + + /** + * Parse a file in Stockholm format into Jalview's data model. The file has to + * be passed at construction time + * + * @throws IOException + * If there is an error with the input file + */ + public void parse() throws IOException + { + StringBuffer treeString = new StringBuffer(); + String treeName = null; + // --------------- Variable Definitions ------------------- + String line; + String version; + // String id; + Hashtable seqAnn = new Hashtable(); // Sequence related annotations + Hashtable seqs = new Hashtable(); + Regex p, r, rend, s, x; + + // Temporary line for processing RNA annotation + // String RNAannot = ""; + + // ------------------ Parsing File ---------------------- + // First, we have to check that this file has STOCKHOLM format, i.e. the + // first line must match + r = new Regex("# STOCKHOLM ([\\d\\.]+)"); + if (!r.search(nextLine())) + { + throw new IOException( + "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'"); + } + else + { + version = r.stringMatched(1); + // logger.debug("Stockholm version: " + version); + } + + // We define some Regexes here that will be used regularily later + rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment + p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in + // id/from/to + s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype + r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line + x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence + + // Convert all bracket types to parentheses (necessary for passing to VARNA) + Regex openparen = new Regex("(<|\\[)", "("); + Regex closeparen = new Regex("(>|\\])", ")"); + + // Detect if file is RNA by looking for bracket types + Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); + + rend.optimize(); + p.optimize(); + s.optimize(); + r.optimize(); + x.optimize(); + openparen.optimize(); + closeparen.optimize(); + + while ((line = nextLine()) != null) + { + if (line.length() == 0) + { + continue; + } + if (rend.search(line)) + { + // End of the alignment, pass stuff back + + this.noSeqs = seqs.size(); + // logger.debug("Number of sequences: " + this.noSeqs); + Enumeration accs = seqs.keys(); + while (accs.hasMoreElements()) + { + String acc = (String) accs.nextElement(); + // logger.debug("Processing sequence " + acc); + String seq = (String) seqs.remove(acc); + if (maxLength < seq.length()) + { + maxLength = seq.length(); + } + int start = 1; + int end = -1; + String sid = acc; + /* + * Retrieve hash of annotations for this accession Associate + * Annotation with accession + */ + Hashtable accAnnotations = null; + + if (seqAnn != null && seqAnn.containsKey(acc)) + { + accAnnotations = (Hashtable) seqAnn.remove(acc); + // TODO: add structures to sequence + } + + // Split accession in id and from/to + if (p.search(acc)) + { + sid = p.stringMatched(1); + start = Integer.parseInt(p.stringMatched(2)); + end = Integer.parseInt(p.stringMatched(3)); + } + // logger.debug(sid + ", " + start + ", " + end); + + Sequence seqO = new Sequence(sid, seq, start, end); + // Add Description (if any) + if (accAnnotations != null && accAnnotations.containsKey("DE")) + { + String desc = (String) accAnnotations.get("DE"); + seqO.setDescription((desc == null) ? "" : desc); + } + // Add DB References (if any) + if (accAnnotations != null && accAnnotations.containsKey("DR")) + { + String dbr = (String) accAnnotations.get("DR"); + if (dbr != null && dbr.indexOf(";") > -1) + { + String src = dbr.substring(0, dbr.indexOf(";")); + String acn = dbr.substring(dbr.indexOf(";") + 1); + jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); + // seqO.addDBRef(dbref); + } + } + if (accAnnotations != null && accAnnotations.containsKey("SS")) + { + Vector v = (Vector) accAnnotations.get("SS"); + + for (int i = 0; i < v.size(); i++) + { + AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i); + seqO.addAlignmentAnnotation(an); + // annotations.add(an); + } + } + + Hashtable features = null; + // We need to adjust the positions of all features to account for gaps + try + { + features = (Hashtable) accAnnotations.remove("features"); + } catch (java.lang.NullPointerException e) + { + // loggerwarn("Getting Features for " + acc + ": " + + // e.getMessage()); + // continue; + } + // if we have features + if (features != null) + { + int posmap[] = seqO.findPositionMap(); + Enumeration i = features.keys(); + while (i.hasMoreElements()) + { + // TODO: parse out secondary structure annotation as annotation + // row + // TODO: parse out scores as annotation row + // TODO: map coding region to core jalview feature types + String type = i.nextElement().toString(); + Hashtable content = (Hashtable) features.remove(type); + Enumeration j = content.keys(); + while (j.hasMoreElements()) + { + String desc = j.nextElement().toString(); + String ns = content.get(desc).toString(); + char[] byChar = ns.toCharArray(); + for (int k = 0; k < byChar.length; k++) + { + char c = byChar[k]; + if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM + // uses + // '.' + // for + // feature + // background + { + int new_pos = posmap[k]; // look up nearest seqeunce + // position to this column + SequenceFeature feat = new SequenceFeature(type, desc, + new_pos, new_pos, 0f, null); + + seqO.addSequenceFeature(feat); + } + } + } + + } + + } + // garbage collect + + // logger.debug("Adding seq " + acc + " from " + start + " to " + end + // + ": " + seq); + this.seqs.addElement(seqO); + } + return; // finished parsing this segment of source + } + else if (!r.search(line)) + { + // System.err.println("Found sequence line: " + line); + + // Split sequence in sequence and accession parts + if (!x.search(line)) + { + // logger.error("Could not parse sequence line: " + line); + throw new IOException("Could not parse sequence line: " + line); + } + String ns = (String) seqs.get(x.stringMatched(1)); + if (ns == null) + { + ns = ""; + } + ns += x.stringMatched(2); + + seqs.put(x.stringMatched(1), ns); + } + else + { + String annType = r.stringMatched(1); + String annContent = r.stringMatched(2); + + // System.err.println("type:" + annType + " content: " + annContent); + + if (annType.equals("GF")) + { + /* + * Generic per-File annotation, free text Magic features: #=GF NH + * #=GF TN Pfam descriptions: 7. DESCRIPTION OF FIELDS + * + * Compulsory fields: ------------------ + * + * AC Accession number: Accession number in form PFxxxxx.version or + * PBxxxxxx. ID Identification: One word name for family. DE + * Definition: Short description of family. AU Author: Authors of the + * entry. SE Source of seed: The source suggesting the seed members + * belong to one family. GA Gathering method: Search threshold to + * build the full alignment. TC Trusted Cutoff: Lowest sequence score + * and domain score of match in the full alignment. NC Noise Cutoff: + * Highest sequence score and domain score of match not in full + * alignment. TP Type: Type of family -- presently Family, Domain, + * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM + * Alignment Method The order ls and fs hits are aligned to the model + * to build the full align. // End of alignment. + * + * Optional fields: ---------------- + * + * DC Database Comment: Comment about database reference. DR Database + * Reference: Reference to external database. RC Reference Comment: + * Comment about literature reference. RN Reference Number: Reference + * Number. RM Reference Medline: Eight digit medline UI number. RT + * Reference Title: Reference Title. RA Reference Author: Reference + * Author RL Reference Location: Journal location. PI Previous + * identifier: Record of all previous ID lines. KW Keywords: Keywords. + * CC Comment: Comments. NE Pfam accession: Indicates a nested domain. + * NL Location: Location of nested domains - sequence ID, start and + * end of insert. + * + * Obsolete fields: ----------- AL Alignment method of seed: The + * method used to align the seed members. + */ + // Let's save the annotations, maybe we'll be able to do something + // with them later... + Regex an = new Regex("(\\w+)\\s*(.*)"); + if (an.search(annContent)) + { + if (an.stringMatched(1).equals("NH")) + { + treeString.append(an.stringMatched(2)); + } + else if (an.stringMatched(1).equals("TN")) + { + if (treeString.length() > 0) + { + if (treeName == null) + { + treeName = "Tree " + (getTreeCount() + 1); + } + addNewickTree(treeName, treeString.toString()); + } + treeName = an.stringMatched(2); + treeString = new StringBuffer(); + } + setAlignmentProperty(an.stringMatched(1), an.stringMatched(2)); + } + } + else if (annType.equals("GS")) + { + // Generic per-Sequence annotation, free text + /* + * Pfam uses these features: Feature Description --------------------- + * ----------- AC ACcession number DE + * DEscription DR ; ; Database Reference OS + * OrganiSm (species) OC Organism Classification (clade, etc.) + * LO Look (Color, etc.) + */ + if (s.search(annContent)) + { + String acc = s.stringMatched(1); + String type = s.stringMatched(2); + String content = s.stringMatched(3); + // TODO: store DR in a vector. + // TODO: store AC according to generic file db annotation. + Hashtable ann; + if (seqAnn.containsKey(acc)) + { + ann = (Hashtable) seqAnn.get(acc); + } + else + { + ann = new Hashtable(); + } + ann.put(type, content); + seqAnn.put(acc, ann); + } + else + { + throw new IOException("Error parsing " + line); + } + } + else if (annType.equals("GC")) + { + // Generic per-Column annotation, exactly 1 char per column + // always need a label. + if (x.search(annContent)) + { + // parse out and create alignment annotation directly. + parseAnnotationRow(annotations, x.stringMatched(1), + x.stringMatched(2)); + } + } + else if (annType.equals("GR")) + { + // Generic per-Sequence AND per-Column markup, exactly 1 char per + // column + /* + * Feature Description Markup letters ------- ----------- + * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface + * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane + * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15; + * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in + * or after) [0-2] + */ + if (s.search(annContent)) + { + String acc = s.stringMatched(1); + String type = s.stringMatched(2); + String seq = new String(s.stringMatched(3)); + String description = null; + // Check for additional information about the current annotation + // We use a simple string tokenizer here for speed + StringTokenizer sep = new StringTokenizer(seq, " \t"); + description = sep.nextToken(); + if (sep.hasMoreTokens()) + { + seq = sep.nextToken(); + } + else + { + seq = description; + description = new String(); + } + // sequence id with from-to fields + + Hashtable ann; + // Get an object with all the annotations for this sequence + if (seqAnn.containsKey(acc)) + { + // logger.debug("Found annotations for " + acc); + ann = (Hashtable) seqAnn.get(acc); + } + else + { + // logger.debug("Creating new annotations holder for " + acc); + ann = new Hashtable(); + seqAnn.put(acc, ann); + } + // TODO test structure, call parseAnnotationRow with vector from + // hashtable for specific sequence + Hashtable features; + // Get an object with all the content for an annotation + if (ann.containsKey("features")) + { + // logger.debug("Found features for " + acc); + features = (Hashtable) ann.get("features"); + } + else + { + // logger.debug("Creating new features holder for " + acc); + features = new Hashtable(); + ann.put("features", features); + } + + Hashtable content; + if (features.containsKey(this.id2type(type))) + { + // logger.debug("Found content for " + this.id2type(type)); + content = (Hashtable) features.get(this.id2type(type)); + } + else + { + // logger.debug("Creating new content holder for " + + // this.id2type(type)); + content = new Hashtable(); + features.put(this.id2type(type), content); + } + String ns = (String) content.get(description); + if (ns == null) + { + ns = ""; + } + ns += seq; + content.put(description, ns); + + if (type.equals("SS")) + { + Hashtable strucAnn; + if (seqAnn.containsKey(acc)) + { + strucAnn = (Hashtable) seqAnn.get(acc); + } + else + { + strucAnn = new Hashtable(); + } + + Vector newStruc = new Vector(); + parseAnnotationRow(newStruc, type, ns); + + strucAnn.put(type, newStruc); + seqAnn.put(acc, strucAnn); + } + } + else + { + System.err + .println("Warning - couldn't parse sequence annotation row line:\n" + + line); + // throw new IOException("Error parsing " + line); + } + } + else + { + throw new IOException("Unknown annotation detected: " + annType + + " " + annContent); + } + } + } + if (treeString.length() > 0) + { + if (treeName == null) + { + treeName = "Tree " + (1 + getTreeCount()); + } + addNewickTree(treeName, treeString.toString()); + } + } + + protected static AlignmentAnnotation parseAnnotationRow( + Vector annotation, String label, String annots) + { + String convert1, convert2 = null; + + // Convert all bracket types to parentheses + Regex openparen = new Regex("(<|\\[)", "("); + Regex closeparen = new Regex("(>|\\])", ")"); + + // Detect if file is RNA by looking for bracket types + Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); + + convert1 = openparen.replaceAll(annots); + convert2 = closeparen.replaceAll(convert1); + annots = convert2; + + String type = (label.indexOf("_cons") == label.length() - 5) ? label + .substring(0, label.length() - 5) : label; + boolean ss = false; + type = id2type(type); + if (type.equals("secondary structure")) + { + ss = true; + } + // decide on secondary structure or not. + Annotation[] els = new Annotation[annots.length()]; + for (int i = 0; i < annots.length(); i++) + { + String pos = annots.substring(i, i + 1); + Annotation ann; + ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not + // be written out + if (ss) + { + if (detectbrackets.search(pos)) + { + ann.secondaryStructure = jalview.schemes.ResidueProperties + .getRNASecStrucState(pos).charAt(0); + } + else + { + ann.secondaryStructure = jalview.schemes.ResidueProperties + .getDssp3state(pos).charAt(0); + } + + if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C') + { + ann.displayCharacter = ""; // null; // " "; + } + else + { + ann.displayCharacter = " " + ann.displayCharacter; + } + } + + els[i] = ann; + } + AlignmentAnnotation annot = null; + Enumeration e = annotation.elements(); + while (e.hasMoreElements()) + { + annot = (AlignmentAnnotation) e.nextElement(); + if (annot.label.equals(type)) + break; + annot = null; + } + if (annot == null) + { + annot = new AlignmentAnnotation(type, type, els); + annotation.addElement(annot); + } + else + { + Annotation[] anns = new Annotation[annot.annotations.length + + els.length]; + System.arraycopy(annot.annotations, 0, anns, 0, + annot.annotations.length); + System.arraycopy(els, 0, anns, annot.annotations.length, els.length); + annot.annotations = anns; + // System.out.println("else: "); + } + return annot; + } + + public static String print(SequenceI[] s) + { + return "not yet implemented"; + } + + public String print() + { + return print(getSeqsAsArray()); + } + + private static Hashtable typeIds = null; + static + { + if (typeIds == null) + { + typeIds = new Hashtable(); + typeIds.put("SS", "secondary structure"); + typeIds.put("SA", "surface accessibility"); + typeIds.put("TM", "transmembrane"); + typeIds.put("PP", "posterior probability"); + typeIds.put("LI", "ligand binding"); + typeIds.put("AS", "active site"); + typeIds.put("IN", "intron"); + typeIds.put("IR", "interacting residue"); + typeIds.put("AC", "accession"); + typeIds.put("OS", "organism"); + typeIds.put("CL", "class"); + typeIds.put("DE", "description"); + typeIds.put("DR", "reference"); + typeIds.put("LO", "look"); + typeIds.put("RF", "reference positions"); + + } + } + + protected static String id2type(String id) + { + if (typeIds.containsKey(id)) + { + return (String) typeIds.get(id); + } + System.err.println("Warning : Unknown Stockholm annotation type code " + + id); + return id; + } + /** + * //ssline is complete secondary structure line private AlignmentAnnotation + * addHelices(Vector annotation, String label, String ssline) { + * + * // decide on secondary structure or not. Annotation[] els = new + * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) { + * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new + * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not + * + * ann.secondaryStructure = + * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0); + * + * ann.displayCharacter = "x" + ann.displayCharacter; + * + * System.out.println(ann.displayCharacter); + * + * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e = + * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot = + * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type)) + * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot = + * new AlignmentAnnotation(type, type, els); + * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new + * Annotation[helicesAnnot.annotations.length + els.length]; + * System.arraycopy(helicesAnnot.annotations, 0, anns, 0, + * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns, + * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations = + * anns; } + * + * helicesAnnot.features = Rna.GetBasePairs(ssline); + * Rna.HelixMap(helicesAnnot.features); + * + * + * return helicesAnnot; } + */ +} diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java index ac5f8d6..1455c63 100644 --- a/src/jalview/io/TCoffeeScoreFile.java +++ b/src/jalview/io/TCoffeeScoreFile.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.io; import jalview.analysis.SequenceIdMatcher; diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index 72a5d3b..64e40e3 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.io; diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java index cae1f1b..f8f5027 100755 --- a/src/jalview/io/WSWUBlastClient.java +++ b/src/jalview/io/WSWUBlastClient.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/packed/DataProvider.java b/src/jalview/io/packed/DataProvider.java index ac370f2..a88d77f 100644 --- a/src/jalview/io/packed/DataProvider.java +++ b/src/jalview/io/packed/DataProvider.java @@ -1,20 +1,21 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ + package jalview.io.packed; /** @@ -79,4 +80,4 @@ public interface DataProvider * @return */ DataProvider.JvDataType getType(); -} \ No newline at end of file +} diff --git a/src/jalview/io/packed/JalviewDataset.java b/src/jalview/io/packed/JalviewDataset.java index d0ecf2c..e0ebd9f 100644 --- a/src/jalview/io/packed/JalviewDataset.java +++ b/src/jalview/io/packed/JalviewDataset.java @@ -1,20 +1,21 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ + package jalview.io.packed; import jalview.datamodel.AlignmentI; @@ -319,4 +320,4 @@ public class JalviewDataset { getLastAlignmentSet().updateSetModified(modified); } -} \ No newline at end of file +} diff --git a/src/jalview/io/packed/ParsePackedSet.java b/src/jalview/io/packed/ParsePackedSet.java index ac7c6df..61a6759 100644 --- a/src/jalview/io/packed/ParsePackedSet.java +++ b/src/jalview/io/packed/ParsePackedSet.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.io.packed; import jalview.datamodel.AlignmentI; diff --git a/src/jalview/io/packed/SimpleDataProvider.java b/src/jalview/io/packed/SimpleDataProvider.java index 8a96219..c274d77 100644 --- a/src/jalview/io/packed/SimpleDataProvider.java +++ b/src/jalview/io/packed/SimpleDataProvider.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.io.packed; import jalview.io.FileParse; @@ -69,4 +69,4 @@ public class SimpleDataProvider implements DataProvider return jvtype; } -} \ No newline at end of file +} diff --git a/src/jalview/io/vamsas/Datasetsequence.java b/src/jalview/io/vamsas/Datasetsequence.java index d15ceb3..1e54ef8 100644 --- a/src/jalview/io/vamsas/Datasetsequence.java +++ b/src/jalview/io/vamsas/Datasetsequence.java @@ -1,275 +1,275 @@ -/* - * 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 . - */ -package jalview.io.vamsas; - -import jalview.datamodel.AlignmentI; -import jalview.datamodel.DBRefEntry; -import jalview.datamodel.SequenceI; -import jalview.io.VamsasAppDatastore; -import uk.ac.vamsas.objects.core.DataSet; -import uk.ac.vamsas.objects.core.DbRef; -import uk.ac.vamsas.objects.core.Sequence; - -/** - * synchronize a vamsas dataset sequence with a jalview dataset sequence. This - * class deals with all sequence features and database references associated - * with the jalview sequence. - * - * @author JimP - * - */ -public class Datasetsequence extends DatastoreItem -{ - String dict; - - private DataSet dataset; - - // private AlignmentI jvdset; - - public Datasetsequence(VamsasAppDatastore vamsasAppDatastore, - SequenceI sq, String dict, DataSet dataset) - { - super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class); - this.dataset = dataset; - // this.jvdset = jvdset; - this.dict = dict; - doSync(); - } - - public Datasetsequence(VamsasAppDatastore vamsasAppDatastore, - Sequence vdseq) - { - super(vamsasAppDatastore, vdseq, SequenceI.class); - doJvUpdate(); - } - - public void addFromDocument() - { - Sequence vseq = (Sequence) vobj; - SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(), - vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd()); - dsseq.setDescription(vseq.getDescription()); - bindjvvobj(dsseq, vseq); - dsseq.setVamsasId(vseq.getVorbaId().getId()); - jvobj = dsseq; - modified = true; - } - - public void updateFromDoc() - { - Sequence sq = (Sequence) vobj; - SequenceI sequence = (SequenceI) jvobj; - if (!sequence.getSequenceAsString().equals(sq.getSequence())) - { - log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence."); - } - else - { - // verify and update principal attributes. - if (sequence.getDescription() != null - && (sequence.getDescription() == null || !sequence - .getDescription().equals(sq.getDescription()))) - { - sequence.setDescription(sq.getDescription()); - modified = true; - } - if (sequence.getSequence() == null - || !sequence.getSequenceAsString().equals(sq.getSequence())) - { - if (sequence.getStart() != sq.getStart() - || sequence.getEnd() != sq.getEnd()) - { - // update modified sequence. - sequence.setSequence(sq.getSequence()); - sequence.setStart((int) sq.getStart()); - sequence.setEnd((int) sq.getEnd()); - modified = true; - } - } - if (!sequence.getName().equals(sq.getName())) - { - sequence.setName(sq.getName()); - modified = true; - } - modified |= updateJvDbRefs(); - // updateJvFeatures(); - } - } - - /* - * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj; - * - * // add or update any new features/references on dataset sequence if - * (vsq.getgetSequenceFeatures() != null) { int sfSize = - * sq.getSequenceFeatures().length; - * - * for (int sf = 0; sf < sfSize; sf++) { new - * jalview.io.vamsas.Sequencefeature(datastore, - * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset, - * (Sequence) vobj); } } } - */ - private boolean updateSqFeatures() - { - boolean modified = false; - SequenceI sq = (SequenceI) jvobj; - - // add or update any new features/references on dataset sequence - if (sq.getSequenceFeatures() != null) - { - int sfSize = sq.getSequenceFeatures().length; - - for (int sf = 0; sf < sfSize; sf++) - { - modified |= new jalview.io.vamsas.Sequencefeature(datastore, - (jalview.datamodel.SequenceFeature) sq - .getSequenceFeatures()[sf], dataset, - (Sequence) vobj).docWasUpdated(); - } - } - return modified; - } - - public void addToDocument() - { - SequenceI sq = (SequenceI) jvobj; - Sequence sequence = new Sequence(); - bindjvvobj(sq, sequence); - sq.setVamsasId(sequence.getVorbaId().getId()); - sequence.setSequence(sq.getSequenceAsString()); - sequence.setDictionary(dict); - sequence.setName(sq.getName()); - sequence.setStart(sq.getStart()); - sequence.setEnd(sq.getEnd()); - sequence.setDescription(sq.getDescription()); - dataset.addSequence(sequence); - vobj = sequence; - updateSqFeatures(); - updateDbRefs();// sq,(Sequence) vobj, dataset); - } - - /** - * sync database references from jv to document - * - * @return true if document was modified - */ - private boolean updateDbRefs() - { - boolean modifiedthedoc = false; - SequenceI sq = (SequenceI) jvobj; - - if (sq.getDatasetSequence() == null && sq.getDBRef() != null) - { - // only sync database references for dataset sequences - DBRefEntry[] entries = sq.getDBRef(); - // jalview.datamodel.DBRefEntry dbentry; - for (int db = 0; db < entries.length; db++) - { - modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore, - // dbentry = - entries[db], sq, (Sequence) vobj, dataset).docWasUpdated(); - - } - - } - return modifiedthedoc; - } - - /** - * sync database references from document to jv sequence - * - * @return true if local sequence refs were modified - */ - private boolean updateJvDbRefs() - { - boolean modifiedtheseq = false; - SequenceI sq = (SequenceI) jvobj; - Sequence vsq = (Sequence) vobj; - if (vsq.getDbRefCount() > 0) - { - // only sync database references for dataset sequences - DbRef[] entries = vsq.getDbRef(); - // DbRef dbentry; - for (int db = 0; db < entries.length; db++) - { - modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore, - // dbentry = - entries[db], vsq, sq).jvWasUpdated(); - } - } - return modifiedtheseq; - } - - public void conflict() - { - log.warn("Conflict in dataset sequence update to document. Overwriting document"); - // TODO: could try to import from document data to jalview first. and then - updateToDoc(); - } - - boolean modified = false; - - public void updateToDoc() - { - SequenceI sq = (SequenceI) jvobj; - Sequence sequence = (Sequence) vobj; - // verify and update principal attributes. - if (sequence.getDescription() != null - && (sequence.getDescription() == null || !sequence - .getDescription().equals(sq.getDescription()))) - { - sequence.setDescription(sq.getDescription()); - modified = true; - } - if (sequence.getSequence() == null - || !sequence.getSequence().equals(sq.getSequenceAsString())) - { - if (sequence.getStart() != sq.getStart() - || sequence.getEnd() != sq.getEnd()) - { - // update modified sequence. - sequence.setSequence(sq.getSequenceAsString()); - sequence.setStart(sq.getStart()); - sequence.setEnd(sq.getEnd()); - modified = true; - } - } - if (!dict.equals(sequence.getDictionary())) - { - sequence.setDictionary(dict); - modified = true; - } - if (!sequence.getName().equals(sq.getName())) - { - sequence.setName(sq.getName()); - modified = true; - } - modified |= updateDbRefs(); - modified |= updateSqFeatures(); - } - - /** - * (probably could just do vobj.isModified(), but..) - * - * @return true if document's dataset sequence was modified - */ - public boolean getModified() - { - return modified; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io.vamsas; + +import jalview.datamodel.AlignmentI; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.SequenceI; +import jalview.io.VamsasAppDatastore; +import uk.ac.vamsas.objects.core.DataSet; +import uk.ac.vamsas.objects.core.DbRef; +import uk.ac.vamsas.objects.core.Sequence; + +/** + * synchronize a vamsas dataset sequence with a jalview dataset sequence. This + * class deals with all sequence features and database references associated + * with the jalview sequence. + * + * @author JimP + * + */ +public class Datasetsequence extends DatastoreItem +{ + String dict; + + private DataSet dataset; + + // private AlignmentI jvdset; + + public Datasetsequence(VamsasAppDatastore vamsasAppDatastore, + SequenceI sq, String dict, DataSet dataset) + { + super(vamsasAppDatastore, sq, uk.ac.vamsas.objects.core.Sequence.class); + this.dataset = dataset; + // this.jvdset = jvdset; + this.dict = dict; + doSync(); + } + + public Datasetsequence(VamsasAppDatastore vamsasAppDatastore, + Sequence vdseq) + { + super(vamsasAppDatastore, vdseq, SequenceI.class); + doJvUpdate(); + } + + public void addFromDocument() + { + Sequence vseq = (Sequence) vobj; + SequenceI dsseq = new jalview.datamodel.Sequence(vseq.getName(), + vseq.getSequence(), (int) vseq.getStart(), (int) vseq.getEnd()); + dsseq.setDescription(vseq.getDescription()); + bindjvvobj(dsseq, vseq); + dsseq.setVamsasId(vseq.getVorbaId().getId()); + jvobj = dsseq; + modified = true; + } + + public void updateFromDoc() + { + Sequence sq = (Sequence) vobj; + SequenceI sequence = (SequenceI) jvobj; + if (!sequence.getSequenceAsString().equals(sq.getSequence())) + { + log.warn("Potential Client Error ! - mismatch of dataset sequence: and jalview internal dataset sequence."); + } + else + { + // verify and update principal attributes. + if (sequence.getDescription() != null + && (sequence.getDescription() == null || !sequence + .getDescription().equals(sq.getDescription()))) + { + sequence.setDescription(sq.getDescription()); + modified = true; + } + if (sequence.getSequence() == null + || !sequence.getSequenceAsString().equals(sq.getSequence())) + { + if (sequence.getStart() != sq.getStart() + || sequence.getEnd() != sq.getEnd()) + { + // update modified sequence. + sequence.setSequence(sq.getSequence()); + sequence.setStart((int) sq.getStart()); + sequence.setEnd((int) sq.getEnd()); + modified = true; + } + } + if (!sequence.getName().equals(sq.getName())) + { + sequence.setName(sq.getName()); + modified = true; + } + modified |= updateJvDbRefs(); + // updateJvFeatures(); + } + } + + /* + * private void updateJvFeatures() { Sequence vsq = (Sequence) vobj; + * + * // add or update any new features/references on dataset sequence if + * (vsq.getgetSequenceFeatures() != null) { int sfSize = + * sq.getSequenceFeatures().length; + * + * for (int sf = 0; sf < sfSize; sf++) { new + * jalview.io.vamsas.Sequencefeature(datastore, + * (jalview.datamodel.SequenceFeature) sq .getSequenceFeatures()[sf], dataset, + * (Sequence) vobj); } } } + */ + private boolean updateSqFeatures() + { + boolean modified = false; + SequenceI sq = (SequenceI) jvobj; + + // add or update any new features/references on dataset sequence + if (sq.getSequenceFeatures() != null) + { + int sfSize = sq.getSequenceFeatures().length; + + for (int sf = 0; sf < sfSize; sf++) + { + modified |= new jalview.io.vamsas.Sequencefeature(datastore, + (jalview.datamodel.SequenceFeature) sq + .getSequenceFeatures()[sf], dataset, + (Sequence) vobj).docWasUpdated(); + } + } + return modified; + } + + public void addToDocument() + { + SequenceI sq = (SequenceI) jvobj; + Sequence sequence = new Sequence(); + bindjvvobj(sq, sequence); + sq.setVamsasId(sequence.getVorbaId().getId()); + sequence.setSequence(sq.getSequenceAsString()); + sequence.setDictionary(dict); + sequence.setName(sq.getName()); + sequence.setStart(sq.getStart()); + sequence.setEnd(sq.getEnd()); + sequence.setDescription(sq.getDescription()); + dataset.addSequence(sequence); + vobj = sequence; + updateSqFeatures(); + updateDbRefs();// sq,(Sequence) vobj, dataset); + } + + /** + * sync database references from jv to document + * + * @return true if document was modified + */ + private boolean updateDbRefs() + { + boolean modifiedthedoc = false; + SequenceI sq = (SequenceI) jvobj; + + if (sq.getDatasetSequence() == null && sq.getDBRef() != null) + { + // only sync database references for dataset sequences + DBRefEntry[] entries = sq.getDBRef(); + // jalview.datamodel.DBRefEntry dbentry; + for (int db = 0; db < entries.length; db++) + { + modifiedthedoc |= new jalview.io.vamsas.Dbref(datastore, + // dbentry = + entries[db], sq, (Sequence) vobj, dataset).docWasUpdated(); + + } + + } + return modifiedthedoc; + } + + /** + * sync database references from document to jv sequence + * + * @return true if local sequence refs were modified + */ + private boolean updateJvDbRefs() + { + boolean modifiedtheseq = false; + SequenceI sq = (SequenceI) jvobj; + Sequence vsq = (Sequence) vobj; + if (vsq.getDbRefCount() > 0) + { + // only sync database references for dataset sequences + DbRef[] entries = vsq.getDbRef(); + // DbRef dbentry; + for (int db = 0; db < entries.length; db++) + { + modifiedtheseq |= new jalview.io.vamsas.Dbref(datastore, + // dbentry = + entries[db], vsq, sq).jvWasUpdated(); + } + } + return modifiedtheseq; + } + + public void conflict() + { + log.warn("Conflict in dataset sequence update to document. Overwriting document"); + // TODO: could try to import from document data to jalview first. and then + updateToDoc(); + } + + boolean modified = false; + + public void updateToDoc() + { + SequenceI sq = (SequenceI) jvobj; + Sequence sequence = (Sequence) vobj; + // verify and update principal attributes. + if (sequence.getDescription() != null + && (sequence.getDescription() == null || !sequence + .getDescription().equals(sq.getDescription()))) + { + sequence.setDescription(sq.getDescription()); + modified = true; + } + if (sequence.getSequence() == null + || !sequence.getSequence().equals(sq.getSequenceAsString())) + { + if (sequence.getStart() != sq.getStart() + || sequence.getEnd() != sq.getEnd()) + { + // update modified sequence. + sequence.setSequence(sq.getSequenceAsString()); + sequence.setStart(sq.getStart()); + sequence.setEnd(sq.getEnd()); + modified = true; + } + } + if (!dict.equals(sequence.getDictionary())) + { + sequence.setDictionary(dict); + modified = true; + } + if (!sequence.getName().equals(sq.getName())) + { + sequence.setName(sq.getName()); + modified = true; + } + modified |= updateDbRefs(); + modified |= updateSqFeatures(); + } + + /** + * (probably could just do vobj.isModified(), but..) + * + * @return true if document's dataset sequence was modified + */ + public boolean getModified() + { + return modified; + } + +} diff --git a/src/jalview/io/vamsas/DatastoreItem.java b/src/jalview/io/vamsas/DatastoreItem.java index 365f8a8..65463f0 100644 --- a/src/jalview/io/vamsas/DatastoreItem.java +++ b/src/jalview/io/vamsas/DatastoreItem.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/DatastoreRegistry.java b/src/jalview/io/vamsas/DatastoreRegistry.java index 8b23e4c..eddb5bf 100644 --- a/src/jalview/io/vamsas/DatastoreRegistry.java +++ b/src/jalview/io/vamsas/DatastoreRegistry.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/Dbref.java b/src/jalview/io/vamsas/Dbref.java index 899a3ae..265fed3 100644 --- a/src/jalview/io/vamsas/Dbref.java +++ b/src/jalview/io/vamsas/Dbref.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/LocalDocSyncObject.java b/src/jalview/io/vamsas/LocalDocSyncObject.java index 7cdbe58..4cf963b 100644 --- a/src/jalview/io/vamsas/LocalDocSyncObject.java +++ b/src/jalview/io/vamsas/LocalDocSyncObject.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/Rangetype.java b/src/jalview/io/vamsas/Rangetype.java index 7914797..94e277a 100644 --- a/src/jalview/io/vamsas/Rangetype.java +++ b/src/jalview/io/vamsas/Rangetype.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/Sequencefeature.java b/src/jalview/io/vamsas/Sequencefeature.java index 0dedee3..f02fe3e 100644 --- a/src/jalview/io/vamsas/Sequencefeature.java +++ b/src/jalview/io/vamsas/Sequencefeature.java @@ -1,359 +1,359 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, 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 . - */ -package jalview.io.vamsas; - -import java.util.Enumeration; -import java.util.Vector; - -import uk.ac.vamsas.objects.core.DataSet; -import uk.ac.vamsas.objects.core.DataSetAnnotations; -import uk.ac.vamsas.objects.core.Link; -import uk.ac.vamsas.objects.core.Property; -import uk.ac.vamsas.objects.core.Provenance; -import uk.ac.vamsas.objects.core.RangeAnnotation; -import uk.ac.vamsas.objects.core.Score; -import uk.ac.vamsas.objects.core.Seg; -import uk.ac.vamsas.objects.core.Sequence; -import uk.ac.vamsas.objects.utils.Properties; -import jalview.bin.Cache; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceI; -import jalview.io.VamsasAppDatastore; -import jalview.util.UrlLink; - -/** - * @author JimP - * - */ -public class Sequencefeature extends Rangetype -{ - - uk.ac.vamsas.objects.core.DataSet dataset; - - uk.ac.vamsas.objects.core.Sequence sequence; - - private SequenceI dsSeq; - - public Sequencefeature(VamsasAppDatastore vamsasAppDatastore, - SequenceFeature sequenceFeature, - uk.ac.vamsas.objects.core.DataSet dataset, - uk.ac.vamsas.objects.core.Sequence sequence) - { - super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class); - this.dataset = dataset; - this.sequence = sequence; - doSync(); - } - - public Sequencefeature(VamsasAppDatastore vamsasAppDatastore, - DataSetAnnotations dseta, SequenceI dsSeq) - { - super(vamsasAppDatastore, dseta, - jalview.datamodel.SequenceFeature.class); - this.dsSeq = dsSeq; - doJvUpdate(); - } - - public void addToDocument() - { - DataSetAnnotations dsa = (DataSetAnnotations) vobj; - jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; - dsa = (DataSetAnnotations) getDSAnnotationFromJalview( - new DataSetAnnotations(), feature); - if (dsa.getProvenance() == null) - { - dsa.setProvenance(new Provenance()); - } - addProvenance(dsa.getProvenance(), "created"); // JBPNote - need - // to update - dsa.addSeqRef(sequence); // we have just created this annotation - // - so safe to use this - bindjvvobj(feature, dsa); - dataset.addDataSetAnnotations(dsa); - } - - public void addFromDocument() - { - DataSetAnnotations dsa = (DataSetAnnotations) vobj; - if (dsa.getSeqRefCount() != 1) - { - Cache.log - .warn("Not binding " - + dsa.getVorbaId() - + " to Sequence Feature - has multiple dataset sequence references."); - return; - } - jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj; - dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa)); - jvobj = sf; - bindjvvobj(sf, dsa); - } - - public void conflict() - { - log.warn("Untested sequencefeature conflict code"); - DataSetAnnotations dsa = (DataSetAnnotations) vobj; - jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; - jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa); - replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature - // to newly created feature - dsSeq.addSequenceFeature(sf); // add new imported feature - addToDocument(); // and create a new feature in the document - } - - public void updateToDoc() - { - DataSetAnnotations dsa = (DataSetAnnotations) vobj; - jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; - if (dsa.getSeqRefCount() != 1) - { - replaceJvObjMapping(feature, null); - Cache.log - .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating."); - doSync(); // re-verify bindings. - } - else - { - // Sync the features from Jalview - long oldref = dsa.get__last_hash(); - getDSAnnotationFromJalview(dsa, feature); - if (oldref != dsa.hashCode()) - { - Cache.log - .debug("Updated dataset sequence annotation from feature."); - addProvenance(dsa.getProvenance(), "modified"); - } - } - - } - - public void updateFromDoc() - { - DataSetAnnotations dsa = (DataSetAnnotations) vobj; - jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; - if (dsa.getSeqRefCount() != 1) - { - // conflicting update from document - we cannot map this feature anymore. - replaceJvObjMapping(feature, null); - Cache.log - .warn("annotation (" - + dsa.getVorbaId() - + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature."); - // - consider deleting the feature ? - dsSeq.deleteFeature(feature); - // doSync(); - } - else - { - // Sync the features to Jalview - easiest to delete and add the feature - // again - jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa); - dsSeq.deleteFeature(feature); - replaceJvObjMapping(feature, newsf); - dsSeq.addSequenceFeature(newsf); - if (feature.otherDetails != null) - { - // TODO later: leave this to finalise method ? - feature.otherDetails.clear(); - } - } - } - - /** - * correctly create/update a RangeAnnotation from a jalview sequence feature - * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class - * - * @param dsa - * (typically DataSetAnnotations or AlignmentSequenceAnnotation) - * @param feature - * (the feature to be mapped from) - * @return - */ - private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa, - jalview.datamodel.SequenceFeature feature) - { - dsa.setType(feature.getType()); - Seg vSeg = new Seg(); - vSeg.setStart(feature.getBegin()); - vSeg.setEnd(feature.getEnd()); - vSeg.setInclusive(true); - if (dsa.getSegCount() > 1) - { - Cache.log - .debug("About to destroy complex annotation in vamsas document mapped to sequence feature (" - + dsa.getVorbaId() + ")"); - } - dsa.setSeg(new Seg[] - { vSeg }); - dsa.setDescription(feature.getDescription()); - dsa.setStatus(feature.getStatus()); - if (feature.links != null && feature.links.size() > 0) - { - for (int i = 0, iSize = feature.links.size(); i < iSize; i++) - { - String link = (String) feature.links.elementAt(i); - UrlLink ulink = new UrlLink(link); - if (ulink.isValid()) - { - // We only add static links to the document. - Link vLink = new Link(); - vLink.setContent(ulink.getLabel()); - vLink.setHref(ulink.getTarget()); - dsa.addLink(vLink); - } - } - } - dsa.setGroup(feature.getFeatureGroup()); - if (feature.getScore() != Float.NaN) - { - Score fscore = new Score(); - dsa.setScore(new Score[] - { fscore }); - fscore.setContent(feature.getScore()); - fscore.setName(feature.getType()); - } - if (feature.otherDetails != null) - { - Enumeration iter = feature.otherDetails.keys(); - Vector props = dsa.getPropertyAsReference(); - while (iter.hasMoreElements()) - { - String key = (String) iter.nextElement(); - if (!key.equalsIgnoreCase("score") - && !key.equalsIgnoreCase("status")) - { - Property nprop = new Property(); - nprop.setName(key); - Object vlu = feature.getValue(key); - nprop.setContent(feature.getValue(key).toString()); - boolean valid = false; - if (vlu instanceof String) - { - nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE); - valid = true; - } - else if (vlu instanceof Integer) - { - valid = true; - nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE); - } - else if (vlu instanceof Float) - { - nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE); - valid = true; - } - if (valid) - { - if (props != null) - { - uk.ac.vamsas.objects.utils.Properties.addOrReplace(props, - nprop); - } - else - { - dsa.addProperty(nprop); - } - } - } - } - } - return dsa; - } - - private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta) - { - int[] se = getBounds(dseta); - SequenceFeature sf = new jalview.datamodel.SequenceFeature( - dseta.getType(), dseta.getDescription(), dseta.getStatus(), - se[0], se[1], dseta.getGroup()); - if (dseta.getLinkCount() > 0) - { - Link[] links = dseta.getLink(); - for (int i = 0; i < links.length; i++) - { - // TODO: use URLLink parsing/validation here. - sf.addLink(links[i].getContent() + "|" + links[i].getHref()); - } - } - if (dseta.getScoreCount() > 0) - { - Enumeration scr = dseta.enumerateScore(); - while (scr.hasMoreElements()) - { - Score score = (Score) scr.nextElement(); - if (score.getName().equals(sf.getType())) - { - sf.setScore(score.getContent()); - } - else - { - sf.setValue(score.getName(), "" + score.getContent()); - } - } - } - // other details - Enumeration props = dseta.enumerateProperty(); - while (props.hasMoreElements()) - { - Property p = (Property) props.nextElement(); - Object val = null; - if (Properties.isValid(p)) - { - if (Properties.isString(p)) - { - val = p.getContent(); - } - if (Properties.isBoolean(p)) - { - try - { - val = new Boolean(p.getContent()); - } catch (Exception e) - { - } - } - if (Properties.isFloat(p)) - { - try - { - val = new Float(p.getContent()); - - } catch (Exception e) - { - } - } - if (Properties.isInteger(p)) - { - try - { - val = new Integer(p.getContent()); - } catch (Exception e) - { - } - } - if (val != null) - { - sf.setValue(p.getName(), val); - } - } - } - - return sf; - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.io.vamsas; + +import java.util.Enumeration; +import java.util.Vector; + +import uk.ac.vamsas.objects.core.DataSet; +import uk.ac.vamsas.objects.core.DataSetAnnotations; +import uk.ac.vamsas.objects.core.Link; +import uk.ac.vamsas.objects.core.Property; +import uk.ac.vamsas.objects.core.Provenance; +import uk.ac.vamsas.objects.core.RangeAnnotation; +import uk.ac.vamsas.objects.core.Score; +import uk.ac.vamsas.objects.core.Seg; +import uk.ac.vamsas.objects.core.Sequence; +import uk.ac.vamsas.objects.utils.Properties; +import jalview.bin.Cache; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.io.VamsasAppDatastore; +import jalview.util.UrlLink; + +/** + * @author JimP + * + */ +public class Sequencefeature extends Rangetype +{ + + uk.ac.vamsas.objects.core.DataSet dataset; + + uk.ac.vamsas.objects.core.Sequence sequence; + + private SequenceI dsSeq; + + public Sequencefeature(VamsasAppDatastore vamsasAppDatastore, + SequenceFeature sequenceFeature, + uk.ac.vamsas.objects.core.DataSet dataset, + uk.ac.vamsas.objects.core.Sequence sequence) + { + super(vamsasAppDatastore, sequenceFeature, DataSetAnnotations.class); + this.dataset = dataset; + this.sequence = sequence; + doSync(); + } + + public Sequencefeature(VamsasAppDatastore vamsasAppDatastore, + DataSetAnnotations dseta, SequenceI dsSeq) + { + super(vamsasAppDatastore, dseta, + jalview.datamodel.SequenceFeature.class); + this.dsSeq = dsSeq; + doJvUpdate(); + } + + public void addToDocument() + { + DataSetAnnotations dsa = (DataSetAnnotations) vobj; + jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; + dsa = (DataSetAnnotations) getDSAnnotationFromJalview( + new DataSetAnnotations(), feature); + if (dsa.getProvenance() == null) + { + dsa.setProvenance(new Provenance()); + } + addProvenance(dsa.getProvenance(), "created"); // JBPNote - need + // to update + dsa.addSeqRef(sequence); // we have just created this annotation + // - so safe to use this + bindjvvobj(feature, dsa); + dataset.addDataSetAnnotations(dsa); + } + + public void addFromDocument() + { + DataSetAnnotations dsa = (DataSetAnnotations) vobj; + if (dsa.getSeqRefCount() != 1) + { + Cache.log + .warn("Not binding " + + dsa.getVorbaId() + + " to Sequence Feature - has multiple dataset sequence references."); + return; + } + jalview.datamodel.SequenceFeature sf = (jalview.datamodel.SequenceFeature) jvobj; + dsSeq.addSequenceFeature(sf = getJalviewSeqFeature(dsa)); + jvobj = sf; + bindjvvobj(sf, dsa); + } + + public void conflict() + { + log.warn("Untested sequencefeature conflict code"); + DataSetAnnotations dsa = (DataSetAnnotations) vobj; + jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; + jalview.datamodel.SequenceFeature sf = getJalviewSeqFeature(dsa); + replaceJvObjMapping(feature, sf); // switch binding of dsa from old feature + // to newly created feature + dsSeq.addSequenceFeature(sf); // add new imported feature + addToDocument(); // and create a new feature in the document + } + + public void updateToDoc() + { + DataSetAnnotations dsa = (DataSetAnnotations) vobj; + jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; + if (dsa.getSeqRefCount() != 1) + { + replaceJvObjMapping(feature, null); + Cache.log + .warn("Binding of annotation to jalview feature has changed. Removing binding and recreating."); + doSync(); // re-verify bindings. + } + else + { + // Sync the features from Jalview + long oldref = dsa.get__last_hash(); + getDSAnnotationFromJalview(dsa, feature); + if (oldref != dsa.hashCode()) + { + Cache.log + .debug("Updated dataset sequence annotation from feature."); + addProvenance(dsa.getProvenance(), "modified"); + } + } + + } + + public void updateFromDoc() + { + DataSetAnnotations dsa = (DataSetAnnotations) vobj; + jalview.datamodel.SequenceFeature feature = (jalview.datamodel.SequenceFeature) jvobj; + if (dsa.getSeqRefCount() != 1) + { + // conflicting update from document - we cannot map this feature anymore. + replaceJvObjMapping(feature, null); + Cache.log + .warn("annotation (" + + dsa.getVorbaId() + + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature."); + // - consider deleting the feature ? + dsSeq.deleteFeature(feature); + // doSync(); + } + else + { + // Sync the features to Jalview - easiest to delete and add the feature + // again + jalview.datamodel.SequenceFeature newsf = getJalviewSeqFeature(dsa); + dsSeq.deleteFeature(feature); + replaceJvObjMapping(feature, newsf); + dsSeq.addSequenceFeature(newsf); + if (feature.otherDetails != null) + { + // TODO later: leave this to finalise method ? + feature.otherDetails.clear(); + } + } + } + + /** + * correctly create/update a RangeAnnotation from a jalview sequence feature + * TODO: refactor to a method in jalview.io.vamsas.RangeAnnotation class + * + * @param dsa + * (typically DataSetAnnotations or AlignmentSequenceAnnotation) + * @param feature + * (the feature to be mapped from) + * @return + */ + private RangeAnnotation getDSAnnotationFromJalview(RangeAnnotation dsa, + jalview.datamodel.SequenceFeature feature) + { + dsa.setType(feature.getType()); + Seg vSeg = new Seg(); + vSeg.setStart(feature.getBegin()); + vSeg.setEnd(feature.getEnd()); + vSeg.setInclusive(true); + if (dsa.getSegCount() > 1) + { + Cache.log + .debug("About to destroy complex annotation in vamsas document mapped to sequence feature (" + + dsa.getVorbaId() + ")"); + } + dsa.setSeg(new Seg[] + { vSeg }); + dsa.setDescription(feature.getDescription()); + dsa.setStatus(feature.getStatus()); + if (feature.links != null && feature.links.size() > 0) + { + for (int i = 0, iSize = feature.links.size(); i < iSize; i++) + { + String link = (String) feature.links.elementAt(i); + UrlLink ulink = new UrlLink(link); + if (ulink.isValid()) + { + // We only add static links to the document. + Link vLink = new Link(); + vLink.setContent(ulink.getLabel()); + vLink.setHref(ulink.getTarget()); + dsa.addLink(vLink); + } + } + } + dsa.setGroup(feature.getFeatureGroup()); + if (feature.getScore() != Float.NaN) + { + Score fscore = new Score(); + dsa.setScore(new Score[] + { fscore }); + fscore.setContent(feature.getScore()); + fscore.setName(feature.getType()); + } + if (feature.otherDetails != null) + { + Enumeration iter = feature.otherDetails.keys(); + Vector props = dsa.getPropertyAsReference(); + while (iter.hasMoreElements()) + { + String key = (String) iter.nextElement(); + if (!key.equalsIgnoreCase("score") + && !key.equalsIgnoreCase("status")) + { + Property nprop = new Property(); + nprop.setName(key); + Object vlu = feature.getValue(key); + nprop.setContent(feature.getValue(key).toString()); + boolean valid = false; + if (vlu instanceof String) + { + nprop.setType(uk.ac.vamsas.objects.utils.Properties.STRINGTYPE); + valid = true; + } + else if (vlu instanceof Integer) + { + valid = true; + nprop.setType(uk.ac.vamsas.objects.utils.Properties.INTEGERTYPE); + } + else if (vlu instanceof Float) + { + nprop.setType(uk.ac.vamsas.objects.utils.Properties.FLOATTYPE); + valid = true; + } + if (valid) + { + if (props != null) + { + uk.ac.vamsas.objects.utils.Properties.addOrReplace(props, + nprop); + } + else + { + dsa.addProperty(nprop); + } + } + } + } + } + return dsa; + } + + private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta) + { + int[] se = getBounds(dseta); + SequenceFeature sf = new jalview.datamodel.SequenceFeature( + dseta.getType(), dseta.getDescription(), dseta.getStatus(), + se[0], se[1], dseta.getGroup()); + if (dseta.getLinkCount() > 0) + { + Link[] links = dseta.getLink(); + for (int i = 0; i < links.length; i++) + { + // TODO: use URLLink parsing/validation here. + sf.addLink(links[i].getContent() + "|" + links[i].getHref()); + } + } + if (dseta.getScoreCount() > 0) + { + Enumeration scr = dseta.enumerateScore(); + while (scr.hasMoreElements()) + { + Score score = (Score) scr.nextElement(); + if (score.getName().equals(sf.getType())) + { + sf.setScore(score.getContent()); + } + else + { + sf.setValue(score.getName(), "" + score.getContent()); + } + } + } + // other details + Enumeration props = dseta.enumerateProperty(); + while (props.hasMoreElements()) + { + Property p = (Property) props.nextElement(); + Object val = null; + if (Properties.isValid(p)) + { + if (Properties.isString(p)) + { + val = p.getContent(); + } + if (Properties.isBoolean(p)) + { + try + { + val = new Boolean(p.getContent()); + } catch (Exception e) + { + } + } + if (Properties.isFloat(p)) + { + try + { + val = new Float(p.getContent()); + + } catch (Exception e) + { + } + } + if (Properties.isInteger(p)) + { + try + { + val = new Integer(p.getContent()); + } catch (Exception e) + { + } + } + if (val != null) + { + sf.setValue(p.getName(), val); + } + } + } + + return sf; + } + +} diff --git a/src/jalview/io/vamsas/Sequencemapping.java b/src/jalview/io/vamsas/Sequencemapping.java index ec2a407..9ac0ae5 100644 --- a/src/jalview/io/vamsas/Sequencemapping.java +++ b/src/jalview/io/vamsas/Sequencemapping.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/io/vamsas/Tree.java b/src/jalview/io/vamsas/Tree.java index 5a9ea88..5b32d40 100644 --- a/src/jalview/io/vamsas/Tree.java +++ b/src/jalview/io/vamsas/Tree.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.io.vamsas; diff --git a/src/jalview/javascript/JSFunctionExec.java b/src/jalview/javascript/JSFunctionExec.java index 56c4ca6..3e10294 100644 --- a/src/jalview/javascript/JSFunctionExec.java +++ b/src/jalview/javascript/JSFunctionExec.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.javascript; import java.net.URL; diff --git a/src/jalview/javascript/JalviewLiteJsApi.java b/src/jalview/javascript/JalviewLiteJsApi.java index 16ba8cf..bd9fe36 100644 --- a/src/jalview/javascript/JalviewLiteJsApi.java +++ b/src/jalview/javascript/JalviewLiteJsApi.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.javascript; import jalview.appletgui.AlignFrame; @@ -593,4 +593,4 @@ public interface JalviewLiteJsApi */ public abstract String getJsMessage(String messageclass, String viewId); -} \ No newline at end of file +} diff --git a/src/jalview/javascript/JsCallBack.java b/src/jalview/javascript/JsCallBack.java index 86dd0f3..f920071 100644 --- a/src/jalview/javascript/JsCallBack.java +++ b/src/jalview/javascript/JsCallBack.java @@ -1,21 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ -package jalview.javascript; + */package jalview.javascript; public interface JsCallBack { diff --git a/src/jalview/javascript/JsSelectionSender.java b/src/jalview/javascript/JsSelectionSender.java index 6c857ad..8e11699 100644 --- a/src/jalview/javascript/JsSelectionSender.java +++ b/src/jalview/javascript/JsSelectionSender.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.javascript; import java.net.URL; diff --git a/src/jalview/javascript/MouseOverListener.java b/src/jalview/javascript/MouseOverListener.java index b642f9d..4d03c39 100644 --- a/src/jalview/javascript/MouseOverListener.java +++ b/src/jalview/javascript/MouseOverListener.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.javascript; import java.util.Vector; diff --git a/src/jalview/javascript/MouseOverStructureListener.java b/src/jalview/javascript/MouseOverStructureListener.java index d829d02..f9d5dd0 100644 --- a/src/jalview/javascript/MouseOverStructureListener.java +++ b/src/jalview/javascript/MouseOverStructureListener.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.javascript; import java.awt.Color; @@ -41,7 +41,7 @@ import jalview.structure.StructureSelectionManager; *
              • mouseover: javascript function called with arguments * *
                - * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue
                + * ['mouseover',String(pdb file URI), String(pdb file chain ID), String(residue
                  * number moused over), String(atom index corresponding to residue)]
                  * 
                * @@ -49,8 +49,8 @@ import jalview.structure.StructureSelectionManager; *
              • colourstruct: javascript function called with arguments * *
                - * ['colourstruct',String(alignment view id),String(number of javascript message
                - * chunks to collect),String(length of first chunk in set of messages - or zero
                + * ['colourstruct',String(alignment view id),String(number of javascript message
                + * chunks to collect),String(length of first chunk in set of messages - or zero
                  * for null message)]
                  * 
                * diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index c64568a..b523763 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GAlignmentPanel.java b/src/jalview/jbgui/GAlignmentPanel.java index fc66218..8549ff8 100755 --- a/src/jalview/jbgui/GAlignmentPanel.java +++ b/src/jalview/jbgui/GAlignmentPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java index fa9e62c..4a591d1 100644 --- a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GCutAndPasteTransfer.java b/src/jalview/jbgui/GCutAndPasteTransfer.java index 05759cd..4f650df 100755 --- a/src/jalview/jbgui/GCutAndPasteTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteTransfer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GDasSourceBrowser.java b/src/jalview/jbgui/GDasSourceBrowser.java index 69bba49..4bf265f 100755 --- a/src/jalview/jbgui/GDasSourceBrowser.java +++ b/src/jalview/jbgui/GDasSourceBrowser.java @@ -1,221 +1,221 @@ -/* - * 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 . - */ -package jalview.jbgui; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.border.*; -import javax.swing.event.*; - -public class GDasSourceBrowser extends JPanel -{ - public GDasSourceBrowser() - { - try - { - jbInit(); - } catch (Exception ex) - { - ex.printStackTrace(); - } - } - - private void jbInit() throws Exception - { - this.setLayout(gridBagLayout1); - refresh.setText("Refresh Available Sources"); - refresh.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - refresh_actionPerformed(e); - } - }); - progressBar.setPreferredSize(new Dimension(450, 20)); - progressBar.setString(""); - scrollPane.setBorder(titledBorder1); - scrollPane.setBorder(BorderFactory.createEtchedBorder()); - fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder()); - fullDetails.addHyperlinkListener(new HyperlinkListener() - { - public void hyperlinkUpdate(HyperlinkEvent e) - { - fullDetails_hyperlinkUpdate(e); - } - }); - fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - fullDetails.setEditable(false); - registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - registryLabel.setHorizontalAlignment(SwingConstants.TRAILING); - registryLabel.setText("Use Registry"); - addLocal.setText("Add Local Source"); - addLocal.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - amendLocal(true); - } - }); - jPanel1.setLayout(flowLayout1); - jPanel1.setMinimumSize(new Dimension(596, 30)); - jPanel1.setPreferredSize(new Dimension(596, 30)); - jScrollPane2.setBorder(titledBorder3); - jScrollPane3.setBorder(titledBorder4); - jScrollPane4.setBorder(titledBorder5); - titledBorder2 - .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - titledBorder3 - .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - titledBorder4 - .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - reset.setMargin(new Insets(2, 2, 2, 2)); - reset.setText("Reset"); - reset.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - reset_actionPerformed(e); - } - }); - jPanel2.setLayout(borderLayout1); - borderLayout1.setHgap(5); - registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - scrollPane.getViewport().add(table); - fullDetailsScrollpane.getViewport().add(fullDetails); - jScrollPane3.getViewport().add(filter2); - jScrollPane4.getViewport().add(filter3); - jPanel1.add(refresh, null); - jPanel1.add(addLocal, null); - jPanel1.add(progressBar, null); - jScrollPane2.getViewport().add(filter1); - this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(0, 0, 0, 0), 0, 0)); - this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0, - 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, - new Insets(3, 0, 0, 3), 240, 130)); - this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( - 3, 2, 0, 0), 150, 130)); - jPanel2.add(registryLabel, java.awt.BorderLayout.WEST); - jPanel2.add(registryURL, java.awt.BorderLayout.CENTER); - jPanel2.add(reset, java.awt.BorderLayout.EAST); - this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, - GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, - new Insets(5, 10, 0, 10), 339, 0)); - this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( - 0, 0, 0, 60), 80, 60)); - this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( - 0, -80, 0, 0), 80, 60)); - this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, - GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( - 0, -60, 0, 80), 80, 60)); - } - - protected JTable table = new JTable(); - - protected JEditorPane fullDetails = new JEditorPane("text/html", ""); - - TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources"); - - protected JButton refresh = new JButton(); - - protected JProgressBar progressBar = new JProgressBar(); - - protected JScrollPane scrollPane = new JScrollPane(); - - TitledBorder titledBorder2 = new TitledBorder("Full Details"); - - protected JScrollPane fullDetailsScrollpane = new JScrollPane(); - - protected JList filter1 = new JList(); - - protected JList filter2 = new JList(); - - protected JList filter3 = new JList(); - - JScrollPane jScrollPane2 = new JScrollPane(); - - JScrollPane jScrollPane3 = new JScrollPane(); - - JScrollPane jScrollPane4 = new JScrollPane(); - - protected JTextField registryURL = new JTextField(); - - protected JLabel registryLabel = new JLabel(); - - protected JButton addLocal = new JButton(); - - JPanel jPanel1 = new JPanel(); - - FlowLayout flowLayout1 = new FlowLayout(); - - GridBagLayout gridBagLayout1 = new GridBagLayout(); - - TitledBorder titledBorder3 = new TitledBorder("Authority:"); - - TitledBorder titledBorder4 = new TitledBorder("Type:"); - - TitledBorder titledBorder5 = new TitledBorder("Label:"); - - JButton reset = new JButton(); - - JPanel jPanel2 = new JPanel(); - - BorderLayout borderLayout1 = new BorderLayout(); - - public void refresh_actionPerformed(ActionEvent e) - { - - } - - public void fullDetails_hyperlinkUpdate(HyperlinkEvent e) - { - try - { - - if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) - { - jalview.util.BrowserLauncher.openURL(e.getURL().toString()); - } - } catch (Exception ex) - { - System.out.println(e.getURL()); - ex.printStackTrace(); - } - } - - public void amendLocal(boolean newSource) - { - - } - - public void reset_actionPerformed(ActionEvent e) - { - - } - -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.jbgui; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.border.*; +import javax.swing.event.*; + +public class GDasSourceBrowser extends JPanel +{ + public GDasSourceBrowser() + { + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + private void jbInit() throws Exception + { + this.setLayout(gridBagLayout1); + refresh.setText("Refresh Available Sources"); + refresh.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + refresh_actionPerformed(e); + } + }); + progressBar.setPreferredSize(new Dimension(450, 20)); + progressBar.setString(""); + scrollPane.setBorder(titledBorder1); + scrollPane.setBorder(BorderFactory.createEtchedBorder()); + fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder()); + fullDetails.addHyperlinkListener(new HyperlinkListener() + { + public void hyperlinkUpdate(HyperlinkEvent e) + { + fullDetails_hyperlinkUpdate(e); + } + }); + fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + fullDetails.setEditable(false); + registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + registryLabel.setHorizontalAlignment(SwingConstants.TRAILING); + registryLabel.setText("Use Registry"); + addLocal.setText("Add Local Source"); + addLocal.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + amendLocal(true); + } + }); + jPanel1.setLayout(flowLayout1); + jPanel1.setMinimumSize(new Dimension(596, 30)); + jPanel1.setPreferredSize(new Dimension(596, 30)); + jScrollPane2.setBorder(titledBorder3); + jScrollPane3.setBorder(titledBorder4); + jScrollPane4.setBorder(titledBorder5); + titledBorder2 + .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + titledBorder3 + .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + titledBorder4 + .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + reset.setMargin(new Insets(2, 2, 2, 2)); + reset.setText("Reset"); + reset.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + reset_actionPerformed(e); + } + }); + jPanel2.setLayout(borderLayout1); + borderLayout1.setHgap(5); + registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); + scrollPane.getViewport().add(table); + fullDetailsScrollpane.getViewport().add(fullDetails); + jScrollPane3.getViewport().add(filter2); + jScrollPane4.getViewport().add(filter3); + jPanel1.add(refresh, null); + jPanel1.add(addLocal, null); + jPanel1.add(progressBar, null); + jScrollPane2.getViewport().add(filter1); + this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, + new Insets(0, 0, 0, 0), 0, 0)); + this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0, + 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, + new Insets(3, 0, 0, 3), 240, 130)); + this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( + 3, 2, 0, 0), 150, 130)); + jPanel2.add(registryLabel, java.awt.BorderLayout.WEST); + jPanel2.add(registryURL, java.awt.BorderLayout.CENTER); + jPanel2.add(reset, java.awt.BorderLayout.EAST); + this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0, + GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, + new Insets(5, 10, 0, 10), 339, 0)); + this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( + 0, 0, 0, 60), 80, 60)); + this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( + 0, -80, 0, 0), 80, 60)); + this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, + GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets( + 0, -60, 0, 80), 80, 60)); + } + + protected JTable table = new JTable(); + + protected JEditorPane fullDetails = new JEditorPane("text/html", ""); + + TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources"); + + protected JButton refresh = new JButton(); + + protected JProgressBar progressBar = new JProgressBar(); + + protected JScrollPane scrollPane = new JScrollPane(); + + TitledBorder titledBorder2 = new TitledBorder("Full Details"); + + protected JScrollPane fullDetailsScrollpane = new JScrollPane(); + + protected JList filter1 = new JList(); + + protected JList filter2 = new JList(); + + protected JList filter3 = new JList(); + + JScrollPane jScrollPane2 = new JScrollPane(); + + JScrollPane jScrollPane3 = new JScrollPane(); + + JScrollPane jScrollPane4 = new JScrollPane(); + + protected JTextField registryURL = new JTextField(); + + protected JLabel registryLabel = new JLabel(); + + protected JButton addLocal = new JButton(); + + JPanel jPanel1 = new JPanel(); + + FlowLayout flowLayout1 = new FlowLayout(); + + GridBagLayout gridBagLayout1 = new GridBagLayout(); + + TitledBorder titledBorder3 = new TitledBorder("Authority:"); + + TitledBorder titledBorder4 = new TitledBorder("Type:"); + + TitledBorder titledBorder5 = new TitledBorder("Label:"); + + JButton reset = new JButton(); + + JPanel jPanel2 = new JPanel(); + + BorderLayout borderLayout1 = new BorderLayout(); + + public void refresh_actionPerformed(ActionEvent e) + { + + } + + public void fullDetails_hyperlinkUpdate(HyperlinkEvent e) + { + try + { + + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) + { + jalview.util.BrowserLauncher.openURL(e.getURL().toString()); + } + } catch (Exception ex) + { + System.out.println(e.getURL()); + ex.printStackTrace(); + } + } + + public void amendLocal(boolean newSource) + { + + } + + public void reset_actionPerformed(ActionEvent e) + { + + } + +} diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index 3f8b364..a3af237 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java index dd749e3..8292e58 100755 --- a/src/jalview/jbgui/GFinder.java +++ b/src/jalview/jbgui/GFinder.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java index 2035be7..12e1740 100755 --- a/src/jalview/jbgui/GFontChooser.java +++ b/src/jalview/jbgui/GFontChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java index 337a23b..94e8dca 100755 --- a/src/jalview/jbgui/GPCAPanel.java +++ b/src/jalview/jbgui/GPCAPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GPairwiseAlignPanel.java b/src/jalview/jbgui/GPairwiseAlignPanel.java index 6f8c8d2..f02c670 100755 --- a/src/jalview/jbgui/GPairwiseAlignPanel.java +++ b/src/jalview/jbgui/GPairwiseAlignPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 0881122..aa8f176 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GRestInputParamEditDialog.java b/src/jalview/jbgui/GRestInputParamEditDialog.java index 198b622..31657f0 100644 --- a/src/jalview/jbgui/GRestInputParamEditDialog.java +++ b/src/jalview/jbgui/GRestInputParamEditDialog.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.jbgui; import java.awt.Dimension; diff --git a/src/jalview/jbgui/GRestServiceEditorPane.java b/src/jalview/jbgui/GRestServiceEditorPane.java index 60e6e45..6779488 100644 --- a/src/jalview/jbgui/GRestServiceEditorPane.java +++ b/src/jalview/jbgui/GRestServiceEditorPane.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.jbgui; import jalview.gui.JvSwingUtils; diff --git a/src/jalview/jbgui/GRnaStructureViewer.java b/src/jalview/jbgui/GRnaStructureViewer.java index c30a34f..0ce05f1 100644 --- a/src/jalview/jbgui/GRnaStructureViewer.java +++ b/src/jalview/jbgui/GRnaStructureViewer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GSequenceLink.java b/src/jalview/jbgui/GSequenceLink.java index f15b4bf..88de6f7 100755 --- a/src/jalview/jbgui/GSequenceLink.java +++ b/src/jalview/jbgui/GSequenceLink.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GSliderPanel.java b/src/jalview/jbgui/GSliderPanel.java index 82acc2c..5f833d7 100755 --- a/src/jalview/jbgui/GSliderPanel.java +++ b/src/jalview/jbgui/GSliderPanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 2b99d2b..874b0ed 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index f2b32f1..4710cac 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GUserDefinedColours.java b/src/jalview/jbgui/GUserDefinedColours.java index 2c10974..288b93d 100755 --- a/src/jalview/jbgui/GUserDefinedColours.java +++ b/src/jalview/jbgui/GUserDefinedColours.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GWebserviceInfo.java b/src/jalview/jbgui/GWebserviceInfo.java index bca274c..d057429 100755 --- a/src/jalview/jbgui/GWebserviceInfo.java +++ b/src/jalview/jbgui/GWebserviceInfo.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/jbgui/GWsPreferences.java b/src/jalview/jbgui/GWsPreferences.java index 0e1325f..b16aa67 100644 --- a/src/jalview/jbgui/GWsPreferences.java +++ b/src/jalview/jbgui/GWsPreferences.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index b6e77ed..958fabe 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/math/RotatableMatrix.java b/src/jalview/math/RotatableMatrix.java index 614c70a..39ae7f5 100755 --- a/src/jalview/math/RotatableMatrix.java +++ b/src/jalview/math/RotatableMatrix.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index b207f94..7ab7fda 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.renderer; import jalview.analysis.AAFrequency; diff --git a/src/jalview/renderer/AwtRenderPanelI.java b/src/jalview/renderer/AwtRenderPanelI.java index 6e76200..70bbc7b 100644 --- a/src/jalview/renderer/AwtRenderPanelI.java +++ b/src/jalview/renderer/AwtRenderPanelI.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.renderer; import java.awt.FontMetrics; diff --git a/src/jalview/schemabinding/version2/AlcodMap.java b/src/jalview/schemabinding/version2/AlcodMap.java index e2522a1..413c028 100644 --- a/src/jalview/schemabinding/version2/AlcodMap.java +++ b/src/jalview/schemabinding/version2/AlcodMap.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Alcodon.java b/src/jalview/schemabinding/version2/Alcodon.java index 3bd1cbb..b382ac8 100644 --- a/src/jalview/schemabinding/version2/Alcodon.java +++ b/src/jalview/schemabinding/version2/Alcodon.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AlcodonFrame.java b/src/jalview/schemabinding/version2/AlcodonFrame.java index 218e07e..d60950b 100644 --- a/src/jalview/schemabinding/version2/AlcodonFrame.java +++ b/src/jalview/schemabinding/version2/AlcodonFrame.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java index 22ab909..2af8828 100644 --- a/src/jalview/schemabinding/version2/Annotation.java +++ b/src/jalview/schemabinding/version2/Annotation.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AnnotationColours.java b/src/jalview/schemabinding/version2/AnnotationColours.java index 131e370..805e70c 100644 --- a/src/jalview/schemabinding/version2/AnnotationColours.java +++ b/src/jalview/schemabinding/version2/AnnotationColours.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/AnnotationElement.java b/src/jalview/schemabinding/version2/AnnotationElement.java index 2a765ea..81e1a23 100644 --- a/src/jalview/schemabinding/version2/AnnotationElement.java +++ b/src/jalview/schemabinding/version2/AnnotationElement.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/CalcIdParam.java b/src/jalview/schemabinding/version2/CalcIdParam.java index 1d5a34c..be00b2f 100644 --- a/src/jalview/schemabinding/version2/CalcIdParam.java +++ b/src/jalview/schemabinding/version2/CalcIdParam.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Colour.java b/src/jalview/schemabinding/version2/Colour.java index 9d5a916..c718411 100644 --- a/src/jalview/schemabinding/version2/Colour.java +++ b/src/jalview/schemabinding/version2/Colour.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/DBRef.java b/src/jalview/schemabinding/version2/DBRef.java index 85997ff..d342821 100644 --- a/src/jalview/schemabinding/version2/DBRef.java +++ b/src/jalview/schemabinding/version2/DBRef.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Feature.java b/src/jalview/schemabinding/version2/Feature.java index 9e484d5..f3ad84a 100644 --- a/src/jalview/schemabinding/version2/Feature.java +++ b/src/jalview/schemabinding/version2/Feature.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/FeatureSettings.java b/src/jalview/schemabinding/version2/FeatureSettings.java index fa75e76..e507af9 100644 --- a/src/jalview/schemabinding/version2/FeatureSettings.java +++ b/src/jalview/schemabinding/version2/FeatureSettings.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Features.java b/src/jalview/schemabinding/version2/Features.java index 5d17512..1dce78a 100644 --- a/src/jalview/schemabinding/version2/Features.java +++ b/src/jalview/schemabinding/version2/Features.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Group.java b/src/jalview/schemabinding/version2/Group.java index ec1af95..5f6cf71 100644 --- a/src/jalview/schemabinding/version2/Group.java +++ b/src/jalview/schemabinding/version2/Group.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/HiddenColumns.java b/src/jalview/schemabinding/version2/HiddenColumns.java index beac4e0..fc7971d 100644 --- a/src/jalview/schemabinding/version2/HiddenColumns.java +++ b/src/jalview/schemabinding/version2/HiddenColumns.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JGroup.java b/src/jalview/schemabinding/version2/JGroup.java index 88f1a97..54af6b8 100644 --- a/src/jalview/schemabinding/version2/JGroup.java +++ b/src/jalview/schemabinding/version2/JGroup.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java index 1a11607..cc8a884 100644 --- a/src/jalview/schemabinding/version2/JSeq.java +++ b/src/jalview/schemabinding/version2/JSeq.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewModel.java b/src/jalview/schemabinding/version2/JalviewModel.java index c13ef64..9042ae4 100644 --- a/src/jalview/schemabinding/version2/JalviewModel.java +++ b/src/jalview/schemabinding/version2/JalviewModel.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewModelSequence.java b/src/jalview/schemabinding/version2/JalviewModelSequence.java index c7c02c5..a2c285a 100644 --- a/src/jalview/schemabinding/version2/JalviewModelSequence.java +++ b/src/jalview/schemabinding/version2/JalviewModelSequence.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/JalviewUserColours.java b/src/jalview/schemabinding/version2/JalviewUserColours.java index 042f092..8a6a8ea 100644 --- a/src/jalview/schemabinding/version2/JalviewUserColours.java +++ b/src/jalview/schemabinding/version2/JalviewUserColours.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListFrom.java b/src/jalview/schemabinding/version2/MapListFrom.java index 67bf1dc..7e2ff4e 100644 --- a/src/jalview/schemabinding/version2/MapListFrom.java +++ b/src/jalview/schemabinding/version2/MapListFrom.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListTo.java b/src/jalview/schemabinding/version2/MapListTo.java index e59baf8..21d650e 100644 --- a/src/jalview/schemabinding/version2/MapListTo.java +++ b/src/jalview/schemabinding/version2/MapListTo.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MapListType.java b/src/jalview/schemabinding/version2/MapListType.java index cfb0752..7a490c0 100644 --- a/src/jalview/schemabinding/version2/MapListType.java +++ b/src/jalview/schemabinding/version2/MapListType.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Mapping.java b/src/jalview/schemabinding/version2/Mapping.java index 9d71e1d..d136186 100644 --- a/src/jalview/schemabinding/version2/Mapping.java +++ b/src/jalview/schemabinding/version2/Mapping.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/MappingChoice.java b/src/jalview/schemabinding/version2/MappingChoice.java index e50efa7..d914004 100644 --- a/src/jalview/schemabinding/version2/MappingChoice.java +++ b/src/jalview/schemabinding/version2/MappingChoice.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/OtherData.java b/src/jalview/schemabinding/version2/OtherData.java index fb6b276..24a46fb 100644 --- a/src/jalview/schemabinding/version2/OtherData.java +++ b/src/jalview/schemabinding/version2/OtherData.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Pdbentry.java b/src/jalview/schemabinding/version2/Pdbentry.java index 65de364..9b46250 100644 --- a/src/jalview/schemabinding/version2/Pdbentry.java +++ b/src/jalview/schemabinding/version2/Pdbentry.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/PdbentryItem.java b/src/jalview/schemabinding/version2/PdbentryItem.java index 5554b49..369ec7a 100644 --- a/src/jalview/schemabinding/version2/PdbentryItem.java +++ b/src/jalview/schemabinding/version2/PdbentryItem.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; /** diff --git a/src/jalview/schemabinding/version2/Pdbids.java b/src/jalview/schemabinding/version2/Pdbids.java index 978df5b..5ff4e13 100644 --- a/src/jalview/schemabinding/version2/Pdbids.java +++ b/src/jalview/schemabinding/version2/Pdbids.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Property.java b/src/jalview/schemabinding/version2/Property.java index dbf96bf..9f65908 100644 --- a/src/jalview/schemabinding/version2/Property.java +++ b/src/jalview/schemabinding/version2/Property.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Sequence.java b/src/jalview/schemabinding/version2/Sequence.java index 531ca66..fa2c1d4 100644 --- a/src/jalview/schemabinding/version2/Sequence.java +++ b/src/jalview/schemabinding/version2/Sequence.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceSet.java b/src/jalview/schemabinding/version2/SequenceSet.java index 8be8022..339ded7 100644 --- a/src/jalview/schemabinding/version2/SequenceSet.java +++ b/src/jalview/schemabinding/version2/SequenceSet.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceSetProperties.java b/src/jalview/schemabinding/version2/SequenceSetProperties.java index 3a7d172..095468b 100644 --- a/src/jalview/schemabinding/version2/SequenceSetProperties.java +++ b/src/jalview/schemabinding/version2/SequenceSetProperties.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/SequenceType.java b/src/jalview/schemabinding/version2/SequenceType.java index f213ebb..83a5a7c 100644 --- a/src/jalview/schemabinding/version2/SequenceType.java +++ b/src/jalview/schemabinding/version2/SequenceType.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java index c458971..05132c0 100644 --- a/src/jalview/schemabinding/version2/Setting.java +++ b/src/jalview/schemabinding/version2/Setting.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/StructureState.java b/src/jalview/schemabinding/version2/StructureState.java index 30e73eb..68a225a 100644 --- a/src/jalview/schemabinding/version2/StructureState.java +++ b/src/jalview/schemabinding/version2/StructureState.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/ThresholdLine.java b/src/jalview/schemabinding/version2/ThresholdLine.java index d70d855..0ccb45f 100644 --- a/src/jalview/schemabinding/version2/ThresholdLine.java +++ b/src/jalview/schemabinding/version2/ThresholdLine.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Tree.java b/src/jalview/schemabinding/version2/Tree.java index 19b3eb1..f9a6391 100644 --- a/src/jalview/schemabinding/version2/Tree.java +++ b/src/jalview/schemabinding/version2/Tree.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/UserColourScheme.java b/src/jalview/schemabinding/version2/UserColourScheme.java index e4983bd..b687418 100644 --- a/src/jalview/schemabinding/version2/UserColourScheme.java +++ b/src/jalview/schemabinding/version2/UserColourScheme.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/UserColours.java b/src/jalview/schemabinding/version2/UserColours.java index b02d0cd..00f9941 100644 --- a/src/jalview/schemabinding/version2/UserColours.java +++ b/src/jalview/schemabinding/version2/UserColours.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/VAMSAS.java b/src/jalview/schemabinding/version2/VAMSAS.java index d025824..fa91d51 100644 --- a/src/jalview/schemabinding/version2/VAMSAS.java +++ b/src/jalview/schemabinding/version2/VAMSAS.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/VamsasModel.java b/src/jalview/schemabinding/version2/VamsasModel.java index d3fe796..4bbc0e2 100644 --- a/src/jalview/schemabinding/version2/VamsasModel.java +++ b/src/jalview/schemabinding/version2/VamsasModel.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java index 24a25c0..8611be0 100644 --- a/src/jalview/schemabinding/version2/Viewport.java +++ b/src/jalview/schemabinding/version2/Viewport.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/WebServiceParameterSet.java b/src/jalview/schemabinding/version2/WebServiceParameterSet.java index 72d2f82..0283bef 100644 --- a/src/jalview/schemabinding/version2/WebServiceParameterSet.java +++ b/src/jalview/schemabinding/version2/WebServiceParameterSet.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java index 1447978..44ec97b 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodMapDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java index c1a0eab..8e6864f 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodonDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java index 919941e..04c2be9 100644 --- a/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AlcodonFrameDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java index 59ea5ca..876e928 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationColoursDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java index 2928c7f..028716e 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java index 4416bbf..af72c3a 100644 --- a/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/AnnotationElementDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java b/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java index 6dbea24..a414789 100644 --- a/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/CalcIdParamDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java index 8b1ae9e..1ef6086 100644 --- a/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ColourDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java index e896d7a..a8e2f2d 100644 --- a/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/DBRefDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java index 64ed3a5..bf03c4b 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeatureDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java index 44bc256..dddeb96 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeatureSettingsDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java index 107c06d..b47af9e 100644 --- a/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/FeaturesDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java index 7aa6203..8bdde86 100644 --- a/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/GroupDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java index a5607b7..8df53af 100644 --- a/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/HiddenColumnsDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java index 8e74952..ccf3217 100644 --- a/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JGroupDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java index 9d192cf..ca83be6 100644 --- a/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JSeqDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java index 70f3095..6237b1a 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java index 4bb4df5..4532250 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewModelSequenceDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java index 77efa7e..f251553 100644 --- a/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/JalviewUserColoursDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java index 529f477..43d40e7 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListFromDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java index bed082a..d32bc03 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListToDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java index fc24a78..7f3c72e 100644 --- a/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MapListTypeDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java index ae460af..c032170 100644 --- a/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MappingChoiceDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java index fab0d2e..4de9c02 100644 --- a/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/MappingDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java index f582311..1f5a2ad 100644 --- a/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/OtherDataDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java index f19703a..18c5933 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbentryDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java index 4e2fc87..42c76da 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbentryItemDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java index 584607d..42ff3cf 100644 --- a/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PdbidsDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java index 60d09b4..48dbc66 100644 --- a/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/PropertyDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java index 2303e1b..e233ccc 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java index cd74c6e..b30ddbe 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java index 409abdd..e3e6ee3 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceSetPropertiesDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java index 3ee3fa9..b7826d0 100644 --- a/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SequenceTypeDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java index 4703f46..55b7fe3 100644 --- a/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/SettingDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java index 5e2a839..9979056 100644 --- a/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/StructureStateDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java index 8a863d8..28a7111 100644 --- a/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ThresholdLineDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java index 8e675f3..3d06573 100644 --- a/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/TreeDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java index df9ab07..9616b54 100644 --- a/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/UserColourSchemeDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java index 53dfde4..8848f14 100644 --- a/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/UserColoursDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java index e3470ee..966f532 100644 --- a/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/VAMSASDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java index 3e26611..9c0994d 100644 --- a/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/VamsasModelDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java index 8a8c2d4..55bfc8e 100644 --- a/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/ViewportDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java index beb5b50..e4a4011 100644 --- a/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java +++ b/src/jalview/schemabinding/version2/descriptors/WebServiceParameterSetDescriptor.java @@ -1,10 +1,20 @@ /* - * This class was automatically generated with - * Castor 1.1, using an XML - * Schema. - * $Id$ + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - package jalview.schemabinding.version2.descriptors; //---------------------------------/ diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index b31eabc..218b5fa 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index 0589475..36c8e75 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/BuriedColourScheme.java b/src/jalview/schemes/BuriedColourScheme.java index f0b2dfb..100a413 100755 --- a/src/jalview/schemes/BuriedColourScheme.java +++ b/src/jalview/schemes/BuriedColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ClustalxColourScheme.java b/src/jalview/schemes/ClustalxColourScheme.java index 1b3482f..e79676f 100755 --- a/src/jalview/schemes/ClustalxColourScheme.java +++ b/src/jalview/schemes/ClustalxColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java index e4e6ebe..0750adf 100755 --- a/src/jalview/schemes/ColourSchemeI.java +++ b/src/jalview/schemes/ColourSchemeI.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index 608d8ed..47dbde2 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -1,18 +1,18 @@ /* - * 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 - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License + * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * - * Jalview is distributed 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 . */ package jalview.schemes; diff --git a/src/jalview/schemes/Consensus.java b/src/jalview/schemes/Consensus.java index a2de3c6..213621b 100755 --- a/src/jalview/schemes/Consensus.java +++ b/src/jalview/schemes/Consensus.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/CovariationColourScheme.java b/src/jalview/schemes/CovariationColourScheme.java index 18403b7..908eff7 100644 --- a/src/jalview/schemes/CovariationColourScheme.java +++ b/src/jalview/schemes/CovariationColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/GraduatedColor.java b/src/jalview/schemes/GraduatedColor.java index f5c3688..bbfc475 100644 --- a/src/jalview/schemes/GraduatedColor.java +++ b/src/jalview/schemes/GraduatedColor.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/HelixColourScheme.java b/src/jalview/schemes/HelixColourScheme.java index 37b9f6d..e740980 100755 --- a/src/jalview/schemes/HelixColourScheme.java +++ b/src/jalview/schemes/HelixColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/HydrophobicColourScheme.java b/src/jalview/schemes/HydrophobicColourScheme.java index fe67de3..e073b20 100755 --- a/src/jalview/schemes/HydrophobicColourScheme.java +++ b/src/jalview/schemes/HydrophobicColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/NucleotideColourScheme.java b/src/jalview/schemes/NucleotideColourScheme.java index e9d6049..522e2e4 100755 --- a/src/jalview/schemes/NucleotideColourScheme.java +++ b/src/jalview/schemes/NucleotideColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 800ba87..cbd082d 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/PurinePyrimidineColourScheme.java b/src/jalview/schemes/PurinePyrimidineColourScheme.java index 0f426b7..2354bab 100644 --- a/src/jalview/schemes/PurinePyrimidineColourScheme.java +++ b/src/jalview/schemes/PurinePyrimidineColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/RNAHelicesColour.java b/src/jalview/schemes/RNAHelicesColour.java index 4416bfd..168aa31 100644 --- a/src/jalview/schemes/RNAHelicesColour.java +++ b/src/jalview/schemes/RNAHelicesColour.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/RNAHelicesColourChooser.java b/src/jalview/schemes/RNAHelicesColourChooser.java index 5b97a12..25b65b3 100644 --- a/src/jalview/schemes/RNAHelicesColourChooser.java +++ b/src/jalview/schemes/RNAHelicesColourChooser.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 642eb05..3f18595 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index e4f6bc9..fa4260f 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java index 4e696cf..2fb6338 100755 --- a/src/jalview/schemes/ScoreColourScheme.java +++ b/src/jalview/schemes/ScoreColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ScoreMatrix.java b/src/jalview/schemes/ScoreMatrix.java index 9341509..da9896e 100644 --- a/src/jalview/schemes/ScoreMatrix.java +++ b/src/jalview/schemes/ScoreMatrix.java @@ -1,147 +1,147 @@ -/* - * 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 . - */ -package jalview.schemes; - -public class ScoreMatrix -{ - String name; - - /** - * reference to integer score matrix - */ - int[][] matrix; - - /** - * 0 for Protein Score matrix. 1 for dna score matrix - */ - int type; - - ScoreMatrix(String name, int[][] matrix, int type) - { - this.matrix = matrix; - this.type = type; - } - - public boolean isDNA() - { - return type == 1; - } - - public boolean isProtein() - { - return type == 0; - } - - public int[][] getMatrix() - { - return matrix; - } - - /** - * - * @param A1 - * @param A2 - * @return score for substituting first char in A1 with first char in A2 - */ - public int getPairwiseScore(String A1, String A2) - { - return getPairwiseScore(A1.charAt(0), A2.charAt(0)); - } - - public int getPairwiseScore(char c, char d) - { - int pog = 0; - - try - { - int a = (type == 0) ? ResidueProperties.aaIndex[c] - : ResidueProperties.nucleotideIndex[c]; - int b = (type == 0) ? ResidueProperties.aaIndex[d] - : ResidueProperties.nucleotideIndex[d]; - - pog = matrix[a][b]; - } catch (Exception e) - { - // System.out.println("Unknown residue in " + A1 + " " + A2); - } - - return pog; - } - - /** - * pretty print the matrix - */ - public String toString() - { - return outputMatrix(false); - } - - public String outputMatrix(boolean html) - { - StringBuffer sb = new StringBuffer(); - int[] symbols = (type == 0) ? ResidueProperties.aaIndex - : ResidueProperties.nucleotideIndex; - int symMax = (type == 0) ? ResidueProperties.maxProteinIndex - : ResidueProperties.maxNucleotideIndex; - boolean header = true; - if (html) - { - sb.append(""); - } - for (char sym = 'A'; sym <= 'Z'; sym++) - { - if (symbols[sym] >= 0 && symbols[sym] < symMax) - { - if (header) - { - sb.append(html ? "" : ""); - for (char sym2 = 'A'; sym2 <= 'Z'; sym2++) - { - if (symbols[sym2] >= 0 && symbols[sym2] < symMax) - { - sb.append((html ? "" : "")); - } - } - header = false; - sb.append(html ? "\n" : "\n"); - } - if (html) - { - sb.append(""); - } - sb.append((html ? "" : "")); - for (char sym2 = 'A'; sym2 <= 'Z'; sym2++) - { - if (symbols[sym2] >= 0 && symbols[sym2] < symMax) - { - sb.append((html ? "" : "")); - } - } - sb.append(html ? "\n" : "\n"); - } - } - if (html) - { - sb.append("
                 " : "\t") + sym2 - + (html ? " 
                " : "") + sym + (html ? "" : "\t") - + matrix[symbols[sym]][symbols[sym2]] - + (html ? "
                "); - } - return sb.toString(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.schemes; + +public class ScoreMatrix +{ + String name; + + /** + * reference to integer score matrix + */ + int[][] matrix; + + /** + * 0 for Protein Score matrix. 1 for dna score matrix + */ + int type; + + ScoreMatrix(String name, int[][] matrix, int type) + { + this.matrix = matrix; + this.type = type; + } + + public boolean isDNA() + { + return type == 1; + } + + public boolean isProtein() + { + return type == 0; + } + + public int[][] getMatrix() + { + return matrix; + } + + /** + * + * @param A1 + * @param A2 + * @return score for substituting first char in A1 with first char in A2 + */ + public int getPairwiseScore(String A1, String A2) + { + return getPairwiseScore(A1.charAt(0), A2.charAt(0)); + } + + public int getPairwiseScore(char c, char d) + { + int pog = 0; + + try + { + int a = (type == 0) ? ResidueProperties.aaIndex[c] + : ResidueProperties.nucleotideIndex[c]; + int b = (type == 0) ? ResidueProperties.aaIndex[d] + : ResidueProperties.nucleotideIndex[d]; + + pog = matrix[a][b]; + } catch (Exception e) + { + // System.out.println("Unknown residue in " + A1 + " " + A2); + } + + return pog; + } + + /** + * pretty print the matrix + */ + public String toString() + { + return outputMatrix(false); + } + + public String outputMatrix(boolean html) + { + StringBuffer sb = new StringBuffer(); + int[] symbols = (type == 0) ? ResidueProperties.aaIndex + : ResidueProperties.nucleotideIndex; + int symMax = (type == 0) ? ResidueProperties.maxProteinIndex + : ResidueProperties.maxNucleotideIndex; + boolean header = true; + if (html) + { + sb.append(""); + } + for (char sym = 'A'; sym <= 'Z'; sym++) + { + if (symbols[sym] >= 0 && symbols[sym] < symMax) + { + if (header) + { + sb.append(html ? "" : ""); + for (char sym2 = 'A'; sym2 <= 'Z'; sym2++) + { + if (symbols[sym2] >= 0 && symbols[sym2] < symMax) + { + sb.append((html ? "" : "")); + } + } + header = false; + sb.append(html ? "\n" : "\n"); + } + if (html) + { + sb.append(""); + } + sb.append((html ? "" : "")); + for (char sym2 = 'A'; sym2 <= 'Z'; sym2++) + { + if (symbols[sym2] >= 0 && symbols[sym2] < symMax) + { + sb.append((html ? "" : "")); + } + } + sb.append(html ? "\n" : "\n"); + } + } + if (html) + { + sb.append("
                 " : "\t") + sym2 + + (html ? " 
                " : "") + sym + (html ? "" : "\t") + + matrix[symbols[sym]][symbols[sym2]] + + (html ? "
                "); + } + return sb.toString(); + } +} diff --git a/src/jalview/schemes/StrandColourScheme.java b/src/jalview/schemes/StrandColourScheme.java index b1f0d75..9cf3340 100755 --- a/src/jalview/schemes/StrandColourScheme.java +++ b/src/jalview/schemes/StrandColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/TCoffeeColourScheme.java b/src/jalview/schemes/TCoffeeColourScheme.java index 82ca10f..ac173bb 100644 --- a/src/jalview/schemes/TCoffeeColourScheme.java +++ b/src/jalview/schemes/TCoffeeColourScheme.java @@ -1,3 +1,20 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ package jalview.schemes; import jalview.analysis.SequenceIdMatcher; diff --git a/src/jalview/schemes/TaylorColourScheme.java b/src/jalview/schemes/TaylorColourScheme.java index 316c828..d33845c 100755 --- a/src/jalview/schemes/TaylorColourScheme.java +++ b/src/jalview/schemes/TaylorColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/TurnColourScheme.java b/src/jalview/schemes/TurnColourScheme.java index 5315fc1..cfc4274 100755 --- a/src/jalview/schemes/TurnColourScheme.java +++ b/src/jalview/schemes/TurnColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 25c849e..462b9c6 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/schemes/ZappoColourScheme.java b/src/jalview/schemes/ZappoColourScheme.java index 19f1d69..a0262d9 100755 --- a/src/jalview/schemes/ZappoColourScheme.java +++ b/src/jalview/schemes/ZappoColourScheme.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/AlignmentViewPanelListener.java b/src/jalview/structure/AlignmentViewPanelListener.java index 711d6fb..c67d916 100644 --- a/src/jalview/structure/AlignmentViewPanelListener.java +++ b/src/jalview/structure/AlignmentViewPanelListener.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.structure; import jalview.api.AlignmentViewPanel; diff --git a/src/jalview/structure/SecondaryStructureListener.java b/src/jalview/structure/SecondaryStructureListener.java index 3f72ed6..e3709d2 100644 --- a/src/jalview/structure/SecondaryStructureListener.java +++ b/src/jalview/structure/SecondaryStructureListener.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/SelectionListener.java b/src/jalview/structure/SelectionListener.java index 3df8863..ef26d06 100644 --- a/src/jalview/structure/SelectionListener.java +++ b/src/jalview/structure/SelectionListener.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/SelectionSource.java b/src/jalview/structure/SelectionSource.java index 1e22e67..e0e7c5e 100644 --- a/src/jalview/structure/SelectionSource.java +++ b/src/jalview/structure/SelectionSource.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/SequenceListener.java b/src/jalview/structure/SequenceListener.java index 88c3021..7668d3c 100644 --- a/src/jalview/structure/SequenceListener.java +++ b/src/jalview/structure/SequenceListener.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/StructureListener.java b/src/jalview/structure/StructureListener.java index e07b480..6285d28 100644 --- a/src/jalview/structure/StructureListener.java +++ b/src/jalview/structure/StructureListener.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/StructureMapping.java b/src/jalview/structure/StructureMapping.java index b706f17..a76b2f2 100644 --- a/src/jalview/structure/StructureMapping.java +++ b/src/jalview/structure/StructureMapping.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/StructureMappingcommandSet.java b/src/jalview/structure/StructureMappingcommandSet.java index 061b106..3278026 100644 --- a/src/jalview/structure/StructureMappingcommandSet.java +++ b/src/jalview/structure/StructureMappingcommandSet.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.structure; /** diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index a76a27e..e598120 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/structure/VamsasListener.java b/src/jalview/structure/VamsasListener.java index c239be7..c9fd12a 100644 --- a/src/jalview/structure/VamsasListener.java +++ b/src/jalview/structure/VamsasListener.java @@ -1,37 +1,37 @@ -/* - * 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 . - */ -package jalview.structure; - -import jalview.datamodel.SequenceI; - -/** - * The vamsasListener allows peers to receive mouseOver events from any Jalview - * alignment window. - * - * @author JimP - * - * @history Version 1 released for Jalview 2.4. - * @history Version 2 mouseOver refactored to include an additional parameter - * allowing the source of the event to be passed to the handler. - * - * - */ -public interface VamsasListener -{ - public void mouseOver(SequenceI seq, int index, VamsasSource source); -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.structure; + +import jalview.datamodel.SequenceI; + +/** + * The vamsasListener allows peers to receive mouseOver events from any Jalview + * alignment window. + * + * @author JimP + * + * @history Version 1 released for Jalview 2.4. + * @history Version 2 mouseOver refactored to include an additional parameter + * allowing the source of the event to be passed to the handler. + * + * + */ +public interface VamsasListener +{ + public void mouseOver(SequenceI seq, int index, VamsasSource source); +} diff --git a/src/jalview/structure/VamsasSource.java b/src/jalview/structure/VamsasSource.java index a6c489b..1c48d6c 100644 --- a/src/jalview/structure/VamsasSource.java +++ b/src/jalview/structure/VamsasSource.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.structure; /** diff --git a/src/jalview/util/AWTConsole.java b/src/jalview/util/AWTConsole.java index ad2e08b..045183d 100644 --- a/src/jalview/util/AWTConsole.java +++ b/src/jalview/util/AWTConsole.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/BrowserLauncher.java b/src/jalview/util/BrowserLauncher.java index 6f89f68..66a9c95 100755 --- a/src/jalview/util/BrowserLauncher.java +++ b/src/jalview/util/BrowserLauncher.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java index f03588e..c4de18b 100644 --- a/src/jalview/util/ColorUtils.java +++ b/src/jalview/util/ColorUtils.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -15,7 +15,6 @@ * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . */ - /** * author: Lauren Michelle Lui */ diff --git a/src/jalview/util/Comparison.java b/src/jalview/util/Comparison.java index 9044bf9..cec9bc3 100644 --- a/src/jalview/util/Comparison.java +++ b/src/jalview/util/Comparison.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 70ef47c..804595b 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index d85013c..9aeb8a6 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/GroupUrlLink.java b/src/jalview/util/GroupUrlLink.java index b4eb2ab..714e12d 100644 --- a/src/jalview/util/GroupUrlLink.java +++ b/src/jalview/util/GroupUrlLink.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index 3c6b05f..1c6b92b 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/MapList.java b/src/jalview/util/MapList.java index 2e81276..e584a13 100644 --- a/src/jalview/util/MapList.java +++ b/src/jalview/util/MapList.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/ParseHtmlBodyAndLinks.java b/src/jalview/util/ParseHtmlBodyAndLinks.java index 22bae14..6919108 100644 --- a/src/jalview/util/ParseHtmlBodyAndLinks.java +++ b/src/jalview/util/ParseHtmlBodyAndLinks.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * 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 - * +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * * This file is part of Jalview. - * + * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License along with Jalview. If not, see . - *******************************************************************************/ + */ package jalview.util; import java.util.ArrayList; diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index 38d5e16..aa17434 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -1,74 +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 . - */ -package jalview.util; - -/** - * System platform information used by Applet and Application - * - * @author Jim Procter - */ -public class Platform -{ - /** - * sorry folks - Macs really are different - * - * @return true if we do things in a special way. - */ - public boolean isAMac() - { - return java.lang.System.getProperty("os.name").indexOf("Mac") > -1; - - } - - public boolean isHeadless() - { - String hdls = java.lang.System.getProperty("java.awt.headless"); - - return hdls != null && hdls.equals("true"); - } - - /** - * - * @return nominal maximum command line length for this platform - */ - public static int getMaxCommandLineLength() - { - // TODO: determine nominal limits for most platforms. - return 2046; // this is the max length for a windows NT system. - } - - /** - * escape a string according to the local platform's escape character - * - * @param file - * @return escaped file - */ - public static String escapeString(String file) - { - StringBuffer f = new StringBuffer(); - int p = 0, lastp = 0; - while ((p = file.indexOf('\\', lastp)) > -1) - { - f.append(file.subSequence(lastp, p)); - f.append("\\\\"); - lastp = p + 1; - } - f.append(file.substring(lastp)); - return f.toString(); - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.util; + +/** + * System platform information used by Applet and Application + * + * @author Jim Procter + */ +public class Platform +{ + /** + * sorry folks - Macs really are different + * + * @return true if we do things in a special way. + */ + public boolean isAMac() + { + return java.lang.System.getProperty("os.name").indexOf("Mac") > -1; + + } + + public boolean isHeadless() + { + String hdls = java.lang.System.getProperty("java.awt.headless"); + + return hdls != null && hdls.equals("true"); + } + + /** + * + * @return nominal maximum command line length for this platform + */ + public static int getMaxCommandLineLength() + { + // TODO: determine nominal limits for most platforms. + return 2046; // this is the max length for a windows NT system. + } + + /** + * escape a string according to the local platform's escape character + * + * @param file + * @return escaped file + */ + public static String escapeString(String file) + { + StringBuffer f = new StringBuffer(); + int p = 0, lastp = 0; + while ((p = file.indexOf('\\', lastp)) > -1) + { + f.append(file.subSequence(lastp, p)); + f.append("\\\\"); + lastp = p + 1; + } + f.append(file.substring(lastp)); + return f.toString(); + } +} diff --git a/src/jalview/util/QuickSort.java b/src/jalview/util/QuickSort.java index 6b77fad..5ba22c1 100755 --- a/src/jalview/util/QuickSort.java +++ b/src/jalview/util/QuickSort.java @@ -1,13 +1,13 @@ /* - * 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 + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR diff --git a/src/jalview/util/ShiftList.java b/src/jalview/util/ShiftList.java index e57b872..d4d06ee 100644 --- a/src/jalview/util/ShiftList.java +++ b/src/jalview/util/ShiftList.java @@ -1,143 +1,143 @@ -/* - * 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 . - */ -package jalview.util; - -import java.util.*; - -/** - * ShiftList Simple way of mapping a linear series to a new linear range with - * new points introduced. Use at your own risk! Now growing to be used for - * interval ranges (position, offset) storing deletions/insertions - */ -public class ShiftList -{ - public Vector shifts; - - public ShiftList() - { - shifts = new Vector(); - } - - /** - * addShift - * - * @param pos - * start position for shift (in original reference frame) - * @param shift - * length of shift - */ - public void addShift(int pos, int shift) - { - int sidx = 0; - int[] rshift = null; - while (sidx < shifts.size() - && (rshift = (int[]) shifts.elementAt(sidx))[0] < pos) - { - sidx++; - } - if (sidx == shifts.size()) - { - shifts.insertElementAt(new int[] - { pos, shift }, sidx); - } - else - { - rshift[1] += shift; - } - } - - /** - * shift - * - * @param pos - * int - * @return int shifted position - */ - public int shift(int pos) - { - if (shifts.size() == 0) - { - return pos; - } - int shifted = pos; - int sidx = 0; - int rshift[]; - while (sidx < shifts.size() - && (rshift = ((int[]) shifts.elementAt(sidx++)))[0] <= pos) - { - shifted += rshift[1]; - } - return shifted; - } - - /** - * clear all shifts - */ - public void clear() - { - shifts.removeAllElements(); - } - - /** - * invert the shifts - * - * @return ShiftList with inverse shift operations - */ - public ShiftList getInverse() - { - ShiftList inverse = new ShiftList(); - if (shifts != null) - { - for (int i = 0, j = shifts.size(); i < j; i++) - { - int[] sh = (int[]) shifts.elementAt(i); - if (sh != null) - { - inverse.shifts.addElement(new int[] - { sh[0], -sh[1] }); - } - } - } - return inverse; - } - - /** - * parse a 1d map of position 1 0) - { - shiftList = new ShiftList(); - for (int i = 0, p = 0; i < gapMap.length; p++, i++) - { - if (p != gapMap[i]) - { - shiftList.addShift(p, gapMap[i] - p); - p = gapMap[i]; - } - } - } - return shiftList; - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.util; + +import java.util.*; + +/** + * ShiftList Simple way of mapping a linear series to a new linear range with + * new points introduced. Use at your own risk! Now growing to be used for + * interval ranges (position, offset) storing deletions/insertions + */ +public class ShiftList +{ + public Vector shifts; + + public ShiftList() + { + shifts = new Vector(); + } + + /** + * addShift + * + * @param pos + * start position for shift (in original reference frame) + * @param shift + * length of shift + */ + public void addShift(int pos, int shift) + { + int sidx = 0; + int[] rshift = null; + while (sidx < shifts.size() + && (rshift = (int[]) shifts.elementAt(sidx))[0] < pos) + { + sidx++; + } + if (sidx == shifts.size()) + { + shifts.insertElementAt(new int[] + { pos, shift }, sidx); + } + else + { + rshift[1] += shift; + } + } + + /** + * shift + * + * @param pos + * int + * @return int shifted position + */ + public int shift(int pos) + { + if (shifts.size() == 0) + { + return pos; + } + int shifted = pos; + int sidx = 0; + int rshift[]; + while (sidx < shifts.size() + && (rshift = ((int[]) shifts.elementAt(sidx++)))[0] <= pos) + { + shifted += rshift[1]; + } + return shifted; + } + + /** + * clear all shifts + */ + public void clear() + { + shifts.removeAllElements(); + } + + /** + * invert the shifts + * + * @return ShiftList with inverse shift operations + */ + public ShiftList getInverse() + { + ShiftList inverse = new ShiftList(); + if (shifts != null) + { + for (int i = 0, j = shifts.size(); i < j; i++) + { + int[] sh = (int[]) shifts.elementAt(i); + if (sh != null) + { + inverse.shifts.addElement(new int[] + { sh[0], -sh[1] }); + } + } + } + return inverse; + } + + /** + * parse a 1d map of position 1 0) + { + shiftList = new ShiftList(); + for (int i = 0, p = 0; i < gapMap.length; p++, i++) + { + if (p != gapMap[i]) + { + shiftList.addShift(p, gapMap[i] - p); + p = gapMap[i]; + } + } + } + return shiftList; + } +} diff --git a/src/jalview/util/TableSorter.java b/src/jalview/util/TableSorter.java index 5e9556e..4c44b61 100755 --- a/src/jalview/util/TableSorter.java +++ b/src/jalview/util/TableSorter.java @@ -1,597 +1,597 @@ -/* - * 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 . - */ -package jalview.util; - -import java.util.*; -import java.util.List; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.table.*; - -/** - * TableSorter is a decorator for TableModels; adding sorting functionality to a - * supplied TableModel. TableSorter does not store or copy the data in its - * TableModel; instead it maintains a map from the row indexes of the view to - * the row indexes of the model. As requests are made of the sorter (like - * getValueAt(row, col)) they are passed to the underlying model after the row - * numbers have been translated via the internal mapping array. This way, the - * TableSorter appears to hold another copy of the table with the rows in a - * different order. - *

                - * TableSorter registers itself as a listener to the underlying model, just as - * the JTable itself would. Events recieved from the model are examined, - * sometimes manipulated (typically widened), and then passed on to the - * TableSorter's listeners (typically the JTable). If a change to the model has - * invalidated the order of TableSorter's rows, a note of this is made and the - * sorter will resort the rows the next time a value is requested. - *

                - * When the tableHeader property is set, either by using the setTableHeader() - * method or the two argument constructor, the table header may be used as a - * complete UI for TableSorter. The default renderer of the tableHeader is - * decorated with a renderer that indicates the sorting status of each column. - * In addition, a mouse listener is installed with the following behavior: - *

                  - *
                • Mouse-click: Clears the sorting status of all other columns and advances - * the sorting status of that column through three values: {NOT_SORTED, - * ASCENDING, DESCENDING} (then back to NOT_SORTED again). - *
                • SHIFT-mouse-click: Clears the sorting status of all other columns and - * cycles the sorting status of the column through the same three values, in the - * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. - *
                • CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that - * the changes to the column do not cancel the statuses of columns that are - * already sorting - giving a way to initiate a compound sort. - *
                - *

                - * This is a long overdue rewrite of a class of the same name that first - * appeared in the swing table demos in 1997. - * - * @author Philip Milne - * @author Brendon McLean - * @author Dan van Enckevort - * @author Parwinder Sekhon - * @version 2.0 02/27/04 - */ - -public class TableSorter extends AbstractTableModel -{ - protected TableModel tableModel; - - public static final int DESCENDING = -1; - - public static final int NOT_SORTED = 0; - - public static final int ASCENDING = 1; - - private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); - - public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() - { - public int compare(Object o1, Object o2) - { - return ((Comparable) o1).compareTo(o2); - } - }; - - public static final Comparator LEXICAL_COMPARATOR = new Comparator() - { - public int compare(Object o1, Object o2) - { - return o1.toString().compareTo(o2.toString()); - } - }; - - private Row[] viewToModel; - - private int[] modelToView; - - private JTableHeader tableHeader; - - private MouseListener mouseListener; - - private TableModelListener tableModelListener; - - private Map columnComparators = new HashMap(); - - private List sortingColumns = new ArrayList(); - - public TableSorter() - { - this.mouseListener = new MouseHandler(); - this.tableModelListener = new TableModelHandler(); - } - - public TableSorter(TableModel tableModel) - { - this(); - setTableModel(tableModel); - } - - public TableSorter(TableModel tableModel, JTableHeader tableHeader) - { - this(); - setTableHeader(tableHeader); - setTableModel(tableModel); - } - - private void clearSortingState() - { - viewToModel = null; - modelToView = null; - } - - public TableModel getTableModel() - { - return tableModel; - } - - public void setTableModel(TableModel tableModel) - { - if (this.tableModel != null) - { - this.tableModel.removeTableModelListener(tableModelListener); - } - - this.tableModel = tableModel; - if (this.tableModel != null) - { - this.tableModel.addTableModelListener(tableModelListener); - } - - clearSortingState(); - fireTableStructureChanged(); - } - - public JTableHeader getTableHeader() - { - return tableHeader; - } - - public void setTableHeader(JTableHeader tableHeader) - { - if (this.tableHeader != null) - { - this.tableHeader.removeMouseListener(mouseListener); - TableCellRenderer defaultRenderer = this.tableHeader - .getDefaultRenderer(); - if (defaultRenderer instanceof SortableHeaderRenderer) - { - this.tableHeader - .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer); - } - } - this.tableHeader = tableHeader; - if (this.tableHeader != null) - { - this.tableHeader.addMouseListener(mouseListener); - this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer( - this.tableHeader.getDefaultRenderer())); - } - } - - public boolean isSorting() - { - return sortingColumns.size() != 0; - } - - private Directive getDirective(int column) - { - for (int i = 0; i < sortingColumns.size(); i++) - { - Directive directive = (Directive) sortingColumns.get(i); - if (directive.column == column) - { - return directive; - } - } - return EMPTY_DIRECTIVE; - } - - public int getSortingStatus(int column) - { - return getDirective(column).direction; - } - - private void sortingStatusChanged() - { - clearSortingState(); - fireTableDataChanged(); - if (tableHeader != null) - { - tableHeader.repaint(); - } - } - - public void setSortingStatus(int column, int status) - { - Directive directive = getDirective(column); - if (directive != EMPTY_DIRECTIVE) - { - sortingColumns.remove(directive); - } - if (status != NOT_SORTED) - { - sortingColumns.add(new Directive(column, status)); - } - sortingStatusChanged(); - } - - protected Icon getHeaderRendererIcon(int column, int size) - { - Directive directive = getDirective(column); - if (directive == EMPTY_DIRECTIVE) - { - return null; - } - return new Arrow(directive.direction == DESCENDING, size, - sortingColumns.indexOf(directive)); - } - - private void cancelSorting() - { - sortingColumns.clear(); - sortingStatusChanged(); - } - - public void setColumnComparator(Class type, Comparator comparator) - { - if (comparator == null) - { - columnComparators.remove(type); - } - else - { - columnComparators.put(type, comparator); - } - } - - protected Comparator getComparator(int column) - { - Class columnType = tableModel.getColumnClass(column); - Comparator comparator = (Comparator) columnComparators.get(columnType); - if (comparator != null) - { - return comparator; - } - if (Comparable.class.isAssignableFrom(columnType)) - { - return COMPARABLE_COMAPRATOR; - } - return LEXICAL_COMPARATOR; - } - - private Row[] getViewToModel() - { - if (viewToModel == null) - { - int tableModelRowCount = tableModel.getRowCount(); - viewToModel = new Row[tableModelRowCount]; - for (int row = 0; row < tableModelRowCount; row++) - { - viewToModel[row] = new Row(row); - } - - if (isSorting()) - { - Arrays.sort(viewToModel); - } - } - return viewToModel; - } - - public int modelIndex(int viewIndex) - { - return getViewToModel()[viewIndex].modelIndex; - } - - private int[] getModelToView() - { - if (modelToView == null) - { - int n = getViewToModel().length; - modelToView = new int[n]; - for (int i = 0; i < n; i++) - { - modelToView[modelIndex(i)] = i; - } - } - return modelToView; - } - - // TableModel interface methods - - public int getRowCount() - { - return (tableModel == null) ? 0 : tableModel.getRowCount(); - } - - public int getColumnCount() - { - return (tableModel == null) ? 0 : tableModel.getColumnCount(); - } - - public String getColumnName(int column) - { - return tableModel.getColumnName(column); - } - - public Class getColumnClass(int column) - { - return tableModel.getColumnClass(column); - } - - public boolean isCellEditable(int row, int column) - { - return tableModel.isCellEditable(modelIndex(row), column); - } - - public Object getValueAt(int row, int column) - { - return tableModel.getValueAt(modelIndex(row), column); - } - - public void setValueAt(Object aValue, int row, int column) - { - tableModel.setValueAt(aValue, modelIndex(row), column); - } - - // Helper classes - - private class Row implements Comparable - { - private int modelIndex; - - public Row(int index) - { - this.modelIndex = index; - } - - public int compareTo(Object o) - { - int row1 = modelIndex; - int row2 = ((Row) o).modelIndex; - - for (Iterator it = sortingColumns.iterator(); it.hasNext();) - { - Directive directive = (Directive) it.next(); - int column = directive.column; - Object o1 = tableModel.getValueAt(row1, column); - Object o2 = tableModel.getValueAt(row2, column); - - int comparison = 0; - // Define null less than everything, except null. - if (o1 == null && o2 == null) - { - comparison = 0; - } - else if (o1 == null) - { - comparison = -1; - } - else if (o2 == null) - { - comparison = 1; - } - else - { - comparison = getComparator(column).compare(o1, o2); - } - if (comparison != 0) - { - return directive.direction == DESCENDING ? -comparison - : comparison; - } - } - return 0; - } - } - - private class TableModelHandler implements TableModelListener - { - public void tableChanged(TableModelEvent e) - { - // If we're not sorting by anything, just pass the event along. - if (!isSorting()) - { - clearSortingState(); - fireTableChanged(e); - return; - } - - // If the table structure has changed, cancel the sorting; the - // sorting columns may have been either moved or deleted from - // the model. - if (e.getFirstRow() == TableModelEvent.HEADER_ROW) - { - cancelSorting(); - fireTableChanged(e); - return; - } - - // We can map a cell event through to the view without widening - // when the following conditions apply: - // - // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) - // and, - // b) all the changes are in one column (column != - // TableModelEvent.ALL_COLUMNS) and, - // c) we are not sorting on that column (getSortingStatus(column) == - // NOT_SORTED) and, - // d) a reverse lookup will not trigger a sort (modelToView != null) - // - // Note: INSERT and DELETE events fail this test as they have column == - // ALL_COLUMNS. - // - // The last check, for (modelToView != null) is to see if modelToView - // is already allocated. If we don't do this check; sorting can become - // a performance bottleneck for applications where cells - // change rapidly in different parts of the table. If cells - // change alternately in the sorting column and then outside of - // it this class can end up re-sorting on alternate cell updates - - // which can be a performance problem for large tables. The last - // clause avoids this problem. - int column = e.getColumn(); - if (e.getFirstRow() == e.getLastRow() - && column != TableModelEvent.ALL_COLUMNS - && getSortingStatus(column) == NOT_SORTED - && modelToView != null) - { - int viewIndex = getModelToView()[e.getFirstRow()]; - fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex, - viewIndex, column, e.getType())); - return; - } - - // Something has happened to the data that may have invalidated the row - // order. - clearSortingState(); - fireTableDataChanged(); - return; - } - } - - private class MouseHandler extends MouseAdapter - { - public void mouseClicked(MouseEvent e) - { - JTableHeader h = (JTableHeader) e.getSource(); - TableColumnModel columnModel = h.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = columnModel.getColumn(viewColumn).getModelIndex(); - if (column != -1) - { - int status = getSortingStatus(column); - if (!e.isControlDown()) - { - cancelSorting(); - } - // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} - // or - // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is - // pressed. - status = status + (e.isShiftDown() ? -1 : 1); - status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} - setSortingStatus(column, status); - } - } - } - - private static class Arrow implements Icon - { - private boolean descending; - - private int size; - - private int priority; - - public Arrow(boolean descending, int size, int priority) - { - this.descending = descending; - this.size = size; - this.priority = priority; - } - - public void paintIcon(Component c, Graphics g, int x, int y) - { - Color color = c == null ? Color.GRAY : c.getBackground(); - // In a compound sort, make each succesive triangle 20% - // smaller than the previous one. - int dx = (int) (size / 2 * Math.pow(0.8, priority)); - int dy = descending ? dx : -dx; - // Align icon (roughly) with font baseline. - y = y + 5 * size / 6 + (descending ? -dy : 0); - int shift = descending ? 1 : -1; - g.translate(x, y); - - // Right diagonal. - g.setColor(color.darker()); - g.drawLine(dx / 2, dy, 0, 0); - g.drawLine(dx / 2, dy + shift, 0, shift); - - // Left diagonal. - g.setColor(color.brighter()); - g.drawLine(dx / 2, dy, dx, 0); - g.drawLine(dx / 2, dy + shift, dx, shift); - - // Horizontal line. - if (descending) - { - g.setColor(color.darker().darker()); - } - else - { - g.setColor(color.brighter().brighter()); - } - g.drawLine(dx, 0, 0, 0); - - g.setColor(color); - g.translate(-x, -y); - } - - public int getIconWidth() - { - return size; - } - - public int getIconHeight() - { - return size; - } - } - - private class SortableHeaderRenderer implements TableCellRenderer - { - private TableCellRenderer tableCellRenderer; - - public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) - { - this.tableCellRenderer = tableCellRenderer; - } - - public Component getTableCellRendererComponent(JTable table, - Object value, boolean isSelected, boolean hasFocus, int row, - int column) - { - Component c = tableCellRenderer.getTableCellRendererComponent(table, - value, isSelected, hasFocus, row, column); - if (c instanceof JLabel) - { - JLabel l = (JLabel) c; - l.setHorizontalTextPosition(JLabel.LEFT); - int modelColumn = table.convertColumnIndexToModel(column); - l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize())); - } - return c; - } - } - - private static class Directive - { - private int column; - - private int direction; - - public Directive(int column, int direction) - { - this.column = column; - this.direction = direction; - } - } -} +/* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + */ +package jalview.util; + +import java.util.*; +import java.util.List; + +import java.awt.*; +import java.awt.event.*; +import javax.swing.*; +import javax.swing.event.*; +import javax.swing.table.*; + +/** + * TableSorter is a decorator for TableModels; adding sorting functionality to a + * supplied TableModel. TableSorter does not store or copy the data in its + * TableModel; instead it maintains a map from the row indexes of the view to + * the row indexes of the model. As requests are made of the sorter (like + * getValueAt(row, col)) they are passed to the underlying model after the row + * numbers have been translated via the internal mapping array. This way, the + * TableSorter appears to hold another copy of the table with the rows in a + * different order. + *

                + * TableSorter registers itself as a listener to the underlying model, just as + * the JTable itself would. Events recieved from the model are examined, + * sometimes manipulated (typically widened), and then passed on to the + * TableSorter's listeners (typically the JTable). If a change to the model has + * invalidated the order of TableSorter's rows, a note of this is made and the + * sorter will resort the rows the next time a value is requested. + *

                + * When the tableHeader property is set, either by using the setTableHeader() + * method or the two argument constructor, the table header may be used as a + * complete UI for TableSorter. The default renderer of the tableHeader is + * decorated with a renderer that indicates the sorting status of each column. + * In addition, a mouse listener is installed with the following behavior: + *

                  + *
                • Mouse-click: Clears the sorting status of all other columns and advances + * the sorting status of that column through three values: {NOT_SORTED, + * ASCENDING, DESCENDING} (then back to NOT_SORTED again). + *
                • SHIFT-mouse-click: Clears the sorting status of all other columns and + * cycles the sorting status of the column through the same three values, in the + * opposite order: {NOT_SORTED, DESCENDING, ASCENDING}. + *
                • CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except that + * the changes to the column do not cancel the statuses of columns that are + * already sorting - giving a way to initiate a compound sort. + *
                + *

                + * This is a long overdue rewrite of a class of the same name that first + * appeared in the swing table demos in 1997. + * + * @author Philip Milne + * @author Brendon McLean + * @author Dan van Enckevort + * @author Parwinder Sekhon + * @version 2.0 02/27/04 + */ + +public class TableSorter extends AbstractTableModel +{ + protected TableModel tableModel; + + public static final int DESCENDING = -1; + + public static final int NOT_SORTED = 0; + + public static final int ASCENDING = 1; + + private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED); + + public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() + { + public int compare(Object o1, Object o2) + { + return ((Comparable) o1).compareTo(o2); + } + }; + + public static final Comparator LEXICAL_COMPARATOR = new Comparator() + { + public int compare(Object o1, Object o2) + { + return o1.toString().compareTo(o2.toString()); + } + }; + + private Row[] viewToModel; + + private int[] modelToView; + + private JTableHeader tableHeader; + + private MouseListener mouseListener; + + private TableModelListener tableModelListener; + + private Map columnComparators = new HashMap(); + + private List sortingColumns = new ArrayList(); + + public TableSorter() + { + this.mouseListener = new MouseHandler(); + this.tableModelListener = new TableModelHandler(); + } + + public TableSorter(TableModel tableModel) + { + this(); + setTableModel(tableModel); + } + + public TableSorter(TableModel tableModel, JTableHeader tableHeader) + { + this(); + setTableHeader(tableHeader); + setTableModel(tableModel); + } + + private void clearSortingState() + { + viewToModel = null; + modelToView = null; + } + + public TableModel getTableModel() + { + return tableModel; + } + + public void setTableModel(TableModel tableModel) + { + if (this.tableModel != null) + { + this.tableModel.removeTableModelListener(tableModelListener); + } + + this.tableModel = tableModel; + if (this.tableModel != null) + { + this.tableModel.addTableModelListener(tableModelListener); + } + + clearSortingState(); + fireTableStructureChanged(); + } + + public JTableHeader getTableHeader() + { + return tableHeader; + } + + public void setTableHeader(JTableHeader tableHeader) + { + if (this.tableHeader != null) + { + this.tableHeader.removeMouseListener(mouseListener); + TableCellRenderer defaultRenderer = this.tableHeader + .getDefaultRenderer(); + if (defaultRenderer instanceof SortableHeaderRenderer) + { + this.tableHeader + .setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer); + } + } + this.tableHeader = tableHeader; + if (this.tableHeader != null) + { + this.tableHeader.addMouseListener(mouseListener); + this.tableHeader.setDefaultRenderer(new SortableHeaderRenderer( + this.tableHeader.getDefaultRenderer())); + } + } + + public boolean isSorting() + { + return sortingColumns.size() != 0; + } + + private Directive getDirective(int column) + { + for (int i = 0; i < sortingColumns.size(); i++) + { + Directive directive = (Directive) sortingColumns.get(i); + if (directive.column == column) + { + return directive; + } + } + return EMPTY_DIRECTIVE; + } + + public int getSortingStatus(int column) + { + return getDirective(column).direction; + } + + private void sortingStatusChanged() + { + clearSortingState(); + fireTableDataChanged(); + if (tableHeader != null) + { + tableHeader.repaint(); + } + } + + public void setSortingStatus(int column, int status) + { + Directive directive = getDirective(column); + if (directive != EMPTY_DIRECTIVE) + { + sortingColumns.remove(directive); + } + if (status != NOT_SORTED) + { + sortingColumns.add(new Directive(column, status)); + } + sortingStatusChanged(); + } + + protected Icon getHeaderRendererIcon(int column, int size) + { + Directive directive = getDirective(column); + if (directive == EMPTY_DIRECTIVE) + { + return null; + } + return new Arrow(directive.direction == DESCENDING, size, + sortingColumns.indexOf(directive)); + } + + private void cancelSorting() + { + sortingColumns.clear(); + sortingStatusChanged(); + } + + public void setColumnComparator(Class type, Comparator comparator) + { + if (comparator == null) + { + columnComparators.remove(type); + } + else + { + columnComparators.put(type, comparator); + } + } + + protected Comparator getComparator(int column) + { + Class columnType = tableModel.getColumnClass(column); + Comparator comparator = (Comparator) columnComparators.get(columnType); + if (comparator != null) + { + return comparator; + } + if (Comparable.class.isAssignableFrom(columnType)) + { + return COMPARABLE_COMAPRATOR; + } + return LEXICAL_COMPARATOR; + } + + private Row[] getViewToModel() + { + if (viewToModel == null) + { + int tableModelRowCount = tableModel.getRowCount(); + viewToModel = new Row[tableModelRowCount]; + for (int row = 0; row < tableModelRowCount; row++) + { + viewToModel[row] = new Row(row); + } + + if (isSorting()) + { + Arrays.sort(viewToModel); + } + } + return viewToModel; + } + + public int modelIndex(int viewIndex) + { + return getViewToModel()[viewIndex].modelIndex; + } + + private int[] getModelToView() + { + if (modelToView == null) + { + int n = getViewToModel().length; + modelToView = new int[n]; + for (int i = 0; i < n; i++) + { + modelToView[modelIndex(i)] = i; + } + } + return modelToView; + } + + // TableModel interface methods + + public int getRowCount() + { + return (tableModel == null) ? 0 : tableModel.getRowCount(); + } + + public int getColumnCount() + { + return (tableModel == null) ? 0 : tableModel.getColumnCount(); + } + + public String getColumnName(int column) + { + return tableModel.getColumnName(column); + } + + public Class getColumnClass(int column) + { + return tableModel.getColumnClass(column); + } + + public boolean isCellEditable(int row, int column) + { + return tableModel.isCellEditable(modelIndex(row), column); + } + + public Object getValueAt(int row, int column) + { + return tableModel.getValueAt(modelIndex(row), column); + } + + public void setValueAt(Object aValue, int row, int column) + { + tableModel.setValueAt(aValue, modelIndex(row), column); + } + + // Helper classes + + private class Row implements Comparable + { + private int modelIndex; + + public Row(int index) + { + this.modelIndex = index; + } + + public int compareTo(Object o) + { + int row1 = modelIndex; + int row2 = ((Row) o).modelIndex; + + for (Iterator it = sortingColumns.iterator(); it.hasNext();) + { + Directive directive = (Directive) it.next(); + int column = directive.column; + Object o1 = tableModel.getValueAt(row1, column); + Object o2 = tableModel.getValueAt(row2, column); + + int comparison = 0; + // Define null less than everything, except null. + if (o1 == null && o2 == null) + { + comparison = 0; + } + else if (o1 == null) + { + comparison = -1; + } + else if (o2 == null) + { + comparison = 1; + } + else + { + comparison = getComparator(column).compare(o1, o2); + } + if (comparison != 0) + { + return directive.direction == DESCENDING ? -comparison + : comparison; + } + } + return 0; + } + } + + private class TableModelHandler implements TableModelListener + { + public void tableChanged(TableModelEvent e) + { + // If we're not sorting by anything, just pass the event along. + if (!isSorting()) + { + clearSortingState(); + fireTableChanged(e); + return; + } + + // If the table structure has changed, cancel the sorting; the + // sorting columns may have been either moved or deleted from + // the model. + if (e.getFirstRow() == TableModelEvent.HEADER_ROW) + { + cancelSorting(); + fireTableChanged(e); + return; + } + + // We can map a cell event through to the view without widening + // when the following conditions apply: + // + // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) + // and, + // b) all the changes are in one column (column != + // TableModelEvent.ALL_COLUMNS) and, + // c) we are not sorting on that column (getSortingStatus(column) == + // NOT_SORTED) and, + // d) a reverse lookup will not trigger a sort (modelToView != null) + // + // Note: INSERT and DELETE events fail this test as they have column == + // ALL_COLUMNS. + // + // The last check, for (modelToView != null) is to see if modelToView + // is already allocated. If we don't do this check; sorting can become + // a performance bottleneck for applications where cells + // change rapidly in different parts of the table. If cells + // change alternately in the sorting column and then outside of + // it this class can end up re-sorting on alternate cell updates - + // which can be a performance problem for large tables. The last + // clause avoids this problem. + int column = e.getColumn(); + if (e.getFirstRow() == e.getLastRow() + && column != TableModelEvent.ALL_COLUMNS + && getSortingStatus(column) == NOT_SORTED + && modelToView != null) + { + int viewIndex = getModelToView()[e.getFirstRow()]; + fireTableChanged(new TableModelEvent(TableSorter.this, viewIndex, + viewIndex, column, e.getType())); + return; + } + + // Something has happened to the data that may have invalidated the row + // order. + clearSortingState(); + fireTableDataChanged(); + return; + } + } + + private class MouseHandler extends MouseAdapter + { + public void mouseClicked(MouseEvent e) + { + JTableHeader h = (JTableHeader) e.getSource(); + TableColumnModel columnModel = h.getColumnModel(); + int viewColumn = columnModel.getColumnIndexAtX(e.getX()); + int column = columnModel.getColumn(viewColumn).getModelIndex(); + if (column != -1) + { + int status = getSortingStatus(column); + if (!e.isControlDown()) + { + cancelSorting(); + } + // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} + // or + // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is + // pressed. + status = status + (e.isShiftDown() ? -1 : 1); + status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} + setSortingStatus(column, status); + } + } + } + + private static class Arrow implements Icon + { + private boolean descending; + + private int size; + + private int priority; + + public Arrow(boolean descending, int size, int priority) + { + this.descending = descending; + this.size = size; + this.priority = priority; + } + + public void paintIcon(Component c, Graphics g, int x, int y) + { + Color color = c == null ? Color.GRAY : c.getBackground(); + // In a compound sort, make each succesive triangle 20% + // smaller than the previous one. + int dx = (int) (size / 2 * Math.pow(0.8, priority)); + int dy = descending ? dx : -dx; + // Align icon (roughly) with font baseline. + y = y + 5 * size / 6 + (descending ? -dy : 0); + int shift = descending ? 1 : -1; + g.translate(x, y); + + // Right diagonal. + g.setColor(color.darker()); + g.drawLine(dx / 2, dy, 0, 0); + g.drawLine(dx / 2, dy + shift, 0, shift); + + // Left diagonal. + g.setColor(color.brighter()); + g.drawLine(dx / 2, dy, dx, 0); + g.drawLine(dx / 2, dy + shift, dx, shift); + + // Horizontal line. + if (descending) + { + g.setColor(color.darker().darker()); + } + else + { + g.setColor(color.brighter().brighter()); + } + g.drawLine(dx, 0, 0, 0); + + g.setColor(color); + g.translate(-x, -y); + } + + public int getIconWidth() + { + return size; + } + + public int getIconHeight() + { + return size; + } + } + + private class SortableHeaderRenderer implements TableCellRenderer + { + private TableCellRenderer tableCellRenderer; + + public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) + { + this.tableCellRenderer = tableCellRenderer; + } + + public Component getTableCellRendererComponent(JTable table, + Object value, boolean isSelected, boolean hasFocus, int row, + int column) + { + Component c = tableCellRenderer.getTableCellRendererComponent(table, + value, isSelected, hasFocus, row, column); + if (c instanceof JLabel) + { + JLabel l = (JLabel) c; + l.setHorizontalTextPosition(JLabel.LEFT); + int modelColumn = table.convertColumnIndexToModel(column); + l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize())); + } + return c; + } + } + + private static class Directive + { + private int column; + + private int direction; + + public Directive(int column, int direction) + { + this.column = column; + this.direction = direction; + } + } +} diff --git a/src/jalview/util/UrlLink.java b/src/jalview/util/UrlLink.java index 007b502..e955a6f 100644 --- a/src/jalview/util/UrlLink.java +++ b/src/jalview/util/UrlLink.java @@ -1,398 +1,398 @@ -/* - * 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 . - */ -package jalview.util; - -import java.util.Vector; - -public class UrlLink -{ - /** - * helper class to parse URL Link strings taken from applet parameters or - * jalview properties file using the com.stevesoft.pat.Regex implementation. - * Jalview 2.4 extension allows regular expressions to be used to parse ID - * strings and replace the result in the URL. Regex's operate on the whole ID - * string given to the matchURL method, if no regex is supplied, then only - * text following the first pipe symbol will be susbstituted. Usage - * documentation todo. - */ - private String url_suffix, url_prefix, target, label, regexReplace; - - private boolean dynamic = false; - - private String invalidMessage = null; - - /** - * parse the given linkString of the form '