+build
+build-site
+buildPropertiesFile
+buildTests
+buildextclients
+buildindices
+castorbinding
+clean
+compileApplet
+distclean
+eclipse-install
help
+init
+linkcheck
+makeApplet
+makedist
+makefulldist
+obfuscate
+packageApplet
+prepare
+prepareTests
+preparejnlp
+prepubapplet_1
+pubapplet
+runenv
+signApplet
+sourcedist
+sourcedoc
+sourcescrub
+testclean
+testng
usage
+writejnlpf
<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"/>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <!-- Not needed for java2script build
+ <classpathentry kind="src" path="utils"/>
+ <classpathentry kind="src" path="test"/>
+ -->
+ <classpathentry kind="lib" path="lib/activation.jar"/>
+ <classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
+ <classpathentry kind="lib" path="lib/commons-discovery.jar"/>
+ <classpathentry kind="lib" path="lib/jaxrpc.jar"/>
+ <classpathentry kind="lib" path="lib/jhall.jar"/>
+ <classpathentry kind="lib" path="lib/mail.jar"/>
+ <classpathentry kind="lib" path="lib/regex.jar"/>
+ <classpathentry kind="lib" path="lib/saaj.jar"/>
+ <classpathentry kind="lib" path="lib/wsdl4j.jar"/>
+ <classpathentry kind="lib" path="lib/xercesImpl.jar"/>
+ <classpathentry kind="lib" path="lib/castor-1.1-cycle-xml.jar" sourcepath="C:/Documents and Settings/JimP/workspace-3.3/castor/src/main/java"/>
+ <classpathentry kind="lib" path="lib/JGoogleAnalytics_0.3.jar" sourcepath="/JGoogleAnalytics/src/main/java"/>
+ <classpathentry kind="lib" path="lib/vamsas-client.jar"/>
+ <classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
+ <classpathentry kind="lib" path="lib/apache-mime4j-0.6.jar" sourcepath="G:/InstallsDir/Sources for Development/apache-mime4j-0.6-src.zip"/>
+ <classpathentry kind="lib" path="lib/httpclient-4.0.3.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib" path="lib/httpcore-4.0.1.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib" path="lib/httpmime-4.0.3.jar">
+ <attributes>
+ <attribute name="javadoc_location" value="file:/D:/InstallsDir/Sources for Development/httpconnect/httpcomponents-client-4.0.3/javadoc/"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="lib" path="lib/miglayout-4.0-swing.jar"/>
+ <classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
+ <classpathentry kind="lib" path="lib/commons-codec-1.3.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"/>
+ <classpathentry kind="lib" path="lib/json_simple-1.1.jar" sourcepath="/Users/jimp/Downloads/json_simple-1.1-all.zip"/>
+ <classpathentry kind="lib" path="lib/slf4j-api-1.7.7.jar"/>
+ <classpathentry kind="lib" path="lib/jsoup-1.8.1.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-to-slf4j-2.0-rc2.jar"/>
+ <classpathentry kind="lib" path="lib/slf4j-log4j12-1.7.7.jar"/>
+ <classpathentry kind="lib" path="lib/VARNAv3-93.jar"/>
+ <classpathentry kind="lib" path="lib/jfreesvg-2.1.jar"/>
+ <classpathentry kind="lib" path="lib/quaqua-filechooser-only-8.0.jar"/>
+ <classpathentry kind="lib" path="lib/VAqua4.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin"/>
+ <classpathentry kind="lib" path="lib/xml-apis.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugin.jar"/>
+ <classpathentry kind="lib" path="lib/jersey-client-1.19.jar"/>
+ <classpathentry kind="lib" path="lib/jersey-core-1.19.jar"/>
+ <classpathentry kind="lib" path="lib/jsr311-api-1.1.1.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
+ <classpathentry kind="lib" path="lib/jetty-server-9.2.10.v20150310.jar"/>
+ <classpathentry kind="lib" path="lib/servlet-api-3.1.jar"/>
+ <classpathentry kind="lib" path="lib/jetty-util-9.2.10.v20150310.jar"/>
+ <classpathentry kind="lib" path="lib/jetty-http-9.2.10.v20150310.jar"/>
+ <classpathentry kind="lib" path="lib/jetty-io-9.2.10.v20150310.jar"/>
+ <classpathentry kind="lib" path="lib/java-json.jar"/>
+ <classpathentry kind="lib" path="lib/Jmol-14.6.4_2016.10.26.jar"/>
+ <classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/biojava-core-4.1.0.jar"/>
+ <classpathentry kind="lib" path="lib/biojava-ontology-4.1.0.jar"/>
+ <classpathentry kind="lib" path="lib/htsjdk-2.12.0.jar"/>
+ <classpathentry kind="lib" path="lib/groovy-all-2.4.12-indy.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="output" path="classes"/>
+</classpath>
-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
<target name="buildindices" depends="init, prepare" unless="help.uptodate">
<replace value="${JALVIEW_VERSION}">
- <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
+ <replacetoken>
+ <![CDATA[$$Version-Rel$$]]>
+ </replacetoken>
<fileset dir="${outputDir}/${helpDir}">
<include name="help.jhm" />
</fileset>
</resources>
<resources os="Mac OS X">
<fileset dir="${packageDir}">
- <include name="quaqua-filechooser-only-8.0.jar"/>
+ <include name="quaqua-filechooser-only-8.0.jar"/>
<include name="*quaqua64*.jnilib.jar" />
</fileset>
</resources>
<jnlpf toFile="${jnlpFile}" />
<!-- add the add-modules j2se attribute for java 9 -->
<replace file="${jnlpFile}" value="j2se version="1.8+" initial-heap-size="${inih}" max-heap-size="${maxh}" java-vm-args="--add-modules=java.se.ee --illegal-access=warn"">
- <replacetoken>j2se version="1.8+"</replacetoken>
+ <replacetoken>j2se version="1.8+"</replacetoken>
</replace>
</target>
<!-- each replacetoken CDATA body must be on one line -
otherwise the pattern doesn't match -->
<replace value="${JALVIEW_VERSION}">
- <replacetoken><![CDATA[$$Version-Rel$$]]></replacetoken>
+ <replacetoken>
+ <![CDATA[$$Version-Rel$$]]>
+ </replacetoken>
<fileset dir="_sourcedist">
<include name="**/*" />
</fileset>
</replace>
<replace dir="_sourcedist" value="${build.year}">
- <replacetoken><![CDATA[$$Year-Rel$$]]></replacetoken>
+ <replacetoken>
+ <![CDATA[$$Year-Rel$$]]>
+ </replacetoken>
<fileset dir="_sourcedist">
<include name="**/*" />
</fileset>
<javac srcdir="utils" destdir="utils" includes="HelpLinksChecker.java"/>
<java fork="true" dir="${helpDir}" classpath="utils" classname="HelpLinksChecker" failonerror="true">
<arg file="${helpDir}"/>
- <arg value="-nointernet"/>
+ <arg value="-nointernet" />
</java>
</target>
+
+<target name="eclipse-install" depends="init,prepare">
+
+ <property name="eclipseTempFile" value="eclipse-jee-oxygen-R-linux-gtk-x86_64.tar.gz"/>
+ <property name="eclipseInstallURL" value="http://mirror.csclub.uwaterloo.ca/eclipse/technology/epp/downloads/release/oxygen/R/eclipse-jee-oxygen-R-linux-gtk-x86_64.tar.gz"/>
+ <property name="java2scriptURL" value="https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/dropins/net.sf.j2s.core.jar?raw=true"/>
+
+ <get url="${eclipseInstallURL}" dest="${eclipseTempFile}"/>
+ <untar compression="gzip" src="${eclipseTempFile}" dest="${eclipse-inst}"/>
+
+ <!-- not needed since we ship transpiler with source
+ <get url="${java2scriptURL}" dest="eclipse-inst/dropins/net.sf.j2s.core.jar" /> -->
+
+</target>
+<target name="build-site" depends="init,prepare">
+ <property name="swingjsdir" value="swingjs"/>
+ <property name="eclipse-inst" value="/home/bamboo/buildtools/eclipse/eclipse-js"/>
+ <property name="eclipse-exec" value="${eclipse-inst}/eclipse"/>
+ <property name="site" value="site"/>
+ <!-- where the eclipse js workspace has been initialised -->
+ <property name="eclipse-work" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace"/>
+ <!-- git repository linked to project in workspace -->
+ <property name="eclipse-workrepo" value="/home/bamboo/buildtools/eclipse/eclipse-js-workspace/jalview-js"/>
+
+ <!-- update transpiler -->
+ <copy file="${swingjsdir}/net.sf.j2s.core.jar" todir="${eclipse-inst}/dropins" overwrite="true" failonerror="true"/>
+ <!-- update the git repo linked to the eclipse workspace -->
+ <exec executable="/usr/bin/git" outputproperty="git.commit" failifexecutionfails="true">
+ <arg value="rev-parse" />
+ <arg value="--short" />
+ <arg value="HEAD" />
+ </exec>
+ <!-- update and checkout the same commit in the workspace project -->
+ <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
+ <arg value="pull" />
+ </exec>
+ <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
+ <arg value="checkout" />
+ <arg value="${git.commit}" />
+ </exec>
+ <!-- custom classpath for .js builds -->
+ <copy file=".classpath.js" tofile="${eclipse-workrepo}/.classpath" overwrite="true"/>
+
+ <!-- execute the eclipse build - the build may fail but valid javascript may still be produced, so we ignore return codes -->
+ <exec executable="${eclipse-exec}" failonerror="no">
+ <arg value="-nosplash"/>
+ <arg value="--launcher.suppressErrors"/>
+ <arg value="-application"/>
+ <arg value="org.eclipse.jdt.apt.core.aptBuild"/>
+ <arg value="-data"/>
+ <arg value="${eclipse-work}"/>
+ </exec>
+
+ <!-- TODO: run jslint and something else here to check we have a complete set of .js files for java -->
+ <!-- possibly compare timestamps between .js files and their mate in source - any newer or not present triggers a new build -->
+ <!-- <mkdir dir="${packageDir}/${site}" /> -->
+ <!-- <property name="swingjs.zipurl" value="https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.java.core/dist/SwingJS-site.zip?raw=true" /> -->
+
+ <!-- and reset the .classpath -->
+ <exec executable="/usr/bin/git" failifexecutionfails="true" dir="${eclipse-workrepo}">
+ <arg value="checkout" />
+ <arg value="${git.commit}"/>
+ <arg value="--"/>
+ <arg value=".classpath" />
+ </exec>
+
+ <!-- finally copy artefacts from eclipse project checkout to the build site -->
+ <copy todir="${site}">
+ <fileset dir="${eclipse-workrepo}/site"/>
+ </copy>
+
+ <property name="swingjs.zip" value="${swingjsdir}/SwingJS-site.zip" />
+ <unzip src="${swingjs.zip}" dest="${site}/" overwrite="true"/>
+ <copy todir="${site}/swingjs/j2s/">
+ <fileset dir="${resourceDir}">
+ <include name="**"/>
+ </fileset>
+ </copy>
+
+ <!-- copy test files into place in site -->
+ <copy todir="${site}/examples">
+ <fileset dir="examples">
+ <include name="*.*"/>
+ </fileset>
+ </copy>
+ <!-- closure compile -->
+ <!-- tarball -->
+ <tar compression="gzip" destfile="site.tar.gz">
+ <tarfileset dir="site"/>
+ </tar>
+</target>
</project>
<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"/>
<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">
<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
+++ /dev/null
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- -->
-<head>
-<title>DAS Features</title>
-</head>
-
-<body>
- <p>
- <strong>DAS Sequence Feature Retrieval</strong>
- </p>
- <p>Jalview includes a client for retrieving sequences and their
- features via the Distributed Annotation System.</p>
- <ol>
- <li>Open the Feature Settings panel by selecting "View
- -> Feature Settings..."</li>
- <li>Click on the "<a href="dassettings.html">DAS
- Settings</a>" tabbed pane.
- </li>
- <li>Select the sources to use for DAS feature retrieval, then
- click the "Fetch DAS Features" button.
- <ul>
- <li>Cancelling Feature Retrieval<br> Press the <strong>Cancel
- Fetch</strong> button to immediately stop feature retrieval. This
- will not remove any features already added to the alignment,
- but will halt any outstanding DAS requests.<em>The cancel
- fetch button is of particular use when one or more DAS
- annotation servers are not responding!</em>
- </ul>
- </li>
- </ol>
- <p>
- If your DAS source selection contains sources which use UniProt
- accession ids, you will be asked whether Jalview should find UniProt
- Accession ids for the given sequence names. It is important to
- realise that many DAS sources only use UniProt accession ids, rather
- than Swissprot/UniProt sequence names.<br> The <a
- href="../webServices/dbreffetcher.html">database
- reference fetcher</a> documentation describes how Jalview discovers
- what database references are appropriate for the sequences in the
- alignment.
- <ul>
- <li><em>Note</em><br> Please remember to save your
- alignment if either the start/end numbering, or the sequence IDs
- were updated during the ID retrieval process.</li>
- </ul>
- <p>
- <p>
- <em>DAS support was introduced in Jalview Version 2.1.</em>
- </p>
- <br />
- <p>
- <em>The DAS registry at http://www.dasregistry.org was
- decommissioned early in 2015. An unmaintained mirror is currently
- hosted at http://www.ebi.ac.uk/das-srv/registry/.</em>
- </p>
- <p>
-</body>
-</html>
+++ /dev/null
-<html>
-<!--
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- -->
-<head>
-<title>DAS Settings</title>
-</head>
-
-<body>
- <p>
- <strong>DAS Settings</strong>
- </p>
- <p>
- Jalview can retrieve sequences and features from many <a
- href="http://biodas.org/">DAS</a> sources. The DAS sources
- that it uses are discovered and selected <em>via</em> the DAS
- settings panel, opened either from the <a
- href="featuresettings.html">View→Feature Settings</a> dialog
- box from the alignment window's menu bar, or the <a
- href="featuresettings.html">Tools→Preferences</a>
- dialog box opened from the Desktop menu bar.
- </p>
- <p>
- <img src="das.gif">
- <p>The available sources are listed in the table using each
- source's Nickname as its identifier. Clicking on a source's entry in
- the table reveals more information about that service in the panel
- to the right. Select the tickbox in the "Use Source"
- column for a source to add it to the set Jalview queries for
- alignment and sequence features.</p>
- <p>You can filter the visible DAS sources by authority, type and
- "label". You should read the DAS documentation to
- understand more about these values.
- <p>
- <strong>Updating the list of sources</strong>
- </p>
- <p>
- When the DAS Settings panel is first opened, and when the <strong>'Refresh
- source'</strong> buton is pressed, a list of DAS sources is retrieved from
- the DAS registry URL. Note that the registry hosted at
- http://www.dasregistry.org/das/ was retired at the start of 2015. An
- alternative service is currently hosted at
- http://www.ebi.ac.uk/das-srv/registry/das/. To connect to this
- service, ensure your .jalview_properties file includes the following
- line:<br> <b>DAS_REGISTRY_URL=http\://www.ebi.ac.uk/das-srv/registry/das/</b>
- </p>
- <p>
- <strong>Adding your own DAS Sources</strong>
- </p>
- <p>You can add your own DAS source to the list by clicking the
- "Add Local Source" button. Enter the URL and nickname of
- your additional service. It should be noted that Jalview 2.1 will
- not query additional sources for more information, but this will be
- implemented in future editions.
- <p>
-</body>
-</html>
Preferences</a> tab contains settings affecting the export of
sequence alignments and EPS files.
</li>
- <li>The <a href="dassettings.html"><strong>"DAS
- Settings"</strong> Preferences</a> tab allows you to select which DAS
- sources to use when fetching DAS Features.
- </li>
<li>The <a href="../webServices/webServicesPrefs.html"><strong>"Web
Service"</strong> Preferences</a> tab allows you to configure the <a
href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a>
<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.) -->
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)
{
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.gui;
-
-import jalview.jbgui.GDasSourceBrowser;
-import jalview.util.MessageManager;
-import jalview.util.TableSorter;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-
-import java.awt.BorderLayout;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JTextField;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.AbstractTableModel;
-
-import org.biodas.jdas.schema.sources.CAPABILITY;
-import org.biodas.jdas.schema.sources.COORDINATES;
-import org.biodas.jdas.schema.sources.PROP;
-import org.biodas.jdas.schema.sources.VERSION;
-
-public class DasSourceBrowser extends GDasSourceBrowser
- implements Runnable, ListSelectionListener
-{
- DasSourceRegistryI sourceRegistry = null;
-
- Vector<String> selectedSources;
-
- public DasSourceBrowser(FeatureSettings featureSettings)
- {
- fs = featureSettings;
- // TODO DasSourceRegistryProvider API
- sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();
- String registry = sourceRegistry.getDasRegistryURL();
-
- registryURL.setText(registry);
-
- setSelectedFromProperties();
-
- displayFullDetails(null);
- table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
-
- filter1.addListSelectionListener(this);
- filter2.addListSelectionListener(this);
- filter3.addListSelectionListener(this);
-
- // Ask to be notified of selection changes.
- ListSelectionModel rowSM = table.getSelectionModel();
- rowSM.addListSelectionListener(new ListSelectionListener()
- {
- @Override
- public void valueChanged(ListSelectionEvent e)
- {
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- if (!lsm.isSelectionEmpty())
- {
- int selectedRow = lsm.getMinSelectionIndex();
- displayFullDetails(table.getValueAt(selectedRow, 0).toString());
- }
- }
- });
-
- table.addMouseListener(new MouseAdapter()
- {
- @Override
- public void mouseClicked(MouseEvent evt)
- {
- if (evt.getClickCount() == 2 || evt.isPopupTrigger())
- {
- editRemoveLocalSource(evt);
- }
- }
- });
-
- if (sourceRegistry.getSources() != null)
- {
- init();
- }
- }
-
- FeatureSettings fs = null;
-
- private boolean loadingDasSources;
-
- public DasSourceBrowser()
- {
- this(null);
- }
-
- @Override
- public void paintComponent(java.awt.Graphics g)
- {
- if (sourceRegistry == null)
- {
- Thread worker = new Thread(this);
- worker.start();
- }
- }
-
- void init()
- {
- List<jalviewSourceI> sources = sourceRegistry.getSources();
- int dSize = sources.size();
- Object[][] data = new Object[dSize][2];
- for (int i = 0; i < dSize; i++)
- {
- data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname
- data[i][1] = new Boolean(
- selectedSources.contains(sources.get(i).getTitle()));
- }
-
- refreshTableData(data);
- setCapabilities(sourceRegistry);
-
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- TableSorter sorter = (TableSorter) table.getModel();
- sorter.setSortingStatus(1, TableSorter.DESCENDING);
- sorter.setSortingStatus(1, TableSorter.NOT_SORTED);
- }
- });
-
- progressBar.setIndeterminate(false);
- progressBar.setVisible(false);
- addLocal.setVisible(true);
- refresh.setVisible(true);
- }
-
- public void refreshTableData(Object[][] data)
- {
- TableSorter sorter = new TableSorter(new DASTableModel(data));
- sorter.setTableHeader(table.getTableHeader());
- table.setModel(sorter);
- }
-
- void displayFullDetails(String nickName)
- {
-
- StringBuffer text = new StringBuffer(
- "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");
-
- if (nickName == null)
- {
- fullDetails.setText(text + MessageManager
- .getString("label.select_das_service_from_table"));
- return;
- }
-
- int dSize = sourceRegistry.getSources().size();
- for (jalviewSourceI ds : sourceRegistry.getSources())
- {
- if (!ds.getTitle().equals(nickName))
- {
- continue;
- }
-
- VERSION latest = ds.getVersion();
- text.append(
- "<font color=\"#0000FF\">Id:</font> " + ds.getUri() + "<br>");
- text.append("<font color=\"#0000FF\">Nickname:</font> "
- + ds.getTitle() + "<br>");
-
- text.append("<font color=\"#0000FF\">URL:</font> <a href=\""
- + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"
- + "<br>");
- if (!ds.isLocal())
- {
- if (ds.getDocHref() != null && ds.getDocHref().length() > 0)
- {
- text.append("<font color=\"#0000FF\">Site:</font> <a href=\""
- + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"
- + "<br>");
- }
-
- text.append("<font color=\"#0000FF\">Description:</font> "
- + ds.getDescription() + "<br>");
-
- text.append(
- "<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
- + ds.getEmail() + "\">" + ds.getEmail() + "</a>"
- + "<br>");
-
- text.append("<font color=\"#0000FF\">Registered at:</font> "
- + latest.getCreated() + "<br>");
-
- // TODO: Identify last successful test date
- // text.append("<font color=\"#0000FF\">Last successful test:</font> "
- // + latest.dasSources[i].getLeaseDate() + "<br>");
- }
- else
- {
- text.append("Source was added manually.<br/>");
- }
- text.append("<font color=\"#0000FF\">Labels:</font> ");
- boolean b = false;
- for (PROP labl : latest.getPROP())
- {
- if (labl.getName().equalsIgnoreCase("LABEL"))
- {
- if (b)
- {
- text.append(",");
- }
- text.append(" ");
-
- text.append(labl.getValue());
- b = true;
- }
- ;
- }
- text.append("<br>");
-
- text.append("<font color=\"#0000FF\">Capabilities:</font> ");
- CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);
- for (int j = 0; j < scap.length; j++)
- {
- text.append(scap[j].getType());
- if (j < scap.length - 1)
- {
- text.append(", ");
- }
- }
- text.append("<br>");
-
- text.append("<font color=\"#0000FF\">Coordinates:</font>");
- int i = 1;
- for (COORDINATES dcs : latest.getCOORDINATES())
- {
- text.append("<br/>" + i++ + ". ");
- text.append(dcs.getAuthority() + " : " + dcs.getSource());
- if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)
- {
- text.append(" [TaxId:" + dcs.getTaxid() + "]");
- }
- if (dcs.getVersion() != null
- && dcs.getVersion().trim().length() > 0)
- {
- {
- text.append(" {v. " + dcs.getVersion() + "}");
- }
- }
- text.append(" (<a href=\"" + dcs.getUri() + "\">" + dcs.getUri()
- + "</a>)");
- }
- text.append("</font></html>");
-
- break;
- }
-
- fullDetails.setText(text.toString());
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- fullDetailsScrollpane.getVerticalScrollBar().setValue(0);
- }
- });
- }
-
- @Override
- public void run()
- {
- loadingDasSources = true;
-
- addLocal.setVisible(false);
- refresh.setVisible(false);
- progressBar.setVisible(true);
- progressBar.setIndeterminate(true);
- setParentGuiEnabled(false);
- // Refresh the source list.
- sourceRegistry.refreshSources();
-
- init();
-
- setParentGuiEnabled(true);
- loadingDasSources = false;
-
- }
-
- private void setParentGuiEnabled(boolean b)
- {
- if (fs != null)
- {
- fs.fetchDAS.setEnabled(b);
- fs.saveDAS.setEnabled(b);
- }
- }
-
- public Vector<jalviewSourceI> getSelectedSources()
- {
- // wait around if we're still loading.
- while (sourceRegistry == null)
- {
- if (!loadingDasSources)
- {
- new Thread(this).start();
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- while (loadingDasSources)
- {
- try
- {
- Thread.sleep(5);
- } catch (Exception e)
- {
- }
- ;
- }
- ;
- }
- }
-
- Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();
- for (String source : selectedSources)
- {
- jalviewSourceI srce = sourceRegistry.getSource(source);
- if (srce != null)
- {
- selected.addElement(srce);
- }
- }
- return selected;
- }
-
- @Override
- public void refresh_actionPerformed(ActionEvent e)
- {
- saveProperties(jalview.bin.Cache.applicationProperties);
-
- Thread worker = new Thread(this);
- worker.start();
- }
-
- private void setCapabilities(DasSourceRegistryI sourceRegistry2)
- {
- Vector<String> authority = new Vector<String>();
- Vector<String> type = new Vector<String>();
- Vector<String> label = new Vector<String>();
- Vector<String> taxIds = new Vector<String>();
- authority.add("Any");
- type.add("Any");
- label.add("Any");
-
- for (jalviewSourceI ds : sourceRegistry2.getSources())
- {
- VERSION latest = ds.getVersion();
-
- for (COORDINATES cs : latest.getCOORDINATES())
- {
- if (!type.contains(cs.getSource()))
- {
- type.add(cs.getSource()); // source==category
- }
-
- if (!authority.contains(cs.getAuthority()))
- {
- authority.add(cs.getAuthority());
- }
- }
-
- for (PROP slabel : latest.getPROP())
- {
- if (slabel.getName().equalsIgnoreCase("LABEL")
- && !label.contains(slabel.getValue()))
- {
- label.add(slabel.getValue());
- }
- }
-
- }
-
- filter1.setListData(authority);
- filter2.setListData(type);
- filter3.setListData(label);
- // filter4 taxIds
-
- javax.swing.SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- filter1.setSelectedIndex(0);
- filter2.setSelectedIndex(0);
- filter3.setSelectedIndex(0);
- }
- });
- }
-
- @Override
- public void amendLocal(boolean newSource)
- {
- String url = "http://localhost:8080/", nickname = "";
- boolean seqsrc = false;
- if (!newSource)
- {
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();
- nickname = table.getValueAt(selectedRow, 0).toString();
- jalviewSourceI source = sourceRegistry.getSource(nickname);
- url = source.getUri();
- seqsrc = source.isSequenceSource();
- }
-
- JTextField nametf = new JTextField(nickname, 40);
- JTextField urltf = new JTextField(url, 40);
- JCheckBox seqs = new JCheckBox(
- MessageManager.getString("label.sequence_source"));
- seqs.setSelected(seqsrc);
- JPanel panel = new JPanel(new BorderLayout());
- JPanel pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.name:")),
- BorderLayout.CENTER);
- pane12.add(nametf, BorderLayout.EAST);
- panel.add(pane12, BorderLayout.NORTH);
- pane12 = new JPanel(new BorderLayout());
- pane12.add(new JLabel(MessageManager.getString("label.url:")),
- BorderLayout.NORTH);
- pane12.add(seqs, BorderLayout.SOUTH);
- pane12.add(urltf, BorderLayout.EAST);
- panel.add(pane12, BorderLayout.SOUTH);
-
- int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
- panel, MessageManager.getString("label.enter_local_das_source"),
- JvOptionPane.OK_CANCEL_OPTION);
-
- if (reply != JvOptionPane.OK_OPTION)
- {
- return;
- }
-
- if (!urltf.getText().endsWith("/"))
- {
- urltf.setText(urltf.getText() + "/");
- }
-
- jalviewSourceI local = sourceRegistry.createLocalSource(urltf.getText(),
- nametf.getText(), seqs.isSelected(), true);
- List sources = sourceRegistry.getSources();
- int osize = sources.size();
- int size = osize + (newSource ? 1 : 0);
-
- Object[][] data = new Object[size][2];
- DASTableModel dtm = (table != null)
- ? (DASTableModel) ((TableSorter) table.getModel())
- .getTableModel()
- : null;
- for (int i = 0; i < osize; i++)
- {
- String osrc = (dtm == null || i >= osize) ? null
- : (String) dtm.getValueAt(i, 0);
- if (!newSource && osrc != null
- && dtm.getValueAt(i, 0).equals(nickname))
- {
- data[i][0] = local.getTitle();
- data[i][1] = new Boolean(true);
- }
- else
- {
- data[i][0] = osrc;
- data[i][1] = new Boolean(selectedSources.contains(osrc));
- }
- }
- // Always add a new source at the end
- if (newSource)
- {
- data[osize][0] = local.getTitle();
- data[osize][1] = new Boolean(true);
- selectedSources.add(local.getTitle());
- }
-
- refreshTableData(data);
-
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- scrollPane.getVerticalScrollBar()
- .setValue(scrollPane.getVerticalScrollBar().getMaximum());
- }
- });
-
- displayFullDetails(local.getTitle());
- }
-
- public void editRemoveLocalSource(MouseEvent evt)
- {
- int selectedRow = table.getSelectionModel().getMinSelectionIndex();
- if (selectedRow == -1)
- {
- return;
- }
-
- String nickname = table.getValueAt(selectedRow, 0).toString();
-
- if (!sourceRegistry.getSource(nickname).isLocal())
- {
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString(
- "label.you_can_only_edit_or_remove_local_das_sources"),
- MessageManager.getString("label.public_das_source"),
- JvOptionPane.WARNING_MESSAGE);
- return;
- }
-
- Object[] options = { "Edit", "Remove", "Cancel" };
- int choice = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
- "Do you want to edit or remove " + nickname + "?",
- "Edit / Remove Local DAS Source",
- JvOptionPane.YES_NO_CANCEL_OPTION,
- JvOptionPane.QUESTION_MESSAGE, null, options, options[2]);
-
- switch (choice)
- {
- case 0:
- amendLocal(false);
- break;
- case 1:
- sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));
- selectedSources.remove(nickname);
- Object[][] data = new Object[sourceRegistry.getSources().size()][2];
- int index = 0, l = table.getRowCount();
-
- for (int i = 0; i < l; i++)
- {
- String nm;
- if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))
- {
- continue;
- }
- else
- {
- data[index][0] = nm;
- data[index][1] = new Boolean(selectedSources.contains(nm));
- index++;
- }
- }
- refreshTableData(data);
- SwingUtilities.invokeLater(new Runnable()
- {
- @Override
- public void run()
- {
- scrollPane.getVerticalScrollBar()
- .setValue(scrollPane.getVerticalScrollBar().getMaximum());
- }
- });
-
- break;
- }
- }
-
- @Override
- public void valueChanged(ListSelectionEvent evt)
- {
- // Called when the MainTable selection changes
- if (evt.getValueIsAdjusting())
- {
- return;
- }
-
- displayFullDetails(null);
-
- // Filter the displayed data sources
-
- ArrayList names = new ArrayList();
- ArrayList selected = new ArrayList();
-
- // The features filter is not visible, but we must still
- // filter the das source list here.
- // July 2006 - only 6 sources fo not serve features
- Object[] dummyFeatureList = new Object[] { "features" };
- List<jalviewSourceI> srcs = sourceRegistry.getSources();
- for (jalviewSourceI ds : srcs)
- {
-
- VERSION v = ds.getVersion();
- List<COORDINATES> coords = v.getCOORDINATES();
- if (ds.isLocal() || ((coords == null || coords.size() == 0)
- && filter1.getSelectedIndex() == 0
- && filter2.getSelectedIndex() == 0
- && filter3.getSelectedIndex() == 0))
- {
- // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
- // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
- // IS ADDED FROM THE REGISTRY
- names.add(ds.getTitle());
- selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
- continue;
- }
-
- if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))
- || !selectedInList(filter3.getSelectedValues(),
- ds.getLabelsFor(v)))
- {
- continue;
- }
-
- for (int j = 0; j < coords.size(); j++)
- {
- if (selectedInList(filter1.getSelectedValues(),
- new String[]
- { coords.get(j).getAuthority() })
- && selectedInList(filter2.getSelectedValues(), new String[]
- { coords.get(j).getSource() }))
- {
- names.add(ds.getTitle());
- selected.add(
- new Boolean(selectedSources.contains(ds.getTitle())));
- break;
- }
- }
- }
-
- int dSize = names.size();
- Object[][] data = new Object[dSize][2];
- for (int d = 0; d < dSize; d++)
- {
- data[d][0] = names.get(d);
- data[d][1] = selected.get(d);
- }
-
- refreshTableData(data);
- }
-
- private boolean selectedInList(Object[] selection, String[] items)
- {
- for (int i = 0; i < selection.length; i++)
- {
- if (selection[i].equals("Any"))
- {
- return true;
- }
- if (items == null || items.length == 0)
- {
- return false;
- }
- String sel = (items[0].startsWith("das1:") ? "das1:" : "")
- + selection[i];
- for (int j = 0; j < items.length; j++)
- {
- if (sel.equals(items[j]))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- void setSelectedFromProperties()
- {
- String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",
- "uniprot");
- StringTokenizer st = new StringTokenizer(active, "\t");
- selectedSources = new Vector();
- while (st.hasMoreTokens())
- {
- selectedSources.addElement(st.nextToken());
- }
- }
-
- @Override
- public void reset_actionPerformed(ActionEvent e)
- {
- registryURL.setText(sourceRegistry.getDasRegistryURL());
- }
-
- /**
- * set the DAS source settings in the given jalview properties.
- *
- * @param properties
- */
- public void saveProperties(Properties properties)
- {
- if (registryURL.getText() == null || registryURL.getText().length() < 1)
- {
- properties.remove(jalview.bin.Cache.DAS_REGISTRY_URL);
- }
- else
- {
- properties.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
- registryURL.getText());
- }
-
- StringBuffer sb = new StringBuffer();
- for (int r = 0; r < table.getModel().getRowCount(); r++)
- {
- if (((Boolean) table.getValueAt(r, 1)).booleanValue())
- {
- sb.append(table.getValueAt(r, 0) + "\t");
- }
- }
-
- properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,
- sb.toString());
-
- String sourceprop = sourceRegistry.getLocalSourceString();
- properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);
- }
-
- class DASTableModel extends AbstractTableModel
- {
-
- public DASTableModel(Object[][] data)
- {
- this.data = data;
- }
-
- private String[] columnNames = new String[] {
- MessageManager.getString("label.nickname"),
- MessageManager.getString("label.use_source") };
-
- private Object[][] data;
-
- @Override
- public int getColumnCount()
- {
- return columnNames.length;
- }
-
- @Override
- public int getRowCount()
- {
- return data.length;
- }
-
- @Override
- public String getColumnName(int col)
- {
- return columnNames[col];
- }
-
- @Override
- public Object getValueAt(int row, int col)
- {
- return data[row][col];
- }
-
- /*
- * JTable uses this method to determine the default renderer/ editor for
- * each cell. If we didn't implement this method, then the last column would
- * contain text ("true"/"false"), rather than a check box.
- */
- @Override
- public Class getColumnClass(int c)
- {
- return getValueAt(0, c).getClass();
- }
-
- /*
- * Don't need to implement this method unless your table's editable.
- */
- @Override
- public boolean isCellEditable(int row, int col)
- {
- // Note that the data/cell address is constant,
- // no matter where the cell appears onscreen.
- return col == 1;
-
- }
-
- /*
- * Don't need to implement this method unless your table's data can change.
- */
- @Override
- public void setValueAt(Object value, int row, int col)
- {
- data[row][col] = value;
- fireTableCellUpdated(row, col);
-
- String name = getValueAt(row, 0).toString();
- boolean selected = ((Boolean) value).booleanValue();
-
- if (selectedSources.contains(name) && !selected)
- {
- selectedSources.remove(name);
- }
-
- if (!selectedSources.contains(name) && selected)
- {
- selectedSources.add(name);
- }
- }
- }
-
- public void initDasSources()
- {
-
- Thread thr = new Thread(new Runnable()
- {
- @Override
- public void run()
- {
- // this actually initialises the das source list
- paintComponent(null); // yuk
- }
- });
- thr.start();
- while (loadingDasSources || sourceRegistry == null)
- {
- try
- {
- Thread.sleep(10);
- } catch (Exception e)
- {
- }
- ;
- }
- }
-
- /**
- * disable or enable the buttons on the source browser
- *
- * @param b
- */
- public void setGuiEnabled(boolean b)
- {
- refresh.setEnabled(b);
- addLocal.setEnabled(b);
- }
-}
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
// ///////////////////////////////////////////////////////////////////////
*/
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)
}
});
+
+ /*
+ * Javascript does not call componentResized on initial display,
+ * so do the update here
+ */
+ /** @j2sNative this.updateOverviewImage(); */
}
/*
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;
Cache.applicationProperties.setProperty("PAD_GAPS",
Boolean.toString(padGaps.isSelected()));
- dasSource.saveProperties(Cache.applicationProperties);
wsPrefs.updateAndRefreshWsMenuConfig(false);
Cache.saveProperties();
Desktop.instance.doConfigureStructurePrefs();
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)
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);
}
/**
protected JCheckBox sortByTree = new JCheckBox();
- /*
- * DAS Settings tab
- */
- protected JPanel dasTab = new JPanel();
/*
* Web Services tab
MessageManager.getString("label.editing"));
/*
- * See DasSourceBrowser for the real work of configuring this tab.
- */
- dasTab.setLayout(new BorderLayout());
- tabbedPane.add(dasTab, MessageManager.getString("label.das_settings"));
-
- /*
* See WsPreferences for the real work of configuring this tab.
*/
wsTab.setLayout(new BorderLayout());
Graphics2D g2d = (Graphics2D) hiddenImage.getGraphics();
// set background to transparent
- g2d.setComposite(AlphaComposite.Clear);
- g2d.fillRect(0, 0, width, height);
+ // g2d.setComposite(AlphaComposite.Clear);
+ // g2d.fillRect(0, 0, width, height);
// set next colour to opaque
g2d.setComposite(AlphaComposite.Src);
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++)
{
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws;
-
-import jalview.bin.Cache;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.DBRefSource;
-import jalview.datamodel.SequenceFeature;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.gui.FeatureSettings;
-import jalview.gui.JvOptionPane;
-import jalview.util.DBRefUtils;
-import jalview.util.MessageManager;
-import jalview.util.UrlLink;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.biodas.jdas.client.FeaturesClient;
-import org.biodas.jdas.client.adapters.features.DasGFFAdapter;
-import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;
-import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;
-import org.biodas.jdas.schema.features.ERRORSEGMENT;
-import org.biodas.jdas.schema.features.FEATURE;
-import org.biodas.jdas.schema.features.LINK;
-import org.biodas.jdas.schema.features.SEGMENT;
-import org.biodas.jdas.schema.features.TYPE;
-import org.biodas.jdas.schema.features.UNKNOWNFEATURE;
-import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;
-import org.biodas.jdas.schema.sources.COORDINATES;
-
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
-public class DasSequenceFeatureFetcher
-{
- SequenceI[] sequences;
-
- AlignFrame af;
-
- FeatureSettings fsettings;
-
- StringBuffer sbuffer = new StringBuffer();
-
- List<jalviewSourceI> selectedSources;
-
- boolean cancelled = false;
-
- private void debug(String mesg)
- {
- debug(mesg, null);
- }
-
- private void debug(String mesg, Exception e)
- {
- if (Cache.log != null)
- {
- Cache.log.debug(mesg, e);
- }
- else
- {
- System.err.println(mesg);
- if (e != null)
- {
- e.printStackTrace();
- }
- }
- }
-
- long startTime;
-
- private DasSourceRegistryI sourceRegistry;
-
- private boolean useJDASMultiThread = true;
-
- /**
- * Creates a new SequenceFeatureFetcher object. Uses default
- *
- * @param align
- * DOCUMENT ME!
- * @param ap
- * DOCUMENT ME!
- */
- public DasSequenceFeatureFetcher(SequenceI[] sequences,
- FeatureSettings fsettings, Vector selectedSources)
- {
- this(sequences, fsettings, selectedSources, true, true, true);
- }
-
- public DasSequenceFeatureFetcher(SequenceI[] oursequences,
- FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
- boolean checkDbrefs, boolean promptFetchDbrefs)
- {
- this(oursequences, fsettings, selectedSources2, checkDbrefs,
- promptFetchDbrefs, true);
- }
-
- public DasSequenceFeatureFetcher(SequenceI[] oursequences,
- FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,
- boolean checkDbrefs, boolean promptFetchDbrefs,
- boolean useJDasMultiThread)
- {
- this.useJDASMultiThread = useJDasMultiThread;
- this.selectedSources = new ArrayList<>();
- // filter both sequences and sources to eliminate duplicates
- for (jalviewSourceI src : selectedSources2)
- {
- if (!selectedSources.contains(src))
- {
- selectedSources.add(src);
- }
- ;
- }
- Vector sqs = new Vector();
- for (int i = 0; i < oursequences.length; i++)
- {
- if (!sqs.contains(oursequences[i]))
- {
- sqs.addElement(oursequences[i]);
- }
- }
- sequences = new SequenceI[sqs.size()];
- for (int i = 0; i < sequences.length; i++)
- {
- sequences[i] = (SequenceI) sqs.elementAt(i);
- }
- if (fsettings != null)
- {
- this.fsettings = fsettings;
- this.af = fsettings.af;
- af.setShowSeqFeatures(true);
- }
- int uniprotCount = 0;
- for (jalviewSourceI source : selectedSources)
- {
- for (COORDINATES coords : source.getVersion().getCOORDINATES())
- {
- // TODO: match UniProt coord system canonically (?) - does
- // UniProt==uniprot==UNIPROT ?
- if (coords.getAuthority().toLowerCase().equals("uniprot"))
- {
- uniprotCount++;
- break;
- }
- }
- }
-
- int refCount = 0;
- for (int i = 0; i < sequences.length; i++)
- {
- DBRefEntry[] dbref = sequences[i].getDBRefs();
- if (dbref != null)
- {
- for (int j = 0; j < dbref.length; j++)
- {
- if (dbref[j].getSource().equals(DBRefSource.UNIPROT))
- {
- refCount++;
- break;
- }
- }
- }
- }
-
- if (checkDbrefs && refCount < sequences.length && uniprotCount > 0)
- {
-
- int reply = JvOptionPane.YES_OPTION;
- if (promptFetchDbrefs)
- {
- reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
- MessageManager.getString(
- "info.you_want_jalview_to_find_uniprot_accessions"),
- MessageManager
- .getString("label.find_uniprot_accession_ids"),
- JvOptionPane.YES_NO_OPTION, JvOptionPane.QUESTION_MESSAGE);
- }
-
- if (reply == JvOptionPane.YES_OPTION)
- {
- Thread thread = new Thread(new FetchDBRefs());
- thread.start();
- }
- else
- {
- _startFetching();
- }
- }
- else
- {
- _startFetching();
- }
-
- }
-
- private void _startFetching()
- {
- running = true;
- new Thread(new FetchSeqFeatures()).start();
- }
-
- class FetchSeqFeatures implements Runnable
- {
- @Override
- public void run()
- {
- startFetching();
- setGuiFetchComplete();
- }
- }
-
- class FetchDBRefs implements Runnable
- {
- @Override
- public void run()
- {
- running = true;
- boolean isNucleotide = af.getViewport().getAlignment().isNucleotide();
- new DBRefFetcher(sequences, af, null, af.featureSettings,
- isNucleotide).fetchDBRefs(true);
-
- startFetching();
- setGuiFetchComplete();
- }
- }
-
- /**
- * Spawns Fetcher threads to add features to sequences in the dataset
- */
- void startFetching()
- {
- running = true;
- cancelled = false;
- startTime = System.currentTimeMillis();
- if (af != null)
- {
- af.setProgressBar(MessageManager.getString(
- "status.fetching_das_sequence_features"), startTime);
- }
- if (sourceRegistry == null)
- {
- sourceRegistry = Cache.getDasSourceRegistry();
- }
- if (selectedSources == null || selectedSources.size() == 0)
- {
- try
- {
- jalviewSourceI[] sources = sourceRegistry.getSources()
- .toArray(new jalviewSourceI[0]);
- String active = Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot");
- StringTokenizer st = new StringTokenizer(active, "\t");
- selectedSources = new Vector();
- String token;
- while (st.hasMoreTokens())
- {
- token = st.nextToken();
- for (int i = 0; i < sources.length; i++)
- {
- if (sources[i].getTitle().equals(token))
- {
- selectedSources.add(sources[i]);
- break;
- }
- }
- }
- } catch (Exception ex)
- {
- debug("Exception whilst setting default feature sources from registry and local preferences.",
- ex);
- }
- }
-
- if (selectedSources == null || selectedSources.size() == 0)
- {
- System.out.println("No DAS Sources active");
- cancelled = true;
- setGuiNoDassourceActive();
- return;
- }
-
- sourcesRemaining = selectedSources.size();
- FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();
- fc.setConnProps(sourceRegistry.getSessionHandler());
- // Now sending requests one at a time to each server
- ArrayList<jalviewSourceI> srcobj = new ArrayList<>();
- ArrayList<String> src = new ArrayList<>();
- List<List<String>> ids = new ArrayList<>();
- List<List<DBRefEntry>> idobj = new ArrayList<>();
- List<Map<String, SequenceI>> sqset = new ArrayList<>();
- for (jalviewSourceI _sr : selectedSources)
- {
-
- Map<String, SequenceI> slist = new HashMap<>();
- List<DBRefEntry> idob = new ArrayList<>();
- List<String> qset = new ArrayList<>();
-
- for (SequenceI seq : sequences)
- {
- Object[] idset = nextSequence(_sr, seq);
- if (idset != null)
- {
- List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];
- List<String> _qset = (List<String>) idset[1];
- if (_idob.size() > 0)
- {
- // add sequence's ref for each id derived from it
- // (space inefficient, but most unambiguous)
- // could replace with hash with _qset values as keys.
- Iterator<DBRefEntry> dbobj = _idob.iterator();
- for (String q : _qset)
- {
- SequenceI osq = slist.get(q);
- DBRefEntry dr = dbobj.next();
- if (osq != null && osq != seq)
- {
- // skip - non-canonical query
- }
- else
- {
- idob.add(dr);
- qset.add(q);
- slist.put(q, seq);
- }
- }
- }
- }
- }
- if (idob.size() > 0)
- {
- srcobj.add(_sr);
- src.add(_sr.getSourceURL());
- ids.add(qset);
- idobj.add(idob);
- sqset.add(slist);
- }
- }
- Map<String, Map<List<String>, Exception>> errors = new HashMap<>();
- Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<>();
- if (!useJDASMultiThread)
- {
- Iterator<String> sources = src.iterator();
- // iterate over each query for each source and do each one individually
- for (List<String> idl : ids)
- {
- String source = sources.next();
- FeaturesClient featuresc = new FeaturesClient(
- sourceRegistry.getSessionHandler()
- .getConnectionPropertyProviderFor(source));
- for (String id : idl)
- {
- List<String> qid = Arrays.asList(new String[] { id });
- try
- {
- DasGFFAdapter dga = featuresc.fetchData(source, qid);
- Map<List<String>, DasGFFAdapter> ers = results.get(source);
- if (ers == null)
- {
- results.put(source,
- ers = new HashMap<>());
- }
- ers.put(qid, dga);
- } catch (Exception ex)
- {
- Map<List<String>, Exception> ers = errors.get(source);
- if (ers == null)
- {
- errors.put(source,
- ers = new HashMap<>());
- }
- ers.put(qid, ex);
- }
- }
- }
- }
- else
- {
- // pass them all at once
- fc.fetchData(src, ids, false, results, errors);
- fc.shutDown();
- while (!fc.isTerminated())
- {
- try
- {
- Thread.sleep(200);
- } catch (InterruptedException x)
- {
-
- }
- }
- }
- Iterator<List<String>> idset = ids.iterator();
- Iterator<List<DBRefEntry>> idobjset = idobj.iterator();
- Iterator<Map<String, SequenceI>> seqset = sqset.iterator();
- for (jalviewSourceI source : srcobj)
- {
- processResponse(seqset.next(), source, idset.next(), idobjset.next(),
- results.get(source.getSourceURL()),
- errors.get(source.getSourceURL()));
- }
- }
-
- private void processResponse(Map<String, SequenceI> sequencemap,
- jalviewSourceI jvsource, List<String> ids, List<DBRefEntry> idobj,
- Map<List<String>, DasGFFAdapter> results,
- Map<List<String>, Exception> errors)
- {
- Set<SequenceI> sequences = new HashSet<>();
- String source = jvsource.getSourceURL();
- // process features
- DasGFFAdapter result = (results == null) ? null : results.get(ids);
- Exception error = (errors == null) ? null : errors.get(ids);
- if (result == null)
- {
- debug("das source " + source + " could not be contacted. "
- + (error == null ? "" : error.toString()));
- }
- else
- {
-
- GFFAdapter gff = result.getGFF();
- List<SEGMENT> segments = gff.getSegments();
- List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();
- List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();
- List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();
- debug("das source " + source + " returned " + gff.getTotal()
- + " responses. " + (errorsegs != null ? errorsegs.size() : 0)
- + " were incorrect segment queries, "
- + (unkfeats != null ? unkfeats.size() : 0)
- + " were unknown features "
- + (unksegs != null ? unksegs.size() : 0)
- + " were unknown segments and "
- + (segments != null ? segments.size() : 0)
- + " were segment responses.");
- Iterator<DBRefEntry> dbr = idobj.iterator();
- if (segments != null)
- {
- for (SEGMENT seg : segments)
- {
- String id = seg.getId();
- if (ids.indexOf(id) == -1)
- {
- id = id.toUpperCase();
- }
- DBRefEntry dbref = idobj.get(ids.indexOf(id));
- SequenceI sequence = sequencemap.get(id);
- boolean added = false;
- sequences.add(sequence);
-
- for (FEATURE feat : seg.getFEATURE())
- {
- // standard DAS feature-> jalview sequence feature transformation
- SequenceFeature f = newSequenceFeature(feat,
- jvsource.getTitle());
- if (!parseSeqFeature(sequence, f, feat, jvsource))
- {
- if (dbref.getMap() != null && f.getBegin() > 0
- && f.getEnd() > 0)
- {
- debug("mapping from " + f.getBegin() + " - " + f.getEnd());
- SequenceFeature vf[] = null;
-
- try
- {
- vf = dbref.getMap().locateFeature(f);
- } catch (Exception ex)
- {
- Cache.log.warn(
- "Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");
- Cache.log.warn("Mapping feature from " + f.getBegin()
- + " to " + f.getEnd() + " in dbref "
- + dbref.getAccessionId() + " in "
- + dbref.getSource());
- Cache.log.warn("using das Source " + source);
- Cache.log.warn("Exception", ex);
- }
-
- if (vf != null)
- {
- for (int v = 0; v < vf.length; v++)
- {
- debug("mapping to " + v + ": " + vf[v].getBegin()
- + " - " + vf[v].getEnd());
- sequence.addSequenceFeature(vf[v]);
- }
- }
- }
- else
- {
- sequence.addSequenceFeature(f);
- }
- }
- }
- }
- featuresAdded(sequences);
- }
- else
- {
- // System.out.println("No features found for " + seq.getName()
- // + " from: " + e.getDasSource().getNickname());
- }
- }
- }
-
- private void setGuiNoDassourceActive()
- {
-
- if (af != null)
- {
- af.setProgressBar(
- MessageManager.getString("status.no_das_sources_active"),
- startTime);
- }
- if (getFeatSettings() != null)
- {
- fsettings.noDasSourceActive();
- }
- }
-
- /**
- * Update our fsettings dialog reference if we didn't have one when we were
- * first initialised.
- *
- * @return fsettings
- */
- private FeatureSettings getFeatSettings()
- {
- if (fsettings == null)
- {
- if (af != null)
- {
- fsettings = af.featureSettings;
- }
- }
- return fsettings;
- }
-
- public void cancel()
- {
- if (af != null)
- {
- af.setProgressBar(MessageManager.getString(
- "status.das_feature_fetching_cancelled"), startTime);
- }
- cancelled = true;
- }
-
- int sourcesRemaining = 0;
-
- private boolean running = false;
-
- private void setGuiFetchComplete()
- {
- running = false;
- if (!cancelled && af != null)
- {
- // only update the progress bar if we've completed the fetch normally
- af.setProgressBar(MessageManager.getString(
- "status.das_feature_fetching_complete"), startTime);
- }
-
- if (af != null && af.featureSettings != null)
- {
- af.featureSettings.discoverAllFeatureData();
- }
-
- if (getFeatSettings() != null)
- {
- fsettings.complete();
- }
- }
-
- void featuresAdded(Set<SequenceI> seqs)
- {
- if (af == null)
- {
- // no gui to update with features.
- return;
- }
- af.getFeatureRenderer().featuresAdded();
-
- int start = af.getViewport().getRanges().getStartSeq();
- int end = af.getViewport().getRanges().getEndSeq();
- int index;
- for (index = start; index < end; index++)
- {
- for (SequenceI seq : seqs)
- {
- if (seq == af.getViewport().getAlignment().getSequenceAt(index)
- .getDatasetSequence())
- {
- af.alignPanel.paintAlignment(true, true);
- index = end;
- break;
- }
- }
- }
- }
-
- Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)
- {
- if (cancelled)
- {
- return null;
- }
- DBRefEntry[] uprefs = DBRefUtils.selectRefs(seq.getDBRefs(),
- new String[]
- {
- // jalview.datamodel.DBRefSource.PDB,
- DBRefSource.UNIPROT,
- // jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
- // sys sources
- });
- // TODO: minimal list of DAS queries to make by querying with untyped ID if
- // distinct from any typed IDs
-
- List<DBRefEntry> ids = new ArrayList<>();
- List<String> qstring = new ArrayList<>();
- boolean dasCoordSysFound = false;
-
- if (uprefs != null)
- {
- // do any of these ids match the source's coordinate system ?
- for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)
- {
-
- for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
- {
- if (DBRefUtils.isDasCoordinateSystem(csys.getAuthority(),
- uprefs[j]))
- {
- debug("Launched fetcher for coordinate system "
- + csys.getAuthority());
- // Will have to pass any mapping information to the fetcher
- // - the start/end for the DBRefEntry may not be the same as the
- // sequence's start/end
-
- System.out.println(
- seq.getName() + " " + (seq.getDatasetSequence() == null)
- + " " + csys.getUri());
-
- dasCoordSysFound = true; // break's out of the loop
- ids.add(uprefs[j]);
- qstring.add(uprefs[j].getAccessionId());
- }
- else
- {
- System.out.println("IGNORE " + csys.getAuthority());
- }
- }
- }
- }
-
- if (!dasCoordSysFound)
- {
- String id = null;
- // try and use the name as the sequence id
- if (seq.getName().indexOf("|") > -1)
- {
- id = seq.getName().substring(seq.getName().lastIndexOf("|") + 1);
- if (id.trim().length() < 4)
- {
- // hack - we regard a significant ID as being at least 4
- // non-whitespace characters
- id = seq.getName().substring(0, seq.getName().lastIndexOf("|"));
- if (id.indexOf("|") > -1)
- {
- id = id.substring(id.lastIndexOf("|") + 1);
- }
- }
- }
- else
- {
- id = seq.getName();
- }
- if (id != null)
- {
- DBRefEntry dbre = new DBRefEntry();
- dbre.setAccessionId(id);
- // Should try to call a general feature fetcher that
- // queries many sources with name to discover applicable ID references
- ids.add(dbre);
- qstring.add(dbre.getAccessionId());
- }
- }
-
- return new Object[] { ids, qstring };
- }
-
- /**
- * examine the given sequence feature to determine if it should actually be
- * turned into sequence annotation or database cross references rather than a
- * simple sequence feature.
- *
- * @param seq
- * the sequence to annotate
- * @param f
- * the jalview sequence feature generated from the DAS feature
- * @param map
- * the sequence feature attributes
- * @param source
- * the source that emitted the feature
- * @return true if feature was consumed as another kind of annotation.
- */
- protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,
- FEATURE feature, jalviewSourceI source)
- {
- SequenceI mseq = seq;
- while (seq.getDatasetSequence() != null)
- {
- seq = seq.getDatasetSequence();
- }
- if (f.getType() != null)
- {
- String type = f.getType();
- if (type.equalsIgnoreCase("protein_name"))
- {
- // parse name onto the alignment sequence or the dataset sequence.
- if (seq.getDescription() == null
- || seq.getDescription().trim().length() == 0)
- {
- // could look at the note series to pick out the first long name, for
- // the moment just use the whole description string
- seq.setDescription(f.getDescription());
- }
- if (mseq.getDescription() == null
- || mseq.getDescription().trim().length() == 0)
- {
- // could look at the note series to pick out the first long name, for
- // the moment just use the whole description string
- mseq.setDescription(f.getDescription());
- }
- return true;
- }
- // check if source has biosapiens or other sequence ontology label
- if (type.equalsIgnoreCase("DBXREF") || type.equalsIgnoreCase("DBREF"))
- {
- // try to parse the accession out
-
- DBRefEntry dbr = new DBRefEntry();
- dbr.setVersion(source.getTitle());
- StringTokenizer st = new StringTokenizer(f.getDescription(), ":");
- if (st.hasMoreTokens())
- {
- dbr.setSource(st.nextToken());
- }
- if (st.hasMoreTokens())
- {
- dbr.setAccessionId(st.nextToken());
- }
- seq.addDBRef(dbr);
-
- if (f.links != null && f.links.size() > 0)
- {
- // feature is also appended to enable links to be seen.
- // TODO: consider extending dbrefs to have their own links ?
- // TODO: new feature: extract dbref links from DAS servers and add the
- // URL pattern to the list of DB name associated links in the user's
- // preferences ?
- // for the moment - just fix up the existing feature so it displays
- // correctly.
- // f.setType(dbr.getSource());
- // f.setDescription();
- f.setValue("linkonly", Boolean.TRUE);
- // f.setDescription("");
- Vector newlinks = new Vector();
- Enumeration it = f.links.elements();
- while (it.hasMoreElements())
- {
- String elm;
- UrlLink urllink = new UrlLink(elm = (String) it.nextElement());
- if (urllink.isValid())
- {
- urllink.setLabel(f.getDescription());
- newlinks.addElement(urllink.toString());
- }
- else
- {
- // couldn't parse the link properly. Keep it anyway - just in
- // case.
- debug("couldn't parse link string - " + elm);
- newlinks.addElement(elm);
- }
- }
- f.links = newlinks;
- seq.addSequenceFeature(f);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * creates a jalview sequence feature from a das feature document
- *
- * @param feat
- * @return sequence feature object created using dasfeature information
- */
- SequenceFeature newSequenceFeature(FEATURE feat, String nickname)
- {
- if (feat == null)
- {
- return null;
- }
- try
- {
- /**
- * Different qNames for a DAS Feature - are string keys to the HashMaps in
- * features "METHOD") || qName.equals("TYPE") || qName.equals("START") ||
- * qName.equals("END") || qName.equals("NOTE") || qName.equals("LINK") ||
- * qName.equals("SCORE")
- */
- String desc = new String();
- if (feat.getNOTE() != null)
- {
- for (String note : feat.getNOTE())
- {
- desc += note;
- }
- }
-
- int start = 0, end = 0;
- float score = 0f;
-
- try
- {
- start = Integer.parseInt(feat.getSTART().toString());
- } catch (Exception ex)
- {
- }
- try
- {
- end = Integer.parseInt(feat.getEND().toString());
- } catch (Exception ex)
- {
- }
- try
- {
- Object scr = feat.getSCORE();
- if (scr != null)
- {
- score = (float) Double.parseDouble(scr.toString());
-
- }
- } catch (Exception ex)
- {
- }
-
- SequenceFeature f = new SequenceFeature(getTypeString(feat.getTYPE()),
- desc, start, end, score, nickname);
-
- if (feat.getLINK() != null)
- {
- for (LINK link : feat.getLINK())
- {
- // Do not put feature extent in link text for non-positional features
- if (f.begin == 0 && f.end == 0)
- {
- f.addLink(f.getType() + " " + link.getContent() + "|"
- + link.getHref());
- }
- else
- {
- f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "
- + link.getContent() + "|" + link.getHref());
- }
- }
- }
-
- return f;
- } catch (Exception e)
- {
- System.out.println("ERRR " + e);
- e.printStackTrace();
- System.out.println("############");
- debug("Failed to parse " + feat.toString(), e);
- return null;
- }
- }
-
- private String getTypeString(TYPE type)
- {
- return type.getContent();
- }
-
- public boolean isRunning()
- {
- return running;
- }
-
-}
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);
- }
- }
- }
- }
-
}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.dbsources.das.api;
-
-import java.util.List;
-
-import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
-
-/**
- * API for a registry that provides datasources that jalview can access
- *
- * @author jprocter
- *
- */
-public interface DasSourceRegistryI
-{
-
- List<jalviewSourceI> getSources();
-
- String getDasRegistryURL();
-
- jalviewSourceI getSource(String nickname);
-
- // TODO: re JAL-424 - introduce form where local source is queried for
- // metadata, rather than have it all provided by caller.
- jalviewSourceI createLocalSource(String uri, String name,
- boolean sequence, boolean features);
-
- boolean removeLocalSource(jalviewSourceI source);
-
- void refreshSources();
-
- String getLocalSourceString();
-
- List<jalviewSourceI> resolveSourceNicknames(List<String> sources);
-
- // TODO: refactor to jDAS specific interface
- MultipleConnectionPropertyProviderI getSessionHandler();
-}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.dbsources.das.api;
-
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-import java.util.List;
-
-import org.biodas.jdas.schema.sources.MAINTAINER;
-import org.biodas.jdas.schema.sources.VERSION;
-
-public interface jalviewSourceI
-{
-
- String getTitle();
-
- VERSION getVersion();
-
- String getDocHref();
-
- String getDescription();
-
- String getUri();
-
- MAINTAINER getMAINTAINER();
-
- String getEmail();
-
- boolean isLocal();
-
- boolean isSequenceSource();
-
- String[] getCapabilityList(VERSION v);
-
- String[] getLabelsFor(VERSION v);
-
- /**
- *
- * @return null if not a sequence source, otherwise a series of database
- * sources that can be used to retrieve sequence data for particular
- * database coordinate systems
- */
- List<DbSourceProxy> getSequenceSourceProxies();
-
- boolean isFeatureSource();
-
- /**
- * returns the base URL for the latest version of a source's DAS endpoint set
- *
- * @return
- */
- String getSourceURL();
-
- /**
- * test to see if this source's latest version is older than the given source
- *
- * @param jalviewSourceI
- * @return true if newer than given source
- */
- boolean isNewerThan(jalviewSourceI jalviewSourceI);
-
- /**
- * test if the source is a reference source for the authority
- *
- * @return
- */
- boolean isReferenceSource();
-
-}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.dbsources.das.datamodel;
-
-import jalview.bin.Cache;
-import jalview.datamodel.Alignment;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.DBRefEntry;
-import jalview.datamodel.Sequence;
-import jalview.datamodel.SequenceI;
-import jalview.util.MessageManager;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-import jalview.ws.seqfetcher.DbSourceProxy;
-import jalview.ws.seqfetcher.DbSourceProxyImpl;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.biodas.jdas.client.SequenceClient;
-import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;
-import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
-import org.biodas.jdas.client.threads.SequenceClientMultipleSources;
-import org.biodas.jdas.schema.sequence.SEQUENCE;
-import org.biodas.jdas.schema.sources.COORDINATES;
-import org.biodas.jdas.schema.sources.SOURCE;
-import org.biodas.jdas.schema.sources.VERSION;
-
-import com.stevesoft.pat.Regex;
-
-/**
- * an instance of this class is created for each unique DAS Sequence source (ie
- * one capable of handling the 'sequence' for a particular MapMaster)
- *
- * @author JimP
- *
- */
-public class DasSequenceSource extends DbSourceProxyImpl
- implements DbSourceProxy
-{
- private jalviewSourceI jsrc;
-
- protected SOURCE source = null;
-
- protected VERSION version = null;
-
- protected COORDINATES coordsys = null;
-
- protected String dbname = "DASCS";
-
- protected String dbrefname = "das:source";
-
- protected MultipleConnectionPropertyProviderI connprops = null;
-
- /**
- * DAS sources are tier 1 - if we have a direct DB connection then we should
- * prefer it
- */
- private int tier = 1;
-
- /**
- * create a new DbSource proxy for a DAS 1 source
- *
- * @param dbnbame
- * Human Readable Name to use when fetching from this source
- * @param dbrefname
- * DbRefName for DbRefs attached to sequences retrieved from this
- * source
- * @param source
- * Das1Source
- * @param coordsys
- * specific coordinate system to use for this source
- * @throws Exception
- * if source is not capable of the 'sequence' command
- */
- public DasSequenceSource(String dbname, String dbrefname, SOURCE source,
- VERSION version, COORDINATES coordsys,
- MultipleConnectionPropertyProviderI connprops) throws Exception
- {
- if (!(jsrc = new JalviewSource(source, connprops, false))
- .isSequenceSource())
- {
- throw new Exception(MessageManager.formatMessage(
- "exception.das_source_doesnt_support_sequence_command",
- new String[]
- { source.getTitle() }));
- }
- this.tier = 1 + ((jsrc.isLocal() || jsrc.isReferenceSource()) ? 0 : 1);
- this.source = source;
- this.dbname = dbname;
- this.dbrefname = dbrefname.toUpperCase();
- if (coordsys != null)
- {
- this.coordsys = coordsys;
- }
- this.connprops = connprops;
- }
-
- public String getAccessionSeparator()
- {
- return "\t";
- }
-
- public Regex getAccessionValidator()
- {
- /** ? * */
- return Regex.perlCode("m/([^:]+)(:\\d+,\\d+)?/");
- }
-
- public String getDbName()
- {
- // TODO: map to
- return dbname + " (DAS)";
- }
-
- public String getDbSource()
- {
- return dbrefname;
- }
-
- public String getDbVersion()
- {
- return coordsys != null ? coordsys.getVersion() : "";
- }
-
- public AlignmentI getSequenceRecords(String queries) throws Exception
- {
- StringTokenizer st = new StringTokenizer(queries, "\t");
- List<String> toks = new ArrayList<String>(),
- src = new ArrayList<String>(), acIds = new ArrayList<String>();
- while (st.hasMoreTokens())
- {
- String t;
- toks.add(t = st.nextToken());
- acIds.add(t.replaceAll(":[0-9,]+", ""));
- }
- src.add(jsrc.getSourceURL());
- Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();
- Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();
-
- // First try multiple sources
- boolean multiple = true, retry = false;
- do
- {
- if (!multiple)
- {
- retry = false;
- // slow, fetch one at a time.
- for (String sr : src)
- {
- System.err.println(
- "Retrieving IDs individually from das source: " + sr);
- org.biodas.jdas.client.SequenceClient sq = new SequenceClient(
- connprops.getConnectionPropertyProviderFor(sr));
- for (String q : toks)
- {
- List<String> qset = Arrays.asList(new String[] { q });
- try
- {
- DasSequenceAdapter s = sq.fetchData(sr, qset);
- Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);
- if (dss == null)
- {
- resultset.put(sr,
- dss = new HashMap<List<String>, DasSequenceAdapter>());
- }
- dss.put(qset, s);
- } catch (Exception x)
- {
- Map<List<String>, Exception> ers = errors.get(sr);
- if (ers == null)
- {
- errors.put(sr,
- ers = new HashMap<List<String>, Exception>());
- }
- ers.put(qset, x);
- }
- }
- }
- }
- else
- {
- SequenceClientMultipleSources sclient;
- sclient = new SequenceClientMultipleSources();
- sclient.fetchData(src, toks, resultset, errors);
- sclient.shutDown();
- while (!sclient.isTerminated())
- {
- try
- {
- Thread.sleep(200);
-
- } catch (InterruptedException x)
- {
- }
- }
- if (resultset.isEmpty() && !errors.isEmpty())
- {
- retry = true;
- multiple = false;
- }
- }
- } while (retry);
-
- if (resultset.isEmpty())
- {
- System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"
- + queries + "' returned no sequences.");
- return null;
- }
- else
- {
- Vector<SequenceI> seqs = null;
- for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset
- .entrySet())
- {
- for (Map.Entry<List<String>, DasSequenceAdapter> result : resset
- .getValue().entrySet())
- {
- DasSequenceAdapter dasseqresp = result.getValue();
- List<String> accessions = result.getKey();
- for (SEQUENCE e : dasseqresp.getSequence())
- {
- String lbl = e.getId();
-
- if (acIds.indexOf(lbl) == -1)
- {
- System.err.println(
- "Warning - received sequence event for strange accession code ("
- + lbl + ")");
- }
- else
- {
- if (seqs == null)
- {
- if (e.getContent().length() == 0)
- {
- System.err.println(
- "Empty sequence returned for accession code ("
- + lbl + ") from " + resset.getKey()
- + " (source is " + getDbName());
- continue;
- }
- }
- seqs = new java.util.Vector<SequenceI>();
- // JDAS returns a sequence complete with any newlines and spaces
- // in the XML
- Sequence sq = new Sequence(lbl,
- e.getContent().replaceAll("\\s+", ""));
- sq.setStart(e.getStart().intValue());
- sq.addDBRef(new DBRefEntry(getDbSource(),
- getDbVersion() + ":" + e.getVersion(), lbl));
- seqs.addElement(sq);
- }
- }
- }
- }
-
- if (seqs == null || seqs.size() == 0)
- return null;
- SequenceI[] sqs = new SequenceI[seqs.size()];
- for (int i = 0, iSize = seqs.size(); i < iSize; i++)
- {
- sqs[i] = (SequenceI) seqs.elementAt(i);
- }
- Alignment al = new Alignment(sqs);
- if (jsrc.isFeatureSource())
- {
- java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();
- srcs.addElement(jsrc);
- try
- {
- jalview.ws.DasSequenceFeatureFetcher dssf = new jalview.ws.DasSequenceFeatureFetcher(
- sqs, null, srcs, false, false, multiple);
- while (dssf.isRunning())
- {
- try
- {
- Thread.sleep(200);
- } catch (InterruptedException x)
- {
-
- }
- }
-
- } catch (Exception x)
- {
- Cache.log.error(
- "Couldn't retrieve features for sequence from its source.",
- x);
- }
- }
-
- return al;
- }
- }
-
- public String getTestQuery()
- {
- return coordsys == null ? "" : coordsys.getTestRange();
- }
-
- public boolean isValidReference(String accession)
- {
- // TODO try to validate an accession against source
- // We don't really know how to do this without querying source
-
- return true;
- }
-
- /**
- * @return the source
- */
- public SOURCE getSource()
- {
- return source;
- }
-
- /**
- * @return the coordsys
- */
- public COORDINATES getCoordsys()
- {
- return coordsys;
- }
-
- @Override
- public int getTier()
- {
- return tier;
- }
-}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.dbsources.das.datamodel;
-
-import jalview.bin.Cache;
-import jalview.ws.dbsources.das.api.DasSourceRegistryI;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.biodas.jdas.client.ConnectionPropertyProviderI;
-import org.biodas.jdas.client.SourcesClient;
-import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
-import org.biodas.jdas.dassources.Capabilities;
-import org.biodas.jdas.schema.sources.CAPABILITY;
-import org.biodas.jdas.schema.sources.SOURCE;
-import org.biodas.jdas.schema.sources.SOURCES;
-import org.biodas.jdas.schema.sources.VERSION;
-
-/**
- *
- */
-public class DasSourceRegistry
- implements DasSourceRegistryI, MultipleConnectionPropertyProviderI
-{
- // private org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
- private List<jalviewSourceI> dasSources = null;
-
- private Hashtable<String, jalviewSourceI> sourceNames = null;
-
- private Hashtable<String, jalviewSourceI> localSources = null;
-
- // public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
- public static String DEFAULT_REGISTRY = "http://www.ebi.ac.uk/das-srv/registry/das/";
-
- /**
- * true if thread is running and we are talking to DAS registry service
- */
- private boolean loadingDasSources = false;
-
- public boolean isLoadingDasSources()
- {
- return loadingDasSources;
- }
-
- @Override
- public String getDasRegistryURL()
- {
- String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
- DEFAULT_REGISTRY);
-
- if (registry.indexOf("/registry/das1/sources/") > -1)
- {
- jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
- DEFAULT_REGISTRY);
- registry = DEFAULT_REGISTRY;
- }
- if (registry.lastIndexOf("sources.xml") == registry.length() - 11)
- {
- // no trailing sources.xml document for registry in JDAS
- jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
- registry = registry.substring(0,
- registry.lastIndexOf("sources.xml")));
- }
- return registry;
- }
-
- /**
- * query the default DAS Source Registry for sources. Uses value of jalview
- * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that
- * doesn't exist.
- *
- * @return list of sources
- */
- private List<jalviewSourceI> getDASSources()
- {
-
- return getDASSources(getDasRegistryURL(), this);
- }
-
- /**
- * query the given URL for DasSources.
- *
- * @param registryURL
- * return sources from registryURL
- */
- private static List<jalviewSourceI> getDASSources(String registryURL,
- MultipleConnectionPropertyProviderI registry)
- {
- try
- {
- URL url = new URL(registryURL);
- org.biodas.jdas.client.SourcesClientInterface client = new SourcesClient();
-
- SOURCES sources = client.fetchDataRegistry(registryURL, null, null,
- null, null, null, null);
-
- List<SOURCE> dassources = sources.getSOURCE();
- ArrayList<jalviewSourceI> dsrc = new ArrayList<jalviewSourceI>();
- HashMap<String, Integer> latests = new HashMap<String, Integer>();
- Integer latest;
- for (SOURCE src : dassources)
- {
- JalviewSource jsrc = new JalviewSource(src, registry, false);
- latest = latests.get(jsrc.getSourceURL());
- if (latest != null)
- {
- if (jsrc.isNewerThan(dsrc.get(latest.intValue())))
- {
- dsrc.set(latest.intValue(), jsrc);
- }
- else
- {
- System.out.println(
- "Debug: Ignored older source " + jsrc.getTitle());
- }
- }
- else
- {
- latests.put(jsrc.getSourceURL(), Integer.valueOf(dsrc.size()));
- dsrc.add(jsrc);
- }
- }
- return dsrc;
- } catch (Exception ex)
- {
- System.out.println(
- "DAS1 registry at " + registryURL + " no longer exists");
- return new ArrayList<jalviewSourceI>();
- }
- }
-
- public void run()
- {
- getSources();
- }
-
- @Override
- public List<jalviewSourceI> getSources()
- {
- if (dasSources == null)
- {
- dasSources = getDASSources();
- }
- return appendLocalSources();
- }
-
- /**
- * generate Sources from the local das source list
- *
- */
- private void addLocalDasSources()
- {
- if (localSources == null)
- {
- // get local sources from properties and initialise the local source list
- String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
-
- if (local != null)
- {
- int n = 1;
- StringTokenizer st = new StringTokenizer(local, "\t");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- int bar = token.indexOf("|");
- if (bar == -1)
- {
- System.err.println(
- "Warning: DAS user local source appears to have no nickname (expected a '|' followed by nickname)\nOffending definition: '"
- + token + "'");
- }
- String url = token.substring(bar + 1);
- boolean features = true, sequence = false;
- if (url.startsWith("sequence:"))
- {
- url = url.substring(9);
- // this source also serves sequences as well as features
- sequence = true;
- }
- try
- {
- if (bar > -1)
- {
- createLocalSource(url, token.substring(0, bar), sequence,
- features);
- }
- else
- {
- createLocalSource(url, "User Source" + n, sequence, features);
- }
- } catch (Exception q)
- {
- System.err.println(
- "Unexpected exception when creating local source from '"
- + token + "'");
- q.printStackTrace();
- }
- n++;
- }
- }
- }
- }
-
- private List<jalviewSourceI> appendLocalSources()
- {
- List<jalviewSourceI> srclist = new ArrayList<jalviewSourceI>();
- addLocalDasSources();
- sourceNames = new Hashtable<String, jalviewSourceI>();
- if (dasSources != null)
- {
- for (jalviewSourceI src : dasSources)
- {
- sourceNames.put(src.getTitle(), src);
- srclist.add(src);
- }
- }
-
- if (localSources == null)
- {
- return srclist;
- }
- Enumeration en = localSources.keys();
- while (en.hasMoreElements())
- {
- String key = en.nextElement().toString();
- jalviewSourceI jvsrc = localSources.get(key);
- sourceNames.put(key, jvsrc);
- srclist.add(jvsrc);
- }
- return srclist;
- }
-
- /*
- *
- */
-
- @Override
- public jalviewSourceI createLocalSource(String url, String name,
- boolean sequence, boolean features)
- {
- SOURCE local = _createLocalSource(url, name, sequence, features);
-
- if (localSources == null)
- {
- localSources = new Hashtable<String, jalviewSourceI>();
- }
- jalviewSourceI src = new JalviewSource(local, this, true);
- localSources.put(local.getTitle(), src);
- return src;
- }
-
- private SOURCE _createLocalSource(String url, String name,
- boolean sequence, boolean features)
- {
- SOURCE local = new SOURCE();
-
- local.setUri(url);
- local.setTitle(name);
- local.setVERSION(new ArrayList<VERSION>());
- VERSION v = new VERSION();
- List<CAPABILITY> cp = new ArrayList<CAPABILITY>();
- if (sequence)
- {
- /*
- * Could try and synthesize a coordinate system for the source if needbe
- * COORDINATES coord = new COORDINATES(); coord.setAuthority("NCBI");
- * coord.setSource("Chromosome"); coord.setTaxid("9606");
- * coord.setVersion("35"); version.getCOORDINATES().add(coord);
- */
- CAPABILITY cap = new CAPABILITY();
- cap.setType("das1:" + Capabilities.SEQUENCE.getName());
- cap.setQueryUri(url + "/sequence");
- cp.add(cap);
- }
- if (features)
- {
- CAPABILITY cap = new CAPABILITY();
- cap.setType("das1:" + Capabilities.FEATURES.getName());
- cap.setQueryUri(url + "/features");
- cp.add(cap);
- }
-
- v.getCAPABILITY().addAll(cp);
- local.getVERSION().add(v);
-
- return local;
- }
-
- @Override
- public jalviewSourceI getSource(String nickname)
- {
- return sourceNames.get(nickname);
- }
-
- @Override
- public boolean removeLocalSource(jalviewSourceI source)
- {
- if (localSources.containsValue(source))
- {
- localSources.remove(source.getTitle());
- sourceNames.remove(source.getTitle());
- dasSources.remove(source);
- jalview.bin.Cache.setProperty("DAS_LOCAL_SOURCE",
- getLocalSourceString());
-
- return true;
- }
- return false;
- }
-
- @Override
- public void refreshSources()
- {
- dasSources = null;
- sourceNames = null;
- run();
- }
-
- @Override
- public List<jalviewSourceI> resolveSourceNicknames(List<String> sources)
- {
- ArrayList<jalviewSourceI> resolved = new ArrayList<jalviewSourceI>();
- if (sourceNames != null)
- {
- for (String src : sources)
- {
- jalviewSourceI dsrc = sourceNames.get(src);
- if (dsrc != null)
- {
- resolved.add(dsrc);
- }
- }
- }
- return resolved;
- }
-
- @Override
- public String getLocalSourceString()
- {
- if (localSources != null)
- {
- StringBuffer sb = new StringBuffer();
- Enumeration en = localSources.keys();
- while (en.hasMoreElements())
- {
- String token = en.nextElement().toString();
- jalviewSourceI srco = localSources.get(token);
- sb.append(token + "|" + (srco.isSequenceSource() ? "sequence:" : "")
- + srco.getUri() + "\t");
- }
- return sb.toString();
- }
- return "";
- }
-
- private static final Hashtable<URL, String> authStash;
- static
- {
- authStash = new Hashtable<URL, String>();
-
- try
- {
- // TODO: allow same credentials for https and http
- authStash.put(
- new URL("http://www.compbio.dundee.ac.uk/geneweb/das/myseq/"),
- "Basic SmltOm1pSg==");
- } catch (MalformedURLException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- @Override
- public MultipleConnectionPropertyProviderI getSessionHandler()
- {
- return this;
- }
-
- @Override
- public ConnectionPropertyProviderI getConnectionPropertyProviderFor(
- String arg0)
- {
-
- final ConnectionPropertyProviderI conprov = new ConnectionPropertyProviderI()
- {
- boolean authed = false;
-
- @Override
- public void setConnectionProperties(HttpURLConnection connection)
- {
- String auth = authStash.get(connection.getURL());
- if (auth != null && auth.length() > 0)
- {
- connection.setRequestProperty("Authorisation", auth);
- authed = true;
- }
- else
- {
- authed = false;
- }
- }
-
- @Override
- public boolean getResponseProperties(HttpURLConnection connection)
- {
- String auth = authStash.get(connection.getURL());
- if (auth != null && auth.length() == 0)
- {
- // don't attempt to check if we authed or not - user entered empty
- // password
- return false;
- }
- if (!authed)
- {
- if (auth != null)
- {
- // try and pass credentials.
- return true;
- }
- // see if we should try and create a new auth record.
- String ameth = connection.getHeaderField("X-DAS-AuthMethods");
- Cache.log.debug("Could authenticate to " + connection.getURL()
- + " with : " + ameth);
- // TODO: search auth string and raise login box - return if auth was
- // provided
- return false;
- }
- else
- {
- // check to see if auth was successful
- String asuc = connection
- .getHeaderField("X-DAS_AuthenticatedUser");
- if (asuc != null && asuc.trim().length() > 0)
- {
- // authentication was successful
- Cache.log.debug("Authenticated successfully to "
- + connection.getURL().toString());
- return false;
- }
- // it wasn't - so we should tell the user it failed and ask if they
- // want to attempt authentication again.
- authStash.remove(connection.getURL());
- // open a new login/password dialog with cancel button
- // set new authStash content with password and return true
- return true; //
- // User cancelled auth - so put empty string in stash to indicate we
- // don't want to auth with this server.
- // authStash.put(connection.getURL(), "");
- // return false;
- }
- }
- };
- return conprov;
- }
-
-}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.dbsources.das.datamodel;
-
-import jalview.util.MessageManager;
-import jalview.ws.dbsources.das.api.jalviewSourceI;
-import jalview.ws.seqfetcher.DbSourceProxy;
-
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
-import org.biodas.jdas.dassources.Capabilities;
-import org.biodas.jdas.dassources.utils.DasTimeFormat;
-import org.biodas.jdas.schema.sources.CAPABILITY;
-import org.biodas.jdas.schema.sources.COORDINATES;
-import org.biodas.jdas.schema.sources.MAINTAINER;
-import org.biodas.jdas.schema.sources.PROP;
-import org.biodas.jdas.schema.sources.SOURCE;
-import org.biodas.jdas.schema.sources.VERSION;
-
-public class JalviewSource implements jalviewSourceI
-{
- SOURCE source;
-
- MultipleConnectionPropertyProviderI connprov;
-
- public JalviewSource(SOURCE local2,
- MultipleConnectionPropertyProviderI connprov, boolean local)
- {
- this.connprov = connprov;
- this.local = local;
- source = local2;
- }
-
- @Override
- public String getTitle()
- {
- return source.getTitle();
- }
-
- @Override
- public VERSION getVersion()
- {
-
- return getVersionFor(source);
- }
-
- @Override
- public String getDocHref()
- {
- return source.getDocHref();
- }
-
- @Override
- public String getDescription()
- {
- return source.getDescription();
- }
-
- @Override
- public String getUri()
- {
- return source.getUri();
- }
-
- @Override
- public MAINTAINER getMAINTAINER()
- {
- return source.getMAINTAINER();
- }
-
- @Override
- public String getEmail()
- {
- return (local) ? null : source.getMAINTAINER().getEmail();
- }
-
- boolean local = false;
-
- @Override
- public boolean isLocal()
- {
- return local;
- }
-
- @Override
- public boolean isSequenceSource()
- {
- String seqcap = "das1:" + Capabilities.SEQUENCE.getName();
- for (String cp : getCapabilityList(getVersionFor(source)))
- {
- if (cp.equals(seqcap))
- {
- return true;
-
- }
- }
- return false;
- }
-
- @Override
- public boolean isFeatureSource()
- {
- String seqcap = "das1:" + Capabilities.FEATURES.getName();
- for (String cp : getCapabilityList(getVersionFor(source)))
- {
- if (cp.equals(seqcap))
- {
- return true;
-
- }
- }
- return false;
- }
-
- private VERSION getVersionFor(SOURCE ds)
- {
- VERSION latest = null;
- for (VERSION v : ds.getVERSION())
- {
- if (latest == null
- || isLaterThan(latest.getCreated(), v.getCreated()))
- {
- // TODO: das 1.6 - should just get the first version - ignore other
- // versions since not specified how to construct URL from version's URI
- // + source URI
- latest = v;
- }
- }
- return latest;
- }
-
- /**
- * compare date strings. null or unparseable dates are assumed to be oldest
- *
- * @param ref
- * @param newer
- * @return true iff ref comes before newer
- */
- private boolean isLaterThan(String ref, String newer)
- {
- Date refdate = null, newdate = null;
- if (ref != null && ref.trim().length() > 0)
- {
- try
- {
- refdate = DasTimeFormat.fromDASString(ref.trim());
-
- } catch (ParseException x)
- {
- }
- }
- if (newer != null && newer.trim().length() > 0)
- {
- try
- {
- newdate = DasTimeFormat.fromDASString(newer);
- } catch (ParseException e)
- {
- }
- }
- if (refdate != null)
- {
- if (newdate != null)
- {
- return refdate.before(newdate);
- }
- return false;
- }
- if (newdate != null)
- {
- return true;
- }
- // assume first instance of source is newest in list. - TODO: check if
- // natural ordering of source versions is newest first or oldest first
- return false;
- }
-
- public String[] getLabelsFor(VERSION v)
- {
- ArrayList<String> labels = new ArrayList<String>();
- for (PROP p : v.getPROP())
- {
- if (p.getName().equalsIgnoreCase("LABEL"))
- {
- labels.add(p.getValue());
- }
- }
- return labels.toArray(new String[0]);
- }
-
- private CAPABILITY getCapability(Capabilities capability)
- {
- for (CAPABILITY p : getVersion().getCAPABILITY())
- {
- if (p.getType().equalsIgnoreCase(capability.getName()) || p.getType()
- .equalsIgnoreCase("das1:" + capability.getName()))
- {
- return p;
- }
- }
- return null;
- }
-
- public String[] getCapabilityList(VERSION v)
- {
-
- ArrayList<String> labels = new ArrayList<String>();
- for (CAPABILITY p : v.getCAPABILITY())
- {
- // TODO: work out what to do with namespace prefix
- // does SEQUENCE == das1:SEQUENCE and das2:SEQUENCE ?
- // for moment, just show all capabilities...
- if (p.getType().startsWith("das1:"))
- {
- labels.add(p.getType());
- }
- }
- return labels.toArray(new String[0]);
- }
-
- @Override
- public List<DbSourceProxy> getSequenceSourceProxies()
- {
- if (!isSequenceSource())
- {
- return null;
- }
- ArrayList<DbSourceProxy> seqsources = new ArrayList<DbSourceProxy>();
- if (!local)
- {
- VERSION v = getVersion();
- Map<String, COORDINATES> latestc = new Hashtable<String, COORDINATES>();
- for (COORDINATES cs : v.getCOORDINATES())
- {
- COORDINATES ltst = latestc.get(cs.getUri());
- if (ltst == null || ltst.getVersion() == null
- || (ltst.getVersion() != null && cs.getVersion() != null
- && isLaterThan(ltst.getVersion(), cs.getVersion())))
- {
- latestc.put(cs.getUri(), cs);
- }
- }
- for (COORDINATES cs : latestc.values())
- {
- DasSequenceSource ds;
- /*
- * if (css == null || css.length == 0) { // TODO: query das source
- * directly to identify coordinate system... or // have to make up a
- * coordinate system css = new DasCoordinateSystem[] { new
- * DasCoordinateSystem() }; css[0].setName(d1s.getNickname());
- * css[0].setUniqueId(d1s.getNickname()); } for (int c = 0; c <
- * css.length; c++) {
- */
- try
- {
- seqsources.add(ds = new DasSequenceSource(
- getTitle() + " (" + cs.getAuthority() + " "
- + cs.getSource()
- + (cs.getVersion() != null ? " " + cs.getVersion()
- : "")
- + ")",
- cs.getAuthority(), source, v, cs, connprov));
- if (seqsources.size() > 1)
- {
- System.err.println("Added another sequence DB source for "
- + getTitle() + " (" + ds.getDbName() + ")");
- }
- } catch (Exception e)
- {
- System.err.println("Ignoring sequence coord system " + cs + " ("
- + cs.getContent() + ") for source " + getTitle()
- + "- threw exception when constructing fetcher.\n");
- e.printStackTrace();
- }
- }
- }
- else
- {
- try
- {
- seqsources.add(new DasSequenceSource(getTitle(), getTitle(), source,
- getVersion(), null, connprov));
- } catch (Exception e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- if (seqsources.size() > 1)
- {
- // sort by name
- DbSourceProxy[] tsort = seqsources.toArray(new DasSequenceSource[0]);
- String[] nm = new String[tsort.length];
- for (int i = 0; i < nm.length; i++)
- {
- nm[i] = tsort[i].getDbName().toLowerCase();
- }
- jalview.util.QuickSort.sort(nm, tsort);
- seqsources.clear();
- for (DbSourceProxy ssrc : tsort)
- {
- seqsources.add(ssrc);
- }
- }
- return seqsources;
- }
-
- @Override
- public String getSourceURL()
- {
- try
- {
- // kind of dumb, since
- // org.biodas.jdas.dassources.utils.VersionAdapter.getSourceUriFromQueryUri()
- // does this,
- // but this way, we can access non DAS 1.6 compliant sources (which have
- // to have a URL like <sourcename>/das/ and cause a validation exception)
-
- for (CAPABILITY cap : getVersion().getCAPABILITY())
- {
- String capname = cap.getType()
- .substring(cap.getType().indexOf(":") + 1);
- int p = cap.getQueryUri().lastIndexOf(capname);
- if (p < -1)
- {
- throw new Exception(MessageManager.formatMessage(
- "exception.invalid_das_source", new String[]
- { source.getUri() }));
- }
- if (cap.getQueryUri().charAt(p) == '/')
- {
- p--;
- }
- return cap.getQueryUri().substring(0, p);
- }
- } catch (Exception x)
- {
- System.err.println("Serious: Couldn't get the URL for source "
- + source.getTitle());
- x.printStackTrace();
- }
- return null;
- }
-
- @Override
- public boolean isNewerThan(jalviewSourceI other)
- {
- return isLaterThan(getVersion().getCreated(),
- other.getVersion().getCreated());
- }
-
- @Override
- public boolean isReferenceSource()
- {
- // TODO check source object for indication that we are the primary for a DAS
- // coordinate system
- return false;
- }
-}
* 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;
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"));
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.seqfetcher;
-
-import static org.testng.Assert.assertTrue;
-
-import jalview.bin.Cache;
-import jalview.gui.JvOptionPane;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-public class DasSequenceFetcher
-{
-
- @BeforeClass(alwaysRun = true)
- public void setUpJvOptionPane()
- {
- JvOptionPane.setInteractiveMode(false);
- JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
- }
-
- @Test(groups = { "Network" })
- public void testDasRegistryContact()
- {
- Cache.getDasSourceRegistry().refreshSources();
- assertTrue(Cache.getDasSourceRegistry().getSources().isEmpty(),
- "Expected to find no DAS sources at the registry. Check config.");
- }
-
-}