<classpathentry kind="lib" path="lib/miglayout-4.0-swing.jar"/>
<classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
- <classpathentry kind="lib" path="lib/jdas-1.0.4.jar"/>
<classpathentry kind="lib" path="lib/spring-core-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/spring-web-3.0.5.RELEASE.jar"/>
<classpathentry kind="lib" path="lib/jabaws-min-client-2.2.0.jar" sourcepath="/clustengine"/>
.project
/dist
+/clover
/classes
/tests
/test-reports
TESTNG
/jalviewApplet.jar
/benchmarking/lib
-*.class
\ No newline at end of file
+*.class
+/site
+
-jalview.release=releases/Release_2_10_4_Branch
-jalview.version=2.10.4b1
+jalview.release=releases/Release_2_11_Branch
+jalview.version=2.11.0
httpcore-4.0.1.jar
httpmime-4.0.3.jar
jaxrpc.jar
-jdas-1.0.4.jar : Apache License - built from http://code.google.com/p/jdas/ (29th Feb 2012)
jhall.jar
jswingreader-0.3.jar : Apache license - built from http://jswingreader.sourceforge.net/ svn/trunk v12
log4j-1.2.8.jar
min-jaba-client.jar
regex.jar
saaj.jar
-spring-core-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven
-spring-web-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven
+spring-core-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven - TODO: JAL-3035 remove if no longer needed ?
+spring-web-3.0.5.RELEASE.jar : Apache License: jdas runtime dependencies retrieved via maven - TODO: JAL-3035 remove if no longer needed ?
vamsas-client.jar
wsdl4j.jar
xercesImpl.jar
<project name="jalviewX" default="usage" basedir="."
xmlns:if="ant:if"
xmlns:unless="ant:unless">
+ <taskdef classpath="${clover.jar}" resource="cloverlib.xml" if:set="clover.jar"/>
+ <clover-env if:set="clover.jar"/>
+
<target name="help" depends="usage" />
<target name="usage" depends="init">
<echo message="~~~Jalview Ant build.xml Usage~~~~" />
<echo message="See docs/building.html and the comments in build file for other targets." />
<echo message="note: compile and makeApplet optionally compile/obfuscate applet against a different Java version by specifying -Djava118.home=PathtoJDK/lib which is the lib directory in the JDK install that contains rt.jar " />
<echo message="Useful -D flags: -Ddonotobfuscate will prevent applet obfuscation" />
+ <echo message="Useful -D flags: -Dclover.jar to specify path to openclover for testng coverage report" />
</target>
<property name="docDir" value="doc" />
<property name="sourceDir" value="src" />
<property name="schemaDir" value="schemas" />
- <property name="outputDir" value="classes" />
+ <property name="outputDir" value="classes" unless:set="clover.jar"/>
+ <property name="outputDir" value="cloverclasses" if:set="clover.jar"/>
<property name="packageDir" value="dist" />
<property name="outputJar" value="jalview.jar" />
<!-- Jalview Applet JMol Jar Dependency -->
verbose="2">
<classpath>
<pathelement location="${testOutputDir}" />
+ <pathelement location="${clover.jar}" if:set="clover.jar"/>
<path refid="test.classpath" />
</classpath>
<jvmarg value="--add-modules=java.se.ee" if:set="java9"/>
</target>
<target name="makedist" depends="build, buildPropertiesFile, linkcheck, buildindices">
+ <fail if="clover.jar">
+ Ignoring request to build jalview distribution with clover-instrumented classes
+ </fail>
<!-- make the package jar if not already existing -->
<mkdir dir="${packageDir}" />
<!-- clean dir if it already existed -->
<mapID target="annotations.fileformat" url="html/features/annotationsFormat.html"/>
<mapID target="features.fileformat" url="html/features/featuresFormat.html"/>
<mapID target="features.featureschemes" url="html/features/featureschemes.html"/>
- <mapID target="das.settings" url="html/features/dassettings.html"/>
- <mapID target="das.viewing" url="html/features/dasfeatures.html"/>
<mapID target="edit" url="html/editing/index.html"/>
<mapID target="jalarchive" url="html/features/jalarchive.html"/>
<mapID target="multipleviews" url="html/features/multipleViews.html"/>
<mapID target="alwCalc" url="html/menus/alwcalculate.html"/>
<mapID target="wsMenu" url="html/menus/wsmenu.html"/>
- <mapID target="alwHmmer" url="html/menus/alwhmmer.html"/>
<mapID target="popMenu" url="html/menus/popupMenu.html"/>
<mapID target="popMenuAddref" url="html/menus/popupMenu.html#addrefannot"/>
<mapID target="annotPanelMenu" url="html/menus/alwannotationpanel.html"/>
<tocitem text="Feature Colourschemes" target="features.featureschemes" />
<tocitem text="User Defined Sequence Features" target="seqfeatcreat" />
<tocitem text="Editing Sequence Features" target="seqfeatedit" />
- <tocitem text="DAS Feature Retrieval" target="das.viewing" />
- <tocitem text="DAS Feature Settings" target="das.settings" />
<tocitem text="HTML annotation report" target="io.seqreport" />
</tocitem>
<tocitem text="Alignment Conservation Analysis" target="aacon" />
<tocitem text="Multi-Harmony Alignment Analysis" target="shmrws" />
<tocitem text="Sequence Retrieval" target="seqfetch" />
- <tocitem text="Database Reference Retrieval" target="dbreffetcher" />
- <tocitem text="DAS Feature Retrieval" target="das.viewing" />
+ <tocitem text="Database Reference Retrieval" target="dbreffetcher" />
</tocitem>
<tocitem text="Colour Schemes" target="colours" expand="false">
<tocitem text="Colour Menu" target="alwColour" />
<tocitem text="Calculate Menu" target="alwCalc" />
<tocitem text="Web Service Menu" target="wsMenu" />
- <tocitem text="HMMER Menu" target="alwHmmer" />
<tocitem text="Annotation Panel Menu" target="annotPanelMenu" />
<tocitem text="Popup Menu" target="popMenu" />
</tocitem>
<em>Undo / redo</em> - editing of sequences (insertion/removal of
gaps, removal of sequences, trimming sequences etc) may be undone or
redone at any time using the appropriate menu items from the edit
- menu. The undo history list only allows a maximum of 10 actions.
+ menu.
<p>
<em>Trimming alignment</em> - First select a column by clicking the
scale indicator (above the sequences) The alignment may then be
</tr>
<tr>
<td>
- <div align="center">-dasserver nickname=URL</div>
- <td>
- <div align="left">
- Add and enable a <a href="dassettings.html">DAS server</a>
- with given nickname (alphanumeric or underscores only) for
- retrieval of features for all alignments<br> Sources that
- also support the sequence command may be specified by
- prepending the URL with 'sequence:'<br> <em>e.g.</em>
- sequence:http://localdas.somewhere.org/das/source
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <div align="center">-fetchfrom nickname</div>
- <td>
- <div align="left">
- Query a <a href="dassettings.html">DAS source</a> called
- nickname for features for the alignments and display them
- </div>
- </td>
- </tr>
- <tr>
- <td>
<div align="center">-groovy FILE/URL</div>
<td>
<div align="left">Execute groovy script in FILE (where
sequence alignments and EPS files.
</li>
<li>The <a href="#editing"><strong>"Editing"</strong>
- Preferences</a> tab contains settings affecting the behaviour of alignments as you edit them.
- </li>
- <li>The <a href="#hmmer"><strong>"HMMER"</strong>
- Preferences</a> tab allows you to configure locally installed HMMER tools.
- </li>
- <li>The <a href="dassettings.html"><strong>"DAS
- Settings"</strong> Preferences</a> tab allows you to select which DAS
- sources to use when fetching DAS Features.
+ Preferences</a> tab contains settings affecting the export of
+ sequence alignments and EPS files.
</li>
<li>The <a href="../webServices/webServicesPrefs.html"><strong>"Web
Service"</strong> Preferences</a> tab allows you to configure the <a
<em>Sort with New Tree</em> - When selected, any trees calculated or
loaded onto the alignment will automatically sort the alignment.
</p>
- <p>
- <a name="hmmer"><strong>"HMMER" Preferences tab</strong></a>
- </p>
- <p>If you have installed HMMER tools (available from <a href="http://hmmerorg">hmmer.org</a>),
- then you should specify on this screen the location of the installation (the path to the folder
- containing binary executable programs). Double-click in the input field to open a file browser.</p>
- <p>When this path is configured, the <a href="../menus/alwhmmer.html">HMMER menu</a> will be
- enabled in the Alignment window.</p>
+ <p> </p>
+ <p> </p>
</body>
</html>
<p>The search history keeps up to 99 queries by default. To clear
the history, or modify the size of the history, right-click the text
box.</p>
- <img src="searchclearhist.png" width="402" height="121" align="left" />
+ <img src="searchclearhist.png" width="402" height="127" align="left" />
<p>
<strong>Other dialogs that provide a query history</strong>
</p>
href="featuresettings.html">Sequence Feature Settings</a>
dialog box. Feature colour schemes and display parameters are unique
to a particular alignment, so it is possible to colour the same
- sequence features differently in different alignment views.<br>
- Since Jalview 2.1, it is possible to add <a href="dassettings.html">DAS
- features</a> to an alignment via the DAS tabbed pane of the feature
- settings window.
+ sequence features differently in different alignment views.
</p>
<p>
<strong>View→Sequence ID Tooltip→Show
<p>
<strong>Sequence Fetcher</strong>
</p>
- <p>
- Jalview can retrieve sequences from certain databases using either
- the DBFetch service provided by the EMBL European Bioinformatics
- Institute, or, since Jalview 2.4, DAS servers capable of the <em>sequence</em>
- command (configured in <a href="dassettings.html">DAS settings</a>).
- </p>
- <p>The Sequence Fetcher can be opened via the "File"
+ <p>Jalview can retrieve sequences from a range of sequence, 3D
+ structure, genomic and domain family databases provided by EMBL-EBI.</p>
+ <p>The Sequence Fetcher can be opened via the "File"
menu on the main desktop in order to retrieve sequences as a new
alignment, or opened via the "File" menu of an existing
alignment to import additional sequences. There may be a short delay
- when the sequence fetcher is first opened, whilst Jalview compiles
- the list of available sequence datasources from the currently
- defined DAS server registry.</p>
+ when the sequence fetcher is first opened, whilst Jalview contacts each database's web API.</p>
<p>
Every time a new fetcher is opened, you will need to <strong>select
the database you want to retrieve sequences</strong> from the database
tooltips are shown if you mouse over some sources, explaining what
the database will retrieve. You can select one by using the up/down
arrow keys and hitting return, or by double clicking with the mouse.
- <br />
- <em>If you have DAS sources enabled, then you may have several
- sources for the same type of sequence identifier, and these will
- be grouped together in a sub-branch branch labeled with the
- identifier.</em>
</p>
<p>Once you have selected a sequence database, its fetcher dialog
will open. Jalview provides two types of dialog:</p>
currently selected database into the retrieval box. Finally, press
"OK" to initiate the retrieval.</li>
</ol>
- <p>
- <strong>Only retrieving part of a sequence</strong>
- </p>
- <p>
- When using DAS sources (indicated by a "<em>(DAS)</em>"),
- you can append a range in addition to a sequence ID. For example, to
- retrieve 50 residues starting at position 35 in UNIPROT sequence
- P73137 using the UNIPROT DAS server, you would enter
- "'P73137:35,84'.<br /> <em>Full support for DAS range
- queries was introduced in Jalview 2.8</em>
- </p>
<p>If you use the WSDBFetch sequence fetcher services (EMBL,
UniProt, PFAM, and RFAM) in work for publication, please cite:</p>
href="../features/featuresettings.html">Sequence
Feature Settings...</a> </strong><br> <em>Opens the
Sequence Feature Settings dialog box to control the colour
- and display of sequence features on the alignment, and
- configure and retrieve features from DAS annotation
- servers.</em></li>
+ and display of sequence features on the alignment.</em></li>
<li><strong>Sequence ID Tooltip</strong><em>
(application only) <br>This submenu's options allow the
inclusion or exclusion of non-positional sequence features
is dynamic, and may contain user-defined web service entries in
addition to any of the following ones:</em>
<ul>
- <li><strong>Fetch DB References</strong><br> <em>This
- submenu contains options for accessing any of the database
- services that Jalview is aware of (e.g. DAS sequence servers
- and the WSDBFetch service provided by the EBI) to verify
- sequence start/end positions and retrieve all database cross
- references and PDB ids associated with all or just the
- selected sequences in the alignment.
- <ul>
- <li>'Trim Retrieved Sequences' - when checked, Jalview
- will discard any additional sequence data for accessions
- associated with sequences in the alignment. <br> <strong>Note:
- Disabling this could cause out of memory errors when
- working with genomic sequence records !</strong><br> <strong>Added
- in Jalview 2.8.1</strong>
- </li>
- <li>'Standard Databases' will check sequences against
- the EBI databases plus any active DAS sequence sources</li>
- </ul> Other sub-menus allow you to pick a specific source to query
- - sources are listed alphabetically according to their
- nickname.
- </em><br></li>
- </ul>
+ <li><strong>Fetch DB References</strong><br> <em>This
+ submenu contains options for accessing any of the database
+ services that Jalview is aware of (e.g. those provided by
+ EMBL-EBI) to verify sequence start/end positions and retrieve all
+ database cross references and PDB ids associated with all or just
+ the selected sequences in the alignment.
+ <ul>
+ <li>'Trim Retrieved Sequences' - when checked, Jalview will
+ discard any additional sequence data for accessions associated
+ with sequences in the alignment. <br> <strong>Note:
+ Disabling this could cause out of memory errors when working
+ with genomic sequence records !</strong><br> <strong>Added
+ in Jalview 2.8.1</strong>
+ </li>
+ <li>'Standard Databases' will check sequences against the
+ EBI databases.</li>
+ </ul> Other sub-menus allow you to pick a specific source to query -
+ sources are listed alphabetically according to their nickname.
+ </em><br></li>
+ </ul>
<p>Selecting items from the following submenus will start a
remote service on compute facilities at the University of Dundee,
or elsewhere. You need a continuous network connection in order to
<li><strong><a href="../features/featuresettings.html">Sequence
Feature Settings...</a></strong><em><br> Opens the Sequence
Feature Settings dialog box to control the colour and display of
- sequence features on the alignment, and configure and retrieve
- features from DAS annotation servers.</em></li>
+ sequence features on the alignment.</em></li>
<li><strong>Sequence ID Tooltip</strong><em> (application
only) <br>This submenu's options allow the inclusion or
exclusion of non-positional sequence features or database cross
dynamic, and may contain user-defined web service entries in
addition to any of the following ones:</em>
<ul>
- <li><strong>Fetch DB References</strong><br> <em>This
- submenu contains options for accessing any of the database
- services that Jalview is aware of (e.g. DAS sequence servers and
- the WSDBFetch service provided by the EBI) to verify sequence
- start/end positions and retrieve all database cross references
- and PDB ids associated with all or just the selected sequences
- in the alignment.
- <ul>
+ <li><strong>Fetch DB References</strong><br> <em>This submenu
+ contains options for accessing any of the database services that
+ Jalview is aware of (e.g services provided by the EBI) to verify
+ sequence start/end positions and retrieve all database cross
+ references and PDB ids associated with all or just the selected
+ sequences in the alignment.
+ <ul>
<li>'Retrieve full Sequence' - when checked, Jalview will
retrieve the full sequence for any accessions associated
with sequences in the alignment. <br> <strong>Note:
in Jalview 2.8.1</strong>
</li>
<li>'Standard Databases' will check sequences against the
- EBI databases plus any active DAS sequence sources<</li>
+ EBI databases</li>
</ul> Other submenus allow you to pick a specific source to query -
sources are listed alphabetically according to their nickname.
</em></li>
</div>
</td>
</tr>
+
+ <td width="60" nowrap>
+ <div align="center">
+ <strong><a name="Jalview.2.11.0">2.11.0</a><br />
+ <em>8/09/2018</em></strong>
+ </div>
+ </td>
+ <td><div align="left">
+ <em></em>
+ <ul>
+ <li>
+ <!-- -->
+ </li>
+ </ul>
+ </div></td>
+ <td><div align="left">
+ <em></em>
+ <ul>
+ <li>
+ <!-- JAL-3035 -->DAS sequence retrieval and annotation capabilities removed from the Jalview Desktop
+ </li>
+ </ul>
+ </div></td>
+ </tr>
<tr>
<td width="60" nowrap>
<div align="center">
ID, and can be viewed in full via the
<a href="../io/exportseqreport.html">Sequence Details</a> window. .
Jalview also uses references for the retrieval of
- <a href="../features/viewingpdbs.html">PDB structures</a> and <a
- href="../features/dasfeatures.html">DAS features</a>, and for
+ <a href="../features/viewingpdbs.html">PDB structures</a>, and for
retrieving sequence cross-references such as the protein products of a
DNA sequence.
</p>
application provides three ways to access the retrieval function.
Either:
<ul>
- <li>select the <strong>Discover PDB IDs</strong> option from the
- structure submenu of the sequence's popup menu
- </li>
- <li>Choose one of the options from the 'Fetch DB Refs' submenu in
+ <li>select the <strong>Structure Chooser...</strong> option from
+ the Sequence ID popup menu.
+ </li>
+ <li>Choose one of the options from the 'Fetch DB Refs' submenu in
the alignment window's <strong>Web Services</strong> menu:
<ul>
- <li><em>Standard Databases</em> will fetch references from
- the EBI databases plus currently selected DAS sources</li>
- <li>The other entries submenus leading to lists of individual
+ <li><em>Standard Databases</em> will fetch references from EBI
+ databases appropriate for the sequence type (Nucleotide or Protein)</li>
+ <li>The other entries submenus leading to lists of individual
database sources that Jalview can access.</li>
</ul>
</li>
- <li>Answer 'Yes' when asked if you wish to retrieve database
- references for your sequences after initiating a DAS Sequence
- Feature fetch.</li>
</ul>
<p>Jalview discovers references for a sequence by generating a set
of ID queries from the ID string of each sequence in the alignment. It
Institute (EBI) and Distributed Annotation System servers that are
capable of serving sequences.
</li>
- <li>The <a href="../features/dasfeatures.html">DAS Feature
- Fetcher</a> enables the retrieval and visualization of features from
- DAS annotation sources
- </li>
- <li>The <a href="dbreffetcher.html">Database Reference
- Fetcher</a> transfers database references from records available
- from DAS or the public sequence databases.
- </li>
- <li>The <strong>Web Services</strong> menu in each alignment
+ <li>The <a href="dbreffetcher.html">Database Reference
+ Fetcher</a> transfers database references and annotation from the public
+ sequence databases.
+ </li>
+ <li>The <strong>Web Services</strong> menu in each alignment
window also provides access to the following:
<ul>
<li>Programs for <a href="msaclient.html">multiple
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
-<!--
+
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
action.show_html_source = Show HTML Source
action.print = Print...
action.web_service = Web Service
-action.hmmer = HMMER
action.cancel_job = Cancel Job
action.start_job = Start Job
action.revert = Revert
label.colourScheme_nucleotide = Nucleotide
label.colourScheme_t-coffee_scores = T-Coffee Scores
label.colourScheme_rna_helices = By RNA Helices
-label.colourScheme_hmmer-uniprot = HMMER profile v global background
-label.colourScheme_hmmer-alignment = HMMER profile v alignment background
label.blc = BLC
label.fasta = Fasta
label.msf = MSF
label.feature_settings_click_drag = Drag up or down to change render order.<br/>Double click to select columns containing feature.
label.transparency_tip = Adjust transparency to 'see through' feature colours.
label.opt_and_params_further_details = see further details by right-clicking
-label.opt_and_params_show_brief_desc_image_link = Click to show brief description<br><img src="{0}"/> Right click for further information.
-label.opt_and_params_show_brief_desc = Click to show brief description<br>
+label.opt_and_params_show_brief_desc_image_link = <html>Click to show brief description<br><img src="{0}"/> Right click for further information.</html>
+label.opt_and_params_show_brief_desc = <html>Click to show brief description<br></html>
label.adjusts_width_generated_eps_png = <html>Adjusts the width of the generated EPS or PNG file to ensure even the longest sequence ID or annotation label is displayed</html>
label.manually_specify_width_left_column = <html>Manually specify the width of the left hand column where sequence IDs and annotation labels will be rendered in exported alignment figures. This setting will be ignored if 'Automatically set ID width' is set</html>
label.job_created_when_checked = <html>When checked, a job is created for every sequence in the current selection.</html>
label.save_alignment_to_file = Save Alignment to file
label.save_features_to_file = Save Features to File
label.save_annotation_to_file = Save Annotation to File
+label.no_features_on_alignment = No features found on alignment
label.save_pdb_file = Save PDB File
label.save_text_to_file = Save Text to File
label.save_state = Save State
label.couldnt_create_groovy_shell = Couldn't create the groovy Shell. Check the error log for the details of what went wrong.
error.unsupported_version_calcIdparam = Unsupported Version for calcIdparam {0}
error.implementation_error_cant_reorder_tree = Implementation Error: Can't reorder this tree. Not DefaultMutableTreeNode.
+error.invalid_value_for_option = Invalid value {0} for option {1}
error.implementation_error_cannot_import_vamsas_doc = Implementation Error - cannot import existing vamsas document into an existing session, Yet!
label.vamsas_doc_couldnt_be_opened_as_new_session = VAMSAS Document could not be opened as a new session - please choose another
error.implementation_error_vamsas_operation_not_init = Impementation error! Vamsas Operations when client not initialised and connected
status.searching_for_pdb_structures = Searching for PDB Structures
status.opening_file_for = opening file for
status.colouring_chimera = Colouring Chimera
-status.running_hmmbuild = Building Hidden Markov Model
-status.running_hmmalign = Creating alignment with Hidden Markov Model
-status.running_hmmsearch = Searching for matching sequences
label.font_doesnt_have_letters_defined = Font doesn't have letters defined\nso cannot be used\nwith alignment data
label.font_too_small = Font size is too small
label.error_loading_file_params = Error loading file {0}
label.most_polymer_residues = Most Polymer Residues
label.cached_structures = Cached Structures
label.free_text_search = Free Text Search
-label.hmmalign = hmmalign
-label.use_hmm = HMM profile to use
-label.hmmbuild = hmmbuild
-label.hmmsearch = hmmsearch
-label.installation = Installation
-label.hmmer_location = HMMER Binaries Installation Location
-label.cygwin_location = Cygwin Binaries Installation Location (Windows)
-label.information_annotation = Information Annotation
-label.ignore_below_background_frequency = Ignore Below Background Frequency
-label.information_description = Information content, measured in bits
-warn.no_hmm = No Hidden Markov model found.\nRun hmmbuild or load an HMM file first.
-label.no_sequences_found = No matching sequences, or an error occurred.
-label.hmmer = HMMER
-label.trim_termini = Trim Non-Matching Termini
-label.trim_termini_desc = If true, non-matching regions on either end of the resulting alignment are removed.
-label.no_of_sequences = Number of sequences returned
-label.reporting_cutoff = Reporting Cut-off
-label.freq_alignment = Use alignment background frequencies
-label.freq_uniprot = Use Uniprot background frequencies
-label.hmmalign_options = hmmalign options
-label.hmmsearch_options = hmmsearch options
-label.executable_not_found = The ''{0}'' executable file was not found
-warn.command_failed = {0} failed
-label.invalid_folder = Invalid Folder
-label.number_of_results = Number of Results to Return
-label.auto_align_seqs = Automatically Align Fetched Sequences
-label.use_accessions = Return Accessions
-label.seq_evalue = Sequence E-value Cut-off
-label.seq_score = Sequence Score Threshold
-label.dom_evalue = Domain E-value Cut-off
-label.dom_score = Domain Score Threshold
-label.number_of_results_desc = The maximum number of hmmsearch results to display
-label.auto_align_seqs_desc = If true, all fetched sequences will be aligned to the hidden Markov model with which the search was performed
-label.use_accessions_desc = If true, the accession number of each sequence is returned, rather than that sequence's name
-label.seq_e_value_desc = The E-value cutoff for returned sequences (hmmsearch -E)
-label.seq_score_desc = The score threshold for returned sequences (hmmsearch -T)
-label.dom_e_value_desc = The E-value cutoff for returned domains (hmmsearch --domE)
-label.dom_score_desc = The score threshold for returned domains (hmmsearch --domT)
-label.add_database = Add Database
-label.this_alignment = This alignment
-warn.invalid_format = This is not a valid database file format. The current supported formats are Fasta, Stockholm and Pfam.
-label.database_for_hmmsearch = The database hmmsearch will search through
-label.use_reference = Use Reference Annotation
-label.use_reference_desc = If true, hmmbuild will keep all columns defined as a reference position by the reference annotation
-label.hmm_name = Alignment HMM Name
-label.hmm_name_desc = The name given to the HMM for the alignment
-warn.no_reference_annotation = No reference annotation found
-label.hmmbuild_for = Build HMM for
-label.hmmbuild_for_desc = Build an HMM for the selected sets of sequences
-label.alignment = Alignment
-label.groups_and_alignment = All groups and alignment
-label.groups = All groups
-label.selected_group = Selected group
-label.use_info_for_height = Use Information Content as Letter Height
-action.search = Search
\ No newline at end of file
label.save_alignment_to_file = Guardar Alineamiento en fichero
label.save_features_to_file = Guardar CaracterÃsticas en un fichero
label.save_annotation_to_file = Guardar Anotación en un fichero
+label.no_features_on_alignment = No se han encontrado caracterÃsticas en el alineamiento
label.save_pdb_file = Guardar fichero PDB
label.save_text_to_file = Guardar Texto en un fichero
label.save_state = Guardar estado
label.couldnt_create_groovy_shell = No es posible crear el shell de Groovy. Compruebe el fichero de log para conocer los detalles.
error.unsupported_version_calcIdparam = Versión no soportada de {0}
error.implementation_error_cant_reorder_tree = Error de implementación: no es posible reordenar este árbol. No DefaultMutableTreeNode.
+error.invalid_value_for_option = Valor no válido de {0} para la opción {1}
error.implementation_error_cannot_import_vamsas_doc = Error de implementación - todavÃa no es posible importar el documento VAMSAS existente en una sesión existente.
label.vamsas_doc_couldnt_be_opened_as_new_session = El documento VAMSAS no ha podido abrirse como una nueva sesión. Por favor, escoja otra.
error.implementation_error_vamsas_operation_not_init = ¡Error de implementación! Operaciones VAMSAS cuando el cliente no estaba inicializado ni conectado
label.most_polymer_residues = Más Residuos de PolÃmeros
label.cached_structures = Estructuras en Caché
label.free_text_search = Búsqueda de texto libre
-action.search = Buscar
\ No newline at end of file
</xs:attribute>
</xs:complexType>
</xs:element>
- <xs:element name="hmmerProfile" minOccurs="0" type="xs:string">
- <xs:annotation>
- <xs:documentation>name of the project jar entry that holds the HMM file with the profile for the sequence</xs:documentation>
- </xs:annotation>
- </xs:element>
</xs:sequence>
<xs:attribute name="colour" type="xs:int" use="optional" />
<xs:attribute name="start" type="xs:int" use="required" />
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
this.structureManager = structureManager;
chimera = null;
chimeraListenerThread = null;
- currentModelsMap = new HashMap<Integer, ChimeraModel>();
+ currentModelsMap = new HashMap<>();
}
public List<ChimeraModel> getChimeraModels(String modelName,
ModelType modelType)
{
- List<ChimeraModel> models = new ArrayList<ChimeraModel>();
+ List<ChimeraModel> models = new ArrayList<>();
for (ChimeraModel model : currentModelsMap.values())
{
if (modelName.equals(model.getModelName())
public Map<String, List<ChimeraModel>> getChimeraModelsMap()
{
- Map<String, List<ChimeraModel>> models = new HashMap<String, List<ChimeraModel>>();
+ Map<String, List<ChimeraModel>> models = new HashMap<>();
for (ChimeraModel model : currentModelsMap.values())
{
String modelName = model.getModelName();
public Map<Integer, ChimeraModel> getSelectedModels()
{
- Map<Integer, ChimeraModel> selectedModelsMap = new HashMap<Integer, ChimeraModel>();
+ Map<Integer, ChimeraModel> selectedModelsMap = new HashMap<>();
List<String> chimeraReply = sendChimeraCommand(
"list selection level molecule", true);
if (chimeraReply != null)
*/
public List<String> getSelectedResidueSpecs()
{
- List<String> selectedResidues = new ArrayList<String>();
+ List<String> selectedResidues = new ArrayList<>();
List<String> chimeraReply = sendChimeraCommand(
"list selection level residue", true);
if (chimeraReply != null)
// TODO: [Optional] Handle smiles names in a better way in Chimera?
public List<ChimeraModel> getModelList()
{
- List<ChimeraModel> modelList = new ArrayList<ChimeraModel>();
+ List<ChimeraModel> modelList = new ArrayList<>();
List<String> list = sendChimeraCommand("list models type molecule",
true);
if (list != null)
*/
public List<String> getPresets()
{
- ArrayList<String> presetList = new ArrayList<String>();
+ ArrayList<String> presetList = new ArrayList<>();
List<String> output = sendChimeraCommand("preset list", true);
if (output != null)
{
// iterate over possible paths for starting Chimera
for (String chimeraPath : chimeraPaths)
{
- File path = new File(chimeraPath);
- // uncomment the next line to simulate Chimera not installed
- // path = new File(chimeraPath + "x");
- if (!path.canExecute())
- {
- error += "File '" + path + "' does not exist.\n";
- continue;
- }
try
{
- List<String> args = new ArrayList<String>();
+ // ensure symbolic links are resolved
+ chimeraPath = Paths.get(chimeraPath).toRealPath().toString();
+ File path = new File(chimeraPath);
+ // uncomment the next line to simulate Chimera not installed
+ // path = new File(chimeraPath + "x");
+ if (!path.canExecute())
+ {
+ error += "File '" + path + "' does not exist.\n";
+ continue;
+ }
+ List<String> args = new ArrayList<>();
args.add(chimeraPath);
// shows Chimera output window but suppresses REST responses:
// args.add("--debug");
break;
} catch (Exception e)
{
- // Chimera could not be started
+ // Chimera could not be started using this path
error += e.getMessage();
}
}
public List<String> getAttrList()
{
- List<String> attributes = new ArrayList<String>();
+ List<String> attributes = new ArrayList<>();
final List<String> reply = sendChimeraCommand("list resattr", true);
if (reply != null)
{
public Map<ChimeraResidue, Object> getAttrValues(String aCommand,
ChimeraModel model)
{
- Map<ChimeraResidue, Object> values = new HashMap<ChimeraResidue, Object>();
+ Map<ChimeraResidue, Object> values = new HashMap<>();
final List<String> reply = sendChimeraCommand("list residue spec "
+ model.toSpec() + " attribute " + aCommand, true);
if (reply != null)
protected List<String> sendRestCommand(String command)
{
String restUrl = "http://127.0.0.1:" + this.chimeraRestPort + "/run";
- List<NameValuePair> commands = new ArrayList<NameValuePair>(1);
+ List<NameValuePair> commands = new ArrayList<>(1);
commands.add(new BasicNameValuePair("command", command));
- List<String> reply = new ArrayList<String>();
+ List<String> reply = new ArrayList<>();
BufferedReader response = null;
try
{
import jalview.bin.Cache;
import jalview.gui.Preferences;
-import jalview.util.FileUtils;
import java.io.File;
import java.io.IOException;
}
else if (os.startsWith("Windows"))
{
- /*
- * typical Windows installation path is
- * C:\Program Files\Chimera 1.12\bin\chimera.exe
- */
- // current drive:
- pathList.addAll(FileUtils.findMatches("\\",
- "Program Files*/Chimera*/bin/{chimera,chimera.exe}"));
- // C: drive (note may add as duplicates)
- pathList.addAll(FileUtils.findMatches("C:\\",
- "Program Files*/Chimera*/bin/{chimera,chimera.exe}"));
+ for (String root : new String[] { "\\Program Files",
+ "C:\\Program Files", "\\Program Files (x86)",
+ "C:\\Program Files (x86)" })
+ {
+ for (String version : new String[] { "1.11", "1.11.1", "1.11.2",
+ "1.12", "1.12.1", "1.12.2", "1.13" })
+ {
+ pathList.add(root + "\\Chimera " + version + "\\bin\\chimera");
+ pathList.add(
+ root + "\\Chimera " + version + "\\bin\\chimera.exe");
+ }
+ }
}
else if (os.startsWith("Mac"))
{
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.Profile;
import jalview.datamodel.ProfileI;
import jalview.datamodel.Profiles;
import jalview.datamodel.ResidueCount.SymbolCounts;
import jalview.datamodel.SequenceI;
import jalview.ext.android.SparseIntArray;
-import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
import jalview.util.Format;
import jalview.util.MappingUtils;
* This class is used extensively in calculating alignment colourschemes that
* depend on the amount of conservation in each alignment column.
*
+ * @author $author$
+ * @version $Revision$
*/
public class AAFrequency
{
- private static final double LOG2 = Math.log(2);
-
public static final String PROFILE = "P";
+ /*
+ * Quick look-up of String value of char 'A' to 'Z'
+ */
+ private static final String[] CHARS = new String['Z' - 'A' + 1];
+
+ static
+ {
+ for (char c = 'A'; c <= 'Z'; c++)
+ {
+ CHARS[c - 'A'] = String.valueOf(c);
+ }
+ }
+
public static final ProfilesI calculate(List<SequenceI> list, int start,
int end)
{
}
/**
- * Returns the full set of profiles for a hidden Markov model. The underlying
- * data is the raw probabilities of a residue being emitted at each node,
- * however the profiles returned by this function contain the percentage
- * chance of a residue emission.
- *
- * @param hmm
- * @param width
- * The width of the Profile array (Profiles) to be returned.
- * @param start
- * The alignment column on which the first profile is based.
- * @param end
- * The alignment column on which the last profile is based.
- * @param removeBelowBackground
- * if true, symbols with a match emission probability less than
- * background frequency are ignored
- * @return
- */
- public static ProfilesI calculateHMMProfiles(final HiddenMarkovModel hmm,
- int width, int start, int end, boolean removeBelowBackground,
- boolean infoLetterHeight)
- {
- ProfileI[] result = new ProfileI[width];
- char[] symbols = hmm.getSymbols().toCharArray();
- int symbolCount = symbols.length;
- for (int column = start; column < end; column++)
- {
- ResidueCount counts = new ResidueCount();
- for (char symbol : symbols)
- {
- int value = getAnalogueCount(hmm, column, symbol,
- removeBelowBackground, infoLetterHeight);
- counts.put(symbol, value);
- }
- int maxCount = counts.getModalCount();
- String maxResidue = counts.getResiduesForCount(maxCount);
- int gapCount = counts.getGapCount();
- ProfileI profile = new Profile(symbolCount, gapCount, maxCount,
- maxResidue);
- profile.setCounts(counts);
-
- result[column] = profile;
- }
- return new Profiles(result);
- }
-
- /**
* Make an estimate of the profile size we are going to compute i.e. how many
* different characters may be present in it. Overestimating has a cost of
* using more memory than necessary. Underestimating has a cost of needing to
}
/**
- * Derive the information annotations to be added to the alignment for
- * display. This does not recompute the raw data, but may be called on a
- * change in display options, such as 'ignore below background frequency',
- * which may in turn result in a change in the derived values.
+ * Derive the gap count annotation row.
*
- * @param information
- * the annotation row to add annotations to
- * @param profiles
- * the source information data
- * @param startCol
- * start column (inclusive)
- * @param endCol
- * end column (exclusive)
- * @param ignoreGaps
- * if true, normalise residue percentages
- * @param showSequenceLogo
- * if true include all information symbols, else just show modal
- * residue
- */
- public static float completeInformation(AlignmentAnnotation information,
- ProfilesI profiles, int startCol, int endCol)
- {
- // long now = System.currentTimeMillis();
- if (information == null || information.annotations == null)
- {
- /*
- * called with a bad alignment annotation row
- * wait for it to be initialised properly
- */
- return 0;
- }
-
- float max = 0f;
- SequenceI hmmSeq = information.sequenceRef;
-
- int seqLength = hmmSeq.getLength();
- if (information.annotations.length < seqLength)
- {
- return 0;
- }
-
- HiddenMarkovModel hmm = hmmSeq.getHMM();
-
- for (int column = startCol; column < endCol; column++)
- {
- if (column >= seqLength)
- {
- // hmm consensus sequence is shorter than the alignment
- break;
- }
-
- float value = hmm.getInformationContent(column);
- boolean isNaN = Float.isNaN(value);
- if (!isNaN)
- {
- max = Math.max(max, value);
- }
-
- String description = isNaN ? null
- : String.format("%.4f bits", value);
- information.annotations[column] = new Annotation(
- Character.toString(
- Character.toUpperCase(hmmSeq.getCharAt(column))),
- description, ' ', value);
- }
-
- information.graphMax = max;
- return max;
- }
-
- /**
- * Derive the occupancy count annotation
- *
- * @param occupancy
+ * @param gaprow
* the annotation row to add annotations to
* @param profiles
* the source consensus data
* @param endCol
* end column (exclusive)
*/
- public static void completeOccupancyAnnot(AlignmentAnnotation occupancy,
+ public static void completeGapAnnot(AlignmentAnnotation gaprow,
ProfilesI profiles, int startCol, int endCol, long nseq)
{
- if (occupancy == null || occupancy.annotations == null
- || occupancy.annotations.length < endCol)
+ if (gaprow == null || gaprow.annotations == null
+ || gaprow.annotations.length < endCol)
{
/*
* called with a bad alignment annotation row
return;
}
// always set ranges again
- occupancy.graphMax = nseq;
- occupancy.graphMin = 0;
+ gaprow.graphMax = nseq;
+ gaprow.graphMin = 0;
double scale = 0.8 / nseq;
for (int i = startCol; i < endCol; i++)
{
* happens if sequences calculated over were
* shorter than alignment width
*/
- occupancy.annotations[i] = null;
+ gaprow.annotations[i] = null;
return;
}
String description = "" + gapped;
- occupancy.annotations[i] = new Annotation("", description, '\0',
- gapped,
+ gaprow.annotations[i] = new Annotation("", description, '\0', gapped,
jalview.util.ColorUtils.bleachColour(Color.DARK_GRAY,
(float) scale * gapped));
}
return result;
}
-
/**
* Extract a sorted extract of cDNA codon profile data. The returned array
* contains
for (int col = 0; col < cols; col++)
{
// todo would prefer a Java bean for consensus data
- Hashtable<String, int[]> columnHash = new Hashtable<>();
+ Hashtable<String, int[]> columnHash = new Hashtable<String, int[]>();
// #seqs, #ungapped seqs, counts indexed by (codon encoded + 1)
int[] codonCounts = new int[66];
codonCounts[0] = alignment.getSequences().size();
}
return scale;
}
-
- /**
- * Returns the sorted HMM profile for the given column of the alignment. The
- * returned array contains
- *
- * <pre>
- * [profileType=0, numberOfValues, 100, charValue1, percentage1, charValue2, percentage2, ...]
- * in descending order of percentage value
- * </pre>
- *
- * @param hmm
- * @param column
- * @param removeBelowBackground
- * if true, ignores residues with probability less than their
- * background frequency
- * @param infoHeight
- * if true, uses the log ratio 'information' measure to scale the
- * value
- * @return
- */
- public static int[] extractHMMProfile(HiddenMarkovModel hmm, int column,
- boolean removeBelowBackground, boolean infoHeight)
- {
- if (hmm == null)
- {
- return null;
- }
- String alphabet = hmm.getSymbols();
- int size = alphabet.length();
- char symbols[] = new char[size];
- int values[] = new int[size];
- int totalCount = 0;
-
- for (int i = 0; i < size; i++)
- {
- char symbol = alphabet.charAt(i);
- symbols[i] = symbol;
- int value = getAnalogueCount(hmm, column, symbol,
- removeBelowBackground, infoHeight);
- values[i] = value;
- totalCount += value;
- }
-
- /*
- * sort symbols by increasing emission probability
- */
- QuickSort.sort(values, symbols);
-
- int[] profile = new int[3 + size * 2];
-
- profile[0] = AlignmentAnnotation.SEQUENCE_PROFILE;
- profile[1] = size;
- profile[2] = 100;
-
- /*
- * order symbol/count profile by decreasing emission probability
- */
- if (totalCount != 0)
- {
- int arrayPos = 3;
- for (int k = size - 1; k >= 0; k--)
- {
- Float percentage;
- int value = values[k];
- if (removeBelowBackground)
- {
- percentage = ((float) value) / totalCount * 100f;
- }
- else
- {
- percentage = value / 100f;
- }
- int intPercent = Math.round(percentage);
- profile[arrayPos] = symbols[k];
- profile[arrayPos + 1] = intPercent;
- arrayPos += 2;
- }
- }
- return profile;
- }
-
- /**
- * Converts the emission probability of a residue at a column in the alignment
- * to a 'count', suitable for rendering as an annotation value
- *
- * @param hmm
- * @param column
- * @param symbol
- * @param removeBelowBackground
- * if true, returns 0 for any symbol with a match emission
- * probability less than the background frequency
- * @infoHeight if true, uses the log ratio 'information content' to scale the
- * value
- * @return
- */
- static int getAnalogueCount(HiddenMarkovModel hmm, int column,
- char symbol, boolean removeBelowBackground, boolean infoHeight)
- {
- double value = hmm.getMatchEmissionProbability(column, symbol);
- double freq = ResidueProperties.backgroundFrequencies
- .get(hmm.getAlphabetType()).get(symbol);
- if (value < freq && removeBelowBackground)
- {
- return 0;
- }
-
- if (infoHeight)
- {
- value = value * (Math.log(value / freq) / LOG2);
- }
-
- value = value * 10000d;
- return Math.round((float) value);
- }
}
final List<AlignmentAnnotation> result = new ArrayList<>();
for (AlignmentAnnotation dsann : datasetAnnotations)
{
- if (dsann.annotations != null) // ignore non-positional annotation
- {
- /*
- * Find matching annotations on the alignment. If none is found, then
- * add this annotation to the list of 'addable' annotations for this
- * sequence.
- */
- final Iterable<AlignmentAnnotation> matchedAlignmentAnnotations = al
- .findAnnotations(seq, dsann.getCalcId(), dsann.label);
- if (!matchedAlignmentAnnotations.iterator().hasNext())
- {
- result.add(dsann);
- if (labelForCalcId != null)
- {
- labelForCalcId.put(dsann.getCalcId(), dsann.label);
- }
- }
- }
/*
- * Save any addable annotations for this sequence
+ * Find matching annotations on the alignment. If none is found, then
+ * add this annotation to the list of 'addable' annotations for this
+ * sequence.
*/
- if (!result.isEmpty())
+ final Iterable<AlignmentAnnotation> matchedAlignmentAnnotations = al
+ .findAnnotations(seq, dsann.getCalcId(), dsann.label);
+ if (!matchedAlignmentAnnotations.iterator().hasNext())
{
- candidates.put(seq, result);
+ result.add(dsann);
+ if (labelForCalcId != null)
+ {
+ labelForCalcId.put(dsann.getCalcId(), dsann.label);
+ }
}
}
+ /*
+ * Save any addable annotations for this sequence
+ */
+ if (!result.isEmpty())
+ {
+ candidates.put(seq, result);
+ }
}
}
*/
package jalview.analysis;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
/**
* Store essential properties of a sequence in a hashtable for later recovery
- * Keys are Name, Start, End, SeqFeatures, PdbId, HMM
+ * Keys are Name, Start, End, SeqFeatures, PdbId
*
* @param seq
* SequenceI
sqinfo.put("Description", seq.getDescription());
}
- Vector<SequenceFeature> sfeat = new Vector<>();
+ Vector<SequenceFeature> sfeat = new Vector<SequenceFeature>();
List<SequenceFeature> sfs = seq.getFeatures().getAllFeatures();
sfeat.addAll(sfs);
(seq.getDatasetSequence() != null) ? seq.getDatasetSequence()
: new Sequence("THISISAPLACEHOLDER", ""));
}
- if (seq.hasHMMProfile())
- {
- sqinfo.put("HMM", seq.getHMM());
- }
return sqinfo;
}
Vector<PDBEntry> pdbid = (Vector<PDBEntry>) sqinfo.get("PdbId");
String description = (String) sqinfo.get("Description");
Sequence seqds = (Sequence) sqinfo.get("datasetSequence");
- HiddenMarkovModel hmm = (HiddenMarkovModel) sqinfo.get("HMM");
if (oldname == null)
{
namePresent = false;
sq.setDatasetSequence(seqds);
}
- if (hmm != null)
- {
- sq.setHMM(new HiddenMarkovModel(hmm, sq));
- }
return namePresent;
}
/**
* Updates the display of calculated annotation values (does not recalculate
- * the values). This allows a quick redraw of annotations when display
- * settings are changed.
+ * the values). This allows ßquick redraw of annotations when display settings
+ * are changed.
*/
void updateAnnotation();
*
* @return
*/
- ViewportRanges getRanges();
+ public ViewportRanges getRanges();
/**
* calculate the height for visible annotation, revalidating bounds where
*
* @return total height of annotation
*/
- int calcPanelHeight();
+ public int calcPanelHeight();
/**
* Answers true if the viewport has at least one column selected
boolean isNormaliseSequenceLogo();
- boolean isShowInformationHistogram();
-
- boolean isShowHMMSequenceLogo();
-
- boolean isNormaliseHMMSequenceLogo();
-
ColourSchemeI getGlobalColourScheme();
/**
ColumnSelection getColumnSelection();
- ProfilesI getConsensusProfiles();
+ ProfilesI getSequenceConsensusHash();
/**
* Get consensus data table for the cDNA complement of this alignment (if any)
boolean isIgnoreGapsConsensus();
- boolean isIgnoreBelowBackground();
-
boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
AlignmentAnnotation getAlignmentQualityAnnot();
*
* @return
*/
- AlignmentAnnotation getOccupancyAnnotation();
+ AlignmentAnnotation getAlignmentGapAnnotation();
/**
* get the container for cDNA complement consensus annotation
*
* @param hconsensus
*/
- void setConsensusProfiles(ProfilesI hconsensus);
+ void setSequenceConsensusHash(ProfilesI hconsensus);
/**
* Set the cDNA complement consensus for the viewport
*
* @return a copy of this view's current display settings
*/
- ViewStyleI getViewStyle();
+ public ViewStyleI getViewStyle();
/**
* update the view's display settings with the given style set
*
* @param settingsForView
*/
- void setViewStyle(ViewStyleI settingsForView);
+ public void setViewStyle(ViewStyleI settingsForView);
/**
* Returns a viewport which holds the cDna for this (protein), or vice versa,
*/
void setFollowHighlight(boolean b);
- void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
+ public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
/**
* check if current selection group is defined on the view, or is simply a
@Override
void setProteinFontAsCdna(boolean b);
- void setHmmProfiles(ProfilesI info);
-
- ProfilesI getHmmProfiles();
-
- /**
- * Registers and starts a worker thread to calculate Information Content
- * annotation, if it is not already registered
- *
- * @param ap
- */
- void initInformationWorker(AlignmentViewPanel ap);
-
- boolean isInfoLetterHeight();
-
- abstract TreeModel getCurrentTree();
+ public abstract TreeModel getCurrentTree();
- abstract void setCurrentTree(TreeModel tree);
+ public abstract void setCurrentTree(TreeModel tree);
}
alignPanel);
viewport.updateConservation(alignPanel);
viewport.updateConsensus(alignPanel);
- viewport.initInformationWorker(alignPanel);
displayNonconservedMenuItem.setState(viewport.getShowUnconserved());
followMouseOverFlag.setState(viewport.isFollowHighlight());
/*
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
import jalview.bin.JalviewLite;
import jalview.commands.CommandI;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.renderer.ResidueShader;
import jalview.schemes.ColourSchemeProperty;
import jalview.schemes.UserColourScheme;
private AnnotationColumnChooser annotationColumnSelectionState;
- java.awt.Frame nullFrame;
-
- protected FeatureSettings featureSettings = null;
-
- private float heightScale = 1, widthScale = 1;
-
public AlignViewport(AlignmentI al, JalviewLite applet)
{
super(al);
if (colour != null)
{
residueShading = new ResidueShader(
- ColourSchemeProperty.getColourScheme(getAlignment(),
- colour));
+ ColourSchemeProperty.getColourScheme(alignment, colour));
if (residueShading != null)
{
- residueShading.setConsensus(consensusProfiles);
+ residueShading.setConsensus(hconsensus);
}
}
}
}
initAutoAnnotation();
+
}
+ java.awt.Frame nullFrame;
+
+ protected FeatureSettings featureSettings = null;
+
+ private float heightScale = 1, widthScale = 1;
+
/**
* {@inheritDoc}
*/
.getStructureSelectionManager(applet);
}
+ @Override
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ public void setNormaliseSequenceLogo(boolean state)
+ {
+ normaliseSequenceLogo = state;
+ }
+
/**
*
* @return true if alignment characters should be displayed
// this is called after loading new annotation onto alignment
if (alignFrame.getSize().height == 0)
{
- // panel not laid out yet?
- return;
+ System.out.println(
+ "adjustAnnotationHeight frame size zero NEEDS FIXING");
}
fontChanged();
validateAnnotationDimensions(true);
MessageManager.getString("label.ignore_gaps_consensus"),
(aa[selectedRow].groupRef != null)
? aa[selectedRow].groupRef
- .isIgnoreGapsConsensus()
+ .getIgnoreGapsConsensus()
: ap.av.isIgnoreGapsConsensus());
final AlignmentAnnotation aaa = aa[selectedRow];
cbmi.addItemListener(new ItemListener()
od = new OverviewDimensionsShowHidden(av.getRanges(),
(av.isShowAnnotation()
- && av.getConsensusProfiles() != null));
+ && av.getSequenceConsensusHash() != null));
oviewCanvas = new OverviewCanvas(od, av);
setLayout(new BorderLayout());
}
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
- boolean vischange = stretchGroup.recalcAnnotations(true);
+ boolean vischange = stretchGroup.recalcConservation(true);
// here we rely on stretchGroup == av.getSelection()
needOverviewUpdate |= vischange && av.isSelectionDefinedGroup()
&& afterDrag;
import jalview.structure.StructureImportSettings;
import jalview.urls.IdOrgSettings;
import jalview.util.ColorUtils;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
-import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
import jalview.ws.sifts.SiftsSettings;
import java.awt.Color;
return null;
}
- private static DasSourceRegistryI sourceRegistry = null;
-
- /**
- * initialise and ..
- *
- * @return instance of the das source registry
- */
- public static DasSourceRegistryI getDasSourceRegistry()
- {
- if (sourceRegistry == null)
- {
- sourceRegistry = new DasSourceRegistry();
- }
- return sourceRegistry;
- }
-
/**
* Set the specified value, or remove it if null or empty. Does not save the
* properties file.
af.setProgressBar(MessageManager
.getString("status.das_features_being_retrived"), id);
af.featureSettings_actionPerformed(null);
- af.featureSettings.fetchDasFeatures(dasSources, true);
af.setProgressBar(null, id);
synchronized (us)
{
*
* @param args
* open <em>filename</em>
- * @throws InterruptedException
- * @throws IOException
*/
public static void main(String[] args)
{
/**
* @param args
- * @throws InterruptedException
- * @throws IOException
*/
void doMain(String[] args)
{
}
/**
- * Inserts a sequence at a point in the alignment.
- *
- * @param i
- * the index of the position the sequence is to be inserted in.
- */
- @Override
- public void insertSequenceAt(int i, SequenceI snew)
- {
- synchronized (sequences)
- {
- if (sequences.size() > i)
- {
- sequences.add(i, snew);
- return;
-
- }
- else
- {
- sequences.add(snew);
- hiddenSequences.adjustHeightSequenceAdded();
- }
- return;
- }
- }
-
- /**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
annot.hasText = false;
if (calcId != null)
{
- annot.setCalcId(calcId);
+ annot.setCalcId(new String(calcId));
}
annot.autoCalculated = autoCalc;
if (seqRef != null)
}
}
- @Override
- public List<SequenceI> getHmmSequences()
- {
- List<SequenceI> result = new ArrayList<>();
- for (int i = 0; i < sequences.size(); i++)
- {
- SequenceI seq = sequences.get(i);
- if (seq.hasHMMProfile())
- {
- result.add(seq);
- }
- }
- return result;
- }
}
private long invalidrnastruc = -2;
/**
+ * Updates the _rnasecstr field Determines the positions that base pair and
+ * the positions of helices based on secondary structure from a Stockholm file
+ *
+ * @param rnaAnnotation
+ */
+ private void _updateRnaSecStr(CharSequence rnaAnnotation)
+ {
+ try
+ {
+ _rnasecstr = Rna.getHelixMap(rnaAnnotation);
+ invalidrnastruc = -1;
+ } catch (WUSSParseException px)
+ {
+ // DEBUG System.out.println(px);
+ invalidrnastruc = px.getProblemPos();
+ }
+ if (invalidrnastruc > -1)
+ {
+ return;
+ }
+
+ if (_rnasecstr != null && _rnasecstr.length > 0)
+ {
+ // show all the RNA secondary structure annotation symbols.
+ isrna = true;
+ showAllColLabels = true;
+ scaleColLabel = true;
+ _markRnaHelices();
+ }
+ // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+
+ }
+
+ private void _markRnaHelices()
+ {
+ int mxval = 0;
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < _rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ int val = 0;
+ try
+ {
+ val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
+ if (mxval < val)
+ {
+ mxval = val;
+ }
+ } catch (NumberFormatException q)
+ {
+ }
+ ;
+
+ annotations[_rnasecstr[x].getBegin()].value = val;
+ annotations[_rnasecstr[x].getEnd()].value = val;
+
+ // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
+ // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
+ }
+ setScore(mxval);
+ }
+
+ /**
* map of positions in the associated annotation
*/
private Map<Integer, Annotation> sequenceMapping;
}
/**
- * Copy constructor creates a new independent annotation row with the same
- * associated sequenceRef
- *
- * @param annotation
- */
- public AlignmentAnnotation(AlignmentAnnotation annotation)
- {
- setAnnotationId();
- this.label = new String(annotation.label);
- if (annotation.description != null)
- {
- this.description = new String(annotation.description);
- }
- this.graphMin = annotation.graphMin;
- this.graphMax = annotation.graphMax;
- this.graph = annotation.graph;
- this.graphHeight = annotation.graphHeight;
- this.graphGroup = annotation.graphGroup;
- this.groupRef = annotation.groupRef;
- this.editable = annotation.editable;
- this.autoCalculated = annotation.autoCalculated;
- this.hasIcons = annotation.hasIcons;
- this.hasText = annotation.hasText;
- this.height = annotation.height;
- this.label = annotation.label;
- this.padGaps = annotation.padGaps;
- this.visible = annotation.visible;
- this.centreColLabels = annotation.centreColLabels;
- this.scaleColLabel = annotation.scaleColLabel;
- this.showAllColLabels = annotation.showAllColLabels;
- this.calcId = annotation.calcId;
- if (annotation.properties != null)
- {
- properties = new HashMap<>();
- for (Map.Entry<String, String> val : annotation.properties.entrySet())
- {
- properties.put(val.getKey(), val.getValue());
- }
- }
- if (this.hasScore = annotation.hasScore)
- {
- this.score = annotation.score;
- }
- if (annotation.threshold != null)
- {
- threshold = new GraphLine(annotation.threshold);
- }
- Annotation[] ann = annotation.annotations;
- if (annotation.annotations != null)
- {
- this.annotations = new Annotation[ann.length];
- for (int i = 0; i < ann.length; i++)
- {
- if (ann[i] != null)
- {
- annotations[i] = new Annotation(ann[i]);
- if (_linecolour != null)
- {
- _linecolour = annotations[i].colour;
- }
- }
- }
- }
- if (annotation.sequenceRef != null)
- {
- this.sequenceRef = annotation.sequenceRef;
- if (annotation.sequenceMapping != null)
- {
- Integer p = null;
- sequenceMapping = new HashMap<>();
- Iterator<Integer> pos = annotation.sequenceMapping.keySet()
- .iterator();
- while (pos.hasNext())
- {
- // could optimise this!
- p = pos.next();
- Annotation a = annotation.sequenceMapping.get(p);
- if (a == null)
- {
- continue;
- }
- if (ann != null)
- {
- for (int i = 0; i < ann.length; i++)
- {
- if (ann[i] == a)
- {
- sequenceMapping.put(p, annotations[i]);
- }
- }
- }
- }
- }
- else
- {
- this.sequenceMapping = null;
- }
- }
- // TODO: check if we need to do this: JAL-952
- // if (this.isrna=annotation.isrna)
- {
- // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
- }
- validateRangeAndDisplay(); // construct hashcodes, etc.
- }
-
- /**
- * copy constructor with edit based on the hidden columns marked in colSel
- *
- * @param alignmentAnnotation
- * @param colSel
- */
- public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,
- HiddenColumns hidden)
- {
- this(alignmentAnnotation);
- if (annotations == null)
- {
- return;
- }
- makeVisibleAnnotation(hidden);
- }
-
- /**
- * Creates a new AlignmentAnnotation object.
- *
- * @param label
- * DOCUMENT ME!
- * @param description
- * DOCUMENT ME!
- * @param annotations
- * DOCUMENT ME!
- * @param min
- * DOCUMENT ME!
- * @param max
- * DOCUMENT ME!
- * @param winLength
- * DOCUMENT ME!
- */
- public AlignmentAnnotation(String label, String description,
- Annotation[] annotations, float min, float max, int graphType)
- {
- setAnnotationId();
- // graphs are not editable
- editable = graphType == 0;
-
- this.label = label;
- this.description = description;
- this.annotations = annotations;
- graph = graphType;
- graphMin = min;
- graphMax = max;
- validateRangeAndDisplay();
- }
-
- /**
- * Score only annotation
- *
- * @param label
- * @param description
- * @param score
- */
- public AlignmentAnnotation(String label, String description, double score)
- {
- this(label, description, null);
- setScore(score);
- }
-
- /**
- * Updates the _rnasecstr field Determines the positions that base pair and
- * the positions of helices based on secondary structure from a Stockholm file
- *
- * @param rnaAnnotation
- */
- private void _updateRnaSecStr(CharSequence rnaAnnotation)
- {
- try
- {
- _rnasecstr = Rna.getHelixMap(rnaAnnotation);
- invalidrnastruc = -1;
- } catch (WUSSParseException px)
- {
- // DEBUG System.out.println(px);
- invalidrnastruc = px.getProblemPos();
- }
- if (invalidrnastruc > -1)
- {
- return;
- }
-
- if (_rnasecstr != null && _rnasecstr.length > 0)
- {
- // show all the RNA secondary structure annotation symbols.
- isrna = true;
- showAllColLabels = true;
- scaleColLabel = true;
- _markRnaHelices();
- }
- // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
-
- }
-
- private void _markRnaHelices()
- {
- int mxval = 0;
- // Figure out number of helices
- // Length of rnasecstr is the number of pairs of positions that base pair
- // with each other in the secondary structure
- for (int x = 0; x < _rnasecstr.length; x++)
- {
-
- /*
- * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
- * this.annotation._rnasecstr[x].getBegin());
- */
- // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
- int val = 0;
- try
- {
- val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
- if (mxval < val)
- {
- mxval = val;
- }
- } catch (NumberFormatException q)
- {
- }
- ;
-
- annotations[_rnasecstr[x].getBegin()].value = val;
- annotations[_rnasecstr[x].getEnd()].value = val;
-
- // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
- // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
- }
- setScore(mxval);
- }
-
- /**
* Checks if annotation labels represent secondary structures
*
*/
}
/**
+ * Creates a new AlignmentAnnotation object.
+ *
+ * @param label
+ * DOCUMENT ME!
+ * @param description
+ * DOCUMENT ME!
+ * @param annotations
+ * DOCUMENT ME!
+ * @param min
+ * DOCUMENT ME!
+ * @param max
+ * DOCUMENT ME!
+ * @param winLength
+ * DOCUMENT ME!
+ */
+ public AlignmentAnnotation(String label, String description,
+ Annotation[] annotations, float min, float max, int graphType)
+ {
+ setAnnotationId();
+ // graphs are not editable
+ editable = graphType == 0;
+
+ this.label = label;
+ this.description = description;
+ this.annotations = annotations;
+ graph = graphType;
+ graphMin = min;
+ graphMax = max;
+ validateRangeAndDisplay();
+ }
+
+ /**
* checks graphMin and graphMax, secondary structure symbols, sets graphType
* appropriately, sets null labels to the empty string if appropriate.
*/
}
/**
+ * Copy constructor creates a new independent annotation row with the same
+ * associated sequenceRef
+ *
+ * @param annotation
+ */
+ public AlignmentAnnotation(AlignmentAnnotation annotation)
+ {
+ setAnnotationId();
+ this.label = new String(annotation.label);
+ if (annotation.description != null)
+ {
+ this.description = new String(annotation.description);
+ }
+ this.graphMin = annotation.graphMin;
+ this.graphMax = annotation.graphMax;
+ this.graph = annotation.graph;
+ this.graphHeight = annotation.graphHeight;
+ this.graphGroup = annotation.graphGroup;
+ this.groupRef = annotation.groupRef;
+ this.editable = annotation.editable;
+ this.autoCalculated = annotation.autoCalculated;
+ this.hasIcons = annotation.hasIcons;
+ this.hasText = annotation.hasText;
+ this.height = annotation.height;
+ this.label = annotation.label;
+ this.padGaps = annotation.padGaps;
+ this.visible = annotation.visible;
+ this.centreColLabels = annotation.centreColLabels;
+ this.scaleColLabel = annotation.scaleColLabel;
+ this.showAllColLabels = annotation.showAllColLabels;
+ this.calcId = annotation.calcId;
+ if (annotation.properties != null)
+ {
+ properties = new HashMap<>();
+ for (Map.Entry<String, String> val : annotation.properties.entrySet())
+ {
+ properties.put(val.getKey(), val.getValue());
+ }
+ }
+ if (this.hasScore = annotation.hasScore)
+ {
+ this.score = annotation.score;
+ }
+ if (annotation.threshold != null)
+ {
+ threshold = new GraphLine(annotation.threshold);
+ }
+ Annotation[] ann = annotation.annotations;
+ if (annotation.annotations != null)
+ {
+ this.annotations = new Annotation[ann.length];
+ for (int i = 0; i < ann.length; i++)
+ {
+ if (ann[i] != null)
+ {
+ annotations[i] = new Annotation(ann[i]);
+ if (_linecolour != null)
+ {
+ _linecolour = annotations[i].colour;
+ }
+ }
+ }
+ }
+ if (annotation.sequenceRef != null)
+ {
+ this.sequenceRef = annotation.sequenceRef;
+ if (annotation.sequenceMapping != null)
+ {
+ Integer p = null;
+ sequenceMapping = new HashMap<>();
+ Iterator<Integer> pos = annotation.sequenceMapping.keySet()
+ .iterator();
+ while (pos.hasNext())
+ {
+ // could optimise this!
+ p = pos.next();
+ Annotation a = annotation.sequenceMapping.get(p);
+ if (a == null)
+ {
+ continue;
+ }
+ if (ann != null)
+ {
+ for (int i = 0; i < ann.length; i++)
+ {
+ if (ann[i] == a)
+ {
+ sequenceMapping.put(p, annotations[i]);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ this.sequenceMapping = null;
+ }
+ }
+ // TODO: check if we need to do this: JAL-952
+ // if (this.isrna=annotation.isrna)
+ {
+ // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
+ }
+ validateRangeAndDisplay(); // construct hashcodes, etc.
+ }
+
+ /**
* clip the annotation to the columns given by startRes and endRes (inclusive)
* and prune any existing sequenceMapping to just those columns.
*
return hasScore || !Double.isNaN(score);
}
+ /**
+ * Score only annotation
+ *
+ * @param label
+ * @param description
+ * @param score
+ */
+ public AlignmentAnnotation(String label, String description, double score)
+ {
+ this(label, description, null);
+ setScore(score);
+ }
+
+ /**
+ * copy constructor with edit based on the hidden columns marked in colSel
+ *
+ * @param alignmentAnnotation
+ * @param colSel
+ */
+ public AlignmentAnnotation(AlignmentAnnotation alignmentAnnotation,
+ HiddenColumns hidden)
+ {
+ this(alignmentAnnotation);
+ if (annotations == null)
+ {
+ return;
+ }
+ makeVisibleAnnotation(hidden);
+ }
+
public void setPadGaps(boolean padgaps, char gapchar)
{
this.padGaps = padgaps;
/**
* machine readable ID string indicating what generated this annotation
*/
- private String calcId = "";
+ protected String calcId = "";
/**
* properties associated with the calcId
Iterable<AlignmentAnnotation> list, SequenceI seq, String calcId,
String label)
{
- List<AlignmentAnnotation> aa = new ArrayList<>();
+
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<>();
for (AlignmentAnnotation ann : list)
{
if ((calcId == null || (ann.getCalcId() != null
public static Iterable<AlignmentAnnotation> findAnnotation(
List<AlignmentAnnotation> list, String calcId)
{
+
List<AlignmentAnnotation> aa = new ArrayList<>();
if (calcId == null)
{
* - null or specific sequence reference
* @param groupRef
* - null or specific group reference
+ * @param method
+ * - CalcId for the annotation (must match)
*
* @return existing annotation matching the given attributes
*/
public void setHiddenColumns(HiddenColumns cols);
/**
- * Insert a sequence at a position in an alignment
- *
- * @param i
- * The index of the position.
- * @param snew
- * The new sequence.
- */
- void insertSequenceAt(int i, SequenceI snew);
-
- /**
* Set the first sequence as representative and hide its insertions. Typically
* used when loading JPred files.
*/
*/
public HiddenColumns propagateInsertions(SequenceI profileseq,
AlignmentView input);
+
}
*/
public AlignmentOrder(AlignmentI orderFrom)
{
- Order = new ArrayList<>();
+ Order = new ArrayList<SequenceI>();
for (SequenceI seq : orderFrom.getSequences())
{
*/
public AlignmentOrder(SequenceI[] orderFrom)
{
- Order = new ArrayList<>(Arrays.asList(orderFrom));
+ Order = new ArrayList<SequenceI>(Arrays.asList(orderFrom));
}
/**
* alignment, parent group).
*/
AnnotatedCollectionI getContext();
-
-
}
import jalview.util.QuickSort;
import jalview.util.SparseCount;
-import java.util.List;
-
/**
* A class to count occurrences of residues in a profile, optimised for speed
* and memory footprint.
}
/**
- * A constructor that counts frequency of all symbols (including gaps) in the
- * sequences (not case-sensitive)
- *
- * @param sequences
- */
- public ResidueCount(List<SequenceI> sequences)
- {
- this();
- for (SequenceI seq : sequences)
- {
- for (int i = 0; i < seq.getLength(); i++)
- {
- add(seq.getCharAt(i));
- }
- }
- }
-
- /**
* Increments the count for the given character. The supplied character may be
* upper or lower case but counts are for the upper case only. Gap characters
* (space, ., -) are all counted together.
sb.append("]");
return sb.toString();
}
-
- /**
- * Answers the total count for all symbols (excluding gaps)
- *
- * @return
- */
- public int getTotalResidueCount()
- {
- int total = 0;
- for (char symbol : this.getSymbolCounts().symbols)
- {
- total += getCount(symbol);
- }
- return total;
- }
}
import jalview.util.DBRefUtils;
import jalview.util.MapList;
import jalview.util.StringUtils;
-import jalview.workers.InformationThread;
import java.util.ArrayList;
import java.util.Arrays;
int end;
- HiddenMarkovModel hmm;
-
- boolean isHMMConsensusSequence = false;
-
Vector<PDBEntry> pdbIds;
String vamsasId;
this.addPDBId(new PDBEntry(pdb));
}
}
- if (seq.getHMM() != null)
- {
- this.hmm = new HiddenMarkovModel(seq.getHMM(), this);
- }
-
}
@Override
{
for (AlignmentAnnotation ann : annotation)
{
- String id = ann.getCalcId();
- if (id != null && id.equals(calcId)
+ if (ann.calcId != null && ann.calcId.equals(calcId)
&& ann.label != null && ann.label.equals(label))
{
result.add(ann);
}
}
- @Override
- public HiddenMarkovModel getHMM()
- {
- return hmm;
- }
-
- @Override
- public void setHMM(HiddenMarkovModel hmm)
- {
- this.hmm = hmm;
- }
-
- @Override
- public boolean hasHMMAnnotation()
- {
- if (this.annotation == null) {
- return false;
- }
- for (AlignmentAnnotation ann : annotation)
- {
- if (InformationThread.HMM_CALC_ID.equals(ann.getCalcId()))
- {
- return true;
- }
- }
- return false;
- }
-
/**
* {@inheritDoc}
*/
// otherwise, sequence was completely hidden
return 0;
}
-
- @Override
- public boolean hasHMMProfile()
- {
- return hmm != null;
- }
}
* @return
*/
boolean isNucleotide();
-
- /**
- * Returns the (possibly empty) list of HMM consensus sequences in the
- * collection
- *
- * @return
- */
- List<SequenceI> getHmmSequences();
}
import jalview.renderer.ResidueShader;
import jalview.renderer.ResidueShaderI;
import jalview.schemes.ColourSchemeI;
-import jalview.util.MessageManager;
-import jalview.workers.InformationThread;
import java.awt.Color;
import java.beans.PropertyChangeListener;
public class SequenceGroup implements AnnotatedCollectionI
{
// TODO ideally this event notification functionality should be separated into
- // a subclass of ViewportProperties similarly to ViewportRanges.
- // Done here as a quick fix for JAL-2665
+ // a
+ // subclass of ViewportProperties similarly to ViewportRanges. Done here as
+ // quick fix for JAL-2665
public static final String SEQ_GROUP_CHANGED = "Sequence group changed";
- private String groupName;
+ protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
- private String description;
+ public void addPropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
- private AnnotatedCollectionI context;
+ public void removePropertyChangeListener(PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+ // end of event notification functionality initialisation
- private Conservation conservationData;
+ String groupName;
- private ProfilesI consensusProfiles;
+ String description;
- private ProfilesI hmmProfiles;
+ Conservation conserve;
- private boolean displayBoxes = true;
+ boolean displayBoxes = true;
- private boolean displayText = true;
+ boolean displayText = true;
- private boolean colourText = false;
+ boolean colourText = false;
- /*
- * true if the group is defined as a group on the alignment, false if it is
- * just a selection
+ /**
+ * True if the group is defined as a group on the alignment, false if it is
+ * just a selection.
*/
- private boolean isDefined;
+ boolean isDefined = false;
- /*
+ /**
* after Olivier's non-conserved only character display
*/
- private boolean showNonconserved;
+ boolean showNonconserved = false;
- /*
- * sequences in the group
+ /**
+ * group members
*/
private List<SequenceI> sequences = new ArrayList<>();
- /*
+ /**
* representative sequence for this group (if any)
*/
- private SequenceI seqrep;
+ private SequenceI seqrep = null;
- private int width = -1;
+ int width = -1;
- /*
- * colour scheme applied to group if any
+ /**
+ * Colourscheme applied to group if any
*/
public ResidueShaderI cs;
// start column (base 0)
- private int startRes;
+ int startRes = 0;
// end column (base 0)
- private int endRes;
+ int endRes = 0;
public Color outlineColour = Color.black;
- public Color idColour;
+ public Color idColour = null;
- public int thresholdTextColour;
+ public int thresholdTextColour = 0;
public Color textColour = Color.black;
public Color textColour2 = Color.white;
- /*
- * properties for consensus annotation
+ /**
+ * consensus calculation property
*/
private boolean ignoreGapsInConsensus = true;
- private boolean showSequenceLogo;
-
- private boolean normaliseSequenceLogo;
-
- private boolean showConsensusHistogram;
-
- /*
- * properties for HMM information annotation
+ /**
+ * consensus calculation property
*/
- private boolean hmmIgnoreBelowBackground = true;
-
- private boolean hmmUseInfoLetterHeight;
+ private boolean showSequenceLogo = false;
- private boolean hmmShowSequenceLogo;
-
- private boolean hmmNormaliseSequenceLogo;
-
- private boolean hmmShowHistogram;
+ /**
+ * flag indicating if logo should be rendered normalised
+ */
+ private boolean normaliseSequenceLogo;
/*
* visibility of rows or represented rows covered by group
*/
- private boolean hidereps;
+ private boolean hidereps = false;
/*
* visibility of columns intersecting this group
*/
- private boolean hidecols;
+ private boolean hidecols = false;
+
+ AlignmentAnnotation consensus = null;
- private AlignmentAnnotation consensus;
+ AlignmentAnnotation conservation = null;
- private AlignmentAnnotation conservation;
+ private boolean showConsensusHistogram;
- private AlignmentAnnotation hmmInformation;
+ private AnnotatedCollectionI context;
/**
- * Constructor, assigning a generated default name of "JGroup:" with object
- * hashcode appended
+ * Creates a new SequenceGroup object.
*/
public SequenceGroup()
{
showSequenceLogo = seqsel.showSequenceLogo;
normaliseSequenceLogo = seqsel.normaliseSequenceLogo;
showConsensusHistogram = seqsel.showConsensusHistogram;
- hmmShowSequenceLogo = seqsel.hmmShowSequenceLogo;
- hmmNormaliseSequenceLogo = seqsel.hmmNormaliseSequenceLogo;
- hmmShowHistogram = seqsel.hmmShowHistogram;
idColour = seqsel.idColour;
outlineColour = seqsel.outlineColour;
seqrep = seqsel.seqrep;
thresholdTextColour = seqsel.thresholdTextColour;
width = seqsel.width;
ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;
- hmmIgnoreBelowBackground = seqsel.hmmIgnoreBelowBackground;
- hmmUseInfoLetterHeight = seqsel.hmmUseInfoLetterHeight;
- if (seqsel.conservationData != null)
+ if (seqsel.conserve != null)
{
recalcConservation(); // safer than
// aaFrequency = (Vector) seqsel.aaFrequency.clone(); // ??
}
}
- protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
- this);
-
- public void addPropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
-
public boolean isShowSequenceLogo()
{
return showSequenceLogo;
*/
public Conservation getConservation()
{
- return conservationData;
+ return conserve;
}
/**
*/
public void setConservation(Conservation c)
{
- conservationData = c;
+ conserve = c;
}
/**
*/
public boolean recalcConservation()
{
- return recalcAnnotations(false);
+ return recalcConservation(false);
}
/**
- * Recalculates column consensus, conservation, and HMM annotation for the
- * group (as applicable). Returns true if the calculation resulted in a
- * visible change to group.
+ * calculate residue conservation for group - but only if necessary. returns
+ * true if the calculation resulted in a visible change to group
*
* @param defer
* when set, colourschemes for this group are not refreshed after
* recalculation
*/
- public boolean recalcAnnotations(boolean defer)
+ public boolean recalcConservation(boolean defer)
{
- if (cs == null && consensus == null && conservation == null
- && hmmInformation == null)
+ if (cs == null && consensus == null && conservation == null)
{
return false;
}
{
ProfilesI cnsns = AAFrequency.calculate(sequences, startRes,
endRes + 1, showSequenceLogo);
- if (hmmInformation != null)
- {
- HiddenMarkovModel hmm = hmmInformation.sequenceRef.getHMM();
-
- ProfilesI info = AAFrequency.calculateHMMProfiles(hmm,
- (endRes + 1) - startRes, startRes, endRes + 1,
- hmmIgnoreBelowBackground, hmmUseInfoLetterHeight);
- _updateInformationRow(info);
- upd = true;
- }
if (consensus != null)
{
_updateConsensusRow(cnsns, sequences.size());
c.completeAnnotations(conservation, null, startRes, endRes + 1);
}
+ public ProfilesI consensusData = null;
+
private void _updateConsensusRow(ProfilesI cnsns, long nseq)
{
if (consensus == null)
}
consensus.label = "Consensus for " + getName();
consensus.description = "Percent Identity";
- consensusProfiles = cnsns;
+ consensusData = cnsns;
// preserve width if already set
int aWidth = (consensus.annotations != null)
? (endRes < consensus.annotations.length
}
/**
- * Recalculates the information content on the HMM annotation
- *
- * @param cnsns
- */
- private void _updateInformationRow(ProfilesI cnsns)
- {
- if (hmmInformation == null)
- {
- createInformationAnnotation();
- }
- hmmInformation.description = MessageManager
- .getString("label.information_description");
- setHmmProfiles(cnsns);
- // preserve width if already set
- int aWidth = (hmmInformation.annotations != null)
- ? (endRes < hmmInformation.annotations.length
- ? hmmInformation.annotations.length : endRes + 1)
- : endRes + 1;
- hmmInformation.annotations = null;
- hmmInformation.annotations = new Annotation[aWidth]; // should be alignment
- // width
- hmmInformation.setCalcId(InformationThread.HMM_CALC_ID);
- AAFrequency.completeInformation(hmmInformation, cnsns, startRes,
- endRes + 1);
- }
-
- /**
* @param s
* sequence to either add or remove from group
* @param recalc
}
/**
- * Creates the Hidden Markov Model annotation for this group
- */
- void createInformationAnnotation()
- {
- hmmInformation = new AlignmentAnnotation("", "", new Annotation[1], 0f,
- 6.25f, AlignmentAnnotation.BAR_GRAPH);
- hmmInformation.hasText = true;
- hmmInformation.autoCalculated = false;
- hmmInformation.groupRef = this;
- hmmInformation.label = getName();
- hmmInformation.description = MessageManager
- .getString("label.information_description");
- hmmInformation.setCalcId(InformationThread.HMM_CALC_ID);
- }
-
- /**
* set this alignmentAnnotation object as the one used to render consensus
* annotation
*
ignoreGapsInConsensus = state;
}
- public boolean isIgnoreGapsConsensus()
+ public boolean getIgnoreGapsConsensus()
{
return ignoreGapsInConsensus;
}
- public void setIgnoreBelowBackground(boolean state)
- {
- hmmIgnoreBelowBackground = state;
- }
-
- public boolean isIgnoreBelowBackground()
- {
- return hmmIgnoreBelowBackground;
- }
-
- public void setInfoLetterHeight(boolean state)
- {
- hmmUseInfoLetterHeight = state;
- }
-
- public boolean isUseInfoLetterHeight()
- {
- return hmmUseInfoLetterHeight;
- }
-
/**
* @param showSequenceLogo
* indicates if a sequence logo is shown for consensus annotation
{
return (startRes <= apos && endRes >= apos) && sequences.contains(seq);
}
-
- public boolean isShowInformationHistogram()
- {
- return hmmShowHistogram;
- }
-
- public void setShowInformationHistogram(boolean state)
- {
- if (hmmShowHistogram != state && hmmInformation != null)
- {
- this.hmmShowHistogram = state;
- // recalcConservation(); TODO don't know what to do here next
- }
- this.hmmShowHistogram = state;
- }
-
- public boolean isShowHMMSequenceLogo()
- {
- return hmmShowSequenceLogo;
- }
-
- public void setShowHMMSequenceLogo(boolean state)
- {
- hmmShowSequenceLogo = state;
- }
-
- public boolean isNormaliseHMMSequenceLogo()
- {
- return hmmNormaliseSequenceLogo;
- }
-
- public void setNormaliseHMMSequenceLogo(boolean state)
- {
- hmmNormaliseSequenceLogo = state;
- }
-
- public ProfilesI getConsensusData()
- {
- return consensusProfiles;
- }
-
- public ProfilesI getHmmProfiles()
- {
- return hmmProfiles;
- }
-
- public void setHmmProfiles(ProfilesI hmmProfiles)
- {
- this.hmmProfiles = hmmProfiles;
- }
-
- @Override
- public List<SequenceI> getHmmSequences()
- {
- List<SequenceI> result = new ArrayList<>();
- for (int i = 0; i < sequences.size(); i++)
- {
- SequenceI seq = sequences.get(i);
- if (seq.hasHMMProfile())
- {
- result.add(seq);
- }
- }
- return result;
- }
-
}
*/
public void setName(String name);
- public HiddenMarkovModel getHMM();
-
- public void setHMM(HiddenMarkovModel hmm);
-
/**
* Get the display name
*/
public List<DBRefEntry> getPrimaryDBRefs();
/**
- * Answers true if the sequence has annotation for Hidden Markov Model
- * information content, else false
- */
- boolean hasHMMAnnotation();
-
- /**
* Returns a (possibly empty) list of sequence features that overlap the given
* alignment column range, optionally restricted to one or more specified
* feature types. If the range is all gaps, then features which enclose it are
* @param c1
* @param c2
*/
- int replace(char c1, char c2);
+ public int replace(char c1, char c2);
/**
* Answers the GeneLociI, or null if not known
* the iterator to use
* @return a String corresponding to the sequence
*/
- String getSequenceStringFromIterator(Iterator<int[]> it);
+ public String getSequenceStringFromIterator(Iterator<int[]> it);
/**
* Locate the first position in this sequence which is not contained in an
* iterator over regions
* @return first residue not contained in regions
*/
- int firstResidueOutsideIterator(Iterator<int[]> it);
-
- /**
- * Answers true if this sequence has an associated Hidden Markov Model
- *
- * @return
- */
- boolean hasHMMProfile();
+ public int firstResidueOutsideIterator(Iterator<int[]> it);
}
Datatype type;
/**
- * Note one instance of this attribute, recording unique, non-null names,
- * and the min/max of any numerical values
+ * Note one instance of this attribute, recording unique, non-null
+ * descriptions, and the min/max of any numerical values
*
* @param desc
* @param value
if (value != null)
{
- try
- {
- float f = Float.valueOf(value);
- min = hasValue ? Float.min(min, f) : f;
- max = hasValue ? Float.max(max, f) : f;
- hasValue = true;
- type = (type == null || type == Datatype.Number) ? Datatype.Number
- : Datatype.Mixed;
- } catch (NumberFormatException e)
+ value = value.trim();
+
+ /*
+ * Parse numeric value unless we have previously
+ * seen text data for this attribute type
+ */
+ if (type == null || type == Datatype.Number)
{
- // not a number, ignore for min-max purposes
- type = (type == null || type == Datatype.Character)
- ? Datatype.Character
- : Datatype.Mixed;
+ try
+ {
+ float f = Float.valueOf(value);
+ min = hasValue ? Float.min(min, f) : f;
+ max = hasValue ? Float.max(max, f) : f;
+ hasValue = true;
+ type = (type == null || type == Datatype.Number)
+ ? Datatype.Number
+ : Datatype.Mixed;
+ } catch (NumberFormatException e)
+ {
+ /*
+ * non-numeric data: treat attribute as Character (or Mixed)
+ */
+ type = (type == null || type == Datatype.Character)
+ ? Datatype.Character
+ : Datatype.Mixed;
+ min = 0f;
+ max = 0f;
+ hasValue = false;
+ }
}
}
}
/**
* Answers the [min, max] value range of the given attribute for the given
- * feature type, if known, else null. Attributes which only have text values
- * would normally return null, however text values which happen to be numeric
- * could result in a 'min-max' range.
+ * feature type, if known, else null. Attributes with a mixture of text and
+ * numeric values are considered text (do not return a min-max range).
*
* @param featureType
* @param attName
*/
// featureStore = Collections
// .synchronizedSortedMap(new TreeMap<String, FeatureStore>());
- featureStore = new TreeMap<String, FeatureStore>();
+ featureStore = new TreeMap<>();
}
/**
}
/**
- * Answers true if the given type is one of the specified sequence ontology
- * terms (or a sub-type of one), or if no terms are supplied. Answers false if
- * filter terms are specified and the given term does not match any of them.
+ * Answers true if the given type matches one of the specified terms (or is a
+ * sub-type of one in the Sequence Ontology), or if no terms are supplied.
+ * Answers false if filter terms are specified and the given term does not
+ * match any of them.
*
* @param type
* @param soTerm
SequenceOntologyI so = SequenceOntologyFactory.getInstance();
for (String term : soTerm)
{
- if (so.isA(type, term))
+ if (type.equals(term) || so.isA(type, term))
{
return true;
}
String group, String... type);
/**
- * Answers a list of all features stored, whose type either matches one of the
- * given ontology terms, or is a specialisation of a term in the Sequence
- * Ontology. Results are returned in no particular guaranteed order.
+ * Answers a list of all features stored, whose type either matches, or is a
+ * specialisation (in the Sequence Ontology) of, one of the given terms.
+ * Results are returned in no particular order.
*
* @param ontologyTerm
* @return
package jalview.ext.ensembl;
import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyI;
+import java.util.ArrayList;
+import java.util.List;
+
import com.stevesoft.pat.Regex;
/**
}
/**
- * Answers true if the sequence feature type is 'exon' (or a subtype of exon
- * in the Sequence Ontology), and the Parent of the feature is the transcript
- * we are retrieving
+ * Answers a list of sequence features (if any) whose type is 'exon' (or a
+ * subtype of exon in the Sequence Ontology), and whose Parent is the
+ * transcript we are retrieving
*/
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.EXON))
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.EXON);
+ for (SequenceFeature sf : sfs)
{
String parentFeature = (String) sf.getValue(PARENT);
if (("transcript:" + accId).equals(parentFeature))
{
- return true;
+ result.add(sf);
}
}
- return false;
+
+ return result;
}
/**
}
/**
- * Answers true if the sequence feature type is 'CDS' (or a subtype of CDS in
- * the Sequence Ontology), and the Parent of the feature is the transcript we
- * are retrieving
+ * Answers a list of sequence features (if any) whose type is 'CDS' (or a
+ * subtype of CDS in the Sequence Ontology), and whose Parent is the
+ * transcript we are retrieving
*/
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.CDS))
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.CDS);
+ for (SequenceFeature sf : sfs)
{
String parentFeature = (String) sf.getValue(PARENT);
if (("transcript:" + accId).equals(parentFeature))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
/**
protected List<int[]> getCdsRanges(SequenceI dnaSeq)
{
int len = dnaSeq.getLength();
- List<int[]> ranges = new ArrayList<int[]>();
+ List<int[]> ranges = new ArrayList<>();
ranges.add(new int[] { 1, len });
return ranges;
}
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
+import jalview.io.DataSourceType;
import jalview.io.FeaturesFile;
import jalview.io.FileParse;
+import java.io.BufferedReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
// TODO: use a vararg String... for getSequenceRecords instead?
List<String> queries = new ArrayList<>();
queries.add(query);
- FileParse fp = getSequenceReader(queries);
- if (fp == null || !fp.isValid())
+ BufferedReader fp = getSequenceReader(queries);
+ if (fp == null)
{
return null;
}
- FeaturesFile fr = new FeaturesFile(fp);
+ FeaturesFile fr = new FeaturesFile(
+ new FileParse(fp, null, DataSourceType.URL));
return new Alignment(fr.getSeqsAsArray());
}
* describes the required encoding of the response.
*/
@Override
- protected String getRequestMimeType(boolean multipleIds)
+ protected String getRequestMimeType()
{
return "text/x-gff3";
}
/**
- * Returns the MIME type for GFF3.
+ * Returns the MIME type for GFF3
*/
@Override
protected String getResponseMimeType()
}
/**
- * Answers true for a feature of type 'gene' (or a sub-type of gene in the
- * Sequence Ontology), whose ID is the accession we are retrieving
+ * Answers a list of sequence features (if any) whose type is 'gene' (or a
+ * subtype of gene in the Sequence Ontology), and whose ID is the accession we
+ * are retrieving
*/
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.GENE))
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.GENE);
+ for (SequenceFeature sf : sfs)
{
// NB features as gff use 'ID'; rest services return as 'id'
String id = (String) sf.getValue("ID");
if ((GENE_PREFIX + accId).equalsIgnoreCase(id))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
/**
}
/**
- * Answers false. This allows an optimisation - a single 'gene' feature is all
- * that is needed to identify the positions of the gene on the genomic
- * sequence.
- */
- @Override
- protected boolean isSpliceable()
- {
- return false;
- }
-
- /**
* Override to do nothing as Ensembl doesn't return a protein sequence for a
* gene identifier
*/
package jalview.ext.ensembl;
import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.io.gff.SequenceOntologyI;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* A client to fetch genomic sequence from Ensembl
}
/**
- * Answers true if the sequence feature type is 'transcript' (or a subtype of
- * transcript in the Sequence Ontology), and the ID of the feature is the
- * transcript we are retrieving
+ * Answers a list of sequence features (if any) whose type is 'transcript' (or
+ * a subtype of transcript in the Sequence Ontology), and whose ID is the
+ * accession we are retrieving.
+ * <p>
+ * Note we also include features of type "NMD_transcript_variant", although
+ * not strictly 'transcript' in the SO, as they used in Ensembl as if they
+ * were.
*/
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (isTranscript(sf.getType()))
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures().getFeaturesByOntology(
+ SequenceOntologyI.TRANSCRIPT,
+ SequenceOntologyI.NMD_TRANSCRIPT_VARIANT);
+ for (SequenceFeature sf : sfs)
{
+ // NB features as gff use 'ID'; rest services return as 'id'
String id = (String) sf.getValue("ID");
if (("transcript:" + accId).equals(id))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
}
return true;
}
- @Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return "application/json";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "application/json";
- }
-
/**
* Answers the domain (http://rest.ensembl.org or
* http://rest.ensemblgenomes.org) for the given division, or null if not
return true;
}
- @Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return "application/json";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "application/json";
- }
-
/**
* Returns the gene id related to the given identifier (which may be for a
- * gene, transcript or protein)
+ * gene, transcript or protein), or null if none is found
*
* @param identifier
* @return
/**
* Returns the gene id related to the given identifier (which may be for a
- * gene, transcript or protein)
+ * gene, transcript or protein), or null if none is found
*
* @param identifier
* @param objectType
*/
protected String parseGeneId(JSONObject val)
{
+ if (val == null)
+ {
+ return null;
+ }
String geneId = null;
String type = val.get(OBJECT_TYPE).toString();
if (OBJECT_TYPE_GENE.equalsIgnoreCase(type))
}
@Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return "application/json";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "application/json";
- }
-
- @Override
protected URL getUrl(List<String> ids) throws MalformedURLException
{
return null; // not used
{
url = getIdMapUrl(domain, accession, start, end, cdsOrCdna);
br = getHttpResponse(url, null);
- return (parseIdMappingResponse(br, accession, domain));
+ if (br != null)
+ {
+ return (parseIdMappingResponse(br, accession, domain));
+ }
}
return null;
} catch (Throwable t)
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
+import java.util.List;
import com.stevesoft.pat.Regex;
}
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- // not applicable - protein sequence is not a 'subset' of genomic sequence
- return false;
+ return new ArrayList<>();
}
@Override
*/
package jalview.ext.ensembl;
-import jalview.io.DataSourceType;
-import jalview.io.FileParse;
import jalview.util.StringUtils;
import java.io.BufferedReader;
* @see https://github.com/Ensembl/ensembl-rest/wiki/Change-log
* @see http://rest.ensembl.org/info/rest?content-type=application/json
*/
- private static final String LATEST_ENSEMBLGENOMES_REST_VERSION = "6.0";
+ private static final String LATEST_ENSEMBLGENOMES_REST_VERSION = "7.0";
- private static final String LATEST_ENSEMBL_REST_VERSION = "6.1";
+ private static final String LATEST_ENSEMBL_REST_VERSION = "7.0";
private static final String REST_CHANGE_LOG = "https://github.com/Ensembl/ensembl-rest/wiki/Change-log";
private static Map<String, EnsemblData> domainData;
- // @see https://github.com/Ensembl/ensembl-rest/wiki/Output-formats
- private static final String PING_URL = "http://rest.ensembl.org/info/ping.json";
-
private final static long AVAILABILITY_RETEST_INTERVAL = 10000L; // 10 seconds
private final static long VERSION_RETEST_INTERVAL = 1000L * 3600; // 1 hr
protected abstract boolean useGetRequest();
/**
- * Return the desired value for the Content-Type request header
- *
- * @param multipleIds
+ * Returns the desired value for the Content-Type request header. Default is
+ * application/json, override if required to vary this.
*
* @return
* @see https://github.com/Ensembl/ensembl-rest/wiki/HTTP-Headers
*/
- protected abstract String getRequestMimeType(boolean multipleIds);
+ protected String getRequestMimeType()
+ {
+ return "application/json";
+ }
/**
- * Return the desired value for the Accept request header
+ * Return the desired value for the Accept request header. Default is
+ * application/json, override if required to vary this.
*
* @return
* @see https://github.com/Ensembl/ensembl-rest/wiki/HTTP-Headers
*/
- protected abstract String getResponseMimeType();
+ protected String getResponseMimeType()
+ {
+ return "application/json";
+ }
/**
* Checks Ensembl's REST 'ping' endpoint, and returns true if response
}
/**
- * returns a reader to a Fasta response from the Ensembl sequence endpoint
+ * Returns a reader to a (Json) response from the Ensembl sequence endpoint.
+ * If the request failed the return value may be null.
*
* @param ids
* @return
* @throws IOException
*/
- protected FileParse getSequenceReader(List<String> ids) throws IOException
+ protected BufferedReader getSequenceReader(List<String> ids)
+ throws IOException
{
URL url = getUrl(ids);
BufferedReader reader = getHttpResponse(url, ids);
- if (reader == null)
- {
- // request failed
- return null;
- }
- FileParse fp = new FileParse(reader, url.toString(),
- DataSourceType.URL);
- return fp;
+ return reader;
}
/**
}
/**
- * Sends the HTTP request and gets the response as a reader
+ * Sends the HTTP request and gets the response as a reader. Returns null if
+ * the HTTP response code was not 200.
*
* @param url
* @param ids
* in milliseconds
* @return
* @throws IOException
- * if response code was not 200, or other I/O error
*/
protected BufferedReader getHttpResponse(URL url, List<String> ids,
int readTimeout) throws IOException
boolean multipleIds = ids != null && ids.size() > 1;
connection.setRequestMethod(
multipleIds ? HttpMethod.POST : HttpMethod.GET);
- connection.setRequestProperty("Content-Type",
- getRequestMimeType(multipleIds));
+ connection.setRequestProperty("Content-Type", getRequestMimeType());
connection.setRequestProperty("Accept", getResponseMimeType());
connection.setUseCaches(false);
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.Mapping;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.datamodel.features.SequenceFeatures;
import jalview.exceptions.JalviewException;
-import jalview.io.FastaFile;
-import jalview.io.FileParse;
import jalview.io.gff.Gff3Helper;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyI;
import jalview.util.IntRangeComparator;
import jalview.util.MapList;
+import java.io.BufferedReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.List;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
/**
* Base class for Ensembl sequence fetchers
*
inProgress = false;
throw new JalviewException("ENSEMBL Rest API not available.");
}
- FileParse fp = getSequenceReader(ids);
- if (fp == null)
+ BufferedReader br = getSequenceReader(ids);
+ if (br == null)
{
return alignment;
}
- FastaFile fr = new FastaFile(fp);
- if (fr.hasWarningMessage())
+ List<SequenceI> seqs = parseSequenceJson(br);
+
+ if (seqs.isEmpty())
{
- System.out.println(
- String.format("Warning when retrieving %d ids %s\n%s",
- ids.size(), ids.toString(), fr.getWarningMessage()));
+ throw new IOException("No data returned for " + ids);
}
- else if (fr.getSeqs().size() != ids.size())
+
+ if (seqs.size() != ids.size())
{
System.out.println(String.format(
"Only retrieved %d sequences for %d query strings",
- fr.getSeqs().size(), ids.size()));
+ seqs.size(), ids.size()));
}
- if (fr.getSeqs().size() == 1 && fr.getSeqs().get(0).getLength() == 0)
+ if (!seqs.isEmpty())
{
- /*
- * POST request has returned an empty FASTA file e.g. for invalid id
- */
- throw new IOException("No data returned for " + ids);
- }
-
- if (fr.getSeqs().size() > 0)
- {
- AlignmentI seqal = new Alignment(fr.getSeqsAsArray());
- for (SequenceI sq : seqal.getSequences())
+ AlignmentI seqal = new Alignment(
+ seqs.toArray(new SequenceI[seqs.size()]));
+ for (SequenceI seq : seqs)
{
- if (sq.getDescription() == null)
+ if (seq.getDescription() == null)
{
- sq.setDescription(getDbName());
+ seq.setDescription(getDbName());
}
- String name = sq.getName();
+ String name = seq.getName();
if (ids.contains(name)
|| ids.contains(name.replace("ENSP", "ENST")))
{
- DBRefEntry dbref = DBRefUtils.parseToDbRef(sq, getDbSource(),
+ // TODO JAL-3077 use true accession version in dbref
+ DBRefEntry dbref = DBRefUtils.parseToDbRef(seq, getDbSource(),
getEnsemblDataVersion(), name);
- sq.addDBRef(dbref);
+ seq.addDBRef(dbref);
}
}
if (alignment == null)
}
/**
+ * Parses a JSON response into a list of sequences
+ *
+ * @param br
+ * @return
+ * @see http://rest.ensembl.org/documentation/info/sequence_id
+ */
+ protected List<SequenceI> parseSequenceJson(BufferedReader br)
+ {
+ JSONParser jp = new JSONParser();
+ List<SequenceI> result = new ArrayList<>();
+ try
+ {
+ /*
+ * for now, assumes only one sequence returned; refactor if needed
+ * in future to handle a JSONArray with more than one
+ */
+ final JSONObject val = (JSONObject) jp.parse(br);
+ Object s = val.get("desc");
+ String desc = s == null ? null : s.toString();
+ s = val.get("id");
+ String id = s == null ? null : s.toString();
+ s = val.get("seq");
+ String seq = s == null ? null : s.toString();
+ Sequence sequence = new Sequence(id, seq);
+ if (desc != null)
+ {
+ sequence.setDescription(desc);
+ }
+ // todo JAL-3077 make a DBRefEntry with true accession version
+ // s = val.get("version");
+ // String version = s == null ? "0" : s.toString();
+ // DBRefEntry dbref = new DBRefEntry(getDbSource(), version, id);
+ // sequence.addDBRef(dbref);
+ result.add(sequence);
+ } catch (ParseException | IOException e)
+ {
+ System.err.println("Error processing JSON response: " + e.toString());
+ // ignore
+ }
+ return result;
+ }
+
+ /**
* Returns the URL for the REST call
*
* @return
}
// @see https://github.com/Ensembl/ensembl-rest/wiki/Output-formats
urlstring.append("?type=").append(getSourceEnsemblType().getType());
- urlstring.append(("&Accept=text/x-fasta"));
+ urlstring.append(("&Accept=application/json"));
+ urlstring.append(("&Content-Type=application/json"));
String objectType = getObjectType();
if (objectType != null)
return false;
}
- @Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return multipleIds ? "application/json" : "text/x-fasta";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "text/x-fasta";
- }
-
/**
*
* @return the configured sequence return type for this source
protected MapList getGenomicRangesFromFeatures(SequenceI sourceSequence,
String accId, int start)
{
- List<SequenceFeature> sfs = sourceSequence.getFeatures()
- .getPositionalFeatures();
+ List<SequenceFeature> sfs = getIdentifyingFeatures(sourceSequence,
+ accId);
if (sfs.isEmpty())
{
return null;
for (SequenceFeature sf : sfs)
{
+ int strand = sf.getStrand();
+ strand = strand == 0 ? 1 : strand; // treat unknown as forward
+
+ if (directionSet && strand != direction)
+ {
+ // abort - mix of forward and backward
+ System.err
+ .println("Error: forward and backward strand for " + accId);
+ return null;
+ }
+ direction = strand;
+ directionSet = true;
+
/*
- * accept the target feature type or a specialisation of it
- * (e.g. coding_exon for exon)
+ * add to CDS ranges, semi-sorted forwards/backwards
*/
- if (identifiesSequence(sf, accId))
+ if (strand < 0)
{
- int strand = sf.getStrand();
- strand = strand == 0 ? 1 : strand; // treat unknown as forward
-
- if (directionSet && strand != direction)
- {
- // abort - mix of forward and backward
- System.err.println(
- "Error: forward and backward strand for " + accId);
- return null;
- }
- direction = strand;
- directionSet = true;
-
- /*
- * add to CDS ranges, semi-sorted forwards/backwards
- */
- if (strand < 0)
- {
- regions.add(0, new int[] { sf.getEnd(), sf.getBegin() });
- }
- else
- {
- regions.add(new int[] { sf.getBegin(), sf.getEnd() });
- }
- mappedLength += Math.abs(sf.getEnd() - sf.getBegin() + 1);
-
- if (!isSpliceable())
- {
- /*
- * 'gene' sequence is contiguous so we can stop as soon as its
- * identifying feature has been found
- */
- break;
- }
+ regions.add(0, new int[] { sf.getEnd(), sf.getBegin() });
+ }
+ else
+ {
+ regions.add(new int[] { sf.getBegin(), sf.getEnd() });
}
+ mappedLength += Math.abs(sf.getEnd() - sf.getBegin() + 1);
}
if (regions.isEmpty())
}
/**
- * Answers true if the sequence being retrieved may occupy discontiguous
- * regions on the genomic sequence.
- */
- protected boolean isSpliceable()
- {
- return true;
- }
-
- /**
- * Returns true if the sequence feature marks positions of the genomic
+ * Answers a list of sequence features that mark positions of the genomic
* sequence feature which are within the sequence being retrieved. For
* example, an 'exon' feature whose parent is the target transcript marks the
- * cdna positions of the transcript.
+ * cdna positions of the transcript. For a gene sequence, this is trivially
+ * just the 'gene' feature with matching gene id.
*
- * @param sf
+ * @param seq
* @param accId
* @return
*/
- protected abstract boolean identifiesSequence(SequenceFeature sf,
- String accId);
+ protected abstract List<SequenceFeature> getIdentifyingFeatures(
+ SequenceI seq, String accId);
/**
* Transfers the sequence feature to the target sequence, locating its start
return true;
}
- @Override
- protected String getRequestMimeType(boolean multipleIds)
- {
- return "application/json";
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return "application/json";
- }
-
/**
* Calls the Ensembl xrefs REST endpoint and retrieves any cross-references
* ("primary_id") for the given identifier (Ensembl accession id) and database
*/
public List<DBRefEntry> getCrossReferences(String identifier)
{
- List<DBRefEntry> result = new ArrayList<DBRefEntry>();
- List<String> ids = new ArrayList<String>();
+ List<DBRefEntry> result = new ArrayList<>();
+ List<String> ids = new ArrayList<>();
ids.add(identifier);
BufferedReader br = null;
throws IOException
{
JSONParser jp = new JSONParser();
- List<DBRefEntry> result = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> result = new ArrayList<>();
try
{
JSONArray responses = (JSONArray) jp.parse(br);
import jalview.datamodel.SequenceI;
import jalview.gui.ColourMenuHelper.ColourChangeListener;
import jalview.gui.ViewSelectionMenu.ViewSetProvider;
-import jalview.hmmer.HMMAlign;
-import jalview.hmmer.HMMBuild;
-import jalview.hmmer.HMMERParamStore;
-import jalview.hmmer.HMMERPreset;
-import jalview.hmmer.HMMSearch;
-import jalview.hmmer.HmmerCommand;
import jalview.io.AlignmentProperties;
import jalview.io.AnnotationFile;
import jalview.io.BioJsHTMLOutput;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
-import jalview.ws.params.ArgumentI;
-import jalview.ws.params.ParamDatastoreI;
-import jalview.ws.params.WsParamSetI;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.io.File;
import java.io.FileWriter;
-import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Deque;
-import java.util.HashSet;
+import java.util.Enumeration;
+import java.util.Hashtable;
import java.util.List;
-import java.util.Set;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
-import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
public class AlignFrame extends GAlignFrame implements DropTargetListener,
IProgressIndicator, AlignViewControllerGuiI, ColourChangeListener
{
+
public static final int DEFAULT_WIDTH = 700;
public static final int DEFAULT_HEIGHT = 500;
*/
String fileName = null;
-
/**
* Creates a new AlignFrame object with specific width and height.
*
ap.av.updateConservation(ap);
ap.av.updateConsensus(ap);
ap.av.updateStrucConsensus(ap);
- ap.av.initInformationWorker(ap);
}
}
showConsensusHistogram.setSelected(av.isShowConsensusHistogram());
showSequenceLogo.setSelected(av.isShowSequenceLogo());
normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo());
- showInformationHistogram.setSelected(av.isShowInformationHistogram());
- showHMMSequenceLogo.setSelected(av.isShowHMMSequenceLogo());
- normaliseHMMSequenceLogo.setSelected(av.isNormaliseHMMSequenceLogo());
ColourMenuHelper.setColourSelected(colourMenu,
av.getGlobalColourScheme());
}
@Override
- public void hmmBuild_actionPerformed(boolean withDefaults)
- {
- if (!alignmentIsSufficient(1))
- {
- return;
- }
-
- /*
- * get default parameters, and optionally show a dialog
- * to allow them to be modified
- */
- ParamDatastoreI store = HMMERParamStore.forBuild(viewport);
- List<ArgumentI> args = store.getServiceParameters();
-
- if (!withDefaults)
- {
- WsParamSetI set = new HMMERPreset();
- WsJobParameters params = new WsJobParameters(store, set, args);
- if (params.showRunDialog())
- {
- args = params.getJobParams();
- }
- else
- {
- return; // user cancelled
- }
- }
- new Thread(new HMMBuild(this, args)).start();
- }
-
- @Override
- public void hmmAlign_actionPerformed(boolean withDefaults)
- {
- if (!(checkForHMM() && alignmentIsSufficient(2)))
- {
- return;
- }
-
- /*
- * get default parameters, and optionally show a dialog
- * to allow them to be modified
- */
- ParamDatastoreI store = HMMERParamStore.forAlign(viewport);
- List<ArgumentI> args = store.getServiceParameters();
-
- if (!withDefaults)
- {
- WsParamSetI set = new HMMERPreset();
- WsJobParameters params = new WsJobParameters(store, set, args);
- if (params.showRunDialog())
- {
- args = params.getJobParams();
- }
- else
- {
- return; // user cancelled
- }
- }
- new Thread(new HMMAlign(this, args)).start();
- }
-
- @Override
- public void hmmSearch_actionPerformed(boolean withDefaults)
- {
- if (!checkForHMM())
- {
- return;
- }
-
- /*
- * get default parameters, and (if requested) show
- * dialog to allow modification
- */
- ParamDatastoreI store = HMMERParamStore.forSearch(viewport);
- List<ArgumentI> args = store.getServiceParameters();
-
- if (!withDefaults)
- {
- WsParamSetI set = new HMMERPreset();
- WsJobParameters params = new WsJobParameters(store, set, args);
- if (params.showRunDialog())
- {
- args = params.getJobParams();
- }
- else
- {
- return; // user cancelled
- }
- }
- new Thread(new HMMSearch(this, args)).start();
- alignPanel.repaint();
- }
-
- /**
- * Checks if the alignment has at least one hidden Markov model, if not shows
- * a dialog advising to run hmmbuild or load an HMM profile
- *
- * @return
- */
- private boolean checkForHMM()
- {
- if (viewport.getAlignment().getHmmSequences().isEmpty())
- {
- JOptionPane.showMessageDialog(this,
- MessageManager.getString("warn.no_hmm"));
- return false;
- }
- return true;
- }
-
- /**
- * Checks if the alignment contains the required number of sequences.
- *
- * @param required
- * @return
- */
- public boolean alignmentIsSufficient(int required)
- {
- if (getViewport().getAlignment().getSequences().size() < required)
- {
- JOptionPane.showMessageDialog(this,
- MessageManager.getString("label.not_enough_sequences"));
- return false;
- }
- return true;
- }
-
- /**
- * Opens a file browser and adds the selected file, if in Fasta, Stockholm or
- * Pfam format, to the list held under preference key "HMMSEARCH_DBS" (as a
- * comma-separated list)
- */
- @Override
- public void addDatabase_actionPerformed() throws IOException
- {
- if (Cache.getProperty(Preferences.HMMSEARCH_DBS) == null)
- {
- Cache.setProperty(Preferences.HMMSEARCH_DBS, "");
- }
-
- String path = openFileChooser(false);
- if (path != null && new File(path).exists())
- {
- IdentifyFile identifier = new IdentifyFile();
- FileFormatI format = identifier.identify(path, DataSourceType.FILE);
- if (format == FileFormat.Fasta || format == FileFormat.Stockholm
- || format == FileFormat.Pfam)
- {
- String currentDbPaths = Cache
- .getProperty(Preferences.HMMSEARCH_DBS);
- currentDbPaths += Preferences.COMMA + path;
- Cache.setProperty(Preferences.HMMSEARCH_DBS, currentDbPaths);
- }
- else
- {
- JOptionPane.showMessageDialog(this,
- MessageManager.getString("warn.invalid_format"));
- }
- }
- }
-
- /**
- * Opens a file chooser, optionally restricted to selecting folders
- * (directories) only. Answers the path to the selected file or folder, or
- * null if none is chosen.
- *
- * @param
- * @return
- */
- protected String openFileChooser(boolean forFolder)
- {
- // TODO duplicates GPreferences method - relocate to JalviewFileChooser?
- String choice = null;
- JFileChooser chooser = new JFileChooser();
- if (forFolder)
- {
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
- chooser.setDialogTitle(
- MessageManager.getString("label.open_local_file"));
- chooser.setToolTipText(MessageManager.getString("action.open"));
-
- int value = chooser.showOpenDialog(this);
-
- if (value == JFileChooser.APPROVE_OPTION)
- {
- choice = chooser.getSelectedFile().getPath();
- }
- return choice;
- }
-
- @Override
public void reload_actionPerformed(ActionEvent e)
{
if (fileName != null)
@Override
public void associatedData_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
// Pick the tree file
JalviewFileChooser chooser = new JalviewFileChooser(
*
* @param e
* DOCUMENT ME!
- * @throws InterruptedException
- * @throws IOException
*/
@Override
protected void pasteNew_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
paste(true);
}
*
* @param e
* DOCUMENT ME!
- * @throws InterruptedException
- * @throws IOException
*/
@Override
protected void pasteThis_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
paste(false);
}
*
* @param newAlignment
* true to paste to a new alignment, otherwise add to this.
- * @throws InterruptedException
- * @throws IOException
*/
- void paste(boolean newAlignment) throws IOException, InterruptedException
+ void paste(boolean newAlignment)
{
boolean externalPaste = true;
try
System.out.println("Exception whilst pasting: " + ex);
// could be anything being pasted in here
}
+
}
@Override
}
if (viewport.getAlignment().getAlignmentAnnotation()
- .hashCode() == _annotationScoreVectorHash)
+ .hashCode() != _annotationScoreVectorHash)
{
- return;
- }
-
- sortByAnnotScore.removeAll();
- Set<String> scoreSorts = new HashSet<>();
- for (SequenceI sqa : viewport.getAlignment().getSequences())
- {
- AlignmentAnnotation[] anns = sqa.getAnnotation();
- for (int i = 0; anns != null && i < anns.length; i++)
+ sortByAnnotScore.removeAll();
+ // almost certainly a quicker way to do this - but we keep it simple
+ Hashtable scoreSorts = new Hashtable();
+ AlignmentAnnotation aann[];
+ for (SequenceI sqa : viewport.getAlignment().getSequences())
{
- AlignmentAnnotation aa = anns[i];
- if (aa != null && aa.hasScore() && aa.sequenceRef != null)
+ aann = sqa.getAnnotation();
+ for (int i = 0; aann != null && i < aann.length; i++)
{
- scoreSorts.add(aa.label);
+ if (aann[i].hasScore() && aann[i].sequenceRef != null)
+ {
+ scoreSorts.put(aann[i].label, aann[i].label);
+ }
}
}
- }
- for (String label : scoreSorts)
- {
- addSortByAnnotScoreMenuItem(sortByAnnotScore, label);
- }
- sortByAnnotScore.setVisible(!scoreSorts.isEmpty());
+ Enumeration labels = scoreSorts.keys();
+ while (labels.hasMoreElements())
+ {
+ addSortByAnnotScoreMenuItem(sortByAnnotScore,
+ (String) labels.nextElement());
+ }
+ sortByAnnotScore.setVisible(scoreSorts.size() > 0);
+ scoreSorts.clear();
- _annotationScoreVectorHash = viewport.getAlignment()
- .getAlignmentAnnotation().hashCode();
+ _annotationScoreVectorHash = viewport.getAlignment()
+ .getAlignmentAnnotation().hashCode();
+ }
}
/**
*
* @param file
* either a filename or a URL string.
- * @throws InterruptedException
- * @throws IOException
*/
public void loadJalviewDataFile(String file, DataSourceType sourceType,
FileFormatI format, SequenceI assocSeq)
}
if (isAnnotation)
{
+
alignPanel.adjustAnnotationHeight();
viewport.updateSequenceIdColours();
buildSortByAnnotationScoresMenu();
}
}
- /**
- * Sets the status of the HMMER menu
- */
- public void updateHMMERStatus()
- {
- hmmerMenu.setEnabled(HmmerCommand.isHmmerAvailable());
- }
-
@Override
protected void loadVcf_actionPerformed()
{
private AnnotationColumnChooser annotationColumnSelectionState;
- boolean validCharWidth;
-
- public boolean followSelection = true;
-
- private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<>();
-
/**
* Creates a new AlignViewport object.
*
setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
- AlignmentI al = getAlignment();
- al.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
+ alignment
+ .setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
// We must set conservation and consensus before setting colour,
// as Blosum and Clustal require this to be done
- if (consensusProfiles == null && !isDataset)
+ if (hconsensus == null && !isDataset)
{
- if (!al.isNucleotide())
+ if (!alignment.isNucleotide())
{
showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
showQuality = Cache.getDefault("SHOW_QUALITY", true);
showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
false);
- // for now, use consensus options for Information till it gets its own
- setShowHMMSequenceLogo(showSequenceLogo);
- setNormaliseHMMSequenceLogo(normaliseSequenceLogo);
- setShowInformationHistogram(showConsensusHistogram);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true);
}
initAutoAnnotation();
- // initInformation();
-
- String colourProperty = al.isNucleotide()
+ String colourProperty = alignment.isNucleotide()
? Preferences.DEFAULT_COLOUR_NUC
: Preferences.DEFAULT_COLOUR_PROT;
String schemeName = Cache.getProperty(colourProperty);
ResidueColourScheme.NONE);
}
ColourSchemeI colourScheme = ColourSchemeProperty
- .getColourScheme(al, schemeName);
+ .getColourScheme(alignment, schemeName);
residueShading = new ResidueShader(colourScheme);
if (colourScheme instanceof UserColourScheme)
if (residueShading != null)
{
- residueShading.setConsensus(consensusProfiles);
+ residueShading.setConsensus(hconsensus);
}
}
+ boolean validCharWidth;
+
/**
* {@inheritDoc}
*/
/*
* replace mappings on our alignment
*/
- if (getAlignment() != null && align != null)
+ if (alignment != null && align != null)
{
- getAlignment().setCodonFrames(align.getCodonFrames());
+ alignment.setCodonFrames(align.getCodonFrames());
}
}
}
/**
- * Returns an iterator over the visible column regions of the alignment
+ * returns the visible column regions of the alignment
*
* @param selectedRegionOnly
* true to just return the contigs intersecting with the selected
}
else
{
- end = getAlignment().getWidth();
+ end = alignment.getWidth();
}
-
- return getAlignment().getHiddenColumns().getVisContigsIterator(start,
- end, false);
+ return (alignment.getHiddenColumns().getVisContigsIterator(start, end,
+ false));
}
/**
return false;
}
+ public boolean followSelection = true;
+
/**
* @return true if view selection should always follow the selections
* broadcast by other selection sources
.getStructureSelectionManager(Desktop.instance);
}
+ @Override
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ public void setNormaliseSequenceLogo(boolean state)
+ {
+ normaliseSequenceLogo = state;
+ }
+
/**
*
* @return true if alignment characters should be displayed
return validCharWidth;
}
+ private Hashtable<String, AutoCalcSetting> calcIdParams = new Hashtable<>();
+
public AutoCalcSetting getCalcIdSettingsFor(String calcId)
{
return calcIdParams.get(calcId);
}
fr.setTransparency(featureSettings.getTransparency());
}
-
}
import jalview.util.Comparison;
import jalview.util.MessageManager;
import jalview.util.Platform;
-import jalview.workers.InformationThread;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
pop.show(this, evt.getX(), evt.getY());
return;
}
-
- final AlignmentAnnotation ann = aa[selectedRow];
- final boolean isSequenceAnnotation = ann.sequenceRef != null;
-
item = new JMenuItem(EDITNAME);
item.addActionListener(this);
pop.add(item);
// JAL-1264 hide all sequence-specific annotations of this type
if (selectedRow < aa.length)
{
- if (isSequenceAnnotation)
+ if (aa[selectedRow].sequenceRef != null)
{
- final String label = ann.label;
+ final String label = aa[selectedRow].label;
JMenuItem hideType = new JMenuItem();
String text = MessageManager.getString("label.hide_all") + " "
+ label;
AlignmentUtils.showOrHideSequenceAnnotations(
ap.av.getAlignment(), Collections.singleton(label),
null, false, false);
+ // for (AlignmentAnnotation ann : ap.av.getAlignment()
+ // .getAlignmentAnnotation())
+ // {
+ // if (ann.sequenceRef != null && ann.label != null
+ // && ann.label.equals(label))
+ // {
+ // ann.visible = false;
+ // }
+ // }
ap.refresh(true);
}
});
// property methods
if (selectedRow < aa.length)
{
- final String label = ann.label;
- if (!(ann.autoCalculated)
- && !(InformationThread.HMM_CALC_ID.equals(ann.getCalcId())))
+ final String label = aa[selectedRow].label;
+ if (!aa[selectedRow].autoCalculated)
{
- if (ann.graph == AlignmentAnnotation.NO_GRAPH)
+ if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH)
{
// display formatting settings for this row.
pop.addSeparator();
// av and sequencegroup need to implement same interface for
item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE,
- ann.scaleColLabel);
+ aa[selectedRow].scaleColLabel);
item.addActionListener(this);
pop.add(item);
}
}
else if (label.indexOf("Consensus") > -1)
{
- addConsensusMenu(pop, ann);
- }
- else if (InformationThread.HMM_CALC_ID.equals(ann.getCalcId()))
- {
- addHmmerMenu(pop, ann);
- }
- }
- pop.show(this, evt.getX(), evt.getY());
- }
-
- /**
- * Adds context menu options for (alignment or group) Hmmer annotation
- *
- * @param pop
- * @param ann
- */
- protected void addHmmerMenu(JPopupMenu pop, final AlignmentAnnotation ann)
- {
- final boolean isGroupAnnotation = ann.groupRef != null;
- pop.addSeparator();
- final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
- MessageManager.getString(
- "label.ignore_below_background_frequency"),
- isGroupAnnotation
- ? ann.groupRef
- .isIgnoreBelowBackground()
- : ap.av.isIgnoreBelowBackground());
- cbmi.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (isGroupAnnotation)
+ pop.addSeparator();
+ // av and sequencegroup need to implement same interface for
+ final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
+ MessageManager.getString("label.ignore_gaps_consensus"),
+ (aa[selectedRow].groupRef != null)
+ ? aa[selectedRow].groupRef.getIgnoreGapsConsensus()
+ : ap.av.isIgnoreGapsConsensus());
+ final AlignmentAnnotation aaa = aa[selectedRow];
+ cbmi.addActionListener(new ActionListener()
{
- if (!ann.groupRef.isUseInfoLetterHeight())
+ @Override
+ public void actionPerformed(ActionEvent e)
{
- ann.groupRef.setIgnoreBelowBackground(cbmi.getState());
- // todo and recompute group annotation
+ if (aaa.groupRef != null)
+ {
+ // TODO: pass on reference to ap so the view can be updated.
+ aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState());
+ ap.getAnnotationPanel()
+ .paint(ap.getAnnotationPanel().getGraphics());
+ }
+ else
+ {
+ ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
+ }
+ ap.alignmentChanged();
}
- }
- else if (!ap.av.isInfoLetterHeight())
- {
- ap.av.setIgnoreBelowBackground(cbmi.getState(), ap);
- // todo and recompute annotation
- }
- ap.alignmentChanged(); // todo not like this
- }
- });
- pop.add(cbmi);
- final JCheckBoxMenuItem letterHeight = new JCheckBoxMenuItem(
- MessageManager.getString("label.use_info_for_height"),
- isGroupAnnotation ? ann.groupRef.isUseInfoLetterHeight()
- : ap.av.isInfoLetterHeight());
- letterHeight.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (isGroupAnnotation)
- {
- ann.groupRef.setInfoLetterHeight((letterHeight.getState()));
- ann.groupRef.setIgnoreBelowBackground(true);
- // todo and recompute group annotation
- }
- else
- {
- ap.av.setInfoLetterHeight(letterHeight.getState(), ap);
- ap.av.setIgnoreBelowBackground(true, ap);
- // todo and recompute annotation
- }
- ap.alignmentChanged();
- }
- });
- pop.add(letterHeight);
- if (isGroupAnnotation)
- {
- final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_group_histogram"),
- ann.groupRef.isShowInformationHistogram());
- chist.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef.setShowInformationHistogram(chist.getState());
- ap.repaint();
- }
- });
- pop.add(chist);
- final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_group_logo"),
- ann.groupRef.isShowHMMSequenceLogo());
- cprofl.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef.setShowHMMSequenceLogo(cprofl.getState());
- ap.repaint();
- }
- });
- pop.add(cprofl);
- final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
- MessageManager.getString("label.normalise_group_logo"),
- ann.groupRef.isNormaliseHMMSequenceLogo());
- cproflnorm.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef
- .setNormaliseHMMSequenceLogo(cproflnorm.getState());
- // automatically enable logo display if we're clicked
- ann.groupRef.setShowHMMSequenceLogo(true);
- ap.repaint();
- }
- });
- pop.add(cproflnorm);
- }
- else
- {
- final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_histogram"),
- av.isShowInformationHistogram());
- chist.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.setShowInformationHistogram(chist.getState());
- ap.repaint();
- }
- });
- pop.add(chist);
- final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_logo"),
- av.isShowHMMSequenceLogo());
- cprof.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.setShowHMMSequenceLogo(cprof.getState());
- ap.repaint();
- }
- });
- pop.add(cprof);
- final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
- MessageManager.getString("label.normalise_logo"),
- av.isNormaliseHMMSequenceLogo());
- cprofnorm.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
+ });
+ pop.add(cbmi);
+ // av and sequencegroup need to implement same interface for
+ if (aaa.groupRef != null)
{
- av.setShowHMMSequenceLogo(true);
- av.setNormaliseHMMSequenceLogo(cprofnorm.getState());
- ap.repaint();
- }
- });
- pop.add(cprofnorm);
- }
- }
+ final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_group_histogram"),
+ aa[selectedRow].groupRef.isShowConsensusHistogram());
+ chist.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setShowConsensusHistogram(chist.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(chist);
+ final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_group_logo"),
+ aa[selectedRow].groupRef.isShowSequenceLogo());
+ cprofl.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setshowSequenceLogo(cprofl.getState());
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofl);
+ final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_group_logo"),
+ aa[selectedRow].groupRef.isNormaliseSequenceLogo());
+ cproflnorm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
- /**
- * Adds context menu options for (alignment or group) Consensus annotation
- *
- * @param pop
- * @param ann
- */
- protected void addConsensusMenu(JPopupMenu pop,
- final AlignmentAnnotation ann)
- {
- final boolean isGroupAnnotation = ann.groupRef != null;
- pop.addSeparator();
-
- final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem(
- MessageManager.getString("label.ignore_gaps_consensus"),
- (ann.groupRef != null)
- ? ann.groupRef.isIgnoreGapsConsensus()
- : ap.av.isIgnoreGapsConsensus());
- cbmi.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- if (isGroupAnnotation)
- {
- ann.groupRef.setIgnoreGapsConsensus(cbmi.getState());
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
+ // automatically enable logo display if we're clicked
+ aaa.groupRef.setshowSequenceLogo(true);
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cproflnorm);
}
else
{
- ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap);
+ final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_histogram"),
+ av.isShowConsensusHistogram());
+ chist.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowConsensusHistogram(chist.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(chist);
+ final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
+ MessageManager.getString("label.show_logo"),
+ av.isShowSequenceLogo());
+ cprof.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowSequenceLogo(cprof.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprof);
+ final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+ MessageManager.getString("label.normalise_logo"),
+ av.isNormaliseSequenceLogo());
+ cprofnorm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowSequenceLogo(true);
+ av.setNormaliseSequenceLogo(cprofnorm.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofnorm);
}
- ap.alignmentChanged();
+ final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
+ consclipbrd.addActionListener(this);
+ pop.add(consclipbrd);
}
- });
- pop.add(cbmi);
- if (isGroupAnnotation)
- {
- /*
- * group consensus options
- */
- final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_group_histogram"),
- ann.groupRef.isShowConsensusHistogram());
- chist.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef.setShowConsensusHistogram(chist.getState());
- ap.repaint();
- }
- });
- pop.add(chist);
- final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_group_logo"),
- ann.groupRef.isShowSequenceLogo());
- cprofl.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef.setshowSequenceLogo(cprofl.getState());
- ap.repaint();
- }
- });
- pop.add(cprofl);
- final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
- MessageManager.getString("label.normalise_group_logo"),
- ann.groupRef.isNormaliseSequenceLogo());
- cproflnorm.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- ann.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
- // automatically enable logo display if we're clicked
- ann.groupRef.setshowSequenceLogo(true);
- ap.repaint();
- }
- });
- pop.add(cproflnorm);
}
- else
- {
- /*
- * alignment consensus options
- */
- final JCheckBoxMenuItem chist = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_histogram"),
- av.isShowConsensusHistogram());
- chist.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.setShowConsensusHistogram(chist.getState());
- ap.repaint();
- }
- });
- pop.add(chist);
- final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem(
- MessageManager.getString("label.show_logo"),
- av.isShowSequenceLogo());
- cprof.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.setShowSequenceLogo(cprof.getState());
- ap.repaint();
- }
- });
- pop.add(cprof);
- final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
- MessageManager.getString("label.normalise_logo"),
- av.isNormaliseSequenceLogo());
- cprofnorm.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- av.setShowSequenceLogo(true);
- av.setNormaliseSequenceLogo(cprofnorm.getState());
- ap.repaint();
- }
- });
- pop.add(cprofnorm);
- }
- final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
- consclipbrd.addActionListener(this);
- pop.add(consclipbrd);
+ pop.show(this, evt.getX(), evt.getY());
}
/**
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId());
ap.av.sendSelection();
}
+
}
}
return;
@Override
public void paintComponent(Graphics g)
{
+
int width = getWidth();
if (width == 0)
{
}
drawComponent(g2, true, width);
+
}
/**
import jalview.analysis.TreeBuilder;
import jalview.analysis.scoremodels.ScoreModels;
import jalview.analysis.scoremodels.SimilarityParams;
-import jalview.api.AlignViewportI;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
import jalview.datamodel.SequenceGroup;
import jalview.util.MessageManager;
-import jalview.viewmodel.AlignmentViewport;
import java.awt.BorderLayout;
import java.awt.Color;
final ComboBoxTooltipRenderer renderer = new ComboBoxTooltipRenderer();
- List<String> tips = new ArrayList<>();
+ List<String> tips = new ArrayList<String>();
/*
* the most recently opened PCA results panel
*/
protected JComboBox<String> buildModelOptionsList()
{
- final JComboBox<String> scoreModelsCombo = new JComboBox<>();
+ final JComboBox<String> scoreModelsCombo = new JComboBox<String>();
scoreModelsCombo.setRenderer(renderer);
/*
{
Object curSel = comboBox.getSelectedItem();
toolTips.clear();
- DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
+ DefaultComboBoxModel<String> model = new DefaultComboBoxModel<String>();
/*
* now we can actually add entries to the combobox,
* gui validation shouldn't allow insufficient sequences here, but leave
* this check in in case this method gets exposed programmatically in future
*/
- AlignViewportI viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
SequenceGroup sg = viewport.getSelectionGroup();
if (sg != null && sg.getSize() < MIN_TREE_SELECTION)
{
*/
protected void openPcaPanel(String modelName, SimilarityParamsI params)
{
- AlignViewportI viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
/*
* gui validation shouldn't allow insufficient sequences here, but leave
*/
final String name = scheme.getSchemeName();
String label = MessageManager.getStringOrReturn(
- "label.colourScheme_", name.toLowerCase().replace(" ", "_"));
+ "label.colourScheme_" + name.toLowerCase().replace(" ", "_"),
+ name);
final JRadioButtonMenuItem radioItem = new JRadioButtonMenuItem(
label);
radioItem.setName(name);
return;
}
- AlignViewportI source = null;
- AlignViewportI target = null;
+ AlignmentViewport source = null, target = null;
if (frames[0] instanceof AlignFrame)
{
source = ((AlignFrame) frames[0]).getCurrentView();
import jalview.schemes.FeatureColour;
import jalview.util.MessageManager;
import jalview.util.Platform;
-import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean;
-import jalview.ws.DasSequenceFeatureFetcher;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import javax.help.HelpSetException;
import javax.swing.AbstractCellEditor;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
-import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.AbstractTableModel;
private static final int MIN_HEIGHT = 400;
- DasSourceBrowser dassourceBrowser;
-
- DasSequenceFeatureFetcher dasFeatureFetcher;
-
- JPanel dasSettingsPane = new JPanel();
-
final FeatureRenderer fr;
public final AlignFrame af;
// MessageManager.getString("label.feature_settings_click_drag")));
scrollPane.setViewportView(table);
- dassourceBrowser = new DasSourceBrowser(this);
- dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER);
-
if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder())
{
fr.findAllFeatures(true); // display everything!
javax.swing.event.InternalFrameEvent evt)
{
fr.removePropertyChangeListener(change);
- dassourceBrowser.fs = null;
};
});
frame.setLayer(JLayeredPane.PALETTE_LAYER);
JPanel settingsPane = new JPanel();
settingsPane.setLayout(new BorderLayout());
- dasSettingsPane.setLayout(new BorderLayout());
-
JPanel bigPanel = new JPanel();
bigPanel.setLayout(new BorderLayout());
transparency.setMaximum(70);
transparency.setToolTipText(
MessageManager.getString("label.transparency_tip"));
- fetchDAS.setText(MessageManager.getString("label.fetch_das_features"));
- fetchDAS.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- fetchDAS_actionPerformed(e);
- }
- });
- saveDAS.setText(MessageManager.getString("action.save_as_default"));
- saveDAS.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- saveDAS_actionPerformed(e);
- }
- });
-
- JPanel dasButtonPanel = new JPanel();
- dasButtonPanel.setBorder(BorderFactory.createEtchedBorder());
- dasSettingsPane.setBorder(null);
- cancelDAS.setEnabled(false);
- cancelDAS.setText(MessageManager.getString("action.cancel_fetch"));
- cancelDAS.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- cancelDAS_actionPerformed(e);
- }
- });
JPanel transPanel = new JPanel(new GridLayout(1, 2));
bigPanel.add(transPanel, BorderLayout.SOUTH);
buttonPanel.add(loadColours);
buttonPanel.add(saveColours);
bigPanel.add(scrollPane, BorderLayout.CENTER);
- dasSettingsPane.add(dasButtonPanel, BorderLayout.SOUTH);
- dasButtonPanel.add(fetchDAS);
- dasButtonPanel.add(cancelDAS);
- dasButtonPanel.add(saveDAS);
settingsPane.add(bigPanel, BorderLayout.CENTER);
settingsPane.add(buttonPanel, BorderLayout.SOUTH);
this.add(settingsPane);
}
- public void fetchDAS_actionPerformed(ActionEvent e)
- {
- fetchDAS.setEnabled(false);
- cancelDAS.setEnabled(true);
- dassourceBrowser.setGuiEnabled(false);
- Vector<jalviewSourceI> selectedSources = dassourceBrowser
- .getSelectedSources();
- doDasFeatureFetch(selectedSources, true, true);
- }
-
- /**
- * get the features from selectedSources for all or the current selection
- *
- * @param selectedSources
- * @param checkDbRefs
- * @param promptFetchDbRefs
- */
- private void doDasFeatureFetch(List<jalviewSourceI> selectedSources,
- boolean checkDbRefs, boolean promptFetchDbRefs)
- {
- SequenceI[] dataset, seqs;
- int iSize;
- AlignmentViewport vp = af.getViewport();
- if (vp.getSelectionGroup() != null
- && vp.getSelectionGroup().getSize() > 0)
- {
- iSize = vp.getSelectionGroup().getSize();
- dataset = new SequenceI[iSize];
- seqs = vp.getSelectionGroup().getSequencesInOrder(vp.getAlignment());
- }
- else
- {
- iSize = vp.getAlignment().getHeight();
- seqs = vp.getAlignment().getSequencesArray();
- }
-
- dataset = new SequenceI[iSize];
- for (int i = 0; i < iSize; i++)
- {
- dataset[i] = seqs[i].getDatasetSequence();
- }
-
- cancelDAS.setEnabled(true);
- dasFeatureFetcher = new jalview.ws.DasSequenceFeatureFetcher(dataset,
- this, selectedSources, checkDbRefs, promptFetchDbRefs);
- af.getViewport().setShowSequenceFeatures(true);
- af.showSeqFeatures.setSelected(true);
- }
-
- /**
- * blocking call to initialise the das source browser
- */
- public void initDasSources()
- {
- dassourceBrowser.initDasSources();
- }
-
- /**
- * examine the current list of das sources and return any matching the given
- * nicknames in sources
- *
- * @param sources
- * Vector of Strings to resolve to DAS source nicknames.
- * @return sources that are present in source list.
- */
- public List<jalviewSourceI> resolveSourceNicknames(Vector<String> sources)
- {
- return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
- }
-
- /**
- * get currently selected das sources. ensure you have called initDasSources
- * before calling this.
- *
- * @return vector of selected das source nicknames
- */
- public Vector<jalviewSourceI> getSelectedSources()
- {
- return dassourceBrowser.getSelectedSources();
- }
-
- /**
- * properly initialise DAS fetcher and then initiate a new thread to fetch
- * features from the named sources (rather than any turned on by default)
- *
- * @param sources
- * @param block
- * if true then runs in same thread, otherwise passes to the Swing
- * executor
- */
- public void fetchDasFeatures(Vector<String> sources, boolean block)
- {
- initDasSources();
- List<jalviewSourceI> resolved = dassourceBrowser.sourceRegistry
- .resolveSourceNicknames(sources);
- if (resolved.size() == 0)
- {
- resolved = dassourceBrowser.getSelectedSources();
- }
- if (resolved.size() > 0)
- {
- final List<jalviewSourceI> dassources = resolved;
- fetchDAS.setEnabled(false);
- // cancelDAS.setEnabled(true); doDasFetch does this.
- Runnable fetcher = new Runnable()
- {
-
- @Override
- public void run()
- {
- doDasFeatureFetch(dassources, true, false);
-
- }
- };
- if (block)
- {
- fetcher.run();
- }
- else
- {
- SwingUtilities.invokeLater(fetcher);
- }
- }
- }
-
- public void saveDAS_actionPerformed(ActionEvent e)
- {
- dassourceBrowser
- .saveProperties(jalview.bin.Cache.applicationProperties);
- }
-
- public void complete()
- {
- fetchDAS.setEnabled(true);
- cancelDAS.setEnabled(false);
- dassourceBrowser.setGuiEnabled(true);
-
- }
-
- public void cancelDAS_actionPerformed(ActionEvent e)
- {
- if (dasFeatureFetcher != null)
- {
- dasFeatureFetcher.cancel();
- }
- complete();
- }
-
- public void noDasSourceActive()
- {
- complete();
- JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
- MessageManager.getString("label.no_das_sources_selected_warn"),
- MessageManager.getString("label.no_das_sources_selected_title"),
- JvOptionPane.DEFAULT_OPTION, JvOptionPane.INFORMATION_MESSAGE);
- }
-
// ///////////////////////////////////////////////////////////////////////
// http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
// ///////////////////////////////////////////////////////////////////////
* if a numeric condition is selected, show the value range
* as a tooltip on the value input field
*/
- setPatternTooltip(filterBy, selectedCondition, patternField);
+ setNumericHints(filterBy, selectedCondition, patternField);
/*
* add remove button if filter is populated (non-empty pattern)
}
/**
- * If a numeric comparison condition is selected, retrieve the min-max range for
- * the value (score or attribute), and set it as a tooltip on the value file
+ * If a numeric comparison condition is selected, retrieves the min-max range
+ * for the value (score or attribute), and sets it as a tooltip on the value
+ * field. If the field is currently empty, then pre-populates it with
+ * <ul>
+ * <li>the minimum value, if condition is > or >=</li>
+ * <li>the maximum value, if condition is < or <=</li>
+ * </ul>
*
* @param attName
* @param selectedCondition
* @param patternField
*/
- private void setPatternTooltip(String attName,
+ private void setNumericHints(String attName,
Condition selectedCondition, JTextField patternField)
{
patternField.setToolTipText("");
float[] minMax = getMinMax(attName);
if (minMax != null)
{
- String tip = String.format("(%s - %s)",
- DECFMT_2_2.format(minMax[0]), DECFMT_2_2.format(minMax[1]));
+ String minFormatted = DECFMT_2_2.format(minMax[0]);
+ String maxFormatted = DECFMT_2_2.format(minMax[1]);
+ String tip = String.format("(%s - %s)", minFormatted, maxFormatted);
patternField.setToolTipText(tip);
+ if (patternField.getText().isEmpty())
+ {
+ if (selectedCondition == Condition.GE
+ || selectedCondition == Condition.GT)
+ {
+ patternField.setText(minFormatted);
+ }
+ else
+ {
+ if (selectedCondition == Condition.LE
+ || selectedCondition == Condition.LT)
+ {
+ patternField.setText(maxFormatted);
+ }
+ }
+ }
}
}
}
ItemListener listener = condCombo.getItemListeners()[0];
condCombo.removeItemListener(listener);
boolean condIsValid = false;
+
condCombo.removeAllItems();
for (Condition c : Condition.values())
{
- if ((c.isNumeric() && type != Datatype.Character)
+ if ((c.isNumeric() && type == Datatype.Number)
|| (!c.isNumeric() && type != Datatype.Number))
{
condCombo.addItem(c);
condCombo.setSelectedIndex(0);
}
- condCombo.addItemListener(listener);
-
/*
* clear pattern if it is now invalid for condition
*/
patternField.setText("");
}
}
+
+ /*
+ * restore the listener
+ */
+ condCombo.addItemListener(listener);
}
/**
Condition cond = (Condition) condCombo.getSelectedItem();
String pattern = valueField.getText().trim();
- setPatternTooltip(attName, cond, valueField);
+ setNumericHints(attName, cond, valueField);
if (pattern.length() == 0 && cond.needsAPattern())
{
*/
package jalview.gui;
-import jalview.bin.Cache;
import jalview.util.MessageManager;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.Vector;
import javax.swing.JButton;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
lstners.remove(actionListener);
}
- public static void main(String args[])
- {
- Cache.getDasSourceRegistry();
- JDatabaseTree jdt = new JDatabaseTree(new jalview.ws.SequenceFetcher());
- JFrame foo = new JFrame();
- foo.setLayout(new BorderLayout());
- foo.add(jdt.getDatabaseSelectorButton(), BorderLayout.CENTER);
- foo.pack();
- foo.setVisible(true);
- int nultimes = 5;
- final Thread us = Thread.currentThread();
- jdt.addActionListener(new ActionListener()
- {
-
- @Override
- public void actionPerformed(ActionEvent e)
- {
- us.interrupt();
- }
- });
- do
- {
- try
- {
- Thread.sleep(50);
- } catch (InterruptedException x)
- {
- nultimes--;
- if (!jdt.hasSelection())
- {
- System.out.println("No Selection");
- }
- else
- {
- System.out.println("Selection: " + jdt.getSelectedItem());
- int s = 1;
- for (DbSourceProxy pr : jdt.getSelectedSources())
- {
- System.out.println("Source " + s++ + ": " + pr.getDbName()
- + " (" + pr.getDbSource() + ") Version "
- + pr.getDbVersion() + ". Test:\t" + pr.getTestQuery());
- }
- System.out.println("Test queries: " + jdt.getExampleQueries());
- }
- }
- } while (nultimes > 0 && foo.isVisible());
- foo.setVisible(false);
- }
@Override
public void keyPressed(KeyEvent arg0)
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.GraphLine;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.RnaViewerModel;
import jalview.datamodel.SequenceFeature;
import jalview.gui.StructureViewer.ViewerType;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
-import jalview.io.HMMFile;
import jalview.renderer.ResidueShaderI;
import jalview.schemabinding.version2.AlcodMap;
import jalview.schemabinding.version2.AlcodonFrame;
import jalview.schemabinding.version2.AnnotationColours;
import jalview.schemabinding.version2.AnnotationElement;
import jalview.schemabinding.version2.CalcIdParam;
+import jalview.schemabinding.version2.Colour;
import jalview.schemabinding.version2.CompoundMatcher;
import jalview.schemabinding.version2.DBRef;
import jalview.schemabinding.version2.Features;
private static final String RNA_PREFIX = "rna_";
- private static final String HMMER_PREFIX = "hmmer_";
-
private static final String UTF_8 = "UTF-8";
// use this with nextCounter() to make unique names for entities
}
}
- /*
- * save sequence features
- * TODO: omit sequence features from each alignment view's
- * XML dump if we are storing dataset
- */
- List<SequenceFeature> sfs = jds.getSequenceFeatures();
+ // TODO: omit sequence features from each alignment view's XML dump if we
+ // are storing dataset
+ List<jalview.datamodel.SequenceFeature> sfs = jds
+ .getSequenceFeatures();
for (SequenceFeature sf : sfs)
{
- Features features = saveFeature(sf);
+ Features features = new Features();
+
+ features.setBegin(sf.getBegin());
+ features.setEnd(sf.getEnd());
+ features.setDescription(sf.getDescription());
+ features.setType(sf.getType());
+ features.setFeatureGroup(sf.getFeatureGroup());
+ features.setScore(sf.getScore());
+ if (sf.links != null)
+ {
+ for (int l = 0; l < sf.links.size(); l++)
+ {
+ OtherData keyValue = new OtherData();
+ keyValue.setKey("LINK_" + l);
+ keyValue.setValue(sf.links.elementAt(l).toString());
+ features.addOtherData(keyValue);
+ }
+ }
+ if (sf.otherDetails != null)
+ {
+ /*
+ * save feature attributes, which may be simple strings or
+ * map valued (have sub-attributes)
+ */
+ for (Entry<String, Object> entry : sf.otherDetails.entrySet())
+ {
+ String key = entry.getKey();
+ Object value = entry.getValue();
+ if (value instanceof Map<?, ?>)
+ {
+ for (Entry<String, Object> subAttribute : ((Map<String, Object>) value)
+ .entrySet())
+ {
+ OtherData otherData = new OtherData();
+ otherData.setKey(key);
+ otherData.setKey2(subAttribute.getKey());
+ otherData.setValue(subAttribute.getValue().toString());
+ features.addOtherData(otherData);
+ }
+ }
+ else
+ {
+ OtherData otherData = new OtherData();
+ otherData.setKey(key);
+ otherData.setValue(value.toString());
+ features.addOtherData(otherData);
+ }
+ }
+ }
+
jseq.addFeatures(features);
}
- /*
- * save PDB entries for sequence
- */
if (jdatasq.getAllPDBEntries() != null)
{
- Enumeration<PDBEntry> en = jdatasq.getAllPDBEntries().elements();
+ Enumeration en = jdatasq.getAllPDBEntries().elements();
while (en.hasMoreElements())
{
Pdbids pdb = new Pdbids();
- PDBEntry entry = en.nextElement();
+ jalview.datamodel.PDBEntry entry = (jalview.datamodel.PDBEntry) en
+ .nextElement();
String pdbId = entry.getId();
pdb.setId(pdbId);
saveRnaViewers(jout, jseq, jds, viewIds, ap, storeDS);
- if (jds.hasHMMProfile())
- {
- saveHmmerProfile(jout, jseq, jds);
- }
-
jms.addJSeq(jseq);
}
jGroup.setTextCol2(sg.textColour2.getRGB());
jGroup.setTextColThreshold(sg.thresholdTextColour);
jGroup.setShowUnconserved(sg.getShowNonconserved());
- jGroup.setIgnoreGapsinConsensus(sg.isIgnoreGapsConsensus());
+ jGroup.setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus());
jGroup.setShowConsensusHistogram(sg.isShowConsensusHistogram());
jGroup.setShowSequenceLogo(sg.isShowSequenceLogo());
jGroup.setNormaliseSequenceLogo(sg.isNormaliseSequenceLogo());
}
/**
- * Saves the HMMER profile associated with the sequence as a file in the jar,
- * in HMMER format, and saves the name of the file as a child element of the
- * XML sequence element
- *
- * @param jout
- * @param xmlSeq
- * @param seq
- */
- protected void saveHmmerProfile(JarOutputStream jout, JSeq xmlSeq,
- SequenceI seq)
- {
- HiddenMarkovModel profile = seq.getHMM();
- if (profile == null)
- {
- warn("Want to save HMM profile for " + seq.getName()
- + " but none found");
- return;
- }
- HMMFile hmmFile = new HMMFile(profile);
- String hmmAsString = hmmFile.print();
- String jarEntryName = HMMER_PREFIX + nextCounter();
- try
- {
- writeJarEntry(jout, jarEntryName, hmmAsString.getBytes());
- xmlSeq.setHmmerProfile(jarEntryName);
- } catch (IOException e)
- {
- warn("Error saving HMM profile: " + e.getMessage());
- }
- }
-
- /**
- * Converts a Jalview SequenceFeature into the XML model of it to save
- *
- * @param sf
- * @return
- */
- protected Features saveFeature(SequenceFeature sf)
- {
- Features features = new Features();
-
- features.setBegin(sf.getBegin());
- features.setEnd(sf.getEnd());
- features.setDescription(sf.getDescription());
- features.setType(sf.getType());
- features.setFeatureGroup(sf.getFeatureGroup());
- features.setScore(sf.getScore());
- if (sf.links != null)
- {
- for (int l = 0; l < sf.links.size(); l++)
- {
- OtherData keyValue = new OtherData();
- keyValue.setKey("LINK_" + l);
- keyValue.setValue(sf.links.elementAt(l).toString());
- features.addOtherData(keyValue);
- }
- }
- if (sf.otherDetails != null)
- {
- /*
- * save feature attributes, which may be simple strings or
- * map valued (have sub-attributes)
- */
- for (Entry<String, Object> entry : sf.otherDetails.entrySet())
- {
- String key = entry.getKey();
- Object value = entry.getValue();
- if (value instanceof Map<?, ?>)
- {
- for (Entry<String, Object> subAttribute : ((Map<String, Object>) value)
- .entrySet())
- {
- OtherData otherData = new OtherData();
- otherData.setKey(key);
- otherData.setKey2(subAttribute.getKey());
- otherData.setValue(subAttribute.getValue().toString());
- features.addOtherData(otherData);
- }
- }
- else
- {
- OtherData otherData = new OtherData();
- otherData.setKey(key);
- otherData.setValue(value.toString());
- features.addOtherData(otherData);
- }
- }
- }
- return features;
- }
-
- /**
* Save any Varna viewers linked to this sequence. Writes an rnaViewer element
* for each viewer, with
* <ul>
}
else if (!matchedFile.equals(pdbentry.getFile()))
{
- warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
- + pdbentry.getFile());
+ Cache.log.warn(
+ "Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): "
+ + pdbentry.getFile());
}
// record the
// file so we
mpc.setDseqFor(jmpid);
if (!seqRefIds.containsKey(mpc.getDseqFor()))
{
- debug("creating new DseqFor ID");
+ jalview.bin.Cache.log.debug("creatign new DseqFor ID");
seqRefIds.put(mpc.getDseqFor(), ps);
}
else
{
- debug("reusing DseqFor ID");
+ jalview.bin.Cache.log.debug("reusing DseqFor ID");
}
mp.setMappingChoice(mpc);
//
for (int i = 0; i < vamsasSeq.length; i++)
{
- SequenceI alignmentSeq = al.getSequenceAt(i);
if (jseqs[i].getFeaturesCount() > 0)
{
Features[] features = jseqs[i].getFeatures();
for (int f = 0; f < features.length; f++)
{
- Features feature = features[f];
- SequenceFeature sf = new SequenceFeature(feature.getType(),
- feature.getDescription(), feature.getBegin(),
- feature.getEnd(), feature.getScore(),
- feature.getFeatureGroup());
- sf.setStatus(feature.getStatus());
+ SequenceFeature sf = new SequenceFeature(features[f].getType(),
+ features[f].getDescription(), features[f].getBegin(),
+ features[f].getEnd(), features[f].getScore(),
+ features[f].getFeatureGroup());
+ sf.setStatus(features[f].getStatus());
/*
* load any feature attributes - include map-valued attributes
*/
Map<String, Map<String, String>> mapAttributes = new HashMap<>();
- for (int od = 0; od < feature.getOtherDataCount(); od++)
+ for (int od = 0; od < features[f].getOtherDataCount(); od++)
{
- OtherData keyValue = feature.getOtherData(od);
+ OtherData keyValue = features[f].getOtherData(od);
String attributeName = keyValue.getKey();
String attributeValue = keyValue.getValue();
if (attributeName.startsWith("LINK"))
}
// adds feature to datasequence's feature set (since Jalview 2.10)
- alignmentSeq.addSequenceFeature(sf);
+ al.getSequenceAt(i).addSequenceFeature(sf);
}
}
if (vamsasSeq[i].getDBRefCount() > 0)
{
// adds dbrefs to datasequence's set (since Jalview 2.10)
addDBRefs(
- alignmentSeq.getDatasetSequence() == null ? alignmentSeq
- : alignmentSeq.getDatasetSequence(),
+ al.getSequenceAt(i).getDatasetSequence() == null
+ ? al.getSequenceAt(i)
+ : al.getSequenceAt(i).getDatasetSequence(),
vamsasSeq[i]);
}
if (jseqs[i].getPdbidsCount() > 0)
.getStructureSelectionManager(Desktop.instance)
.registerPDBEntry(entry);
// adds PDBEntry to datasequence's set (since Jalview 2.10)
- if (alignmentSeq.getDatasetSequence() != null)
+ if (al.getSequenceAt(i).getDatasetSequence() != null)
{
- alignmentSeq.getDatasetSequence().addPDBId(entry);
+ al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);
}
else
{
- alignmentSeq.addPDBId(entry);
+ al.getSequenceAt(i).addPDBId(entry);
}
}
}
-
- /*
- * load any HMMER profile
- */
- String hmmJarFile = jseqs[i].getHmmerProfile();
- if (hmmJarFile != null)
- {
- loadHmmerProfile(jprovider, hmmJarFile, alignmentSeq);
- }
}
} // end !multipleview
}
/**
- * Loads a HMMER profile from a file stored in the project, and associates it
- * with the specified sequence
- *
- * @param jprovider
- * @param hmmJarFile
- * @param seq
- */
- protected void loadHmmerProfile(jarInputStreamProvider jprovider,
- String hmmJarFile, SequenceI seq)
- {
- try
- {
- String hmmFile = copyJarEntry(jprovider, hmmJarFile, "hmm", null);
- HMMFile parser = new HMMFile(hmmFile, DataSourceType.FILE);
- HiddenMarkovModel hmmModel = parser.getHMM();
- hmmModel = new HiddenMarkovModel(hmmModel, seq);
- seq.setHMM(hmmModel);
- } catch (IOException e)
- {
- warn("Error loading HMM profile for " + seq.getName() + ": "
- + e.getMessage());
- }
- }
-
- /**
* Instantiate and link any saved RNA (Varna) viewers. The state of the Varna
* panel is restored from separate jar entries, two (gapped and trimmed) per
* sequence and secondary structure.
af.viewport.getResidueShading().setThreshold(view.getPidThreshold(),
view.getIgnoreGapsinConsensus());
af.viewport.getResidueShading()
- .setConsensus(af.viewport.getConsensusProfiles());
+ .setConsensus(af.viewport.getSequenceConsensusHash());
af.viewport.setColourAppliesToAllGroups(false);
if (view.getConservationSelected() && cs != null)
id = object.getJalviewModelSequence().getViewport()[0]
.getSequenceSetId()))
{
- debug("Skipping sequence set id " + id);
+ if (Cache.log != null && Cache.log.isDebugEnabled())
+ {
+ Cache.log.debug("Skipping seuqence set id " + id);
+ }
return true;
}
return false;
seqRefIds.put(sqid, djs);
}
- debug("about to recurse on addDBRefs.");
+ jalview.bin.Cache.log.debug("about to recurse on addDBRefs.");
addDBRefs(djs, ms);
}
}
else
{
- debug("Ignoring " + jvobj.getClass() + " (ID = " + id);
+ Cache.log.debug("Ignoring " + jvobj.getClass() + " (ID = " + id);
}
}
}
maxcol = new Color(Integer.parseInt(colourModel.getRGB(), 16));
} catch (Exception e)
{
- if (Cache.log != null)
- {
- Cache.log.warn("Couldn't parse out graduated feature color.", e);
- }
+ Cache.log.warn("Couldn't parse out graduated feature color.", e);
}
NoValueColour noCol = colourModel.getNoValueColour();
af.viewport.getResidueShading().setThreshold(view.getPidThreshold(),
true);
af.viewport.getResidueShading()
- .setConsensus(af.viewport.getConsensusProfiles());
+ .setConsensus(af.viewport.getSequenceConsensusHash());
af.viewport.setColourAppliesToAllGroups(false);
af.alignPanel.updateLayout();
af.changeColour(cs);
import jalview.util.MessageManager;
+import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.Rectangle;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
+import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.SwingConstants;
import javax.swing.border.Border;
}
/**
- * A convenience method that that adds a component with label to a container,
- * sets a tooltip on both component and label, and optionally specifies layout
- * constraints for the added component (but not the label)
*
- * @param container
+ * @param panel
* @param tooltip
* @param label
- * @param comp
- * @param constraints
+ * @param valBox
+ * @return the GUI element created that was added to the layout so it's
+ * attributes can be changed.
*/
- public static void addtoLayout(Container container, String tooltip,
- JComponent label, JComponent comp, String constraints)
+ public static JPanel addtoLayout(JPanel panel, String tooltip,
+ JComponent label, JComponent valBox)
+ {
+ JPanel laypanel = new JPanel(new GridLayout(1, 2));
+ JPanel labPanel = new JPanel(new BorderLayout());
+ JPanel valPanel = new JPanel();
+ labPanel.setBounds(new Rectangle(7, 7, 158, 23));
+ valPanel.setBounds(new Rectangle(172, 7, 270, 23));
+ labPanel.add(label, BorderLayout.WEST);
+ valPanel.add(valBox);
+ laypanel.add(labPanel);
+ laypanel.add(valPanel);
+ valPanel.setToolTipText(tooltip);
+ labPanel.setToolTipText(tooltip);
+ valBox.setToolTipText(tooltip);
+ panel.add(laypanel);
+ panel.validate();
+ return laypanel;
+ }
+
+ public static void mgAddtoLayout(JPanel cpanel, String tooltip,
+ JLabel jLabel, JComponent name)
+ {
+ mgAddtoLayout(cpanel, tooltip, jLabel, name, null);
+ }
+
+ public static void mgAddtoLayout(JPanel cpanel, String tooltip,
+ JLabel jLabel, JComponent name, String params)
{
- container.add(label);
- container.add(comp, constraints);
- comp.setToolTipText(tooltip); // this doesn't seem to show?
- label.setToolTipText(tooltip);
+ cpanel.add(jLabel);
+ if (params == null)
+ {
+ cpanel.add(name);
+ }
+ else
+ {
+ cpanel.add(name, params);
+ }
+ name.setToolTipText(tooltip);
+ jLabel.setToolTipText(tooltip);
}
/**
/**
* Adds a titled border to the component in the default font and position (top
- * left), optionally with italic text
+ * left), optionally witht italic text
*
* @param comp
* @param title
*/
package jalview.gui;
-import jalview.bin.Cache;
-import jalview.io.DataSourceType;
-import jalview.io.FileLoader;
-import jalview.io.JalviewFileChooser;
-import jalview.io.JalviewFileView;
import jalview.util.MessageManager;
-import jalview.ws.jws2.dm.JabaOption;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.OptionI;
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
import jalview.ws.params.ValueConstrainI.ValueType;
-import jalview.ws.params.simple.FileParameter;
-import jalview.ws.params.simple.LogarithmicParameter;
-import jalview.ws.params.simple.RadioChoiceParameter;
-import jalview.ws.params.simple.StringParameter;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Component;
-import java.awt.Container;
import java.awt.Dimension;
-import java.awt.FlowLayout;
import java.awt.Font;
+import java.awt.GridLayout;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.event.MouseAdapter;
+import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
-import java.io.File;
import java.net.URL;
import java.util.ArrayList;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
-import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JTextArea;
*/
public class OptsAndParamsPage
{
- public static final int PARAM_WIDTH = 340;
-
- public static final int PARAM_HEIGHT = 150;
-
- public static final int PARAM_CLOSEDHEIGHT = 80;
-
- URL linkImageURL = getClass().getResource("/images/link.gif");
-
- Map<String, OptionBox> optSet = new LinkedHashMap<>();
-
- Map<String, ParamBox> paramSet = new LinkedHashMap<>();
-
- /*
+ /**
* compact or verbose style parameters
*/
boolean compact = false;
- OptsParametersContainerI poparent;
-
- /**
- * A class that models a panel rendering a single option (checkbox or choice
- * list)
- */
public class OptionBox extends JPanel
implements MouseListener, ActionListener
{
- JCheckBox enabled;
+ JCheckBox enabled = new JCheckBox();
final URL finfo;
OptionI option;
- JComboBox<String> val;
+ JLabel optlabel = new JLabel();
+
+ JComboBox val = new JComboBox();
- /**
- * Constructs and adds labels and controls to the panel for one Option
- *
- * @param opt
- */
public OptionBox(OptionI opt)
{
option = opt;
- setLayout(new FlowLayout(FlowLayout.LEFT));
- enabled = new JCheckBox(opt.getName());
- enabled.setSelected(opt.isRequired());
-
- /*
- * If option is required, show a label, if optional a checkbox
- * (but not for Jabaws pending JWS-126 resolution)
- */
- if (opt.isRequired() && !(opt instanceof JabaOption))
- {
- finfo = null;
- add(new JLabel(opt.getName()));
- }
- else
- {
- finfo = option.getFurtherDetails();
- configureCheckbox(opt);
- add(enabled);
- }
-
- /*
- * construct the choice box with possible values,
- * or their display names if provided
- */
- val = buildComboBox(opt);
- val.setSelectedItem(opt.getValue());
-
- /*
- * only show the choicebox if there is more than one option,
- * or the option is mandatory
- */
- if (opt.getPossibleValues().size() > 1 || opt.isRequired())
- {
- val.addActionListener(this);
- add(val);
- }
-
- setInitialValue();
- }
-
- /**
- * Configures the checkbox that controls whether or not the option is
- * selected
- *
- * @param opt
- */
- protected void configureCheckbox(OptionI opt)
- {
+ setLayout(new BorderLayout());
+ enabled.setSelected(opt.isRequired()); // TODO: lock required options
enabled.setFont(new Font("Verdana", Font.PLAIN, 11));
+ enabled.setText("");
+ enabled.setText(opt.getName());
enabled.addActionListener(this);
- final String desc = opt.getDescription();
+ finfo = option.getFurtherDetails();
+ String desc = opt.getDescription();
if (finfo != null)
{
hasLink = true;
- String description = desc;
- if (desc == null || desc.trim().isEmpty())
- {
- description = MessageManager
- .getString("label.opt_and_params_further_details");
- }
- description = description + "<br><img src=\"" + linkImageURL
- + "\"/>";
- String text = JvSwingUtils.wrapTooltip(true, description);
- enabled.setToolTipText(text);
- enabled.addMouseListener(this); // for popup menu to show link
+
+ enabled.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ ((desc == null || desc.trim().length() == 0)
+ ? MessageManager.getString(
+ "label.opt_and_params_further_details")
+ : desc) + "<br><img src=\"" + linkImageURL
+ + "\"/>"));
+ enabled.addMouseListener(this);
}
else
{
if (desc != null && desc.trim().length() > 0)
{
- enabled.setToolTipText(JvSwingUtils.wrapTooltip(true, desc));
+ enabled.setToolTipText(
+ JvSwingUtils.wrapTooltip(true, opt.getDescription()));
}
}
+ add(enabled, BorderLayout.NORTH);
+ for (Object str : opt.getPossibleValues())
+ {
+ val.addItem(str);
+ }
+ val.setSelectedItem(opt.getValue());
+ if (opt.getPossibleValues().size() > 1)
+ {
+ setLayout(new GridLayout(1, 2));
+ val.addActionListener(this);
+ add(val, BorderLayout.SOUTH);
+ }
+ // TODO: add actionListeners for popup (to open further info),
+ // and to update list of parameters if an option is enabled
+ // that takes a value. JBPNote: is this TODO still valid ?
+ setInitialValue();
}
@Override
poparent.argSetModified(this, !notmod);
}
- /**
- * Answers null if the option is not selected, else a new Option holding the
- * selected value
- *
- * @return
- */
- public ArgumentI getSelectedOption()
+ public OptionI getOptionIfEnabled()
{
if (!enabled.isSelected())
{
return null;
}
- String value = getSelectedValue(option, val.getSelectedIndex());
OptionI opt = option.copy();
- opt.setValue(value);
+ if (opt.getPossibleValues() != null
+ && opt.getPossibleValues().size() == 1)
+ {
+ // Hack to make sure the default value for an enabled option with only
+ // one value is actually returned
+ opt.setValue(opt.getPossibleValues().get(0));
+ }
+ if (val.getSelectedItem() != null)
+ {
+ opt.setValue((String) val.getSelectedItem());
+ }
+ else
+ {
+ if (option.getValue() != null)
+ {
+ opt.setValue(option.getValue());
+ }
+ }
return opt;
}
@Override
public void mouseEntered(MouseEvent e)
{
+ // TODO Auto-generated method stub
+
}
@Override
public void mouseExited(MouseEvent e)
{
+ // TODO Auto-generated method stub
+
}
@Override
}
}
- /**
- * toString representation for identification in the debugger only
- */
- @Override
- public String toString()
- {
- return option == null ? super.toString() : option.toString();
- }
-
}
- /**
- * A class that models a panel rendering a single parameter
- */
public class ParamBox extends JPanel
implements ChangeListener, ActionListener, MouseListener
{
- /*
- * parameter values (or their logs) are multiplied by this
- * scaling factor to ensure an integer range for the slider
- */
- private int sliderScaleFactor = 1;
-
- boolean isLogarithmicParameter;
-
- boolean isChoiceParameter;
+ boolean adjusting = false;
- boolean isIntegerParameter;
+ boolean choice = false;
- boolean isStringParameter;
+ JComboBox choicebox;
- boolean adjusting;
+ JPanel controlPanel = new JPanel();
- /*
- * drop-down list of choice options (if applicable)
- */
- JComboBox<String> choicebox;
-
- /*
- * radio buttons as an alternative to combo box
- */
- ButtonGroup buttonGroup;
-
- JPanel controlsPanel = new JPanel();
-
- boolean descriptionIsVisible = false;
+ boolean descisvisible = false;
JScrollPane descPanel = new JScrollPane();
final URL finfo;
+ boolean integ = false;
+
Object lastVal;
ParameterI parameter;
JPanel settingPanel = new JPanel();
- JSlider slider;
+ JButton showDesc = new JButton();
- JTextArea descriptionText = new JTextArea();
+ JSlider slider = null;
- ValueConstrainI validator;
+ JTextArea string = new JTextArea();
- JTextField valueField;
+ ValueConstrainI validator = null;
- private String descTooltip;
+ JTextField valueField = null;
- public ParamBox(final OptsParametersContainerI paramContainer,
+ public ParamBox(final OptsParametersContainerI pmlayout,
ParameterI parm)
{
- pmdialogbox = paramContainer;
+ pmdialogbox = pmlayout;
finfo = parm.getFurtherDetails();
validator = parm.getValidValue();
parameter = parm;
-
- isLogarithmicParameter = parm instanceof LogarithmicParameter;
-
if (validator != null)
{
- ValueType type = validator.getType();
- isIntegerParameter = type == ValueType.Integer;
- isStringParameter = type == ValueType.String
- || type == ValueType.File;
-
- /*
- * ensure slider has an integer range corresponding to
- * the min-max range of the parameter
- */
- if (validator.getMin() != null && validator.getMax() != null
- // && !isIntegerParameter
- && !isStringParameter)
+ integ = validator.getType() == ValueType.Integer;
+ }
+ else
+ {
+ if (parameter.getPossibleValues() != null)
{
- double min = validator.getMin().doubleValue();
- double max = validator.getMax().doubleValue();
- if (isLogarithmicParameter)
- {
- min = Math.log(min);
- max = Math.log(max);
- }
- sliderScaleFactor = (int) (1000000 / (max - min));
- // todo scaleMin, scaleMax could also be final fields
+ choice = true;
}
}
- List<String> possibleValues = parameter.getPossibleValues();
- isChoiceParameter = possibleValues != null
- && !possibleValues.isEmpty();
-
- if (compact)
+ if (!compact)
{
- addCompactParameter(parm);
+ makeExpanderParam(parm);
}
else
{
- addExpandableParam(parm);
+ makeCompactParam(parm);
+
}
}
- /**
- * Adds a 'compact' format parameter, with any help text shown as a tooltip
- *
- * @param parm
- */
- private void addCompactParameter(ParameterI parm)
+ private void makeCompactParam(ParameterI parm)
{
setLayout(new MigLayout("", "[][grow]"));
+
String ttipText = null;
- controlsPanel.setLayout(new BorderLayout());
+ controlPanel.setLayout(new BorderLayout());
if (parm.getDescription() != null
&& parm.getDescription().trim().length() > 0)
{
+ // Only create description boxes if there actually is a description.
ttipText = (JvSwingUtils.wrapTooltip(true,
parm.getDescription() + (finfo != null ? "<br><img src=\""
+ linkImageURL + "\"/>"
: "")));
}
- JvSwingUtils.addtoLayout(this, ttipText, new JLabel(parm.getName()),
- controlsPanel, "");
+ JvSwingUtils.mgAddtoLayout(this, ttipText, new JLabel(parm.getName()),
+ controlPanel, "");
updateControls(parm);
validate();
}
- /**
- * Adds an 'expanded' format parameter, with any help shown in a panel that
- * may be shown or hidden
- *
- * @param parm
- */
- private void addExpandableParam(ParameterI parm)
+ private void makeExpanderParam(ParameterI parm)
{
setPreferredSize(new Dimension(PARAM_WIDTH, PARAM_CLOSEDHEIGHT));
setBorder(new TitledBorder(parm.getName()));
setLayout(null);
- descriptionText.setFont(new Font("Verdana", Font.PLAIN, 11));
- descriptionText.setBackground(getBackground());
+ showDesc.setFont(new Font("Verdana", Font.PLAIN, 6));
+ showDesc.setText("+");
+ string.setFont(new Font("Verdana", Font.PLAIN, 11));
+ string.setBackground(getBackground());
- descriptionText.setEditable(false);
- descPanel.getViewport().setView(descriptionText);
+ string.setEditable(false);
+ descPanel.getViewport().setView(string);
descPanel.setVisible(false);
JPanel firstrow = new JPanel();
firstrow.setLayout(null);
- controlsPanel.setLayout(new BorderLayout());
- controlsPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH - 70,
+ controlPanel.setLayout(new BorderLayout());
+ controlPanel.setBounds(new Rectangle(39, 10, PARAM_WIDTH - 70,
PARAM_CLOSEDHEIGHT - 50));
- firstrow.add(controlsPanel);
+ firstrow.add(controlPanel);
firstrow.setBounds(new Rectangle(10, 20, PARAM_WIDTH - 30,
PARAM_CLOSEDHEIGHT - 30));
+ final ParamBox me = this;
+
if (parm.getDescription() != null
&& parm.getDescription().trim().length() > 0)
{
- addExpandableHelp(firstrow, parm);
+ // Only create description boxes if there actually is a description.
+ if (finfo != null)
+ {
+ showDesc.setToolTipText(JvSwingUtils.wrapTooltip(true,
+ MessageManager.formatMessage(
+ "label.opt_and_params_show_brief_desc_image_link",
+ new String[]
+ { linkImageURL.toExternalForm() })));
+ showDesc.addMouseListener(this);
+ }
+ else
+ {
+ showDesc.setToolTipText(
+ JvSwingUtils.wrapTooltip(true, MessageManager.getString(
+ "label.opt_and_params_show_brief_desc")));
+ }
+ showDesc.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ descisvisible = !descisvisible;
+ descPanel.setVisible(descisvisible);
+ descPanel.getVerticalScrollBar().setValue(0);
+ me.setPreferredSize(new Dimension(PARAM_WIDTH,
+ (descisvisible) ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT));
+ me.validate();
+ pmdialogbox.refreshParamLayout();
+ }
+ });
+ string.setWrapStyleWord(true);
+ string.setLineWrap(true);
+ string.setColumns(32);
+ string.setText(parm.getDescription());
+ showDesc.setBounds(new Rectangle(10, 10, 16, 16));
+ firstrow.add(showDesc);
}
add(firstrow);
validator = parm.getValidValue();
parameter = parm;
if (validator != null)
{
- isIntegerParameter = validator.getType() == ValueType.Integer;
+ integ = validator.getType() == ValueType.Integer;
}
else
{
if (parameter.getPossibleValues() != null)
{
- isChoiceParameter = true;
+ choice = true;
}
}
updateControls(parm);
validate();
}
- /**
- * Adds a button which can be clicked to show or hide help text
- *
- * @param container
- * @param param
- */
- protected void addExpandableHelp(JPanel container, ParameterI param)
- {
- JButton showDescBtn = new JButton("+");
- showDescBtn.setFont(new Font("Verdana", Font.PLAIN, 8));
- if (finfo != null)
- {
- descTooltip = JvSwingUtils.wrapTooltip(true,
- MessageManager.formatMessage(
- "label.opt_and_params_show_brief_desc_image_link",
- new String[]
- { linkImageURL.toExternalForm() }));
- showDescBtn.addMouseListener(this);
- }
- else
- {
- descTooltip = JvSwingUtils.wrapTooltip(true, MessageManager
- .getString("label.opt_and_params_show_brief_desc"));
- }
- showDescBtn.setToolTipText(descTooltip);
- showDescBtn.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- descriptionIsVisible = !descriptionIsVisible;
- showDescBtn.setText(descriptionIsVisible ? "-" : "+");
- showDescBtn.setToolTipText(
- descriptionIsVisible ? null : descTooltip);
- descPanel.setVisible(descriptionIsVisible);
- descPanel.getVerticalScrollBar().setValue(0);
- ParamBox.this.setPreferredSize(new Dimension(PARAM_WIDTH,
- (descriptionIsVisible) ? PARAM_HEIGHT
- : PARAM_CLOSEDHEIGHT));
- ParamBox.this.validate();
- pmdialogbox.refreshParamLayout();
- }
- });
- descriptionText.setWrapStyleWord(true);
- descriptionText.setLineWrap(true);
- descriptionText.setColumns(32);
- descriptionText.setText(param.getDescription());
- showDescBtn.setBounds(new Rectangle(10, 10, 16, 16));
- container.add(showDescBtn);
- }
-
@Override
public void actionPerformed(ActionEvent e)
{
{
return;
}
+ if (!choice)
+ {
+ updateSliderFromValueField();
+ }
checkIfModified();
}
- /**
- * Checks whether the value of this parameter has been changed and notifies
- * the parent page accordingly
- */
private void checkIfModified()
{
- Object newValue = updateSliderFromValueField();
- boolean modified = true;
- if (newValue.getClass() == lastVal.getClass())
+ Object cstate = updateSliderFromValueField();
+ boolean notmod = false;
+ if (cstate.getClass() == lastVal.getClass())
{
- modified = !newValue.equals(lastVal);
+ if (cstate instanceof int[])
+ {
+ notmod = (((int[]) cstate)[0] == ((int[]) lastVal)[0]);
+ }
+ else if (cstate instanceof float[])
+ {
+ notmod = (((float[]) cstate)[0] == ((float[]) lastVal)[0]);
+ }
+ else if (cstate instanceof String[])
+ {
+ notmod = (((String[]) cstate)[0].equals(((String[]) lastVal)[0]));
+ }
}
- pmdialogbox.argSetModified(this, modified);
+ pmdialogbox.argSetModified(this, !notmod);
}
@Override
return Component.BaselineResizeBehavior.CONSTANT_ASCENT;
}
- /**
- * Answers an argument holding the value entered or selected in the dialog
- *
- * @return
- */
- public ArgumentI getParameter()
+ public int getBoxHeight()
+ {
+ return (descisvisible ? PARAM_HEIGHT : PARAM_CLOSEDHEIGHT);
+ }
+
+ public ParameterI getParameter()
{
ParameterI prm = parameter.copy();
- String value = null;
- if (parameter instanceof RadioChoiceParameter)
- {
- value = buttonGroup.getSelection().getActionCommand();
- }
- else if (isChoiceParameter)
+ if (choice)
{
- value = getSelectedValue(this.parameter,
- choicebox.getSelectedIndex());
+ prm.setValue((String) choicebox.getSelectedItem());
}
else
{
- value = valueField.getText();
+ prm.setValue(valueField.getText());
}
- prm.setValue(value);
-
return prm;
}
@Override
public void mouseEntered(MouseEvent e)
{
+ // TODO Auto-generated method stub
+
}
@Override
public void mouseExited(MouseEvent e)
{
+ // TODO Auto-generated method stub
+
}
@Override
@Override
public void mouseReleased(MouseEvent e)
{
+ // TODO Auto-generated method stub
+
}
@Override
public void stateChanged(ChangeEvent e)
{
- if (adjusting)
- {
- return;
- }
- try
+ if (!adjusting)
{
- adjusting = true;
- if (!isLogarithmicParameter)
- {
- /*
- * set (int or float formatted) text field value
- */
- valueField.setText(isIntegerParameter
- ? String.valueOf(slider.getValue())
- : formatDouble(
- slider.getValue() / (float) sliderScaleFactor));
- }
- else
- {
- double value = Math.pow(Math.E,
- slider.getValue() / (double) sliderScaleFactor);
- valueField.setText(formatDouble(value));
- }
+ valueField.setText("" + ((integ) ? ("" + slider.getValue())
+ : ("" + slider.getValue() / 1000f)));
checkIfModified();
- } finally
- {
- adjusting = false;
}
- }
- /**
- * Answers the value formatted as a string to 3 decimal places - in
- * scientific notation if the value is less than 0.001
- *
- * @param value
- * @return
- */
- String formatDouble(double value)
- {
- String format = value < 0.001 ? "%3.1E" : "%3.3f";
- return String.format(format, value);
- }
-
- /**
- * Formats a number as integer or float (3dp) or scientific notation (1dp)
- *
- * @param n
- * @return
- */
- String formatNumber(Number n)
- {
- return n instanceof Integer ? String.valueOf(n.intValue())
- : formatDouble(n.doubleValue());
}
- void updateControls(ParameterI parm)
+ public void updateControls(ParameterI parm)
{
adjusting = true;
- boolean init = (choicebox == null && valueField == null
- && buttonGroup == null);
+ boolean init = (choicebox == null && valueField == null);
if (init)
{
- if (parm instanceof RadioChoiceParameter)
+ if (choice)
{
- buttonGroup = addRadioButtons(parameter, controlsPanel);
- }
- else if (isChoiceParameter)
- {
- choicebox = buildComboBox(parm);
+ choicebox = new JComboBox();
choicebox.addActionListener(this);
- controlsPanel.add(choicebox, BorderLayout.CENTER);
+ controlPanel.add(choicebox, BorderLayout.CENTER);
}
else
{
slider = new JSlider();
slider.addChangeListener(this);
- int cols = parm instanceof StringParameter ? 20 : 0;
- valueField = new JTextField(cols);
+ valueField = new JTextField();
valueField.addActionListener(this);
- valueField.addKeyListener(new KeyAdapter()
+ valueField.addKeyListener(new KeyListener()
{
+
+ @Override
+ public void keyTyped(KeyEvent e)
+ {
+ }
+
@Override
public void keyReleased(KeyEvent e)
{
- int keyCode = e.getKeyCode();
- if (e.isActionKey() && keyCode != KeyEvent.VK_LEFT
- && keyCode != KeyEvent.VK_RIGHT)
+ if (e.isActionKey())
{
if (valueField.getText().trim().length() > 0)
{
}
}
}
- });
- valueField.setPreferredSize(new Dimension(65, 25));
- if (parm instanceof FileParameter)
- {
- valueField.setToolTipText(MessageManager
- .getString("label.double_click_to_browse"));
- valueField.addMouseListener(new MouseAdapter()
+
+ @Override
+ public void keyPressed(KeyEvent e)
{
- @Override
- public void mouseClicked(MouseEvent e)
- {
- if (e.getClickCount() == 2)
- {
- String dir = Cache.getProperty("LAST_DIRECTORY");
- JalviewFileChooser chooser = new JalviewFileChooser(dir);
- chooser.setFileView(new JalviewFileView());
- chooser.setDialogTitle(
- MessageManager.getString("action.select_ddbb"));
-
- int val = chooser.showOpenDialog(ParamBox.this);
- if (val == JalviewFileChooser.APPROVE_OPTION)
- {
- File choice = chooser.getSelectedFile();
- String path = choice.getPath();
- valueField.setText(path);
- Cache.setProperty("LAST_DIRECTORY", choice.getParent());
- FileLoader.updateRecentlyOpened(path,
- DataSourceType.FILE);
- }
- }
- }
- });
- }
-
- controlsPanel.add(slider, BorderLayout.WEST);
- controlsPanel.add(valueField, BorderLayout.EAST);
+ }
+ });
+ valueField.setPreferredSize(new Dimension(60, 25));
+ controlPanel.add(slider, BorderLayout.WEST);
+ controlPanel.add(valueField, BorderLayout.EAST);
+
}
}
- String value = parm.getValue();
- if (value != null)
+ if (parm != null)
{
- if (isChoiceParameter)
+ if (choice)
{
- if (!(parm instanceof RadioChoiceParameter))
+ if (init)
+ {
+ List vals = parm.getPossibleValues();
+ for (Object val : vals)
+ {
+ choicebox.addItem(val);
+ }
+ }
+
+ if (parm.getValue() != null)
{
- choicebox.setSelectedItem(value);
+ choicebox.setSelectedItem(parm.getValue());
}
}
else
{
- valueField.setText(value);
+ valueField.setText(parm.getValue());
}
}
lastVal = updateSliderFromValueField();
adjusting = false;
}
- /**
- * Adds a panel to comp, containing a label and radio buttons for the choice
- * of values of the given option. Returns a ButtonGroup whose members are
- * the added radio buttons.
- *
- * @param option
- * @param comp
- *
- * @return
- */
- protected ButtonGroup addRadioButtons(OptionI option, Container comp)
- {
- ButtonGroup bg = new ButtonGroup();
- JPanel radioPanel = new JPanel();
- radioPanel.add(new JLabel(option.getDescription()));
-
- String value = option.getValue();
-
- for (String opt : option.getPossibleValues())
- {
- JRadioButton btn = new JRadioButton(opt);
- btn.setActionCommand(opt);
- boolean selected = opt.equals(value);
- btn.setSelected(selected);
- btn.addActionListener(this);
- bg.add(btn);
- radioPanel.add(btn);
- }
- comp.add(radioPanel);
-
- return bg;
- }
-
- /**
- * Action depends on the type of the input parameter:
- * <ul>
- * <li>if a text input, returns the trimmed value</li>
- * <li>if a choice list or radio button, returns the selected value</li>
- * <li>if a value slider and input field, sets the value of the slider from
- * the value in the text field, limiting it to any defined min-max
- * range.</li>
- * </ul>
- * Answers the (possibly modified) input value, as a String, Integer, Float
- * or Double.
- *
- * @return
- */
- Object updateSliderFromValueField()
+ public Object updateSliderFromValueField()
{
- if (validator == null || isStringParameter)
+ int iVal;
+ float fVal;
+ if (validator != null)
{
- if (isChoiceParameter)
+ if (integ)
{
- if (parameter instanceof RadioChoiceParameter)
+ iVal = 0;
+ try
{
- return buttonGroup.getSelection().getActionCommand();
+ valueField.setText(valueField.getText().trim());
+ iVal = Integer.valueOf(valueField.getText());
+ if (validator.getMin() != null
+ && validator.getMin().intValue() > iVal)
+ {
+ iVal = validator.getMin().intValue();
+ // TODO: provide visual indication that hard limit was reached for
+ // this parameter
+ }
+ if (validator.getMax() != null
+ && validator.getMax().intValue() < iVal)
+ {
+ iVal = validator.getMax().intValue();
+ // TODO: provide visual indication that hard limit was reached for
+ // this parameter
+ }
+ } catch (Exception e)
+ {
+ }
+ ;
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + iVal);
+ if (validator.getMin() != null && validator.getMax() != null)
+ {
+ slider.getModel().setRangeProperties(iVal, 1,
+ validator.getMin().intValue(),
+ validator.getMax().intValue() + 1, true);
}
else
{
- return getSelectedValue(this.parameter,
- choicebox.getSelectedIndex());
+ slider.setVisible(false);
}
- }
- slider.setVisible(false);
- return valueField.getText().trim();
- }
-
- valueField.setText(valueField.getText().trim());
-
- /*
- * ensure not outside min-max range
- * TODO: provide some visual indicator if limit reached
- */
- try
- {
- valueField.setBackground(Color.WHITE);
- double d = Double.parseDouble(valueField.getText());
- if (validator.getMin() != null
- && validator.getMin().doubleValue() > d)
- {
- valueField.setText(formatNumber(validator.getMin()));
- }
- if (validator.getMax() != null
- && validator.getMax().doubleValue() < d)
- {
- valueField.setText(formatNumber(validator.getMax()));
- }
- } catch (NumberFormatException e)
- {
- valueField.setBackground(Color.yellow);
- return Float.NaN;
- }
-
- if (isIntegerParameter)
- {
- int iVal = 0;
- try
- {
- iVal = Integer.valueOf(valueField.getText());
- } catch (Exception e)
- {
- valueField.setBackground(Color.yellow);
- return Integer.valueOf(0);
- }
-
- if (validator.getMin() != null && validator.getMax() != null)
- {
- slider.getModel().setRangeProperties(iVal, 1,
- validator.getMin().intValue(),
- validator.getMax().intValue() + 1, true);
+ return new int[] { iVal };
}
else
{
- slider.setVisible(false);
+ fVal = 0f;
+ try
+ {
+ valueField.setText(valueField.getText().trim());
+ fVal = Float.valueOf(valueField.getText());
+ if (validator.getMin() != null
+ && validator.getMin().floatValue() > fVal)
+ {
+ fVal = validator.getMin().floatValue();
+ // TODO: provide visual indication that hard limit was reached for
+ // this parameter
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + fVal);
+ }
+ if (validator.getMax() != null
+ && validator.getMax().floatValue() < fVal)
+ {
+ fVal = validator.getMax().floatValue();
+ // TODO: provide visual indication that hard limit was reached for
+ // this parameter
+ // update value field to reflect any bound checking we performed.
+ valueField.setText("" + fVal);
+ }
+ } catch (Exception e)
+ {
+ }
+ ;
+ if (validator.getMin() != null && validator.getMax() != null)
+ {
+ slider.getModel().setRangeProperties((int) (fVal * 1000f), 1,
+ (int) (validator.getMin().floatValue() * 1000f),
+ 1 + (int) (validator.getMax().floatValue() * 1000f),
+ true);
+ }
+ else
+ {
+ slider.setVisible(false);
+ }
+ return new float[] { fVal };
}
- return new Integer(iVal);
}
-
- if (isLogarithmicParameter)
+ else
{
- double dVal = 0d;
- try
- {
- double eValue = Double.valueOf(valueField.getText());
- dVal = Math.log(eValue) * sliderScaleFactor;
- } catch (Exception e)
+ if (!choice)
{
- // shouldn't be possible here
- valueField.setBackground(Color.yellow);
- return Double.NaN;
- }
- if (validator.getMin() != null && validator.getMax() != null)
- {
- double scaleMin = Math.log(validator.getMin().doubleValue())
- * sliderScaleFactor;
- double scaleMax = Math.log(validator.getMax().doubleValue())
- * sliderScaleFactor;
- slider.getModel().setRangeProperties((int) (dVal), 1,
- (int) scaleMin, 1 + (int) scaleMax, true);
+ slider.setVisible(false);
+ return new String[] { valueField.getText().trim() };
}
else
{
- slider.setVisible(false);
+ return new String[] { (String) choicebox.getSelectedItem() };
}
- return new Double(dVal);
}
- float fVal = 0f;
- try
- {
- fVal = Float.valueOf(valueField.getText());
- } catch (Exception e)
- {
- return Float.valueOf(0f); // shouldn't happen
- }
- if (validator.getMin() != null && validator.getMax() != null)
- {
- float scaleMin = validator.getMin().floatValue()
- * sliderScaleFactor;
- float scaleMax = validator.getMax().floatValue()
- * sliderScaleFactor;
- slider.getModel().setRangeProperties(
- (int) (fVal * sliderScaleFactor), 1, (int) scaleMin,
- 1 + (int) scaleMax, true);
- }
- else
- {
- slider.setVisible(false);
- }
- return new Float(fVal);
}
}
- /**
- * Constructor with the option to show 'compact' format (parameter description
- * as tooltip) or 'expanded' format (parameter description in a textbox which
- * may be opened or closed). Use compact for simple description text, expanded
- * for more wordy or formatted text.
- *
- * @param paramContainer
- */
+ public static final int PARAM_WIDTH = 340;
+
+ public static final int PARAM_HEIGHT = 150;
+
+ public static final int PARAM_CLOSEDHEIGHT = 80;
+
+ public OptsAndParamsPage(OptsParametersContainerI paramContainer)
+ {
+ this(paramContainer, false);
+ }
+
public OptsAndParamsPage(OptsParametersContainerI paramContainer,
boolean compact)
{
mnu.show(invoker, x, y);
}
+ URL linkImageURL = getClass().getResource("/images/link.gif");
+
+ Map<String, OptionBox> optSet = new java.util.LinkedHashMap<String, OptionBox>();
+
+ Map<String, ParamBox> paramSet = new java.util.LinkedHashMap<String, ParamBox>();
+
public Map<String, OptionBox> getOptSet()
{
return optSet;
this.paramSet = paramSet;
}
+ OptsParametersContainerI poparent;
+
OptionBox addOption(OptionI opt)
{
OptionBox cb = optSet.get(opt.getName());
}
else
{
- throw new Error(String.format("Invalid value '%s' for option '%s'",
- string, option.getName()));
+ throw new Error(MessageManager.formatMessage(
+ "error.invalid_value_for_option", new String[]
+ { string, option.getName() }));
}
+
}
if (option.isRequired() && !cb.enabled.isSelected())
{
}
/**
- * Answers a list of arguments representing all the options and arguments
- * selected on the dialog, holding their chosen or input values. Optional
- * parameters which were not selected are not included.
+ * recover options and parameters from GUI
*
* @return
*/
public List<ArgumentI> getCurrentSettings()
{
- List<ArgumentI> argSet = new ArrayList<>();
+ List<ArgumentI> argSet = new ArrayList<ArgumentI>();
for (OptionBox opts : getOptSet().values())
{
- ArgumentI opt = opts.getSelectedOption();
+ OptionI opt = opts.getOptionIfEnabled();
if (opt != null)
{
argSet.add(opt);
}
for (ParamBox parambox : getParamSet().values())
{
- ArgumentI parm = parambox.getParameter();
+ ParameterI parm = parambox.getParameter();
if (parm != null)
{
argSet.add(parm);
return argSet;
}
- /**
- * A helper method that constructs and returns a CombBox for choice of the
- * possible option values. If display names are provided, then these are added
- * as options, otherwise the actual values are added.
- *
- * @param opt
- * @return
- */
- protected static JComboBox<String> buildComboBox(OptionI opt)
- {
- JComboBox<String> cb = null;
- List<String> displayNames = opt.getDisplayNames();
- if (displayNames != null)
- {
- cb = JvSwingUtils.buildComboWithTooltips(displayNames,
- opt.getPossibleValues());
- }
- else
- {
- cb = new JComboBox<>();
- for (String v : opt.getPossibleValues())
- {
- cb.addItem(v);
- }
- }
- return cb;
- }
-
- /**
- * Answers the value corresponding to the selected item in the choice combo
- * box. Note that this returns the underlying value even if a different
- * display name is used in the combo box.
- *
- * @return
- */
- protected static String getSelectedValue(OptionI opt, int sel)
- {
- List<String> possibleValues = opt.getPossibleValues();
- String value = null;
- if (possibleValues != null && possibleValues.size() == 1)
- {
- // Hack to make sure the default value for an enabled option with only
- // one value is actually returned even if this.val is not displayed
- value = possibleValues.get(0);
- }
- else if (sel >= 0 && sel < possibleValues.size())
- {
- value = possibleValues.get(sel);
- }
- return value;
- }
}
*/
package jalview.gui;
-import jalview.api.AlignViewportI;
import jalview.bin.Cache;
import jalview.renderer.OverviewRenderer;
import jalview.util.MessageManager;
private OverviewCanvas oviewCanvas;
- private AlignViewportI av;
+ private AlignViewport av;
private AlignmentPanel ap;
package jalview.gui;
import jalview.analysis.AlignSeq;
-import jalview.api.AlignViewportI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.jbgui.GPairwiseAlignPanel;
import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
import java.awt.event.ActionEvent;
import java.util.Vector;
private static final String DASHES = "---------------------\n";
- AlignViewportI av;
+ AlignmentViewport av;
Vector<SequenceI> sequences;
* Creates a new PairwiseAlignPanel object.
*
* @param viewport
+ * DOCUMENT ME!
*/
- public PairwiseAlignPanel(AlignViewportI viewport)
+ public PairwiseAlignPanel(AlignmentViewport viewport)
{
super();
this.av = viewport;
- sequences = new Vector<>();
+ sequences = new Vector<SequenceI>();
SequenceGroup selectionGroup = viewport.getSelectionGroup();
boolean isSelection = selectionGroup != null
JMenuItem sequenceFeature = new JMenuItem();
-
JMenuItem textColour = new JMenuItem();
JMenu jMenu1 = new JMenu();
* currently selected sequence (if there is one):
*/
final List<SequenceI> selectedSequence = (seq == null
- ? Collections.<SequenceI> emptyList() : Arrays.asList(seq));
-
+ ? Collections.<SequenceI> emptyList()
+ : Arrays.asList(seq));
buildAnnotationTypesMenus(seqShowAnnotationsMenu,
seqHideAnnotationsMenu, selectedSequence);
configureReferenceAnnotationsMenu(seqAddReferenceAnnotations,
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<>();
- Hashtable<String, PDBEntry> reppdb = new Hashtable<>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<>(), reppdb = new Hashtable<>();
SequenceI sqass = null;
for (SequenceI sq : alignPanel.av.getSequenceSelection())
import jalview.bin.Cache;
import jalview.gui.Help.HelpId;
import jalview.gui.StructureViewer.ViewerType;
-import jalview.hmmer.HmmerCommand;
import jalview.io.FileFormatI;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
import jalview.urls.api.UrlProviderFactoryI;
import jalview.urls.api.UrlProviderI;
import jalview.urls.desktop.DesktopUrlProviderFactory;
-import jalview.util.FileUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.UrlConstants;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.FocusAdapter;
-import java.awt.event.FocusEvent;
import java.awt.event.MouseEvent;
import java.io.File;
import java.util.ArrayList;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
-import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.RowFilter;
import javax.swing.RowSorter;
*/
public class Preferences extends GPreferences
{
- // suggested list delimiter character
- public static final String COMMA = ",";
-
- public static final String HMMSEARCH_SEQCOUNT = "HMMSEARCH_SEQCOUNT";
-
- public static final String HMMINFO_GLOBAL_BACKGROUND = "HMMINFO_GLOBAL_BACKGROUND";
-
- public static final String HMMALIGN_TRIM_TERMINI = "HMMALIGN_TRIM_TERMINI";
-
public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
public static final String CHIMERA_PATH = "CHIMERA_PATH";
-
- public static final String HMMER_PATH = "HMMER_PATH";
-
- public static final String CYGWIN_PATH = "CYGWIN_PATH";
-
- public static final String HMMSEARCH_DBS = "HMMSEARCH_DBS";
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
JInternalFrame frame;
- DasSourceBrowser dasSource;
-
private WsPreferences wsPrefs;
private OptionsParam promptEachTimeOpt = new OptionsParam(
super();
frame = new JInternalFrame();
frame.setContentPane(this);
- dasSource = new DasSourceBrowser();
- dasTab.add(dasSource, BorderLayout.CENTER);
wsPrefs = new WsPreferences();
wsTab.add(wsPrefs, BorderLayout.CENTER);
int width = 500, height = 450;
frame.setMinimumSize(new Dimension(width, height));
/*
- * Set HMMER tab defaults
- */
- hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false));
- if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false))
- {
- hmmerBackgroundUniprot.setSelected(true);
- }
- else
- {
- hmmerBackgroundAlignment.setSelected(true);
- }
- hmmerSequenceCount
- .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT));
- hmmerPath.setText(Cache.getProperty(HMMER_PATH));
- hmmerPath.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- validateHmmerPath();
- }
- });
- hmmerPath.addFocusListener(new FocusAdapter()
- {
- @Override
- public void focusLost(FocusEvent e)
- {
- validateHmmerPath();
- }
- });
- if (cygwinPath != null)
- {
- String path = Cache.getProperty(CYGWIN_PATH);
- if (path == null)
- {
- path = FileUtils.getPathTo("bash");
- }
- cygwinPath.setText(path);
- cygwinPath.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- validateCygwinPath();
- }
- });
- cygwinPath.addFocusListener(new FocusAdapter()
- {
- @Override
- public void focusLost(FocusEvent e)
- {
- validateCygwinPath();
- }
- });
- }
-
- /*
* Set Visual tab defaults
*/
seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true));
Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true));
showConsensLogo
.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false));
- showInformationHistogram.setSelected(
- Cache.getDefault("SHOW_INFORMATION_HISTOGRAM", true));
- showHMMLogo.setSelected(Cache.getDefault("SHOW_HMM_LOGO", false));
showNpTooltip
.setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
showDbRefTooltip
Boolean.toString(showConsensHistogram.isSelected()));
Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
Boolean.toString(showConsensLogo.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_INFORMATION_HISTOGRAM",
- Boolean.toString(showConsensHistogram.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_HMM_LOGO",
- Boolean.toString(showHMMLogo.isSelected()));
Cache.applicationProperties.setProperty("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
maxColour.getBackground());
/*
- * Save HMMER settings
- */
- Cache.applicationProperties.setProperty(HMMALIGN_TRIM_TERMINI,
- Boolean.toString(hmmrTrimTermini.isSelected()));
- Cache.applicationProperties.setProperty(HMMINFO_GLOBAL_BACKGROUND,
- Boolean.toString(hmmerBackgroundUniprot.isSelected()));
- Cache.applicationProperties.setProperty(HMMSEARCH_SEQCOUNT,
- hmmerSequenceCount.getText());
- Cache.setOrRemove(HMMER_PATH, hmmerPath.getText());
- if (cygwinPath != null)
- {
- Cache.setOrRemove(CYGWIN_PATH, cygwinPath.getText());
- }
- AlignFrame[] frames = Desktop.getAlignFrames();
- if (frames != null && frames.length > 0)
- {
- for (AlignFrame f : frames)
- {
- f.updateHMMERStatus();
- }
- }
-
- hmmrTrimTermini.setSelected(Cache.getDefault(HMMALIGN_TRIM_TERMINI, false));
- if (Cache.getDefault(HMMINFO_GLOBAL_BACKGROUND, false))
- {
- hmmerBackgroundUniprot.setSelected(true);
- }
- else
- {
- hmmerBackgroundAlignment.setSelected(true);
- }
- hmmerSequenceCount
- .setText(Cache.getProperty(HMMSEARCH_SEQCOUNT));
- hmmerPath.setText(Cache.getProperty(HMMER_PATH));
-
- /*
* Save Overview settings
*/
Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground());
Cache.applicationProperties.setProperty("PAD_GAPS",
Boolean.toString(padGaps.isSelected()));
- dasSource.saveProperties(Cache.applicationProperties);
wsPrefs.updateAndRefreshWsMenuConfig(false);
Cache.saveProperties();
Desktop.instance.doConfigureStructurePrefs();
&& (identity.isSelected() || showGroupConsensus.isSelected()));
showConsensLogo.setEnabled(annotations.isSelected()
&& (identity.isSelected() || showGroupConsensus.isSelected()));
- showInformationHistogram.setEnabled(annotations.isSelected());
- showHMMLogo.setEnabled(annotations.isSelected());
}
@Override
}
return true;
}
-
- /**
- * Returns true if the given text field contains a path to a folder that
- * contains an executable with the given name, else false (after showing a
- * warning dialog). The executable name will be tried with .exe appended if not
- * found.
- *
- * @param textField
- * @param executable
- */
- protected boolean validateExecutablePath(JTextField textField, String executable)
- {
- String folder = textField.getText().trim();
-
- if (FileUtils.getExecutable(executable, folder) != null)
- {
- return true;
- }
- if (folder.length() > 0)
- {
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.formatMessage("label.executable_not_found",
- executable),
- MessageManager.getString("label.invalid_folder"),
- JvOptionPane.ERROR_MESSAGE);
- }
- return false;
- }
-
- /**
- * Checks if a file can be executed
- *
- * @param path
- * the path to the file
- * @return
- */
- public boolean canExecute(String path)
- {
- File file = new File(path);
- if (!file.canExecute())
- {
- file = new File(path + ".exe");
- {
- if (!file.canExecute())
- {
- return false;
- }
- }
- }
- return true;
- }
/**
* If Chimera is selected, check it can be found on default or user-specified
}
}
- @Override
- protected void validateHmmerPath()
- {
- validateExecutablePath(hmmerPath, HmmerCommand.HMMBUILD);
- }
-
- @Override
- protected void validateCygwinPath()
- {
- validateExecutablePath(cygwinPath, "run");
- }
-
public class OptionsParam
{
private String name;
// always do this - annotation has own state
// but defer colourscheme update until hidden sequences are passed in
- boolean vischange = stretchGroup.recalcAnnotations(true);
+ boolean vischange = stretchGroup.recalcConservation(true);
updateOverviewAndStructs |= vischange && av.isSelectionDefinedGroup()
&& afterDrag;
if (stretchGroup.cs != null)
import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
private static jalview.ws.SequenceFetcher sfetch = null;
- private static long lastDasSourceRegistry = -3;
-
- private static DasSourceRegistryI dasRegistry = null;
-
private static boolean _initingFetcher = false;
private static Thread initingThread = null;
Thread.currentThread().hashCode());
}
}
- if (sfetch == null || dasRegistry != Cache.getDasSourceRegistry()
- || lastDasSourceRegistry != (Cache.getDasSourceRegistry()
- .getDasRegistryURL()
- + Cache.getDasSourceRegistry().getLocalSourceString())
- .hashCode())
+ if (sfetch == null)
{
_initingFetcher = true;
initingThread = Thread.currentThread();
"status.init_sequence_database_fetchers"),
Thread.currentThread().hashCode());
}
- dasRegistry = Cache.getDasSourceRegistry();
- dasRegistry.refreshSources();
jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
if (guiWindow != null)
{
guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
}
- lastDasSourceRegistry = (dasRegistry.getDasRegistryURL()
- + dasRegistry.getLocalSourceString()).hashCode();
sfetch = sf;
_initingFetcher = false;
initingThread = null;
dbeg.setText(MessageManager.formatMessage("label.example_query_param",
new String[]
{ eq }));
+ // TODO this should be a property of the SequenceFetcher whether commas are and
+ // colons are allowed in the IDs...
+
boolean enablePunct = !(eq != null && eq.indexOf(",") > -1);
- for (DbSourceProxy dbs : database.getSelectedSources())
- {
- if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
- {
- enablePunct = false;
- break;
- }
- }
replacePunctuation.setEnabled(enablePunct);
} catch (Exception ex)
*/
package jalview.gui;
-import jalview.api.AlignViewportI;
import jalview.api.SplitContainerI;
import jalview.datamodel.AlignmentI;
import jalview.jbgui.GAlignFrame;
topFrame.alignPanel.adjustAnnotationHeight();
bottomFrame.alignPanel.adjustAnnotationHeight();
- final AlignViewportI topViewport = topFrame.viewport;
- final AlignViewportI bottomViewport = bottomFrame.viewport;
+ final AlignViewport topViewport = topFrame.viewport;
+ final AlignViewport bottomViewport = bottomFrame.viewport;
final AlignmentI topAlignment = topViewport.getAlignment();
final AlignmentI bottomAlignment = bottomViewport.getAlignment();
boolean topAnnotations = topViewport.isShowAnnotation();
import java.awt.event.ItemListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+import java.net.URL;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.border.TitledBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import net.miginfocom.swing.MigLayout;
+
import compbio.metadata.Argument;
import compbio.metadata.Option;
import compbio.metadata.Parameter;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
-import net.miginfocom.swing.MigLayout;
+import compbio.metadata.RunnerConfig;
/**
* job parameter editing/browsing dialog box. User can browse existing settings
public class WsJobParameters extends JPanel implements ItemListener,
ActionListener, DocumentListener, OptsParametersContainerI
{
- private static final int PREFERRED_WIDTH = 540;
-
- private static final int DEFAULT_HEIGHT = 640;
+ URL linkImageURL = getClass().getResource("/images/link.gif");
- // the default parameter set shown to the user
- private static final String SVC_DEF = "Defaults";
+ private static final String SVC_DEF = "Defaults"; // this is the null
+ // parameter set as shown to
+ // user
- private int maxOptWidth = 200;
-
- // URL linkImageURL = getClass().getResource("/images/link.gif");
-
- /*
- * controller for options and parameters layout
+ /**
+ * manager for options and parameters.
*/
- OptsAndParamsPage opanp;
+ OptsAndParamsPage opanp = new OptsAndParamsPage(this);
- /*
+ /**
* panel containing job options
*/
- JPanel optionsPanel = new JPanel();
+ JPanel jobOptions = new JPanel();
- /*
+ /**
* panel containing job parameters
*/
- JPanel paramsPanel = new JPanel();
+ JPanel paramList = new JPanel();
+
+ JPanel SetNamePanel = new JPanel();
- JPanel setNamePanel = new JPanel();
+ JPanel setDetails = new JPanel();
+
+ JSplitPane settingsPanel = new JSplitPane();
+
+ JPanel jobPanel = new JPanel();
+
+ JScrollPane jobOptionsPane = new JScrollPane();
JButton createpref = new JButton();
JButton updatepref = new JButton();
- JComboBox<String> setName = new JComboBox<>();
+ JButton startjob = new JButton();
- JTextArea setDescr = new JTextArea();
+ JButton canceljob = new JButton();
- JScrollPane paramPane = new JScrollPane();
+ JComboBox setName = new JComboBox();
- ParamDatastoreI paramStore;
+ JTextArea setDescr = new JTextArea();
- // set true when 'Start Job' is clicked
- boolean startJob = false;
+ JScrollPane paramPane = new JScrollPane();
- JDialog frame = null;
+ // ScrollablePanel optsAndparams = new ScrollablePanel();
+ JPanel optsAndparams = new JPanel();
- Jws2Instance service;
+ RunnerConfig serviceOptions;
- /*
- * list of service presets in the gui
- */
- Hashtable<String, String> servicePresets = null;
-
- /*
- * set if dialog is being set - so handlers will avoid spurious events
- */
- boolean settingDialog = false;
+ ParamDatastoreI paramStore;
- private Hashtable<Object, Object> modifiedElements = new Hashtable<>();
+ private int MAX_OPTWIDTH = 200;
- String lastParmSet = null;
+ WsJobParameters(Jws2Instance service)
+ {
+ this(service, null);
+ }
- public WsJobParameters(ParamDatastoreI store, WsParamSetI preset,
- List<ArgumentI> args)
+ public WsJobParameters(Jws2Instance service, WsParamSetI preset)
{
- super();
+ this(null, service, preset, null);
+ }
- // parameters dialog in 'compact' format (help as tooltips)
- opanp = new OptsAndParamsPage(this, true);
- jbInit();
- this.paramStore = store;
- this.service = null;
- init(preset, args);
- validate();
+ /**
+ *
+ * @param desktop
+ * - if null, create new JFrame outside of desktop
+ * @param service
+ * @param preset
+ */
+ public WsJobParameters(JFrame parent, Jws2Instance service,
+ WsParamSetI preset, List<Argument> jobArgset)
+ {
+ this(parent, null, service, preset, jobArgset);
}
/**
- * Constructor given a set of parameters and presets, a service to be invoked,
- * and a list of (Jabaws client) arguments
*
+ * @param parent
* @param paramStorei
* @param service
* @param preset
* @param jobArgset
*/
- public WsJobParameters(ParamDatastoreI paramStorei, Jws2Instance service,
- WsParamSetI preset, List<Argument> jobArgset)
+ public WsJobParameters(JFrame parent, ParamDatastoreI paramStorei,
+ Jws2Instance service, WsParamSetI preset,
+ List<Argument> jobArgset)
{
super();
-
- // parameters dialog in 'expanded' format (help text boxes)
- opanp = new OptsAndParamsPage(this, false);
-
jbInit();
this.paramStore = paramStorei;
- if (paramStore == null && service != null)
+ if (paramStore == null)
{
paramStore = service.getParamStore();
}
this.service = service;
- initForService(preset, jobArgset);
+ // argSetModified(false);
+ // populate parameter table
+ initForService(service, preset, jobArgset);
+ // display in new JFrame attached to parent.
validate();
}
+ int response = -1;
+
+ JDialog frame = null;
+
/**
- * Shows a modal dialog containing the parameters and Start or Cancel options.
- * Answers true if the job is started, false if cancelled.
+ * shows a modal dialog containing the parameters.
*
* @return
*/
{
frame = new JDialog(Desktop.instance, true);
- if (service != null)
- {
- frame.setTitle(MessageManager.formatMessage("label.edit_params_for",
- new String[]
- { service.getActionText() }));
- }
+ frame.setTitle(MessageManager.formatMessage("label.edit_params_for",
+ new String[]
+ { service.getActionText() }));
Rectangle deskr = Desktop.instance.getBounds();
Dimension pref = this.getPreferredSize();
frame.setBounds(
});
frame.setVisible(true);
- return startJob;
+ if (response > 0)
+ {
+ return true;
+ }
+ return false;
}
private void jbInit()
@Override
public void actionPerformed(ActionEvent e)
{
- update_actionPerformed();
+ update_actionPerformed(e);
}
});
deletepref = JvSwingUtils.makeButton(
@Override
public void actionPerformed(ActionEvent e)
{
- delete_actionPerformed();
+ delete_actionPerformed(e);
}
});
createpref = JvSwingUtils.makeButton(
@Override
public void actionPerformed(ActionEvent e)
{
- create_actionPerformed();
+ create_actionPerformed(e);
}
});
revertpref = JvSwingUtils.makeButton(
@Override
public void actionPerformed(ActionEvent e)
{
- revert_actionPerformed();
+ revert_actionPerformed(e);
}
});
-
- JButton startjob = JvSwingUtils.makeButton(
+ startjob = JvSwingUtils.makeButton(
MessageManager.getString("action.start_job"),
MessageManager.getString("label.start_job_current_settings"),
new ActionListener()
@Override
public void actionPerformed(ActionEvent e)
{
- startjob_actionPerformed();
+ startjob_actionPerformed(e);
}
});
- JButton canceljob = JvSwingUtils.makeButton(
+ canceljob = JvSwingUtils.makeButton(
MessageManager.getString("action.cancel_job"),
MessageManager.getString("label.cancel_job_close_dialog"),
new ActionListener()
@Override
public void actionPerformed(ActionEvent e)
{
- canceljob_actionPerformed();
+ canceljob_actionPerformed(e);
}
});
- JPanel setDetails = new JPanel();
setDetails.setBorder(
new TitledBorder(MessageManager.getString("label.details")));
setDetails.setLayout(new BorderLayout());
setName.getEditor().addActionListener(this);
JPanel setNameInfo = new JPanel(new FlowLayout(FlowLayout.LEFT));
GridBagLayout gbl = new GridBagLayout();
- setNamePanel.setLayout(gbl);
+ SetNamePanel.setLayout(gbl);
JLabel setNameLabel = new JLabel(
MessageManager.getString("label.current_parameter_set_name"));
revertpref.setVisible(false);
createpref.setVisible(false);
JPanel setsavebuts = new JPanel();
- setsavebuts.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 0)); // GridLayout(1,2));
+ setsavebuts.setLayout(new FlowLayout(FlowLayout.LEFT)); // GridLayout(1,2));
+ ((FlowLayout) setsavebuts.getLayout()).setHgap(10);
+ ((FlowLayout) setsavebuts.getLayout()).setVgap(0);
JPanel spacer = new JPanel();
spacer.setPreferredSize(new Dimension(2, 30));
setsavebuts.add(spacer);
// setsavebuts.setSize(new Dimension(150, 30));
JPanel buttonArea = new JPanel(new GridLayout(1, 1));
buttonArea.add(setsavebuts);
- setNamePanel.add(setNameInfo);
+ SetNamePanel.add(setNameInfo);
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridheight = 2;
gbl.setConstraints(setNameInfo, gbc);
- setNamePanel.add(buttonArea);
+ SetNamePanel.add(buttonArea);
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
// paramPane.setPreferredSize(new Dimension(360, 400));
// paramPane.setPreferredSize(null);
- optionsPanel.setBorder(
+ jobOptions.setBorder(
new TitledBorder(MessageManager.getString("label.options")));
- optionsPanel.setOpaque(true);
- paramsPanel.setBorder(
+ jobOptions.setOpaque(true);
+ paramList.setBorder(
new TitledBorder(MessageManager.getString("label.parameters")));
- paramsPanel.setOpaque(true);
+ paramList.setOpaque(true);
+ JPanel bjo = new JPanel(new BorderLayout()),
+ bjp = new JPanel(new BorderLayout());
+ bjo.add(jobOptions, BorderLayout.CENTER);
+ bjp.add(paramList, BorderLayout.CENTER);
+ bjp.setOpaque(true);
+ bjo.setOpaque(true);
// optsAndparams.setScrollableWidth(ScrollableSizeHint.FIT);
// optsAndparams.setScrollableHeight(ScrollableSizeHint.NONE);
// optsAndparams.setLayout(new BorderLayout());
- JPanel optsAndparams = new JPanel();
optsAndparams.setLayout(new BorderLayout());
- optsAndparams.add(optionsPanel, BorderLayout.NORTH);
- optsAndparams.add(paramsPanel, BorderLayout.CENTER);
+ optsAndparams.add(jobOptions, BorderLayout.NORTH);
+ optsAndparams.add(paramList, BorderLayout.CENTER);
JPanel jp = new JPanel(new BorderLayout());
jp.add(optsAndparams, BorderLayout.CENTER);
paramPane.getViewport().setView(jp);
paramPane.setBorder(null);
setLayout(new BorderLayout());
-
- JPanel jobPanel = new JPanel();
jobPanel.setPreferredSize(null);
jobPanel.setLayout(new BorderLayout());
jobPanel.add(setDetails, BorderLayout.NORTH);
jobPanel.add(paramPane, BorderLayout.CENTER);
// jobPanel.setOrientation(JSplitPane.VERTICAL_SPLIT);
- add(setNamePanel, BorderLayout.NORTH);
+ add(SetNamePanel, BorderLayout.NORTH);
add(jobPanel, BorderLayout.CENTER);
JPanel dialogpanel = new JPanel();
dialogpanel.add(canceljob);
// JAL-1580: setMaximumSize() doesn't work, so just size for the worst case:
// check for null is for JUnit usage
- final int windowHeight = Desktop.instance == null ? DEFAULT_HEIGHT
+ final int windowHeight = Desktop.instance == null ? 540
: Desktop.instance.getHeight();
- // setPreferredSize(new Dimension(PREFERRED_WIDTH, windowHeight));
+ setPreferredSize(new Dimension(540, windowHeight));
add(dialogpanel, BorderLayout.SOUTH);
validate();
}
- protected void revert_actionPerformed()
+ protected void revert_actionPerformed(ActionEvent e)
{
reInitDialog(lastParmSet);
updateWebServiceMenus();
}
- protected void update_actionPerformed()
+ protected void update_actionPerformed(ActionEvent e)
{
if (isUserPreset)
{
paramStore.deletePreset(lastParmSet2);
}
- protected void delete_actionPerformed()
+ protected void delete_actionPerformed(ActionEvent e)
{
if (isUserPreset)
{
updateWebServiceMenus();
}
- protected void create_actionPerformed()
+ protected void create_actionPerformed(ActionEvent e)
{
String curname = ((String) setName.getSelectedItem()).trim();
if (curname.length() > 0)
}
}
- protected void canceljob_actionPerformed()
+ protected void canceljob_actionPerformed(ActionEvent e)
{
- startJob = false;
+ response = 0;
if (frame != null)
{
frame.setVisible(false);
}
}
- protected void startjob_actionPerformed()
+ protected void startjob_actionPerformed(ActionEvent e)
{
- startJob = true;
+ response = 1;
if (frame != null)
{
frame.setVisible(false);
}
}
- void initForService(WsParamSetI jabap, List<Argument> jabajobArgset)
+ Jws2Instance service;
+
+ /**
+ * list of service presets in the gui
+ */
+ Hashtable servicePresets = null;
+
+ /**
+ * set if dialog is being set - so handlers will avoid spurious events
+ */
+ boolean settingDialog = false;
+
+ void initForService(Jws2Instance service, WsParamSetI jabap,
+ List<Argument> jabajobArgset)
{
WsParamSetI p = null;
List<ArgumentI> jobArgset = null;
// null;
}
- init(p, jobArgset);
-
- }
-
- void init(WsParamSetI p, List<ArgumentI> jobArgset)
- {
- Hashtable<String, String> exnames = new Hashtable<>();
+ Hashtable exnames = new Hashtable();
for (int i = 0, iSize = setName.getItemCount(); i < iSize; i++)
{
exnames.put(setName.getItemAt(i), setName.getItemAt(i));
}
- servicePresets = new Hashtable<>();
+ servicePresets = new Hashtable();
// Add the default entry - if not present already.
if (!exnames.contains(SVC_DEF))
{
exnames.put(SVC_DEF, SVC_DEF);
servicePresets.put(SVC_DEF, SVC_DEF);
}
-
- // String curname = (p == null ? "" : p.getName());
+ String curname = (p == null ? "" : p.getName());
for (WsParamSetI pr : paramStore.getPresets())
{
if (!pr.isModifiable())
}
}
settingDialog = false;
+
}
+ @SuppressWarnings("unchecked")
private void updateTable(WsParamSetI p, List<ArgumentI> jobArgset)
{
boolean setDefaultParams = false;
OptionI opt = (OptionI) myarg;
OptionBox ob = opanp.addOption(opt);
ob.resetToDefault(setDefaultParams);
- if (maxOptWidth < ob.getPreferredSize().width)
+ if (MAX_OPTWIDTH < ob.getPreferredSize().width)
{
- maxOptWidth = ob.getPreferredSize().width;
+ MAX_OPTWIDTH = ob.getPreferredSize().width;
}
ob.validate();
cw += ob.getPreferredSize().width + 5;
return modifiedElements.size() > 0;
}
+ private Hashtable modifiedElements = new Hashtable();
+
/**
* reset gui and modification state settings
*/
if (b && modifiedElements.size() > 0)
{
makeSetNameValid(!isUserPreset);
- setNamePanel.revalidate();
+ SetNamePanel.revalidate();
}
updateButtonDisplay();
}
// sync the gui with the preset database
for (int i = 0, iS = setName.getItemCount(); i < iS; i++)
{
- String snm = setName.getItemAt(i);
+ String snm = (String) setName.getItemAt(i);
if (snm.equals(nm))
{
makeupdate = true;
settingDialog = stn;
}
- /**
- * Rebuilds the Options and Parameters panels
- */
@Override
public void refreshParamLayout()
{
- final int rightMargin = 40;
- final int availableWidth = paramPane.getViewport().getSize().width
- - rightMargin
- - optionsPanel.getBorder().getBorderInsets(optionsPanel).left
- + optionsPanel.getBorder().getBorderInsets(optionsPanel).right;
+ // optsAndparams.setPreferredSize(null);
+ FlowLayout fl = new FlowLayout(FlowLayout.LEFT);
+ int sep = fl.getVgap();
+ boolean fh = true;
+ int os = 0,
+ s = jobOptions.getBorder().getBorderInsets(jobOptions).bottom
+ + jobOptions.getBorder().getBorderInsets(jobOptions).top
+ + 2 * sep;
+ /**
+ * final height for viewport
+ */
+ int finalh = s;
+ int panewidth = paramPane.getViewport().getSize().width - 120
+ - jobOptions.getBorder().getBorderInsets(jobOptions).left
+ + jobOptions.getBorder().getBorderInsets(jobOptions).right;
+
+ int w = 2 * fl.getHgap()
+ + (MAX_OPTWIDTH > OptsAndParamsPage.PARAM_WIDTH ? MAX_OPTWIDTH
+ : OptsAndParamsPage.PARAM_WIDTH);
+ int hgap = fl.getHgap(), cw = hgap;
if (opanp.getOptSet().size() > 0)
{
- int hgap = 5;
- int currentWidth = hgap;
- /*
- * layout constraint 'nogrid' prevents vertical column alignment,
- * allowing controls to flow without extra space inserted to align
- */
- optionsPanel.setLayout(new MigLayout("nogrid", "", ""));
- optionsPanel.removeAll();
- JPanel lastAdded = null;
+ jobOptions.setLayout(new MigLayout("", "", ""));
+ jobOptions.removeAll();
- /*
- * add each control in turn; if adding would overflow the right margin,
- * remove and re-add the previous parameter with "wrap" (after)
- * in order to start a new row
- */
for (OptionBox pbox : opanp.getOptSet().values())
{
pbox.validate();
- int boxWidth = pbox.getSize().width;
- currentWidth += boxWidth + hgap;
- boolean wrapAfterLast = currentWidth > availableWidth
- && lastAdded != null;
- // System.out.println(String.format(
- // "%s width=%d, paneWidth=%d, currentWidth=%d, wrapAfterLast=%s",
- // pbox.toString(), boxWidth, panewidth, currentWidth,
- // wrapAfterLast));
- if (wrapAfterLast)
+ cw += pbox.getSize().width + hgap;
+ if (cw + 120 > panewidth)
+ {
+ jobOptions.add(pbox, "wrap");
+ // System.out.println("Wrap on "+pbox.option.getName());
+ cw = hgap + pbox.getSize().width;
+ fh = true;
+ }
+ else
{
- optionsPanel.remove(lastAdded);
- optionsPanel.add(lastAdded, "wrap");
- currentWidth = hgap + boxWidth;
+ jobOptions.add(pbox);
+ }
+ if (fh)
+ {
+ finalh += pbox.getSize().height + fl.getVgap();
+ fh = false;
}
- optionsPanel.add(pbox);
- lastAdded = pbox;
}
- optionsPanel.revalidate();
+ jobOptions.revalidate();
}
else
{
- optionsPanel.setVisible(false);
+ jobOptions.setVisible(false);
}
+ // Now layout the parameters assuming they occupy one column - to calculate
+ // total height of options+parameters
+ fl = new FlowLayout(FlowLayout.LEFT);
+ // helpful hint from
+ // http://stackoverflow.com/questions/2743177/top-alignment-for-flowlayout
+ fl.setAlignOnBaseline(true);
if (opanp.getParamSet().size() > 0)
{
- paramsPanel.removeAll();
- paramsPanel.setLayout(new MigLayout("", "", ""));
- int hgap = 5;
- int currentWidth = hgap;
-
- JPanel lastAdded = null;
+ paramList.removeAll();
+ paramList.setLayout(new MigLayout("", "", ""));
+ fh = true;
for (ParamBox pbox : opanp.getParamSet().values())
{
pbox.validate();
- int boxWidth = pbox.getSize().width;
- currentWidth += boxWidth + hgap;
- boolean wrapAfterLast = currentWidth > availableWidth
- && lastAdded != null;
- if (wrapAfterLast)
+ cw += pbox.getSize().width + hgap;
+ if (cw + 160 > panewidth)
{
- paramsPanel.remove(lastAdded);
- paramsPanel.add(lastAdded, "wrap");
- currentWidth = pbox.getSize().width + hgap;
+ paramList.add(pbox, "wrap");
+ cw = pbox.getSize().width + hgap;
+ fh = true;
+ }
+ else
+ {
+ paramList.add(pbox);
+ }
+ if (fh)
+ {
+ finalh += pbox.getSize().height + fl.getVgap();
+ fh = false;
}
- paramsPanel.add(pbox);
- lastAdded = pbox;
- }
+ }
/*
* s = 2 * sep; for (ParamBox pbox : opanp.getParamSet().values()) {
* pbox.validate(); s += sep +
* .getBorder().getBorderInsets(paramList).bottom+paramList
* .getBorder().getBorderInsets(paramList).top;
*/
- paramsPanel.revalidate();
+ paramList.revalidate();
}
else
{
- paramsPanel.setVisible(false);
+ paramList.setVisible(false);
}
// TODO: waste some time trying to eliminate any unnecessary .validate calls
// here
int p = 0;
if (args.length > 0)
{
- Vector<String> services = new Vector<>();
+ Vector<String> services = new Vector<String>();
services.addElement(args[p++]);
Jws2Discoverer.getDiscoverer().setServiceUrls(services);
}
e.printStackTrace();
}
}
- WsJobParameters pgui = new WsJobParameters(null, lastserv,
- new JabaPreset(lastserv, pr), null);
+ WsJobParameters pgui = new WsJobParameters(lastserv,
+ new JabaPreset(lastserv, pr));
JFrame jf = new JFrame(MessageManager
.formatMessage("label.ws_parameters_for", new String[]
{ lastserv.getActionText() }));
return opanp.getCurrentSettings();
}
+ String lastParmSet = null;
+
/*
* Hashtable<String, Object[]> editedParams = new Hashtable<String,
* Object[]>();
int n = 0;
// remove any set names in the drop down menu that aren't either a reserved
// setting, or a user defined or service preset.
- Vector<String> items = new Vector<>();
+ Vector items = new Vector();
while (n < setName.getItemCount())
{
- String item = setName.getItemAt(n);
+ String item = (String) setName.getItemAt(n);
if (!item.equals(SVC_DEF) && !paramStore.presetExists(item))
{
setName.removeItemAt(n);
initArgSetModified();
syncSetNamesWithStore();
setName.setSelectedItem(lastParmSet);
- setNamePanel.validate();
+ SetNamePanel.validate();
validate();
settingDialog = false;
}
@Override
public void itemStateChanged(ItemEvent e)
{
- if (e.getSource() == setName
- && e.getStateChange() == ItemEvent.SELECTED)
+ if (e.getSource() == setName && e.getStateChange() == e.SELECTED)
{
final String setname = (String) setName.getSelectedItem();
- // System.out.println("Item state changed for " + setname
- // + " (handling ? " + !settingDialog + ")");
+ System.out.println("Item state changed for " + setname
+ + " (handling ? " + !settingDialog + ")");
if (settingDialog)
{
// ignore event
*/
public class WsParamSetManager implements ParamManager
{
- private static final String WS_PARAM_FILES = "WS_PARAM_FILES";
- Hashtable<String, ParamDatastoreI> paramparsers = new Hashtable<>();
+ Hashtable<String, ParamDatastoreI> paramparsers = new Hashtable<String, ParamDatastoreI>();
@Override
public WsParamSetI[] getParameterSet(String name, String serviceUrl,
boolean modifiable, boolean unmodifiable)
{
- String files = Cache.getProperty(WS_PARAM_FILES);
+ String files = Cache.getProperty("WS_PARAM_FILES");
if (files == null)
{
return null;
}
StringTokenizer st = new StringTokenizer(files, "|");
String pfile = null;
- ArrayList<WsParamSetI> params = new ArrayList<>();
+ ArrayList<WsParamSetI> params = new ArrayList<WsParamSetI>();
while (st.hasMoreTokens())
{
pfile = st.nextToken();
} catch (IOException e)
{
Cache.log.info("Failed to parse parameter file " + pfile
- + " (Check that all " + WS_PARAM_FILES
- + " entries are valid!)",
+ + " (Check that all JALVIEW_WSPARAMFILES entries are valid!)",
e);
}
}
private WsParamSetI[] parseParamFile(String filename) throws IOException
{
- List<WsParamSetI> psets = new ArrayList<>();
+ List<WsParamSetI> psets = new ArrayList<WsParamSetI>();
InputStreamReader is = new InputStreamReader(
new java.io.FileInputStream(new File(filename)), "UTF-8");
}
if (outfile != null)
{
- String paramFiles = jalview.bin.Cache.getDefault(WS_PARAM_FILES,
+ String paramFiles = jalview.bin.Cache.getDefault("WS_PARAM_FILES",
filename);
if (paramFiles.indexOf(filename) == -1)
{
}
paramFiles = paramFiles.concat(filename);
}
- jalview.bin.Cache.setProperty(WS_PARAM_FILES, paramFiles);
+ jalview.bin.Cache.setProperty("WS_PARAM_FILES", paramFiles);
jalview.schemabinding.version2.WebServiceParameterSet paramxml = new jalview.schemabinding.version2.WebServiceParameterSet();
{
return;
}
- String paramFiles = jalview.bin.Cache.getDefault(WS_PARAM_FILES, "");
+ String paramFiles = jalview.bin.Cache.getDefault("WS_PARAM_FILES", "");
if (paramFiles.indexOf(filename) > -1)
{
String nparamFiles = new String();
nparamFiles = nparamFiles.concat("|").concat(fl);
}
}
- jalview.bin.Cache.setProperty(WS_PARAM_FILES, nparamFiles);
+ jalview.bin.Cache.setProperty("WS_PARAM_FILES", nparamFiles);
}
try
*/
protected void initData()
{
- seqs = new Vector<>();
- annotations = new Vector<>();
- seqGroups = new ArrayList<>();
+ seqs = new Vector<SequenceI>();
+ annotations = new Vector<AlignmentAnnotation>();
+ seqGroups = new ArrayList<SequenceGroup>();
parseCalled = false;
}
@Override
public void setSeqs(SequenceI[] s)
{
- seqs = new Vector<>();
+ seqs = new Vector<SequenceI>();
for (int i = 0; i < s.length; i++)
{
{
if (newickStrings == null)
{
- newickStrings = new Vector<>();
+ newickStrings = new Vector<String[]>();
}
newickStrings.addElement(new String[] { treeName, newickString });
}
{
seqs.add(seq);
}
-
- /**
- * Used only for hmmer statistics, so should probably be removed at some
- * point. TODO remove this
- *
- * @return
- */
- public Vector<AlignmentAnnotation> getAnnotations()
- {
- return annotations;
- }
-
}
{
return false;
}
- },
- HMMER3("HMMER3", "hmm", true, true)
- {
- @Override
- public AlignmentFileReaderI getReader(FileParse source)
- throws IOException
- {
- return new HMMFile(source);
- }
-
- @Override
- public AlignmentFileWriterI getWriter(AlignmentI al)
- {
- return new HMMFile();
- }
};
-
private boolean writable;
private boolean readable;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
import java.util.StringTokenizer;
+import java.util.Vector;
import javax.swing.SwingUtilities;
public class FileLoader implements Runnable
{
- private static final String TAB = "\t";
-
String file;
DataSourceType protocol;
return alignFrame;
}
- public void LoadFileOntoAlignmentWaitTillLoaded(AlignViewport viewport,
- String file, DataSourceType sourceType, FileFormatI format)
+ public void updateRecentlyOpened()
{
- this.viewport = viewport;
- this.file = file;
- this.protocol = sourceType;
- this.format = format;
- _LoadAlignmentFileWaitTillLoaded();
- }
-
- protected void _LoadAlignmentFileWaitTillLoaded()
- {
- Thread loader = new Thread(this);
- loader.start();
-
- while (loader.isAlive())
+ Vector recent = new Vector();
+ if (protocol == DataSourceType.PASTE)
{
- try
- {
- Thread.sleep(500);
- } catch (Exception ex)
- {
- }
+ // do nothing if the file was pasted in as text... there is no filename to
+ // refer to it as.
+ return;
}
- }
-
- /**
- * Updates (or creates) the tab-separated list of recently opened files held
- * under the given property name by inserting the filePath at the front of the
- * list. Duplicates are removed, and the list is limited to 11 entries. The
- * method returns the updated value of the property.
- *
- * @param filePath
- * @param sourceType
- */
- public static String updateRecentlyOpened(String filePath,
- DataSourceType sourceType)
- {
- if (sourceType != DataSourceType.FILE
- && sourceType != DataSourceType.URL)
- {
- return null;
- }
-
- String propertyName = sourceType == DataSourceType.FILE ? "RECENT_FILE"
- : "RECENT_URL";
- String historyItems = Cache.getProperty(propertyName);
- if (filePath != null
- && filePath.indexOf(System.getProperty("java.io.tmpdir")) > -1)
+ if (file != null
+ && file.indexOf(System.getProperty("java.io.tmpdir")) > -1)
{
// ignore files loaded from the system's temporary directory
- return null;
+ return;
}
+ String type = protocol == DataSourceType.FILE ? "RECENT_FILE"
+ : "RECENT_URL";
- List<String> recent = new ArrayList<>();
+ String historyItems = jalview.bin.Cache.getProperty(type);
+
+ StringTokenizer st;
if (historyItems != null)
{
- StringTokenizer st = new StringTokenizer(historyItems, TAB);
+ st = new StringTokenizer(historyItems, "\t");
while (st.hasMoreTokens())
{
- String trimmed = st.nextToken().trim();
- if (!recent.contains(trimmed))
- {
- recent.add(trimmed);
- }
+ recent.addElement(st.nextElement().toString().trim());
}
}
- /*
- * if file was already in the list, it moves to the top
- */
- if (recent.contains(filePath))
+ if (recent.contains(file))
{
- recent.remove(filePath);
+ recent.remove(file);
}
- StringBuilder newHistory = new StringBuilder(filePath);
+ StringBuffer newHistory = new StringBuffer(file);
for (int i = 0; i < recent.size() && i < 10; i++)
{
- newHistory.append(TAB);
- newHistory.append(recent.get(i));
+ newHistory.append("\t");
+ newHistory.append(recent.elementAt(i));
}
- String newProperty = newHistory.toString();
- Cache.setProperty(propertyName, newProperty);
+ Cache.setProperty(type, newHistory.toString());
- return newProperty;
+ if (protocol == DataSourceType.FILE)
+ {
+ Cache.setProperty("DEFAULT_FILE_FORMAT", format.getName());
+ }
}
@Override
}
// append to existing alignment
viewport.addAlignment(al, title);
- if (source instanceof HMMFile)
- {
- AlignmentI alignment = viewport.getAlignment();
- SequenceI seq = alignment
- .getSequenceAt(alignment.getAbsoluteHeight() - 1);
- if (seq.hasHMMProfile())
- {
- /*
- * fudge: move HMM consensus sequence from last to first
- */
- alignment.deleteSequence(alignment.getAbsoluteHeight() - 1);
- alignment.insertSequenceAt(0, seq);
- }
- viewport.getAlignPanel().adjustAnnotationHeight();
- viewport.updateSequenceIdColours();
- }
}
else
{
}
}
- updateRecentlyOpened(file, protocol);
-
- if (protocol == DataSourceType.FILE && format != null)
- {
- Cache.setProperty("DEFAULT_FILE_FORMAT", format.getName());
- }
+ updateRecentlyOpened();
} catch (Exception er)
{
reply = FileFormat.ScoreMatrix;
break;
}
- if (data.startsWith("HMMER3"))
- {
- reply = FileFormat.HMMER3;
- break;
- }
if (data.startsWith("H ") && !aaIndexHeaderRead)
{
aaIndexHeaderRead = true;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
import jalview.datamodel.Mapping;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.HashMap;
import java.util.Hashtable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Vector;
import com.stevesoft.pat.Regex;
{
private static final String ANNOTATION = "annotation";
- private static final char UNDERSCORE = '_';
+ private static final Regex OPEN_PAREN = new Regex("(<|\\[)", "(");
- // private static final Regex OPEN_PAREN = new Regex("(<|\\[)", "(");
- // private static final Regex CLOSE_PAREN = new Regex("(>|\\])", ")");
+ private static final Regex CLOSE_PAREN = new Regex("(>|\\])", ")");
public static final Regex DETECT_BRACKETS = new Regex(
"(<|>|\\[|\\]|\\(|\\)|\\{|\\})");
- /*
- * lookup table of Stockholm 'feature' (annotation) types
- * see http://sonnhammer.sbc.su.se/Stockholm.html
- */
- private static Map<String, String> featureTypes = null;
-
- static
- {
- featureTypes = new HashMap<>();
- featureTypes.put("SS", "Secondary Structure");
- featureTypes.put("SA", "Surface Accessibility");
- featureTypes.put("TM", "transmembrane");
- featureTypes.put("PP", "Posterior Probability");
- featureTypes.put("LI", "ligand binding");
- featureTypes.put("AS", "active site");
- featureTypes.put("IN", "intron");
- featureTypes.put("IR", "interacting residue");
- featureTypes.put("AC", "accession");
- featureTypes.put("OS", "organism");
- featureTypes.put("CL", "class");
- featureTypes.put("DE", "description");
- featureTypes.put("DR", "reference");
- featureTypes.put("LO", "look");
- featureTypes.put("RF", "Reference Positions");
- }
+ StringBuffer out; // output buffer
- private AlignmentI al;
+ AlignmentI al;
public StockholmFile()
{
}
/**
- * Creates a new StockholmFile object for output
+ * Creates a new StockholmFile object for output.
*/
public StockholmFile(AlignmentI al)
{
super(source);
}
- /**
- * Answers the readable description for a (case-sensitive) annotation type
- * code, for example "Reference Positions" for "RF". Returns the type code if
- * no description is found.
- *
- * @param id
- * @return
- */
- public static String typeToDescription(String id)
- {
- if (featureTypes.containsKey(id))
- {
- return featureTypes.get(id);
- }
- System.err.println(
- "Warning : Unknown Stockholm annotation type code " + id);
- return id;
- }
-
- /**
- * Answers the annotation type code for a (non-case-sensitive) readable
- * description, for example "RF" for "Reference Positions" (or null if not
- * found)
- *
- * @param description
- * @return
- */
- public static String descriptionToType(String description)
- {
- for (Entry<String, String> entry : featureTypes.entrySet())
- {
- if (entry.getValue().equalsIgnoreCase(description))
- {
- return entry.getKey();
- }
- }
- System.err.println(
- "Warning : Unknown Stockholm annotation type: " + description);
- return null;
- }
-
@Override
public void initData()
{
String version;
// String id;
Hashtable seqAnn = new Hashtable(); // Sequence related annotations
- LinkedHashMap<String, String> seqs = new LinkedHashMap<>();
+ LinkedHashMap<String, String> seqs = new LinkedHashMap<String, String>();
Regex p, r, rend, s, x;
// Temporary line for processing RNA annotation
// String RNAannot = "";
// logger.debug("Stockholm version: " + version);
}
- // We define some Regexes here that will be used regularly later
+ // 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
Regex closeparen = new Regex("(>|\\])", ")");
// Detect if file is RNA by looking for bracket types
- // Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");
rend.optimize();
p.optimize();
Hashtable content = (Hashtable) features.remove(type);
// add alignment annotation for this feature
- String key = descriptionToType(type);
+ String key = type2id(type);
/*
* have we added annotation rows for this type ?
}
Hashtable content;
- if (features.containsKey(StockholmFile.typeToDescription(type)))
+ if (features.containsKey(this.id2type(type)))
{
// logger.debug("Found content for " + this.id2type(type));
- content = (Hashtable) features
- .get(StockholmFile.typeToDescription(type));
+ content = (Hashtable) features.get(this.id2type(type));
}
else
{
// logger.debug("Creating new content holder for " +
// this.id2type(type));
content = new Hashtable();
- features.put(StockholmFile.typeToDescription(type), content);
+ features.put(this.id2type(type), content);
}
String ns = (String) content.get(ANNOTATION);
strucAnn = new Hashtable();
}
- Vector<AlignmentAnnotation> newStruc = new Vector<>();
+ Vector<AlignmentAnnotation> newStruc = new Vector<AlignmentAnnotation>();
parseAnnotationRow(newStruc, type, ns);
for (AlignmentAnnotation alan : newStruc)
{
private void guessDatabaseFor(Sequence seqO, String dbr, String dbsource)
{
DBRefEntry dbrf = null;
- List<DBRefEntry> dbrs = new ArrayList<>();
+ List<DBRefEntry> dbrs = new ArrayList<DBRefEntry>();
String seqdb = "Unknown", sdbac = "" + dbr;
int st = -1, en = -1, p;
if ((st = sdbac.indexOf("/")) > -1)
Vector<AlignmentAnnotation> annotation, String label,
String annots)
{
- // String convert1 = OPEN_PAREN.replaceAll(annots);
- // String convert2 = CLOSE_PAREN.replaceAll(convert1);
+ String convert1, convert2 = null;
+
+ // convert1 = OPEN_PAREN.replaceAll(annots);
+ // convert2 = CLOSE_PAREN.replaceAll(convert1);
// annots = convert2;
String type = label;
: label;
}
boolean ss = false, posterior = false;
- type = typeToDescription(type);
+ type = id2type(type);
if (type.equalsIgnoreCase("secondary structure"))
{
ss = true;
for (int i = 0; i < annots.length(); i++)
{
String pos = annots.substring(i, i + 1);
- if (UNDERSCORE == pos.charAt(0))
- {
- pos = " ";
- }
Annotation ann;
ann = new Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not
// be written out
}
@Override
- public String print(final SequenceI[] sequences, boolean jvSuffix)
+ public String print(SequenceI[] s, boolean jvSuffix)
{
- StringBuilder out = new StringBuilder();
+ out = new StringBuffer();
out.append("# STOCKHOLM 1.0");
out.append(newline);
- int maxIdWidth = 0;
- for (SequenceI seq : sequences)
+ // find max length of id
+ int max = 0;
+ int maxid = 0;
+ int in = 0;
+ Hashtable dataRef = null;
+ while ((in < s.length) && (s[in] != null))
{
- if (seq != null)
+ String tmp = printId(s[in], jvSuffix);
+ max = Math.max(max, s[in].getLength());
+
+ if (tmp.length() > maxid)
+ {
+ maxid = tmp.length();
+ }
+ if (s[in].getDBRefs() != null)
{
- String formattedId = printId(seq, jvSuffix);
- maxIdWidth = Math.max(maxIdWidth, formattedId.length());
+ for (int idb = 0; idb < s[in].getDBRefs().length; idb++)
+ {
+ if (dataRef == null)
+ {
+ dataRef = new Hashtable();
+ }
+
+ String datAs1 = s[in].getDBRefs()[idb].getSource().toString()
+ + " ; "
+ + s[in].getDBRefs()[idb].getAccessionId().toString();
+ dataRef.put(tmp, datAs1);
+ }
}
+ in++;
}
- maxIdWidth += 9;
+ maxid += 9;
+ int i = 0;
- /*
- * generic alignment properties
- */
- Hashtable props = al.getProperties();
- if (props != null)
+ // output database type
+ if (al.getProperties() != null)
{
- for (Object key : props.keySet())
+ if (!al.getProperties().isEmpty())
{
- out.append(String.format("#=GF %s %s", key.toString(),
- props.get(key).toString()));
- out.append(newline);
+ Enumeration key = al.getProperties().keys();
+ Enumeration val = al.getProperties().elements();
+ while (key.hasMoreElements())
+ {
+ out.append("#=GF " + key.nextElement() + " " + val.nextElement());
+ out.append(newline);
+ }
}
}
- /*
- * output database accessions as #=GS (per sequence annotation)
- * PFAM or RFAM are output as AC <accession number>
- * others are output as DR <dbname> ; <accession>
- */
- Format formatter = new Format("%-" + (maxIdWidth - 2) + "s");
- for (SequenceI seq : sequences)
+ // output database accessions
+ if (dataRef != null)
{
- if (seq != null)
+ Enumeration en = dataRef.keys();
+ while (en.hasMoreElements())
{
- DBRefEntry[] dbRefs = seq.getDBRefs();
- if (dbRefs != null)
+ Object idd = en.nextElement();
+ String type = (String) dataRef.remove(idd);
+ out.append(new Format("%-" + (maxid - 2) + "s")
+ .form("#=GS " + idd.toString() + " "));
+ if (type.contains("PFAM") || type.contains("RFAM"))
{
- String idField = formatter
- .form("#=GS " + printId(seq, jvSuffix) + " ");
- for (DBRefEntry dbRef : dbRefs)
- {
- out.append(idField);
- printDbRef(out, dbRef);
- }
+
+ out.append(" AC " + type.substring(type.indexOf(";") + 1));
}
+ else
+ {
+ out.append(" DR " + type + " ");
+ }
+ out.append(newline);
}
}
- /*
- * output annotations
- */
- for (SequenceI seq : sequences)
+ // output annotations
+ while (i < s.length && s[i] != null)
{
- if (seq != null)
+ AlignmentAnnotation[] alAnot = s[i].getAnnotation();
+ if (alAnot != null)
{
- AlignmentAnnotation[] alAnot = seq.getAnnotation();
- if (alAnot != null)
+ Annotation[] ann;
+ for (int j = 0; j < alAnot.length; j++)
{
- for (int j = 0; j < alAnot.length; j++)
+
+ String key = type2id(alAnot[j].label);
+ boolean isrna = alAnot[j].isValidStruc();
+
+ if (isrna)
+ {
+ // hardwire to secondary structure if there is RNA secondary
+ // structure on the annotation
+ key = "SS";
+ }
+ if (key == null)
{
- AlignmentAnnotation ann = alAnot[j];
- String key = descriptionToType(ann.label);
- boolean isrna = ann.isValidStruc();
- if (isrna)
- {
- /*
- * output as secondary structure if there is
- * RNA secondary structure on the annotation
- */
- key = "SS";
- }
- if (key == null)
- {
- continue;
- }
- out.append(new Format("%-" + maxIdWidth + "s").form(
- "#=GR " + printId(seq, jvSuffix) + " " + key + " "));
- Annotation[] anns = ann.annotations;
- StringBuilder seqString = new StringBuilder();
- for (int k = 0; k < anns.length; k++)
- {
- seqString
- .append(getAnnotationCharacter(key, k, anns[k], seq));
- }
- out.append(seqString.toString());
- out.append(newline);
+ continue;
}
- }
- out.append(new Format("%-" + maxIdWidth + "s")
- .form(printId(seq, jvSuffix) + " "));
- out.append(seq.getSequenceAsString());
- out.append(newline);
+ // out.append("#=GR ");
+ out.append(new Format("%-" + maxid + "s").form(
+ "#=GR " + printId(s[i], jvSuffix) + " " + key + " "));
+ ann = alAnot[j].annotations;
+ String seq = "";
+ for (int k = 0; k < ann.length; k++)
+ {
+ seq += outputCharacter(key, k, isrna, ann, s[i]);
+ }
+ out.append(seq);
+ out.append(newline);
+ }
}
+
+ out.append(new Format("%-" + maxid + "s")
+ .form(printId(s[i], jvSuffix) + " "));
+ out.append(s[i].getSequenceAsString());
+ out.append(newline);
+ i++;
}
- /*
- * output alignment annotation (but not auto-calculated or sequence-related)
- */
+ // alignment annotation
+ AlignmentAnnotation aa;
if (al.getAlignmentAnnotation() != null)
{
for (int ia = 0; ia < al.getAlignmentAnnotation().length; ia++)
{
- AlignmentAnnotation aa = al.getAlignmentAnnotation()[ia];
+ aa = al.getAlignmentAnnotation()[ia];
if (aa.autoCalculated || !aa.visible || aa.sequenceRef != null)
{
continue;
}
- String label = aa.label;
+ String seq = "";
+ String label;
String key = "";
if (aa.label.equals("seq"))
{
}
else
{
- key = descriptionToType(aa.label);
- if ("RF".equals(key))
+ key = type2id(aa.label.toLowerCase());
+ if (key == null)
{
- label = key;
+ label = aa.label;
}
- else if (key != null)
+ else
{
label = key + "_cons";
}
}
+ if (label == null)
+ {
+ label = aa.label;
+ }
label = label.replace(" ", "_");
out.append(
- new Format("%-" + maxIdWidth + "s")
- .form("#=GC " + label + " "));
- StringBuilder sb = new StringBuilder(aa.annotations.length);
+ new Format("%-" + maxid + "s").form("#=GC " + label + " "));
+ boolean isrna = aa.isValidStruc();
for (int j = 0; j < aa.annotations.length; j++)
{
- sb.append(
- getAnnotationCharacter(key, j, aa.annotations[j], null));
+ seq += outputCharacter(key, j, isrna, aa.annotations, null);
}
- out.append(sb.toString());
+ out.append(seq);
out.append(newline);
}
}
}
/**
- * A helper method that appends a formatted dbref to the output buffer
- *
- * @param out
- * @param dbRef
- */
- protected void printDbRef(StringBuilder out, DBRefEntry dbRef)
- {
- String db = dbRef.getSource();
- String acc = dbRef.getAccessionId();
- if (DBRefSource.PFAM.equalsIgnoreCase(db)
- || DBRefSource.RFAM.equalsIgnoreCase(db))
- {
- out.append(" AC " + acc);
- }
- else
- {
- out.append(" DR " + db + " ; " + acc);
- }
- out.append(newline);
- }
-
- /**
- * Returns an annotation character to add to the output row
+ * add an annotation character to the output row
*
* @param seq
* @param key
* @param k
+ * @param isrna
* @param ann
* @param sequenceI
*/
- static char getAnnotationCharacter(String key, int k, Annotation annot,
- SequenceI sequenceI)
+ private char outputCharacter(String key, int k, boolean isrna,
+ Annotation[] ann, SequenceI sequenceI)
{
char seq = ' ';
+ Annotation annot = ann[k];
String ch = (annot == null)
? ((sequenceI == null) ? "-"
: Character.toString(sequenceI.getCharAt(k)))
{
if (annot == null)
{
- // Stockholm format requires underscore, not space
- return UNDERSCORE;
+ // sensible gap character
+ return ' ';
}
else
{
return seq;
}
+ public String print()
+ {
+ out = new StringBuffer();
+ out.append("# STOCKHOLM 1.0");
+ out.append(newline);
+ print(getSeqsAsArray(), false);
+
+ out.append("//");
+ out.append(newline);
+ return out.toString();
+ }
+
+ private static Hashtable typeIds = null;
+
+ static
+ {
+ if (typeIds == null)
+ {
+ typeIds = new Hashtable();
+ typeIds.put("SS", "Secondary Structure");
+ typeIds.put("SA", "Surface Accessibility");
+ typeIds.put("TM", "transmembrane");
+ typeIds.put("PP", "Posterior Probability");
+ typeIds.put("LI", "ligand binding");
+ typeIds.put("AS", "active site");
+ typeIds.put("IN", "intron");
+ typeIds.put("IR", "interacting residue");
+ typeIds.put("AC", "accession");
+ typeIds.put("OS", "organism");
+ typeIds.put("CL", "class");
+ typeIds.put("DE", "description");
+ typeIds.put("DR", "reference");
+ typeIds.put("LO", "look");
+ typeIds.put("RF", "Reference Positions");
+
+ }
+ }
+
+ protected static String id2type(String id)
+ {
+ if (typeIds.containsKey(id))
+ {
+ return (String) typeIds.get(id);
+ }
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type code " + id);
+ return id;
+ }
+
+ protected static String type2id(String type)
+ {
+ String key = null;
+ Enumeration e = typeIds.keys();
+ while (e.hasMoreElements())
+ {
+ Object ll = e.nextElement();
+ if (typeIds.get(ll).toString().equalsIgnoreCase(type))
+ {
+ key = (String) ll;
+ break;
+ }
+ }
+ if (key != null)
+ {
+ return key;
+ }
+ System.err.println(
+ "Warning : Unknown Stockholm annotation type: " + type);
+ return key;
+ }
+
/**
* make a friendly ID string.
*
import jalview.bin.Cache;
import jalview.util.MessageManager;
-import java.awt.Color;
-import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.Set;
-import javax.swing.BorderFactory;
import javax.swing.JComboBox;
-import javax.swing.JLabel;
import javax.swing.JMenuItem;
-import javax.swing.JPanel;
import javax.swing.JPopupMenu;
-import javax.swing.JTextField;
import javax.swing.SwingUtilities;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
public class JvCacheableInputBox<E> extends JComboBox<String>
{
private static final long serialVersionUID = 5774610435079326695L;
- private static final int INPUT_LIMIT = 2;
-
private static final int LEFT_BOARDER_WIDTH = 16;
private String cacheKey;
private AppCache appCache;
- private JPanel pnlDefaultCache = new JPanel();
-
- private JLabel lblDefaultCacheSize = new JLabel();
-
- private JTextField txtDefaultCacheSize = new JTextField();
-
private JPopupMenu popup = new JPopupMenu();
private JMenuItem menuItemClearCache = new JMenuItem();
}
/**
- * Method for initialising cache items for a given cache key and populating
- * the in-memory cache with persisted cache items
+ * Method for initialising cache items for a given cache key and populating the
+ * in-memory cache with persisted cache items
*
* @param cacheKey
*/
.getAllCachedItemsFor(cacheKey);
if (foundCacheItems == null)
{
- foundCacheItems = new LinkedHashSet<String>();
+ foundCacheItems = new LinkedHashSet<>();
}
// populate memory cache
for (String cacheItem : persistedCacheItems)
*/
private void initCachePopupMenu()
{
- pnlDefaultCache.setBackground(Color.WHITE);
- // pad panel so as to align with other menu items
- pnlDefaultCache.setBorder(
- BorderFactory.createEmptyBorder(0, LEFT_BOARDER_WIDTH, 0, 0));
- txtDefaultCacheSize.setPreferredSize(new Dimension(45, 20));
- txtDefaultCacheSize.setFont(new java.awt.Font("Verdana", 0, 12));
- lblDefaultCacheSize
- .setText(MessageManager.getString("label.default_cache_size"));
- lblDefaultCacheSize.setFont(new java.awt.Font("Verdana", 0, 12));
- // Force input to accept only Integer entries up to length - INPUT_LIMIT
- txtDefaultCacheSize.setDocument(new PlainDocument()
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void insertString(int offs, String str, AttributeSet a)
- throws BadLocationException
- {
- if (getLength() + str.length() <= INPUT_LIMIT && isInteger(str))
- {
- super.insertString(offs, str, a);
- }
- }
- });
- txtDefaultCacheSize.addKeyListener(new java.awt.event.KeyAdapter()
- {
- @Override
- public void keyPressed(KeyEvent e)
- {
- if (e.getKeyCode() == KeyEvent.VK_ENTER)
- {
- e.consume();
- updateCache();
- closePopup();
- }
- }
- });
-
- txtDefaultCacheSize.setText(appCache.getCacheLimit(cacheKey));
- pnlDefaultCache.add(lblDefaultCacheSize);
menuItemClearCache.setFont(new java.awt.Font("Verdana", 0, 12));
- pnlDefaultCache.add(txtDefaultCacheSize);
menuItemClearCache
.setText(MessageManager.getString("action.clear_cached_items"));
menuItemClearCache.addActionListener(new ActionListener()
}
});
- popup.insert(pnlDefaultCache, 0);
popup.add(menuItemClearCache);
setComponentPopupMenu(popup);
add(popup);
}
- private void closePopup()
- {
- popup.setVisible(false);
- popup.transferFocus();
- }
-
/**
* Answers true if input text is an integer
*
@Override
public void run()
{
- int userLimit = txtDefaultCacheSize.getText().trim().isEmpty()
- ? Integer.valueOf(AppCache.DEFAULT_LIMIT)
- : Integer.valueOf(txtDefaultCacheSize.getText());
- int cacheLimit = appCache.updateCacheLimit(cacheKey, userLimit);
+ int cacheLimit = Integer.parseInt(appCache.getCacheLimit(cacheKey));
String userInput = getUserInput();
if (userInput != null && !userInput.isEmpty())
{
removeAllItems();
}
Set<String> cacheItems = appCache.getAllCachedItemsFor(cacheKey);
- List<String> reversedCacheItems = new ArrayList<String>();
+ List<String> reversedCacheItems = new ArrayList<>();
reversedCacheItems.addAll(cacheItems);
cacheItems = null;
Collections.reverse(reversedCacheItems);
public void persistCache()
{
appCache.persistCache(cacheKey);
- int userLimit = txtDefaultCacheSize.getText().trim().isEmpty()
- ? Integer.valueOf(AppCache.DEFAULT_LIMIT)
- : Integer.valueOf(txtDefaultCacheSize.getText());
- appCache.updateCacheLimit(cacheKey, userLimit);
}
/**
import jalview.bin.Cache;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
-import jalview.hmmer.HmmerCommand;
-import jalview.io.FileFormatException;
import jalview.io.FileFormats;
import jalview.util.MessageManager;
import jalview.util.Platform;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
protected JMenu webService = new JMenu();
- protected JMenu hmmerMenu = new JMenu();
-
protected JMenuItem webServiceNoServices;
protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
- protected JCheckBoxMenuItem showInformationHistogram = new JCheckBoxMenuItem();
-
- protected JCheckBoxMenuItem showHMMSequenceLogo = new JCheckBoxMenuItem();
-
- protected JCheckBoxMenuItem normaliseHMMSequenceLogo = new JCheckBoxMenuItem();
-
protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
private SequenceAnnotationOrder annotationSortOrder;
private boolean showAutoCalculatedAbove = false;
- private Map<KeyStroke, JMenuItem> accelerators = new HashMap<>();
+ private Map<KeyStroke, JMenuItem> accelerators = new HashMap<KeyStroke, JMenuItem>();
private SplitContainerI splitFrame;
private void jbInit() throws Exception
{
initColourMenu();
-
+
JMenuItem saveAs = new JMenuItem(
MessageManager.getString("action.save_as"));
ActionListener al = new ActionListener()
saveAs_actionPerformed(e);
}
};
-
+
// FIXME getDefaultToolkit throws an exception in Headless mode
KeyStroke keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
| KeyEvent.SHIFT_MASK,
false);
addMenuActionAndAccelerator(keyStroke, saveAs, al);
-
+
closeMenuItem.setText(MessageManager.getString("action.close"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_W,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
}
};
addMenuActionAndAccelerator(keyStroke, closeMenuItem, al);
-
+
JMenu editMenu = new JMenu(MessageManager.getString("action.edit"));
JMenu viewMenu = new JMenu(MessageManager.getString("action.view"));
JMenu annotationsMenu = new JMenu(
JMenu calculateMenu = new JMenu(
MessageManager.getString("action.calculate"));
webService.setText(MessageManager.getString("action.web_service"));
-
- initHMMERMenu();
-
JMenuItem selectAllSequenceMenuItem = new JMenuItem(
MessageManager.getString("action.select_all"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A,
}
};
addMenuActionAndAccelerator(keyStroke, selectAllSequenceMenuItem, al);
-
+
JMenuItem deselectAllSequenceMenuItem = new JMenuItem(
MessageManager.getString("action.deselect_all"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
}
};
addMenuActionAndAccelerator(keyStroke, deselectAllSequenceMenuItem, al);
-
+
JMenuItem invertSequenceMenuItem = new JMenuItem(
MessageManager.getString("action.invert_sequence_selection"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
}
};
addMenuActionAndAccelerator(keyStroke, invertSequenceMenuItem, al);
-
+
JMenuItem grpsFromSelection = new JMenuItem(
MessageManager.getString("action.make_groups_selection"));
grpsFromSelection.addActionListener(new ActionListener()
}
};
addMenuActionAndAccelerator(keyStroke, remove2LeftMenuItem, al);
-
+
JMenuItem remove2RightMenuItem = new JMenuItem(
MessageManager.getString("action.remove_right"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_R,
}
};
addMenuActionAndAccelerator(keyStroke, remove2RightMenuItem, al);
-
+
JMenuItem removeGappedColumnMenuItem = new JMenuItem(
MessageManager.getString("action.remove_empty_columns"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
}
};
addMenuActionAndAccelerator(keyStroke, removeGappedColumnMenuItem, al);
-
+
JMenuItem removeAllGapsMenuItem = new JMenuItem(
MessageManager.getString("action.remove_all_gaps"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_E,
}
};
addMenuActionAndAccelerator(keyStroke, removeAllGapsMenuItem, al);
-
+
JMenuItem justifyLeftMenuItem = new JMenuItem(
MessageManager.getString("action.left_justify_alignment"));
justifyLeftMenuItem.addActionListener(new ActionListener()
sortGroupMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem removeRedundancyMenuItem = new JMenuItem(
MessageManager.getString("action.remove_redundancy"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_D,
}
};
addMenuActionAndAccelerator(keyStroke, removeRedundancyMenuItem, al);
-
+
JMenuItem pairwiseAlignmentMenuItem = new JMenuItem(
MessageManager.getString("action.pairwise_alignment"));
pairwiseAlignmentMenuItem.addActionListener(new ActionListener()
pairwiseAlignmentMenuItem_actionPerformed(e);
}
});
-
+
this.getContentPane().setLayout(new BorderLayout());
alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));
statusBar.setBackground(Color.white);
statusBar.setFont(new java.awt.Font("Verdana", 0, 11));
statusBar.setBorder(BorderFactory.createLineBorder(Color.black));
statusBar.setText(MessageManager.getString("label.status_bar"));
-
outputTextboxMenu
.setText(MessageManager.getString("label.out_to_textbox"));
-
annotationPanelMenuItem.setActionCommand("");
annotationPanelMenuItem
.setText(MessageManager.getString("label.show_annotations"));
final JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem(
MessageManager.getString("label.sort_annotations_by_label"));
-
sortAnnBySequence.setSelected(
sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
sortAnnBySequence.addActionListener(new ActionListener()
colourTextMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem htmlMenuItem = new JMenuItem(
MessageManager.getString("label.html"));
htmlMenuItem.addActionListener(new ActionListener()
htmlMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem createBioJS = new JMenuItem(
MessageManager.getString("label.biojs_html_export"));
createBioJS.addActionListener(new java.awt.event.ActionListener()
bioJSMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem overviewMenuItem = new JMenuItem(
MessageManager.getString("label.overview_window"));
overviewMenuItem.addActionListener(new ActionListener()
overviewMenuItem_actionPerformed(e);
}
});
-
+
undoMenuItem.setEnabled(false);
undoMenuItem.setText(MessageManager.getString("action.undo"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Z,
}
};
addMenuActionAndAccelerator(keyStroke, undoMenuItem, al);
-
+
redoMenuItem.setEnabled(false);
redoMenuItem.setText(MessageManager.getString("action.redo"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_Y,
}
};
addMenuActionAndAccelerator(keyStroke, redoMenuItem, al);
-
+
wrapMenuItem.setText(MessageManager.getString("label.wrap"));
wrapMenuItem.addActionListener(new ActionListener()
{
wrapMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem printMenuItem = new JMenuItem(
MessageManager.getString("action.print"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_P,
}
};
addMenuActionAndAccelerator(keyStroke, printMenuItem, al);
-
+
renderGapsMenuItem
.setText(MessageManager.getString("action.show_gaps"));
renderGapsMenuItem.setState(true);
renderGapsMenuItem_actionPerformed(e);
}
});
-
+
JMenuItem findMenuItem = new JMenuItem(
MessageManager.getString("action.find"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_F,
showSeqFeatures.setText(
MessageManager.getString("label.show_sequence_features"));
-
showSeqFeatures.addActionListener(new ActionListener()
{
@Override
.setText(MessageManager.getString("label.show_database_refs"));
showDbRefsMenuitem.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showDbRefs_actionPerformed(e);
}
-
+
});
showNpFeatsMenuitem.setText(
MessageManager.getString("label.show_non_positional_features"));
showNpFeatsMenuitem.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showNpFeats_actionPerformed(e);
}
-
+
});
showGroupConservation
.setText(MessageManager.getString("label.group_conservation"));
showGroupConservation.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showGroupConservation_actionPerformed(e);
}
-
+
});
showGroupConsensus
.setText(MessageManager.getString("label.group_consensus"));
showGroupConsensus.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showGroupConsensus_actionPerformed(e);
}
-
+
});
showConsensusHistogram.setText(
MessageManager.getString("label.show_consensus_histogram"));
showConsensusHistogram.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showConsensusHistogram_actionPerformed(e);
}
-
+
});
showSequenceLogo
.setText(MessageManager.getString("label.show_consensus_logo"));
showSequenceLogo.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
showSequenceLogo_actionPerformed(e);
}
-
+
});
normaliseSequenceLogo
.setText(MessageManager.getString("label.norm_consensus_logo"));
normaliseSequenceLogo.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
normaliseSequenceLogo_actionPerformed(e);
}
-
+
});
applyAutoAnnotationSettings
.setText(MessageManager.getString("label.apply_all_groups"));
applyAutoAnnotationSettings_actionPerformed(e);
}
});
-
+
ButtonGroup buttonGroup = new ButtonGroup();
final JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem(
MessageManager.getString("label.show_first"));
sortAnnotations_actionPerformed();
}
});
-
+
JMenuItem deleteGroups = new JMenuItem(
MessageManager.getString("action.undefine_groups"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_U,
}
};
addMenuActionAndAccelerator(keyStroke, deleteGroups, al);
-
+
JMenuItem annotationColumn = new JMenuItem(
MessageManager.getString("action.select_by_annotation"));
annotationColumn.addActionListener(new ActionListener()
annotationColumn_actionPerformed(e);
}
});
-
+
JMenuItem createGroup = new JMenuItem(
MessageManager.getString("action.create_group"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
}
};
addMenuActionAndAccelerator(keyStroke, createGroup, al);
-
+
JMenuItem unGroup = new JMenuItem(
MessageManager.getString("action.remove_group"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G,
}
};
addMenuActionAndAccelerator(keyStroke, unGroup, al);
-
+
copy.setText(MessageManager.getString("action.copy"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_C,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
}
};
addMenuActionAndAccelerator(keyStroke, copy, al);
-
+
cut.setText(MessageManager.getString("action.cut"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
}
};
addMenuActionAndAccelerator(keyStroke, cut, al);
-
+
JMenuItem delete = new JMenuItem(
MessageManager.getString("action.delete"));
delete.addActionListener(new ActionListener()
delete_actionPerformed(e);
}
});
-
+
pasteMenu.setText(MessageManager.getString("action.paste"));
JMenuItem pasteNew = new JMenuItem(
MessageManager.getString("label.to_new_alignment"));
@Override
public void actionPerformed(ActionEvent e)
{
- try
- {
- pasteNew_actionPerformed(e);
- } catch (IOException | InterruptedException e1)
- {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+ pasteNew_actionPerformed(e);
}
};
addMenuActionAndAccelerator(keyStroke, pasteNew, al);
-
+
JMenuItem pasteThis = new JMenuItem(
MessageManager.getString("label.to_this_alignment"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_V,
@Override
public void actionPerformed(ActionEvent e)
{
- try
- {
- pasteThis_actionPerformed(e);
- } catch (IOException | InterruptedException e1)
- {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+ pasteThis_actionPerformed(e);
}
};
addMenuActionAndAccelerator(keyStroke, pasteThis, al);
-
+
JMenuItem createPNG = new JMenuItem("PNG");
createPNG.addActionListener(new ActionListener()
{
});
createPNG.setActionCommand(
MessageManager.getString("label.save_png_image"));
+
JMenuItem font = new JMenuItem(MessageManager.getString("action.font"));
font.addActionListener(new ActionListener()
{
createEPS(null);
}
});
-
+
JMenuItem createSVG = new JMenuItem("SVG");
createSVG.addActionListener(new ActionListener()
{
createSVG(null);
}
});
-
+
JMenuItem loadTreeMenuItem = new JMenuItem(
MessageManager.getString("label.load_associated_tree"));
loadTreeMenuItem.setActionCommand(
loadTreeMenuItem_actionPerformed(e);
}
});
-
+
scaleAbove.setVisible(false);
scaleAbove.setText(MessageManager.getString("action.scale_above"));
scaleAbove.addActionListener(new ActionListener()
.setText(MessageManager.getString("label.automatic_scrolling"));
followHighlightMenuItem.addActionListener(new ActionListener()
{
-
+
@Override
public void actionPerformed(ActionEvent e)
{
followHighlight_actionPerformed();
}
-
+
});
-
+
sortByTreeMenu
.setText(MessageManager.getString("action.by_tree_order"));
sort.setText(MessageManager.getString("action.sort"));
{
buildTreeSortMenu();
}
-
+
@Override
public void menuDeselected(MenuEvent e)
{
}
-
+
@Override
public void menuCanceled(MenuEvent e)
{
sort.add(sortByAnnotScore);
sort.addMenuListener(new javax.swing.event.MenuListener()
{
-
+
@Override
public void menuCanceled(MenuEvent e)
{
}
-
+
@Override
public void menuDeselected(MenuEvent e)
{
}
-
+
@Override
public void menuSelected(MenuEvent e)
{
showReverse_actionPerformed(true);
}
});
-
+
JMenuItem extractScores = new JMenuItem(
MessageManager.getString("label.extract_scores"));
extractScores.addActionListener(new ActionListener()
});
extractScores.setVisible(true);
// JBPNote: TODO: make gui for regex based score extraction
-
+
// for show products actions see AlignFrame.canShowProducts
showProducts.setText(MessageManager.getString("label.get_cross_refs"));
-
+
runGroovy.setText(MessageManager.getString("label.run_groovy"));
runGroovy.setToolTipText(
MessageManager.getString("label.run_groovy_tip"));
runGroovy_actionPerformed();
}
});
-
+
JMenuItem openFeatureSettings = new JMenuItem(
MessageManager.getString("action.feature_settings"));
openFeatureSettings.addActionListener(new ActionListener()
fetchSequence_actionPerformed(e);
}
});
-
+
JMenuItem associatedData = new JMenuItem(
MessageManager.getString("label.load_features_annotations"));
associatedData.addActionListener(new ActionListener()
@Override
public void actionPerformed(ActionEvent e)
{
- try
- {
- associatedData_actionPerformed(e);
- } catch (IOException | InterruptedException e1)
- {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
+ associatedData_actionPerformed(e);
}
});
loadVcf = new JMenuItem(MessageManager.getString("label.load_vcf_file"));
listenToViewSelections_actionPerformed(e);
}
});
-
+
JMenu addSequenceMenu = new JMenu(
MessageManager.getString("label.add_sequences"));
JMenuItem addFromFile = new JMenuItem(
hiddenMarkers_actionPerformed(e);
}
});
-
+
JMenuItem invertColSel = new JMenuItem(
MessageManager.getString("action.invert_column_selection"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_I,
}
};
addMenuActionAndAccelerator(keyStroke, invertColSel, al);
-
+
showComplementMenuItem.setVisible(false);
showComplementMenuItem.addActionListener(new ActionListener()
{
showComplement_actionPerformed(showComplementMenuItem.getState());
}
});
-
+
tabbedPane.addChangeListener(new javax.swing.event.ChangeListener()
{
@Override
tabbedPane_mousePressed(e);
}
}
-
+
@Override
public void mouseReleased(MouseEvent e)
{
tabbedPane_focusGained(e);
}
});
-
+
JMenuItem save = new JMenuItem(MessageManager.getString("action.save"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_S,
Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false);
}
};
addMenuActionAndAccelerator(keyStroke, save, al);
-
+
reload.setEnabled(false);
reload.setText(MessageManager.getString("action.reload"));
reload.addActionListener(new ActionListener()
reload_actionPerformed(e);
}
});
-
+
JMenuItem newView = new JMenuItem(
MessageManager.getString("action.new_view"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_T,
}
};
addMenuActionAndAccelerator(keyStroke, newView, al);
-
+
tabbedPane.setToolTipText("<html><i>"
+ MessageManager.getString("label.rename_tab_eXpand_reGroup")
+ "</i></html>");
-
+
formatMenu.setText(MessageManager.getString("action.format"));
JMenu selectMenu = new JMenu(MessageManager.getString("action.select"));
idRightAlign_actionPerformed(e);
}
});
-
+
gatherViews.setEnabled(false);
gatherViews.setText(MessageManager.getString("action.gather_views"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_G, 0, false);
}
};
addMenuActionAndAccelerator(keyStroke, gatherViews, al);
-
+
expandViews.setEnabled(false);
expandViews.setText(MessageManager.getString("action.expand_views"));
keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_X, 0, false);
}
};
addMenuActionAndAccelerator(keyStroke, expandViews, al);
-
+
JMenuItem pageSetup = new JMenuItem(
MessageManager.getString("action.page_setup"));
pageSetup.addActionListener(new ActionListener()
MessageManager.getString("label.sequence_id_tooltip"));
JMenu autoAnnMenu = new JMenu(
MessageManager.getString("label.autocalculated_annotation"));
-
+
JMenu exportImageMenu = new JMenu(
MessageManager.getString("label.export_image"));
JMenu fileMenu = new JMenu(MessageManager.getString("action.file"));
alignFrameMenuBar.add(colourMenu);
alignFrameMenuBar.add(calculateMenu);
alignFrameMenuBar.add(webService);
- alignFrameMenuBar.add(hmmerMenu);
-
+
fileMenu.add(fetchSequence);
fileMenu.add(addSequenceMenu);
fileMenu.add(reload);
fileMenu.add(loadVcf);
fileMenu.addSeparator();
fileMenu.add(closeMenuItem);
-
+
pasteMenu.add(pasteNew);
pasteMenu.add(pasteThis);
editMenu.add(undoMenuItem);
// editMenu.add(justifyRightMenuItem);
// editMenu.addSeparator();
editMenu.add(padGapsMenuitem);
-
+
showMenu.add(showAllColumns);
showMenu.add(showAllSeqs);
showMenu.add(showAllhidden);
viewMenu.add(alignmentProperties);
viewMenu.addSeparator();
viewMenu.add(overviewMenuItem);
-
+
annotationsMenu.add(annotationPanelMenuItem);
annotationsMenu.addSeparator();
annotationsMenu.add(showAllAlAnnotations);
calculateMenu.add(extractScores);
calculateMenu.addSeparator();
calculateMenu.add(runGroovy);
-
+
webServiceNoServices = new JMenuItem(
MessageManager.getString("label.no_services"));
webService.add(webServiceNoServices);
this.getContentPane().add(statusPanel, java.awt.BorderLayout.SOUTH);
statusPanel.add(statusBar, null);
this.getContentPane().add(tabbedPane, java.awt.BorderLayout.CENTER);
-
+
formatMenu.add(font);
formatMenu.addSeparator();
formatMenu.add(wrapMenuItem);
// selectMenu.add(listenToViewSelections);
}
- /**
- * Constructs the entries on the HMMER menu
- */
- protected void initHMMERMenu()
- {
- /*
- * hmmbuild
- */
- JMenu hmmBuild = new JMenu(MessageManager.getString("label.hmmbuild"));
- JMenuItem hmmBuildSettings = new JMenuItem(
- MessageManager.getString("label.edit_settings_and_run"));
- hmmBuildSettings.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmBuild_actionPerformed(false);
- }
- });
- JMenuItem hmmBuildRun = new JMenuItem(MessageManager.formatMessage(
- "label.action_with_default_settings", "hmmbuild"));
- hmmBuildRun.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmBuild_actionPerformed(true);
- }
- });
- hmmBuild.add(hmmBuildRun);
- hmmBuild.add(hmmBuildSettings);
-
- /*
- * hmmalign
- */
- JMenu hmmAlign = new JMenu(MessageManager.getString("label.hmmalign"));
- JMenuItem hmmAlignRun = new JMenuItem(MessageManager.formatMessage(
- "label.action_with_default_settings", "hmmalign"));
- hmmAlignRun.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmAlign_actionPerformed(true);
- }
- });
- JMenuItem hmmAlignSettings = new JMenuItem(
- MessageManager.getString("label.edit_settings_and_run"));
- hmmAlignSettings.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmAlign_actionPerformed(false);
- }
- });
- hmmAlign.add(hmmAlignRun);
- hmmAlign.add(hmmAlignSettings);
-
- /*
- * hmmsearch
- */
- JMenu hmmSearch = new JMenu(
- MessageManager.getString("label.hmmsearch"));
- JMenuItem hmmSearchSettings = new JMenuItem(
- MessageManager.getString("label.edit_settings_and_run"));
- hmmSearchSettings.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmSearch_actionPerformed(false);
- }
- });
- JMenuItem hmmSearchRun = new JMenuItem(MessageManager.formatMessage(
- "label.action_with_default_settings", "hmmsearch"));
- hmmSearchRun.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- hmmSearch_actionPerformed(true);
- }
- });
- JMenuItem addDatabase = new JMenuItem(
- MessageManager.getString("label.add_database"));
- addDatabase.addActionListener(new ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- try
- {
- addDatabase_actionPerformed();
- } catch (IOException e1)
- {
- e1.printStackTrace();
- }
- }
- });
- hmmSearch.add(hmmSearchRun);
- hmmSearch.add(hmmSearchSettings);
- // hmmSearch.add(addDatabase);
-
- /*
- * top level menu
- */
- hmmerMenu.setText(MessageManager.getString("action.hmmer"));
- hmmerMenu.setEnabled(HmmerCommand.isHmmerAvailable());
- hmmerMenu.add(hmmBuild);
- hmmerMenu.add(hmmAlign);
- hmmerMenu.add(hmmSearch);
-
- }
-
protected void loadVcf_actionPerformed()
{
}
}
protected void pasteNew_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
}
protected void pasteThis_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
}
{
}
- protected void hmmBuild_actionPerformed(boolean withDefaults)
- {
- }
-
- protected void hmmSearch_actionPerformed(boolean withDefaults)
- {
- }
-
- protected void addDatabase_actionPerformed()
- throws FileFormatException, IOException
- {
- }
-
- protected void hmmAlign_actionPerformed(boolean withDefaults)
- {
- }
-
public void createPNG(java.io.File f)
{
}
}
public void associatedData_actionPerformed(ActionEvent e)
- throws IOException, InterruptedException
{
}
import jalview.gui.JvSwingUtils;
import jalview.gui.StructureViewer.ViewerType;
import jalview.util.MessageManager;
-import jalview.util.Platform;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import javax.swing.AbstractButton;
import javax.swing.AbstractCellEditor;
import javax.swing.BorderFactory;
-import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
-import javax.swing.JComponent;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
-import net.miginfocom.swing.MigLayout;
-
/**
* Base class for the Preferences panel.
*
protected JCheckBox showConsensLogo = new JCheckBox();
- protected JCheckBox showInformationHistogram = new JCheckBox();
-
- protected JCheckBox showHMMLogo = new JCheckBox();
-
protected JCheckBox showDbRefTooltip = new JCheckBox();
protected JCheckBox showNpTooltip = new JCheckBox();
-
/*
* Structure tab and components
*/
protected JCheckBox sortByTree = new JCheckBox();
- /*
- * hmmer tab and components
- */
- protected JPanel hmmerTab;
-
- protected JCheckBox hmmrTrimTermini;
-
- protected AbstractButton hmmerBackgroundUniprot;
-
- protected AbstractButton hmmerBackgroundAlignment;
-
- protected JTextField hmmerSequenceCount;
-
- protected JTextField hmmerPath;
-
- protected JTextField cygwinPath;
-
- /*
- * DAS Settings tab
- */
- protected JPanel dasTab = new JPanel();
/*
* Web Services tab
*/
protected JPanel wsTab = new JPanel();
-
-
/**
* Creates a new GPreferences object.
*/
tabbedPane.add(initEditingTab(),
MessageManager.getString("label.editing"));
- tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer"));
-
- /*
- * See DasSourceBrowser for the real work of configuring this tab.
- */
- dasTab.setLayout(new BorderLayout());
- tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
-
/*
* See WsPreferences for the real work of configuring this tab.
*/
/*
* Handler to validate a tab before leaving it - currently only for
- * Structure
+ * Structure.
*/
tabbedPane.addChangeListener(new ChangeListener()
{
}
/**
- * Initialises the hmmer tabbed panel
- *
- * @return
- */
- private JPanel initHMMERTab()
- {
- hmmerTab = new JPanel();
- hmmerTab.setLayout(new BoxLayout(hmmerTab, BoxLayout.Y_AXIS));
- hmmerTab.setLayout(new MigLayout("flowy"));
-
- /*
- * path to hmmer binaries folder
- */
- JPanel installationPanel = new JPanel(new MigLayout("flowy"));
- // new FlowLayout(FlowLayout.LEFT));
- JvSwingUtils.createTitledBorder(installationPanel,
- MessageManager.getString("label.installation"), true);
- hmmerTab.add(installationPanel);
- JLabel hmmerLocation = new JLabel(
- MessageManager.getString("label.hmmer_location"));
- hmmerLocation.setFont(LABEL_FONT);
- final int pathFieldLength = 40;
- hmmerPath = new JTextField(pathFieldLength);
- hmmerPath.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mouseClicked(MouseEvent e)
- {
- if (e.getClickCount() == 2)
- {
- String chosen = openFileChooser(true);
- if (chosen != null)
- {
- hmmerPath.setText(chosen);
- validateHmmerPath();
- }
- }
- }
- });
- installationPanel.add(hmmerLocation);
- installationPanel.add(hmmerPath);
-
- /*
- * path to Cygwin binaries folder (for Windows)
- */
- if (Platform.isWindows())
- {
- JLabel cygwinLocation = new JLabel(
- MessageManager.getString("label.cygwin_location"));
- cygwinLocation.setFont(LABEL_FONT);
- cygwinPath = new JTextField(pathFieldLength);
- cygwinPath.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mouseClicked(MouseEvent e)
- {
- if (e.getClickCount() == 2)
- {
- String chosen = openFileChooser(true);
- if (chosen != null)
- {
- cygwinPath.setText(chosen);
- validateCygwinPath();
- }
- }
- }
- });
- installationPanel.add(cygwinLocation);
- installationPanel.add(cygwinPath);
- }
-
- /*
- * preferences for hmmalign
- */
- JPanel alignOptionsPanel = new JPanel(new MigLayout());
- // new FlowLayout(FlowLayout.LEFT));
- JvSwingUtils.createTitledBorder(alignOptionsPanel,
- MessageManager.getString("label.hmmalign_options"), true);
- hmmerTab.add(alignOptionsPanel);
- hmmrTrimTermini = new JCheckBox();
- hmmrTrimTermini.setFont(LABEL_FONT);
- hmmrTrimTermini.setText(MessageManager.getString("label.trim_termini"));
- alignOptionsPanel.add(hmmrTrimTermini);
-
- /*
- * preferences for hmmsearch
- */
- JPanel searchOptions = new JPanel(new MigLayout());
- // FlowLayout(FlowLayout.LEFT));
- JvSwingUtils.createTitledBorder(searchOptions,
- MessageManager.getString("label.hmmsearch_options"), true);
- hmmerTab.add(searchOptions);
- JLabel sequencesToKeep = new JLabel(
- MessageManager.getString("label.no_of_sequences"));
- sequencesToKeep.setFont(LABEL_FONT);
- searchOptions.add(sequencesToKeep);
- hmmerSequenceCount = new JTextField(5);
- searchOptions.add(hmmerSequenceCount);
-
- /*
- * preferences for Information Content annotation
- */
- // JPanel dummy = new JPanel(new FlowLayout(FlowLayout.LEFT));
- JPanel annotationOptions = new JPanel(new MigLayout("left"));
- JvSwingUtils.createTitledBorder(annotationOptions,
- MessageManager.getString("label.information_annotation"), true);
- // dummy.add(annotationOptions);
- hmmerTab.add(annotationOptions);
- ButtonGroup backgroundOptions = new ButtonGroup();
- hmmerBackgroundUniprot = new JRadioButton(
- MessageManager.getString("label.freq_uniprot"));
- hmmerBackgroundUniprot.setFont(LABEL_FONT);
- hmmerBackgroundAlignment = new JRadioButton(
- MessageManager.getString("label.freq_alignment"));
- hmmerBackgroundAlignment.setFont(LABEL_FONT);
- backgroundOptions.add(hmmerBackgroundUniprot);
- backgroundOptions.add(hmmerBackgroundAlignment);
- backgroundOptions.setSelected(hmmerBackgroundUniprot.getModel(), true);
- // disable buttons for now as annotation only uses Uniprot background
- hmmerBackgroundAlignment.setEnabled(false);
- hmmerBackgroundUniprot.setEnabled(false);
- annotationOptions.add(hmmerBackgroundUniprot, "wrap");
- annotationOptions.add(hmmerBackgroundAlignment);
-
- return hmmerTab;
- }
-
- /**
* Initialises the Output tabbed panel.
*
* @return
protColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
protColourLabel.setText(
MessageManager.getString("label.prot_alignment_colour") + " ");
- GPreferences.addtoLayout(coloursTab,
+ JvSwingUtils.addtoLayout(coloursTab,
MessageManager
.getString("label.default_colour_scheme_for_alignment"),
protColourLabel, protColour);
nucColourLabel.setHorizontalAlignment(SwingConstants.LEFT);
nucColourLabel.setText(
MessageManager.getString("label.nuc_alignment_colour") + " ");
- GPreferences.addtoLayout(coloursTab,
+ JvSwingUtils.addtoLayout(coloursTab,
MessageManager
.getString("label.default_colour_scheme_for_alignment"),
nucColourLabel, nucColour);
annotationShding.setBorder(new TitledBorder(
MessageManager.getString("label.annotation_shading_default")));
annotationShding.setLayout(new GridLayout(1, 2));
- GPreferences.addtoLayout(annotationShding,
+ JvSwingUtils.addtoLayout(annotationShding,
MessageManager.getString(
"label.default_minimum_colour_annotation_shading"),
mincolourLabel, minColour);
- GPreferences.addtoLayout(annotationShding,
+ JvSwingUtils.addtoLayout(annotationShding,
MessageManager.getString(
"label.default_maximum_colour_annotation_shading"),
maxcolourLabel, maxColour);
{
if (e.getClickCount() == 2)
{
- String chosen = openFileChooser(false);
+ String chosen = openFileChooser();
if (chosen != null)
{
chimeraPath.setText(chosen);
*
* @return
*/
- protected String openFileChooser(boolean forFolder)
+ protected String openFileChooser()
{
String choice = null;
JFileChooser chooser = new JFileChooser();
- if (forFolder)
- {
- chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- }
// chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(
return choice;
}
+ /**
+ * Validate the structure tab preferences; if invalid, set focus on this tab.
+ *
+ * @param e
+ */
+ protected boolean validateStructure(FocusEvent e)
+ {
+ if (!validateStructure())
+ {
+ e.getComponent().requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
protected boolean validateStructure()
{
return false;
}
}
-
- protected void validateHmmerPath()
- {
- }
-
- protected void validateCygwinPath()
- {
- }
-
- /**
- * A helper method to add a panel containing a label and a component to a
- * panel
- *
- * @param panel
- * @param tooltip
- * @param label
- * @param valBox
- */
- protected static void addtoLayout(JPanel panel, String tooltip,
- JComponent label, JComponent valBox)
- {
- JPanel laypanel = new JPanel(new GridLayout(1, 2));
- JPanel labPanel = new JPanel(new BorderLayout());
- JPanel valPanel = new JPanel();
- labPanel.setBounds(new Rectangle(7, 7, 158, 23));
- valPanel.setBounds(new Rectangle(172, 7, 270, 23));
- labPanel.add(label, BorderLayout.WEST);
- valPanel.add(valBox);
- laypanel.add(labPanel);
- laypanel.add(valPanel);
- valPanel.setToolTipText(tooltip);
- labPanel.setToolTipText(tooltip);
- valBox.setToolTipText(tooltip);
- panel.add(laypanel);
- panel.validate();
- }
}
optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]"));
JScrollPane optionView = new JScrollPane();
optionView.setViewportView(options);
- JvSwingUtils.addtoLayout(dpane,
+ JvSwingUtils.mgAddtoLayout(dpane,
MessageManager.getString("label.input_parameter_name"),
new JLabel(MessageManager.getString("label.name")), tok,
"grow,spanx 3,wrap");
cpanel = details;
name = new JTextArea(1, 12);
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager
.getString("label.short_descriptive_name_for_service"),
new JLabel(MessageManager.getString("label.name")), name,
"wrap");
action = new JComboBox();
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager.getString("label.function_service_performs"),
new JLabel(MessageManager.getString("label.service_action")),
action, "wrap");
descr = new JTextArea(4, 60);
descrVp = new JScrollPane();
descrVp.setViewportView(descr);
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager.getString("label.brief_description_service"),
new JLabel(MessageManager.getString("label.description")),
descrVp, "wrap");
url = new JTextArea(2, 60);
urlVp = new JScrollPane();
urlVp.setViewportView(url);
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager.getString("label.url_post_data_service"),
new JLabel(MessageManager.getString("label.post_url")), urlVp,
"wrap");
urlsuff = new JTextArea();
urlsuff.setColumns(60);
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager.getString("label.optional_suffix"),
new JLabel(MessageManager.getString("label.url_suffix")),
urlsuff, "wrap");
}
});
gapChar = new JComboBox();
- JvSwingUtils.addtoLayout(cpanel,
+ JvSwingUtils.mgAddtoLayout(cpanel,
MessageManager.getString("label.preferred_gap_character"),
new JLabel(
MessageManager.getString("label.gap_character") + ":"),
import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.ProfilesI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.ResidueProperties;
import jalview.schemes.ZappoColourScheme;
import jalview.util.Platform;
-import jalview.workers.InformationThread;
import java.awt.BasicStroke;
import java.awt.Color;
private final boolean MAC = Platform.isAMac();
- // todo remove these flags, read from group/viewport where needed
- boolean av_renderHistogram = true;
-
- boolean av_renderProfile = true;
-
- boolean av_normaliseProfile = false;
-
- boolean av_infoHeight = false;
+ boolean av_renderHistogram = true, av_renderProfile = true,
+ av_normaliseProfile = false;
ResidueShaderI profcolour = null;
private boolean av_ignoreGapsConsensus;
- private boolean av_ignoreBelowBackground;
-
/**
* attributes set from AwtRenderPanelI
*/
}
columnSelection = av.getColumnSelection();
hiddenColumns = av.getAlignment().getHiddenColumns();
- hconsensus = av.getConsensusProfiles();
+ hconsensus = av.getSequenceConsensusHash();
complementConsensus = av.getComplementConsensusHash();
hStrucConsensus = av.getRnaStructureConsensusHash();
av_ignoreGapsConsensus = av.isIgnoreGapsConsensus();
- av_ignoreBelowBackground = av.isIgnoreBelowBackground();
- av_infoHeight = av.isInfoLetterHeight();
}
-
-
/**
* Returns profile data; the first element is the profile type, the second is
* the number of distinct values, the third the total count, and the remainder
// properties/rendering attributes as a global 'alignment group' which holds
// all vis settings for the alignment as a whole rather than a subset
//
- if (InformationThread.HMM_CALC_ID.equals(aa.getCalcId()))
- {
- HiddenMarkovModel hmm = aa.sequenceRef.getHMM();
- return AAFrequency.extractHMMProfile(hmm, column,
- av_ignoreBelowBackground, av_infoHeight); // TODO check if this follows standard
- // pipeline
- }
- if (aa.autoCalculated
- && (aa.label.startsWith("Consensus") || aa.label
- .startsWith("cDNA Consensus")))
+ if (aa.autoCalculated && (aa.label.startsWith("Consensus")
+ || aa.label.startsWith("cDNA Consensus")))
{
boolean forComplement = aa.label.startsWith("cDNA Consensus");
- if (aa.groupRef != null && aa.groupRef.getConsensusData() != null
+ if (aa.groupRef != null && aa.groupRef.consensusData != null
&& aa.groupRef.isShowSequenceLogo())
{
// TODO? group consensus for cDNA complement
return AAFrequency.extractProfile(
- aa.groupRef.getConsensusData().get(column),
- aa.groupRef.isIgnoreGapsConsensus());
+ aa.groupRef.consensusData.get(column),
+ aa.groupRef.getIgnoreGapsConsensus());
}
// TODO extend annotation row to enable dynamic and static profile data to
// be stored
renderProfile = av_renderProfile;
normaliseProfile = av_normaliseProfile;
}
- else if (InformationThread.HMM_CALC_ID.equals(row.getCalcId()))
- {
- if (row.groupRef != null)
- {
- renderHistogram = row.groupRef.isShowInformationHistogram();
- renderProfile = row.groupRef.isShowHMMSequenceLogo();
- normaliseProfile = row.groupRef.isNormaliseHMMSequenceLogo();
- }
- else
- {
- renderHistogram = av.isShowInformationHistogram();
- renderProfile = av.isShowHMMSequenceLogo();
- normaliseProfile = av.isNormaliseHMMSequenceLogo();
- }
- }
else
{
renderHistogram = true;
* This file is part of Jalview.
*
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General 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
- * PURPOSE. See the GNU General License for more details.
+ * PURPOSE. See the GNU General Public License for more details.
*
- * You should have received a copy of the GNU General License
+ * You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
public interface ResidueShaderI
{
- void setConsensus(ProfilesI cons);
- boolean conservationApplied();
+ public abstract void setConsensus(ProfilesI cons);
- void setConservationApplied(boolean conservationApplied);
+ public abstract boolean conservationApplied();
- void setConservation(Conservation cons);
+ public abstract void setConservationApplied(boolean conservationApplied);
- void alignmentChanged(AnnotatedCollectionI alignment,
+ public abstract void setConservation(Conservation cons);
+
+ public abstract void alignmentChanged(AnnotatedCollectionI alignment,
Map<SequenceI, SequenceCollectionI> hiddenReps);
/**
* @param consensusThreshold
* @param ignoreGaps
*/
- void setThreshold(int consensusThreshold,
+ public abstract void setThreshold(int consensusThreshold,
boolean ignoreGaps);
- void setConservationInc(int i);
+ public abstract void setConservationInc(int i);
- int getConservationInc();
+ public abstract int getConservationInc();
/**
* Get the percentage threshold for this colour scheme
*
* @return Returns the percentage threshold
*/
- int getThreshold();
+ public abstract int getThreshold();
/**
* Returns the possibly context dependent colour for the given symbol at the
* @param seq
* @return
*/
- Color findColour(char symbol, int position,
+ public abstract Color findColour(char symbol, int position,
SequenceI seq);
- ColourSchemeI getColourScheme();
+ public abstract ColourSchemeI getColourScheme();
- void setColourScheme(ColourSchemeI cs);
+ public abstract void setColourScheme(ColourSchemeI cs);
}
\ No newline at end of file
package jalview.schemabinding.version2;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import org.exolab.castor.xml.Marshaller;
*
* @version $Revision$ $Date$
*/
-public class JSeq implements java.io.Serializable {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _colour.
- */
- private int _colour;
-
- /**
- * keeps track of state for field: _colour
- */
- private boolean _has_colour;
-
- /**
- * Field _start.
- */
- private int _start;
-
- /**
- * keeps track of state for field: _start
- */
- private boolean _has_start;
-
- /**
- * Field _end.
- */
- private int _end;
-
- /**
- * keeps track of state for field: _end
- */
- private boolean _has_end;
-
- /**
- * Field _id.
- */
- private java.lang.String _id;
-
- /**
- * Field _hidden.
- */
- private boolean _hidden;
-
- /**
- * keeps track of state for field: _hidden
- */
- private boolean _has_hidden;
-
- /**
- * Field _viewreference.
- */
- private boolean _viewreference;
-
- /**
- * keeps track of state for field: _viewreference
- */
- private boolean _has_viewreference;
-
- /**
- * Field _featuresList.
- */
- private java.util.Vector _featuresList;
-
- /**
- * Field _pdbidsList.
- */
- private java.util.Vector _pdbidsList;
-
- /**
- * Field _hiddenSequencesList.
- */
- private java.util.Vector _hiddenSequencesList;
-
- /**
- * Reference to a viewer showing RNA structure
- * for this sequence. Schema supports one viewer showing
- * multiple
- * annotations for multiple sequences, though currently only
- * one
- * annotation for one sequence (gapped or trimmed) is used
- *
- */
- private java.util.Vector _rnaViewerList;
-
- /**
- * name of the project jar entry that holds the HMM file with
- * the profile for the sequence
- */
- private java.lang.String _hmmerProfile;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JSeq() {
- super();
- this._featuresList = new java.util.Vector();
- this._pdbidsList = new java.util.Vector();
- this._hiddenSequencesList = new java.util.Vector();
- this._rnaViewerList = new java.util.Vector();
- }
-
-
- //-----------/
- //- Methods -/
- //-----------/
-
- /**
- *
- *
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.addElement(vFeatures);
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addFeatures(
- final int index,
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- this._featuresList.add(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenSequences(
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenSequencesList.addElement(new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addHiddenSequences(
- final int index,
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- this._hiddenSequencesList.add(index, new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.addElement(vPdbids);
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addPdbids(
- final int index,
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- this._pdbidsList.add(index, vPdbids);
- }
-
- /**
- *
- *
- * @param vRnaViewer
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addRnaViewer(
- final jalview.schemabinding.version2.RnaViewer vRnaViewer)
- throws java.lang.IndexOutOfBoundsException {
- this._rnaViewerList.addElement(vRnaViewer);
- }
-
- /**
- *
- *
- * @param index
- * @param vRnaViewer
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void addRnaViewer(
- final int index,
- final jalview.schemabinding.version2.RnaViewer vRnaViewer)
- throws java.lang.IndexOutOfBoundsException {
- this._rnaViewerList.add(index, vRnaViewer);
- }
-
- /**
- */
- public void deleteColour(
- ) {
- this._has_colour= false;
- }
-
- /**
- */
- public void deleteEnd(
- ) {
- this._has_end= false;
- }
-
- /**
- */
- public void deleteHidden(
- ) {
- this._has_hidden= false;
- }
-
- /**
- */
- public void deleteStart(
- ) {
- this._has_start= false;
- }
-
- /**
- */
- public void deleteViewreference(
- ) {
- this._has_viewreference= false;
- }
-
- /**
- * Method enumerateFeatures.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Features elements
- */
- public java.util.Enumeration enumerateFeatures(
- ) {
- return this._featuresList.elements();
- }
-
- /**
- * Method enumerateHiddenSequences.
- *
- * @return an Enumeration over all int elements
- */
- public java.util.Enumeration enumerateHiddenSequences(
- ) {
- return this._hiddenSequencesList.elements();
- }
-
- /**
- * Method enumeratePdbids.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.Pdbids elements
- */
- public java.util.Enumeration enumeratePdbids(
- ) {
- return this._pdbidsList.elements();
- }
-
- /**
- * Method enumerateRnaViewer.
- *
- * @return an Enumeration over all
- * jalview.schemabinding.version2.RnaViewer elements
- */
- public java.util.Enumeration enumerateRnaViewer(
- ) {
- return this._rnaViewerList.elements();
- }
-
- /**
- * Returns the value of field 'colour'.
- *
- * @return the value of field 'Colour'.
- */
- public int getColour(
- ) {
- return this._colour;
- }
-
- /**
- * Returns the value of field 'end'.
- *
- * @return the value of field 'End'.
- */
- public int getEnd(
- ) {
- return this._end;
- }
-
- /**
- * Method getFeatures.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Features at the given index
- */
- public jalview.schemabinding.version2.Features getFeatures(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("getFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Features) _featuresList.get(index);
- }
-
- /**
- * Method getFeatures.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Features[] getFeatures(
- ) {
- jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
- return (jalview.schemabinding.version2.Features[]) this._featuresList.toArray(array);
- }
-
- /**
- * Method getFeaturesCount.
- *
- * @return the size of this collection
- */
- public int getFeaturesCount(
- ) {
- return this._featuresList.size();
- }
-
- /**
- * Returns the value of field 'hidden'.
- *
- * @return the value of field 'Hidden'.
- */
- public boolean getHidden(
- ) {
- return this._hidden;
- }
-
- /**
- * Method getHiddenSequences.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the int at the given index
- */
- public int getHiddenSequences(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenSequencesList.size()) {
- throw new IndexOutOfBoundsException("getHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
- }
-
- return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
- }
-
- /**
- * Method getHiddenSequences.Returns the contents of the
- * collection in an Array.
- *
- * @return this collection as an Array
- */
- public int[] getHiddenSequences(
- ) {
- int size = this._hiddenSequencesList.size();
- int[] array = new int[size];
- java.util.Iterator iter = _hiddenSequencesList.iterator();
- for (int index = 0; index < size; index++) {
- array[index] = ((java.lang.Integer) iter.next()).intValue();
- }
- return array;
- }
-
- /**
- * Method getHiddenSequencesCount.
- *
- * @return the size of this collection
- */
- public int getHiddenSequencesCount(
- ) {
- return this._hiddenSequencesList.size();
- }
-
- /**
- * Returns the value of field 'hmmerProfile'. The field
- * 'hmmerProfile' has the following description: name of the
- * project jar entry that holds the HMM file with the profile
- * for the sequence
- *
- * @return the value of field 'HmmerProfile'.
- */
- public java.lang.String getHmmerProfile(
- ) {
- return this._hmmerProfile;
- }
-
- /**
- * Returns the value of field 'id'.
- *
- * @return the value of field 'Id'.
- */
- public java.lang.String getId(
- ) {
- return this._id;
- }
-
- /**
- * Method getPdbids.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.Pdbids at the given index
- */
- public jalview.schemabinding.version2.Pdbids getPdbids(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("getPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
- }
-
- /**
- * Method getPdbids.Returns the contents of the collection in
- * an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.Pdbids[] getPdbids(
- ) {
- jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
- return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList.toArray(array);
- }
-
- /**
- * Method getPdbidsCount.
- *
- * @return the size of this collection
- */
- public int getPdbidsCount(
- ) {
- return this._pdbidsList.size();
- }
-
- /**
- * Method getRnaViewer.
- *
- * @param index
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- * @return the value of the
- * jalview.schemabinding.version2.RnaViewer at the given index
- */
- public jalview.schemabinding.version2.RnaViewer getRnaViewer(
- final int index)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._rnaViewerList.size()) {
- throw new IndexOutOfBoundsException("getRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]");
- }
-
- return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList.get(index);
- }
-
- /**
- * Method getRnaViewer.Returns the contents of the collection
- * in an Array. <p>Note: Just in case the collection contents
- * are changing in another thread, we pass a 0-length Array of
- * the correct type into the API call. This way we <i>know</i>
- * that the Array returned is of exactly the correct length.
- *
- * @return this collection as an Array
- */
- public jalview.schemabinding.version2.RnaViewer[] getRnaViewer(
- ) {
- jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
- return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList.toArray(array);
- }
-
- /**
- * Method getRnaViewerCount.
- *
- * @return the size of this collection
- */
- public int getRnaViewerCount(
- ) {
- return this._rnaViewerList.size();
- }
-
- /**
- * Returns the value of field 'start'.
- *
- * @return the value of field 'Start'.
- */
- public int getStart(
- ) {
- return this._start;
- }
-
- /**
- * Returns the value of field 'viewreference'.
- *
- * @return the value of field 'Viewreference'.
- */
- public boolean getViewreference(
- ) {
- return this._viewreference;
- }
-
- /**
- * Method hasColour.
- *
- * @return true if at least one Colour has been added
- */
- public boolean hasColour(
- ) {
- return this._has_colour;
- }
-
- /**
- * Method hasEnd.
- *
- * @return true if at least one End has been added
- */
- public boolean hasEnd(
- ) {
- return this._has_end;
- }
-
- /**
- * Method hasHidden.
- *
- * @return true if at least one Hidden has been added
- */
- public boolean hasHidden(
- ) {
- return this._has_hidden;
- }
-
- /**
- * Method hasStart.
- *
- * @return true if at least one Start has been added
- */
- public boolean hasStart(
- ) {
- return this._has_start;
- }
-
- /**
- * Method hasViewreference.
- *
- * @return true if at least one Viewreference has been added
- */
- public boolean hasViewreference(
- ) {
- return this._has_viewreference;
- }
-
- /**
- * Returns the value of field 'hidden'.
- *
- * @return the value of field 'Hidden'.
- */
- public boolean isHidden(
- ) {
- return this._hidden;
- }
-
- /**
- * Method isValid.
- *
- * @return true if this object is valid according to the schema
- */
- public boolean isValid(
- ) {
- try {
- validate();
- } catch (org.exolab.castor.xml.ValidationException vex) {
- return false;
- }
- return true;
- }
-
- /**
- * Returns the value of field 'viewreference'.
- *
- * @return the value of field 'Viewreference'.
- */
- public boolean isViewreference(
- ) {
- return this._viewreference;
- }
-
- /**
- *
- *
- * @param out
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void marshal(
- final java.io.Writer out)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, out);
- }
-
- /**
- *
- *
- * @param handler
- * @throws java.io.IOException if an IOException occurs during
- * marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- */
- public void marshal(
- final org.xml.sax.ContentHandler handler)
- throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- Marshaller.marshal(this, handler);
- }
-
- /**
- */
- public void removeAllFeatures(
- ) {
- this._featuresList.clear();
- }
-
- /**
- */
- public void removeAllHiddenSequences(
- ) {
- this._hiddenSequencesList.clear();
- }
-
- /**
- */
- public void removeAllPdbids(
- ) {
- this._pdbidsList.clear();
- }
-
- /**
- */
- public void removeAllRnaViewer(
- ) {
- this._rnaViewerList.clear();
- }
-
- /**
- * Method removeFeatures.
- *
- * @param vFeatures
- * @return true if the object was removed from the collection.
- */
- public boolean removeFeatures(
- final jalview.schemabinding.version2.Features vFeatures) {
- boolean removed = _featuresList.remove(vFeatures);
- return removed;
- }
-
- /**
- * Method removeFeaturesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Features removeFeaturesAt(
- final int index) {
- java.lang.Object obj = this._featuresList.remove(index);
- return (jalview.schemabinding.version2.Features) obj;
- }
-
- /**
- * Method removeHiddenSequences.
- *
- * @param vHiddenSequences
- * @return true if the object was removed from the collection.
- */
- public boolean removeHiddenSequences(
- final int vHiddenSequences) {
- boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(vHiddenSequences));
- return removed;
- }
-
- /**
- * Method removeHiddenSequencesAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public int removeHiddenSequencesAt(
- final int index) {
- java.lang.Object obj = this._hiddenSequencesList.remove(index);
- return ((java.lang.Integer) obj).intValue();
- }
-
- /**
- * Method removePdbids.
- *
- * @param vPdbids
- * @return true if the object was removed from the collection.
- */
- public boolean removePdbids(
- final jalview.schemabinding.version2.Pdbids vPdbids) {
- boolean removed = _pdbidsList.remove(vPdbids);
- return removed;
- }
-
- /**
- * Method removePdbidsAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.Pdbids removePdbidsAt(
- final int index) {
- java.lang.Object obj = this._pdbidsList.remove(index);
- return (jalview.schemabinding.version2.Pdbids) obj;
- }
-
- /**
- * Method removeRnaViewer.
- *
- * @param vRnaViewer
- * @return true if the object was removed from the collection.
- */
- public boolean removeRnaViewer(
- final jalview.schemabinding.version2.RnaViewer vRnaViewer) {
- boolean removed = _rnaViewerList.remove(vRnaViewer);
- return removed;
- }
-
- /**
- * Method removeRnaViewerAt.
- *
- * @param index
- * @return the element removed from the collection
- */
- public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
- final int index) {
- java.lang.Object obj = this._rnaViewerList.remove(index);
- return (jalview.schemabinding.version2.RnaViewer) obj;
- }
-
- /**
- * Sets the value of field 'colour'.
- *
- * @param colour the value of field 'colour'.
- */
- public void setColour(
- final int colour) {
- this._colour = colour;
- this._has_colour = true;
- }
-
- /**
- * Sets the value of field 'end'.
- *
- * @param end the value of field 'end'.
- */
- public void setEnd(
- final int end) {
- this._end = end;
- this._has_end = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vFeatures
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setFeatures(
- final int index,
- final jalview.schemabinding.version2.Features vFeatures)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._featuresList.size()) {
- throw new IndexOutOfBoundsException("setFeatures: Index value '" + index + "' not in range [0.." + (this._featuresList.size() - 1) + "]");
- }
-
- this._featuresList.set(index, vFeatures);
- }
-
- /**
- *
- *
- * @param vFeaturesArray
- */
- public void setFeatures(
- final jalview.schemabinding.version2.Features[] vFeaturesArray) {
- //-- copy array
- _featuresList.clear();
-
- for (int i = 0; i < vFeaturesArray.length; i++) {
- this._featuresList.add(vFeaturesArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'hidden'.
- *
- * @param hidden the value of field 'hidden'.
- */
- public void setHidden(
- final boolean hidden) {
- this._hidden = hidden;
- this._has_hidden = true;
- }
-
- /**
- *
- *
- * @param index
- * @param vHiddenSequences
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setHiddenSequences(
- final int index,
- final int vHiddenSequences)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._hiddenSequencesList.size()) {
- throw new IndexOutOfBoundsException("setHiddenSequences: Index value '" + index + "' not in range [0.." + (this._hiddenSequencesList.size() - 1) + "]");
- }
-
- this._hiddenSequencesList.set(index, new java.lang.Integer(vHiddenSequences));
- }
-
- /**
- *
- *
- * @param vHiddenSequencesArray
- */
- public void setHiddenSequences(
- final int[] vHiddenSequencesArray) {
- //-- copy array
- _hiddenSequencesList.clear();
-
- for (int i = 0; i < vHiddenSequencesArray.length; i++) {
- this._hiddenSequencesList.add(new java.lang.Integer(vHiddenSequencesArray[i]));
- }
- }
-
- /**
- * Sets the value of field 'hmmerProfile'. The field
- * 'hmmerProfile' has the following description: name of the
- * project jar entry that holds the HMM file with the profile
- * for the sequence
- *
- * @param hmmerProfile the value of field 'hmmerProfile'.
- */
- public void setHmmerProfile(
- final java.lang.String hmmerProfile) {
- this._hmmerProfile = hmmerProfile;
- }
-
- /**
- * Sets the value of field 'id'.
- *
- * @param id the value of field 'id'.
- */
- public void setId(
- final java.lang.String id) {
- this._id = id;
- }
-
- /**
- *
- *
- * @param index
- * @param vPdbids
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setPdbids(
- final int index,
- final jalview.schemabinding.version2.Pdbids vPdbids)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._pdbidsList.size()) {
- throw new IndexOutOfBoundsException("setPdbids: Index value '" + index + "' not in range [0.." + (this._pdbidsList.size() - 1) + "]");
- }
-
- this._pdbidsList.set(index, vPdbids);
- }
-
- /**
- *
- *
- * @param vPdbidsArray
- */
- public void setPdbids(
- final jalview.schemabinding.version2.Pdbids[] vPdbidsArray) {
- //-- copy array
- _pdbidsList.clear();
-
- for (int i = 0; i < vPdbidsArray.length; i++) {
- this._pdbidsList.add(vPdbidsArray[i]);
- }
- }
-
- /**
- *
- *
- * @param index
- * @param vRnaViewer
- * @throws java.lang.IndexOutOfBoundsException if the index
- * given is outside the bounds of the collection
- */
- public void setRnaViewer(
- final int index,
- final jalview.schemabinding.version2.RnaViewer vRnaViewer)
- throws java.lang.IndexOutOfBoundsException {
- // check bounds for index
- if (index < 0 || index >= this._rnaViewerList.size()) {
- throw new IndexOutOfBoundsException("setRnaViewer: Index value '" + index + "' not in range [0.." + (this._rnaViewerList.size() - 1) + "]");
- }
-
- this._rnaViewerList.set(index, vRnaViewer);
- }
-
- /**
- *
- *
- * @param vRnaViewerArray
- */
- public void setRnaViewer(
- final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray) {
- //-- copy array
- _rnaViewerList.clear();
-
- for (int i = 0; i < vRnaViewerArray.length; i++) {
- this._rnaViewerList.add(vRnaViewerArray[i]);
- }
- }
-
- /**
- * Sets the value of field 'start'.
- *
- * @param start the value of field 'start'.
- */
- public void setStart(
- final int start) {
- this._start = start;
- this._has_start = true;
- }
-
- /**
- * Sets the value of field 'viewreference'.
- *
- * @param viewreference the value of field 'viewreference'.
- */
- public void setViewreference(
- final boolean viewreference) {
- this._viewreference = viewreference;
- this._has_viewreference = true;
- }
-
- /**
- * Method unmarshal.
- *
- * @param reader
- * @throws org.exolab.castor.xml.MarshalException if object is
- * null or if any SAXException is thrown during marshaling
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- * @return the unmarshaled jalview.schemabinding.version2.JSeq
- */
- public static jalview.schemabinding.version2.JSeq unmarshal(
- final java.io.Reader reader)
- throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
- return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(jalview.schemabinding.version2.JSeq.class, reader);
- }
-
- /**
- *
- *
- * @throws org.exolab.castor.xml.ValidationException if this
- * object is an invalid instance according to the schema
- */
- public void validate(
- )
- throws org.exolab.castor.xml.ValidationException {
- org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
- validator.validate(this);
- }
+public class JSeq implements java.io.Serializable
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _colour.
+ */
+ private int _colour;
+
+ /**
+ * keeps track of state for field: _colour
+ */
+ private boolean _has_colour;
+
+ /**
+ * Field _start.
+ */
+ private int _start;
+
+ /**
+ * keeps track of state for field: _start
+ */
+ private boolean _has_start;
+
+ /**
+ * Field _end.
+ */
+ private int _end;
+
+ /**
+ * keeps track of state for field: _end
+ */
+ private boolean _has_end;
+
+ /**
+ * Field _id.
+ */
+ private java.lang.String _id;
+
+ /**
+ * Field _hidden.
+ */
+ private boolean _hidden;
+
+ /**
+ * keeps track of state for field: _hidden
+ */
+ private boolean _has_hidden;
+
+ /**
+ * Field _viewreference.
+ */
+ private boolean _viewreference;
+
+ /**
+ * keeps track of state for field: _viewreference
+ */
+ private boolean _has_viewreference;
+
+ /**
+ * Field _featuresList.
+ */
+ private java.util.Vector _featuresList;
+
+ /**
+ * Field _pdbidsList.
+ */
+ private java.util.Vector _pdbidsList;
+
+ /**
+ * Field _hiddenSequencesList.
+ */
+ private java.util.Vector _hiddenSequencesList;
+
+ /**
+ * Reference to a viewer showing RNA structure for this sequence. Schema
+ * supports one viewer showing multiple annotations for multiple sequences,
+ * though currently only one annotation for one sequence (gapped or trimmed)
+ * is used
+ *
+ */
+ private java.util.Vector _rnaViewerList;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JSeq()
+ {
+ super();
+ this._featuresList = new java.util.Vector();
+ this._pdbidsList = new java.util.Vector();
+ this._hiddenSequencesList = new java.util.Vector();
+ this._rnaViewerList = new java.util.Vector();
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ *
+ *
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.addElement(vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addFeatures(final int index,
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._featuresList.add(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenSequences(final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenSequencesList.addElement(new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addHiddenSequences(final int index, final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._hiddenSequencesList.add(index, new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.addElement(vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addPdbids(final int index,
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._pdbidsList.add(index, vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._rnaViewerList.addElement(vRnaViewer);
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void addRnaViewer(final int index,
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ this._rnaViewerList.add(index, vRnaViewer);
+ }
+
+ /**
+ */
+ public void deleteColour()
+ {
+ this._has_colour = false;
+ }
+
+ /**
+ */
+ public void deleteEnd()
+ {
+ this._has_end = false;
+ }
+
+ /**
+ */
+ public void deleteHidden()
+ {
+ this._has_hidden = false;
+ }
+
+ /**
+ */
+ public void deleteStart()
+ {
+ this._has_start = false;
+ }
+
+ /**
+ */
+ public void deleteViewreference()
+ {
+ this._has_viewreference = false;
+ }
+
+ /**
+ * Method enumerateFeatures.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Features
+ * elements
+ */
+ public java.util.Enumeration enumerateFeatures()
+ {
+ return this._featuresList.elements();
+ }
+
+ /**
+ * Method enumerateHiddenSequences.
+ *
+ * @return an Enumeration over all int elements
+ */
+ public java.util.Enumeration enumerateHiddenSequences()
+ {
+ return this._hiddenSequencesList.elements();
+ }
+
+ /**
+ * Method enumeratePdbids.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.Pdbids
+ * elements
+ */
+ public java.util.Enumeration enumeratePdbids()
+ {
+ return this._pdbidsList.elements();
+ }
+
+ /**
+ * Method enumerateRnaViewer.
+ *
+ * @return an Enumeration over all jalview.schemabinding.version2.RnaViewer
+ * elements
+ */
+ public java.util.Enumeration enumerateRnaViewer()
+ {
+ return this._rnaViewerList.elements();
+ }
+
+ /**
+ * Returns the value of field 'colour'.
+ *
+ * @return the value of field 'Colour'.
+ */
+ public int getColour()
+ {
+ return this._colour;
+ }
+
+ /**
+ * Returns the value of field 'end'.
+ *
+ * @return the value of field 'End'.
+ */
+ public int getEnd()
+ {
+ return this._end;
+ }
+
+ /**
+ * Method getFeatures.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Features at the
+ * given index
+ */
+ public jalview.schemabinding.version2.Features getFeatures(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("getFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Features) _featuresList
+ .get(index);
+ }
+
+ /**
+ * Method getFeatures.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Features[] getFeatures()
+ {
+ jalview.schemabinding.version2.Features[] array = new jalview.schemabinding.version2.Features[0];
+ return (jalview.schemabinding.version2.Features[]) this._featuresList
+ .toArray(array);
+ }
+
+ /**
+ * Method getFeaturesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getFeaturesCount()
+ {
+ return this._featuresList.size();
+ }
+
+ /**
+ * Returns the value of field 'hidden'.
+ *
+ * @return the value of field 'Hidden'.
+ */
+ public boolean getHidden()
+ {
+ return this._hidden;
+ }
+
+ /**
+ * Method getHiddenSequences.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the int at the given index
+ */
+ public int getHiddenSequences(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenSequencesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "getHiddenSequences: Index value '" + index
+ + "' not in range [0.."
+ + (this._hiddenSequencesList.size() - 1) + "]");
+ }
+
+ return ((java.lang.Integer) _hiddenSequencesList.get(index)).intValue();
+ }
+
+ /**
+ * Method getHiddenSequences.Returns the contents of the collection in an
+ * Array.
+ *
+ * @return this collection as an Array
+ */
+ public int[] getHiddenSequences()
+ {
+ int size = this._hiddenSequencesList.size();
+ int[] array = new int[size];
+ java.util.Iterator iter = _hiddenSequencesList.iterator();
+ for (int index = 0; index < size; index++)
+ {
+ array[index] = ((java.lang.Integer) iter.next()).intValue();
+ }
+ return array;
+ }
+
+ /**
+ * Method getHiddenSequencesCount.
+ *
+ * @return the size of this collection
+ */
+ public int getHiddenSequencesCount()
+ {
+ return this._hiddenSequencesList.size();
+ }
+
+ /**
+ * Returns the value of field 'id'.
+ *
+ * @return the value of field 'Id'.
+ */
+ public java.lang.String getId()
+ {
+ return this._id;
+ }
+
+ /**
+ * Method getPdbids.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.Pdbids at the given
+ * index
+ */
+ public jalview.schemabinding.version2.Pdbids getPdbids(final int index)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("getPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.Pdbids) _pdbidsList.get(index);
+ }
+
+ /**
+ * Method getPdbids.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.Pdbids[] getPdbids()
+ {
+ jalview.schemabinding.version2.Pdbids[] array = new jalview.schemabinding.version2.Pdbids[0];
+ return (jalview.schemabinding.version2.Pdbids[]) this._pdbidsList
+ .toArray(array);
+ }
+
+ /**
+ * Method getPdbidsCount.
+ *
+ * @return the size of this collection
+ */
+ public int getPdbidsCount()
+ {
+ return this._pdbidsList.size();
+ }
+
+ /**
+ * Method getRnaViewer.
+ *
+ * @param index
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ * @return the value of the jalview.schemabinding.version2.RnaViewer at the
+ * given index
+ */
+ public jalview.schemabinding.version2.RnaViewer getRnaViewer(
+ final int index) throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._rnaViewerList.size())
+ {
+ throw new IndexOutOfBoundsException("getRnaViewer: Index value '"
+ + index + "' not in range [0.."
+ + (this._rnaViewerList.size() - 1) + "]");
+ }
+
+ return (jalview.schemabinding.version2.RnaViewer) _rnaViewerList
+ .get(index);
+ }
+
+ /**
+ * Method getRnaViewer.Returns the contents of the collection in an Array.
+ * <p>
+ * Note: Just in case the collection contents are changing in another thread,
+ * we pass a 0-length Array of the correct type into the API call. This way we
+ * <i>know</i> that the Array returned is of exactly the correct length.
+ *
+ * @return this collection as an Array
+ */
+ public jalview.schemabinding.version2.RnaViewer[] getRnaViewer()
+ {
+ jalview.schemabinding.version2.RnaViewer[] array = new jalview.schemabinding.version2.RnaViewer[0];
+ return (jalview.schemabinding.version2.RnaViewer[]) this._rnaViewerList
+ .toArray(array);
+ }
+
+ /**
+ * Method getRnaViewerCount.
+ *
+ * @return the size of this collection
+ */
+ public int getRnaViewerCount()
+ {
+ return this._rnaViewerList.size();
+ }
+
+ /**
+ * Returns the value of field 'start'.
+ *
+ * @return the value of field 'Start'.
+ */
+ public int getStart()
+ {
+ return this._start;
+ }
+
+ /**
+ * Returns the value of field 'viewreference'.
+ *
+ * @return the value of field 'Viewreference'.
+ */
+ public boolean getViewreference()
+ {
+ return this._viewreference;
+ }
+
+ /**
+ * Method hasColour.
+ *
+ * @return true if at least one Colour has been added
+ */
+ public boolean hasColour()
+ {
+ return this._has_colour;
+ }
+
+ /**
+ * Method hasEnd.
+ *
+ * @return true if at least one End has been added
+ */
+ public boolean hasEnd()
+ {
+ return this._has_end;
+ }
+
+ /**
+ * Method hasHidden.
+ *
+ * @return true if at least one Hidden has been added
+ */
+ public boolean hasHidden()
+ {
+ return this._has_hidden;
+ }
+
+ /**
+ * Method hasStart.
+ *
+ * @return true if at least one Start has been added
+ */
+ public boolean hasStart()
+ {
+ return this._has_start;
+ }
+
+ /**
+ * Method hasViewreference.
+ *
+ * @return true if at least one Viewreference has been added
+ */
+ public boolean hasViewreference()
+ {
+ return this._has_viewreference;
+ }
+
+ /**
+ * Returns the value of field 'hidden'.
+ *
+ * @return the value of field 'Hidden'.
+ */
+ public boolean isHidden()
+ {
+ return this._hidden;
+ }
+
+ /**
+ * Method isValid.
+ *
+ * @return true if this object is valid according to the schema
+ */
+ public boolean isValid()
+ {
+ try
+ {
+ validate();
+ } catch (org.exolab.castor.xml.ValidationException vex)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the value of field 'viewreference'.
+ *
+ * @return the value of field 'Viewreference'.
+ */
+ public boolean isViewreference()
+ {
+ return this._viewreference;
+ }
+
+ /**
+ *
+ *
+ * @param out
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void marshal(final java.io.Writer out)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, out);
+ }
+
+ /**
+ *
+ *
+ * @param handler
+ * @throws java.io.IOException
+ * if an IOException occurs during marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ */
+ public void marshal(final org.xml.sax.ContentHandler handler)
+ throws java.io.IOException,
+ org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ Marshaller.marshal(this, handler);
+ }
+
+ /**
+ */
+ public void removeAllFeatures()
+ {
+ this._featuresList.clear();
+ }
+
+ /**
+ */
+ public void removeAllHiddenSequences()
+ {
+ this._hiddenSequencesList.clear();
+ }
+
+ /**
+ */
+ public void removeAllPdbids()
+ {
+ this._pdbidsList.clear();
+ }
+
+ /**
+ */
+ public void removeAllRnaViewer()
+ {
+ this._rnaViewerList.clear();
+ }
+
+ /**
+ * Method removeFeatures.
+ *
+ * @param vFeatures
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeFeatures(
+ final jalview.schemabinding.version2.Features vFeatures)
+ {
+ boolean removed = _featuresList.remove(vFeatures);
+ return removed;
+ }
+
+ /**
+ * Method removeFeaturesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Features removeFeaturesAt(
+ final int index)
+ {
+ java.lang.Object obj = this._featuresList.remove(index);
+ return (jalview.schemabinding.version2.Features) obj;
+ }
+
+ /**
+ * Method removeHiddenSequences.
+ *
+ * @param vHiddenSequences
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeHiddenSequences(final int vHiddenSequences)
+ {
+ boolean removed = _hiddenSequencesList.remove(new java.lang.Integer(
+ vHiddenSequences));
+ return removed;
+ }
+
+ /**
+ * Method removeHiddenSequencesAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public int removeHiddenSequencesAt(final int index)
+ {
+ java.lang.Object obj = this._hiddenSequencesList.remove(index);
+ return ((java.lang.Integer) obj).intValue();
+ }
+
+ /**
+ * Method removePdbids.
+ *
+ * @param vPdbids
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removePdbids(
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ {
+ boolean removed = _pdbidsList.remove(vPdbids);
+ return removed;
+ }
+
+ /**
+ * Method removePdbidsAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.Pdbids removePdbidsAt(
+ final int index)
+ {
+ java.lang.Object obj = this._pdbidsList.remove(index);
+ return (jalview.schemabinding.version2.Pdbids) obj;
+ }
+
+ /**
+ * Method removeRnaViewer.
+ *
+ * @param vRnaViewer
+ * @return true if the object was removed from the collection.
+ */
+ public boolean removeRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ {
+ boolean removed = _rnaViewerList.remove(vRnaViewer);
+ return removed;
+ }
+
+ /**
+ * Method removeRnaViewerAt.
+ *
+ * @param index
+ * @return the element removed from the collection
+ */
+ public jalview.schemabinding.version2.RnaViewer removeRnaViewerAt(
+ final int index)
+ {
+ java.lang.Object obj = this._rnaViewerList.remove(index);
+ return (jalview.schemabinding.version2.RnaViewer) obj;
+ }
+
+ /**
+ * Sets the value of field 'colour'.
+ *
+ * @param colour
+ * the value of field 'colour'.
+ */
+ public void setColour(final int colour)
+ {
+ this._colour = colour;
+ this._has_colour = true;
+ }
+
+ /**
+ * Sets the value of field 'end'.
+ *
+ * @param end
+ * the value of field 'end'.
+ */
+ public void setEnd(final int end)
+ {
+ this._end = end;
+ this._has_end = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vFeatures
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setFeatures(final int index,
+ final jalview.schemabinding.version2.Features vFeatures)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._featuresList.size())
+ {
+ throw new IndexOutOfBoundsException("setFeatures: Index value '"
+ + index + "' not in range [0.."
+ + (this._featuresList.size() - 1) + "]");
+ }
+
+ this._featuresList.set(index, vFeatures);
+ }
+
+ /**
+ *
+ *
+ * @param vFeaturesArray
+ */
+ public void setFeatures(
+ final jalview.schemabinding.version2.Features[] vFeaturesArray)
+ {
+ // -- copy array
+ _featuresList.clear();
+
+ for (int i = 0; i < vFeaturesArray.length; i++)
+ {
+ this._featuresList.add(vFeaturesArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'hidden'.
+ *
+ * @param hidden
+ * the value of field 'hidden'.
+ */
+ public void setHidden(final boolean hidden)
+ {
+ this._hidden = hidden;
+ this._has_hidden = true;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vHiddenSequences
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setHiddenSequences(final int index, final int vHiddenSequences)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._hiddenSequencesList.size())
+ {
+ throw new IndexOutOfBoundsException(
+ "setHiddenSequences: Index value '" + index
+ + "' not in range [0.."
+ + (this._hiddenSequencesList.size() - 1) + "]");
+ }
+
+ this._hiddenSequencesList.set(index, new java.lang.Integer(
+ vHiddenSequences));
+ }
+
+ /**
+ *
+ *
+ * @param vHiddenSequencesArray
+ */
+ public void setHiddenSequences(final int[] vHiddenSequencesArray)
+ {
+ // -- copy array
+ _hiddenSequencesList.clear();
+
+ for (int i = 0; i < vHiddenSequencesArray.length; i++)
+ {
+ this._hiddenSequencesList.add(new java.lang.Integer(
+ vHiddenSequencesArray[i]));
+ }
+ }
+
+ /**
+ * Sets the value of field 'id'.
+ *
+ * @param id
+ * the value of field 'id'.
+ */
+ public void setId(final java.lang.String id)
+ {
+ this._id = id;
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vPdbids
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setPdbids(final int index,
+ final jalview.schemabinding.version2.Pdbids vPdbids)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._pdbidsList.size())
+ {
+ throw new IndexOutOfBoundsException("setPdbids: Index value '"
+ + index + "' not in range [0.."
+ + (this._pdbidsList.size() - 1) + "]");
+ }
+
+ this._pdbidsList.set(index, vPdbids);
+ }
+
+ /**
+ *
+ *
+ * @param vPdbidsArray
+ */
+ public void setPdbids(
+ final jalview.schemabinding.version2.Pdbids[] vPdbidsArray)
+ {
+ // -- copy array
+ _pdbidsList.clear();
+
+ for (int i = 0; i < vPdbidsArray.length; i++)
+ {
+ this._pdbidsList.add(vPdbidsArray[i]);
+ }
+ }
+
+ /**
+ *
+ *
+ * @param index
+ * @param vRnaViewer
+ * @throws java.lang.IndexOutOfBoundsException
+ * if the index given is outside the bounds of the collection
+ */
+ public void setRnaViewer(final int index,
+ final jalview.schemabinding.version2.RnaViewer vRnaViewer)
+ throws java.lang.IndexOutOfBoundsException
+ {
+ // check bounds for index
+ if (index < 0 || index >= this._rnaViewerList.size())
+ {
+ throw new IndexOutOfBoundsException("setRnaViewer: Index value '"
+ + index + "' not in range [0.."
+ + (this._rnaViewerList.size() - 1) + "]");
+ }
+
+ this._rnaViewerList.set(index, vRnaViewer);
+ }
+
+ /**
+ *
+ *
+ * @param vRnaViewerArray
+ */
+ public void setRnaViewer(
+ final jalview.schemabinding.version2.RnaViewer[] vRnaViewerArray)
+ {
+ // -- copy array
+ _rnaViewerList.clear();
+
+ for (int i = 0; i < vRnaViewerArray.length; i++)
+ {
+ this._rnaViewerList.add(vRnaViewerArray[i]);
+ }
+ }
+
+ /**
+ * Sets the value of field 'start'.
+ *
+ * @param start
+ * the value of field 'start'.
+ */
+ public void setStart(final int start)
+ {
+ this._start = start;
+ this._has_start = true;
+ }
+
+ /**
+ * Sets the value of field 'viewreference'.
+ *
+ * @param viewreference
+ * the value of field 'viewreference'.
+ */
+ public void setViewreference(final boolean viewreference)
+ {
+ this._viewreference = viewreference;
+ this._has_viewreference = true;
+ }
+
+ /**
+ * Method unmarshal.
+ *
+ * @param reader
+ * @throws org.exolab.castor.xml.MarshalException
+ * if object is null or if any SAXException is thrown during
+ * marshaling
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ * @return the unmarshaled jalview.schemabinding.version2.JSeq
+ */
+ public static jalview.schemabinding.version2.JSeq unmarshal(
+ final java.io.Reader reader)
+ throws org.exolab.castor.xml.MarshalException,
+ org.exolab.castor.xml.ValidationException
+ {
+ return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(
+ jalview.schemabinding.version2.JSeq.class, reader);
+ }
+
+ /**
+ *
+ *
+ * @throws org.exolab.castor.xml.ValidationException
+ * if this object is an invalid instance according to the schema
+ */
+ public void validate() throws org.exolab.castor.xml.ValidationException
+ {
+ org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+ validator.validate(this);
+ }
}
package jalview.schemabinding.version2.descriptors;
- //---------------------------------/
- //- Imported classes and packages -/
+//---------------------------------/
+//- Imported classes and packages -/
//---------------------------------/
import jalview.schemabinding.version2.JSeq;
*
* @version $Revision$ $Date$
*/
-public class JSeqDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
-
-
- //--------------------------/
- //- Class/Member Variables -/
- //--------------------------/
-
- /**
- * Field _elementDefinition.
- */
- private boolean _elementDefinition;
-
- /**
- * Field _nsPrefix.
- */
- private java.lang.String _nsPrefix;
-
- /**
- * Field _nsURI.
- */
- private java.lang.String _nsURI;
-
- /**
- * Field _xmlName.
- */
- private java.lang.String _xmlName;
-
-
- //----------------/
- //- Constructors -/
- //----------------/
-
- public JSeqDescriptor() {
- super();
- _nsURI = "www.jalview.org";
- _xmlName = "JSeq";
- _elementDefinition = true;
-
- //-- set grouping compositor
- setCompositorAsSequence();
- org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
- org.exolab.castor.mapping.FieldHandler handler = null;
- org.exolab.castor.xml.FieldValidator fieldValidator = null;
- //-- initialize attribute descriptors
-
- //-- _colour
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasColour()) { return null; }
- return new java.lang.Integer(target.getColour());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteColour();
- return;
- }
- target.setColour( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _colour
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+public class JSeqDescriptor extends
+ org.exolab.castor.xml.util.XMLClassDescriptorImpl
+{
+
+ // --------------------------/
+ // - Class/Member Variables -/
+ // --------------------------/
+
+ /**
+ * Field _elementDefinition.
+ */
+ private boolean _elementDefinition;
+
+ /**
+ * Field _nsPrefix.
+ */
+ private java.lang.String _nsPrefix;
+
+ /**
+ * Field _nsURI.
+ */
+ private java.lang.String _nsURI;
+
+ /**
+ * Field _xmlName.
+ */
+ private java.lang.String _xmlName;
+
+ // ----------------/
+ // - Constructors -/
+ // ----------------/
+
+ public JSeqDescriptor()
+ {
+ super();
+ _nsURI = "www.jalview.org";
+ _xmlName = "JSeq";
+ _elementDefinition = true;
+
+ // -- set grouping compositor
+ setCompositorAsSequence();
+ org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null;
+ org.exolab.castor.mapping.FieldHandler handler = null;
+ org.exolab.castor.xml.FieldValidator fieldValidator = null;
+ // -- initialize attribute descriptors
+
+ // -- _colour
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_colour", "colour",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasColour())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _start
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasStart()) { return null; }
- return new java.lang.Integer(target.getStart());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setStart( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _start
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return new java.lang.Integer(target.getColour());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteColour();
+ return;
+ }
+ target.setColour(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _end
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasEnd()) { return null; }
- return new java.lang.Integer(target.getEnd());
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.setEnd( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _end
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _colour
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _start
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_start", "start",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasStart())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _id
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getId();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.setId( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setRequired(true);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _id
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(1);
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ return new java.lang.Integer(target.getStart());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setStart(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _hidden
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_hidden", "hidden", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasHidden()) { return null; }
- return (target.getHidden() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteHidden();
- return;
- }
- target.setHidden( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hidden
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _start
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _end
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_end", "end",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasEnd())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _viewreference
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_viewreference", "viewreference", org.exolab.castor.xml.NodeType.Attribute);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- if (!target.hasViewreference()) { return null; }
- return (target.getViewreference() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // if null, use delete method for optional primitives
- if (value == null) {
- target.deleteViewreference();
- return;
- }
- target.setViewreference( ((java.lang.Boolean) value).booleanValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _viewreference
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.BooleanValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
- fieldValidator.setValidator(typeValidator);
+ return new java.lang.Integer(target.getEnd());
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.setEnd(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- initialize element descriptors
-
- //-- _featuresList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Features.class, "_featuresList", "features", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getFeatures();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.addFeatures( (jalview.schemabinding.version2.Features) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllFeatures();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Features();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _featuresList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _end
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _id
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.String.class, "_id", "id",
+ org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getId();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.setId((java.lang.String) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _pdbidsList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Pdbids.class, "_pdbidsList", "pdbids", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getPdbids();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.addPdbids( (jalview.schemabinding.version2.Pdbids) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllPdbids();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.Pdbids();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _pdbidsList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setRequired(true);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _id
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(1);
+ { // -- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
+ // -- _hidden
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_hidden", "hidden",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasHidden())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _hiddenSequencesList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_hiddenSequencesList", "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getHiddenSequences();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- // ignore null values for non optional primitives
- if (value == null) { return; }
-
- target.addHiddenSequences( ((java.lang.Integer) value).intValue());
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllHiddenSequences();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hiddenSequencesList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
- org.exolab.castor.xml.validators.IntValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.IntValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setMinInclusive(-2147483648);
- typeValidator.setMaxInclusive(2147483647);
+ return (target.getHidden() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteHidden();
+ return;
+ }
+ target.setHidden(((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
- //-- _rnaViewerList
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.RnaViewer.class, "_rnaViewerList", "rnaViewer", org.exolab.castor.xml.NodeType.Element);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getRnaViewer();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.addRnaViewer( (jalview.schemabinding.version2.RnaViewer) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public void resetValue(Object object) throws IllegalStateException, IllegalArgumentException {
- try {
- JSeq target = (JSeq) object;
- target.removeAllRnaViewer();
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return new jalview.schemabinding.version2.RnaViewer();
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(true);
- addFieldDescriptor(desc);
-
- //-- validation code for: _rnaViewerList
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- fieldValidator.setMinOccurs(0);
- { //-- local scope
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _hidden
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ // -- _viewreference
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Boolean.TYPE, "_viewreference", "viewreference",
+ org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ if (!target.hasViewreference())
+ {
+ return null;
}
- desc.setValidator(fieldValidator);
- //-- _hmmerProfile
- desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_hmmerProfile", "hmmerProfile", org.exolab.castor.xml.NodeType.Element);
- desc.setImmutable(true);
- handler = new org.exolab.castor.xml.XMLFieldHandler() {
- public java.lang.Object getValue( java.lang.Object object )
- throws IllegalStateException
- {
- JSeq target = (JSeq) object;
- return target.getHmmerProfile();
- }
- public void setValue( java.lang.Object object, java.lang.Object value)
- throws IllegalStateException, IllegalArgumentException
- {
- try {
- JSeq target = (JSeq) object;
- target.setHmmerProfile( (java.lang.String) value);
- } catch (java.lang.Exception ex) {
- throw new IllegalStateException(ex.toString());
- }
- }
- public java.lang.Object newInstance(java.lang.Object parent) {
- return null;
- }
- };
- desc.setHandler(handler);
- desc.setNameSpaceURI("www.jalview.org");
- desc.setMultivalued(false);
- addFieldDescriptor(desc);
-
- //-- validation code for: _hmmerProfile
- fieldValidator = new org.exolab.castor.xml.FieldValidator();
- { //-- local scope
- org.exolab.castor.xml.validators.StringValidator typeValidator;
- typeValidator = new org.exolab.castor.xml.validators.StringValidator();
- fieldValidator.setValidator(typeValidator);
- typeValidator.setWhiteSpace("preserve");
+ return (target.getViewreference() ? java.lang.Boolean.TRUE
+ : java.lang.Boolean.FALSE);
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // if null, use delete method for optional primitives
+ if (value == null)
+ {
+ target.deleteViewreference();
+ return;
+ }
+ target.setViewreference(((java.lang.Boolean) value)
+ .booleanValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
}
- desc.setValidator(fieldValidator);
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _viewreference
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { // -- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
}
+ desc.setValidator(fieldValidator);
+ // -- initialize element descriptors
+ // -- _featuresList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Features.class, "_featuresList",
+ "features", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getFeatures();
+ }
- //-----------/
- //- Methods -/
- //-----------/
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addFeatures((jalview.schemabinding.version2.Features) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getAccessMode.
- *
- * @return the access mode specified for this class.
- */
- public org.exolab.castor.mapping.AccessMode getAccessMode(
- ) {
- return null;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllFeatures();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getIdentity.
- *
- * @return the identity field, null if this class has no
- * identity.
- */
- public org.exolab.castor.mapping.FieldDescriptor getIdentity(
- ) {
- return super.getIdentity();
- }
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Features();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method getJavaClass.
- *
- * @return the Java class represented by this descriptor.
- */
- public java.lang.Class getJavaClass(
- ) {
- return jalview.schemabinding.version2.JSeq.class;
+ // -- validation code for: _featuresList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _pdbidsList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.Pdbids.class, "_pdbidsList",
+ "pdbids", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getPdbids();
+ }
- /**
- * Method getNameSpacePrefix.
- *
- * @return the namespace prefix to use when marshaling as XML.
- */
- public java.lang.String getNameSpacePrefix(
- ) {
- return _nsPrefix;
- }
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addPdbids((jalview.schemabinding.version2.Pdbids) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getNameSpaceURI.
- *
- * @return the namespace URI used when marshaling and
- * unmarshaling as XML.
- */
- public java.lang.String getNameSpaceURI(
- ) {
- return _nsURI;
- }
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllPdbids();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getValidator.
- *
- * @return a specific validator for the class described by this
- * ClassDescriptor.
- */
- public org.exolab.castor.xml.TypeValidator getValidator(
- ) {
- return this;
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.Pdbids();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _pdbidsList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ // -- _hiddenSequencesList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ java.lang.Integer.TYPE, "_hiddenSequencesList",
+ "hiddenSequences", org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getHiddenSequences();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ // ignore null values for non optional primitives
+ if (value == null)
+ {
+ return;
+ }
+
+ target.addHiddenSequences(((java.lang.Integer) value).intValue());
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
- /**
- * Method getXMLName.
- *
- * @return the XML Name for the Class being described.
- */
- public java.lang.String getXMLName(
- ) {
- return _xmlName;
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllHiddenSequences();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
+
+ // -- validation code for: _hiddenSequencesList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
+ org.exolab.castor.xml.validators.IntValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.IntValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setMinInclusive(-2147483648);
+ typeValidator.setMaxInclusive(2147483647);
}
+ desc.setValidator(fieldValidator);
+ // -- _rnaViewerList
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(
+ jalview.schemabinding.version2.RnaViewer.class,
+ "_rnaViewerList", "rnaViewer",
+ org.exolab.castor.xml.NodeType.Element);
+ handler = new org.exolab.castor.xml.XMLFieldHandler()
+ {
+ public java.lang.Object getValue(java.lang.Object object)
+ throws IllegalStateException
+ {
+ JSeq target = (JSeq) object;
+ return target.getRnaViewer();
+ }
+
+ public void setValue(java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.addRnaViewer((jalview.schemabinding.version2.RnaViewer) value);
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public void resetValue(Object object) throws IllegalStateException,
+ IllegalArgumentException
+ {
+ try
+ {
+ JSeq target = (JSeq) object;
+ target.removeAllRnaViewer();
+ } catch (java.lang.Exception ex)
+ {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+
+ public java.lang.Object newInstance(java.lang.Object parent)
+ {
+ return new jalview.schemabinding.version2.RnaViewer();
+ }
+ };
+ desc.setHandler(handler);
+ desc.setNameSpaceURI("www.jalview.org");
+ desc.setMultivalued(true);
+ addFieldDescriptor(desc);
- /**
- * Method isElementDefinition.
- *
- * @return true if XML schema definition of this Class is that
- * of a global
- * element or element with anonymous type definition.
- */
- public boolean isElementDefinition(
- ) {
- return _elementDefinition;
+ // -- validation code for: _rnaViewerList
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ fieldValidator.setMinOccurs(0);
+ { // -- local scope
}
+ desc.setValidator(fieldValidator);
+ }
+
+ // -----------/
+ // - Methods -/
+ // -----------/
+
+ /**
+ * Method getAccessMode.
+ *
+ * @return the access mode specified for this class.
+ */
+ public org.exolab.castor.mapping.AccessMode getAccessMode()
+ {
+ return null;
+ }
+
+ /**
+ * Method getIdentity.
+ *
+ * @return the identity field, null if this class has no identity.
+ */
+ public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+ {
+ return super.getIdentity();
+ }
+
+ /**
+ * Method getJavaClass.
+ *
+ * @return the Java class represented by this descriptor.
+ */
+ public java.lang.Class getJavaClass()
+ {
+ return jalview.schemabinding.version2.JSeq.class;
+ }
+
+ /**
+ * Method getNameSpacePrefix.
+ *
+ * @return the namespace prefix to use when marshaling as XML.
+ */
+ public java.lang.String getNameSpacePrefix()
+ {
+ return _nsPrefix;
+ }
+
+ /**
+ * Method getNameSpaceURI.
+ *
+ * @return the namespace URI used when marshaling and unmarshaling as XML.
+ */
+ public java.lang.String getNameSpaceURI()
+ {
+ return _nsURI;
+ }
+
+ /**
+ * Method getValidator.
+ *
+ * @return a specific validator for the class described by this
+ * ClassDescriptor.
+ */
+ public org.exolab.castor.xml.TypeValidator getValidator()
+ {
+ return this;
+ }
+
+ /**
+ * Method getXMLName.
+ *
+ * @return the XML Name for the Class being described.
+ */
+ public java.lang.String getXMLName()
+ {
+ return _xmlName;
+ }
+
+ /**
+ * Method isElementDefinition.
+ *
+ * @return true if XML schema definition of this Class is that of a global
+ * element or element with anonymous type definition.
+ */
+ public boolean isElementDefinition()
+ {
+ return _elementDefinition;
+ }
}
Nucleotide("Nucleotide", NucleotideColourScheme.class),
PurinePyrimidine("Purine/Pyrimidine", PurinePyrimidineColourScheme.class),
RNAHelices("RNA Helices", RNAHelicesColour.class),
- TCoffee("T-Coffee Scores", TCoffeeColourScheme.class),
- HMMERU("HMMER-Uniprot", HmmerGlobalBackground.class),
- HMMERA("HMMER-Alignment", HmmerLocalBackground.class);
+ TCoffee("T-Coffee Scores", TCoffeeColourScheme.class);
// RNAInteraction("RNA Interaction type", RNAInteractionColourScheme.class)
private String name;
public class ResidueProperties
{
- // alphabet names used in Hidden Markov Model files
- public static final String ALPHABET_RNA = "RNA";
-
- public static final String ALPHABET_DNA = "DNA";
-
- public static final String ALPHABET_AMINO = "amino";
-
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
// lookup from modified amino acid (e.g. MSE) to canonical form (e.g. MET)
public static final Map<String, String> modifications = new HashMap<>();
- // residue background frequencies across different alphabets
- public static final Map<String, Map<Character, Float>> backgroundFrequencies = new HashMap<>();
-
static
{
aaIndex = new int[255];
}
- static
- {
- Map<Character, Float> amino = new HashMap<>();
- amino.put('A', 0.0826f);
- amino.put('Q', 0.0393f);
- amino.put('L', 0.0965f);
- amino.put('S', 0.0661f);
- amino.put('R', 0.0553f);
- amino.put('E', 0.0674f);
- amino.put('K', 0.0582f);
- amino.put('T', 0.0535f);
- amino.put('N', 0.0406f);
- amino.put('G', 0.0708f);
- amino.put('M', 0.0241f);
- amino.put('W', 0.0109f);
- amino.put('D', 0.0546f);
- amino.put('H', 0.0227f);
- amino.put('F', 0.0386f);
- amino.put('Y', 0.0292f);
- amino.put('C', 0.0137f);
- amino.put('I', 0.0593f);
- amino.put('P', 0.0472f);
- amino.put('V', 0.0686f);
- backgroundFrequencies.put(ALPHABET_AMINO, amino);
- // todo: these don't match https://www.ebi.ac.uk/uniprot/TrEMBLstats - what
- // are they?
- }
-
- // TODO get correct frequencies
-
- static
- {
- Map<Character, Float> dna = new HashMap<>();
- dna.put('A', 0.25f);
- dna.put('C', 0.25f);
- dna.put('T', 0.25f);
- dna.put('G', 0.25f);
- backgroundFrequencies.put(ALPHABET_DNA, dna);
-
- }
-
- static
- {
- Map<Character, Float> rna = new HashMap<>();
- rna.put('A', 0.25f);
- rna.put('C', 0.25f);
- rna.put('T', 0.25f);
- rna.put('G', 0.25f);
- backgroundFrequencies.put(ALPHABET_RNA, rna);
-
- }
-
public static String getCanonicalAminoAcid(String aA)
{
String canonical = modifications.get(aA);
fromHighest = Integer.MIN_VALUE;
for (int[] range : fromRange)
{
+ if (range.length != 2)
+ {
+ // throw new IllegalArgumentException(range);
+ System.err.println(
+ "Invalid format for fromRange " + Arrays.toString(range)
+ + " may cause errors");
+ }
fromLowest = Math.min(fromLowest, Math.min(range[0], range[1]));
fromHighest = Math.max(fromHighest, Math.max(range[0], range[1]));
}
toHighest = Integer.MIN_VALUE;
for (int[] range : toRange)
{
+ if (range.length != 2)
+ {
+ // throw new IllegalArgumentException(range);
+ System.err.println("Invalid format for toRange "
+ + Arrays.toString(range)
+ + " may cause errors");
+ }
toLowest = Math.min(toLowest, Math.min(range[0], range[1]));
toHighest = Math.max(toHighest, Math.max(range[0], range[1]));
}
for (int[] range : map.getFromRanges())
{
- MappingUtils.addRange(range, fromShifts);
+ addRange(range, fromShifts);
}
for (int[] range : map.getToRanges())
{
- MappingUtils.addRange(range, toShifts);
+ addRange(range, toShifts);
+ }
+ }
+
+ /**
+ * Adds the given range to a list of ranges. If the new range just extends
+ * existing ranges, the current endpoint is updated instead.
+ *
+ * @param range
+ * @param addTo
+ */
+ static void addRange(int[] range, List<int[]> addTo)
+ {
+ /*
+ * list is empty - add to it!
+ */
+ if (addTo.size() == 0)
+ {
+ addTo.add(range);
+ return;
+ }
+
+ int[] last = addTo.get(addTo.size() - 1);
+ boolean lastForward = last[1] >= last[0];
+ boolean newForward = range[1] >= range[0];
+
+ /*
+ * contiguous range in the same direction - just update endpoint
+ */
+ if (lastForward == newForward && last[1] == range[0])
+ {
+ last[1] = range[1];
+ return;
}
+
+ /*
+ * next range starts at +1 in forward sense - update endpoint
+ */
+ if (lastForward && newForward && range[0] == last[1] + 1)
+ {
+ last[1] = range[1];
+ return;
+ }
+
+ /*
+ * next range starts at -1 in reverse sense - update endpoint
+ */
+ if (!lastForward && !newForward && range[0] == last[1] - 1)
+ {
+ last[1] = range[1];
+ return;
+ }
+
+ /*
+ * just add the new range
+ */
+ addTo.add(range);
}
/**
for (int[] range : getToRanges())
{
int[] transferred = map.locateInTo(range[0], range[1]);
- if (transferred == null)
+ if (transferred == null || transferred.length % 2 != 0)
{
return null;
}
- toRanges.add(transferred);
+
+ /*
+ * convert [start1, end1, start2, end2, ...]
+ * to [[start1, end1], [start2, end2], ...]
+ */
+ for (int i = 0; i < transferred.length;)
+ {
+ toRanges.add(new int[] { transferred[i], transferred[i + 1] });
+ i += 2;
+ }
}
return new MapList(getFromRanges(), toRanges, outFromRatio, outToRatio);
}
}
}
-
- /**
- * Adds the given range to a list of ranges. If the new range just extends
- * existing ranges, the current endpoint is updated instead.
- *
- * @param range
- * @param addTo
- */
- public static void addRange(int[] range, List<int[]> addTo)
- {
- /*
- * list is empty - add to it!
- */
- if (addTo.size() == 0)
- {
- addTo.add(range);
- return;
- }
-
- int[] last = addTo.get(addTo.size() - 1);
- boolean lastForward = last[1] >= last[0];
- boolean newForward = range[1] >= range[0];
-
- /*
- * contiguous range in the same direction - just update endpoint
- */
- if (lastForward == newForward && last[1] == range[0])
- {
- last[1] = range[1];
- return;
- }
-
- /*
- * next range starts at +1 in forward sense - update endpoint
- */
- if (lastForward && newForward && range[0] == last[1] + 1)
- {
- last[1] = range[1];
- return;
- }
-
- /*
- * next range starts at -1 in reverse sense - update endpoint
- */
- if (!lastForward && !newForward && range[0] == last[1] - 1)
- {
- last[1] = range[1];
- return;
- }
-
- /*
- * just add the new range
- */
- addTo.add(range);
- }
}
}
/**
- * Check if we are on a Microsoft platform...
+ * Check if we are on a Microsoft plaform...
*
* @return true if we have to cope with another platform variation
*/
}
/**
+ * Returns the last part of 'input' after the last occurrence of 'token'. For
+ * example to extract only the filename from a full path or URL.
+ *
+ * @param input
+ * @param token
+ * a delimiter which must be in regular expression format
+ * @return
+ */
+ public static String getLastToken(String input, String token)
+ {
+ if (input == null)
+ {
+ return null;
+ }
+ if (token == null)
+ {
+ return input;
+ }
+ String[] st = input.split(token);
+ return st[st.length - 1];
+ }
+
+ /**
* Parses the input string into components separated by the delimiter. Unlike
* String.split(), this method will ignore occurrences of the delimiter which
* are nested within single quotes in name-value pair values, e.g. a='b,c'.
{
return null;
}
- List<String> jv = new ArrayList<>();
+ List<String> jv = new ArrayList<String>();
int cp = 0, pos, escape;
boolean wasescaped = false, wasquoted = false;
String lstitem = null;
import jalview.workers.AlignCalcManager;
import jalview.workers.ComplementConsensusThread;
import jalview.workers.ConsensusThread;
-import jalview.workers.InformationThread;
import jalview.workers.StrucConsensusThread;
import java.awt.Color;
protected Deque<CommandI> redoList = new ArrayDeque<>();
- protected String sequenceSetID;
-
- /*
- * probably unused indicator that view is of a dataset rather than an
- * alignment
- */
- protected boolean isDataset = false;
-
- private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
-
- protected ColumnSelection colSel = new ColumnSelection();
-
- public boolean autoCalculateConsensus = true;
-
- protected boolean autoCalculateStrucConsensus = true;
-
- protected boolean ignoreGapsInConsensusCalculation = false;
-
- protected boolean ignoreBelowBackGroundFrequencyCalculation = false;
-
- protected boolean infoLetterHeight = false;
-
- protected ResidueShaderI residueShading = new ResidueShader();
-
- protected AlignmentAnnotation consensus;
-
- protected AlignmentAnnotation complementConsensus;
-
- protected AlignmentAnnotation occupancy;
-
- protected AlignmentAnnotation strucConsensus;
-
- protected AlignmentAnnotation conservation;
-
- protected AlignmentAnnotation quality;
-
- /**
- * alignment displayed in the viewport
- */
- private AlignmentI alignment;
-
- /**
- * results of alignment consensus analysis for visible portion of view
- */
- protected ProfilesI consensusProfiles;
-
- /**
- * HMM profile for the alignment
- */
- protected ProfilesI hmmProfiles;
-
- /**
- * results of cDNA complement consensus visible portion of view
- */
- protected Hashtable[] hcomplementConsensus;
-
/**
- * results of secondary structure base pair consensus for visible portion of
- * view
+ * alignment displayed in the viewport. Please use get/setter
*/
- protected Hashtable[] hStrucConsensus;
-
- protected Conservation hconservation;
+ protected AlignmentI alignment;
public AlignmentViewport(AlignmentI al)
{
return alignment.getGapCharacter();
}
+ protected String sequenceSetID;
+
+ /**
+ * probably unused indicator that view is of a dataset rather than an
+ * alignment
+ */
+ protected boolean isDataset = false;
+
public void setDataset(boolean b)
{
isDataset = b;
return isDataset;
}
+ private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
+
+ protected ColumnSelection colSel = new ColumnSelection();
+
+ public boolean autoCalculateConsensus = true;
+
+ protected boolean autoCalculateStrucConsensus = true;
+
+ protected boolean ignoreGapsInConsensusCalculation = false;
+
+ protected ResidueShaderI residueShading = new ResidueShader();
+
@Override
public void setGlobalColourScheme(ColourSchemeI cs)
{
{
return residueShading;
}
+
+ protected AlignmentAnnotation consensus;
+
+ protected AlignmentAnnotation complementConsensus;
+
+ protected AlignmentAnnotation gapcounts;
+
+ protected AlignmentAnnotation strucConsensus;
+
+ protected AlignmentAnnotation conservation;
+
+ protected AlignmentAnnotation quality;
+
+ protected AlignmentAnnotation[] groupConsensus;
+
+ protected AlignmentAnnotation[] groupConservation;
+
+ /**
+ * results of alignment consensus analysis for visible portion of view
+ */
+ protected ProfilesI hconsensus = null;
+
+ /**
+ * results of cDNA complement consensus visible portion of view
+ */
+ protected Hashtable[] hcomplementConsensus = null;
+
+ /**
+ * results of secondary structure base pair consensus for visible portion of
+ * view
+ */
+ protected Hashtable[] hStrucConsensus = null;
+
+ protected Conservation hconservation = null;
+
@Override
public void setConservation(Conservation cons)
{
}
@Override
- public void setConsensusProfiles(ProfilesI hconsensus)
+ public void setSequenceConsensusHash(ProfilesI hconsensus)
{
- this.consensusProfiles = hconsensus;
+ this.hconsensus = hconsensus;
}
@Override
}
@Override
- public ProfilesI getConsensusProfiles()
- {
- return consensusProfiles;
- }
-
- @Override
- public void setHmmProfiles(ProfilesI info)
- {
- hmmProfiles = info;
- }
-
- @Override
- public ProfilesI getHmmProfiles()
+ public ProfilesI getSequenceConsensusHash()
{
- return hmmProfiles;
+ return hconsensus;
}
@Override
}
@Override
- public AlignmentAnnotation getOccupancyAnnotation()
+ public AlignmentAnnotation getAlignmentGapAnnotation()
{
- return occupancy;
+ return gapcounts;
}
@Override
}
}
- @Override
- public void initInformationWorker(final AlignmentViewPanel ap)
- {
- if (calculator
- .getRegisteredWorkersOfClass(InformationThread.class) == null)
- {
- calculator.registerWorker(new InformationThread(this, ap));
- }
- }
-
// --------START Structure Conservation
public void updateStrucConsensus(final AlignmentViewPanel ap)
{
strucConsensus = null;
conservation = null;
quality = null;
- consensusProfiles = null;
+ groupConsensus = null;
+ groupConservation = null;
+ hconsensus = null;
hconservation = null;
hcomplementConsensus = null;
- occupancy = null;
+ gapcounts = null;
calculator = null;
residueShading = null; // may hold a reference to Consensus
changeSupport = null;
protected boolean showConsensusHistogram = true;
/**
- * should hmm profile be rendered by default
- */
- protected boolean hmmShowSequenceLogo = false;
-
- /**
- * should hmm profile be rendered normalised to row height
- */
- protected boolean hmmNormaliseSequenceLogo = false;
-
- /**
- * should information histograms be rendered by default
- */
- protected boolean hmmShowHistogram = true;
-
- /**
* @return the showConsensusProfile
*/
@Override
}
/**
- * @return the showInformationProfile
- */
- @Override
- public boolean isShowHMMSequenceLogo()
- {
- return hmmShowSequenceLogo;
- }
-
- /**
* @param showSequenceLogo
* the new value
*/
this.showSequenceLogo = showSequenceLogo;
}
- public void setShowHMMSequenceLogo(boolean showHMMSequenceLogo)
- {
- if (showHMMSequenceLogo != this.hmmShowSequenceLogo)
- {
- this.hmmShowSequenceLogo = showHMMSequenceLogo;
- // TODO: updateAnnotation if description (tooltip) will show
- // profile in place of information content?
- // calculator.updateAnnotationFor(InformationThread.class);
- }
- this.hmmShowSequenceLogo = showHMMSequenceLogo;
- }
-
/**
* @param showConsensusHistogram
* the showConsensusHistogram to set
}
/**
- * @param showInformationHistogram
- */
- public void setShowInformationHistogram(boolean showInformationHistogram)
- {
- this.hmmShowHistogram = showInformationHistogram;
- }
-
- /**
* @return the showGroupConservation
*/
public boolean isShowGroupConservation()
}
/**
- *
- * @return flag to indicate if the information content histogram should be
- * rendered by default
- */
- @Override
- public boolean isShowInformationHistogram()
- {
- return this.hmmShowHistogram;
- }
-
- /**
* when set, updateAlignment will always ensure sequences are of equal length
*/
private boolean padGaps = false;
ignoreGapsInConsensusCalculation = b;
if (ap != null)
{
+ updateConsensus(ap);
if (residueShading != null)
{
residueShading.setThreshold(residueShading.getThreshold(),
ignoreGapsInConsensusCalculation);
}
}
- }
-
- public void setIgnoreBelowBackground(boolean b, AlignmentViewPanel ap)
- {
- ignoreBelowBackGroundFrequencyCalculation = b;
- }
- public void setInfoLetterHeight(boolean b, AlignmentViewPanel ap)
- {
- infoLetterHeight = b;
}
private long sgrouphash = -1, colselhash = -1;
return ignoreGapsInConsensusCalculation;
}
- @Override
- public boolean isIgnoreBelowBackground()
- {
- return ignoreBelowBackGroundFrequencyCalculation;
- }
-
- @Override
- public boolean isInfoLetterHeight()
- {
- return infoLetterHeight;
- }
-
// property change stuff
// JBPNote Prolly only need this in the applet version.
private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
{
alignment.padGaps();
}
+ if (autoCalculateConsensus)
+ {
+ updateConsensus(ap);
+ }
+ if (hconsensus != null && autoCalculateConsensus)
+ {
+ updateConservation(ap);
+ }
+ if (autoCalculateStrucConsensus)
+ {
+ updateStrucConsensus(ap);
+ }
// Reset endRes of groups if beyond alignment width
int alWidth = alignment.getWidth();
updateAllColourSchemes();
calculator.restartWorkers();
+ // alignment.adjustSequenceAnnotations();
}
/**
{
rs.alignmentChanged(alignment, hiddenRepSequences);
- rs.setConsensus(consensusProfiles);
+ rs.setConsensus(hconsensus);
if (rs.conservationApplied())
{
rs.setConservation(Conservation.calculateConservation("All",
// depending on if the user wants to see the annotation or not in a
// specific alignment
- if (consensusProfiles == null && !isDataset)
+ if (hconsensus == null && !isDataset)
{
if (!alignment.isNucleotide())
{
MessageManager.getString("label.consensus_descr"),
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
initConsensus(consensus);
-
- initOccupancy();
+ initGapCounts();
initComplementConsensus();
}
// these should be extracted from the view model - style and settings for
// derived annotation
- private void initOccupancy()
+ private void initGapCounts()
{
if (showOccupancy)
{
- occupancy = new AlignmentAnnotation("Occupancy",
+ gapcounts = new AlignmentAnnotation("Occupancy",
MessageManager.getString("label.occupancy_descr"),
new Annotation[1], 0f, alignment.getHeight(),
AlignmentAnnotation.BAR_GRAPH);
- occupancy.hasText = true;
- occupancy.autoCalculated = true;
- occupancy.scaleColLabel = true;
- occupancy.graph = AlignmentAnnotation.BAR_GRAPH;
+ gapcounts.hasText = true;
+ gapcounts.autoCalculated = true;
+ gapcounts.scaleColLabel = true;
+ gapcounts.graph = AlignmentAnnotation.BAR_GRAPH;
- alignment.addAnnotation(occupancy);
+ alignment.addAnnotation(gapcounts);
}
}
boolean showprf = isShowSequenceLogo();
boolean showConsHist = isShowConsensusHistogram();
boolean normLogo = isNormaliseSequenceLogo();
- boolean showHMMPrf = isShowHMMSequenceLogo();
- boolean showInfoHist = isShowInformationHistogram();
- boolean normHMMLogo = isNormaliseHMMSequenceLogo();
/**
* TODO reorder the annotation rows according to group/sequence ordering on
sg.setshowSequenceLogo(showprf);
sg.setShowConsensusHistogram(showConsHist);
sg.setNormaliseSequenceLogo(normLogo);
- sg.setShowHMMSequenceLogo(showHMMPrf);
- sg.setShowInformationHistogram(showInfoHist);
- sg.setNormaliseHMMSequenceLogo(normHMMLogo);
}
if (conv)
{
return sq;
}
- public boolean hasReferenceAnnotation()
- {
- AlignmentAnnotation[] annots = this.alignment.getAlignmentAnnotation();
- for (AlignmentAnnotation annot : annots)
- {
- if ("RF".equals(annot.label) || annot.label.contains("Reference"))
- {
- return true;
- }
- }
- return false;
- }
-
@Override
public void setCurrentTree(TreeModel tree)
{
{
return currentTree;
}
-
- @Override
- public boolean isNormaliseSequenceLogo()
- {
- return normaliseSequenceLogo;
- }
-
- public void setNormaliseSequenceLogo(boolean state)
- {
- normaliseSequenceLogo = state;
- }
-
- @Override
- public boolean isNormaliseHMMSequenceLogo()
- {
- return hmmNormaliseSequenceLogo;
- }
-
- public void setNormaliseHMMSequenceLogo(boolean state)
- {
- hmmNormaliseSequenceLogo = state;
- }
}
.synchronizedList(new ArrayList<AlignCalcWorkerI>());
updating = Collections.synchronizedMap(
new Hashtable<Class<? extends AlignCalcWorkerI>, List<AlignCalcWorkerI>>());
- canUpdate = new HashSet<>();
+ canUpdate = new HashSet<AlignCalcWorkerI>();
}
@Override
public List<AlignCalcWorkerI> getRegisteredWorkersOfClass(
Class<? extends AlignCalcWorkerI> workerClass)
{
- List<AlignCalcWorkerI> workingClass = new ArrayList<>();
+ List<AlignCalcWorkerI> workingClass = new ArrayList<AlignCalcWorkerI>();
synchronized (canUpdate)
{
for (AlignCalcWorkerI worker : canUpdate)
public void removeRegisteredWorkersOfClass(
Class<? extends AlignCalcWorkerI> typeToRemove)
{
- List<AlignCalcWorkerI> removable = new ArrayList<>();
- Set<AlignCalcWorkerI> toremovannot = new HashSet<>();
+ List<AlignCalcWorkerI> removable = new ArrayList<AlignCalcWorkerI>();
+ Set<AlignCalcWorkerI> toremovannot = new HashSet<AlignCalcWorkerI>();
synchronized (restartable)
{
for (AlignCalcWorkerI worker : restartable)
* first just find those to remove (to avoid
* ConcurrentModificationException)
*/
- List<AlignCalcWorkerI> toRemove = new ArrayList<>();
+ List<AlignCalcWorkerI> toRemove = new ArrayList<AlignCalcWorkerI>();
for (AlignCalcWorkerI worker : restartable)
{
if (worker.involves(ann))
try
{
AlignmentAnnotation consensus = getConsensusAnnotation();
- AlignmentAnnotation gap = getOccupancyAnnotation();
+ AlignmentAnnotation gap = getGapAnnotation();
if ((consensus == null && gap == null) || calcMan.isPending(this))
{
calcMan.workerComplete(this);
{
AlignmentAnnotation consensus = getConsensusAnnotation();
consensus.annotations = new Annotation[aWidth];
- AlignmentAnnotation gap = getOccupancyAnnotation();
+ AlignmentAnnotation gap = getGapAnnotation();
if (gap != null)
{
gap.annotations = new Annotation[aWidth];
ProfilesI hconsensus = AAFrequency.calculate(aseqs, width, 0, width,
true);
- alignViewport.setConsensusProfiles(hconsensus);
+ alignViewport.setSequenceConsensusHash(hconsensus);
setColourSchemeConsensus(hconsensus);
}
*
* @return
*/
- protected AlignmentAnnotation getOccupancyAnnotation()
+ protected AlignmentAnnotation getGapAnnotation()
{
- return alignViewport.getOccupancyAnnotation();
+ return alignViewport.getAlignmentGapAnnotation();
}
/**
&& hconsensus != null)
{
deriveConsensus(consensus, hconsensus);
- AlignmentAnnotation occupancy = getOccupancyAnnotation();
- if (occupancy != null)
+ AlignmentAnnotation gap = getGapAnnotation();
+ if (gap != null)
{
- deriveOccupancy(occupancy, hconsensus);
+ deriveGap(gap, hconsensus);
}
}
}
protected void deriveConsensus(AlignmentAnnotation consensusAnnotation,
ProfilesI hconsensus)
{
+
long nseq = getSequences().length;
AAFrequency.completeConsensus(consensusAnnotation, hconsensus,
hconsensus.getStartColumn(), hconsensus.getEndColumn() + 1,
* @param hconsensus
* the computed consensus data
*/
- protected void deriveOccupancy(AlignmentAnnotation gapAnnotation,
+ protected void deriveGap(AlignmentAnnotation gapAnnotation,
ProfilesI hconsensus)
{
long nseq = getSequences().length;
- AAFrequency.completeOccupancyAnnot(gapAnnotation, hconsensus,
+ AAFrequency.completeGapAnnot(gapAnnotation, hconsensus,
hconsensus.getStartColumn(), hconsensus.getEndColumn() + 1,
nseq);
}
protected Object getViewportConsensus()
{
// TODO convert ComplementConsensusThread to use Profile
- return alignViewport.getConsensusProfiles();
+ return alignViewport.getSequenceConsensusHash();
}
}
import jalview.datamodel.Mapping;
import jalview.datamodel.SequenceI;
import jalview.gui.CutAndPasteTransfer;
-import jalview.gui.DasSourceBrowser;
import jalview.gui.Desktop;
import jalview.gui.FeatureSettings;
import jalview.gui.IProgressIndicator;
import jalview.gui.OOMWarning;
import jalview.util.DBRefUtils;
import jalview.util.MessageManager;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-import jalview.ws.dbsources.das.datamodel.DasSequenceSource;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.ArrayList;
DbSourceProxy[] sources, FeatureSettings featureSettings,
boolean isNucleotide)
{
- listeners = new ArrayList<FetchFinishedListenerI>();
+ listeners = new ArrayList<>();
this.progressWindow = progressIndicatorFrame;
alseqs = new SequenceI[seqs.length];
SequenceI[] ds = new SequenceI[seqs.length];
{
// af.featureSettings_actionPerformed(null);
String[] defdb = null;
- List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();
- Vector<jalviewSourceI> dasselsrc = (featureSettings != null)
- ? featureSettings.getSelectedSources()
- : new DasSourceBrowser().getSelectedSources();
-
- for (jalviewSourceI src : dasselsrc)
- {
- List<DbSourceProxy> sp = src.getSequenceSourceProxies();
- if (sp != null)
- {
- selsources.addAll(sp);
- if (sp.size() > 1)
- {
- Cache.log.debug("Added many Db Sources for :" + src.getTitle());
- }
- }
- }
+ List<DbSourceProxy> selsources = new ArrayList<>();
// select appropriate databases based on alignFrame context.
if (forNucleotide)
{
{
defdb = DBRefSource.PROTEINDBS;
}
- List<DbSourceProxy> srces = new ArrayList<DbSourceProxy>();
+ List<DbSourceProxy> srces = new ArrayList<>();
for (String ddb : defdb)
{
List<DbSourceProxy> srcesfordb = sfetcher.getSourceProxy(ddb);
}
/**
- * retrieve all the das sequence sources and add them to the list of db
- * sources to retrieve from
- */
- public void appendAllDasSources()
- {
- if (dbSources == null)
- {
- dbSources = new DbSourceProxy[0];
- }
- // append additional sources
- DbSourceProxy[] otherdb = sfetcher
- .getDbSourceProxyInstances(DasSequenceSource.class);
- if (otherdb != null && otherdb.length > 0)
- {
- DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length
- + otherdb.length];
- System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);
- System.arraycopy(otherdb, 0, newsrc, dbSources.length,
- otherdb.length);
- dbSources = newsrc;
- }
- }
-
- /**
* start the fetcher thread
*
* @param waitTillFinished
}
else if (seqs == null)
{
- seqs = new Vector<SequenceI>();
+ seqs = new Vector<>();
seqs.addElement(seq);
}
}
else
{
- seqs = new Vector<SequenceI>();
+ seqs = new Vector<>();
seqs.addElement(seq);
}
e.printStackTrace();
}
- Vector<SequenceI> sdataset = new Vector<SequenceI>(
+ Vector<SequenceI> sdataset = new Vector<>(
Arrays.asList(dataset));
- List<String> warningMessages = new ArrayList<String>();
+ List<String> warningMessages = new ArrayList<>();
int db = 0;
while (sdataset.size() > 0 && db < dbSources.length)
SequenceI[] currSeqs = new SequenceI[sdataset.size()];
sdataset.copyInto(currSeqs);// seqs that are to be validated against
// dbSources[db]
- Vector<String> queries = new Vector<String>(); // generated queries curSeq
- seqRefs = new Hashtable<String, Vector<SequenceI>>();
+ Vector<String> queries = new Vector<>(); // generated queries curSeq
+ seqRefs = new Hashtable<>();
int seqIndex = 0;
{
// Work out which sequences this sequence matches,
// taking into account all accessionIds and names in the file
- Vector<SequenceI> sequenceMatches = new Vector<SequenceI>();
+ Vector<SequenceI> sequenceMatches = new Vector<>();
// look for corresponding accession ids
DBRefEntry[] entryRefs = DBRefUtils
.selectRefs(retrievedSeq.getDBRefs(), new String[]
*/
private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray)
{
- Vector<SequenceI> nseq = new Vector<SequenceI>();
+ Vector<SequenceI> nseq = new Vector<>();
for (int i = 0; sequencesArray != null
&& i < sequencesArray.length; i++)
{
import jalview.ws.dbsources.PfamSeed;
import jalview.ws.dbsources.RfamSeed;
import jalview.ws.dbsources.Uniprot;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
import jalview.ws.seqfetcher.ASequenceFetcher;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.ArrayList;
-import java.util.List;
/**
* This implements the run-time discovery of sequence database clients.
*/
public SequenceFetcher()
{
- this(true);
- }
-
- public SequenceFetcher(boolean addDas)
- {
addDBRefSourceImpl(EnsemblGene.class);
addDBRefSourceImpl(EnsemblGenomes.class);
addDBRefSourceImpl(EmblSource.class);
addDBRefSourceImpl(PfamFull.class);
addDBRefSourceImpl(PfamSeed.class);
addDBRefSourceImpl(RfamSeed.class);
-
- if (addDas)
- {
- registerDasSequenceSources();
- }
}
/**
- * return an ordered list of database sources where non-das database classes
- * appear before das database classes
+ * return an ordered list of database sources excluding alignment only databases
*/
public String[] getOrderedSupportedSources()
{
String[] srcs = this.getSupportedDb();
- ArrayList<String> dassrc = new ArrayList<String>(),
- nondas = new ArrayList<String>();
+ ArrayList<String> src = new ArrayList<>();
+
for (int i = 0; i < srcs.length; i++)
{
- boolean das = false, skip = false;
- String nm;
+ boolean skip = false;
for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
{
// Skip the alignment databases for the moment - they're not useful for
{
skip = true;
}
- else
- {
- nm = dbs.getDbName();
- if (getSourceProxy(
- srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
- {
- if (nm.startsWith("das:"))
- {
- nm = nm.substring(4);
- das = true;
- }
- break;
- }
- }
}
if (skip)
{
continue;
}
- if (das)
{
- dassrc.add(srcs[i]);
- }
- else
- {
- nondas.add(srcs[i]);
+ src.add(srcs[i]);
}
}
- String[] tosort = nondas.toArray(new String[0]),
- sorted = nondas.toArray(new String[0]);
+ String[] tosort = src.toArray(new String[0]),
+ sorted = src.toArray(new String[0]);
for (int j = 0, jSize = sorted.length; j < jSize; j++)
{
tosort[j] = tosort[j].toLowerCase();
}
jalview.util.QuickSort.sort(tosort, sorted);
// construct array with all sources listed
-
- srcs = new String[sorted.length + dassrc.size()];
int i = 0;
for (int j = sorted.length - 1; j >= 0; j--, i++)
{
srcs[i] = sorted[j];
- sorted[j] = null;
- }
-
- sorted = dassrc.toArray(new String[0]);
- tosort = dassrc.toArray(new String[0]);
- for (int j = 0, jSize = sorted.length; j < jSize; j++)
- {
- tosort[j] = tosort[j].toLowerCase();
- }
- jalview.util.QuickSort.sort(tosort, sorted);
- for (int j = sorted.length - 1; j >= 0; j--, i++)
- {
- srcs[i] = sorted[j];
}
return srcs;
}
-
- /**
- * query the currently defined DAS source registry for sequence sources and
- * add a DasSequenceSource instance for each source to the SequenceFetcher
- * source list.
- */
- public void registerDasSequenceSources()
- {
- // TODO: define a context as a registry provider (either desktop,
- // jalview.bin.cache, or something else).
- for (jalviewSourceI source : jalview.bin.Cache.getDasSourceRegistry()
- .getSources())
- {
- if (source.isSequenceSource())
- {
- List<DbSourceProxy> dassources = source.getSequenceSourceProxies();
- for (DbSourceProxy seqsrc : dassources)
- {
- addDbRefSourceImpl(seqsrc);
- }
- }
- }
- }
-
}
import jalview.ws.jws2.dm.AAConSettings;
import jalview.ws.jws2.dm.JabaWsParamSet;
import jalview.ws.jws2.jabaws2.Jws2Instance;
-import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.WsParamSetI;
import jalview.ws.uimodel.AlignAnalysisUIText;
}
WsJobParameters jobParams = (preset == null && paramset != null
&& paramset.size() > 0)
- ? new WsJobParameters((ParamDatastoreI) null, sh,
- (WsParamSetI) null,
- paramset)
- : new WsJobParameters((ParamDatastoreI) null, sh,
- preset,
- (List<Argument>) null);
+ ? new WsJobParameters(null, sh, null, paramset)
+ : new WsJobParameters(sh, preset);
if (adjustingExisting)
{
jobParams.setName(MessageManager
}
if (!jobParams.showRunDialog())
{
- return false; // dialog cancelled
+ return false;
}
-
WsParamSetI prset = jobParams.getPreset();
if (prset == null)
{
/**
* input
*/
- ArrayList<compbio.data.sequence.FastaSequence> seqs = new ArrayList<>();
+ ArrayList<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
/**
* output
compbio.data.sequence.FastaSequence seq;
for (int i = 0, n = 0; i < seqs.length; i++)
{
+
String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same
// for
// any
public List<Argument> getJabaArguments()
{
- List<Argument> newargs = new ArrayList<>();
+ List<Argument> newargs = new ArrayList<Argument>();
if (preset != null && preset instanceof JabaWsParamSet)
{
newargs.addAll(((JabaWsParamSet) preset).getjabaArguments());
void displayResults(boolean newFrame)
{
// view input or result data for each block
- List<AlignmentOrder> alorders = new ArrayList<>();
+ List<AlignmentOrder> alorders = new ArrayList<AlignmentOrder>();
SequenceI[][] results = new SequenceI[jobs.length][];
AlignmentOrder[] orders = new AlignmentOrder[jobs.length];
String lastProgram = null;
if (newFrame)
{
displayInNewFrame(al, alorders, hidden);
+
}
else
{
else
{
// construct a non-redundant ordering set
- List<String> names = new ArrayList<>();
+ List<String> names = new ArrayList<String>();
for (int i = 0, l = alorders.size(); i < l; i++)
{
String orderName = " Region " + i;
return opt;
}
- @Override
- public List<String> getDisplayNames()
- {
- return null; // not supported for Jaba options
- }
-
}
public interface OptionI extends ArgumentI
{
- /**
- * Answers a URL with further details for this option, or null if none is
- * known
- *
- * @return
- */
+
URL getFurtherDetails();
- /**
- * Answers true if the option is mandatory (a value must be chosen), false if
- * it is optional
- *
- * @return
- */
boolean isRequired();
- /**
- * Answers the description of the option
- *
- * @return
- */
String getDescription();
- /**
- * Answers a list of possible values that may be chosen for the option (or
- * null if not applicable)
- *
- * @return
- */
List<String> getPossibleValues();
- /**
- * Answers a list of display names corresponding to the possible values that
- * may be chosen for the option (or null if not applicable)
- *
- * @return
- */
- List<String> getDisplayNames();
-
- /**
- * Answers a new Option with a copy of the settings of this one
- *
- * @return
- */
OptionI copy();
+
}
public enum ValueType
{
- Integer, Float, String, Double, File
+ Integer, Float, String
};
ValueType getType();
*/
package jalview.ws.params.simple;
+import jalview.ws.params.OptionI;
+
import java.net.URL;
import java.util.Arrays;
-public class BooleanOption extends Option
+public class BooleanOption extends Option implements OptionI
{
public BooleanOption(String name, String descr, boolean required,
boolean defVal, boolean val, URL link)
{
- super(name, descr, required, (defVal ? name : null),
- (val ? name : null),
- Arrays.asList(name), link);
+
+ super(name, descr, required, (defVal ? name : ""), (val ? name : ""),
+ Arrays.asList(new String[]
+ { name }), link);
}
}
{
int defval;
- int min;
+ int min, max;
- int max;
-
- @Override
public ValueConstrainI getValidValue()
{
return new ValueConstrainI()
@Override
public Number getMin()
{
- return min < max ? min : null;
+ if (min < max)
+ {
+ return min;
+ }
+ else
+ {
+ return null;
+ }
}
@Override
public Number getMax()
{
- return min < max ? max : null;
+ if (min < max)
+ {
+ return max;
+ }
+ else
+ {
+ return null;
+ }
}
};
}
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
public class Option implements OptionI
{
- String name;
- /*
- * current value in string format, or "null" if undefined
- */
- String value;
+ String name, value, defvalue, description;
- /*
- * default value in string format, or "null" if undefined
- */
- String defvalue;
-
- String description;
-
- List<String> possibleVals;
-
- /*
- * optional display names corresponding to possibleVals
- */
- List<String> displayVals;
+ ArrayList<String> possibleVals = new ArrayList<String>();
boolean required;
URL fdetails;
- /**
- * Copy constructor
- *
- * @param opt
- */
- public Option(Option opt)
- {
- name = opt.name;
- value = opt.value;
- defvalue = opt.defvalue;
- description = opt.description;
- if (opt.possibleVals != null)
- {
- possibleVals = new ArrayList<>(opt.possibleVals);
- }
- required = opt.required;
- // URLs are singletons - so we copy by reference. nasty but true.
- fdetails = opt.fdetails;
- }
-
- public Option()
- {
- }
-
- /**
- * Constructor including display names for possible values
- *
- * @param name2
- * @param description2
- * @param isrequired
- * @param defValue
- * @param val
- * @param possibleVals
- * @param fdetails
- */
- public Option(String name2, String description2, boolean isrequired,
- String defValue, String val, List<String> possibleVals,
- List<String> displayNames, URL fdetails)
- {
- name = name2;
- description = description2;
- this.value = val;
- this.required = isrequired;
- this.defvalue = defValue;
- if (possibleVals != null)
- {
- this.possibleVals = new ArrayList<>(possibleVals);
- }
- if (displayNames != null)
- {
- this.displayVals = new ArrayList<>(displayNames);
- }
- this.fdetails = fdetails;
- }
-
- /**
- * Constructor
- *
- * @param name2
- * @param description2
- * @param isrequired
- * @param defValue
- * @param val
- * @param possibleVals
- * @param fdetails
- */
- public Option(String name2, String description2, boolean isrequired,
- String defValue, String val, List<String> possibleVals,
- URL fdetails)
- {
- this(name2, description2, isrequired, defValue, val, possibleVals, null,
- fdetails);
- }
-
- @Override
- public OptionI copy()
- {
- Option opt = new Option(this);
- return opt;
- }
-
- /**
- * toString method to help identify options in the debugger only
- */
- @Override
- public String toString()
- {
- return this.getClass().getName() + ":" + name;
- }
-
@Override
public String getName()
{
return possibleVals;
}
+ public Option(Option opt)
+ {
+ name = new String(opt.name);
+ if (opt.value != null)
+ value = new String(opt.value);
+ if (opt.defvalue != null)
+ defvalue = new String(opt.defvalue);
+ if (opt.description != null)
+ description = new String(opt.description);
+ if (opt.possibleVals != null)
+ {
+ possibleVals = (ArrayList<String>) opt.possibleVals.clone();
+ }
+ required = opt.required;
+ // URLs are singletons - so we copy by reference. nasty but true.
+ fdetails = opt.fdetails;
+ }
+
+ public Option()
+ {
+ }
+
+ public Option(String name2, String description2, boolean isrequired,
+ String defValue, String value, Collection<String> possibleVals,
+ URL fdetails)
+ {
+ name = name2;
+ description = description2;
+ this.value = value;
+ this.required = isrequired;
+ this.defvalue = defValue;
+ if (possibleVals != null)
+ {
+ this.possibleVals = new ArrayList<String>();
+ this.possibleVals.addAll(possibleVals);
+ }
+ this.fdetails = fdetails;
+ }
+
@Override
- public List<String> getDisplayNames()
+ public OptionI copy()
{
- return displayVals;
+ Option opt = new Option(this);
+ return opt;
}
}
*/
package jalview.ws.params.simple;
-import java.util.List;
-
-/**
- * A parameter with options intended to be rendered as radio buttons
- */
public class StringChoiceParameter extends Option
{
- /**
- * Constructor
- *
- * @param name
- * @param description
- * @param options
- * @param def
- */
- public StringChoiceParameter(String name, String description,
- List<String> options, String def)
- {
- super(name, description, true, def, def, options, null);
- }
}
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
{
NUC, PROT, MIX;
- public static List<String> toStringValues()
+ public static Collection<String> toStringValues()
{
- List<String> c = new ArrayList<>();
+ Collection<String> c = new ArrayList<String>();
for (molType type : values())
{
c.add(type.toString());
public int max = 0; // unbounded
- protected List<Class> inputData = new ArrayList<>();
+ protected ArrayList<Class> inputData = new ArrayList<Class>();
/**
* initialise the InputType with a list of jalview data classes that the
public boolean validFor(RestJob restJob)
{
if (!validFor(restJob.rsd))
- {
return false;
- }
for (Class cl : inputData)
{
if (!restJob.hasDataOfType(cl))
public boolean validFor(RestServiceDescription restServiceDescription)
{
if (!restServiceDescription.inputParams.values().contains(this))
- {
return false;
- }
return true;
}
public List<OptionI> getBaseOptions()
{
- ArrayList<OptionI> opts = new ArrayList<>();
+ ArrayList<OptionI> opts = new ArrayList<OptionI>();
opts.add(new IntegerParameter("min",
"Minimum number of data of this type", true, 1, min, 0, -1));
opts.add(new IntegerParameter("max",
public void configureFromArgumentI(List<ArgumentI> currentSettings)
throws InvalidArgumentException
{
- List<String> urltoks = new ArrayList<>();
+ ArrayList<String> urltoks = new ArrayList<String>();
String rg;
for (ArgumentI arg : currentSettings)
{
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
-import jalview.datamodel.HiddenMarkovModel;
-import jalview.datamodel.Profile;
import jalview.datamodel.ProfileI;
-import jalview.datamodel.Profiles;
import jalview.datamodel.ProfilesI;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.gui.JvOptionPane;
-import jalview.io.DataSourceType;
-import jalview.io.FileParse;
-import jalview.io.HMMFile;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class AAFrequencyTest
{
- HiddenMarkovModel hmm;
@BeforeClass(alwaysRun = true)
public void setUpJvOptionPane()
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
- @BeforeClass(alwaysRun = true)
- public void setUp() throws IOException, MalformedURLException
- {
- /*
- * load a dna (ACGT) HMM file to a HiddenMarkovModel
- */
- HMMFile hmmFile = new HMMFile(new FileParse(
- "test/jalview/io/test_MADE1_hmm.txt", DataSourceType.FILE));
- hmm = hmmFile.getHMM();
- }
-
@Test(groups = { "Functional" })
public void testCalculate_noProfile()
{
assertEquals("T 75%", ann.description);
assertEquals("T", ann.displayCharacter);
}
-
- @Test(groups = { "Functional" })
- public void testExtractHMMProfile()
- throws MalformedURLException, IOException
- {
- int[] expected = { 0, 4, 100, 'T', 71, 'C', 12, 'G', 9, 'A', 9 };
- int[] actual = AAFrequency.extractHMMProfile(hmm, 17, false, false);
- for (int i = 0; i < actual.length; i++)
- {
- if (i == 2)
- {
- assertEquals(actual[i], expected[i]);
- }
- else
- {
- assertEquals(actual[i], expected[i]);
- }
- }
-
- int[] expected2 = { 0, 4, 100, 'A', 85, 'C', 0, 'G', 0, 'T', 0 };
- int[] actual2 = AAFrequency.extractHMMProfile(hmm, 2, true, false);
- for (int i = 0; i < actual2.length; i++)
- {
- if (i == 2)
- {
- assertEquals(actual[i], expected[i]);
- }
- else
- {
- assertEquals(actual[i], expected[i]);
- }
- }
-
- assertNull(AAFrequency.extractHMMProfile(null, 98978867, true, false));
- }
-
- @Test(groups = { "Functional" })
- public void testGetAnalogueCount()
- {
- /*
- * 'T' in column 0 has emission probability 0.7859, scales to 7859
- */
- int count = AAFrequency.getAnalogueCount(hmm, 0, 'T', false, false);
- assertEquals(7859, count);
-
- /*
- * same with 'use info height': value is multiplied by log ratio
- * log(value / background) / log(2) = log(0.7859/0.25)/0.693
- * = log(3.1)/0.693 = 1.145/0.693 = 1.66
- * so value becomes 1.2987 and scales up to 12987
- */
- count = AAFrequency.getAnalogueCount(hmm, 0, 'T', false, true);
- assertEquals(12987, count);
-
- /*
- * 'G' in column 20 has emission probability 0.75457, scales to 7546
- */
- count = AAFrequency.getAnalogueCount(hmm, 20, 'G', false, false);
- assertEquals(7546, count);
-
- /*
- * 'G' in column 1077 has emission probability 0.0533, here
- * ignored (set to 0) since below background of 0.25
- */
- count = AAFrequency.getAnalogueCount(hmm, 1077, 'G', true, false);
- assertEquals(0, count);
- }
-
- @Test(groups = { "Functional" })
- public void testCompleteInformation()
- {
- ProfileI prof1 = new Profile(1, 0, 100, "A");
- ProfileI prof2 = new Profile(1, 0, 100, "-");
-
- ProfilesI profs = new Profiles(new ProfileI[] { prof1, prof2 });
- Annotation ann1 = new Annotation(6.5f);
- Annotation ann2 = new Annotation(0f);
- Annotation[] annots = new Annotation[] { ann1, ann2 };
- SequenceI seq = new Sequence("", "AA", 0, 0);
- seq.setHMM(hmm);
- AlignmentAnnotation annot = new AlignmentAnnotation("", "", annots);
- annot.setSequenceRef(seq);
- AAFrequency.completeInformation(annot, profs, 0, 1);
- float ic = annot.annotations[0].value;
- assertEquals(0.91532f, ic, 0.0001f);
- ic = annot.annotations[1].value;
- assertEquals(0f, ic, 0.0001f);
- int i = 0;
- }
-
}
assertEquals(2, toMap.getFromRanges().get(0).length);
assertEquals(1, toMap.getFromRanges().get(0)[0]);
assertEquals(12, toMap.getFromRanges().get(0)[1]);
- assertEquals(1, toMap.getToRanges().size());
- assertEquals(4, toMap.getToRanges().get(0).length);
+ assertEquals(2, toMap.getToRanges().size());
+ assertEquals(2, toMap.getToRanges().get(0).length);
assertEquals(158, toMap.getToRanges().get(0)[0]);
assertEquals(164, toMap.getToRanges().get(0)[1]);
- assertEquals(210, toMap.getToRanges().get(0)[2]);
- assertEquals(214, toMap.getToRanges().get(0)[3]);
+ assertEquals(210, toMap.getToRanges().get(1)[0]);
+ assertEquals(214, toMap.getToRanges().get(1)[1]);
// or summarised as (but toString might change in future):
- assertEquals("[ [1, 12] ] 1:1 to [ [158, 164, 210, 214] ]",
+ assertEquals("[ [1, 12] ] 1:1 to [ [158, 164] [210, 214] ]",
toMap.toString());
/*
assertEquals("GRCh38", toLoci.getAssemblyId());
assertEquals("7", toLoci.getChromosomeId());
toMap = toLoci.getMap();
- assertEquals("[ [1, 12] ] 1:1 to [ [158, 164, 210, 214] ]",
+ assertEquals("[ [1, 12] ] 1:1 to [ [158, 164] [210, 214] ]",
toMap.toString());
}
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
- SequenceFetcher mockFetcher = new SequenceFetcher(false)
+ SequenceFetcher mockFetcher = new SequenceFetcher()
{
@Override
public boolean isFetchable(String source)
* argument false suppresses adding DAS sources
* todo: define an interface type SequenceFetcherI and mock that
*/
- SequenceFetcher mockFetcher = new SequenceFetcher(false)
+ SequenceFetcher mockFetcher = new SequenceFetcher()
{
@Override
public boolean isFetchable(String source)
* passed in calls to getSequences() - important to verify that
* duplicate sequence fetches are not requested
*/
- SequenceFetcher mockFetcher = new SequenceFetcher(false)
+ SequenceFetcher mockFetcher = new SequenceFetcher()
{
int call = 0;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.api.AlignViewportI;
import jalview.api.analysis.ScoreModelI;
import jalview.api.analysis.SimilarityParamsI;
import jalview.datamodel.Alignment;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.JvOptionPane;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
public void testFindDistances_withParams()
{
AlignFrame af = setupAlignmentView();
- AlignViewportI viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
AlignmentView view = viewport.getAlignmentView(false);
ScoreModelI sm = new FeatureDistanceModel();
"Temperature Factor", null, false, seq, null);
assertNotNull(ala);
assertEquals(seq, ala.sequenceRef);
- assertEquals("", ala.getCalcId());
+ assertEquals("", ala.calcId);
}
@Test(groups = "Functional")
import static org.testng.Assert.assertEquals;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.JvOptionPane;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
-import jalview.viewmodel.AlignmentViewport;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
">s1\n0123456789\n", DataSourceType.PASTE);
- AlignmentViewport av = af.getViewport();
+ AlignViewport av = af.getViewport();
AlignmentView view = av.getAlignmentView(true);
/*
import jalview.gui.AlignViewport;
import jalview.gui.JvOptionPane;
-import jalview.viewmodel.AlignmentViewport;
import java.util.List;
* represent seqs 2-4 with seq3
* this hides seq2 and seq4 but not seq3
*/
- AlignmentViewport av = new AlignViewport(al);
+ AlignViewport av = new AlignViewport(al);
SequenceGroup sg = new SequenceGroup();
sg.addSequence(seqs[1], false);
sg.addSequence(seqs[2], false);
import jalview.datamodel.ResidueCount.SymbolCounts;
import jalview.gui.JvOptionPane;
-import java.util.Arrays;
-
import org.junit.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
assertEquals(rc.getCount('N'), 1);
assertEquals(rc.getCount('?'), 0);
assertEquals(rc.getCount('-'), 0);
- assertEquals(rc.getTotalResidueCount(), 11);
assertFalse(rc.isCountingInts());
assertFalse(rc.isUsingOtherData());
assertEquals(rc.getCount(' '), 4);
assertEquals(rc.getCount('-'), 4);
assertEquals(rc.getCount('.'), 4);
- assertEquals(rc.getTotalResidueCount(), 0);
assertFalse(rc.isUsingOtherData());
assertFalse(rc.isCountingInts());
}
assertEquals(rc.getCount('m'), 13);
assertEquals(rc.getCount('G'), 0);
assertEquals(rc.getCount('-'), 0);
- assertEquals(rc.getTotalResidueCount(), 27);
assertFalse(rc.isCountingInts());
assertFalse(rc.isUsingOtherData());
assertEquals(rc.getCount('?'), 6);
assertEquals(rc.getCount('!'), 7);
}
-
- @Test(groups = "Functional")
- public void testConstructor_forSequences()
- {
- SequenceI seq1 = new Sequence("seq1", "abcde--. FCD");
- SequenceI seq2 = new Sequence("seq2", "ab.kKqBd-.");
- ResidueCount rc = new ResidueCount(Arrays.asList(seq1, seq2));
-
- assertEquals(rc.getGapCount(), 7);
- assertEquals(rc.getTotalResidueCount(), 15); // excludes gaps
- assertEquals(rc.getCount('a'), 2);
- assertEquals(rc.getCount('A'), 2);
- assertEquals(rc.getCount('B'), 3);
- assertEquals(rc.getCount('c'), 2);
- assertEquals(rc.getCount('D'), 3);
- assertEquals(rc.getCount('f'), 1);
- assertEquals(rc.getCount('K'), 2);
- assertEquals(rc.getCount('Q'), 1);
- }
}
import java.awt.Color;
import java.util.Collections;
-import org.testng.annotations.Test;
-
import junit.extensions.PA;
+import org.testng.annotations.Test;
+
public class SequenceGroupTest
{
@Test(groups={"Functional"})
sg.setDisplayBoxes(false);
sg.setDisplayText(false);
sg.setColourText(true);
- PA.setValue(sg, "isDefined", true);
+ sg.isDefined = true;
sg.setShowNonconserved(true);
sg.setOutlineColour(Color.red);
sg.setIdColour(Color.blue);
assertEquals(sg2.thresholdTextColour, sg.thresholdTextColour);
assertEquals(sg2.textColour, sg.textColour);
assertEquals(sg2.textColour2, sg.textColour2);
- assertEquals(sg2.isIgnoreGapsConsensus(), sg.isIgnoreGapsConsensus());
+ assertEquals(sg2.getIgnoreGapsConsensus(), sg.getIgnoreGapsConsensus());
assertEquals(sg2.isShowSequenceLogo(), sg.isShowSequenceLogo());
assertEquals(sg2.isNormaliseSequenceLogo(),
sg.isNormaliseSequenceLogo());
assertNull(fa.getMinMax("Pfam", "kd"));
sf.setValue("domain", "xyz");
assertNull(fa.getMinMax("Pfam", "kd"));
- sf.setValue("kd", "some text");
- assertNull(fa.getMinMax("Pfam", "kd"));
sf.setValue("kd", "1.3");
assertEquals(fa.getMinMax("Pfam", "kd"), new float[] { 1.3f, 1.3f });
sf.setValue("kd", "-2.6");
assertEquals(fa.getMinMax("Pfam", "kd"), new float[] { -2.6f, 1.3f });
+ // setting 'mixed' character and numeric values wipes the min/max value
+ sf.setValue("kd", "some text");
+ assertNull(fa.getMinMax("Pfam", "kd"));
+
Map<String, String> csq = new HashMap<>();
csq.put("AF", "-3");
sf.setValue("CSQ", csq);
import java.util.Map;
import java.util.Set;
-import junit.extensions.PA;
-
import org.testng.annotations.Test;
+import junit.extensions.PA;
+
public class SequenceFeaturesTest
{
@Test(groups = "Functional")
assertTrue(store.getFeaturesByOntology(new String[] {}).isEmpty());
assertTrue(store.getFeaturesByOntology((String[]) null).isEmpty());
- SequenceFeature sf1 = new SequenceFeature("transcript", "desc", 10, 20,
+ SequenceFeature transcriptFeature = new SequenceFeature("transcript", "desc", 10, 20,
Float.NaN, null);
- store.add(sf1);
+ store.add(transcriptFeature);
- // mRNA isA transcript; added here 'as if' non-positional
- // just to show that non-positional features are included in results
- SequenceFeature sf2 = new SequenceFeature("mRNA", "desc", 0, 0,
+ /*
+ * mRNA is a sub-type of transcript; added here 'as if' non-positional
+ * just to show that non-positional features are included in results
+ */
+ SequenceFeature mrnaFeature = new SequenceFeature("mRNA", "desc", 0, 0,
Float.NaN, null);
- store.add(sf2);
+ store.add(mrnaFeature);
- SequenceFeature sf3 = new SequenceFeature("Pfam", "desc", 30, 40,
+ SequenceFeature pfamFeature = new SequenceFeature("Pfam", "desc", 30, 40,
Float.NaN, null);
- store.add(sf3);
+ store.add(pfamFeature);
+ /*
+ * "transcript" matches both itself and the sub-term "mRNA"
+ */
features = store.getFeaturesByOntology("transcript");
assertEquals(features.size(), 2);
- assertTrue(features.contains(sf1));
- assertTrue(features.contains(sf2));
+ assertTrue(features.contains(transcriptFeature));
+ assertTrue(features.contains(mrnaFeature));
+ /*
+ * "mRNA" matches itself but not parent term "transcript"
+ */
features = store.getFeaturesByOntology("mRNA");
assertEquals(features.size(), 1);
- assertTrue(features.contains(sf2));
+ assertTrue(features.contains(mrnaFeature));
+ /*
+ * "pfam" is not an SO term but is included as an exact match
+ */
features = store.getFeaturesByOntology("mRNA", "Pfam");
assertEquals(features.size(), 2);
- assertTrue(features.contains(sf2));
- assertTrue(features.contains(sf3));
+ assertTrue(features.contains(mrnaFeature));
+ assertTrue(features.contains(pfamFeature));
features = store.getFeaturesByOntology("sequence_variant");
assertTrue(features.isEmpty());
@Test(groups = "Functional")
public void testSortFeatures()
{
- List<SequenceFeature> sfs = new ArrayList<SequenceFeature>();
+ List<SequenceFeature> sfs = new ArrayList<>();
SequenceFeature sf1 = new SequenceFeature("Pfam", "desc", 30, 80,
Float.NaN, null);
sfs.add(sf1);
import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
* accession id as parent
*/
@Test(groups = "Functional")
- public void testIdentifiesSequence()
+ public void testGetIdentifyingFeatures()
{
String accId = "ABC123";
- EnsemblCdna testee = new EnsemblCdna();
+ SequenceI seq = new Sequence(accId, "MKLNFRQIE");
- // exon with no parent not valid
- SequenceFeature sf = new SequenceFeature("exon", "", 1, 2, 0f, null);
- assertFalse(testee.identifiesSequence(sf, accId));
+ // exon with no parent: not valid
+ SequenceFeature sf1 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ seq.addSequenceFeature(sf1);
- // exon with wrong parent not valid
- sf.setValue("Parent", "transcript:XYZ");
- assertFalse(testee.identifiesSequence(sf, accId));
+ // exon with wrong parent: not valid
+ SequenceFeature sf2 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ sf2.setValue("Parent", "transcript:XYZ");
+ seq.addSequenceFeature(sf2);
// exon with right parent is valid
- sf.setValue("Parent", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf3 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ sf3.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf3);
// exon sub-type with right parent is valid
- sf = new SequenceFeature("coding_exon", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf4 = new SequenceFeature("coding_exon", "", 1, 2, 0f,
+ null);
+ sf4.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf4);
// transcript not valid:
- sf = new SequenceFeature("transcript", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f,
+ null);
+ sf5.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf5);
// CDS not valid:
- sf = new SequenceFeature("CDS", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf6 = new SequenceFeature("transcript", "", 1, 2, 0f,
+ null);
+ sf6.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf6);
+
+ List<SequenceFeature> sfs = new EnsemblCdna()
+ .getIdentifyingFeatures(seq, accId);
+ assertFalse(sfs.contains(sf1));
+ assertFalse(sfs.contains(sf2));
+ assertTrue(sfs.contains(sf3));
+ assertTrue(sfs.contains(sf4));
+ assertFalse(sfs.contains(sf5));
+ assertFalse(sfs.contains(sf6));
}
@Test(groups = "Functional")
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
* accession id as parent
*/
@Test(groups = "Functional")
- public void testIdentifiesSequence()
+ public void testGetIdentifyingFeatures()
{
String accId = "ABC123";
- EnsemblCds testee = new EnsemblCds();
+ SequenceI seq = new Sequence(accId, "MKDONS");
// cds with no parent not valid
- SequenceFeature sf = new SequenceFeature("CDS", "", 1, 2, 0f, null);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf1 = new SequenceFeature("CDS", "", 1, 2, 0f, null);
+ seq.addSequenceFeature(sf1);
// cds with wrong parent not valid
- sf.setValue("Parent", "transcript:XYZ");
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf2 = new SequenceFeature("CDS", "", 1, 2, 0f, null);
+ sf2.setValue("Parent", "transcript:XYZ");
+ seq.addSequenceFeature(sf2);
// cds with right parent is valid
- sf.setValue("Parent", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf3 = new SequenceFeature("CDS", "", 1, 2, 0f, null);
+ sf3.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf3);
// cds sub-type with right parent is valid
- sf = new SequenceFeature("CDS_predicted", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf4 = new SequenceFeature("CDS_predicted", "", 1, 2, 0f,
+ null);
+ sf4.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf4);
// transcript not valid:
- sf = new SequenceFeature("transcript", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f,
+ null);
+ sf5.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf5);
// exon not valid:
- sf = new SequenceFeature("exon", "", 1, 2, 0f, null);
- sf.setValue("Parent", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf6 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ sf6.setValue("Parent", "transcript:" + accId);
+ seq.addSequenceFeature(sf6);
+
+ List<SequenceFeature> sfs = new EnsemblCds().getIdentifyingFeatures(seq,
+ accId);
+ assertFalse(sfs.contains(sf1));
+ assertFalse(sfs.contains(sf2));
+ assertTrue(sfs.contains(sf3));
+ assertTrue(sfs.contains(sf4));
+ assertFalse(sfs.contains(sf5));
+ assertFalse(sfs.contains(sf6));
}
@Test(groups = "Functional")
import jalview.api.FeatureSettingsModelI;
import jalview.bin.Cache;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
genomic.setEnd(50000);
String geneId = "ABC123";
- // gene at (start+20000) length 501
- // should be ignored - the first 'gene' found defines the whole range
- // (note features are found in position order, not addition order)
- SequenceFeature sf = new SequenceFeature("gene", "", 20000, 20500, 0f,
- null);
- sf.setValue("ID", "gene:" + geneId);
- sf.setStrand("+");
- genomic.addSequenceFeature(sf);
-
// gene at (start + 10500) length 101
- sf = new SequenceFeature("gene", "", 10500, 10600, 0f, null);
+ SequenceFeature sf = new SequenceFeature("gene", "", 10500, 10600, 0f,
+ null);
sf.setValue("ID", "gene:" + geneId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
genomic.setEnd(50000);
String geneId = "ABC123";
- // gene at (start+20000) length 501
- // should be ignored - the first 'gene' found defines the whole range
- // (real data would only have one such feature)
- SequenceFeature sf = new SequenceFeature("ncRNA_gene", "", 20000,
- 20500, 0f, null);
- sf.setValue("ID", "gene:" + geneId);
- sf.setStrand("-");
- genomic.addSequenceFeature(sf);
-
// gene at (start + 10500) length 101
- sf = new SequenceFeature("gene", "", 10500, 10600, 0f, null);
+ SequenceFeature sf = new SequenceFeature("gene", "", 10500, 10600, 0f,
+ null);
sf.setValue("ID", "gene:" + geneId);
sf.setStrand("+");
genomic.addSequenceFeature(sf);
* accession id as ID
*/
@Test(groups = "Functional")
- public void testIdentifiesSequence()
+ public void testGetIdentifyingFeatures()
{
String accId = "ABC123";
- EnsemblGene testee = new EnsemblGene();
+ SequenceI seq = new Sequence(accId, "HIBEES");
// gene with no ID not valid
- SequenceFeature sf = new SequenceFeature("gene", "", 1, 2, 0f, null);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf1 = new SequenceFeature("gene", "", 1, 2, 0f, null);
+ seq.addSequenceFeature(sf1);
// gene with wrong ID not valid
- sf.setValue("ID", "gene:XYZ");
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf2 = new SequenceFeature("gene", "", 1, 2, 0f, null);
+ sf2.setValue("ID", "gene:XYZ");
+ seq.addSequenceFeature(sf2);
// gene with right ID is valid
- sf.setValue("ID", "gene:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf3 = new SequenceFeature("gene", "", 1, 2, 0f, null);
+ sf3.setValue("ID", "gene:" + accId);
+ seq.addSequenceFeature(sf3);
// gene sub-type with right ID is valid
- sf = new SequenceFeature("snRNA_gene", "", 1, 2, 0f, null);
- sf.setValue("ID", "gene:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
-
- // test is not case-sensitive
- assertTrue(testee.identifiesSequence(sf, accId.toLowerCase()));
+ SequenceFeature sf4 = new SequenceFeature("snRNA_gene", "", 1, 2, 0f, null);
+ sf4.setValue("ID", "gene:" + accId);
+ seq.addSequenceFeature(sf4);
// transcript not valid:
- sf = new SequenceFeature("transcript", "", 1, 2, 0f, null);
- sf.setValue("ID", "gene:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf5 = new SequenceFeature("transcript", "", 1, 2, 0f, null);
+ sf5.setValue("ID", "gene:" + accId);
+ seq.addSequenceFeature(sf5);
// exon not valid:
- sf = new SequenceFeature("exon", "", 1, 2, 0f, null);
- sf.setValue("ID", "gene:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf6 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ sf6.setValue("ID", "gene:" + accId);
+ seq.addSequenceFeature(sf6);
+
+ List<SequenceFeature> sfs = new EnsemblGene()
+ .getIdentifyingFeatures(seq, accId);
+ assertFalse(sfs.contains(sf1));
+ assertFalse(sfs.contains(sf2));
+ assertTrue(sfs.contains(sf3));
+ assertTrue(sfs.contains(sf4));
+ assertFalse(sfs.contains(sf5));
+ assertFalse(sfs.contains(sf6));
}
/**
import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertTrue;
+import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
* accession id as ID
*/
@Test(groups = "Functional")
- public void testIdentifiesSequence()
+ public void testGetIdentifyingFeatures()
{
String accId = "ABC123";
- EnsemblGenome testee = new EnsemblGenome();
+ SequenceI seq = new Sequence(accId, "HEARTS");
// transcript with no ID not valid
- SequenceFeature sf = new SequenceFeature("transcript", "", 1, 2, 0f,
+ SequenceFeature sf1 = new SequenceFeature("transcript", "", 1, 2, 0f,
null);
- assertFalse(testee.identifiesSequence(sf, accId));
+ seq.addSequenceFeature(sf1);
// transcript with wrong ID not valid
- sf.setValue("ID", "transcript");
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf2 = new SequenceFeature("transcript", "", 1, 2, 0f,
+ null);
+ sf2.setValue("ID", "transcript");
+ seq.addSequenceFeature(sf2);
// transcript with right ID is valid
- sf.setValue("ID", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf3 = new SequenceFeature("transcript", "", 1, 2, 0f,
+ null);
+ sf3.setValue("ID", "transcript:" + accId);
+ seq.addSequenceFeature(sf3);
// transcript sub-type with right ID is valid
- sf = new SequenceFeature("ncRNA", "", 1, 2, 0f, null);
- sf.setValue("ID", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf4 = new SequenceFeature("ncRNA", "", 1, 2, 0f, null);
+ sf4.setValue("ID", "transcript:" + accId);
+ seq.addSequenceFeature(sf4);
// Ensembl treats NMD_transcript_variant as if a transcript
- sf = new SequenceFeature("NMD_transcript_variant", "", 1, 2, 0f, null);
- sf.setValue("ID", "transcript:" + accId);
- assertTrue(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf5 = new SequenceFeature("NMD_transcript_variant", "",
+ 1, 2, 0f, null);
+ sf5.setValue("ID", "transcript:" + accId);
+ seq.addSequenceFeature(sf5);
// gene not valid:
- sf = new SequenceFeature("gene", "", 1, 2, 0f, null);
- sf.setValue("ID", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf6 = new SequenceFeature("gene", "", 1, 2, 0f, null);
+ sf6.setValue("ID", "transcript:" + accId);
+ seq.addSequenceFeature(sf6);
// exon not valid:
- sf = new SequenceFeature("exon", "", 1, 2, 0f, null);
- sf.setValue("ID", "transcript:" + accId);
- assertFalse(testee.identifiesSequence(sf, accId));
+ SequenceFeature sf7 = new SequenceFeature("exon", "", 1, 2, 0f, null);
+ sf7.setValue("ID", "transcript:" + accId);
+ seq.addSequenceFeature(sf7);
+
+ List<SequenceFeature> sfs = new EnsemblGenome()
+ .getIdentifyingFeatures(seq, accId);
+ assertFalse(sfs.contains(sf1));
+ assertFalse(sfs.contains(sf2));
+ assertTrue(sfs.contains(sf3));
+ assertTrue(sfs.contains(sf4));
+ assertTrue(sfs.contains(sf5));
+ assertFalse(sfs.contains(sf6));
+ assertFalse(sfs.contains(sf7));
}
}
{
return false;
}
-
- @Override
- protected String getRequestMimeType(boolean b)
- {
- return null;
- }
-
- @Override
- protected String getResponseMimeType()
- {
- return null;
- }
-
};
}
package jalview.ext.ensembl;
import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+
+import java.util.ArrayList;
+import java.util.List;
/**
* A convenience class to simplify writing unit tests (pending Mockito or
}
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- return false;
+ return new ArrayList<>();
}
}
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertSame;
-import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.datamodel.features.SequenceFeatures;
import jalview.gui.JvOptionPane;
import jalview.io.DataSourceType;
import jalview.io.FastaFile;
-import jalview.io.FileParse;
import jalview.io.gff.SequenceOntologyFactory;
import jalview.io.gff.SequenceOntologyLite;
+ "LKKALMMRGLIPECCAVYRIQDGEKKPIGWDTDISWLTGEELHVEVLENVPLTTHNFVRK\n"
+ "TFFTLAFCDFCRKLLFQGFRCQTCGYKFHQRCSTEVPLMCVNYDQLDLLFVSKFFEHHPI\n"
+ "PQEEASLAETALTSGSSPSAPASDSIGPQILTSPSPSKSIPIPQPFRPADEDHRNQFGQR\n"
- + "DRSSSAPNVHINTIEPVNIDDLIRDQGFRGDGGSTTGLSATPPASLPGSLTNVKALQKSP\n"
+ + "DRSSSAPNVHINTIEPVNIDDLIRDQGFRGDG\n"
+ // ? insertion added in ENSP00000288602.11, not in P15056
+ + "APLNQLMRCLRKYQSRTPSPLLHSVPSEIVFDFEPGPVFR\n"
+ // end insertion
+ + "GSTTGLSATPPASLPGSLTNVKALQKSP\n"
+ "GPQRERKSSSSSEDRNRMKTLGRRDSSDDWEIPDGQITVGQRIGSGSFGTVYKGKWHGDV\n"
+ "AVKMLNVTAPTPQQLQAFKNEVGVLRKTRHVNILLFMGYSTKPQLAIVTQWCEGSSLYHH\n"
+ "LHIIETKFEMIKLIDIARQTAQGMDYLHAKSIIHRDLKSNNIFLHEDLTVKIGDFGLATV\n"
}
@Test(dataProvider = "ens_seqs", suiteName = "live")
- public void testGetOneSeqs(EnsemblRestClient proxy, String sq,
+ public void testGetSequenceRecords(EnsemblSeqProxy proxy, String sq,
String fastasq) throws Exception
{
- FileParse fp = proxy.getSequenceReader(Arrays
- .asList(new String[] { sq }));
- SequenceI[] sqs = new FastaFile(fp).getSeqsAsArray();
FastaFile trueRes = new FastaFile(fastasq, DataSourceType.PASTE);
- SequenceI[] trueSqs = trueRes.getSeqsAsArray();
- Assert.assertEquals(sqs.length, trueSqs.length,
+ SequenceI[] expected = trueRes.getSeqsAsArray();
+ AlignmentI retrieved = proxy.getSequenceRecords(sq);
+
+ Assert.assertEquals(retrieved.getHeight(), expected.length,
"Different number of sequences retrieved for query " + sq);
- Alignment ral = new Alignment(sqs);
- for (SequenceI tr : trueSqs)
+
+ for (SequenceI tr : expected)
{
SequenceI[] rseq;
Assert.assertNotNull(
- rseq = ral.findSequenceMatch(tr.getName()),
+ rseq = retrieved.findSequenceMatch(tr.getName()),
"Couldn't find sequences matching expected sequence "
+ tr.getName());
Assert.assertEquals(rseq.length, 1,
"Sequences differ for " + tr.getName() + "\n" + "Exp:"
+ tr.getSequenceAsString() + "\n" + "Got:"
+ rseq[0].getSequenceAsString());
-
}
}
import static org.testng.Assert.assertSame;
import static org.testng.Assert.assertTrue;
-import jalview.api.AlignViewportI;
import jalview.api.FeatureColourI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.schemes.StrandColourScheme;
import jalview.schemes.TurnColourScheme;
import jalview.util.MessageManager;
-import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
import java.util.Iterator;
@Test(groups = "Functional")
public void testChangeColour_background_groupsAndThresholds()
{
- AlignViewportI av = af.getViewport();
+ AlignViewport av = af.getViewport();
AlignmentI al = av.getAlignment();
/*
@Test(groups = "Functional")
public void testColourThresholdActions()
{
- AlignViewportI av = af.getViewport();
+ AlignViewport av = af.getViewport();
AlignmentI al = av.getAlignment();
/*
@Test(groups = "Functional")
public void testNewView_colourThresholds()
{
- AlignViewportI av = af.getViewport();
+ AlignViewport av = af.getViewport();
AlignmentI al = av.getAlignment();
/*
*/
af.newView_actionPerformed(null);
assertEquals(af.alignPanel.getViewName(), "View 1");
- AlignmentViewport av2 = af.getViewport();
+ AlignViewport av2 = af.getViewport();
assertNotSame(av, av2);
assertSame(av2, af.alignPanel.av);
rs = av2.getResidueShading();
import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
-import jalview.api.AlignViewportI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
import jalview.schemes.PIDColourScheme;
import jalview.structure.StructureSelectionManager;
import jalview.util.MapList;
-import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import java.util.ArrayList;
AlignmentI al;
- AlignmentViewport testee;
+ AlignViewport testee;
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
- AlignViewportI av = af.getViewport();
+ AlignViewport av = af.getViewport();
SequenceGroup sg1 = new SequenceGroup();
SequenceGroup sg2 = new SequenceGroup();
SequenceGroup sg3 = new SequenceGroup();
jalview.bin.Cache.setProperty("SHOW_OCCUPANCY", Boolean.FALSE.toString());
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
- AlignViewportI av = af.getViewport();
- Assert.assertNull(av.getOccupancyAnnotation(), "Preference did not disable occupancy row.");
+ AlignViewport av = af.getViewport();
+ Assert.assertNull(av.getAlignmentGapAnnotation(), "Preference did not disable occupancy row.");
int c = 0;
for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null,
null, "Occupancy"))
af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
av = af.getViewport();
- Assert.assertNotNull(av.getOccupancyAnnotation(), "Preference did not enable occupancy row.");
+ Assert.assertNotNull(av.getAlignmentGapAnnotation(), "Preference did not enable occupancy row.");
c = 0;
for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null,
- null, av.getOccupancyAnnotation().label))
+ null, av.getAlignmentGapAnnotation().label))
{
c++;
}
String fasta = ">s1\nA-C\n>s2\nA-C\n>s3\nA-D\n>s4\n--D\n";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta,
DataSourceType.PASTE);
- AlignmentViewport testme = af.getViewport();
+ AlignViewport testme = af.getViewport();
SequenceI cons = testme.getConsensusSeq();
assertEquals("A-C", cons.getSequenceAsString());
}
import static org.testng.Assert.assertEquals;
-import jalview.api.AlignViewportI;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceGroup;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
-import jalview.viewmodel.AlignmentViewport;
import javax.swing.JTextArea;
-import org.testng.annotations.Test;
-
import junit.extensions.PA;
+import org.testng.annotations.Test;
+
public class PairwiseAlignmentPanelTest
{
@Test(groups = "Functional")
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
- AlignViewportI viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
AlignmentI al = viewport.getAlignment();
/*
String seqs = ">Q93XJ9_SOLTU/23-29\nL-KAISNV\n>FER1_PEA/26-32\nV-TTTKAF\n";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs,
DataSourceType.PASTE);
- AlignViewportI viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
PairwiseAlignPanel testee = new PairwiseAlignPanel(viewport);
import static org.testng.Assert.assertEquals;
-import jalview.api.AlignViewportI;
import jalview.bin.Jalview;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
public class SequenceRendererTest
{
AlignmentI al;
- AlignViewportI av;
+ AlignViewport av;
SequenceI seq1;
@Test(groups = "Functional")
public void testGetReadableFormats()
{
- String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]";
+ String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]";
FileFormats formats = FileFormats.getInstance();
assertEquals(formats.getReadableFormats().toString(), expected);
}
@Test(groups = "Functional")
public void testGetWritableFormats()
{
- String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]";
+ String expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]";
FileFormats formats = FileFormats.getInstance();
assertEquals(formats.getWritableFormats(true).toString(), expected);
- expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Jalview, HMMER3]";
+ expected = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Jalview]";
assertEquals(formats.getWritableFormats(false).toString(), expected);
}
@Test(groups = "Functional")
public void testDeregisterFileFormat()
{
- String writable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]";
- String readable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]";
+ String writable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]";
+ String readable = "[Fasta, PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]";
FileFormats formats = FileFormats.getInstance();
assertEquals(formats.getWritableFormats(true).toString(), writable);
assertEquals(formats.getReadableFormats().toString(), readable);
formats.deregisterFileFormat(FileFormat.Fasta.getName());
- writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3]";
- readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3]";
+ writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP]";
+ readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview]";
assertEquals(formats.getWritableFormats(true).toString(), writable);
assertEquals(formats.getReadableFormats().toString(), readable);
* re-register the format: it gets added to the end of the list
*/
formats.registerFileFormat(FileFormat.Fasta);
- writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, HMMER3, Fasta]";
- readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, HMMER3, Fasta]";
+ writable = "[PFAM, Stockholm, PIR, BLC, AMSA, JSON, PileUp, MSF, Clustal, PHYLIP, Fasta]";
+ readable = "[PFAM, Stockholm, PIR, BLC, AMSA, HTML, RNAML, JSON, PileUp, MSF, Clustal, PHYLIP, GFF or Jalview features, PDB, mmCIF, Jalview, Fasta]";
assertEquals(formats.getWritableFormats(true).toString(), writable);
assertEquals(formats.getReadableFormats().toString(), readable);
}
package jalview.io;
-import static org.testng.Assert.assertEquals;
-
-import jalview.bin.Cache;
-
import org.junit.Assert;
import org.testng.annotations.Test;
// Data source type expected to be DataSourceType.URL
Assert.assertEquals(DataSourceType.URL, fileLoader.protocol);
}
-
- @Test(groups = "Functional")
- public void testUpdateRecentlyOpened()
- {
- // ensure properties file is read-only
- Cache.loadProperties("test/jalview/io/testProps.jvprops");
-
- String recent = "RECENT_FILE";
- Cache.removeProperty(recent);
-
- String prop = FileLoader.updateRecentlyOpened("a/b/c",
- DataSourceType.FILE);
- assertEquals(prop, "a/b/c");
-
- prop = FileLoader.updateRecentlyOpened("d/e/f", DataSourceType.FILE);
- assertEquals(prop, "d/e/f\ta/b/c");
-
- // revisiting a file moves it to the top of the list
- prop = FileLoader.updateRecentlyOpened("a/b/c", DataSourceType.FILE);
- assertEquals(prop, "a/b/c\td/e/f");
-
- // history list is limited to the most recent 11 items
- for (int i = 0; i < 20; i++)
- {
- prop = FileLoader.updateRecentlyOpened(String.format("%d.fa", i),
- DataSourceType.FILE);
- }
- assertEquals(prop,
- "19.fa\t18.fa\t17.fa\t16.fa\t15.fa\t14.fa\t13.fa\t12.fa\t11.fa\t10.fa\t9.fa");
- }
}
{
try
{
- AlignmentI al;
- if (format == FileFormat.HMMER3)
- {
- al = new FormatAdapter().readFile("examples/uniref50.hmm",
- DataSourceType.FILE, FileFormat.HMMER3);
- }
- else
- {
- al = new FormatAdapter().readFile("examples/uniref50.fa",
+ AlignmentI al = new FormatAdapter().readFile("examples/uniref50.fa",
DataSourceType.FILE, FileFormat.Fasta);
- }
/*
* 'gap' is the gap character used in the alignment data file here,
AlignmentI reloaded = new FormatAdapter().readFile(formatted,
DataSourceType.PASTE, format);
List<SequenceI> reread = reloaded.getSequences();
- assertEquals("Wrong number of reloaded sequences", seqs.length,
- reread.size());
-
+ assertEquals("Wrong number of reloaded sequences", seqs.length,
+ reread.size());
int i = 0;
for (SequenceI seq : reread)
@DataProvider(name = "formats")
static Object[][] getFormats()
{
- List<FileFormatI> both = new ArrayList<>();
+ List<FileFormatI> both = new ArrayList<FileFormatI>();
for (FileFormatI format : FileFormats.getInstance().getFormats())
{
if (format.isReadable() && format.isWritable()
+ actualGrp.getColourText());
System.out.println(expectedGrp.getDisplayBoxes() + " | "
+ actualGrp.getDisplayBoxes());
- System.out.println(expectedGrp.isIgnoreGapsConsensus() + " | "
- + actualGrp.isIgnoreGapsConsensus());
+ System.out.println(expectedGrp.getIgnoreGapsConsensus() + " | "
+ + actualGrp.getIgnoreGapsConsensus());
System.out.println(expectedGrp.getSequences().size() + " | "
+ actualGrp.getSequences().size());
System.out.println(expectedGrp.getStartRes() + " | "
if (expectedGrp.getName().equals(actualGrp.getName())
&& expectedGrp.getColourText() == actualGrp.getColourText()
&& expectedGrp.getDisplayBoxes() == actualGrp.getDisplayBoxes()
- && expectedGrp.isIgnoreGapsConsensus() == actualGrp
- .isIgnoreGapsConsensus()
+ && expectedGrp.getIgnoreGapsConsensus() == actualGrp
+ .getIgnoreGapsConsensus()
&& colourSchemeMatches
&& expectedGrp.getSequences().size() == actualGrp
.getSequences().size()
import jalview.api.ViewStyleI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.HiddenSequences;
-import jalview.datamodel.Mapping;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.features.FeatureMatcherSet;
import jalview.datamodel.features.FeatureMatcherSetI;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
import jalview.gui.Desktop;
import jalview.gui.FeatureRenderer;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import junit.extensions.PA;
-
@Test(singleThreaded = true)
public class Jalview2xmlTests extends Jalview2xmlBase
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
- AlignViewportI av = af.getViewport();
+ AlignViewport av = af.getViewport();
AlignmentI al = av.getAlignment();
/*
* @throws IOException
*/
@Test(groups = { "Functional" })
- public void testStoreAndRecoverFeatureColoursAndFilters()
- throws IOException
+ public void testSaveLoadFeatureColoursAndFilters() throws IOException
{
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
">Seq1\nACDEFGHIKLM", DataSourceType.PASTE);
addFeature(seq, featureType, score++);
addFeature(seq, featureType, score);
}
-
- /**
- * Load an HMM profile to an alignment, and confirm it is correctly restored
- * when reloaded from project
- *
- * @throws IOException
- */
- @Test(groups = { "Functional" })
- public void testStoreAndRecoverHmmProfile() throws IOException
- {
- Desktop.instance.closeAll_actionPerformed(null);
- AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
- "examples/uniref50.fa", DataSourceType.FILE);
-
- AlignViewportI av = af.getViewport();
- AlignmentI al = av.getAlignment();
-
- /*
- * mimic drag and drop of hmm file on to alignment
- */
- AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded(
- "examples/uniref50.hmm", DataSourceType.FILE);
- al.insertSequenceAt(0,
- af2.getViewport().getAlignment().getSequenceAt(0));
-
- /*
- * check it loaded in
- */
- SequenceI hmmSeq = al.getSequenceAt(0);
- assertTrue(hmmSeq.hasHMMProfile());
- HiddenMarkovModel hmm = hmmSeq.getHMM();
- assertSame(hmm.getConsensusSequence(), hmmSeq);
-
- /*
- * save project, close windows, reload project, verify
- */
- File tfile = File.createTempFile("testStoreAndRecoverHmmProfile",
- ".jvp");
- tfile.deleteOnExit();
- new Jalview2XML(false).saveState(tfile);
- Desktop.instance.closeAll_actionPerformed(null);
- af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
- DataSourceType.FILE);
- Assert.assertNotNull(af, "Failed to reload project");
-
- hmmSeq = al.getSequenceAt(0);
- assertTrue(hmmSeq.hasHMMProfile());
- assertSame(hmm.getConsensusSequence(), hmmSeq);
- Mapping mapToHmmConsensus = (Mapping) PA.getValue(hmm,
- "mapToHmmConsensus");
- assertNotNull(mapToHmmConsensus);
- assertSame(mapToHmmConsensus.getTo(), hmmSeq.getDatasetSequence());
- }
}
import static org.testng.AssertJUnit.assertEquals;
import static org.testng.AssertJUnit.assertNotNull;
-import static org.testng.AssertJUnit.assertNull;
import static org.testng.AssertJUnit.assertTrue;
import static org.testng.AssertJUnit.fail;
-import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Annotation;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.JvOptionPane;
import java.io.File;
-import java.io.IOException;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
// we might want to revise this in future
int aa_new_size = (aa_new == null ? 0 : aa_new.length);
int aa_original_size = (aa_original == null ? 0 : aa_original.length);
- Map<Integer, BitSet> orig_groups = new HashMap<>();
- Map<Integer, BitSet> new_groups = new HashMap<>();
+ Map<Integer, BitSet> orig_groups = new HashMap<Integer, BitSet>();
+ Map<Integer, BitSet> new_groups = new HashMap<Integer, BitSet>();
if (aa_new != null && aa_original != null)
{
testAlignmentEquivalence(al, newAl, true, true, true);
}
-
- @Test(groups = { "Functional" })
- public void testTypeToDescription()
- {
- assertEquals("Secondary Structure",
- StockholmFile.typeToDescription("SS"));
- assertEquals("Surface Accessibility",
- StockholmFile.typeToDescription("SA"));
- assertEquals("transmembrane", StockholmFile.typeToDescription("TM"));
- assertEquals("Posterior Probability",
- StockholmFile.typeToDescription("PP"));
- assertEquals("ligand binding", StockholmFile.typeToDescription("LI"));
- assertEquals("active site", StockholmFile.typeToDescription("AS"));
- assertEquals("intron", StockholmFile.typeToDescription("IN"));
- assertEquals("interacting residue",
- StockholmFile.typeToDescription("IR"));
- assertEquals("accession", StockholmFile.typeToDescription("AC"));
- assertEquals("organism", StockholmFile.typeToDescription("OS"));
- assertEquals("class", StockholmFile.typeToDescription("CL"));
- assertEquals("description", StockholmFile.typeToDescription("DE"));
- assertEquals("reference", StockholmFile.typeToDescription("DR"));
- assertEquals("look", StockholmFile.typeToDescription("LO"));
- assertEquals("Reference Positions",
- StockholmFile.typeToDescription("RF"));
-
- // case-sensitive:
- assertEquals("Rf", StockholmFile.typeToDescription("Rf"));
- assertEquals("junk", StockholmFile.typeToDescription("junk"));
- assertEquals("", StockholmFile.typeToDescription(""));
- assertNull(StockholmFile.typeToDescription(null));
- }
-
- @Test(groups = { "Functional" })
- public void testDescriptionToType()
- {
- assertEquals("SS",
- StockholmFile.descriptionToType("Secondary Structure"));
- assertEquals("SA",
- StockholmFile.descriptionToType("Surface Accessibility"));
- assertEquals("TM", StockholmFile.descriptionToType("transmembrane"));
-
- // test is not case-sensitive:
- assertEquals("SS",
- StockholmFile.descriptionToType("secondary structure"));
-
- // test is white-space sensitive:
- assertNull(StockholmFile.descriptionToType("secondary structure "));
-
- assertNull(StockholmFile.descriptionToType("any old junk"));
- assertNull(StockholmFile.descriptionToType(""));
- assertNull(StockholmFile.descriptionToType(null));
- }
-
- @Test(groups = { "Functional" })
- public void testPrint()
- {
- SequenceI seq1 = new Sequence("seq1", "LKMF-RS-Q");
- SequenceI seq2 = new Sequence("seq2/10-15", "RRS-LIP-");
- SequenceI[] seqs = new SequenceI[] { seq1, seq2 };
- AlignmentI al = new Alignment(seqs);
-
- StockholmFile testee = new StockholmFile(al);
-
- /*
- * basic output (sequences only):
- * sequence ids are padded with 9 spaces more than the widest id
- */
- String output = testee.print(seqs, true);
- String expected = "# STOCKHOLM 1.0\n" + "seq1/1-7 LKMF-RS-Q\n"
- + "seq2/10-15 RRS-LIP-\n//\n";
- assertEquals(expected, output);
-
- /*
- * add some dbrefs
- */
- seq1.addDBRef(new DBRefEntry("PFAM", "1", "PF00111"));
- seq1.addDBRef(new DBRefEntry("UNIPROT", "1", "P83527"));
- seq2.addDBRef(new DBRefEntry("RFAM", "1", "AY119185.1"));
- seq2.addDBRef(new DBRefEntry("EMBL", "1", "AF125575"));
- output = testee.print(seqs, true);
- // PFAM and RFAM dbrefs should be output as AC, others as DR
- expected = "# STOCKHOLM 1.0\n" + "#=GS seq1/1-7 AC PF00111\n"
- + "#=GS seq1/1-7 DR UNIPROT ; P83527\n"
- + "#=GS seq2/10-15 AC AY119185.1\n"
- + "#=GS seq2/10-15 DR EMBL ; AF125575\n"
- + "seq1/1-7 LKMF-RS-Q\n"
- + "seq2/10-15 RRS-LIP-\n//\n";
- assertEquals(expected, output);
-
- /*
- * add some sequence and alignment annotation
- */
- Annotation[] anns = new Annotation[5];
- for (int i = 0; i < anns.length; i++)
- {
- anns[i] = new Annotation(String.valueOf((char) ('B' + i)),
- "Desc " + i,
- (char) ('C' + i), i + 3);
- }
-
- // expect "secondary structure" to be output as #=GR seqid SS
- // using the secondary structure character (CDEFG) not display char (BCDEF)
- AlignmentAnnotation aa1 = new AlignmentAnnotation("secondary structure",
- "ssdesc", anns);
- aa1.sequenceRef = seq1;
- seq1.addAlignmentAnnotation(aa1);
- al.addAnnotation(aa1);
-
- // "sec structure" should not be output as no corresponding feature id
- AlignmentAnnotation aa2 = new AlignmentAnnotation("sec structure",
- "ssdesc", anns);
- aa2.sequenceRef = seq2;
- seq2.addAlignmentAnnotation(aa2);
- al.addAnnotation(aa2);
-
- // alignment annotation for Reference Positions: output as #=GC RF
- AlignmentAnnotation aa3 = new AlignmentAnnotation("reference positions",
- "refpos", anns);
- al.addAnnotation(aa3);
-
- // 'seq' annotation: output as seq_cons
- AlignmentAnnotation aa4 = new AlignmentAnnotation("seq", "seqdesc",
- anns);
- al.addAnnotation(aa4);
-
- // 'intron' annotation: output as IN_cons
- AlignmentAnnotation aa5 = new AlignmentAnnotation("intron",
- "introndesc", anns);
- al.addAnnotation(aa5);
-
- // 'binding site' annotation: output as binding_site
- AlignmentAnnotation aa6 = new AlignmentAnnotation("binding site",
- "bindingdesc", anns);
- al.addAnnotation(aa6);
-
- // 'autocalc' annotation should not be output
- AlignmentAnnotation aa7 = new AlignmentAnnotation("Consensus",
- "consensusdesc", anns);
- aa7.autoCalculated = true;
- al.addAnnotation(aa7);
-
- // hidden annotation should not be output
- AlignmentAnnotation aa8 = new AlignmentAnnotation("domains",
- "domaindesc", anns);
- aa8.visible = false;
- al.addAnnotation(aa8);
-
- output = testee.print(seqs, true);
- //@formatter:off
- expected =
- "# STOCKHOLM 1.0\n"
- + "#=GS seq1/1-7 AC PF00111\n"
- + "#=GS seq1/1-7 DR UNIPROT ; P83527\n"
- + "#=GS seq2/10-15 AC AY119185.1\n"
- + "#=GS seq2/10-15 DR EMBL ; AF125575\n"
- + "#=GR seq1/1-7 SS CDEFG\n"
- + "seq1/1-7 LKMF-RS-Q\n"
- + "seq2/10-15 RRS-LIP-\n"
- + "#=GC RF BCDEF\n" + "#=GC seq_cons BCDEF\n"
- + "#=GC IN_cons BCDEF\n" + "#=GC binding_site BCDEF\n"
- + "//\n";
- //@formatter:on
- assertEquals(expected, output);
- }
-
- @Test(groups = "Functional")
- public void testGetAnnotationCharacter()
- {
- SequenceI seq = new Sequence("seq", "abc--def-");
-
- Annotation[] ann = new Annotation[8];
- ann[1] = new Annotation("Z", "desc", 'E', 1f);
- ann[2] = new Annotation("Q", "desc", ' ', 1f);
- ann[4] = new Annotation("", "desc", 'E', 1f);
- ann[6] = new Annotation("ZH", "desc", 'E', 1f);
-
- /*
- * null annotation in column (not Secondary Structure annotation)
- * should answer sequence character, or '-' if null sequence
- */
- assertEquals('-',
- StockholmFile.getAnnotationCharacter("RF", 0, ann[0], null));
- assertEquals('d',
- StockholmFile.getAnnotationCharacter("RF", 5, ann[5], seq));
- assertEquals('-',
- StockholmFile.getAnnotationCharacter("RF", 8, null, seq));
-
- /*
- * null annotation in column (SS annotation) should answer underscore
- */
- assertEquals('_',
- StockholmFile.getAnnotationCharacter("SS", 0, ann[0], seq));
-
- /*
- * SS secondary structure symbol
- */
- assertEquals('E',
- StockholmFile.getAnnotationCharacter("SS", 1, ann[1], seq));
-
- /*
- * no SS symbol, use label instead
- */
- assertEquals('Q',
- StockholmFile.getAnnotationCharacter("SS", 2, ann[2], seq));
-
- /*
- * SS with 2 character label - second character overrides SS symbol
- */
- assertEquals('H',
- StockholmFile.getAnnotationCharacter("SS", 6, ann[6], seq));
-
- /*
- * empty display character, not SS - answers '.'
- */
- assertEquals('.',
- StockholmFile.getAnnotationCharacter("RF", 4, ann[4], seq));
- }
-
- /**
- * Test to verify that gaps are input/output as underscore in STO annotation
- *
- * @throws IOException
- */
- @Test(groups = "Functional")
- public void testRoundtripWithGaps() throws IOException
- {
- /*
- * small extract from RF00031_folded.stk
- */
- // @formatter:off
- String stoData =
- "# STOCKHOLM 1.0\n" +
- "#=GR B.taurus.4 SS .._((.))_\n" +
- "B.taurus.4 AC.UGCGU.\n" +
- "#=GR B.taurus.5 SS ..((_._))\n" +
- "B.taurus.5 ACUU.G.CG\n" +
- "//\n";
- // @formatter:on
- StockholmFile parser = new StockholmFile(stoData, DataSourceType.PASTE);
- SequenceI[] seqs = parser.getSeqsAsArray();
- assertEquals(2, seqs.length);
-
- /*
- * B.taurus.4 has a trailing gap
- * rendered as underscore in Stockholm annotation
- */
- assertEquals("AC.UGCGU.", seqs[0].getSequenceAsString());
- AlignmentAnnotation[] anns = seqs[0].getAnnotation();
- assertEquals(1, anns.length);
- AlignmentAnnotation taurus4SS = anns[0];
- assertEquals(9, taurus4SS.annotations.length);
- assertEquals(" .", taurus4SS.annotations[0].displayCharacter);
- assertNull(taurus4SS.annotations[2]); // gapped position
- assertNull(taurus4SS.annotations[8]); // gapped position
- assertEquals('(', taurus4SS.annotations[3].secondaryStructure);
- assertEquals("(", taurus4SS.annotations[3].displayCharacter);
- assertEquals(')', taurus4SS.annotations[7].secondaryStructure);
-
- /*
- * output as Stockholm and verify it matches the original input
- * (gaps output as underscore in annotation lines)
- * note: roundtrip test works with the input lines ordered as above;
- * can also parse in other orders, but then input doesn't match output
- */
- AlignmentFileWriterI afile = FileFormat.Stockholm
- .getWriter(new Alignment(seqs));
- String output = afile.print(seqs, false);
- assertEquals(stoData, output);
- }
}
import static org.testng.AssertJUnit.assertEquals;
-import jalview.api.AlignViewportI;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
import java.util.ArrayList;
{
SequenceI seq = new Sequence("name", "MA--TVLGSPRAPAFF");
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new OverviewResColourFinder();
// gaps are grey, residues white
SequenceI seq = new Sequence("name", "MAT--GSPRAPAFF"); // FER1_MAIZE... + a
// gap
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new OverviewResColourFinder();
av.setGlobalColourScheme(new ZappoColourScheme());
SequenceI seq = new Sequence("name", "MAT--GSPRAPAFF"); // FER1_MAIZE... + a
// gap
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new OverviewResColourFinder();
Color[] newColours = new Color[24];
SequenceGroup[] groups = new SequenceGroup[1];
groups[0] = sg;
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new OverviewResColourFinder();
// G in group specified as magenta in Zappo
{
SequenceI seq = new Sequence("name", "MAT--GSPRAPAFF"); // FER1_MAIZE... + a
// gap
+ AlignmentI al = new Alignment(new SequenceI[] { seq });
+ final AlignViewport av = new AlignViewport(al);
// non-legacy colouring
ResidueColourFinder rcf = new OverviewResColourFinder();
// gaps gap colour
c = rcf.getBoxColour(shader, seq, 3);
- assertEquals(OverviewResColourFinder.OVERVIEW_DEFAULT_GAP, c);
+ assertEquals(
+ jalview.renderer.OverviewResColourFinder.OVERVIEW_DEFAULT_GAP,
+ c);
// non legacy colouring with colour scheme
rcf = new OverviewResColourFinder(false, Color.blue, Color.red);
import static org.testng.AssertJUnit.assertEquals;
-import jalview.api.AlignViewportI;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.Sequence;
import jalview.gui.JvOptionPane;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
{
SequenceI seq = new Sequence("name", "MATVLGSPRAPAFF"); // FER1_MAIZE...
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new ResidueColourFinder();
av.setGlobalColourScheme(new ZappoColourScheme());
{
SequenceI seq = new Sequence("name", "MA--TVLGSPRAPAFF");
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new ResidueColourFinder();
assertEquals(Color.white,
SequenceI seq = new Sequence("name", "MAT--GSPRAPAFF"); // FER1_MAIZE... + a
// gap
AlignmentI al = new Alignment(new SequenceI[] { seq });
- final AlignViewportI av = new AlignViewport(al);
+ final AlignViewport av = new AlignViewport(al);
ResidueColourFinder rcf = new ResidueColourFinder();
Color[] newColours = new Color[24];
import static org.testng.Assert.assertTrue;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
import jalview.renderer.ScaleRenderer.ScaleMark;
-import jalview.viewmodel.AlignmentViewport;
import java.util.List;
String data = ">Seq/20-45\nABCDEFGHIJKLMNOPQRSTUVWXYS\n";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(data,
DataSourceType.PASTE);
- AlignmentViewport av = af.getViewport();
+ AlignViewport av = af.getViewport();
/*
* scale has minor ticks at 5, 15, 25, major at 10 and 20
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
-import jalview.api.AlignViewportI;
import jalview.api.FeatureColourI;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.FeatureRenderer;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
*/
public class FeatureColourFinderTest
{
- private AlignViewportI av;
+ private AlignViewport av;
private SequenceI seq;
// TODO more test cases; check if help documentation matches implementation
}
+
+ // @formatter:on
/**
* Test for colour calculation when the consensus percentage ignores gapped
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
-import jalview.viewmodel.AlignmentViewport;
import java.awt.Color;
*/
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(seqs,
DataSourceType.PASTE);
- AlignmentViewport viewport = af.getViewport();
+ AlignViewport viewport = af.getViewport();
viewport.setIgnoreGapsConsensus(false, af.alignPanel);
while (viewport.getConsensusSeq() == null)
{
assertEquals("[ [11, 16] ] 1:3 to [ [72, 53] ]", ml.toString());
}
+ @Test(groups = "Functional")
+ public void testAddRange()
+ {
+ int[] range = { 1, 5 };
+ List<int[]> ranges = new ArrayList<>();
+
+ // add to empty list:
+ MapList.addRange(range, ranges);
+ assertEquals(1, ranges.size());
+ assertSame(range, ranges.get(0));
+
+ // extend contiguous (same position):
+ MapList.addRange(new int[] { 5, 10 }, ranges);
+ assertEquals(1, ranges.size());
+ assertEquals(1, ranges.get(0)[0]);
+ assertEquals(10, ranges.get(0)[1]);
+
+ // extend contiguous (next position):
+ MapList.addRange(new int[] { 11, 15 }, ranges);
+ assertEquals(1, ranges.size());
+ assertEquals(1, ranges.get(0)[0]);
+ assertEquals(15, ranges.get(0)[1]);
+
+ // change direction: range is not merged:
+ MapList.addRange(new int[] { 16, 10 }, ranges);
+ assertEquals(2, ranges.size());
+ assertEquals(16, ranges.get(1)[0]);
+ assertEquals(10, ranges.get(1)[1]);
+
+ // extend reverse contiguous (same position):
+ MapList.addRange(new int[] { 10, 8 }, ranges);
+ assertEquals(2, ranges.size());
+ assertEquals(16, ranges.get(1)[0]);
+ assertEquals(8, ranges.get(1)[1]);
+
+ // extend reverse contiguous (next position):
+ MapList.addRange(new int[] { 7, 6 }, ranges);
+ assertEquals(2, ranges.size());
+ assertEquals(16, ranges.get(1)[0]);
+ assertEquals(6, ranges.get(1)[1]);
+
+ // change direction: range is not merged:
+ MapList.addRange(new int[] { 6, 9 }, ranges);
+ assertEquals(3, ranges.size());
+ assertEquals(6, ranges.get(2)[0]);
+ assertEquals(9, ranges.get(2)[1]);
+
+ // not contiguous: not merged
+ MapList.addRange(new int[] { 11, 12 }, ranges);
+ assertEquals(4, ranges.size());
+ assertEquals(11, ranges.get(3)[0]);
+ assertEquals(12, ranges.get(3)[1]);
+ }
+
/**
* Check state after construction
*/
*/
MapList ml1 = new MapList(new int[] { 3, 4, 8, 12 }, new int[] { 5, 8,
11, 13 }, 1, 1);
+ assertEquals("{[3, 4], [8, 12]}", prettyPrint(ml1.getFromRanges()));
+ assertEquals("{[5, 8], [11, 13]}", prettyPrint(ml1.getToRanges()));
+
MapList ml2 = new MapList(new int[] { 1, 50 }, new int[] { 40, 45, 70,
75, 90, 127 }, 1, 1);
+ assertEquals("{[1, 50]}", prettyPrint(ml2.getFromRanges()));
+ assertEquals("{[40, 45], [70, 75], [90, 127]}",
+ prettyPrint(ml2.getToRanges()));
+
MapList compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 1);
- assertEquals(compound.getToRatio(), 1);
+ assertEquals(1, compound.getFromRatio());
+ assertEquals(1, compound.getToRatio());
List<int[]> fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 2);
+ assertEquals(2, fromRanges.size());
assertArrayEquals(new int[] { 3, 4 }, fromRanges.get(0));
assertArrayEquals(new int[] { 8, 12 }, fromRanges.get(1));
List<int[]> toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 2);
+ assertEquals(4, toRanges.size());
// 5-8 maps to 44-45,70-71
// 11-13 maps to 74-75,90
- assertArrayEquals(new int[] { 44, 45, 70, 71 }, toRanges.get(0));
- assertArrayEquals(new int[] { 74, 75, 90, 90 }, toRanges.get(1));
+ assertArrayEquals(new int[] { 44, 45 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 70, 71 }, toRanges.get(1));
+ assertArrayEquals(new int[] { 74, 75 }, toRanges.get(2));
+ assertArrayEquals(new int[] { 90, 90 }, toRanges.get(3));
/*
* 1:1 over 1:1 backwards ('reverse strand')
new int[] { 1000, 901, 600, 201 }, 1, 1);
compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 1);
- assertEquals(compound.getToRatio(), 1);
+ assertEquals(1, compound.getFromRatio());
+ assertEquals(1, compound.getToRatio());
fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 1);
+ assertEquals(1, fromRanges.size());
assertArrayEquals(new int[] { 1, 50 }, fromRanges.get(0));
toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 1);
- assertArrayEquals(new int[] { 931, 901, 600, 582 }, toRanges.get(0));
+ assertEquals(2, toRanges.size());
+ assertArrayEquals(new int[] { 931, 901 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 600, 582 }, toRanges.get(1));
/*
* 1:1 plus 1:3 should result in 1:3
1, 3);
compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 1);
- assertEquals(compound.getToRatio(), 3);
+ assertEquals(1, compound.getFromRatio());
+ assertEquals(3, compound.getToRatio());
fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 1);
+ assertEquals(1, fromRanges.size());
assertArrayEquals(new int[] { 1, 30 }, fromRanges.get(0));
// 11-40 maps to 31-50,91-160
toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 1);
- assertArrayEquals(new int[] { 31, 50, 91, 160 }, toRanges.get(0));
+ assertEquals(2, toRanges.size());
+ assertArrayEquals(new int[] { 31, 50 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 91, 160 }, toRanges.get(1));
/*
* 3:1 plus 1:1 should result in 3:1
1, 1);
compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 3);
- assertEquals(compound.getToRatio(), 1);
+ assertEquals(3, compound.getFromRatio());
+ assertEquals(1, compound.getToRatio());
fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 1);
+ assertEquals(1, fromRanges.size());
assertArrayEquals(new int[] { 1, 30 }, fromRanges.get(0));
// 11-20 maps to 11-15, 91-95
toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 1);
- assertArrayEquals(new int[] { 11, 15, 91, 95 }, toRanges.get(0));
+ assertEquals(2, toRanges.size());
+ assertArrayEquals(new int[] { 11, 15 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 91, 95 }, toRanges.get(1));
/*
* 1:3 plus 3:1 should result in 1:1
3, 1);
compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 1);
- assertEquals(compound.getToRatio(), 1);
+ assertEquals(1, compound.getFromRatio());
+ assertEquals(1, compound.getToRatio());
fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 1);
+ assertEquals(1, fromRanges.size());
assertArrayEquals(new int[] { 21, 40 }, fromRanges.get(0));
// 13-72 maps 3:1 to 55-70, 121-124
toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 1);
- assertArrayEquals(new int[] { 55, 70, 121, 124 }, toRanges.get(0));
+ assertEquals(2, toRanges.size());
+ assertArrayEquals(new int[] { 55, 70 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 121, 124 }, toRanges.get(1));
/*
* 3:1 plus 1:3 should result in 1:1
1, 3);
compound = ml1.traverse(ml2);
- assertEquals(compound.getFromRatio(), 1);
- assertEquals(compound.getToRatio(), 1);
+ assertEquals(1, compound.getFromRatio());
+ assertEquals(1, compound.getToRatio());
fromRanges = compound.getFromRanges();
- assertEquals(fromRanges.size(), 1);
+ assertEquals(1, fromRanges.size());
assertArrayEquals(new int[] { 31, 90 }, fromRanges.get(0));
// 13-32 maps to 47-50,71-126
toRanges = compound.getToRanges();
- assertEquals(toRanges.size(), 1);
- assertArrayEquals(new int[] { 47, 50, 71, 126 }, toRanges.get(0));
+ assertEquals(2, toRanges.size());
+ assertArrayEquals(new int[] { 47, 50 }, toRanges.get(0));
+ assertArrayEquals(new int[] { 71, 126 }, toRanges.get(1));
/*
* method returns null if not all regions are mapped through
assertEquals(1, ranges.size());
assertEquals(9, ranges.get(0)[1]);
}
-
- @Test(groups = "Functional")
- public void testAddRange()
- {
- int[] range = { 1, 5 };
- List<int[]> ranges = new ArrayList<>();
-
- // add to empty list:
- MappingUtils.addRange(range, ranges);
- assertEquals(1, ranges.size());
- assertSame(range, ranges.get(0));
-
- // extend contiguous (same position):
- MappingUtils.addRange(new int[] { 5, 10 }, ranges);
- assertEquals(1, ranges.size());
- assertEquals(1, ranges.get(0)[0]);
- assertEquals(10, ranges.get(0)[1]);
-
- // extend contiguous (next position):
- MappingUtils.addRange(new int[] { 11, 15 }, ranges);
- assertEquals(1, ranges.size());
- assertEquals(1, ranges.get(0)[0]);
- assertEquals(15, ranges.get(0)[1]);
-
- // change direction: range is not merged:
- MappingUtils.addRange(new int[] { 16, 10 }, ranges);
- assertEquals(2, ranges.size());
- assertEquals(16, ranges.get(1)[0]);
- assertEquals(10, ranges.get(1)[1]);
-
- // extend reverse contiguous (same position):
- MappingUtils.addRange(new int[] { 10, 8 }, ranges);
- assertEquals(2, ranges.size());
- assertEquals(16, ranges.get(1)[0]);
- assertEquals(8, ranges.get(1)[1]);
-
- // extend reverse contiguous (next position):
- MappingUtils.addRange(new int[] { 7, 6 }, ranges);
- assertEquals(2, ranges.size());
- assertEquals(16, ranges.get(1)[0]);
- assertEquals(6, ranges.get(1)[1]);
-
- // change direction: range is not merged:
- MappingUtils.addRange(new int[] { 6, 9 }, ranges);
- assertEquals(3, ranges.size());
- assertEquals(6, ranges.get(2)[0]);
- assertEquals(9, ranges.get(2)[1]);
-
- // not contiguous: not merged
- MappingUtils.addRange(new int[] { 11, 12 }, ranges);
- assertEquals(4, ranges.size());
- assertEquals(11, ranges.get(3)[0]);
- assertEquals(12, ranges.get(3)[1]);
- }
}
}
@Test(groups = { "Functional" })
+ public void testGetLastToken()
+ {
+ assertNull(StringUtils.getLastToken(null, null));
+ assertNull(StringUtils.getLastToken(null, "/"));
+ assertEquals("a", StringUtils.getLastToken("a", null));
+
+ assertEquals("abc", StringUtils.getLastToken("abc", "/"));
+ assertEquals("c", StringUtils.getLastToken("abc", "b"));
+ assertEquals("file1.dat", StringUtils.getLastToken(
+ "file://localhost:8080/data/examples/file1.dat", "/"));
+ }
+
+ @Test(groups = { "Functional" })
public void testSeparatorListToArray()
{
String[] result = StringUtils.separatorListToArray(
public void testListToDelimitedString()
{
assertEquals("", StringUtils.listToDelimitedString(null, ";"));
- List<String> list = new ArrayList<>();
+ List<String> list = new ArrayList<String>();
assertEquals("", StringUtils.listToDelimitedString(list, ";"));
list.add("now");
assertEquals("now", StringUtils.listToDelimitedString(list, ";"));
Cache.applicationProperties.setProperty("ADD_SS_ANN",
Boolean.TRUE.toString());
- sf = new SequenceFetcher(false);
+ sf = new SequenceFetcher();
}
/**
*/
public static void main(String[] argv)
{
- // TODO: extracted from SequenceFetcher - convert to proper unit test with
+ // TODO: extracted from SequenceFetcher - convert to network dependent
+ // functional integration test with
// assertions
String usage = "SequenceFetcher.main [-nodas] [<DBNAME> [<ACCNO>]]\n"
+ "With no arguments, all DbSources will be queried with their test Accession number.\n"
+ "With one argument, the argument will be resolved to one or more db sources and each will be queried with their test accession only.\n"
- + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.\n"
- + "The -nodas option will exclude DAS sources from the database fetchers Jalview will try to use.";
- boolean withDas = true;
- if (argv != null && argv.length > 0
- && argv[0].toLowerCase().startsWith("-nodas"))
+ + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.";
+
+ if (argv != null && argv.length > 0)
{
- withDas = false;
String targs[] = new String[argv.length - 1];
System.arraycopy(argv, 1, targs, 0, targs.length);
argv = targs;
}
if (argv != null && argv.length > 0)
{
- List<DbSourceProxy> sps = new SequenceFetcher(withDas)
+ List<DbSourceProxy> sps = new SequenceFetcher()
.getSourceProxy(argv[0]);
if (sps != null)
System.out.println(usage);
return;
}
- ASequenceFetcher sfetcher = new SequenceFetcher(withDas);
+ ASequenceFetcher sfetcher = new SequenceFetcher();
String[] dbSources = sfetcher.getSupportedDb();
for (int dbsource = 0; dbsource < dbSources.length; dbsource++)
{
String testQuery)
{
AlignmentI ds = null;
- Vector<Object[]> noProds = new Vector<Object[]>();
+ Vector<Object[]> noProds = new Vector<>();
System.out.println("Source: " + sp.getDbName() + " (" + db
+ "): retrieving test:" + sp.getTestQuery());
{
Cache.applicationProperties.setProperty("ADD_SS_ANN",
Boolean.TRUE.toString());
- sf = new SequenceFetcher(false);
+ sf = new SequenceFetcher();
}
@DataProvider(name = "AccessionData")
@Test(groups = { "Network" })
public void testUniprotFreeTextSearch() throws Exception
{
- List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
+ List<FTSDataColumnI> wantedFields = new ArrayList<>();
FTSRestClientI client = UniProtFTSRestClient.getInstance();
wantedFields.add(client.getDataColumnByNameOrCode("id"));
wantedFields.add(client.getDataColumnByNameOrCode("entry name"));
import jalview.ws.jws2.JabaPreset;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
-import jalview.ws.params.ParamDatastoreI;
import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import compbio.metadata.Argument;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
/**
* which services to test
*/
- public static List<String> serviceTests = new ArrayList<>();
+ public static List<String> serviceTests = new ArrayList<String>();
/**
* which presets to test for services
*/
- public static List<String> presetTests = new ArrayList<>();
+ public static List<String> presetTests = new ArrayList<String>();
static
{
serviceTests.add("AAConWS".toLowerCase());
}
pr = en.next();
}
- WsJobParameters pgui = new WsJobParameters((ParamDatastoreI) null,
- service, new JabaPreset(service, pr),
- (List<Argument>) null);
- JFrame jf = new JFrame(MessageManager
- .formatMessage("label.ws_parameters_for", new String[]
- { service.getActionText() }));
+ WsJobParameters pgui = new WsJobParameters(service,
+ new JabaPreset(service, pr));
+ JFrame jf = new JFrame(MessageManager.formatMessage(
+ "label.ws_parameters_for",
+ new String[] { service.getActionText() }));
jf.setSize(700, 800);
JPanel cont = new JPanel(new BorderLayout());
pgui.validate();
<param name="file2" value="${file2}" />
</antcall>
<echo message=" "/>
- <echo message="Missing message labels in Messages.properties compared to ${file2}"/>
+ <echo message="Missing message labels in Messages.properties compare to ${file2}"/>
<antcall target="compareProperties">
<param name="file2" value="resources/lang/Messages.properties"/>
<param name="file1" value="${file2}" />