<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="utils"/>
+ <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/activation.jar"/>
<classpathentry kind="lib" path="lib/axis.jar" sourcepath="D:/axis-1_2RC2-src/axis-1_2RC2"/>
</classpathentry>
<classpathentry kind="lib" path="lib/miglayout-4.0-swing.jar"/>
<classpathentry kind="lib" path="lib/jswingreader-0.3.jar" sourcepath="/jswingreader"/>
- <classpathentry kind="lib" path="lib/min-jaba-client.jar"/>
<classpathentry kind="lib" path="lib/commons-codec-1.3.jar"/>
+ <classpathentry kind="lib" path="lib/min-jaba-client-2.0.jar" sourcepath="/clustengine2"/>
<classpathentry kind="lib" path="lib/Jmol-12.2.4.jar"/>
<classpathentry kind="lib" path="appletlib/JmolApplet-12.2.4.jar"/>
+ <classpathentry kind="lib" path="lib/jdas-1.0.4.jar"/>
+ <classpathentry kind="lib" path="lib/spring-core-3.0.5.RELEASE.jar"/>
+ <classpathentry kind="lib" path="lib/spring-web-3.0.5.RELEASE.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/plugin.jar"/>
+ <classpathentry kind="lib" path="/Users/jimp/git/jalview_clean/lib/VARNAv3-9-dev.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="classes"/>
</classpath>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="jalview"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_ANT_TARGETS" value="buildindices,"/>
+<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${build_project}/build.xml"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
</dictionary>
</arguments>
</buildCommand>
- <buildCommand>
- <name>org.codehaus.groovy.eclipse.groovyBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
+ <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>de.tud.st.ispace.builder.ISpaceNature</nature>
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
- <nature>org.codehaus.groovy.eclipse.groovyNature</nature>
</natures>
</projectDescription>
--- /dev/null
+Normalised logo feature todo
+
+* add gui switches in applet for normalised logo display
+* add flags for normalised logo display to AnnotationFile and Jalview Project
+* add preference for application
+* consider rationalising flag model for N types of consensus/logo calculation methods
+
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
vamsas-client.jar
wsdl4j.jar
xercesImpl.jar
<?xml version="1.0"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<title>Jalview RNA Support</title>
+<body>
+<h1>
+Jalview RNA Support
+</h1>
+<p>
+Jalview RNA support was first added during a
+<a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2010">2010 Google Summer of Code Project</a> by
+Lauren Lui (see her <a href="https://www.nescent.org/wg_phyloinformatics/PhyloSoC:Extending_Jalview_to_Support_RNA_Alignment_Annotation_and_Secondary_Structure_Visualization">
+NESCent wiki page</a> and the project <a href="http://jalview-rnasupport.blogspot.com/">blog</a>).
+</p>
+<h2>What was added</h2>
+<p>
+<ul>
+<li>Recognition of ".stk" and ".sto" extensions for Stockholm file format.</li>
+<li>Purine/Pyrimidine colour scheme.</li>
+<li>Colouring by RNA helices. Helices are determined from the secondary structure line written in WUSS format in Stockholm files.</li>
+<li>Ability to fetch sequences from RFAM.</li>
+<li>Visualization of RNA secondary structure in WUSS format (from input file) and RNA helices in the
+annotation panel.</li>
+</ul>
+</p>
+<p>In 2011, Jan Engelhardt was supported by <a href="http://socghop.appspot.com/gsoc/program/home/google/gsoc2011">GSOC</a> to extend Lauren's work, with <a href="https://www.nescent.org/wg_phyloinformatics/PhyloSoC:_Extending_Jalview_support_for_handling_RNA">support for viewing secondary structure in VARNA and visualizing base pair contact conservation</a>.
+</p>
+<h2>What Jan added</h2>
+<p>
+<ul>
+<li>Enable RNA secondary structure annotation to be imported/exported through Jalview annotation files</li>
+<li>Incorporated <a href="varna.lri.fr">VARNA</a> into the desktop application</li>
+<li>Added a new base pair consensus histogram and sequence logo annotation row</li>
+</ul>
+</p>
+<h2>TODO</h2>
+<h3>Secondary Structure Visualization/Annotation</h3>
+<ul>
+<li>Detection of pseudoknots and tetraloops </li>
+<li>Update colouring of RNA helices in annotation panel when "By RNA helices" colouring is selected</li>
+<li>Editing of secondary structure line</li>
+<li>Update helix colouring when secondary structure changes.</li>
+<li>Support per sequence in RNA secondary structure annotation</li>
+</ul>
+
+<h3>Colour schemes</h3>
+<ul>
+<li>Coloring scheme for pseudoknots</li>
+<li>Covariation colour scheme similar to RFAM's</li>
+<li>Coloring schemes from other MSA viewers, like 4Sale and Assemble</li>
+<li>Highlight positions in alignments that break base pairing specified in the secondary structure line</li>
+</ul>
+<h3>Embed VARNA, An RNA Secondary Structure Viewer</h3>
+<ul>
+<li>The homepage for VARNA can be found <a href="http://varna.lri.fr/">here</a>.</li>
+<li>Hook VARNA into Jalview</li>
+<li>Ability to port RNA secondary structure (e.g. from Stockholm files) into VARNA</li>
+<li>Mouse over and selections get highlighted in the linked views</li>
+</ul>
+<h3>Miscellaneous</h3>
+<ul>
+<li>Add changes done to the main gui to the applet gui</li>
+<li>Add export of Stockholm file format</li>
+</ul>
+</p>
+</body>
+</html>
+
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<p>
You will need the following (hopefully):<br>
<ul>
-<li>Java development kit (we used JDK1.5SE but JDK1.6 will work too,
-and maybe even jikes).</li>
+<li>Java development kit (JDK1.6 is the recommended platform for developing with Jalview, although JDK1.7 seems to work too!).</li>
<li>Ant (we think 1.5.4 is quite sufficient to use the simple build
-file supplied).</li>
+file supplied, and it seems to work with later versions e.g. 1.7).</li>
</ul>
With any luck, after setting your paths and JAVA_HOME correctly, you
just need to change to the Jalview directory and run ant (this works
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<html>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
--- /dev/null
+# STOCKHOLM 1.0
+
+#=GF ID SECIS_1
+#=GF AC RF00031
+#=GF DE Selenocysteine insertion sequence 1
+#=GF AU Griffiths-Jones SR
+#=GF GA 20.0
+#=GF NC 0.0
+#=GF TC 22.6
+#=GF PI SECIS
+#=GF SE Gautheret D, PMID:12458087
+#=GF SS Published; PMID:12458087
+#=GF TP Cis-reg;
+#=GF BM cmbuild -F CM SEED; cmcalibrate --mpi -s 1 CM
+#=GF BM cmsearch -Z 169604 -E 1000 --toponly CM SEQDB
+#=GF DR SO:1001274 SO:SECIS_element
+#=GF DR GO:0001514 GO:selenocysteine incorporation
+#=GF RN [1]
+#=GF RM 8634917
+#=GF RT A novel RNA structural motif in the selenocysteine insertion element
+#=GF RT of eukaryotic selenoprotein mRNAs.
+#=GF RA Walczak R, Westhof E, Carbon P, Krol A;
+#=GF RL RNA 1996;2:367-379.
+#=GF RN [2]
+#=GF RM 12458087
+#=GF RT A survey of metazoan selenocysteine insertion sequences.
+#=GF RA Lambert A, Lescure A, Gautheret D;
+#=GF RL Biochimie 2002;84:953-959.
+#=GF CC The incorporation of selenocysteine into a protein sequence
+#=GF CC is directed by an in-frame UGA codon (usually a stop codon)
+#=GF CC within the coding region of the mRNA. Selenoprotein mRNAs
+#=GF CC contain a conserved secondary structure in the 3' UTR that
+#=GF CC is required for the distinction of UGA stop from UGA
+#=GF CC selenocysteine. The selenocysteine insertion sequence
+#=GF CC (SECIS) is around 60 nt in length and adopts a hairpin
+#=GF CC structure which is sufficiently well-defined and conserved
+#=GF CC to act as a computational screen for selenoprotein genes [2].
+#=GF WK http://en.wikipedia.org/wiki/SECIS_element
+#=GF SQ 61
+
+#=GS D.melanogaster.1 AC AY119185.1/838-902
+#=GS D.melanogaster.2 AC AC092237.1/57223-57161
+#=GS D.melanogaster.3 AC AY060611.1/560-627
+#=GS O.niloticus.1 AC Y11109.1/1272-1330
+#=GS O.niloticus.2 AC Y11109.1/927-987
+#=GS O.niloticus.3 AC Y11111.1/1260-1324
+#=GS D.rerio.1 AC AF322071.1/1577-1642
+#=GS X.laevis.1 AC L28111.1/1299-1365
+#=GS G.gallus.1 AC AF125575.1/5781-5843
+#=GS G.gallus.2 AC Y11110.1/1218-1277
+#=GS G.gallus.3 AC Y11273.1/1139-1211
+#=GS M.musculus.1 AC AF195142.1/461-524
+#=GS M.musculus.2 AC AF021345.1/10097-10160
+#=GS M.musculus.3 AC X03920.1/1172-1235
+#=GS M.musculus.4 AC AF096875.1/5504-5568
+#=GS M.musculus.5 AC AF241527.2/359-424
+#=GS M.musculus.6 AC AF136399.1/1808-1868
+#=GS M.musculus.7 AC X84742.1/5239-5302
+#=GS M.musculus.8 AC AF288740.1/1291-1357
+#=GS M.musculus.9 AC AF274027.1/835-900
+#=GS M.musculus.10 AC AB030643.1/4176-4241
+#=GS M.musculus.11 AC AL645723.11/192421-192359
+#=GS M.musculus.12 AC AC002327.1/156204-156268
+#=GS M.musculus.13 AC AF333036.1/2190-2249
+#=GS M.musculus.14 AC U43285.1/2009-2075
+#=GS R.norvegicus.1 AC X57999.1/1526-1586
+#=GS R.norvegicus.2 AC M63574.1/1465-1528
+#=GS R.norvegicus.3 AC AF390544.1/1076-1142
+#=GS R.norvegicus.4 AC AF072865.1/1887-1947
+#=GS R.norvegicus.5 AC X12367.1/703-764
+#=GS R.norvegicus.6 AC U25264.1/366-432
+#=GS R.norvegicus.7 AC L24896.1/600-665
+#=GS H.sapiens.1 AC AF201385.1/3055-3117
+#=GS H.sapiens.2 AC AL049837.4/130674-130738
+#=GS H.sapiens.3 AC U67171.1/375-442
+#=GS H.sapiens.4 AC AF195141.1/689-759
+#=GS H.sapiens.5 AC X53463.1/847-903
+#=GS H.sapiens.6 AC AF093774.1/5851-5916
+#=GS H.sapiens.7 AC X58295.1/1384-1453
+#=GS H.sapiens.8 AC AL833145.1/1479-1545
+#=GS H.sapiens.9 AC S48220.1/1731-1788
+#=GS H.sapiens.10 AC X71973.1/730-791
+#=GS H.sapiens.11 AC AF166127.1/1919-1981
+#=GS H.sapiens.12 AC U43286.1/2054-2120
+#=GS H.sapiens.13 AC BC003127.1/865-928
+#=GS H.sapiens.14 AC S79854.1/1605-1666
+#=GS H.sapiens.15 AC X13710.1/946-1008
+#=GS B.taurus.1 AC D88033.3/5711-5774
+#=GS B.taurus.2 AC D25220.1/1493-1556
+#=GS B.taurus.3 AC AB017534.1/661-726
+#=GS B.taurus.4 AC AB032826.1/1401-1464
+#=GS B.taurus.5 AC AB022283.1/1669-1729
+#=GS B.taurus.6 AC AF053984.1/1951-2017
+#=GS B.taurus.7 AC X13684.1/700-760
+#=GS O.aries.1 AC U67853.1/375-442
+#=GS S.scrofa.1 AC AF380118.1/366-433
+#=GS S.scrofa.2 AC L12743.1/694-758
+#=GS S.scrofa.3 AC AF532927.1/678-740
+#=GS S.scrofa.4 AC X76008.1/2709-2772
+#=GS C.elegans.1 AC U61947.2/4246-4309
+#=GS S.mansoni.1 AC L37762.1/2940-3006
+
+D.melanogaster.1 G.AGCC.CU...AUGAUCGAUGAUUGG.CAAA.UCCUCUC..GAGG..A.......ACCGAUC.G.U.UGAGAA..CCCCU.....UUGCCUU
+#=GR D.melanogaster.1 SS ................(((((((((((......((((......)))..)........)))))).).).)))......................
+D.melanogaster.2 C.AUUCAACU.UAUGAGGAUUAUUUCU.UAAA.GGCCUCU...GGC..U.......CGGAAAU.A.G.UCUGAA...CCU........UAUUG
+#=GR D.melanogaster.2 SS ................(((((((((((......((((......)))..)........)))))).).).)))......................
+D.melanogaster.3 G.UGGCGCU..UAUGACGCAGUUGUCU.UAAA.CUCGAAC..UCGA.GC........GGGCAA.U.U.GCUGAU...UACG...AUUAACCAC
+#=GR D.melanogaster.3 SS (.(((...(....((((((((((((((......((((......))).).........)))))).).).)).).)...)).....)....))))
+O.niloticus.1 G.UUUCUCA...GUGAAGGCUACAGAU.UAAA..CCUCU....GGC...........CUCUGG.A.G.CCAGAU..GCAUU.......GAAAC
+#=GR O.niloticus.1 SS ......(((...(((..(((((.((..........)).)....)))...........)((((.......))))....)))).......))...
+O.niloticus.2 U.GUUUAUU..AAUGACGGCUACAGAU.UAAA..CCUUU....AGC...........CUCUGG.A.G.CCAGAU..GCAUU......CAAACA
+#=GR O.niloticus.2 SS ..((((.....((((..(((((.((..........)).)....)))...........)((((.......))))....)))).......)))).
+O.niloticus.3 G.UGUCUCU...GUGAAGUUCGGUUUU.UAAA.AGGGUCA...UCC..A.......GAAAACC.G.ACACUGAU..GUUUC......CGACAC
+#=GR O.niloticus.3 SS (.((((..........(((((((((((.(......((.......))..........))))))).).).))).................)))))
+D.rerio.1 A.UGUGGUCUUUAUGAAGGCAGGUGCA.GAAA.CUAUGCA...CUA.GU........GGUGUC.U.G.UCUGAU..GUUUG.......GCCAU
+#=GR D.rerio.1 SS ...((((((.......(((((((..(.....(.(((........)).)).........)..)).).).))).........).......)))))
+X.laevis.1 G.UGUUUGCA.AAUGACGACCGAUUUU.GAAA.UGGUCUCACGGCC..A.......AAAACUC.GUG.UCCGAC...AUC........AACCC
+#=GR X.laevis.1 SS .................((((((.(((......(((((....))))..)........))).)).).).)).......................
+G.gallus.1 G.UGUGUUU...AUGAAGAGCACUAAC.AAAA.GAGUAAU.UGACU..C.......AGUUGGU.G.U.UCAGAU..GCU.........CUCAC
+#=GR G.gallus.1 SS (.((.(..(...((...((((((((((......((((......)))..)........)))))).).).))..))..)...........).)))
+G.gallus.2 U.AUUUGUC...AUGACAGUCACAGCA.UAAA..GCGCA....GAC...........GGCUGU.G.A.CCUGAU..UUUAG......AAAAUA
+#=GR G.gallus.2 SS ................((((((((((................................))))).).)..))).....................
+G.gallus.3 U.AUUUCUU..UGUGAUGACCGAUUUU.GAAA.UGGGUUU...CUC..UAAUGCCAGGAAAUC.GUG.UCUGAU...GUUG.....UCAAGUA
+#=GR G.gallus.3 SS ......(((...(..((((((((((((......((((((..........))).))).)))))).).).)).......)).......).)))..
+M.musculus.1 G.UCACCGA...AUGAUCUGCUCUGGU.CAAA.UCCUUCU...AUG..C......CAGCCAGG.G.U.GGUGAU..GACCC.......GUGAC
+#=GR M.musculus.1 SS (.((((.(....((.(((.((((((((..............................)))))).).).))).)).....)........)))))
+M.musculus.2 G.UUACAUU..AAUGAGAACAGAAACA.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU..AGCUU.......GUAAU
+#=GR M.musculus.2 SS (.(((((..........(((((((((........(((......)))............))))).).).))..........).......)))))
+M.musculus.3 G.GUUCUUC..CAUGAUGGUGUUUCCUCUAAA..UUUGC....ACG...........GAGAAA.C.A.CCUGAU.UUCCAG.....GAAAAUC
+#=GR M.musculus.3 SS (.(((.(((..(..((.((((((((.(((................)...........)))))).).).))......))..).....)))))))
+M.musculus.4 G.UGUGCGA...AUGAUAACUACUGAC.GAAA.GAGCUGU.CUGCU..C.......AGUCUGU.G.G.UUGGAU...GUAG......UCACAC
+#=GR M.musculus.4 SS (.(((((.........(((((((.(((......((((......)))..)........))).)).).).))).........).......)))))
+M.musculus.5 G.CCGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUUA...GAC..C.....UGUGGUCUU.U.C.CUCGAU..GUUCC......UGCGGC
+#=GR M.musculus.5 SS (.((((..(...((...((((((((((.(.....(((......)))..........))))))).).).))..))..)...........)))))
+M.musculus.6 G.UCAGAUG...AUGAUGGCCUGGGCA.GAAA.CCCCAUG..UGGG..C........CGCCCA.G.G.UUUGAA...CCC........CUGGC
+#=GR M.musculus.6 SS (.((((...........(((((((((..(.....(((......)))..).........))))).).).))..................)))))
+M.musculus.7 G.UGUCUCU...AUGAAGGAGGGGCCC.GAAG.CCCUUGU...GGG..C........GGGCCU.C.C.CCUGAG...CCCG....UCUGUGGU
+#=GR M.musculus.7 SS ................(((.(((((((....(.(((.......)))..)........)))))).)...)))..(...(((........).)))
+M.musculus.8 U.UUGCAUU..AAUGAGGAUUACACAG.AAAA.CCUUUGU..UAAG.GA.......CUUGUGU.AGA.UCUGAU..AAUUG.......GCAAA
+#=GR M.musculus.8 SS ..((((......((.(((.((((((((......((((......))).).........)))))).))..))).))..............)))).
+M.musculus.9 C.CGGCACU..CAUGAAGGUCUGCUUG.AAAA.CCAGCCU..GCUG.GU........GGGGCA.G.U.CCUGAG.GACCUG.......GCGUG
+#=GR M.musculus.9 SS (.(((..((..((....((.((((((.....(.((((......))).)).........))))).)...))))))...)).).......)....
+M.musculus.10 C.CGGCACU..CAUGAAGGUCUGCCUG.AAAA.CCAGCCU..GCUG.GU........GGGGCA.G.U.CCUGAG.GACCUG.......GCGUG
+#=GR M.musculus.10 SS (.(((..((..((....((.((((((.....(.((((......))).)).........))))).)...))))))...)).).......)....
+M.musculus.11 U.AUUUGUG..UAUGAUGGUCACAGUG.UAAA..GUUCC....CAC...........AGCUGU.G.A.CUUGAU..UUUUA....AAAAUGUC
+#=GR M.musculus.11 SS (.((((...........((((((((((.(...............))...........).)))).).).))................)))))..
+M.musculus.12 C.UCAGCAG..GAUGAUGAGAAGGGCU.GAAA.UGCUGCC..AAAC..C.......AGGUCCU.U.U.UCUGAU..GGUGG.......CUGGG
+#=GR M.musculus.12 SS (.(((((..........((((((((((......((....)..)..............)))))).).).))..........).......)))))
+M.musculus.13 C.AUGCGUC..CAUGAAGUCACUGGCC.UCAA.GCCCAA....GUG.GU........GGGCAG.U.G.ACAGAA...GA.........GCUGC
+#=GR M.musculus.13 SS (.(((......))))..(((((((.((......(((.........).))........)).))).).).)).......................
+M.musculus.14 C.UCUGAUA...AUGAUGUCUCUCCCU.CUAA.CUCCCAGUAAGGA..C........UGGGAG.A.G.GCUGAACAAACCU.......CAGAG
+#=GR M.musculus.14 SS (.(((((.........(((.((..(((.(.....(((((((....)..)........)))))).).).)..)))))....).......)))))
+R.norvegicus.1 A.UAUUUGUU.UAUGAUGGUCACAGUG.UAAA..GUUCA....CAC...........AGCUGU.G.A.CUUGAU..UUUUA.......AAAAU
+#=GR R.norvegicus.1 SS ....((((.........((((((((((.(...............))...........).)))).).).)).........)).......))...
+R.norvegicus.2 G.UUACAUU..GAUGAGAACAGAAACA.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU..AGCUC.......GUAAU
+#=GR R.norvegicus.2 SS ............((((((((((((((........(((......)))............))))).).).))........))).......))...
+R.norvegicus.3 U.UUGCAUU..AAUGAGGAUUACACAG.AAAA.CCUUUGU..UAAGGGU........UUGUGUCG.A.UCUGCU..AAUUG.......GCAAA
+#=GR R.norvegicus.3 SS ..((((..........(((((((((((.(....((((......)))).)........)))))).).).))).................)))).
+R.norvegicus.4 G.UCAGAUG...AUGACGGCCUGUGCA.GAAA.CCCCCAC.GUGGG..C........UGC.CA.G.G.UUUGAA...CCC........CUGGC
+#=GR R.norvegicus.4 SS (.(((........)))).(((..((...(.......)..).)..))..).........((.((.(.(............)........)))))
+R.norvegicus.5 G.UUUUUCC...AUGACGGUGUUUCCUCUAAA..UUUAC....AUG...........GAGAAA.C.A.CCUGAU.UUCCAG......AAAAAU
+#=GR R.norvegicus.5 SS (.((((((......(((((((((((.((((..............))...........)))))).).).)).).).)....)......))))))
+R.norvegicus.6 G.CCGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUCA.AAGAC..C.....UGUGGUCUU.U.C.UUCGAU..GUUCU.......GCGGC
+#=GR R.norvegicus.6 SS (.((((..(...((((..(((((((((.(.....(((......)))..........))))))).).).))).))..)...........)))))
+R.norvegicus.7 C.CGGCACU..CAUGACGGUCUGCCUG.AAAA.CCAGCCC..GCUG.GU........GGGGCA.G.U.CCCGAG.GACCUG.......GCGUG
+#=GR R.norvegicus.7 SS (.(((..((..(.....((.((((((.....(.((((......))).)).........))))).)...)).)))...)).).......)....
+H.sapiens.1 G.CCAGAUG...AUGACGACCUGGGUG.GAAA.CCUACCC.UGUGG..G........CACCCA.U.G.UCCGAG...CCCC.......CUGGC
+#=GR H.sapiens.1 SS (.((((...........(((.((((((......(((((....))))..)........))))))...).))..................)))))
+H.sapiens.2 G.UGUGCGG...AUGAUAACUACUGAC.GAAA.GAGUCAU.CGACU..C.......AGUUAGU.G.G.UUGGAU...GUAG......UCACAU
+#=GR H.sapiens.2 SS (.(((((.........(((((((((((......(((((....))))..)........)))))).).).))).........).......)))))
+H.sapiens.3 G.ACGCUUC...AUGAUAGGAAGGACU.GAAA.AGUCUUG.UGGAC..A.....CCUGGUCUU.U.C.CCUGAU..GUUCU......CGUGGC
+#=GR H.sapiens.3 SS ..(((...(...((.(..(((((((((.......(((......)))...........)))))).).).).).))..)..........)))...
+H.sapiens.4 G.ACUGACAU.UAUGAAGGCCUGUACU.GAAG.ACAGCAA..GCUG..U.......UAGUACA.G.A.CCAGAU..GCUUU..CUUGGCAGGC
+#=GR H.sapiens.4 SS ...(((.((.....(((((((((((((....(.((((......)))..).......))))))).)...........)))))..).)).)))..
+H.sapiens.5 U.UCACAGA...AUGAUGGCACCUUCC.UAA...ACCCU....CAU...........GGGUGG.U.G.UCUGAG..AGGC........GUGAA
+#=GR H.sapiens.5 SS ..((((...........((((((...........((((...................)))))).).).))..................)))).
+H.sapiens.6 G.UGUGCGG...AUGAUAACUACUGAC.GAAAGAGUCAUC...GAC..C.....UCAGUUAGU.G.G.UUGGAU...GUAG......UCACAU
+#=GR H.sapiens.6 SS (.(((((.........(((((((((((....((.(((......)))..).....)..)))))).).).))).........).......)))))
+H.sapiens.7 U.GGCGUCUU.CAUGAGGGAGGGGCCC..AAA.GCCCUUG..UGGG..C........GGACCU.C.C.CCUGAG...CCUGUCUGAGGGGCCA
+#=GR H.sapiens.7 SS ..(((.((((.((...((((((((.........((((......)))..)...............).).)))......)))...))))))))).
+H.sapiens.8 U.UUGCUUU..AAUGAGAAUAGAAACG.UAAA..CUAUGA.CCUAG.G.........GGUUUC.U.G.UUGGAU.AAUUAG.....CAGUUUA
+#=GR H.sapiens.8 SS ..(((((..........(((((((((........(((......)))............))))).).).)).........)).....)))....
+H.sapiens.9 U.AUUUGUU..UAUGAUGGCCACAGCC.UAAA..GUACA....CAC...........GGCUGU.G.A.CUUGAU...UCA........AAAGA
+#=GR H.sapiens.9 SS .............(((.((.(((((((..............................)))))).)...)).......))).............
+H.sapiens.10 C.CGGCACU..CAUGACGGCCUGCCUG.CAAA..CCUGC....UGG..U........GGGGCA.G.A.CCCGAA.AAUCCA.......GCGUG
+#=GR H.sapiens.10 SS ...((((....(......)..))))............((....(((..(........(((........))))......))).......))...
+H.sapiens.11 G.CCGGAUG...AUGACGACCUGGGUG.GAAA.CCUACCC.UGUGG..G........CACCCA.U.G.UCCGAG...CCCC.......CUGGC
+#=GR H.sapiens.11 SS (.((((...........(((.((((((......(((((....))))..)........))))))...).))..................)))))
+H.sapiens.12 C.UCUGUUA...AUGACGUCUCUCCCUCUAAA.CCCCAUU.AAGGA..C........UGGGAG.A.G.GCAGAGCAAGCCU.......CAGAG
+#=GR H.sapiens.12 SS (.((((.......((..(((((((((.......((........)).............))))).).).))....))............)))))
+H.sapiens.13 G.UCACUGC...AUGAUCCGCUCUGGU.CAAA.CCCUUCC...AGG..C......CAGCCAGA.G.U.GGGGAU..GGUCU.......GUGAC
+#=GR H.sapiens.13 SS (.((((.((.......(((((((((((......((.........))...........)))))).).).)))......)).........)))))
+H.sapiens.14 C.ACUGCUG...AUGACGAACUAUCUC.UAAC.UGGUCUU..GACC..A.......CGAGCUA.G.U.UCUGAA...UU.G.......CAGGG
+#=GR H.sapiens.14 SS ...((((.(...((...((((((.(((......((((......)))..)........))).)).).).))...)...)).).......)))..
+H.sapiens.15 U.UUUCAUC..UAUGAGGGUGUUUCCUCUAAA..CCUACG...AGG...........GAGGAA.C.A.CCUGAU...CUUA.....CAGAAAA
+#=GR H.sapiens.15 SS .......((..(.((((((((((.(((((................)...........)))))).).).)).......))))......)))...
+B.taurus.1 C.UUGCGUU..AAUGAGAACAGAAACG.UAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAAC
+#=GR B.taurus.1 SS ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.2 C.UUGCGUU..AAUGAGAACAGAAACG.AAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAAC
+#=GR B.taurus.2 SS ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.3 C.CCGGUGCC.UAUGACGGUCUGUCUG.AAAA.CCAGCCC...CUG.GU........GGGGCA.G.A.CCUGAG.AACCUG.......GCGUG
+#=GR B.taurus.3 SS (.(.(((..(.(.....(((((((((.....(.((((......))).)).........))))).).).))..))..))).).......)....
+B.taurus.4 ACUUGCGUU..AAUGAGAACAGAAACG.UAAA..CUAUAA.CCUAG.G.........GGUUUC.U.G.UUGGAU..GGUUG.......GCAA.
+#=GR B.taurus.4 SS ......(((..(((.(.(((((((((........(((......)))............))))).).).))...)...)))).......))...
+B.taurus.5 G.CCAGAUG...AUGAGGACCUGUGCG.GAAA.CCCCCCG..CGGG..C........UGCCCA.U.G.UCUGAG...CCC........CUGGC
+#=GR B.taurus.5 SS (.((((((....(((.((.((((((.(.(.......))))..)))).............)))).).).)))).)...)...............
+B.taurus.6 G.AUGCGUC..CAUGAAGUCACCAGCC.CCAA.GCCCCUC...GUG.GU........GGGUGG.U.G.AUGGAA.CCGUCA.....AAGCAGU
+#=GR B.taurus.6 SS (.(((..((..((.....((((((.((.(((.............)).).........)).))).).).)))))...)))).............
+B.taurus.7 U.UUUGCCC...AUGAAGGUGUUCCCUCUAAA..CCUAC....GUG...........GAGGAA.U.G.CCUGAU.GUCCAG.......GAAAA
+#=GR B.taurus.7 SS (.((((..(...((..(((((((((.((((..............))...........)))))).).).))).)).)..))).......))...
+O.aries.1 G.ACGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUCU.UGGAC.GC......CUGGUCCU.U.C.CUUGAU..GUUCU......CACGGC
+#=GR O.aries.1 SS (.(.((.((...(....((((((((((.(....((((......))).)........))))))).).).)))))...))..)......).....
+S.scrofa.1 G.ACGCUUC...AUGACAGGAAGGACU.GAAA.UGUCUUG.UGGAC.GC......CUGGUCCU.U.C.CCUGAU..GUUCU......CAUGGC
+#=GR S.scrofa.1 SS .......((...(((((((((((((((.(....((((......))).)........))))))).)...))))........)......))))).
+S.scrofa.2 C.UGGCACC..CAUGACAGUCUGCCUA.AAAA.CCAGCCC...CUG.GU........GGGGCA.G.A.CUCGAG.AACCUG.......GCGUG
+#=GR S.scrofa.2 SS .....((((..((.(.((((((((((.....(.((((......))).)).........))))).).).)).).....).)).......).)))
+S.scrofa.3 A.UUUUAUC..CAUGAAAGUGUUUCCUCUAAA..CCUAU....GUG...........GAGGAA.C.A.CCUGAU.GUCCAG......GAAAAU
+#=GR S.scrofa.3 SS ...........(((....))).((((((((..............))...........)))))).....((((......)))......).....
+S.scrofa.4 C.UGGCACC..CAUGACAGUCUGCCUA.AAAA.CCAGCC....CUG.GU........GGGGCA.G.A.CUCGAG.AACCUG.......GCGUG
+#=GR S.scrofa.4 SS .....((((..((.(.((((((((((.....(.(((........)).)).........))))).).).)).).....).)).......).)))
+C.elegans.1 G.AGGCAGCUUUGUGACGACCUUUGGC.UAAA.CUCCAUC..GUGA.GC........GCCUCU.G.G.UCUGAU...GC.........GCCUC
+#=GR C.elegans.1 SS (.((((.((...((.(.((((...(((......(((........)).).........)))....).).))).))...)).........)))))
+S.mansoni.1 C.UCGCUAU...AUGACGAUGGCAAUC.UCAA..AUGUU....CAU..U........GGUUGC.C.A.UUUGAU..GAAAUCAGUUUUGUGUG
+#=GR S.mansoni.1 SS ...(((.((...(.(((((((((((((..............................)))))).).).)).............))).))))))
+#=GC SS_cons <-<<<<-----------<<<<<<<<<<-------<<<______>>>----------->>>>>>->->->>------------------>>>>>
+#=GC RF g.ucucauu..uAUGAuGgccucuccc.uAAA.ucccuuu...ggg..c........gggaga.g.g.cCuGAU..gcuug.......gagac
+//
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->\r<head>\r<!-- InstanceBeginEditable name="doctitle" -->
-<TITLE>Applet Parameters</TITLE>
-<!-- InstanceEndEditable --> \r<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">\r<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable --> \r<style type="text/css">\r<!--\rtd {\r font-family: Geneva, Arial, Helvetica, sans-serif;\r font-size: 12px;\r}\r.plain {\r font-family: Verdana, Arial, Helvetica, sans-serif;\r font-size: 14px;\r text-decoration: none;\r}\r.plain:hover{\r background-color:#000000; color: #F2F2FF;\r}\r \r-->\r</style>\r\r<script language="JavaScript">\rfunction genHref()\r{\rvar s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";\rfor(i=0; i<8; i++)\r{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }\rwindow.location=href;\r}\rfunction getEventTarget(e)\r{\rif(!e)\re = window.event;\rif(e.target)\rreturn e.target;\rreturn e.srcElement;\r}\r\r</script>\r</head>\r\r<body alink="#000000" vlink="#000000" link="#000000">\r<script type="text/javascript">\rvar gaJsHost = (("https:" == document.location.protocol) ? \r"https://ssl." : "http://www.");\rdocument.write(unescape("%3Cscript src='" + gaJsHost + \r"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r</script>\r<script type="text/javascript">\rtry{\rvar pageTracker = _gat._getTracker("UA-9060947-1");\rpageTracker._trackPageview();\r} catch(err) {}\r</script>\r<div align="left"> \r <table width="805" height="100" cellpadding="5">\r <tr>\r <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>\r </tr>\r </table>\r <table width="805" border="0" cellpadding="5" cellspacing="5">\r <tr> \r <td width="183" valign="top" bgcolor="#F2F2FF" border="5"> \r \r <div align="center">\r <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">\r <tr> \r <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="applets.html" class="plain">Applet \r Version</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>\r </tr>\r <tr>\r <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release \r history</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source \r Code</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>\r </tr>\r <tr> \r <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News \r Mailing List</a></td>\r </tr>\r <tr>\r <td align="left" valign="middle"><a\r href="http://www.jalview.org/mailman/listinfo/jalview-discuss"\r class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and\r bug reports to the discussion list.</em></td>\r </tr>\r <tr></tr>\r <tr>\r <!--<td align="left" valign="middle"><br>\r Please send problems<br>and\r bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->\r </tr>\r </table>\r\r </div>\r\r <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>\r <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a> \r </div>\r </td>\r <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" -->
- <p>\r <strong>Quick Links:<ul><li>Download the applet jar file from <a\r href="jalviewApplet.jar">here</a>\r </li>\r <li>Parameters are described <a href="#parameters">below</a></li>\r <li>The javascript API is described <a\r href="jalviewLiteJs.html">here</a></li>\r </ul></strong>\r </p>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><!-- InstanceBegin template="/Templates/jtemplate.dwt" codeOutsideHTMLIsLocked="false" -->
+<head>
+<!-- InstanceBeginEditable name="doctitle" -->\r
+<TITLE>Applet Parameters</TITLE>\r
+<!-- InstanceEndEditable -->
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="keywords" content="jalview,multiple,sequence,alignment,editor,viewer,java,download,barton group,protein,dna,das,distributed annotation system">
+<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
+<style type="text/css">
+<!--
+td {
+ font-family: Geneva, Arial, Helvetica, sans-serif;
+ font-size: 12px;
+}
+.plain {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 14px;
+ text-decoration: none;
+}
+.plain:hover{
+ background-color:#000000; color: #F2F2FF;
+}
+
+-->
+</style>
+
+<script language="JavaScript">
+function genHref()
+{
+var s1 = "ml:ljvwr", s2 = "athpai.g", s3 = "ioe@leo ", href="";
+for(i=0; i<8; i++)
+{href = href + s1.charAt(i) + s2.charAt(i) + s3.charAt(i); }
+window.location=href;
+}
+function getEventTarget(e)
+{
+if(!e)
+e = window.event;
+if(e.target)
+return e.target;
+return e.srcElement;
+}
+
+</script>
+</head>
+
+<body alink="#000000" vlink="#000000" link="#000000">
+<script type="text/javascript">
+var gaJsHost = (("https:" == document.location.protocol) ?
+"https://ssl." : "http://www.");
+document.write(unescape("%3Cscript src='" + gaJsHost +
+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script>
+<script type="text/javascript">
+try{
+var pageTracker = _gat._getTracker("UA-9060947-1");
+pageTracker._trackPageview();
+} catch(err) {}
+</script>
+<div align="left">
+ <table width="805" height="100" cellpadding="5">
+ <tr>
+ <td background="../jalview.gif"> <a href="http://www.compbio.dundee.ac.uk" target="NEW"><img src="../uodc_r1_c1.gif" width="143" height="101" border="1"></a></td>
+ </tr>
+ </table>
+ <table width="805" border="0" cellpadding="5" cellspacing="5">
+ <tr>
+ <td width="183" valign="top" bgcolor="#F2F2FF" border="5">
+
+ <div align="center">
+ <table width="182" height="386" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td align="left" valign="middle"><a href="../index.html" class="plain">Home</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../overview.html" class="plain">Overview</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../download.html" class="plain">Download</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="applets.html" class="plain">Applet
+ Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="examples.html" class="plain">Screenshots</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../faq.html" class="plain">FAQ</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../documentList.html" class="plain">Documentation</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle" ><a href="../releaseHistory.html" class="plain">Release
+ history</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../source/source.html" class="plain">Source
+ Code</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../versions.html" class="plain">Development Version</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="../links.html" class="plain">Links</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a href="http://www.jalview.org/mailman/listinfo/jalview-announce" class="plain" target="NEW">News
+ Mailing List</a></td>
+ </tr>
+ <tr>
+ <td align="left" valign="middle"><a
+ href="http://www.jalview.org/mailman/listinfo/jalview-discuss"
+ class="plain" target="NEW">Discussion Mailing List</a><br><br><em>Please send problems<br>and
+ bug reports to the discussion list.</em></td>
+ </tr>
+ <tr></tr>
+ <tr>
+ <!--<td align="left" valign="middle"><br>
+ Please send problems<br>and
+ bug reports to:<br><a href="#" onClick="javascript:genHref();"><img src="../help.gif" width="123" height="19" border="0"></a></td>-->
+ </tr>
+ </table>
+
+ </div>
+
+ <div align="center"> <a href="http://www.bbsrc.ac.uk/" target="NEW"><br>
+ <img src="../bbsrc-new.gif" width="179" height="64" border="1"></a>
+ </div>
+ </td>
+ <td valign="top" width="587" bgcolor="#F2F2FF"><!-- InstanceBeginEditable name="Contents" --> \r
+ <p>
+ <strong>Quick Links:<ul><li>Download the applet jar file from <a
+ href="jalviewApplet.jar">here</a>
+ </li>
+ <li>Parameters are described <a href="#parameters">below</a></li>
+ <li>The javascript API is described <a
+ href="jalviewLiteJs.html">here</a></li>
+ </ul></strong>
+ </p>
+
<h3 align="left">Useful to know!!</h3>
<ul>
<li>Package all your data files into a single (or multiple) zip / jar
</font></li>
<li> Use Jalview for input to a HTML form. For an example of how to
code this using Javascript, click <a href="formComplete.html">here</a>.
- <br>
- </li>
+ <br>\r
+ </li>\r
<li>Embed Jalview into the web page, without the "Start Jalview"
button by setting the embed parameter to true;<br>
<param name="embedded"
value="true"> </li>
- </ul>\r <p><strong><font size="2">** NEW FEATURES ** in Jalview 2.7.1</font></strong></p>\r <ul><li><font size="2">Jmol compatibility updated to Jmol 12.2.x series - <a href="JmolApplet-12.2.4.jar">download the JmolApplet here</a></font></li>\r<li>To use Jmol as the structure viewer for Jalview, you must include \r the jar file in the applet archive argument thus:<br>\r <pre>archive="jalviewApplet.jar,Jmol-12.2.4.jar"</pre></font>\r </li>\r <li>Jmol 12.2.x requires at least Java 1.6 to run in the clients web browser. If the client does not have \r Java 1.6, or if the Jmol-12.2.jar is not added to the archive, the \r original Jalview structure viewer will still be available. <br>\r </li>\r \r </ul>\r <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7</font></strong></p>\r <ul>\r <li><font size="2">Javascript callbacks capabilities<ul><li>oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.</li>\r <li>To use javascript callbacks, ensure the applet tag includes the '<a href="http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html">mayscript</a>' attribute - either as a parameter (<param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).</li></ul></font>\r </li>\r <li><font size="2">New <a href="jalviewLiteJs.html">jalviewLite java api</a> methods for selecting, highlighting, scrolling and reordering sequences in an alignment view.\r </font></li></ul>\r <p><strong><font size="2">**NEW FEATURES** in Jalview 2.6</font></strong></p>\r <ul>\r <li><font size="2">Jmol compatibility updated to Jmol 12.1.x series</font></li>\r <li>Jalview 2.6 works only with Jmol version 12.1.13 or later. You can use the JmolApplet.jar from \r the Jmol binary distribution available at the Jmol Sourceforge site, \r or <a href="JmolApplet-12.1.13.jar">download the Jmol applet from here</a></li>\r <li><font size="2">Minimum recommended version of Java runtime for the applet is now 1.5 (JalviewLite v2.6 without the Jmol viewer may work ok on earlier Java environments but compatibility can no-longer be guaranteed).</font></li>\r </ul>
- <br><strong><font size="2">**NEW FEATURES** in Jalview 2.5</font></strong></p>\r <ul>\r <li><font size="2">New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</font></li>\r </ul> \r <br><strong><font size="2">**NEW FEATURES** in Jalview 2.4</font></strong></p>
+ </ul>
+ <p><strong><font size="2">**NEW FEATURES** in Jalview 2.8</font></strong></p>
+ <ul>
+ <li><font size="2">Normalised sequence logo display
+ </font></li>
+ <li><font size="2">RNA secondary structure annotation row
+ </font></li>
+ </ul>
+ <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7.1</font></strong></p>
+ <ul>
+<li><font size="2">Jmol compatibility updated to Jmol 12.2.x series - <a href="JmolApplet-12.2.4.jar">download the JmolApplet here</a></font></li>
+<li>To use Jmol as the structure viewer for Jalview, you must include
+ the jar file in the applet archive argument thus:<br>
+ <pre>archive="jalviewApplet.jar,Jmol-12.2.4.jar"</pre></font>
+ </li>
+ <li>Jmol 12.2.x requires at least Java 1.6 to run in the clients web browser. If the client does not have
+ Java 1.6, or if the Jmol-12.2.jar is not added to the archive, the
+ original Jalview structure viewer will still be available. <br>
+ </li>
+
+ </ul>
+ <p><strong><font size="2">**NEW FEATURES** in Jalview 2.7</font></strong></p>
+ <ul>
+ <li><font size="2">Javascript callbacks capabilities<ul><li>oninit parameter and methods for registering javascript handlers for selections, mouseovers and linking to Jmol applets on the page.</li>
+ <li>To use javascript callbacks, ensure the applet tag includes the '<a href="http://download.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html">mayscript</a>' attribute - either as a parameter (<param name="mayscript" value="true"/;gt;) or as a bare attribute in the applet html tag).</li></ul></font>
+ </li>
+ <li><font size="2">New <a href="jalviewLiteJs.html">jalviewLite java api</a> methods for selecting, highlighting, scrolling and reordering sequences in an alignment view.
+ </font></li></ul>
+ <p><strong><font size="2">**NEW FEATURES** in Jalview 2.6</font></strong></p>
+ <ul>
+ <li><font size="2">Jmol compatibility updated to Jmol 12.1.x series</font></li>
+ <li>Jalview 2.6 works only with Jmol version 12.1.13 or later. You can use the JmolApplet.jar from
+ the Jmol binary distribution available at the Jmol Sourceforge site,
+ or <a href="JmolApplet-12.1.13.jar">download the Jmol applet from here</a></li>
+ <li><font size="2">Minimum recommended version of Java runtime for the applet is now 1.5 (JalviewLite v2.6 without the Jmol viewer may work ok on earlier Java environments but compatibility can no-longer be guaranteed).</font></li>
+ </ul>
+ <br><strong><font size="2">**NEW FEATURES** in Jalview 2.5</font></strong></p>
+ <ul>
+ <li><font size="2">New parameters to control display of tree annotation, width of alignment columns, and to disable the jalview button and check for Jmol on startup.</font></li>
+ </ul>
+ <br><strong><font size="2">**NEW FEATURES** in Jalview 2.4</font></strong></p>
<ul>
<li><font size="2">New applet API methods for feature display control, views, and obtaining current selection via javascript.</font></li>
<li><font size="2">Group show and hide parameters:
<font size="2"><param name="PDBFile3" value="Third.pdb
D=SeqX B=SeqY C=SeqZ"> </font> <br>
</li>
- <li>Note parameter "PDBSeq" is no longer required.<br>
+ <li>Note parameter "PDBSeq" is no longer required.<br>\r
</li>
<li>Jalview 2.3 was updated to work with Jmol 11. See the <a href="../versions.html">versions archive if you want to download the old Jmol applet</a>.</li>
<p> </p>
<font face="Courier New, Courier, mono"><param name="userDefinedColour"
value="D,E=red; K,R,H=0022FF; C=yellow"></font><br>
</li>
- <li>Param <font face="Courier New, Courier, mono">showFeatureSettings</font>
+ <li>Param <font face="Courier New, Courier, mono">showFeatureSettings</font>
- this will display the feature settings window when the applet starts.<br>
</li>
<li>Param <font face="Courier New, Courier, mono">Application_URL value="http://www.jalview.org/services/launchApp"<br>
<tr><td>showbutton</td>
<td>true</td>
<td>Show the jalview button on the page. When false, JalviewLite will open immediately.</td>
- </tr>\r </tr>\r <tr><td>sortByTree</td>\r <td>true or false (default is false)</td>\r <td>automatically sort the associated alignment view by the tree when a new tree is opened.</td>\r </tr>\r <tr>\r <td>showTreeBootstraps</td><td>true or false (default is true)</td><td>show or hide branch bootstraps</td>\r </tr>\r <tr><td>showTreeDistances</td><td>true or false (default is true)</td><td>show or hide branch lengths</td></tr>\r <tr><td>showUnlinkedTreeNodes</td><td>true or false (default is false)</td><td>indicate if unassociated nodes should be highlighted in the tree view</td>\r </tr>\r <tr><td>heightScale</td>\r <td>1.0 or greater</td>\r <td>Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r </tr>
- <tr><td>widthScale</td>\r <td>1.0 or greater</td>\r <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>\r </tr>\r <tr><td>centrecolumnlabels</td>\r <td>true of false (default is false)</td>\r <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>\r <tr><td>showUnconserved</td>\r <td>true of false (default is false)</td>\r <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>\r </tr>\r <tr><td>upperCase</td>\r <td><em>bold</em> or other value</td>\r <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>\r </tr>\r <tr><td>automaticScrolling</td>\r <td>true of false (default is true)</td>\r <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>\r </tr>\r \r <tr><td>showGroupConsensus</td>\r <td>true of false (default is false)</td>\r <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r \r <tr><td>showGroupConservation</td>\r <td>true of false (default is false)</td>\r <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showConsensusHistogram</td>\r <td>true of false (default is true)</td>\r <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>showSequenceLogo</td>\r <td>true of false (default is false)</td>\r <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>oninit</td>\r <td><em>after_init()</em></td>\r <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>relaxedidmatch</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>alignpdbfiles</td>\r <td><em>true or false (default is false)</em></td>\r <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>externalstructureviewer</td>\r <td><em>true or false (default is false)</em></td>\r <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>\r \r </tr>\r <tr><td>annotationcolour_max</td>\r <td>colour name or RGB hex triplet (default is red)</td>\r <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>annotationcolour_min</td>\r <td>colour name or RGB hex triplet (default is orange)</td>\r <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>jalviewhelpurl</td>\r <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>\r <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>\r </tr>\r <tr><td>resolvetocodebase</td>\r <td>True or False (False)</td>\r <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>\r </tr>\r \r </table>
+ </tr>
+ </tr>
+ <tr><td>sortByTree</td>
+ <td>true or false (default is false)</td>
+ <td>automatically sort the associated alignment view by the tree when a new tree is opened.</td>
+ </tr>
+ <tr>
+ <td>showTreeBootstraps</td><td>true or false (default is true)</td><td>show or hide branch bootstraps</td>
+ </tr>
+ <tr><td>showTreeDistances</td><td>true or false (default is true)</td><td>show or hide branch lengths</td></tr>
+ <tr><td>showUnlinkedTreeNodes</td><td>true or false (default is false)</td><td>indicate if unassociated nodes should be highlighted in the tree view</td>
+ </tr>
+ <tr><td>heightScale</td>
+ <td>1.0 or greater</td>
+ <td>Adjust the height of each cell in the alignment grid relative to the height of a character in the alignment font. (<em>since 2.5.1</em>)</td>
+ </tr>
+ <tr><td>widthScale</td>
+ <td>1.0 or greater</td>
+ <td>Adjust the width of each cell in the alignment grid relative to the width of a character in the alignment font. (<em>since 2.5.1</em>)</td>
+ </tr>
+ <tr><td>centrecolumnlabels</td>
+ <td>true of false (default is false)</td>
+ <td>When true, text labels associated with a column in the alignment will be shown centered with respect to the column. (<em>since 2.4</em>)</td>
+ <tr><td>showUnconserved</td>
+ <td>true of false (default is false)</td>
+ <td>When true, only gaps and symbols different to the consensus sequence for a column will be shown. Useful for visualizing alignments exhibiting low sequence variation, where it is important to highlight mutations. (<em>since 2.5</em>)</td>
+ </tr>
+ <tr><td>upperCase</td>
+ <td><em>bold</em> or other value</td>
+ <td>Indicate a text style to apply to uppercase sequence symbols. Currently, only <strong>bold</strong> is supported.</td>
+ </tr>
+ <tr><td>automaticScrolling</td>
+ <td>true of false (default is true)</td>
+ <td>When true, alignment panels will automatically scroll to show any regions of the alignment highlighted due to javascript events or when mousing over a position in an associated structure. (<em>since 2.6</em>)</td>
+ </tr>
+
+ <tr><td>showGroupConsensus</td>
+ <td>true of false (default is false)</td>
+ <td>When true, shows consensus annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>
+ </tr>
+
+ <tr><td>showGroupConservation</td>
+ <td>true of false (default is false)</td>
+ <td>When true, shows amino-acid property conservation annotation row for any groups on the alignment. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>showConsensusHistogram</td>
+ <td>true of false (default is true)</td>
+ <td>When true, shows the percentage occurence of the consensus symbol for each column as a histogram above the consensus sequence row. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>showSequenceLogo</td>
+ <td>true of false (default is false)</td>
+ <td>When true, shows a sequence logo above the consensus sequence (overlaid above the Consensus Histogram, if visible, with symbols coloured using the alignment's default colourscheme). (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>normaliseLogo</td>
+ <td>true of false (default is false)</td>
+ <td>When true, all sequence logos will be normalised (all symbol stacks add up to full height of annotation row), rather than being scaled according to the fraction of symbols identical to the consensus. (<em>since 2.7.1</em>)</td>
+ </tr>
+ <tr><td>oninit</td>
+ <td><em>after_init()</em></td>
+ <td>name of javascript function that will be called after the jalviewLite instance has completed its initialisation. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>relaxedidmatch</td>
+ <td><em>true or false (default is false)</em></td>
+ <td>When true, use stem based matching to identify sequences that match features imported from a GFF or Jalview sequence features file, and for associating PDB data (passed on PDBfile parguments) with sequences (based on a given destination sequence ID). (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>alignpdbfiles</td>
+ <td><em>true or false (default is false)</em></td>
+ <td>When true, and jalviewLite is able to use jmol as a structure viewer, attempt to show a superposition of all structures loaded onto the alignment, superimposed using the aligned regions of corresponding sequences. [experimental] (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>externalstructureviewer</td>
+ <td><em>true or false (default is false)</em></td>
+ <td>re-route jmol colouring commands, selection and mouseover events to an external viewer using javascript callbacks. [experimental] (<em>since 2.7</em>)</td>
+
+ </tr>
+ <tr><td>annotationcolour_max</td>
+ <td>colour name or RGB hex triplet (default is red)</td>
+ <td>Default colour used for maximum value when shading by annotation. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>annotationcolour_min</td>
+ <td>colour name or RGB hex triplet (default is orange)</td>
+ <td>Default colour used for minimum value when shading by annotation. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>jalviewhelpurl</td>
+ <td>absolute or relative url or javascript function prefixed by <em>javascript:</em> (default is http://www.jalview.org/help.html)</td>
+ <td>Optional parameter allowing modification of the default Jalview Help URL normally opened when JalviewLite's 'Help' menu item is selected. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>resolvetocodebase</td>
+ <td>True or False (False)</td>
+ <td>Set to true to re-instate pre-JalviewLite 2.7 behaviour where relative URLs were prepended with the applet 'codebase' rather than the current document base URL before resolution. (<em>since 2.7</em>)</td>
+ </tr>
+ <tr><td>scoreFile</td>
+ <td>file</td>
+ <td>Multiple sequences aligment scores file. Currently is supported only the T-Coffee score_ascii file format</td>
+ </tr>
+ </table>
<p align="center"> </p>
- <!-- InstanceEndEditable --></td>\r </tr>\r </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
+ <!-- InstanceEndEditable --></td>
+ </tr>
+ </table>
+</div>
+</body>
+<!-- InstanceEnd --></html>
</table></td>
</tr>
</table>
- <p> </p>
- <table width="300" border="1" cellspacing="0" cellpadding="0">
- <tr>
- <td><table width="300" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="100"> <applet code="jalview.bin.JalviewLite"
- width="140" height="35"
- archive="jalviewApplet.jar">
- <param name="file" value="jpred_msa.fasta">
- <param name="jnetfile" value="jpred_msa.seq.concise">
- <param name="defaultColour" value="Clustal">
- <param name="showAnnotation" value="true">
- <param name="windowHeight" value="515">
- <param name="windowWidth" value="650">
- <param name="showConservation" value="false">
- <param name="showQuality" value="false">
- <param name="showConsensus" value="false">
- <param name="showFullId" value="false">
- <param name="RGB" value="F2F2FF">
- <param name="linkLabel_1" value="SRS">
- <param name="linkUrl_1" value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">
- <param name="linkLabel_2" value="Uniprot">
- <param name="linkUrl_2" value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">
- <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">
- </applet> </td>
- <td width="165">Displays a Multiple Sequence Alignment Based
- JNet Prediction for a Sequence</td>
- </tr>
- </table></td>
- </tr>
- </table>\r </div>\r <p> </p>\r <p>For more JalviewLite examples, follow the links below.\r <ul>\r <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>\r <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>\r <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r </ul>
+ <p> </p>\r <table width="300" border="1" cellspacing="0" cellpadding="0">\r <tr>\r <td><table width="300" border="0" cellspacing="0"\r cellpadding="0">\r <tr>\r <td width="100"><applet code="jalview.bin.JalviewLite"\r width="140" height="35" archive="jalviewApplet.jar">\r <param name="file" value="jpred_msa.fasta">\r <param name="jnetfile" value="jpred_msa.seq.concise">\r <param name="defaultColour" value="Clustal">\r <param name="showAnnotation" value="true">\r <param name="windowHeight" value="515">\r <param name="windowWidth" value="650">\r <param name="showConservation" value="false">\r <param name="showQuality" value="false">\r <param name="showConsensus" value="false">\r <param name="showFullId" value="false">\r <param name="RGB" value="F2F2FF">\r <param name="linkLabel_1" value="SRS">\r <param name="linkUrl_1"\r value="http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2">\r <param name="linkLabel_2" value="Uniprot">\r <param name="linkUrl_2"\r value="http://us.expasy.org/cgi-bin/niceprot.pl?$SEQUENCE_ID$">\r <param name="APPLICATION_URL"\r value="http://www.jalview.org/services/launchApp">\r </applet></td>\r <td width="165">Displays a Multiple Sequence Alignment\r Based JNet Prediction for a Sequence</td>\r </tr>\r </table></td>\r </tr>\r </table>\r <p> </p>\r <table width="300" border="1" cellspacing="0" cellpadding="0">\r <tr>\r <td><table width="300" border="0" cellspacing="0" cellpadding="0">\r <tr>\r <td width="100"> <applet code="jalview.bin.JalviewLite"\r width="140" height="35"\r archive="jalviewApplet.jar">\r <param name="file" value="RF00031_folded.stk">\r <param name="defaultColour" value="Purine/Pyrimidine">\r <param name="showAnnotation" value="true">\r <param name="windowHeight" value="515">\r <param name="windowWidth" value="650">\r <param name="showConservation" value="false">\r <param name="showQuality" value="false">\r <param name="showConsensus" value="true">\r <param name="showFullId" value="false">\r <param name="RGB" value="F2F2FF">\r <param name="APPLICATION_URL" value="http://www.jalview.org/services/launchApp">\r </applet> </td>\r <td width="165">Displays an RFAM RNA fold family with secondary structure annotation</td>\r </tr>\r </table></td>\r </tr>\r </table>\r </div>\r <p> </p>\r <p>For more JalviewLite examples, follow the links below.\r <ul>\r <li><a href="embedded.html">JalviewLite embedded in the web page</a></li>\r <li><a href="formComplete.html">use Javascript to control and get data from JalviewLite</a></li>\r <li><a href="linkedapplets_ng.html">use Javascript to make two jalviewLite instances talk to each other</a></li>\r <li><a href="embeddedWJmol.html">configure JalviewLite to talk to a Jmol applet on the page.</a></li>\r </ul>
<!-- InstanceEndEditable --></td>\r </tr>\r </table>\r</div>\r</body>\r<!-- InstanceEnd --></html>\r
\ No newline at end of file
<mapID target="viewingpdbs" url="html/features/viewingpdbs.html"/>
<mapID target="pdbmcviewer" url="html/features/pdbviewer.html"/>
<mapID target="pdbjmol" url="html/features/jmol.html"/>
+ <mapID target="varna" url="html/features/varna.html"/>
<mapID target="preferences" url="html/features/preferences.html"/>
<mapID target="commandline" url="html/features/commandline.html"/>
<mapID target="clarguments" url="html/features/clarguments.html"/>
<mapID target="colours.abovepid" url="html/colourSchemes/abovePID.html"/>
<mapID target="colours.conservation" url="html/colourSchemes/conservation.html"/>
<mapID target="colours.annotation" url="html/colourSchemes/annotationColouring.html"/>
+ <mapID target="colours.purinepyrimidine" url="html/colourSchemes/purinepyrimidine.html"/>
+ <mapID target="colours.rnahelices" url="html/colourSchemes/rnahelicesColouring.html"/>
<mapID target="calcs.alquality" url="html/calculations/quality.html"/>
<mapID target="calcs.alconserv" url="html/calculations/conservation.html"/>
+ <mapID target="calcs.alstrconsensus" url="html/calculations/structureconsensus.html"/>
<mapID target="calcs.consensus" url="html/calculations/consensus.html"/>
+ <mapID target="nucleicAcids" url="html/na/index.html"/>
+
<mapID target="menus" url="html/menus/index.html"/>
<mapID target="desktopMenu" url="html/menus/desktopMenu.html"/>
<mapID target="alMenu" url="html/menus/alignmentMenu.html"/>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<toc version="1.0">
<tocitem text="Jalview Documentation" target="home" expand="true" >
<tocitem text="What's new" target="new" expand="true">
- <tocitem text="Enhanced Jmol/Jalview interaction" target="pdbjmol"/>
- <tocitem text="Multi-Harmony Alignment Analysis" target="shmrws"/>
- <tocitem text="Jalview News Reader" target="newsreader"/>
- <tocitem text="Sort alignments associated with tree" target="treeviewer"/>
- <tocitem text="Default Annotation preferences" target="colours.annotation"/>
- <tocitem text="Jaba Web Services" target="jabaws"/>
+ <tocitem text="Viewing RNA structure" target="varna" />
+ <tocitem text="RNA Structure Consensus" target="calcs.alstrconsensus"/>
+ <tocitem text="RNA Helices coloring" target="colours.rnahelices"/>
</tocitem>
<tocitem text="Editing Alignments" target ="edit"/>
<tocitem text="Cursor Mode" target="cursor"/>
<tocitem text="Multiple Views" target="multipleviews"/>
<tocitem text="Viewing Trees" target="treeviewer" expand="false"/>
<tocitem text="Fetching Sequences" target="seqfetch"/>
+ <tocitem text="Nucleic Acid Support" target="nucleicAcids" expand="false">
+ <tocitem text="Viewing RNA structure" target="varna" />
+ <tocitem text="RNA Structure Consensus" target="calcs.alstrconsensus"/>
+ <tocitem text="RNA Helices coloring" target="colours.rnahelices"/>
+ </tocitem>
<tocitem text="Sequence Features" target="seqfeatures" expand="false">
<tocitem text="Sequence Feature Settings" target="seqfeatures.settings"/>
<tocitem text="Sequence Features File" target="features.fileformat"/>
<tocitem text="Turn propensity" target="colours.turn"/>
<tocitem text="Buried index" target="colours.buried"/>
<tocitem text="Nucleotide colours" target="colours.nucleotide"/>
+ <tocitem text="Purine/Pyrimidine colours" target="colours.purinepyrimidine"/>
<tocitem text="Blosum62" target="colours.blosum"/>
<tocitem text="by Percentage Identity" target="colours.pid"/>
<tocitem text="User Defined" target="colours.user"/>
<tocitem text="Above Percentage Identity" target="colours.abovepid"/>
<tocitem text="By conservation" target="colours.conservation"/>
<tocitem text="By Annotation" target="colours.annotation"/>
+ <tocitem text="By RNA Helices" target="colours.rnahelices"/>
</tocitem>
<tocitem text="Calculations" target="calculations" expand="false">
<tocitem text="Sorting alignments" target="sorting"/>
<tocitem text="Remove Redundancy" target="redundancy"/>
</tocitem>
<tocitem text="Alignment Annotations" target ="alannotation" expand="false">
- <tocitem text="Conservation" target="calcs.alconserv"/>
+ <tocitem text="Conservation" target="calcs.alconserv"/>
<tocitem text="Quality" target="calcs.alquality"/>
<tocitem text="Consensus" target="calcs.consensus"/>
+ <tocitem text="RNA Structure Consensus" target="calcs.alstrconsensus"/>
<tocitem text="Annotations File Format" target="annotations.fileformat"/>
</tocitem>
<tocitem text="Viewing PDB Files" target="viewingpdbs" expand="false">
<tocitem text="Jmol Viewer" target="pdbjmol"/>
<tocitem text="Simple PDB Viewer" target="pdbmcviewer"/>
</tocitem>
+ <tocitem text="Viewing RNA structures" target="varna" expand="false"> </tocitem>
<tocitem text="VAMSAS Data Exchange" target="vamsas">
<!-- what can Jalview share with other apps -->
<!-- what other apps exist -->
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<p>Select the <strong>"Copy Consensus Sequence"</strong> entry from
the consensus annotation label to copy the alignment's consensus sequence to the
clipboard.
+
+<p><strong>Sequence logo</strong></p>
+By clicking on the label you can also activate the sequence logo. It
+indicates the relative amount of residues per column which can be
+estimated by it's size in the logo. The tooltip of a column gives the
+exact numbers for all occuring residues.
</p>
</body>
</html>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
for the Hierarchical Analysis of Residue Conservation.<em>CABIOS</em> Vol. <b>9</b>
No. 6 (745-756)).
</ul>
+<em><a href="http://www.compbio.dundee.ac.uk/papers/amas/amas3d.html">View an HTML version of the paper</a></em>
</p>
<p>Conservation is measured as a numerical index reflecting the conservation of
<a href="../misc/aaproperties.html">physico-chemical
properties</a> in the alignment: Identities score highest, and the next most
conserved group contain substitutions to amino acids lying in the same physico-chemical
class.</p>
+ <p>Conservation is visualised on the alignment or a sequence group
+ as a histogram giving the score for each column. Conserved columns are
+ indicated by '*' (score of 11 with default amino acid property
+ grouping), and columns with mutations where all properties are
+ conserved are marked with a '+' (score of 10, indicating all
+ properties are conserved).</p>
-<p><em>Colouring an alignment by conservation</em><br>
+ <p><em>Colouring an alignment by conservation</em><br>
Conservation scores can be used to colour an alignment. This is
explained further in the help page for <a
href="../colourSchemes/conservation.html">conservation colouring</a>.
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head><title>Alignment RNA Structure Consensus Annotation</title></head>
+<body><p><strong>Alignment RNA Structure Consensus Annotation</strong></p>
+
+<p>The RNA structure consensus displayed below the alignment is the
+percentage of valid base pairs per column. It is calculated in
+relation to a secondary structure and just paired columns are
+calculated. The canonical Watson-Crick base pairings (A-T/U, G-C) and
+the wobble base pair (G-T/U) are regarded as valid pairings.<br>
+The amount of valid base pairs is indicated by the profile in the
+Alignment Annotation row.<br>
+By default this calculation includes gaps in columns. You can choose
+to ignore gaps in the calculation by right clicking on the label
+"StrConsensus" to the left of the structure consensus bar
+chart.<br>
+
+<p><strong>Structure logo</strong></p>
+By clicking on the label you can also activate the structure logo. It is very
+similar to a sequence logo but counts the numbers of base pairs. There
+are two residues per column, the actual column and the interacting
+base. The opening bracket is always the one on the left side.<br>
+Like sequence logos the relative amount of a specific base pair can be
+estimated by it's size in the logo. The tool tip of a column gives the
+exact numbers for all occurring valid base pairs.
+</p>
+</body>
+</html>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<p>The default colour schemes are summarised in the table below:
<div align="center">
<p> </p>
+<p><strong>Protein Colour Schemes</strong></p>
<table border="1">
<tr>
<td>
</td>
</tr>
</table>
+<p> </p>
+<p><strong>Nucleotide Colour Schemes</strong></p>
+<table border="1">
+ <tr>
+ <td>
+ <table border="1">
+ <tr>
+ <td nowrap></td>
+ <td>A</td> <!--Adenine-->
+ <td>C</td> <!--Cytosine-->
+ <td>G</td> <!--Guanine-->
+ <td>T</td> <!--Thymine-->
+ <td>U</td> <!--Uracil-->
+ <td>I</td> <!--Inosine-->
+ <td>X</td> <!--Xanthine-->
+ <td>R</td> <!--Unknown Purine-->
+ <td>Y</td> <!--Unknown Pyrimidine-->
+ <td>N</td> <!--Unknown-->
+ <td>W</td> <!--Weak nucleotide (A or T)-->
+ <td>S</td> <!--Strong nucleotide (G or C)-->
+ <td>M</td> <!--Amino (A or C)-->
+ <td>K</td> <!--Keto (G or T)-->
+ <td>B</td> <!--Not A (G or C or T)-->
+ <td>H</td> <!--Not G (A or C or T)-->
+ <td>D</td> <!--Not C (A or G or T)-->
+ <td>V</td> <!--Not T (A or G or C-->
+ </tr>
+ <tr>
+ <td height="24">Nucleotide</td>
+ <td bgcolor="#64F73F"></td>
+ <td bgcolor="#FFB340"></td>
+ <td bgcolor="#EB413C"></td>
+ <td bgcolor="#3C88EE"></td>
+ <td bgcolor="#3C88EE"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ <tr>
+ <td height="24">Purine/Pyrimidine</td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td></td>
+ <td></td>
+ <td bgcolor="#FF83FA"></td>
+ <td bgcolor="#40E0D0"></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+
+
</div>
<p align="center"> </p>
</body>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<td bgcolor="#FFB340">C</td>
<td bgcolor="#EB413C">G</td>
<td bgcolor="#3C88EE">T</td>
+ <td bgcolor="#3C88EE">U</td>
</tr>
</table>
</div>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head><title>Purine/Pyrimidine Colour Scheme</title>
+<style type="text/css">
+<!--
+td {
+ text-align: center;
+}
+-->
+</style>
+</head>
+
+<body>
+<p><em>Purine/Pyrimidine Colours</em></p>
+<div align="center">
+ <table width="200" border="1">
+ <tr>
+ <td bgcolor="#FF83FA">Purines <BR> A, G, R</td>
+ <td bgcolor="#40E0D0">Pyrimidines <BR> C, U, T, Y</td>
+ </tr>
+ </table>
+</div>
+</body>
+</html>
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head><title>RNA Helices Colouring</title></head>
+
+<body>
+<p><strong> RNA Helices Colouring </strong></p>
+<p>An RNA alignment loaded from a Stockholm file can be coloured
+ based on its helices. The helices are determined from the
+ secondary structure line in the Stockholm file (#GC SS_cons)
+ written in WUSS notation
+ that specifies base pairing. See <a href="http://en.wikipedia.org/wiki/Stockholm_format">
+ Wikipedia</a> or <a href="http://jalview-rnasupport.blogspot.com/2010/06/parsing-wuss-notation-of-rna-secondary.html">
+ Jalview RNA Support Blog</a> for more information about Stockholm files and WUSS notation.</p>
+Select "Colour" <strong>→</strong> "
+ By RNA Helices" to colour the alignment by RNA helices. <br>
+ <br>
+<p><em>Features</em></p>
+<ul>
+<li>Colours are generated randomly for the number of helices present.
+Reselect the "By RNA Helices" option to generate another set of random colors. </li>
+<li>Sequence logo is in <a href="purinepyrimidine.html">
+Purine/Pyrimidine colour scheme</a>. </li>
+<li>Line above the "Secondary Structure" line in annotation panel is WUSS notation present
+in the input file.</li>
+</ul>
+
+
+
+ <div align="center">
+ <img src="rnahelicescoloring.png" width="600" height="140"> </div>
+
+
+</body>
+</html>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<p><strong>The Jmol PDB Viewer</strong></p>\r
<p>Since Jalview 2.3, <a href="http://jmol.sourceforge.net/">Jmol</a>\r
has been integrated into Jalview for interactively viewing structures\r
-opened by selecting the <strong>"Sequence→View PDB\r
+opened by selecting the <strong>"Structure→View PDB\r
entry:"</strong> option in the <a href="../menus/popupMenu.html">sequence\r
id pop-up menu</a> (if you can't see this, then you need to <a\r
href="viewingpdbs.html">associate a PDB structure</a> with the\r
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
</head>
<body>
<p><strong>Sequence Fetcher</strong></p>
-<p>Jalview can retrieve sequences from certain databases using
-either the WSDBFetch service provided by the European Bioinformatics
-Institute, and, since Jalview 2.4, DAS servers capable of the <em>sequence</em>
-command (configured in <a href="dassettings.html">DAS settings</a>).</p>
-<img src="seqfetcher.gif" align="center"
- alt="The Jalview Sequence Fetcher Dialog Box">
-<p>The Sequence Fetcher dialog box can be opened via the
-"File" menu on the main desktop in order to retrieve sequences
-as a new alignment, or opened via the "File" menu of an
-existing alignment to import additional sequences. Please note, there
-will be a short delay when the sequence fetcher is first opened, whilst
-Jalview compiles the list of available sequence datasources from the
-currently defined DAS server registry.</strong></p>
-<p>First, select the database you want to retrieve sequences from.
-Then, enter one or more accession ids (as a semi-colon separated list),
-or press the "Example" button to paste the example accession
-for the currently selected database into the retrieval box. Finally,
-press "OK" to initiate the retrieval.</p>
-<p><em>Fetching Individual PDB Chains</em><br>
-If you are retrieving sequences from the PDB, you can retrieve specific
-chains by appending a colon and the chain id to the PDB id. For example
-:<br>
-<pre> 1GAQ:A</pre>
-</p>
-<p><em>Retrieving parts of large sequence records</em><br>
-When retrieving from DAS sequence sources, coordinate range arguments
-can be passed to the server using the standard DAS sequence command
-format:<pre>
- <AccessionId>:<start>,<end></pre> If you know a source
-understands this type of query format, then you should untick the
-checkbox for 'replace commas with semi-colons' so the range query can be
-passed to the server; otherwise, the query will be split into two (e.g
-'Mito:1' and '85779' rather than 'Mito:1,85779'). In most cases,
-however, a source that supports range queries will include a range
-qualification in its example query, and Jalview will then automatically
-disable the 'replace commas with semi-colons' option.<br>
-<em>The option to disable the comma to semi-colon translation was
-added in Jalview 2.6</em></p>
-<p>If you use the WSDBFetch sequence fetcher services (EMBL,
-Uniprot, PDB and PFAM) in work for publication, please cite:</p>
-<p>Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S.,
-Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez
-R. <br>
-SOAP-based services provided by the European Bioinformatics Institute.<br>
-Nucleic Acids Res. 33(1):W25-W28 (2005) <br>
-<br>
+<p>Jalview can retrieve sequences from certain databases using either the
+WSDBFetch service provided by the European Bioinformatics Institute, and, since Jalview 2.4, DAS servers capable of the <em>sequence</em> command (configured in <a href="dassettings.html">DAS settings</a>).</p>
+<img src="seqfetcher.gif" align="center" alt="The Jalview Sequence Fetcher Dialog Box">
+<p>The Sequence Fetcher dialog box can be opened via the "File"
+ menu on the main desktop in order to retrieve sequences as a new
+ alignment, or opened via the "File" menu of an existing alignment
+ to import additional sequences. Please note, there will be a short delay when the sequence fetcher is first opened,
+ whilst Jalview compiles the list of available sequence datasources from the
+ currently defined DAS server registry.</strong>
</p>
+<p>First, select the database you want to retrieve sequences from. Then, enter
+ one or more accession ids (as a semi-colon separated list), or press the
+ "Example" button to paste the example accession for the currently selected database into the retrieval box.
+ Finally, press "OK" to initiate the retrieval.</p>
+<p>
+ If you are retrieving sequences from the PDB, you can retrieve
+ specific chains by appending a colon and the chain id to the PDB
+ id. For example :<br><pre> 1GAQ:A</pre><br>When retrieving from DAS sequence sources,
+ coordinate range arguments can be passed to the server using the standard DAS
+ sequence command format (<strong>:<start>,<end></strong>)</p>
+<p>If you use the WSDBFetch sequence fetcher services (EMBL, Uniprot, PDB, PFAM, and RFAM)
+ in work for publication, please cite:</p>
+<p>Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar
+ S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R. <br>
+ SOAP-based services provided by the European Bioinformatics Institute.<br>
+ Nucleic Acids Res. 33(1):W25-W28 (2005) <br>
+ <br>
+ </p>
</body>
</html>
<html>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
--- /dev/null
+<html>\r
+<!--\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
+-->\r
+<head>\r
+<title>The VARNA RNA Viewer</title>\r
+</head>\r
+<body>\r
+<p><strong>The VARNA RNA Viewer</strong></p>\r
+<p>Since Jalview\r
+2.7.1, <a href="http://varna.lri.fr/index.html">VARNA</a> has been\r
+integrated into Jalview for interactively viewing structures opened by\r
+selecting the <strong>"Structure→View\r
+Structure:"</strong> option in\r
+the <a href="../menus/popupMenu.html">sequence id pop-up menu</a> (if\r
+you can't see this, then no RNA structure is associated with your\r
+sequence or alignment. In the pop-up menu all structures that\r
+are associated with this sequence and all sequences that are\r
+associated with the alignment are available.\r
+\r
+<p><strong>Different structures</strong></p>\r
+<ul>\r
+ <li>\r
+ <b>Alignment structures</b>:\r
+ Structures associated with the alignment are marked by having "consensus" attached to their name. VARNA contains two different entries for consensus structures.\r
+ <ul>\r
+ <li>Consensus structure: the individual sequence folded into the consensus structure</li>\r
+ <li>Trimmed consensus structure: the individual sequence\r
+ folded into the the gap-free consensus structure. That means all\r
+ columns that contained gaps in the individual sequence were\r
+ removed. If this breaks a base-pair the pairing is removed also.\r
+ This can be considered as an approximation for the individual structure.\r
+ </ul>\r
+ </li>\r
+ <li>\r
+ <b>Individual structures</b>:\r
+ this is a structure associated with the individual sequence and therefore not related to the alignment \r
+ </li>\r
+\r
+<p><strong>Controls</strong><br>\r
+<ul>\r
+<li>Rotate view - Left Click and drag</li>\r
+<li>Zoom in - Press '+'</li>\r
+<li>Zoom out - Press '-'</li>\r
+<li>Choose a different structure - Left click on structure in the left hand panel</li>\r
+<li>Highlighting bases - Move mouse over columns in the Jalview alignment panel</li>\r
+</ul>\r
+\r
+<p><strong>Functionality provided by VARNA</strong></p>\r
+<p>VARNA's own functions are accessed by right-clicking in the\r
+structure display area. That will open the VARNA pop-up menu,\r
+which provides access to a number of features like different draw algorithm, color highlighting or annotations. \r
+</p>\r
+<p><strong>More Information</strong></p>\r
+<p>VARNA is a very powerful RNA viewer on its own. Only the\r
+essentials have been described here - the interested reader is\r
+referred to <a href="http://varna.lri.fr/usermanual.html">VARNA's own\r
+comprehensive online documentation</a>.</p>\r
+</body>\r
+</html>\r
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
</tr><tr><td width="17%">PFAM</td>
<td width="60%">SequenceName THISISASEQENCE</td>
<td width="23%">.pfam</td>
+</tr><tr>
+<td width="17%">Stockholm</td>
+<td width="60%"># STOCKHOLM VersionNumber<br>
+<em>...</em><br>//</td>
+<td width="23%">.stk, .sto</td>
</tr>
</table>
<p>The file extensions are used to associate jalview alignment icons
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<li><strong>File</strong>
<ul>
<li><strong>Fetch Sequence</strong><br> <em>Shows a
- dialog window in which you can select known ids from Uniprot,
- EMBL, EMBLCDS or PDB database using Web Services provided by the
+ dialog window in which you can retrieve known ids from Uniprot,
+ EMBL, EMBLCDS, PFAM, Rfam, or PDB database using Web Services provided by the
European Bioinformatics Institute. See <a
href="../features/seqfetch.html">Sequence Fetcher</a> </em>.</li>
<li><strong>Add Sequences</strong><em><br> Add
</ul></li>
</ul>
+ </li>
+
+ </ul>
</li>
<li><strong>Colour</strong>
<li>Colour Scheme options: <strong>None, ClustalX,
Blosum62 Score, Percentage Identity, Zappo, Taylor,
Hydrophobicity, Helix Propensity, Strand Propensity, Turn
- Propensity, Buried Index, Nucleotide, User Defined<br> </strong> <em>See
+ Propensity, Buried Index, Nucleotide, Purine/Pyrimidine, User Defined<br> </strong> <em>See
<a href="../colourSchemes/index.html">colours</a> for a
description of all colour schemes.</em><br></li>
<li><strong>By Conservation<br> </strong><em>See <a
the alignment on a per-column value from a specified annotation.
See <a href="../colourSchemes/annotationColouring.html">Annotation
Colouring</a>.</em><br></li>
+ <li><strong>By RNA Helices</strong><br>
+ <em>Colours the helices of an RNA alignment loaded from a Stockholm file. See
+ <a href="../colourSchemes/rnahelicesColouring.html">RNA Helices
+ Colouring</a>.</em><br>
+ </li>
</ul></li>
<li><strong>Calculate</strong>
<ul>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
</em></li>
<li>Colour Scheme options: <strong>None, ClustalX, Blosum62 Score, Percentage
Identity, Zappo, Taylor, Hydrophobicity, Helix Propensity, Strand Propensity,
- Turn Propensity, Buried Index, Nucleotide, User Defined<br>
+ Turn Propensity, Buried Index, Nucleotide, Purine/Pyrimidine, User Defined<br>
</strong> <em>See <a href="../colourSchemes/index.html">colours</a> for
a description of all colour schemes.</em><br>
</li>
<em>Colours the alignment on a per-column value from a specified annotation.
See <a href="../colourSchemes/annotationColouring.html">Annotation Colouring</a>.</em><br>
</li>
+ <li><strong>By RNA Helices</strong><br>
+ <em>Colours the helices of an RNA alignment loaded from a Stockholm file. See
+ <a href="../colourSchemes/rnahelicesColouring.html">RNA Helices
+ Colouring</a>.</em><br>
+ </li>
</ul>
</body>
</html>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<ul>
<li><strong>Fetch Sequence</strong><br>
<em>Shows a dialog window in which you can select known ids from
- Uniprot, EMBL, EMBLCDS or PDB database using Web Services provided by
+ Uniprot, EMBL, EMBLCDS, PDB, PFAM, or RFAM databases using Web Services provided by
the European Bioinformatics Institute. See <a
href="../features/seqfetch.html">Sequence Fetcher</a></em>.</li>
<li><strong>Add Sequences</strong><em><br>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+-->
+<head>
+<title>Nucleic Acid Support</title>
+<style type="text/css">
+<!--
+td {
+ font-family: "Courier New", Courier, mono;
+ font-style: normal;
+ font-size: medium;
+}
+-->
+</style>
+</head>
+<body>
+<p><strong>Nucleic Acid Support</strong></p>
+<p><em>Colour Schemes</em></p>
+<p>Jalview has color schemes for nucleic acid based sequences, ability to
+fetch sequences from RFAM and RNA secondary structure coloring</p>
+<p>Information on the <a href="../colourSchemes/nucleotide.html">Nucleotide
+colour scheme</a> and <a href="../colourSchemes/purinepyrimidine.html">
+Purine/Pyrimidine colour scheme</a> are available
+under the Colour Menu. See <a href="../colourSchemes/index.html">Colour
+Schemes</a>.</p>
+<p><em>RNA Support</em></p>
+<p>Sequences can be <a href="../features/seqfetch.html">fetched</a> from the
+RFAM database by accession number or ID.</p>
+<p>If an RNA alignment is loaded from a Stockholm file with secondary
+structure information in WUSS notation, the alignment can be coloured by
+the helices in the secondary structure. Helices are determined by the base-pairing
+in the secondary structure line. See <a href="../colourSchemes/rnahelicesColouring.html">
+RNA Helices Colouring</a>. Below is an example of this type of coloring</p>
+<p>Annotation panel shows the presence of RNA helices and WUSS notation from
+input file specifying secondary structure.<p>
+<div align="center">
+ <img src="../colourschemes/rnahelicescoloring.png" width="600" height="140"> </div>
+
+
+</div>
+<p align="center"> </p>
+</body>
+</html>
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<strong>What's new ?</strong>
</p>
<p>
- The Jalview 2.7 release features new web services, and important
- improvements to the way in which Jalview handles alignments and
- associated PDB structures, as well as numerous minor improvements and
- bug fixes. Version 2.7 of the JalviewLite applet also features a
- significantly enhanced Javascript API enabling it to be more easily
- integrated with javascript based web applications. <br /> For full
- details see the <a href="releases.html#Jalview2.7">Jalview 2.7
+ The Jalview 2.7.1 release features (tbc)
+ <br /> For full
+ details see the <a href="releases.html#Jalview2.7.1">Jalview 2.7.1
release history</a>.
</p>
<p>
- <strong>Highlights in Jalview Desktop Version 2.7</strong>
+ <strong>Highlights in Jalview Desktop Version 2.7.1</strong>
</p>
<ul>
- <li>New <a href="features/viewingpdbs.html">structure viewer
- options</a>:
- <ul>
- <li>Colour and superimpose 3D structures of complexes and
- multi-domain chains using several different alignments</li>
- <li>Drag and drop to associate PDB files with sequences that
- have the same name</li>
- <li>Open and superimpose all associated structures for the
- current selection</li>
- </ul>
- <li>New web services for <a href="webServices/shmr.html">alignment
- analysis</a></li>
- <li>Improved graphical user interface for <a
- href="http://www.compbio.dundee.ac.uk/jabaws">JABAWS</a>services.
- </li>
- <li>Sort associated alignment views option in tree viewer</li>
- <li>Default colours for <a
- href="colourSchemes/annotationColouring.html">shading alignment
- by quantitative annotation</a>.
- </li>
- <li><a href="webServices/newsreader.html">Jalview Desktop RSS
- reader</a> - following important updates at <a
- href="http://www.jalview.org/feeds/desktop/rss">http://www.jalview.org/feeds/desktop/rss</a>
+
+ <li>New Purine/Pyrimidine colour scheme</li>
+ <li>Colouring of RNA secondary structure by helices. See <a href="na/index.html">Nucleic Acid Support</a></li>
+ <li>Embedded <a href="http://www.varna.fr/">VARNA</a> RNA secondary structure viewer.
</ul>
<p>
<strong>Issues Resolved (a select list - see the <a
- href="releases.html#Jalview2.7">release history</a> for full details)
+ href="releases.html#Jalview2.7.1">release history</a> for full details)
</strong>
</p>
<p>
<strong>Issues in the Jalview Desktop</strong>
<ul>
- <li>Problems viewing associated structures for sequences
- retrieved from UNIPROT</li>
- <li>Problems viewing Jalview projects from older versions in
- version 2.6</li>
- <li>Preservation of hidden annotation rows and tree bootstrap
- values in projects</li>
- <li>Newly added JABAWS servers not always visible in web services
- menu</li>
</ul>
<strong>Issues specific to the JalviewLite Applet</strong>
<ul>
- <li>Layout problems when lots of annotation rows are displayed</li>
- <li><= shown as = in annotation row tooltip</li>
- <li>export features raises exception when no features exist</li>
- <li>relative URLs not handled properly when used in parameters
- and annotation files</li>
</ul>
<strong>Issues affecting both applet and application</strong>
<ul>
- <li>sequence numbering not preserved in MSF alignment output</li>
- <li>sequence associated secondary structure not correctly parsed
- in interleaved stockholm</li>
- <li>sequences containing lowercase letters are not properly
- associated with their pdb files</li>
- <li>Jalview PDB file reader does not extract sequence from deoxy
- nucleotide chains correctly</li>
- <li>Sequence length given in alignment properties window is off
- by 1</li>
</ul>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8"?><!--
Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
This file is part of Jalview.
file.reference.JmolApplet-12.2.4.jar=appletlib/JmolApplet-12.2.4.jar
file.reference.log4j-1.2.8.jar=lib/log4j-1.2.8.jar
file.reference.mail.jar=lib/mail.jar
-file.reference.min-jaba-client.jar=lib/min-jaba-client.jar
+file.reference.min-jaba-client.jar=lib/min-jaba-client-2.0.jar
file.reference.regex.jar=lib/regex.jar
file.reference.saaj.jar=lib/saaj.jar
file.reference.vamsas-client.jar=lib/vamsas-client.jar
file.reference.xercesImpl.jar=lib/xercesImpl.jar
file.reference.xml-apis.jar=lib/xml-apis.jar
file.reference.miglayout-4.0-swing.jar=lib/miglayout-4.0-swing.jar
+file.reference.varna-3.9-dev.jar=lib/VARNAv3.9-dev.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.xml-apis.jar}:\
${file.reference.xercesImpl.jar}:\
${file.reference.wsdl4j.jar}:\
- ${file.reference.JmolApplet-12.2.4.jar}
+ ${file.reference.JmolApplet-12.2.4.jar} \
+ ${file.reference.varna-3.9-dev.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
<?xml version="1.0" encoding="UTF-8"?><!--
Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
This file is part of Jalview.
--- /dev/null
+YEAR=2011
+AUTHORS=J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+AUTHORFNAMES=Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton
+
\ No newline at end of file
<?xml version="1.0"?>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<?xml version="1.0"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8"?>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8"?>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
<?xml version="1.0" encoding="UTF-8"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<xs:attribute name="autoCalculated" type="xs:boolean" use="optional" default="false">
<xs:annotation><xs:documentation>is an autocalculated annotation row</xs:documentation>
</xs:annotation></xs:attribute>
+ <xs:attribute name="belowAlignment" type="xs:boolean" use="optional" default="true">
+ <xs:annotation><xs:documentation>is to be shown below the alignment - introduced in Jalview 2.8 for visualizing T-COFFEE alignment scores</xs:documentation></xs:annotation></xs:attribute>
+ <xs:attribute name="calcId" type="xs:string" use="optional">
+ <xs:annotation><xs:documentation>Optional string identifier used to group sets of annotation produced by a particular calculation. Values are opaque strings but have semantic meaning to Jalview's renderer, data importer and calculation system.</xs:documentation></xs:annotation>
+ </xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name="SequenceSet">
<?xml version="1.0" encoding="UTF-8"?>\r
<!--\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.analysis;
* returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
* This class is used extensively in calculating alignment colourschemes that
* depend on the amount of conservation in each alignment column.
- *
+ *
* @author $author$
* @version $Revision$
*/
public static final String PROFILE = "P";
- public static final Hashtable[] calculate(Vector sequences, int start,
+ public static final Hashtable[] calculate(List<SequenceI> list, int start,
int end)
{
- return calculate(sequences, start, end, false);
+ return calculate(list, start, end, false);
}
- public static final Hashtable[] calculate(Vector sequences, int start,
+ public static final Hashtable[] calculate(List<SequenceI> sequences, int start,
int end, boolean profile)
{
SequenceI[] seqs = new SequenceI[sequences.size()];
int width = 0;
+ synchronized (sequences) {
for (int i = 0; i < sequences.size(); i++)
{
- seqs[i] = (SequenceI) sequences.elementAt(i);
+ seqs[i] = sequences.get(i);
if (seqs[i].getLength() > width)
{
width = seqs[i].getLength();
}
calculate(seqs, start, end, reply, profile);
-
return reply;
}
+ }
public static final void calculate(SequenceI[] sequences, int start,
int end, Hashtable[] result)
residueHash.put(MAXCOUNT, new Integer(maxCount));
residueHash.put(MAXRESIDUE, maxResidue);
- percentage = ((float) maxCount * 100) / (float) jSize;
+ percentage = ((float) maxCount * 100) / jSize;
residueHash.put(PID_GAPS, new Float(percentage));
- percentage = ((float) maxCount * 100) / (float) nongap;
+ percentage = ((float) maxCount * 100) / nongap;
residueHash.put(PID_NOGAPS, new Float(percentage));
result[i] = residueHash;
}
/**
* Compute all or part of the annotation row from the given consensus
* hashtable
- *
+ *
* @param consensus
* - pre-allocated annotation row
* @param hconsensus
}
for (int i = iStart; i < width; i++)
{
- if (i >= hconsensus.length)
+ Hashtable hci;
+ if (i >= hconsensus.length || ((hci=hconsensus[i])==null))
{
// happens if sequences calculated over were shorter than alignment
// width
consensus.annotations[i] = null;
continue;
}
+
value = 0;
+ Float fv;
if (ignoreGapsInConsensusCalculation)
{
- value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
- .floatValue();
+ fv = (Float) hci.get(AAFrequency.PID_NOGAPS);
}
else
{
- value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
- .floatValue();
+ fv = (Float) hci.get(AAFrequency.PID_GAPS);
}
-
- String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
- String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
+ if (fv==null)
+ {
+ consensus.annotations[i] = null;
+ // data has changed below us .. give up and
+ continue;
+ }
+ value = fv.floatValue();
+ String maxRes = hci.get(AAFrequency.MAXRESIDUE).toString();
+ String mouseOver = hci.get(AAFrequency.MAXRESIDUE) + " ";
if (maxRes.length() > 1)
{
mouseOver = "[" + maxRes + "] ";
maxRes = "+";
}
- int[][] profile = (int[][]) hconsensus[i].get(AAFrequency.PROFILE);
+ int[][] profile = (int[][]) hci.get(AAFrequency.PROFILE);
if (profile != null && includeAllConsSymbols)
{
mouseOver = "";
{
for (int c = 0; c < alphabet.length; c++)
{
- tval = ((float) profile[0][alphabet[c]])
+ tval = profile[0][alphabet[c]]
* 100f
- / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+ / profile[1][ignoreGapsInConsensusCalculation ? 1
: 0];
mouseOver += ((c == 0) ? "" : "; ") + alphabet[c] + " "
+ ((int) tval) + "%";
{
ca[c] = new char[]
{ (char) c };
- vl[c] = (float) profile[0][c];
+ vl[c] = profile[0][c];
}
;
jalview.util.QuickSort.sort(vl, ca);
{
if (((char[]) ca[c])[0] != '-')
{
- tval = ((float) profile[0][((char[]) ca[c])[0]])
+ tval = profile[0][((char[]) ca[c])[0]]
* 100f
- / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+ / profile[1][ignoreGapsInConsensusCalculation ? 1
: 0];
mouseOver += ((p == 0) ? "" : "; ") + ((char[]) ca[c])[0]
+ " " + ((int) tval) + "%";
/**
* get the sorted profile for the given position of the consensus
- *
+ *
* @param hconsensus
* @return
*/
{
ca[c] = new char[]
{ (char) c };
- vl[c] = (float) profile[0][c];
+ vl[c] = profile[0][c];
}
;
jalview.util.QuickSort.sort(vl, ca);
- rtnval[0] = 1;
+ rtnval[0] = 2;
+ rtnval[1]=0;
for (int c = ca.length - 1; profile[0][((char[]) ca[c])[0]] > 0; c--)
{
if (((char[]) ca[c])[0] != '-')
{
rtnval[rtnval[0]++] = ((char[]) ca[c])[0];
- rtnval[rtnval[0]++] = (int) (((float) profile[0][((char[]) ca[c])[0]]) * 100f / (float) profile[1][ignoreGapsInConsensusCalculation ? 1
+ rtnval[rtnval[0]] = (int) (profile[0][((char[]) ca[c])[0]] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
: 0]);
+ rtnval[1]+=rtnval[rtnval[0]++];
}
}
return rtnval;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.analysis;
/**
* Sort by Percentage Identity w.r.t. s
- *
+ *
* @param align
* AlignmentI
* @param s
/**
* Sort by Percentage Identity w.r.t. s
- *
+ *
* @param align
* AlignmentI
* @param s
/**
* Reverse the order of the sort
- *
+ *
* @param align
* DOCUMENT ME!
* @param seqs
}
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- for (int i = 0; i < len; i++)
+ List<SequenceI> asq;
+ synchronized (asq = align.getSequences())
{
- // SequenceI tmp = seqs[i];
- align.getSequences().setElementAt(seqs[nSeq - i - 1], i);
- align.getSequences().setElementAt(seqs[i], nSeq - i - 1);
+ for (int i = 0; i < len; i++)
+ {
+ // SequenceI tmp = seqs[i];
+ asq.set(i, seqs[nSeq - i - 1]);
+ asq.set(nSeq - i - 1, seqs[i]);
+ }
}
}
/**
* Sets the Alignment object with the given sequences
- *
+ *
* @param align
* Alignment object to be updated
* @param tmp
/**
* Sets the Alignment object with the given sequences
- *
+ *
* @param align
* DOCUMENT ME!
* @param seqs
public static void setOrder(AlignmentI align, SequenceI[] seqs)
{
// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work
- Vector algn = align.getSequences();
- Vector tmp = new Vector();
-
- for (int i = 0; i < seqs.length; i++)
+ List<SequenceI> algn;
+ synchronized (algn = align.getSequences())
{
- if (algn.contains(seqs[i]))
+ List<SequenceI> tmp = new ArrayList<SequenceI>();
+
+ for (int i = 0; i < seqs.length; i++)
{
- tmp.addElement(seqs[i]);
+ if (algn.contains(seqs[i]))
+ {
+ tmp.add(seqs[i]);
+ }
}
- }
- algn.removeAllElements();
- // User may have hidden seqs, then clicked undo or redo
- for (int i = 0; i < tmp.size(); i++)
- {
- algn.addElement(tmp.elementAt(i));
+ algn.clear();
+ // User may have hidden seqs, then clicked undo or redo
+ for (int i = 0; i < tmp.size(); i++)
+ {
+ algn.add(tmp.get(i));
+ }
}
-
}
/**
* Sorts by ID. Numbers are sorted before letters.
- *
+ *
* @param align
* The alignment object to sort
*/
/**
* Sorts by sequence length
- *
+ *
* @param align
* The alignment object to sort
*/
for (int i = 0; i < nSeq; i++)
{
seqs[i] = align.getSequenceAt(i);
- length[i] = (float) (seqs[i].getEnd() - seqs[i].getStart());
+ length[i] = (seqs[i].getEnd() - seqs[i].getStart());
}
QuickSort.sort(length, seqs);
* Sorts the alignment by size of group. <br>
* Maintains the order of sequences in each group by order in given alignment
* object.
- *
+ *
* @param align
* sorts the given alignment object by group
*/
// SORTS GROUPS BY SIZE
// ////////////////////
- for (int i = 0; i < align.getGroups().size(); i++)
+ for (SequenceGroup sg : align.getGroups())
{
- SequenceGroup sg = (SequenceGroup) align.getGroups().elementAt(i);
-
for (int j = 0; j < groups.size(); j++)
{
SequenceGroup sg2 = (SequenceGroup) groups.elementAt(j);
/**
* Converts Vector to array. java 1.18 does not have Vector.toArray()
- *
+ *
* @param tmp
* Vector of SequenceI objects
- *
+ *
* @return array of Sequence[]
*/
private static SequenceI[] vectorToArray(Vector tmp)
}
/**
- * DOCUMENT ME!
- *
+ * Select sequences in order from tmp that is present in mask, and any
+ * remaining seqeunces in mask not in tmp
+ *
* @param tmp
- * DOCUMENT ME!
+ * thread safe collection of sequences
* @param mask
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * thread safe collection of sequences
+ *
+ * @return intersect(tmp,mask)+intersect(complement(tmp),mask)
*/
- private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask)
+ private static SequenceI[] vectorSubsetToArray(List<SequenceI> tmp,
+ List<SequenceI> mask)
{
- Vector seqs = new Vector();
+ ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
int i, idx;
boolean[] tmask = new boolean[mask.size()];
for (i = 0; i < tmp.size(); i++)
{
- Object sq = tmp.elementAt(i);
+ SequenceI sq = tmp.get(i);
idx = mask.indexOf(sq);
if (idx > -1 && tmask[idx])
{
tmask[idx] = false;
- seqs.addElement(sq);
+ seqs.add(sq);
}
}
{
if (tmask[i])
{
- seqs.addElement(mask.elementAt(i));
+ seqs.add(mask.get(i));
}
}
- return vectorToArray(seqs);
+ return seqs.toArray(new SequenceI[seqs.size()]);
}
/**
* Sorts by a given AlignmentOrder object
- *
+ *
* @param align
* Alignment to order
* @param order
/**
* DOCUMENT ME!
- *
+ *
* @param align
* alignment to order
* @param tree
* tree which has
- *
+ *
* @return DOCUMENT ME!
*/
private static Vector getOrderByTree(AlignmentI align, NJTree tree)
if (tmp.size() != nSeq)
{
- System.err.println("WARNING: tmp.size()=" + tmp.size() + " != nseq="
- + nSeq + " in getOrderByTree - tree contains sequences not in alignment");
+ System.err
+ .println("WARNING: tmp.size()="
+ + tmp.size()
+ + " != nseq="
+ + nSeq
+ + " in getOrderByTree - tree contains sequences not in alignment");
}
}
/**
* Sorts the alignment by a given tree
- *
+ *
* @param align
* alignment to order
* @param tree
/**
* DOCUMENT ME!
- *
+ *
* @param align
* DOCUMENT ME!
* @param seqs
/**
* DOCUMENT ME!
- *
+ *
* @param node
* DOCUMENT ME!
* @param tmp
* DOCUMENT ME!
* @param seqset
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
private static Vector _sortByTree(SequenceNode node, Vector tmp,
- Vector seqset)
+ List<SequenceI> seqset)
{
if (node == null)
{
{
if (node.element() instanceof SequenceI)
{
- if (!tmp.contains(node.element())) // && (seqset==null || seqset.size()==0 || seqset.contains(tmp)))
+ if (!tmp.contains(node.element())) // && (seqset==null ||
+ // seqset.size()==0 ||
+ // seqset.contains(tmp)))
{
- tmp.addElement((SequenceI) node.element());
+ tmp.addElement(node.element());
}
}
}
/**
* Sort sequence in order of increasing score attribute for annotation with a
* particular scoreLabel. Or reverse if same label was used previously
- *
+ *
* @param scoreLabel
* exact label for sequence associated AlignmentAnnotation scores to
* use for sorting.
/**
* sort the alignment using the features on each sequence found between start
* and stop with the given featureLabel (and optional group qualifier)
- *
+ *
* @param featureLabel
* (may not be null)
* @param groupLabel
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* end residue position
*/
public Conservation(String name, Hashtable propHash, int threshold,
- Vector sequences, int start, int end)
+ List<SequenceI> sequences, int start, int end)
{
-
this.name = name;
this.propHash = propHash;
this.threshold = threshold;
try {
for (s = 0; s < sSize; s++)
{
- sarray[s] = (SequenceI) sequences.elementAt(s);
+ sarray[s] = (SequenceI) sequences.get(s);
if (sarray[s].getLength() > maxLength)
{
maxLength = sarray[s].getLength();
}
}
}
+
+ /**
+ * construct and call the calculation methods on a new Conservation object
+ * @param name - name of conservation
+ * @param consHash - hash table of properties for each amino acid (normally ResidueProperties.propHash)
+ * @param threshold - minimum number of conserved residues needed to indicate conservation (typically 3)
+ * @param seqs
+ * @param start first column in calculation window
+ * @param end last column in calculation window
+ * @param posOrNeg positive (true) or negative (false) conservation
+ * @param consPercGaps percentage of gaps tolerated in column
+ * @param calcQuality flag indicating if alignment quality should be calculated
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(String name,
+ Hashtable consHash, int threshold, List<SequenceI> seqs, int start, int end, boolean posOrNeg, int consPercGaps, boolean calcQuality)
+ {
+ Conservation cons = new Conservation(name, consHash, threshold, seqs, start,end);
+ return calculateConservation(cons, posOrNeg, consPercGaps, calcQuality);
+ }
+ /**
+ * @param b positive (true) or negative (false) conservation
+ * @param consPercGaps percentage of gaps tolerated in column
+ * @param calcQuality flag indicating if alignment quality should be calculated
+ * @return Conservation object ready for use in visualization
+ */
+ public static Conservation calculateConservation(Conservation cons, boolean b, int consPercGaps, boolean calcQuality)
+ {
+ cons.calculate();
+ cons.verdict(b, consPercGaps);
+
+ if (calcQuality)
+ {
+ cons.findQuality();
+ }
+
+ return cons;
+ }
}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ *\r
* This file is part of Jalview.\r
- * \r
+ *\r
* Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
+ * modify it under the terms of the GNU General Public License\r
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ *\r
+ * Jalview is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty\r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
* PURPOSE. See the GNU General Public License for more details.\r
- * \r
+ *\r
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.analysis;\r
\r
import java.util.Enumeration;\r
+import java.util.List;\r
import java.util.Vector;\r
import java.util.Hashtable;\r
\r
/**\r
* Functions for cross-referencing sequence databases. user must first specify\r
* if cross-referencing from protein or dna (set dna==true)\r
- * \r
+ *\r
* @author JimP\r
- * \r
+ *\r
*/\r
public class CrossRef\r
{\r
/**\r
* get the DNA or protein references for a protein or dna sequence\r
- * \r
+ *\r
* @param dna\r
* @param rfs\r
* @return\r
/**\r
* Indirect references are references from other sequences from the dataset to\r
* any of the direct DBRefEntrys on the given sequences.\r
- * \r
+ *\r
* @param dna\r
* true if seqs are DNA seqs\r
* @param seqs\r
}\r
\r
/**\r
- * \r
+ *\r
* @param dna\r
* @param seqs\r
* @return\r
}\r
\r
/**\r
- * \r
+ *\r
* @param seqs\r
* @param dna\r
* @param source\r
* find references to lrfs in the cross-reference set of each sequence in\r
* dataset (that is not equal to sequenceI) Identifies matching DBRefEntry\r
* based on source and accession string only - Map and Version are nulled.\r
- * \r
+ *\r
* @param sequenceI\r
* @param lrfs\r
* @param dataset\r
/**\r
* search a given sequence dataset for references matching cross-references to\r
* the given sequence\r
- * \r
+ *\r
* @param sequenceI\r
* @param xrf\r
* @param dataset\r
* TODO: generalise to different protein classifications Search dataset for\r
* DBRefEntrys matching the given one (xrf) and add the associated sequence to\r
* rseq.\r
- * \r
+ *\r
* @param sequenceI\r
* @param xrf\r
* @param dataset\r
System.err.println("Empty dataset sequence set - NO VECTOR");\r
return false;\r
}\r
- Enumeration e = dataset.getSequences().elements();\r
- while (e.hasMoreElements())\r
+ List<SequenceI> ds;\r
+ synchronized (ds=dataset.getSequences())\r
{\r
- SequenceI nxt = (SequenceI) e.nextElement();\r
+ for (SequenceI nxt:ds)\r
if (nxt != null)\r
{\r
if (nxt.getDatasetSequence() != null)\r
/**\r
* precalculate different products that can be found for seqs in dataset and\r
* return them.\r
- * \r
+ *\r
* @param dna\r
* @param seqs\r
* @param dataset\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
/**
*
* @param sequences
* @param selectedChars
- * @param exgroups
+ * @param list
* @return
*/
public static SequenceGroup[] makeGroupsFrom(SequenceI[] sequences,
- String[] selectedChars, Vector exgroups)
+ String[] selectedChars, List<SequenceGroup> list)
{
// TODO: determine how to get/recover input data for group generation
Hashtable gps = new Hashtable();
int width = 0, i;
Hashtable pgroup = new Hashtable();
- if (exgroups != null)
+ if (list != null)
{
- SequenceGroup sg;
- for (Enumeration g = exgroups.elements(); g.hasMoreElements();)
+ for (SequenceGroup sg:list)
{
- sg = (SequenceGroup) g.nextElement();
- for (Enumeration sq = sg.getSequences(null).elements(); sq
- .hasMoreElements();)
- pgroup.put(sq.nextElement().toString(), sg);
+ for (SequenceI sq :sg.getSequences(null))
+ {
+ pgroup.put(sq.toString(), sg);
+ }
}
}
for (i = 0; i < sequences.length; i++)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* Author: Lauren Michelle Lui
+ * Methods are based on RALEE methods http://personalpages.manchester.ac.uk/staff/sam.griffiths-jones/software/ralee/
+ * */
+
+package jalview.analysis;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+
+import jalview.datamodel.SequenceFeature;
+
+public class Rna
+{
+ static Hashtable<Integer, Integer> pairHash = new Hashtable();
+ /**
+ * Based off of RALEE code ralee-get-base-pairs. Keeps track of open bracket
+ * positions in "stack" vector. When a close bracket is reached, pair this
+ * with the last element in the "stack" vector and store in "pairs" vector.
+ * Remove last element in the "stack" vector. Continue in this manner until
+ * the whole string is processed.
+ *
+ * @param line
+ * Secondary structure line of an RNA Stockholm file
+ * @return Array of SequenceFeature; type = RNA helix, begin is open base
+ * pair, end is close base pair
+ */
+ public static SequenceFeature[] GetBasePairs(CharSequence line) throws WUSSParseException
+ {
+ Stack stack = new Stack();
+ Vector pairs = new Vector();
+
+ int i = 0;
+ while (i < line.length())
+ {
+ char base = line.charAt(i);
+
+ if ((base == '<') || (base == '(') || (base == '{') || (base == '['))
+ {
+ stack.push(i);
+ }
+ else if ((base == '>') || (base == ')') || (base == '}')
+ || (base == ']'))
+ {
+
+ if (stack.isEmpty())
+ {
+ // error whilst parsing i'th position. pass back
+ throw new WUSSParseException("Mismatched closing bracket", i);
+ }
+ Object temp = stack.pop();
+ pairs.addElement(temp);
+ pairs.addElement(i);
+ }
+
+ i++;
+ }
+
+ int numpairs = pairs.size() / 2;
+ SequenceFeature[] outPairs = new SequenceFeature[numpairs];
+
+ // Convert pairs to array
+ for (int p = 0; p < pairs.size(); p += 2)
+ {
+ int begin = Integer.parseInt(pairs.elementAt(p).toString());
+ int end = Integer.parseInt(pairs.elementAt(p + 1).toString());
+
+ outPairs[p / 2] = new SequenceFeature("RNA helix", "", "", begin,
+ end, "");
+ //pairHash.put(begin, end);
+
+ }
+
+ return outPairs;
+ }
+
+
+ /**
+ * Function to get the end position corresponding to a given start position
+ * @param indice - start position of a base pair
+ * @return - end position of a base pair
+ */
+ /*makes no sense at the moment :(
+ public int findEnd(int indice){
+ //TODO: Probably extend this to find the start to a given end?
+ //could be done by putting everything twice to the hash
+ ArrayList<Integer> pair = new ArrayList<Integer>();
+ return pairHash.get(indice);
+ }*/
+
+
+ /**
+ * Figures out which helix each position belongs to and stores the helix
+ * number in the 'featureGroup' member of a SequenceFeature Based off of RALEE
+ * code ralee-helix-map.
+ *
+ * @param pairs
+ * Array of SequenceFeature (output from Rna.GetBasePairs)
+ */
+ public static void HelixMap(SequenceFeature[] pairs)
+ {
+
+ int helix = 0; // Number of helices/current helix
+ int lastopen = 0; // Position of last open bracket reviewed
+ int lastclose = 9999999; // Position of last close bracket reviewed
+ int i = pairs.length; // Number of pairs
+
+ int open; // Position of an open bracket under review
+ int close; // Position of a close bracket under review
+ int j; // Counter
+
+ Hashtable helices = new Hashtable(); // Keep track of helix number for each
+ // position
+
+ // Go through each base pair and assign positions a helix
+ for (i = 0; i < pairs.length; i++)
+ {
+
+ open = pairs[i].getBegin();
+ close = pairs[i].getEnd();
+
+ // System.out.println("open " + open + " close " + close);
+ // System.out.println("lastclose " + lastclose + " lastopen " + lastopen);
+
+ // we're moving from right to left based on closing pair
+ /*
+ * catch things like <<..>>..<<..>> |
+ */
+ if (open > lastclose)
+ {
+ helix++;
+ }
+
+ /*
+ * catch things like <<..<<..>>..<<..>>>> |
+ */
+ j = pairs.length - 1;
+ while (j >= 0)
+ {
+ int popen = pairs[j].getBegin();
+
+ // System.out.println("j " + j + " popen " + popen + " lastopen "
+ // +lastopen + " open " + open);
+ if ((popen < lastopen) && (popen > open))
+ {
+ if (helices.containsValue(popen)
+ && (((Integer) helices.get(popen)) == helix))
+ {
+ continue;
+ }
+ else
+ {
+ helix++;
+ break;
+ }
+ }
+
+ j -= 1;
+ }
+
+ // Put positions and helix information into the hashtable
+ helices.put(open, helix);
+ helices.put(close, helix);
+
+ // Record helix as featuregroup
+ pairs[i].setFeatureGroup(Integer.toString(helix));
+
+ lastopen = open;
+ lastclose = close;
+
+ }
+ }
+}
+
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package jalview.analysis;
+
+import java.util.*;
+
+import jalview.datamodel.*;
+
+/**
+ * Takes in a vector or array of sequences and column start and column end and
+ * returns a new Hashtable[] of size maxSeqLength, if Hashtable not supplied.
+ * This class is used extensively in calculating alignment colourschemes that
+ * depend on the amount of conservation in each alignment column.
+ *
+ * @author $author$
+ * @version $Revision$
+ */
+public class StructureFrequency
+{
+ // No need to store 1000s of strings which are not
+ // visible to the user.
+ public static final String MAXCOUNT = "C";
+
+ public static final String MAXRESIDUE = "R";
+
+ public static final String PID_GAPS = "G";
+
+ public static final String PID_NOGAPS = "N";
+
+ public static final String PROFILE = "P";
+
+ public static final String PAIRPROFILE = "B";
+
+ /**
+ * Returns the 3' position of a base pair
+ *
+ * @param pairs
+ * Secondary structure annotation
+ * @param indice
+ * 5' position of a base pair
+ * @return 3' position of a base pair
+ */
+ public static int findPair(SequenceFeature[] pairs, int indice)
+ {
+ for (int i = 0; i < pairs.length; i++)
+ {
+ if (pairs[i].getBegin() == indice)
+ {
+ return pairs[i].getEnd();
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * Method to calculate a 'base pair consensus row', very similar to nucleotide
+ * consensus but takes into account a given structure
+ *
+ * @param sequences
+ * @param start
+ * @param end
+ * @param result
+ * @param profile
+ * @param rnaStruc
+ */
+ public static final void calculate(SequenceI[] sequences, int start,
+ int end, Hashtable[] result, boolean profile,
+ AlignmentAnnotation rnaStruc)
+ {
+ Hashtable residueHash;
+ String maxResidue;
+ char[] seq, struc = rnaStruc.getRNAStruc().toCharArray();
+ SequenceFeature[] rna = rnaStruc._rnasecstr;
+ char c, s, cEnd;
+ int count, nonGap = 0, i, bpEnd = -1, j, jSize = sequences.length;
+ int[] values;
+ int[][] pairs;
+ float percentage;
+
+ for (i = start; i < end; i++) // foreach column
+ {
+ residueHash = new Hashtable();
+ maxResidue = "-";
+ values = new int[255];
+ pairs = new int[255][255];
+ bpEnd = -1;
+ if (i < struc.length)
+ {
+ s = struc[i];
+ }
+ else
+ {
+ s = '-';
+ }
+ if (s == '.' || s == ' ')
+ {
+ s = '-';
+ }
+
+ if (s != '(')
+ {
+ if (s == '-')
+ {
+ values['-']++;
+ }
+ }
+ else
+ {
+ bpEnd = findPair(rna, i);
+ if (bpEnd>-1)
+ {
+ for (j = 0; j < jSize; j++) // foreach row
+ {
+ if (sequences[j] == null)
+ {
+ System.err
+ .println("WARNING: Consensus skipping null sequence - possible race condition.");
+ continue;
+ }
+ c = sequences[j].getCharAt(i);
+ {
+
+ // standard representation for gaps in sequence and structure
+ if (c == '.' || c == ' ')
+ {
+ c = '-';
+ }
+
+ if (c == '-')
+ {
+ values['-']++;
+ continue;
+ }
+ cEnd = sequences[j].getCharAt(bpEnd);
+ if (checkBpType(c, cEnd))
+ {
+ values['(']++; // H means it's a helix (structured)
+ }
+ pairs[c][cEnd]++;
+
+ maxResidue = "(";
+ }
+ }
+ }
+ // nonGap++;
+ }
+ // UPDATE this for new values
+ if (profile)
+ {
+ residueHash.put(PROFILE, new int[][]
+ { values, new int[]
+ { jSize, (jSize - values['-']) } });
+
+ residueHash.put(PAIRPROFILE, pairs);
+ }
+
+ count = values['('];
+
+ residueHash.put(MAXCOUNT, new Integer(count));
+ residueHash.put(MAXRESIDUE, maxResidue);
+
+ percentage = ((float) count * 100) / jSize;
+ residueHash.put(PID_GAPS, new Float(percentage));
+
+ // percentage = ((float) count * 100) / (float) nongap;
+ // residueHash.put(PID_NOGAPS, new Float(percentage));
+ if (result[i] == null)
+ {
+ result[i] = residueHash;
+ }
+ if (bpEnd > 0)
+ {
+ values[')'] = values['('];
+ values['('] = 0;
+
+ residueHash = new Hashtable();
+ maxResidue = ")";
+
+ if (profile)
+ {
+ residueHash.put(PROFILE, new int[][]
+ { values, new int[]
+ { jSize, (jSize - values['-']) } });
+
+ residueHash.put(PAIRPROFILE, pairs);
+ }
+
+ residueHash.put(MAXCOUNT, new Integer(count));
+ residueHash.put(MAXRESIDUE, maxResidue);
+
+ percentage = ((float) count * 100) / jSize;
+ residueHash.put(PID_GAPS, new Float(percentage));
+
+ result[bpEnd] = residueHash;
+ }
+ }
+ }
+
+ /**
+ * Method to check if a base-pair is a canonical or a wobble bp
+ *
+ * @param up
+ * 5' base
+ * @param down
+ * 3' base
+ * @return True if it is a canonical/wobble bp
+ */
+ public static boolean checkBpType(char up, char down)
+ {
+ if (up > 'Z')
+ {
+ up -= 32;
+ }
+ if (down > 'Z')
+ {
+ down -= 32;
+ }
+
+ switch (up)
+ {
+ case 'A':
+ switch (down)
+ {
+ case 'T':
+ return true;
+ case 'U':
+ return true;
+ }
+ break;
+ case 'C':
+ switch (down)
+ {
+ case 'G':
+ return true;
+ }
+ break;
+ case 'T':
+ switch (down)
+ {
+ case 'A':
+ return true;
+ case 'G':
+ return true;
+ }
+ break;
+ case 'G':
+ switch (down)
+ {
+ case 'C':
+ return true;
+ case 'T':
+ return true;
+ case 'U':
+ return true;
+ }
+ break;
+ case 'U':
+ switch (down)
+ {
+ case 'A':
+ return true;
+ case 'G':
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Compute all or part of the annotation row from the given consensus
+ * hashtable
+ *
+ * @param consensus
+ * - pre-allocated annotation row
+ * @param hconsensus
+ * @param iStart
+ * @param width
+ * @param ignoreGapsInConsensusCalculation
+ * @param includeAllConsSymbols
+ */
+ public static void completeConsensus(AlignmentAnnotation consensus,
+ Hashtable[] hconsensus, int iStart, int width,
+ boolean ignoreGapsInConsensusCalculation,
+ boolean includeAllConsSymbols)
+ {
+ float tval, value;
+ if (consensus == null || consensus.annotations == null
+ || consensus.annotations.length < width)
+ {
+ // called with a bad alignment annotation row - wait for it to be
+ // initialised properly
+ return;
+ }
+ for (int i = iStart; i < width; i++)
+ {
+ Hashtable hci;
+ if (i >= hconsensus.length || ((hci=hconsensus[i])==null))
+ {
+ // happens if sequences calculated over were shorter than alignment
+ // width
+ consensus.annotations[i] = null;
+ continue;
+ }
+ value = 0;
+ Float fv;
+ if (ignoreGapsInConsensusCalculation)
+ {
+ fv =(Float) hci.get(StructureFrequency.PID_NOGAPS);
+ }
+ else
+ {
+ fv = (Float) hci.get(StructureFrequency.PID_GAPS);
+ }
+ if (fv==null)
+ {
+ consensus.annotations[i] = null;
+ // data has changed below us .. give up and
+ continue;
+ }
+ value = fv.floatValue();
+ String maxRes = hci.get(StructureFrequency.MAXRESIDUE)
+ .toString();
+ String mouseOver = hci.get(StructureFrequency.MAXRESIDUE)
+ + " ";
+ if (maxRes.length() > 1)
+ {
+ mouseOver = "[" + maxRes + "] ";
+ maxRes = "+";
+ }
+ int[][] profile = (int[][]) hci
+ .get(StructureFrequency.PROFILE);
+ int[][] pairs = (int[][]) hci
+ .get(StructureFrequency.PAIRPROFILE);
+
+ if (pairs != null && includeAllConsSymbols) // Just responsible for the
+ // tooltip
+ // TODO Update tooltips for Structure row
+ {
+ mouseOver = "";
+
+ /* TODO It's not sure what is the purpose of the alphabet and wheter it is useful for structure?
+ *
+ * if (alphabet != null) { for (int c = 0; c < alphabet.length; c++) {
+ * tval = ((float) profile[0][alphabet[c]]) 100f / (float)
+ * profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; mouseOver +=
+ * ((c == 0) ? "" : "; ") + alphabet[c] + " " + ((int) tval) + "%"; } }
+ * else {
+ */
+ Object[] ca = new Object[625];
+ float[] vl = new float[625];
+ int x = 0;
+ for (int c = 65; c < 90; c++)
+ {
+ for (int d = 65; d < 90; d++)
+ {
+ ca[x] = new int[]
+ { c, d };
+ vl[x] = pairs[c][d];
+ x++;
+ }
+ }
+ jalview.util.QuickSort.sort(vl, ca);
+ int p = 0;
+
+ for (int c = 624; c > 0; c--)
+ {
+ if (vl[c] > 0)
+ {
+ tval = (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
+ : 0]);
+ mouseOver += ((p == 0) ? "" : "; ") + (char) ((int[]) ca[c])[0]
+ + (char) ((int[]) ca[c])[1] + " " + ((int) tval) + "%";
+ p++;
+
+ }
+ }
+
+ // }
+ }
+ else
+ {
+ mouseOver += ((int) value + "%");
+ }
+ consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
+ value);
+ }
+ }
+
+ /**
+ * get the sorted base-pair profile for the given position of the consensus
+ *
+ * @param hconsensus
+ * @return profile of the given column
+ */
+ public static int[] extractProfile(Hashtable hconsensus,
+ boolean ignoreGapsInConsensusCalculation)
+ {
+ int[] rtnval = new int[74]; // 2*(5*5)+2
+ int[][] profile = (int[][]) hconsensus.get(StructureFrequency.PROFILE);
+ int[][] pairs = (int[][]) hconsensus
+ .get(StructureFrequency.PAIRPROFILE);
+
+ if (profile == null)
+ return null;
+
+ // TODO fix the object length, also do it in completeConsensus
+ Object[] ca = new Object[625];
+ float[] vl = new float[625];
+ int x = 0;
+ for (int c = 65; c < 90; c++)
+ {
+ for (int d = 65; d < 90; d++)
+ {
+ ca[x] = new int[]
+ { c, d };
+ vl[x] = pairs[c][d];
+ x++;
+ }
+ }
+ jalview.util.QuickSort.sort(vl, ca);
+
+ rtnval[0] = 2;
+ rtnval[1] = 0;
+ for (int c = 624; c > 0; c--)
+ {
+ if (vl[c] > 0)
+ {
+ rtnval[rtnval[0]++] = ((int[]) ca[c])[0];
+ rtnval[rtnval[0]++] = ((int[]) ca[c])[1];
+ rtnval[rtnval[0]] = (int) (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1
+ : 0]);
+ rtnval[1]+=rtnval[rtnval[0]++];
+ }
+ }
+
+ return rtnval;
+ }
+
+ public static void main(String args[])
+ {
+ // Short test to see if checkBpType works
+ ArrayList<String> test = new ArrayList<String>();
+ test.add("A");
+ test.add("c");
+ test.add("g");
+ test.add("T");
+ test.add("U");
+ for (String i : test)
+ {
+ for (String j : test)
+ {
+ System.out.println(i + "-" + j + ": "
+ + StructureFrequency.checkBpType(i.charAt(0), j.charAt(0)));
+ }
+ }
+ }
+}
--- /dev/null
+package jalview.analysis;
+
+public class WUSSParseException extends Exception {
+ private long problemPos;
+ public WUSSParseException(long problemPos)
+ {
+ this("Invalid WUSS Notation", problemPos);
+ }
+ public WUSSParseException(String message, long problemPos)
+ {
+ super(message+" at or near position "+problemPos);
+ this.problemPos=problemPos;
+ }
+ public long getProblemPos()
+ {
+ return problemPos;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package jalview.api;
+
+import java.util.List;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+public interface AlignCalcManagerI
+{
+
+
+ /**
+ * tell manager that a worker is initialised and has started to run
+ * @param worker
+ */
+ void notifyStart(AlignCalcWorkerI worker);
+
+ /**
+ * check if a calculation of this type is already active
+ * @param worker
+ * @return
+ */
+ boolean alreadyDoing(AlignCalcWorkerI worker);
+
+ /**
+ * tell manager that worker is now processing data
+ * @param worker
+ */
+ boolean notifyWorking(AlignCalcWorkerI worker);
+
+
+ /**
+ * notify manager that the worker has completed, and results may be ready to collect
+ * @param worker
+ */
+ void workerComplete(AlignCalcWorkerI worker);
+
+ /**
+ * indicate that a worker like this cannot run on the platform and shouldn't be started again
+ * @param worker
+ */
+ void workerCannotRun(AlignCalcWorkerI worker);
+
+ /**
+ * indicate that a worker like this may be run on the platform.
+ * @param worker of class to be removed from the execution blacklist
+ */
+ void workerMayRun(AlignCalcWorkerI worker);
+ /**
+ * launch a new worker
+ * @param worker
+ */
+ void startWorker(AlignCalcWorkerI worker);
+
+ /**
+ *
+ * @param worker
+ * @return
+ */
+ boolean isWorking(AlignCalcWorkerI worker);
+
+ /**
+ * if any worker thread is operational, return true!
+ * @return
+ */
+ boolean isWorking();
+
+
+ /**
+ * register a restartable worker
+ * @param worker
+ */
+ void registerWorker(AlignCalcWorkerI worker);
+
+ /**
+ * restart any registered workers
+ */
+ void restartWorkers();
+
+ /**
+ *
+ * @param alignmentAnnotation
+ * @return true if a currently registered and working worker indicates its involvement with the given alignmentAnnotation
+ */
+ boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation);
+
+ /**
+ * kick any known instances of the given worker class to update their annotation
+ * @param workerClass
+ */
+ void updateAnnotationFor(Class workerClass);
+
+ /**
+ * return any registered workers of the given class
+ * @param workerClass
+ * @return null or one or more workers of the given class
+ */
+ List<AlignCalcWorkerI> getRegisteredWorkersOfClass(
+ Class workerClass);
+
+ /**
+ * start any workers of the given class
+ * @param workerClass
+ * @return false if no workers of given class were registered
+ * (note - blacklisted classes cannot be restarted, so this method will return true for blacklisted workers)
+ */
+ boolean startRegisteredWorkersOfClass(Class workerClass);
+
+ /**
+ * work out if there is an instance of a worker that is *waiting* to start
+ * calculating
+ *
+ * @param workingClass
+ * @return true if workingClass is already waiting to calculate. false if it
+ * is calculating, or not queued.
+ */
+ boolean isPending(AlignCalcWorkerI workingClass);
+
+}
--- /dev/null
+package jalview.api;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+public interface AlignCalcWorkerI extends Runnable
+{
+
+ public boolean involves(AlignmentAnnotation annot);
+
+ public void updateAnnotation();
+}
--- /dev/null
+/**
+ *
+ */
+package jalview.api;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.RNAHelicesColour;
+
+/**
+ * @author jimp
+ *
+ */
+public interface AlignViewportI
+{
+
+ int getCharWidth();
+
+ int getEndRes();
+
+ int getCharHeight();
+
+ boolean hasHiddenColumns();
+
+ boolean isValidCharWidth();
+
+ boolean isShowConsensusHistogram();
+
+ boolean isShowSequenceLogo();
+
+ boolean isNormaliseSequenceLogo();
+
+ ColourSchemeI getGlobalColourScheme();
+
+ AlignmentI getAlignment();
+
+ ColumnSelection getColumnSelection();
+
+ Hashtable[] getSequenceConsensusHash();
+
+ Hashtable[] getRnaStructureConsensusHash();
+
+ boolean getIgnoreGapsConsensus();
+
+ boolean getCentreColumnLabels();
+
+ boolean isCalculationInProgress(AlignmentAnnotation alignmentAnnotation);
+
+ AlignmentAnnotation getAlignmentQualityAnnot();
+
+ AlignmentAnnotation getAlignmentConservationAnnotation();
+ /**
+ * get the container for alignment consensus annotation
+ * @return
+ */
+ AlignmentAnnotation getAlignmentConsensusAnnotation();
+
+ /**
+ * Test to see if viewport is still open and active
+ * @return true indicates that all references to viewport should be dropped
+ */
+ boolean isClosed();
+ /**
+ * get the associated calculation thread manager for the view
+ * @return
+ */
+ AlignCalcManagerI getCalcManager();
+
+ /**
+ * get the percentage gaps allowed in a conservation calculation
+ *
+ */
+ public int getConsPercGaps();
+
+ /**
+ * set the consensus result object for the viewport
+ * @param hconsensus
+ */
+ void setSequenceConsensusHash(Hashtable[] hconsensus);
+
+ /**
+ *
+ * @return the alignment annotatino row for the structure consensus calculation
+ */
+ AlignmentAnnotation getAlignmentStrucConsensusAnnotation();
+
+ /**
+ * set the Rna structure consensus result object for the viewport
+ * @param hStrucConsensus
+ */
+ void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus);
+
+ /**
+ * set global colourscheme
+ * @param rhc
+ */
+ void setGlobalColourScheme(ColourSchemeI rhc);
+
+ Map<SequenceI, SequenceCollectionI> getHiddenRepSequences();
+
+ void setHiddenRepSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences);
+
+}
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* @author JimP
*
*/
-public interface AlignmentViewPanel
+public interface AlignmentViewPanel extends OOMHandlerI
{
AlignmentI getAlignment();
StructureSelectionManager getStructureSelectionManager();
+ /**
+ * repaint the alignment view after a datamodel update.
+ * @param updateOverview - if true, the overview panel will also be updated and repainted
+ */
+
+ void paintAlignment(boolean updateOverview);
+ /**
+ * automatically adjust annotation panel height for new annotation
+ * whilst ensuring the alignment is still visible.
+ */
+ void adjustAnnotationHeight();
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.api;
+
+public interface OOMHandlerI
+{
+
+ void raiseOOMWarning(String string, OutOfMemoryError error);
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
showColourText.setState(sg.getColourText());
showBoxes.setState(sg.getDisplayBoxes());
displayNonconserved.setState(sg.getShowNonconserved());
- if (!ap.av.alignment.getGroups().contains(sg))
+ if (!ap.av.getAlignment().getGroups().contains(sg))
{
groupMenu.remove(unGroupMenuItem);
}
remove(seqMenu);
}
- if (!ap.av.hasHiddenRows)
+ if (!ap.av.hasHiddenRows())
{
remove(revealAll);
remove(revealSeq);
} else {
- final int index = ap.av.alignment.findIndex(seq);
+ final int index = ap.av.getAlignment().findIndex(seq);
if (ap.av.adjustForHiddenSeqs(index)
- ap.av.adjustForHiddenSeqs(index - 1) > 1)
EditCommand editCommand = new EditCommand("Edit Sequences",
EditCommand.REPLACE, dialog.getName().replace(' ',
ap.av.getGapCharacter()),
- sg.getSequencesAsArray(ap.av.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1, ap.av.alignment);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
Vector regions = new Vector();
if (sg != null)
{
- int start = sg.getStartRes();
- int end = sg.getEndRes() + 1;
-
- do
- {
- if (ap.av.hasHiddenColumns)
- {
- if (start == 0)
- {
- start = ap.av.colSel.adjustForHiddenColumns(start);
- }
-
- end = ap.av.colSel.getHiddenBoundaryRight(start);
- if (start == end)
- {
- end = sg.getEndRes() + 1;
- }
- if (end > sg.getEndRes())
- {
- end = sg.getEndRes() + 1;
- }
- }
-
- regions.addElement(new int[]
- { start, end });
-
- if (ap.av.hasHiddenColumns)
- {
- start = ap.av.colSel.adjustForHiddenColumns(end);
- start = ap.av.colSel.getHiddenBoundaryLeft(start) + 1;
- }
- } while (end < sg.getEndRes());
-
- int[][] startEnd = new int[regions.size()][2];
- for (int i = 0; i < regions.size(); i++)
- {
- startEnd[i] = (int[]) regions.elementAt(i);
- }
+ int[][] startEnd = ap.av.getVisibleRegionBoundaries(sg.getStartRes(),
+ sg.getEndRes() + 1);
String description;
int caseChange;
}
ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
- sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), startEnd,
caseChange);
ap.alignFrame.addHistoryItem(caseCommand);
frame.add(cap);
jalview.bin.JalviewLite.addFrame(frame,
"Selection output - " + e.getActionCommand(), 600, 500);
+ // JBPNote: getSelectionAsNewSequence behaviour has changed - this method now returns a full copy of sequence data
+ // TODO consider using getSequenceSelection instead here
cap.setText(new jalview.io.AppletFormatAdapter().formatSequences(
e.getActionCommand(),
{
SequenceGroup sg = getGroup();
sg.cs = new ClustalxColourScheme(
- sg.getSequences(ap.av.hiddenRepSequences),
- ap.av.alignment.getWidth());
+ sg,ap.av.getHiddenRepSequences());
refresh();
}
if (abovePIDColour.getState())
{
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.getSequences(ap.av.getHiddenRepSequences()), 0,
+ ap.av.getAlignment().getWidth()));
int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
.getName());
SequenceGroup sg = getGroup();
sg.cs = new PIDColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.getSequences(ap.av.getHiddenRepSequences()), 0,
+ ap.av.getAlignment().getWidth()));
refresh();
}
sg.cs = new Blosum62ColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth()));
+ sg.getSequences(ap.av.getHiddenRepSequences()), 0,
+ ap.av.getAlignment().getWidth()));
refresh();
}
if (conservationMenuItem.getState())
{
- Conservation c = new Conservation("Group",
+ sg.cs.setConservation(Conservation.calculateConservation("Group",
ResidueProperties.propHash, 3,
- sg.getSequences(ap.av.hiddenRepSequences), 0,
- ap.av.alignment.getWidth());
-
- c.calculate();
- c.verdict(false, ap.av.ConsPercGaps);
-
- sg.cs.setConservation(c);
-
+ sg.getSequences(ap.av.getHiddenRepSequences()), 0,
+ ap.av.getAlignment().getWidth(),
+ false, ap.av.getConsPercGaps(),false));
SliderPanel.setConservationSlider(ap, sg.cs, sg.getName());
SliderPanel.showConservationSlider();
}
// this method won't add a new group if it already exists
if (sg != null)
{
- ap.av.alignment.addGroup(sg);
+ ap.av.getAlignment().addGroup(sg);
}
return sg;
void unGroupMenuItem_actionPerformed()
{
SequenceGroup sg = ap.av.getSelectionGroup();
- ap.av.alignment.deleteGroup(sg);
+ ap.av.getAlignment().deleteGroup(sg);
ap.av.setSelectionGroup(null);
ap.paintAlignment(true);
}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ *\r
* This file is part of Jalview.\r
- * \r
+ *\r
* Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
+ * modify it under the terms of the GNU General Public License\r
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ *\r
+ * Jalview is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty\r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
* PURPOSE. See the GNU General Public License for more details.\r
- * \r
+ *\r
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
*/\r
package jalview.appletgui;\r
\r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.analysis.*;\r
+import jalview.analysis.AAFrequency;\r
+import jalview.analysis.AlignmentSorter;\r
+import jalview.analysis.Conservation;\r
import jalview.api.SequenceStructureBinding;\r
import jalview.bin.JalviewLite;\r
-import jalview.commands.*;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.schemes.*;\r
+import jalview.commands.CommandI;\r
+import jalview.commands.EditCommand;\r
+import jalview.commands.OrderCommand;\r
+import jalview.commands.RemoveGapColCommand;\r
+import jalview.commands.RemoveGapsCommand;\r
+import jalview.commands.SlideSequencesCommand;\r
+import jalview.commands.TrimRegionCommand;\r
+import jalview.datamodel.Alignment;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.AlignmentOrder;\r
+import jalview.datamodel.ColumnSelection;\r
+import jalview.datamodel.PDBEntry;\r
+import jalview.datamodel.Sequence;\r
+import jalview.datamodel.SequenceCollectionI;\r
+import jalview.datamodel.SequenceGroup;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.io.AnnotationFile;\r
+import jalview.io.AppletFormatAdapter;\r
+import jalview.io.FeaturesFile;\r
+import jalview.io.TCoffeeScoreFile;\r
+import jalview.schemes.Blosum62ColourScheme;\r
+import jalview.schemes.BuriedColourScheme;\r
+import jalview.schemes.ClustalxColourScheme;\r
+import jalview.schemes.ColourSchemeI;\r
+import jalview.schemes.HelixColourScheme;\r
+import jalview.schemes.HydrophobicColourScheme;\r
+import jalview.schemes.NucleotideColourScheme;\r
+import jalview.schemes.PIDColourScheme;\r
+import jalview.schemes.PurinePyrimidineColourScheme;\r
+import jalview.schemes.RNAHelicesColourChooser;\r
+import jalview.schemes.ResidueProperties;\r
+import jalview.schemes.StrandColourScheme;\r
+import jalview.schemes.TCoffeeColourScheme;\r
+import jalview.schemes.TaylorColourScheme;\r
+import jalview.schemes.TurnColourScheme;\r
+import jalview.schemes.ZappoColourScheme;\r
import jalview.structure.StructureSelectionManager;\r
\r
-public class AlignFrame extends EmbmenuFrame implements ActionListener,\r
- ItemListener, KeyListener\r
+import java.awt.BorderLayout;\r
+import java.awt.Canvas;\r
+import java.awt.CheckboxMenuItem;\r
+import java.awt.Color;\r
+import java.awt.Font;\r
+import java.awt.FontMetrics;\r
+import java.awt.Frame;\r
+import java.awt.Graphics;\r
+import java.awt.Label;\r
+import java.awt.Menu;\r
+import java.awt.MenuBar;\r
+import java.awt.MenuItem;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.FocusEvent;\r
+import java.awt.event.FocusListener;\r
+import java.awt.event.ItemEvent;\r
+import java.awt.event.ItemListener;\r
+import java.awt.event.KeyEvent;\r
+import java.awt.event.KeyListener;\r
+import java.awt.event.WindowAdapter;\r
+import java.awt.event.WindowEvent;\r
+import java.io.IOException;\r
+import java.io.InputStreamReader;\r
+import java.net.URL;\r
+import java.net.URLEncoder;\r
+import java.util.Enumeration;\r
+import java.util.Hashtable;\r
+import java.util.List;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemListener, KeyListener\r
{\r
public AlignmentPanel alignPanel;\r
\r
\r
String jalviewServletURL;\r
\r
- public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet,\r
- String title, boolean embedded)\r
- {\r
\r
+ public AlignFrame(AlignmentI al, jalview.bin.JalviewLite applet, String title, boolean embedded)\r
+ {\r
if (applet != null)\r
{\r
jalviewServletURL = applet.getParameter("APPLICATION_URL");\r
viewport.updateConsensus(alignPanel);\r
\r
annotationPanelMenuItem.setState(viewport.showAnnotation);\r
- displayNonconservedMenuItem.setState(viewport.getShowunconserved());\r
+ displayNonconservedMenuItem.setState(viewport.getShowUnconserved());\r
followMouseOverFlag.setState(viewport.getFollowHighlight());\r
- showGroupConsensus.setState(viewport.showGroupConsensus);\r
- showGroupConservation.setState(viewport.showGroupConservation);\r
- showConsensusHistogram.setState(viewport.showConsensusHistogram);\r
- showSequenceLogo.setState(viewport.showSequenceLogo);\r
+ showGroupConsensus.setState(viewport.isShowGroupConsensus());\r
+ showGroupConservation.setState(viewport.isShowGroupConservation());\r
+ showConsensusHistogram.setState(viewport.isShowConsensusHistogram());\r
+ showSequenceLogo.setState(viewport.isShowSequenceLogo());\r
\r
seqLimits.setState(viewport.showJVSuffix);\r
\r
}\r
\r
}\r
-\r
+ if (viewport.getAlignment().isNucleotide())\r
+ {\r
+ viewport.updateStrucConsensus(alignPanel);\r
+ if (viewport.getAlignment().hasRNAStructure())\r
+ {\r
+ RNAHelixColour.setEnabled(true);\r
+ }\r
+ else {\r
+ RNAHelixColour.setEnabled(false);\r
+ }\r
+ } else {\r
+ RNAHelixColour.setEnabled(false);\r
+ purinePyrimidineColour.setEnabled(false);\r
+ }\r
// Some JVMS send keyevents to Top frame or lowest panel,\r
// Havent worked out why yet. So add to both this frame and seqCanvas for\r
// now\r
\r
/**\r
* Load a features file onto the alignment\r
- * \r
+ *\r
* @param file file URL, content, or other resolvable path\r
* @param type is protocol for accessing data referred to by file\r
*/\r
\r
- public void parseFeaturesFile(String file, String type)\r
+ public boolean parseFeaturesFile(String file, String type)\r
{\r
- parseFeaturesFile(file, type, true);\r
+ return parseFeaturesFile(file, type, true);\r
}\r
- \r
+\r
/**\r
* Load a features file onto the alignment\r
- * \r
+ *\r
* @param file file URL, content, or other resolvable path\r
* @param type is protocol for accessing data referred to by file\r
* @param autoenabledisplay when true, display features flag will be automatically enabled if features are loaded\r
+ * @return true if data parsed as a features file\r
*/\r
- public void parseFeaturesFile(String file, String type, boolean autoenabledisplay)\r
- { \r
+ public boolean parseFeaturesFile(String file, String type, boolean autoenabledisplay)\r
+ {\r
+ // TODO: test if importing a features file onto an alignment which already has features with links overwrites the original links.\r
+\r
Hashtable featureLinks = new Hashtable();\r
boolean featuresFile = false;\r
try\r
{\r
featuresFile = new jalview.io.FeaturesFile(file, type)\r
- .parse(viewport.alignment,\r
+ .parse(viewport.getAlignment(),\r
alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,\r
featureLinks, true, viewport.applet.getDefaultParameter("relaxedidmatch", false));\r
} catch (Exception ex)\r
viewport.featureSettings.refreshTable();\r
}\r
alignPanel.paintAlignment(true);\r
+ statusBar.setText("Successfully added features to alignment.");\r
}\r
-\r
+ return featuresFile;\r
}\r
\r
+ @Override\r
public void keyPressed(KeyEvent evt)\r
{\r
if (viewport.cursorMode\r
{\r
case 27: // escape key\r
deselectAllSequenceMenuItem_actionPerformed();\r
- \r
- alignPanel.alabels.cancelDrag(); \r
+\r
+ alignPanel.alabels.cancelDrag();\r
break;\r
case KeyEvent.VK_X:\r
if (evt.isControlDown() || evt.isMetaDown())\r
\r
/**\r
* called by key handler and the hide all/show all menu items\r
- * \r
+ *\r
* @param toggleSeqs\r
* @param toggleCols\r
*/\r
// Hide everything by the current selection - this is a hack - we do the\r
// invert and then hide\r
// first check that there will be visible columns after the invert.\r
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel\r
+ if ((viewport.getColumnSelection() != null && viewport.getColumnSelection().getSelected() != null && viewport.getColumnSelection()\r
.getSelected().size() > 0)\r
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg\r
.getEndRes()))\r
\r
if (toggleSeqs)\r
{\r
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())\r
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())\r
{\r
hide = true;\r
viewport.hideAllSelectedSeqs();\r
}\r
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))\r
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected().size() > 0))\r
{\r
viewport.showAllHiddenSeqs();\r
}\r
\r
if (toggleCols)\r
{\r
- if (viewport.colSel.getSelected().size() > 0)\r
+ if (viewport.getColumnSelection().getSelected().size() > 0)\r
{\r
viewport.hideSelectedColumns();\r
if (!toggleSeqs)\r
{\r
- viewport.selectionGroup = sg;\r
+ viewport.setSelectionGroup(sg);\r
}\r
}\r
else if (!hide)\r
}\r
}\r
\r
+ @Override\r
public void keyReleased(KeyEvent evt)\r
{\r
}\r
\r
+ @Override\r
public void keyTyped(KeyEvent evt)\r
{\r
}\r
\r
+ @Override\r
public void itemStateChanged(ItemEvent evt)\r
{\r
if (evt.getSource() == displayNonconservedMenuItem)\r
}\r
else if (evt.getSource() == autoCalculate)\r
{\r
- viewport.autocalculateConsensus = autoCalculate.getState();\r
+ viewport.autoCalculateConsensus = autoCalculate.getState();\r
}\r
else if (evt.getSource() == sortByTree)\r
{\r
this.alignPanel.annotationPanel.repaint();\r
}\r
\r
+ @Override\r
public void actionPerformed(ActionEvent evt)\r
{\r
Object source = evt.getSource();\r
else if (source == alProperties)\r
{\r
StringBuffer contents = new jalview.io.AlignmentProperties(\r
- viewport.alignment).formatAsString();\r
+ viewport.getAlignment()).formatAsString();\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this);\r
cap.setText(contents.toString());\r
Frame frame = new Frame();\r
else if (source == clustalColour)\r
{\r
abovePIDThreshold.setState(false);\r
- changeColour(new ClustalxColourScheme(\r
- viewport.alignment.getSequences(),\r
- viewport.alignment.getWidth()));\r
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(),null));\r
}\r
else if (source == zappoColour)\r
{\r
{\r
changeColour(new NucleotideColourScheme());\r
}\r
+ else if (source == purinePyrimidineColour)\r
+ {\r
+ changeColour(new PurinePyrimidineColourScheme());\r
+ }\r
+ else if (source == RNAHelixColour)\r
+ {\r
+ new RNAHelicesColourChooser(viewport, alignPanel);\r
+ }\r
else if (source == modifyPID)\r
{\r
modifyPID_actionPerformed();\r
{\r
changeColour(new Blosum62ColourScheme());\r
}\r
+ else if (source == tcoffeeColour) {\r
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+ }\r
else if (source == annotationColour)\r
{\r
new AnnotationColourChooser(viewport, alignPanel);\r
public void loadAnnotations()\r
{\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this);\r
- cap.setText("Paste your features / annotations file here.");\r
+ cap.setText("Paste your features / annotations / T-coffee score file here.");\r
cap.setAnnotationImport();\r
Frame frame = new Frame();\r
frame.add(cap);\r
public String outputAnnotations(boolean displayTextbox)\r
{\r
String annotation = new AnnotationFile().printAnnotations(\r
- viewport.showAnnotation ? viewport.alignment\r
- .getAlignmentAnnotation() : null, viewport.alignment\r
+ viewport.showAnnotation ? viewport.getAlignment()\r
+ .getAlignmentAnnotation() : null, viewport.getAlignment()\r
.getGroups(),\r
- ((Alignment) viewport.alignment).alignmentProperties);\r
+ ((Alignment) viewport.getAlignment()).alignmentProperties);\r
\r
if (displayTextbox)\r
{\r
if (format.equalsIgnoreCase("Jalview"))\r
{\r
features = new FeaturesFile().printJalviewFormat(\r
- viewport.alignment.getSequencesArray(),\r
+ viewport.getAlignment().getSequencesArray(),\r
getDisplayedFeatureCols());\r
}\r
else\r
{\r
features = new FeaturesFile().printGFFFormat(\r
- viewport.alignment.getSequencesArray(),\r
+ viewport.getAlignment().getSequencesArray(),\r
getDisplayedFeatureCols());\r
}\r
\r
features = "# No features visible - paste some and import them here.";\r
frimport=true;\r
}\r
- \r
+\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(frimport, this);\r
if (frimport)\r
{\r
public void closeMenuItem_actionPerformed()\r
{\r
PaintRefresher.RemoveComponent(alignPanel);\r
- PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
- PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+ if (alignPanel.seqPanel!=null && alignPanel.seqPanel.seqCanvas!=null)\r
+ {\r
+ PaintRefresher.RemoveComponent(alignPanel.seqPanel.seqCanvas);\r
+ }\r
+ if (alignPanel.idPanel!=null && alignPanel.idPanel.idCanvas!=null) {\r
+ PaintRefresher.RemoveComponent(alignPanel.idPanel.idCanvas);\r
+ }\r
\r
if (PaintRefresher.components.size() == 0 && viewport.applet == null)\r
{\r
}\r
\r
/**\r
- * DOCUMENT ME!\r
+ * TODO: JAL-1104\r
*/\r
void updateEditMenuBar()\r
{\r
}\r
}\r
\r
+ /**\r
+ * TODO: JAL-1104\r
+ */\r
public void addHistoryItem(CommandI command)\r
{\r
if (command.getSize() > 0)\r
viewport.historyList.push(command);\r
viewport.redoList.removeAllElements();\r
updateEditMenuBar();\r
- viewport.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ viewport.updateHiddenColumns();\r
}\r
}\r
\r
/**\r
+ * TODO: JAL-1104\r
* DOCUMENT ME!\r
- * \r
+ *\r
* @param e\r
* DOCUMENT ME!\r
*/\r
command.undoCommand(null);\r
\r
AlignViewport originalSource = getOriginatingSource(command);\r
-\r
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ // JBPNote Test\r
+ if (originalSource!=viewport) {\r
+ System.err.println("Warning: Viewport object mismatch whilst undoing");\r
+ }\r
+ originalSource.updateHiddenColumns(); // originalSource.hasHiddenColumns = viewport.getColumnSelection().getHiddenColumns() != null;\r
updateEditMenuBar();\r
originalSource.firePropertyChange("alignment", null,\r
- originalSource.alignment.getSequences());\r
+ originalSource.getAlignment().getSequences());\r
}\r
\r
/**\r
+ * TODO: JAL-1104\r
* DOCUMENT ME!\r
- * \r
+ *\r
* @param e\r
* DOCUMENT ME!\r
*/\r
command.doCommand(null);\r
\r
AlignViewport originalSource = getOriginatingSource(command);\r
- originalSource.hasHiddenColumns = viewport.colSel.getHiddenColumns() != null;\r
+ // JBPNote Test\r
+ if (originalSource!=viewport) {\r
+ System.err.println("Warning: Viewport object mismatch whilst re-doing");\r
+ }\r
+ originalSource.updateHiddenColumns(); //sethasHiddenColumns(); = viewport.getColumnSelection().getHiddenColumns() != null;\r
\r
updateEditMenuBar();\r
originalSource.firePropertyChange("alignment", null,\r
- originalSource.alignment.getSequences());\r
+ originalSource.getAlignment().getSequences());\r
}\r
\r
AlignViewport getOriginatingSource(CommandI command)\r
{\r
if (comps.elementAt(i) instanceof AlignmentPanel)\r
{\r
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)\r
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())\r
{\r
originalSource = ((AlignmentPanel) comps.elementAt(i)).av;\r
break;\r
// the current view against the closed view first\r
if (al != null)\r
{\r
- PaintRefresher.validateSequences(al, viewport.alignment);\r
+ PaintRefresher.validateSequences(al, viewport.getAlignment());\r
}\r
\r
originalSource = viewport;\r
{\r
return;\r
}\r
-\r
- if (up)\r
- {\r
- for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
- if (!sg.getSequences(null).contains(seq))\r
- {\r
- continue;\r
- }\r
-\r
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
- if (sg.getSequences(null).contains(temp))\r
- {\r
- continue;\r
- }\r
-\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
- }\r
- }\r
- else\r
- {\r
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
- {\r
- SequenceI seq = viewport.alignment.getSequenceAt(i);\r
- if (!sg.getSequences(viewport.hiddenRepSequences).contains(seq))\r
- {\r
- continue;\r
- }\r
-\r
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
- if (sg.getSequences(viewport.hiddenRepSequences).contains(temp))\r
- {\r
- continue;\r
- }\r
-\r
- viewport.alignment.getSequences().setElementAt(temp, i);\r
- viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
- }\r
- }\r
-\r
+ viewport.getAlignment().moveSelectedSequencesByOne(sg, up ? null : viewport.getHiddenRepSequences(), up);\r
alignPanel.paintAlignment(true);\r
}\r
\r
synchronized void slideSequences(boolean right, int size)\r
{\r
- Vector sg = new Vector();\r
+ List<SequenceI>sg = new Vector<SequenceI>();\r
if (viewport.cursorMode)\r
{\r
- sg.addElement(viewport.alignment\r
+ sg.add(viewport.getAlignment()\r
.getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));\r
}\r
else if (viewport.getSelectionGroup() != null\r
- && viewport.getSelectionGroup().getSize() != viewport.alignment\r
+ && viewport.getSelectionGroup().getSize() != viewport.getAlignment()\r
.getHeight())\r
{\r
sg = viewport.getSelectionGroup().getSequences(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
}\r
\r
if (sg.size() < 1)\r
return;\r
}\r
\r
- Vector invertGroup = new Vector();\r
+ Vector<SequenceI> invertGroup = new Vector();\r
\r
- for (int i = 0; i < viewport.alignment.getHeight(); i++)\r
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)\r
{\r
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))\r
- invertGroup.addElement(viewport.alignment.getSequenceAt(i));\r
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))\r
+ invertGroup.addElement(viewport.getAlignment().getSequenceAt(i));\r
}\r
\r
- SequenceI[] seqs1 = new SequenceI[sg.size()];\r
- for (int i = 0; i < sg.size(); i++)\r
- seqs1[i] = (SequenceI) sg.elementAt(i);\r
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[sg.size()]);\r
\r
- SequenceI[] seqs2 = new SequenceI[invertGroup.size()];\r
+ SequenceI[] seqs2 = invertGroup.toArray(new SequenceI[invertGroup.size()]);\r
for (int i = 0; i < invertGroup.size(); i++)\r
- seqs2[i] = (SequenceI) invertGroup.elementAt(i);\r
+ seqs2[i] = invertGroup.elementAt(i);\r
\r
SlideSequencesCommand ssc;\r
if (right)\r
for (int i = 0; i < sg.getSize(); i++)\r
{\r
SequenceI seq = sg.getSequenceAt(i);\r
- int index = viewport.alignment.findIndex(seq);\r
+ int index = viewport.getAlignment().findIndex(seq);\r
orderedSeqs.put(index + "", seq);\r
}\r
\r
int index = 0, startRes, endRes;\r
char ch;\r
\r
- if (viewport.hasHiddenColumns && viewport.getSelectionGroup() != null)\r
+ if (viewport.hasHiddenColumns() && viewport.getSelectionGroup() != null)\r
{\r
copiedHiddenColumns = new Vector();\r
int hiddenOffset = viewport.getSelectionGroup().getStartRes();\r
{\r
for (int i = 0; i < seqs.length; i++)\r
{\r
- viewport.alignment.addSequence(seqs[i]);\r
+ viewport.getAlignment().addSequence(seqs[i]);\r
}\r
\r
// !newAlignment\r
addHistoryItem(new EditCommand("Add sequences", EditCommand.PASTE,\r
- seqs, 0, viewport.alignment.getWidth(), viewport.alignment));\r
+ seqs, 0, viewport.getAlignment().getWidth(), viewport.getAlignment()));\r
\r
- viewport.setEndSeq(viewport.alignment.getHeight());\r
- viewport.alignment.getWidth();\r
+ viewport.setEndSeq(viewport.getAlignment().getHeight());\r
+ viewport.getAlignment().getWidth();\r
viewport.firePropertyChange("alignment", null,\r
- viewport.alignment.getSequences());\r
+ viewport.getAlignment().getSequences());\r
\r
}\r
\r
}\r
\r
// If the cut affects all sequences, remove highlighted columns\r
- if (sg.getSize() == viewport.alignment.getHeight())\r
+ if (sg.getSize() == viewport.getAlignment().getHeight())\r
{\r
viewport.getColumnSelection().removeElements(sg.getStartRes(),\r
sg.getEndRes() + 1);\r
*/\r
addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,\r
sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
\r
viewport.setSelectionGroup(null);\r
- viewport.alignment.deleteGroup(sg);\r
+ viewport.getAlignment().deleteGroup(sg);\r
\r
viewport.firePropertyChange("alignment", null, viewport.getAlignment()\r
.getSequences());\r
\r
/**\r
* group consensus toggled\r
- * \r
+ *\r
*/\r
protected void showGroupConsensus_actionPerformed()\r
{\r
\r
/*\r
* (non-Javadoc)\r
- * \r
+ *\r
* @see\r
* jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt\r
* .event.ActionEvent)\r
}\r
/*\r
* (non-Javadoc)\r
- * \r
+ *\r
* @see\r
* jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt\r
* .event.ActionEvent)\r
viewport.getSequenceSelection(),\r
viewport.getAlignmentView(true).getSequenceStrings(\r
viewport.getGapCharacter()),\r
- viewport.alignment.getGroups());\r
- viewport.alignment.deleteAllGroups();\r
+ viewport.getAlignment().getGroups());\r
+ viewport.getAlignment().deleteAllGroups();\r
viewport.sequenceColours = null;\r
viewport.setSelectionGroup(null);\r
// set view properties for each group\r
{\r
// gps[g].setShowunconserved(viewport.getShowUnconserved());\r
gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());\r
- viewport.alignment.addGroup(gps[g]);\r
+ viewport.getAlignment().addGroup(gps[g]);\r
Color col = new Color((int) (Math.random() * 255),\r
(int) (Math.random() * 255), (int) (Math.random() * 255));\r
col = col.brighter();\r
- for (Enumeration sq = gps[g].getSequences(null).elements(); sq\r
- .hasMoreElements(); viewport.setSequenceColour(\r
- (SequenceI) sq.nextElement(), col))\r
+ for (SequenceI sq : gps[g].getSequences(null))\r
+ viewport.setSequenceColour(\r
+ sq, col)\r
;\r
}\r
PaintRefresher.Refresh(this, viewport.getSequenceSetId());\r
\r
protected void deleteGroups_actionPerformed()\r
{\r
- viewport.alignment.deleteAllGroups();\r
+ viewport.getAlignment().deleteAllGroups();\r
viewport.sequenceColours = null;\r
viewport.setSelectionGroup(null);\r
\r
{\r
sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);\r
}\r
- sg.setEndRes(viewport.alignment.getWidth() - 1);\r
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);\r
viewport.setSelectionGroup(sg);\r
alignPanel.paintAlignment(true);\r
PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId());\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
TrimRegionCommand trimRegion;\r
{\r
trimRegion = new TrimRegionCommand("Remove Left",\r
TrimRegionCommand.TRIM_LEFT, seqs, column,\r
- viewport.alignment, viewport.colSel,\r
- viewport.selectionGroup);\r
+ viewport.getAlignment(), viewport.getColumnSelection(),\r
+ viewport.getSelectionGroup());\r
viewport.setStartRes(0);\r
}\r
else\r
{\r
trimRegion = new TrimRegionCommand("Remove Right",\r
TrimRegionCommand.TRIM_RIGHT, seqs, column,\r
- viewport.alignment, viewport.colSel,\r
- viewport.selectionGroup);\r
+ viewport.getAlignment(), viewport.getColumnSelection(),\r
+ viewport.getSelectionGroup());\r
}\r
\r
statusBar.setText("Removed " + trimRegion.getSize() + " columns.");\r
\r
addHistoryItem(trimRegion);\r
\r
- Vector groups = viewport.alignment.getGroups();\r
\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
\r
+ for (SequenceGroup sg:viewport.getAlignment().getGroups())\r
+ {\r
if ((trimLeft && !sg.adjustForRemoveLeft(column))\r
|| (!trimLeft && !sg.adjustForRemoveRight(column)))\r
{\r
- viewport.alignment.deleteGroup(sg);\r
+ viewport.getAlignment().deleteGroup(sg);\r
}\r
}\r
\r
\r
public void removeGappedColumnMenuItem_actionPerformed()\r
{\r
- int start = 0, end = viewport.alignment.getWidth() - 1;\r
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
\r
SequenceI[] seqs;\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
start = viewport.getSelectionGroup().getStartRes();\r
end = viewport.getSelectionGroup().getEndRes();\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
RemoveGapColCommand removeGapCols = new RemoveGapColCommand(\r
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);\r
+ "Remove Gapped Columns", seqs, start, end, viewport.getAlignment());\r
\r
addHistoryItem(removeGapCols);\r
\r
\r
// This is to maintain viewport position on first residue\r
// of first sequence\r
- SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
int startRes = seq.findPosition(viewport.startRes);\r
// ShiftList shifts;\r
// viewport.getAlignment().removeGaps(shifts=new ShiftList());\r
\r
public void removeAllGapsMenuItem_actionPerformed()\r
{\r
- int start = 0, end = viewport.alignment.getWidth() - 1;\r
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;\r
\r
SequenceI[] seqs;\r
if (viewport.getSelectionGroup() != null)\r
{\r
seqs = viewport.getSelectionGroup().getSequencesAsArray(\r
- viewport.hiddenRepSequences);\r
+ viewport.getHiddenRepSequences());\r
start = viewport.getSelectionGroup().getStartRes();\r
end = viewport.getSelectionGroup().getEndRes();\r
}\r
else\r
{\r
- seqs = viewport.alignment.getSequencesArray();\r
+ seqs = viewport.getAlignment().getSequencesArray();\r
}\r
\r
// This is to maintain viewport position on first residue\r
// of first sequence\r
- SequenceI seq = viewport.alignment.getSequenceAt(0);\r
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);\r
int startRes = seq.findPosition(viewport.startRes);\r
\r
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
\r
viewport.setStartRes(seq.findIndex(startRes) - 1);\r
\r
\r
/**\r
* create a new view derived from the current view\r
- * \r
+ *\r
* @param viewtitle\r
* @return frame for the new view\r
*/\r
public AlignFrame newView(String viewtitle)\r
{\r
AlignmentI newal;\r
- if (viewport.hasHiddenRows)\r
+ if (viewport.hasHiddenRows())\r
{\r
newal = new Alignment(viewport.getAlignment().getHiddenSequences()\r
.getFullAlignment().getSequencesArray());\r
}\r
else\r
{\r
- newal = new Alignment(viewport.alignment.getSequencesArray());\r
+ newal = new Alignment(viewport.getAlignment().getSequencesArray());\r
}\r
\r
- if (viewport.alignment.getAlignmentAnnotation() != null)\r
+ if (viewport.getAlignment().getAlignmentAnnotation() != null)\r
{\r
- for (int i = 0; i < viewport.alignment.getAlignmentAnnotation().length; i++)\r
+ for (int i = 0; i < viewport.getAlignment().getAlignmentAnnotation().length; i++)\r
{\r
- if (!viewport.alignment.getAlignmentAnnotation()[i].autoCalculated)\r
+ if (!viewport.getAlignment().getAlignmentAnnotation()[i].autoCalculated)\r
{\r
- newal.addAnnotation(viewport.alignment.getAlignmentAnnotation()[i]);\r
+ newal.addAnnotation(viewport.getAlignment().getAlignmentAnnotation()[i]);\r
}\r
}\r
}\r
\r
AlignFrame newaf = new AlignFrame(newal, viewport.applet, "", false);\r
\r
- newaf.viewport.sequenceSetID = alignPanel.av.getSequenceSetId();\r
+ newaf.viewport.setSequenceSetId(alignPanel.av.getSequenceSetId());\r
PaintRefresher.Register(alignPanel, alignPanel.av.getSequenceSetId());\r
PaintRefresher.Register(newaf.alignPanel,\r
newaf.alignPanel.av.getSequenceSetId());\r
}\r
\r
/**\r
- * \r
+ *\r
* @return list of feature groups on the view\r
*/\r
public String[] getFeatureGroups()\r
\r
/**\r
* get sequence feature groups that are hidden or shown\r
- * \r
+ *\r
* @param visible\r
* true is visible\r
* @return list\r
\r
/**\r
* Change the display state for the given feature groups\r
- * \r
+ *\r
* @param groups\r
* list of group strings\r
* @param state\r
overview.getPreferredSize().height + 50);\r
\r
frame.pack();\r
+ final AlignmentPanel ap=alignPanel;\r
frame.addWindowListener(new WindowAdapter()\r
{\r
+ @Override\r
public void windowClosing(WindowEvent e)\r
{\r
- alignPanel.setOverviewPanel(null);\r
+ if (ap!=null) {\r
+ ap.setOverviewPanel(null);\r
+ }\r
};\r
});\r
\r
if (viewport.getConservationSelected())\r
{\r
\r
- Alignment al = (Alignment) viewport.alignment;\r
+ Alignment al = (Alignment) viewport.getAlignment();\r
Conservation c = new Conservation("All",\r
ResidueProperties.propHash, 3, al.getSequences(), 0,\r
al.getWidth() - 1);\r
\r
c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
+ c.verdict(false, viewport.getConsPercGaps());\r
\r
cs.setConservation(c);\r
\r
cs.setConservation(null);\r
}\r
\r
- cs.setConsensus(viewport.hconsensus);\r
+ cs.setConsensus(viewport.getSequenceConsensusHash());\r
\r
}\r
viewport.setGlobalColourScheme(cs);\r
\r
- if (viewport.getColourAppliesToAllGroups())\r
- {\r
- Vector groups = viewport.alignment.getGroups();\r
- for (int i = 0; i < groups.size(); i++)\r
- {\r
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-\r
- if (cs == null)\r
- {\r
- sg.cs = null;\r
- continue;\r
- }\r
- if (cs instanceof ClustalxColourScheme)\r
- {\r
- sg.cs = new ClustalxColourScheme(\r
- sg.getSequences(viewport.hiddenRepSequences),\r
- sg.getWidth());\r
- }\r
- else\r
- {\r
- try\r
- {\r
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- sg.cs = cs;\r
- }\r
- }\r
-\r
- if (viewport.getAbovePIDThreshold()\r
- || cs instanceof PIDColourScheme\r
- || cs instanceof Blosum62ColourScheme)\r
- {\r
- sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());\r
- sg.cs.setConsensus(AAFrequency.calculate(\r
- sg.getSequences(viewport.hiddenRepSequences), 0,\r
- sg.getWidth()));\r
- }\r
- else\r
- {\r
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
- }\r
-\r
- if (viewport.getConservationSelected())\r
- {\r
- Conservation c = new Conservation("Group",\r
- ResidueProperties.propHash, 3,\r
- sg.getSequences(viewport.hiddenRepSequences), 0,\r
- viewport.alignment.getWidth() - 1);\r
- c.calculate();\r
- c.verdict(false, viewport.ConsPercGaps);\r
- sg.cs.setConservation(c);\r
- }\r
- else\r
- {\r
- sg.cs.setConservation(null);\r
- sg.cs.setThreshold(0, viewport.getIgnoreGapsConsensus());\r
- }\r
-\r
- }\r
- }\r
\r
if (alignPanel.getOverviewPanel() != null)\r
{\r
protected void modifyPID_actionPerformed()\r
{\r
if (viewport.getAbovePIDThreshold()\r
- && viewport.globalColourScheme != null)\r
+ && viewport.getGlobalColourScheme() != null)\r
{\r
SliderPanel.setPIDSliderSource(alignPanel,\r
viewport.getGlobalColourScheme(), "Background");\r
protected void modifyConservation_actionPerformed()\r
{\r
if (viewport.getConservationSelected()\r
- && viewport.globalColourScheme != null)\r
+ && viewport.getGlobalColourScheme() != null)\r
{\r
SliderPanel.setConservationSlider(alignPanel,\r
- viewport.globalColourScheme, "Background");\r
+ viewport.getGlobalColourScheme(), "Background");\r
SliderPanel.showConservationSlider();\r
}\r
}\r
.getAlignment().getSequenceAt(0), null);\r
\r
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
{\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByID(viewport.getAlignment());\r
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));\r
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByLength(viewport.getAlignment());\r
addHistoryItem(new OrderCommand("Length Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();\r
AlignmentSorter.sortByGroup(viewport.getAlignment());\r
addHistoryItem(new OrderCommand("Group Sort", oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
\r
}\r
public void PCAMenuItem_actionPerformed()\r
{\r
// are the sequences aligned?\r
- if (!viewport.alignment.isAligned(false))\r
+ if (!viewport.getAlignment().isAligned(false))\r
{\r
SequenceI current;\r
int Width = viewport.getAlignment().getWidth();\r
void NewTreePanel(String type, String pwType, String title)\r
{\r
// are the sequences aligned?\r
- if (!viewport.alignment.isAligned(false))\r
+ if (!viewport.getAlignment().isAligned(false))\r
{\r
SequenceI current;\r
int Width = viewport.getAlignment().getWidth();\r
\r
if ((viewport.getSelectionGroup() != null && viewport\r
.getSelectionGroup().getSize() > 1)\r
- || (viewport.getSelectionGroup() == null && viewport.alignment\r
+ || (viewport.getSelectionGroup() == null && viewport.getAlignment()\r
.getHeight() > 1))\r
{\r
final TreePanel tp = new TreePanel(alignPanel, type, pwType);\r
\r
/**\r
* sort the alignment using the given treePanel\r
- * \r
+ *\r
* @param treePanel\r
* tree used to sort view\r
* @param title\r
// addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
// HistoryItem.SORT));\r
addHistoryItem(new OrderCommand("Order by " + title, oldOrder,\r
- viewport.alignment));\r
+ viewport.getAlignment()));\r
alignPanel.paintAlignment(true);\r
}\r
\r
/**\r
* Do any automatic reordering of the alignment and add the necessary bits to\r
* the menu structure for the new tree\r
- * \r
+ *\r
* @param treePanel\r
* @param title\r
*/\r
sortByTreeMenu.add(item);\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
+ @Override\r
public void actionPerformed(ActionEvent evt)\r
{\r
sortByTree(treePanel, title); // treePanel.getTitle());\r
}\r
});\r
- \r
+\r
treePanel.addWindowListener(new WindowAdapter()\r
{\r
+ @Override\r
public void windowOpened(WindowEvent e)\r
{\r
if (viewport.sortByTree)\r
super.windowOpened(e);\r
}\r
\r
+ @Override\r
public void windowClosing(WindowEvent e)\r
{\r
sortByTreeMenu.remove(item);\r
AlignmentSorter.sortBy(viewport.getAlignment(), alorder);\r
if (undoname!=null)\r
{\r
- addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.alignment));\r
+ addHistoryItem(new OrderCommand(undoname, oldOrder, viewport.getAlignment()));\r
}\r
alignPanel.paintAlignment(true);\r
return true;\r
this.builddate = builddate;\r
}\r
\r
+ @Override\r
public void paint(Graphics g)\r
{\r
g.setColor(Color.white);\r
\r
MenuItem buriedColour = new MenuItem();\r
\r
+ MenuItem purinePyrimidineColour = new MenuItem();\r
+ MenuItem RNAHelixColour = new MenuItem();\r
+\r
MenuItem userDefinedColour = new MenuItem();\r
\r
MenuItem PIDColour = new MenuItem();\r
\r
MenuItem BLOSUM62Colour = new MenuItem();\r
\r
+ MenuItem tcoffeeColour = new MenuItem();\r
+\r
MenuItem njTreeBlosumMenuItem = new MenuItem();\r
\r
MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
CheckboxMenuItem seqLimits = new CheckboxMenuItem();\r
\r
CheckboxMenuItem centreColumnLabelFlag = new CheckboxMenuItem();\r
- \r
+\r
CheckboxMenuItem followMouseOverFlag = new CheckboxMenuItem();\r
Menu autoAnnMenu=new Menu();\r
CheckboxMenuItem showSequenceLogo= new CheckboxMenuItem();\r
\r
item.addActionListener(new java.awt.event.ActionListener()\r
{\r
+ @Override\r
public void actionPerformed(ActionEvent e)\r
{\r
outputText_actionPerformed(e);\r
turnColour.addActionListener(this);\r
buriedColour.setLabel("Buried Index");\r
buriedColour.addActionListener(this);\r
+ purinePyrimidineColour.setLabel("Purine/Pyrimidine");\r
+ purinePyrimidineColour.addActionListener(this);\r
+ RNAHelixColour.setLabel("by RNA Helices");\r
+ RNAHelixColour.addActionListener(this);\r
userDefinedColour.setLabel("User Defined...");\r
userDefinedColour.addActionListener(this);\r
PIDColour.setLabel("Percentage Identity");\r
PIDColour.addActionListener(this);\r
BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
BLOSUM62Colour.addActionListener(this);\r
- avDistanceTreeBlosumMenuItem\r
- .setLabel("Average Distance Using BLOSUM62");\r
+ tcoffeeColour.setLabel("T-Coffee Scores");\r
+ tcoffeeColour.setEnabled(false); // it will enabled only if a score file is provided\r
+ tcoffeeColour.addActionListener(this);\r
+ avDistanceTreeBlosumMenuItem .setLabel("Average Distance Using BLOSUM62");\r
avDistanceTreeBlosumMenuItem.addActionListener(this);\r
njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62");\r
njTreeBlosumMenuItem.addActionListener(this);\r
applyAutoAnnotationSettings.setLabel("Apply to all groups");\r
applyAutoAnnotationSettings.setState(true);\r
autoAnnMenu.setLabel("Autocalculated Annotation");\r
- \r
+\r
invertColSel.addActionListener(this);\r
showColumns.addActionListener(this);\r
showSeqs.addActionListener(this);\r
colourMenu.add(turnColour);\r
colourMenu.add(buriedColour);\r
colourMenu.add(nucleotideColour);\r
+ colourMenu.add(purinePyrimidineColour);\r
+ colourMenu.add(tcoffeeColour);\r
colourMenu.add(userDefinedColour);\r
colourMenu.addSeparator();\r
colourMenu.add(conservationMenuItem);\r
colourMenu.add(abovePIDThreshold);\r
colourMenu.add(modifyPID);\r
colourMenu.add(annotationColour);\r
+ colourMenu.add(RNAHelixColour);\r
calculateMenu.add(sort);\r
calculateMenu.add(calculate);\r
calculateMenu.addSeparator();\r
* Attach the alignFrame panels after embedding menus, if necessary. This used\r
* to be called setEmbedded, but is now creates the dropdown menus in a\r
* platform independent manner to avoid OSX/Mac menu appendage daftness.\r
- * \r
+ *\r
* @param reallyEmbedded\r
* true to attach the view to the applet area on the page rather than\r
* in a new window\r
final AlignFrame me = this;\r
viewport.applet.addFocusListener(new FocusListener()\r
{\r
- \r
+\r
@Override\r
public void focusLost(FocusEvent e)\r
{\r
if (me.viewport.applet.currentAlignFrame==me) {\r
me.viewport.applet.currentAlignFrame = null;\r
}}\r
- \r
+\r
@Override\r
public void focusGained(FocusEvent e)\r
{\r
* structures in the original jmol window. Note This method doesn't work\r
* without an additional javascript library to exchange messages between the\r
* distinct applets. See http://issues.jalview.org/browse/JAL-621\r
- * \r
+ *\r
* @param viewer\r
* JmolViewer instance\r
* @param sequenceIds\r
}\r
/**\r
* bind a pdb file to a sequence in the current view\r
- * \r
+ *\r
* @param sequenceId\r
* - sequenceId within the dataset.\r
* @param pdbEntryString\r
\r
/**\r
* modify the current selection, providing the user has not made a selection already.\r
- * @param sel - sequences from this alignment \r
+ * @param sel - sequences from this alignment\r
* @param csel - columns to be selected on the alignment\r
*/\r
public void select(SequenceGroup sel, ColumnSelection csel)\r
\r
public void scrollTo(int row, int column)\r
{\r
- alignPanel.seqPanel.scrollTo(row, column); \r
+ alignPanel.seqPanel.scrollTo(row, column);\r
}\r
public void scrollToRow(int row)\r
{\r
- alignPanel.seqPanel.scrollToRow(row); \r
+ alignPanel.seqPanel.scrollToRow(row);\r
}\r
public void scrollToColumn(int column)\r
{\r
- alignPanel.seqPanel.scrollToColumn(column); \r
+ alignPanel.seqPanel.scrollToColumn(column);\r
}\r
/**\r
* @return the alignments unique ID.\r
public String getSequenceSetId() {\r
return viewport.getSequenceSetId();\r
}\r
+\r
+\r
+ /**\r
+ * Load the (T-Coffee) score file from the specified url\r
+ *\r
+ * @param source File/URL/T-COFFEE score file contents\r
+ * @throws IOException\r
+ * @return true if alignment was annotated with data from source\r
+ */\r
+ public boolean loadScoreFile( String source ) throws IOException {\r
+\r
+ TCoffeeScoreFile file = new TCoffeeScoreFile(source, AppletFormatAdapter.checkProtocol(source));\r
+ if( !file.isValid()) {\r
+ // TODO: raise dialog for gui\r
+ System.err.println("Problems parsing T-Coffee scores: "+file.getWarningMessage());\r
+ System.err.println("Origin was:\n"+source);\r
+ return false;\r
+ }\r
+\r
+ /*\r
+ * check that the score matrix matches the alignment dimensions\r
+ */\r
+ AlignmentI aln;\r
+ if( (aln=viewport.getAlignment()) != null && (aln.getHeight() != file.getHeight() || aln.getWidth() != file.getWidth()) ) {\r
+ // TODO: raise a dialog box here rather than bomb out.\r
+ System.err.println("The scores matrix does not match the alignment dimensions");\r
+\r
+ }\r
+\r
+ // TODO add parameter to indicate if matching should be done\r
+ if (file.annotateAlignment(alignPanel.getAlignment(), false))\r
+ {\r
+ alignPanel.fontChanged();\r
+ tcoffeeColour.setEnabled(true);\r
+ // switch to this color\r
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));\r
+ return true;\r
+ } else {\r
+ System.err.println("Problems resolving T-Coffee scores:");\r
+ if (file.getWarningMessage()!=null) {\r
+ System.err.println(file.getWarningMessage());\r
+ }\r
+ }\r
+ return false;\r
+ }\r
+\r
+\r
}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.*;
import jalview.analysis.*;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
import jalview.bin.*;
import jalview.datamodel.*;
import jalview.schemes.*;
import jalview.structure.SelectionSource;
-import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.workers.ConservationThread;
+import jalview.workers.ConsensusThread;
-public class AlignViewport implements SelectionSource, VamsasSource
+public class AlignViewport extends AlignmentViewport implements AlignViewportI, SelectionSource, VamsasSource
{
int startRes;
boolean showAnnotation = true;
- boolean showConservation = true;
-
- boolean showQuality = true;
-
- boolean showConsensus = true;
-
boolean upperCasebold = false;
- boolean colourAppliesToAllGroups = true;
-
- ColourSchemeI globalColourScheme = null;
-
- boolean conservationColourSelected = false;
-
- boolean abovePIDThreshold = false;
-
- SequenceGroup selectionGroup;
int charHeight;
boolean validCharWidth = true;
- AlignmentI alignment;
-
- ColumnSelection colSel = new ColumnSelection();
-
int threshold;
int increment;
// currently visible, in the correct order or rendering
public Hashtable featuresDisplayed;
- boolean hasHiddenColumns = false;
-
- boolean hasHiddenRows = false;
boolean showHiddenMarkers = true;
- public Hashtable[] hconsensus;
-
- AlignmentAnnotation consensus;
-
- AlignmentAnnotation conservation;
-
- AlignmentAnnotation quality;
-
- AlignmentAnnotation[] groupConsensus;
-
- AlignmentAnnotation[] groupConservation;
-
- boolean autocalculateConsensus = true;
-
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
- this);
-
- boolean ignoreGapsInConsensusCalculation = false;
-
public jalview.bin.JalviewLite applet;
Hashtable sequenceColours;
Stack historyList = new Stack();
Stack redoList = new Stack();
-
- String sequenceSetID;
-
- Hashtable hiddenRepSequences;
-
+
public void finalize() {
applet=null;
quality=null;
public AlignViewport(AlignmentI al, JalviewLite applet)
{
+ calculator = new jalview.workers.AlignCalcManager();
this.applet = applet;
setAlignment(al);
+ // we always pad gaps
+ this.setPadGaps(true);
this.startRes = 0;
this.endRes = al.getWidth() - 1;
this.startSeq = 0;
followSelection = followHighlight;
showSequenceLogo = applet.getDefaultParameter("showSequenceLogo", showSequenceLogo);
-
+
+ normaliseSequenceLogo = applet.getDefaultParameter("normaliseSequenceLogo", normaliseSequenceLogo);
+
showGroupConsensus = applet.getDefaultParameter("showGroupConsensus", showGroupConsensus);
showGroupConservation = applet.getDefaultParameter("showGroupConservation", showGroupConservation);
.getParameter("userDefinedColour"));
}
}
- if (hconsensus == null)
- {
- if (!alignment.isNucleotide())
- {
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " + ConsPercGaps
- + "% gaps", new Annotation[1], 0f, 11f,
- AlignmentAnnotation.BAR_GRAPH);
- conservation.hasText = true;
- conservation.autoCalculated = true;
-
- if (showConservation)
- {
- alignment.addAnnotation(conservation);
- }
-
- if (showQuality)
- {
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
- quality.hasText = true;
- quality.autoCalculated = true;
-
- alignment.addAnnotation(quality);
- }
- }
-
- consensus = new AlignmentAnnotation("Consensus", "PID",
- new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
- consensus.hasText = true;
- consensus.autoCalculated = true;
-
- if (showConsensus)
- {
- alignment.addAnnotation(consensus);
- }
- }
+ initAutoAnnotation();
}
return showSequenceFeatures;
}
- class ConservationThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConservationThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- try
- {
- updatingConservation = true;
-
- while (UPDATING_CONSERVATION)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSERVATION = true;
-
- int alWidth = (alignment==null) ? -1 : alignment.getWidth();
- if (alWidth < 0)
- {
- updatingConservation = false;
- UPDATING_CONSERVATION = false;
- return;
- }
-
- Conservation cons = new jalview.analysis.Conservation("All",
- jalview.schemes.ResidueProperties.propHash, 3,
- alignment.getSequences(), 0, alWidth - 1);
-
- cons.calculate();
- cons.verdict(false, ConsPercGaps);
-
- if (quality != null)
- {
- cons.findQuality();
- }
-
- char[] sequence = cons.getConsSequence().getSequence();
- float minR;
- float minG;
- float minB;
- float maxR;
- float maxG;
- float maxB;
- minR = 0.3f;
- minG = 0.0f;
- minB = 0f;
- maxR = 1.0f - minR;
- maxG = 0.9f - minG;
- maxB = 0f - minB; // scalable range for colouring both Conservation and
- // Quality
-
- float min = 0f;
- float max = 11f;
- float qmin = 0f;
- float qmax = 0f;
-
- char c;
-
- conservation.annotations = new Annotation[alWidth];
-
- if (quality != null)
- {
- quality.graphMax = cons.qualityRange[1].floatValue();
- quality.annotations = new Annotation[alWidth];
- qmin = cons.qualityRange[0].floatValue();
- qmax = cons.qualityRange[1].floatValue();
- }
-
- for (int i = 0; i < alWidth; i++)
- {
- float value = 0;
-
- c = sequence[i];
-
- if (Character.isDigit(c))
- {
- value = (int) (c - '0');
- }
- else if (c == '*')
- {
- value = 11;
- }
- else if (c == '+')
- {
- value = 10;
- }
- // TODO - refactor to use a graduatedColorScheme to calculate the
- // histogram colors.
- float vprop = value - min;
- vprop /= max;
- conservation.annotations[i] = new Annotation(String.valueOf(c),
- String.valueOf(value), ' ', value, new Color(minR
- + (maxR * vprop), minG + (maxG * vprop), minB
- + (maxB * vprop)));
-
- // Quality calc
- if (quality != null)
- {
- value = ((Double) cons.quality.elementAt(i)).floatValue();
- vprop = value - qmin;
- vprop /= qmax;
- quality.annotations[i] = new Annotation(" ",
- String.valueOf(value), ' ', value, new Color(minR
- + (maxR * vprop), minG + (maxG * vprop), minB
- + (maxB * vprop)));
- }
- }
- } catch (OutOfMemoryError error)
- {
- System.out.println("Out of memory calculating conservation!!");
- conservation = null;
- quality = null;
- System.gc();
- }
-
- UPDATING_CONSERVATION = false;
- updatingConservation = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
-
- }
- }
-
- ConservationThread conservationThread;
-
- ConsensusThread consensusThread;
-
- boolean consUpdateNeeded = false;
-
- static boolean UPDATING_CONSENSUS = false;
-
- static boolean UPDATING_CONSERVATION = false;
-
- boolean updatingConsensus = false;
-
- boolean updatingConservation = false;
-
- /**
- * DOCUMENT ME!
- */
- public void updateConservation(final AlignmentPanel ap)
- {
- if (alignment.isNucleotide() || conservation == null)
- {
- return;
- }
-
- conservationThread = new ConservationThread(ap);
- conservationThread.start();
- }
-
- /**
- * DOCUMENT ME!
- */
- public void updateConsensus(final AlignmentPanel ap)
- {
- consensusThread = new ConsensusThread(ap);
- consensusThread.start();
- }
-
- class ConsensusThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConsensusThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- updatingConsensus = true;
- while (UPDATING_CONSENSUS)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
-
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSENSUS = true;
-
- try
- {
- int aWidth = alignment==null ? -1 : alignment.getWidth();
- if (aWidth < 0)
- {
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
- return;
- }
-
- consensus.annotations = null;
- consensus.annotations = new Annotation[aWidth];
-
- hconsensus = new Hashtable[aWidth];
- AAFrequency.calculate(alignment.getSequencesArray(), 0,
- alignment.getWidth(), hconsensus, true); // always calculate the
- // full profile
- updateAnnotation(true);
- //AAFrequency.completeConsensus(consensus, hconsensus, 0, aWidth,
- // ignoreGapsInConsensusCalculation,
- // true);
-
- if (globalColourScheme != null)
- {
- globalColourScheme.setConsensus(hconsensus);
- }
-
- } catch (OutOfMemoryError error)
- {
- alignment.deleteAnnotation(consensus);
-
- consensus = null;
- hconsensus = null;
- System.out.println("Out of memory calculating consensus!!");
- System.gc();
- }
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
- }
-
- /**
- * update the consensus annotation from the sequence profile data using
- * current visualization settings.
- */
- public void updateAnnotation()
- {
- updateAnnotation(false);
- }
-
- protected void updateAnnotation(boolean immediate)
- {
- // TODO: make calls thread-safe, so if another thread calls this method,
- // it will either return or wait until one calculation is finished.
- if (immediate
- || (!updatingConsensus && consensus != null && hconsensus != null))
- {
- AAFrequency.completeConsensus(consensus, hconsensus, 0,
- hconsensus.length, ignoreGapsInConsensusCalculation,
- showSequenceLogo);
- }
- }
- }
/**
* get the consensus sequence as displayed under the PID consensus annotation
return sq;
}
- public SequenceGroup getSelectionGroup()
- {
- return selectionGroup;
- }
-
- public void setSelectionGroup(SequenceGroup sg)
- {
- selectionGroup = sg;
- }
-
- public boolean getConservationSelected()
- {
- return conservationColourSelected;
- }
-
- public void setConservationSelected(boolean b)
- {
- conservationColourSelected = b;
- }
-
- public boolean getAbovePIDThreshold()
- {
- return abovePIDThreshold;
- }
-
- public void setAbovePIDThreshold(boolean b)
- {
- abovePIDThreshold = b;
- }
-
public int getStartRes()
{
return startRes;
return startSeq;
}
- public void setGlobalColourScheme(ColourSchemeI cs)
- {
- globalColourScheme = cs;
- }
-
- public ColourSchemeI getGlobalColourScheme()
- {
- return globalColourScheme;
- }
-
public void setStartRes(int res)
{
this.startRes = res;
return increment;
}
- public void setHiddenColumns(ColumnSelection colsel)
- {
- this.colSel = colsel;
- if (colSel.getHiddenColumns() != null)
- {
- hasHiddenColumns = true;
- }
- }
-
- public ColumnSelection getColumnSelection()
- {
- return colSel;
- }
-
public void resetSeqLimits(int height)
{
setEndSeq(height / getCharHeight());
return currentTree;
}
- public void setColourAppliesToAllGroups(boolean b)
- {
- colourAppliesToAllGroups = b;
- }
-
- public boolean getColourAppliesToAllGroups()
- {
- return colourAppliesToAllGroups;
- }
-
public boolean getShowJVSuffix()
{
return showJVSuffix;
}
}
- /**
- * Property change listener for changes in alignment
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void addPropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void removePropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Property change listener for changes in alignment
- *
- * @param prop
- * DOCUMENT ME!
- * @param oldvalue
- * DOCUMENT ME!
- * @param newvalue
- * DOCUMENT ME!
- */
- public void firePropertyChange(String prop, Object oldvalue,
- Object newvalue)
- {
- changeSupport.firePropertyChange(prop, oldvalue, newvalue);
- }
-
- public boolean getIgnoreGapsConsensus()
- {
- return ignoreGapsInConsensusCalculation;
- }
-
- public void hideSelectedColumns()
- {
- if (colSel.size() < 1)
- {
- return;
- }
-
- colSel.hideSelectedColumns();
- setSelectionGroup(null);
-
- hasHiddenColumns = true;
- }
-
- public void invertColumnSelection()
- {
- for (int i = 0; i < alignment.getWidth(); i++)
- {
- if (colSel.contains(i))
- {
- colSel.removeElement(i);
- }
- else
- {
- if (!hasHiddenColumns || colSel.isVisible(i))
- {
- colSel.addElement(i);
- }
- }
- }
- }
-
- public void hideColumns(int start, int end)
- {
- if (start == end)
- {
- colSel.hideColumns(start);
- }
- else
- {
- colSel.hideColumns(start, end);
- }
-
- hasHiddenColumns = true;
- }
-
- public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
- {
- int sSize = sg.getSize();
- if (sSize < 2)
- {
- return;
- }
-
- if (hiddenRepSequences == null)
- {
- hiddenRepSequences = new Hashtable();
- }
-
- hiddenRepSequences.put(repSequence, sg);
-
- // Hide all sequences except the repSequence
- SequenceI[] seqs = new SequenceI[sSize - 1];
- int index = 0;
- for (int i = 0; i < sSize; i++)
- {
- if (sg.getSequenceAt(i) != repSequence)
- {
- if (index == sSize - 1)
- {
- return;
- }
-
- seqs[index++] = sg.getSequenceAt(i);
- }
- }
-
- hideSequence(seqs);
-
- }
-
- public void hideAllSelectedSeqs()
- {
- if (selectionGroup == null || selectionGroup.getSize() < 1)
- {
- return;
- }
-
- SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
-
- hideSequence(seqs);
-
- setSelectionGroup(null);
- }
-
- public void hideSequence(SequenceI[] seq)
- {
- if (seq != null)
- {
- for (int i = 0; i < seq.length; i++)
- {
- alignment.getHiddenSequences().hideSequence(seq[i]);
- }
-
- hasHiddenRows = true;
- firePropertyChange("alignment", null, alignment.getSequences());
- }
- }
- public void showSequence(int index)
- {
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
- hiddenRepSequences);
- if (tmp.size() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
-
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- }
-
- if (alignment.getHiddenSequences().getSize() < 1)
- {
- hasHiddenRows = false;
- }
- }
- public void showColumn(int col)
- {
- colSel.revealHiddenColumns(col);
- if (colSel.getHiddenColumns() == null)
- {
- hasHiddenColumns = false;
- }
- }
-
- public void showAllHiddenColumns()
- {
- colSel.revealAllHiddenColumns();
- hasHiddenColumns = false;
- }
-
- public void showAllHiddenSeqs()
- {
- if (alignment.getHiddenSequences().getSize() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
- Vector tmp = alignment.getHiddenSequences().showAll(
- hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- hasHiddenRows = false;
- hiddenRepSequences = null;
- sendSelection();
- }
- }
-
- public int adjustForHiddenSeqs(int alignmentIndex)
- {
- return alignment.getHiddenSequences().adjustForHiddenSeqs(
- alignmentIndex);
- }
-
- /**
- * This method returns the a new SequenceI [] with the selection sequence and
- * start and end points adjusted
- *
- * @return String[]
- */
- public SequenceI[] getSelectionAsNewSequence()
- {
- SequenceI[] sequences;
-
- if (selectionGroup == null)
- {
- sequences = alignment.getSequencesArray();
- }
- else
- {
- sequences = selectionGroup.getSelectionAsNewSequences(alignment);
- }
-
- return sequences;
- }
-
- /**
- * get the currently selected sequence objects or all the sequences in the
- * alignment.
- *
- * @return array of references to sequence objects
- */
- public SequenceI[] getSequenceSelection()
- {
- SequenceI[] sequences = null;
- if (selectionGroup != null)
- {
- sequences = selectionGroup.getSequencesInOrder(alignment);
- }
- if (sequences == null)
- {
- sequences = alignment.getSequencesArray();
- }
- return sequences;
- }
-
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public jalview.datamodel.CigarArray getViewAsCigars(
- boolean selectedRegionOnly)
- {
- return new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? colSel : null), (selectedRegionOnly ? selectionGroup : null));
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @return AlignmentView
- */
- jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
- {
- return getAlignmentView(selectedOnly, false);
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @param markGroups
- * boolean true to annotate the alignment view with groups on the alignment (and intersecting with selected region if selectedOnly is true)
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups)
- {
- return new AlignmentView(alignment, colSel, selectionGroup, hasHiddenColumns, selectedOnly, markGroups);
- }
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public String[] getViewAsString(boolean selectedRegionOnly)
- {
- String[] selection = null;
- SequenceI[] seqs = null;
- int i, iSize;
- int start = 0, end = 0;
- if (selectedRegionOnly && selectionGroup != null)
- {
- iSize = selectionGroup.getSize();
- seqs = selectionGroup.getSequencesInOrder(alignment);
- start = selectionGroup.getStartRes();
- end = selectionGroup.getEndRes() + 1;
- }
- else
- {
- iSize = alignment.getHeight();
- seqs = alignment.getSequencesArray();
- end = alignment.getWidth();
- }
-
- selection = new String[iSize];
-
- for (i = 0; i < iSize; i++)
- {
- if (hasHiddenColumns)
- {
- StringBuffer visibleSeq = new StringBuffer();
- Vector regions = colSel.getHiddenColumns();
-
- int blockStart = start, blockEnd = end;
- int[] region;
- int hideStart, hideEnd;
-
- for (int j = 0; j < regions.size(); j++)
- {
- region = (int[]) regions.elementAt(j);
- hideStart = region[0];
- hideEnd = region[1];
-
- if (hideStart < start)
- {
- continue;
- }
-
- blockStart = Math.min(blockStart, hideEnd + 1);
- blockEnd = Math.min(blockEnd, hideStart);
-
- if (blockStart > blockEnd)
- {
- break;
- }
-
- visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
-
- blockStart = hideEnd + 1;
- blockEnd = end;
- }
-
- if (end > blockStart)
- {
- visibleSeq.append(seqs[i].getSequence(blockStart, end));
- }
- selection[i] = visibleSeq.toString();
- }
- else
- {
- selection[i] = seqs[i].getSequenceAsString(start, end);
- }
- }
+
- return selection;
- }
public boolean getShowHiddenMarkers()
{
}
}
- public String getSequenceSetId()
- {
- if (sequenceSetID == null)
- {
- sequenceSetID = alignment.hashCode() + "";
- }
-
- return sequenceSetID;
- }
- /**
- * unique viewId for synchronizing state (e.g. with stored Jalview Project)
- *
- */
- private String viewId = null;
-
- public String getViewId()
- {
- if (viewId == null)
- {
- viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
- }
- return viewId;
- }
-
- public void alignmentChanged(AlignmentPanel ap)
- {
- alignment.padGaps();
-
- if (hconsensus != null && autocalculateConsensus)
- {
- updateConsensus(ap);
- updateConservation(ap);
- }
-
- // Reset endRes of groups if beyond alignment width
- int alWidth = alignment.getWidth();
- Vector groups = alignment.getGroups();
- if (groups != null)
- {
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg.getEndRes() > alWidth)
- {
- sg.setEndRes(alWidth - 1);
- }
- }
- }
-
- if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
- {
- selectionGroup.setEndRes(alWidth - 1);
- }
-
- resetAllColourSchemes();
-
- // AW alignment.adjustSequenceAnnotations();
- }
-
- void resetAllColourSchemes()
- {
- ColourSchemeI cs = globalColourScheme;
- if (cs != null)
- {
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
- alignment.getWidth());
- }
-
- cs.setConsensus(hconsensus);
- if (cs.conservationApplied())
- {
- Alignment al = (Alignment) alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
- c.calculate();
- c.verdict(false, ConsPercGaps);
-
- cs.setConservation(c);
- }
- }
-
- int s, sSize = alignment.getGroups().size();
- for (s = 0; s < sSize; s++)
- {
- SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
- if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) sg.cs).resetClustalX(
- sg.getSequences(hiddenRepSequences), sg.getWidth());
- }
- sg.recalcConservation();
- }
- }
-
boolean centreColumnLabels;
public boolean getCentreColumnLabels()
public void updateSequenceIdColours()
{
- Vector groups = alignment.getGroups();
- for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
+
+ for (SequenceGroup sg:alignment.getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
if (sg.idColour != null)
{
- Vector sqs = sg.getSequences(hiddenRepSequences);
- for (int s = 0, sSize = sqs.size(); s < sSize; s++)
+ for (SequenceI s:sg.getSequences(getHiddenRepSequences()))
{
- this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
+ this.setSequenceColour(s, sg.idColour);
}
}
}
{
return followSelection;
}
-
- private long sgrouphash = -1, colselhash = -1;
-
- /**
- * checks current SelectionGroup against record of last hash value, and
- * updates record.
- *
- * @return true if SelectionGroup changed since last call
- */
- boolean isSelectionGroupChanged()
- {
- int hc = (selectionGroup == null) ? -1 : selectionGroup.hashCode();
- if (hc != sgrouphash)
- {
- sgrouphash = hc;
- return true;
- }
- return false;
- }
-
- /**
- * checks current colsel against record of last hash value, and updates
- * record.
- *
- * @return true if colsel changed since last call
- */
- boolean isColSelChanged()
- {
- int hc = (colSel == null) ? -1 : colSel.hashCode();
- if (hc != colselhash)
- {
- colselhash = hc;
- return true;
- }
- return false;
- }
public void sendSelection()
{
jalview.structure.StructureSelectionManager
/**
- * show non-conserved residues only
- */
- public boolean showUnconserved = false;
-
- /**
- * when set, alignment should be reordered according to a newly opened tree
- */
- public boolean sortByTree = false;
-
- /**
- * @return the showUnconserved
- */
- public boolean getShowunconserved()
- {
- return showUnconserved;
- }
-
- /**
- * @param showNonconserved
- * the showUnconserved to set
- */
- public void setShowunconserved(boolean displayNonconserved)
- {
- this.showUnconserved = displayNonconserved;
- }
-
- /**
- * should conservation rows be shown for groups
- */
- boolean showGroupConservation = false;
-
- /**
- * should consensus rows be shown for groups
- */
- boolean showGroupConsensus = false;
-
- /**
- * should consensus profile be rendered by default
- */
- public boolean showSequenceLogo = false;
-
- /**
- * should consensus histograms be rendered by default
- */
- public boolean showConsensusHistogram = true;
-
- /**
- * @return the showConsensusProfile
- */
- public boolean isShowSequenceLogo()
- {
- return showSequenceLogo;
- }
-
- /**
- * @param showSequenceLogo
- * the new value
- */
- public void setShowSequenceLogo(boolean showSequenceLogo)
- {
- if (showSequenceLogo != this.showSequenceLogo)
- {
- // TODO: decouple settings setting from calculation when refactoring
- // annotation update method from alignframe to viewport
- this.showSequenceLogo = showSequenceLogo;
- if (consensusThread != null)
- {
- consensusThread.updateAnnotation();
- }
- }
- this.showSequenceLogo = showSequenceLogo;
- }
-
- /**
- * @param showConsensusHistogram
- * the showConsensusHistogram to set
- */
- public void setShowConsensusHistogram(boolean showConsensusHistogram)
- {
- this.showConsensusHistogram = showConsensusHistogram;
- }
-
- /**
- * @return the showGroupConservation
- */
- public boolean isShowGroupConservation()
- {
- return showGroupConservation;
- }
-
- /**
- * @param showGroupConservation
- * the showGroupConservation to set
- */
- public void setShowGroupConservation(boolean showGroupConservation)
- {
- this.showGroupConservation = showGroupConservation;
- }
-
- /**
- * @return the showGroupConsensus
- */
- public boolean isShowGroupConsensus()
- {
- return showGroupConsensus;
- }
-
- /**
- * @param showGroupConsensus
- * the showGroupConsensus to set
- */
- public void setShowGroupConsensus(boolean showGroupConsensus)
- {
- this.showGroupConsensus = showGroupConsensus;
- }
-
- /**
- *
- * @return flag to indicate if the consensus histogram should be rendered by
- * default
- */
- public boolean isShowConsensusHistogram()
- {
- return this.showConsensusHistogram;
- }
-
- /**
* synthesize a column selection if none exists so it covers the given
* selection group. if wholewidth is false, no column selection is made if the
* selection group covers the whole alignment width.
}
}
}
+
+ @Override
+ public boolean hasHiddenColumns()
+ {
+ return hasHiddenColumns;
+ }
+
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ public void setNormaliseSequenceLogo(boolean state)
+ {
+ normaliseSequenceLogo = state;
+ }
+
+ /**
+ *
+ * @return true if alignment characters should be displayed
+ */
+ public boolean isValidCharWidth()
+ {
+ return validCharWidth;
+ }
+
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
// do we need to scroll the panel?
if (results != null && results.getSize() > 0)
{
- int seqIndex = av.alignment.findIndex(results);
+ AlignmentI alignment=av.getAlignment();
+ int seqIndex = alignment.findIndex(results);
if (seqIndex == -1)
{
return false;
}
- SequenceI seq = av.alignment.getSequenceAt(seqIndex);
- int[] r = results.getResults(seq, 0,av.alignment.getWidth());
+ SequenceI seq = alignment.getSequenceAt(seqIndex);
+ int[] r = results.getResults(seq, 0,alignment.getWidth());
if (r == null)
{
if (av.applet.debug) {// DEBUG
int startv, endv, starts, ends, width;
int start=-1;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
start = av.getColumnSelection().findColumnPosition(ostart);
end = av.getColumnSelection().findColumnPosition(end);
if (start == end)
{
- if (!scrollToNearest && !av.colSel.isVisible(ostart))
+ if (!scrollToNearest && !av.getColumnSelection().isVisible(ostart))
{
// don't scroll - position isn't visible
return false;
|| (av.getEndRes() < start)
|| ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
{
- if (start > av.alignment.getWidth() - hextent)
+ if (start > av.getAlignment().getWidth() - hextent)
{
- start = av.alignment.getWidth() - hextent;
+ start = av.getAlignment().getWidth() - hextent;
if (start < 0)
{
start = 0;
}
}
- if (seqIndex > av.alignment.getHeight() - vextent)
+ if (seqIndex > av.getAlignment().getHeight() - vextent)
{
- seqIndex = av.alignment.getHeight() - vextent;
+ seqIndex = av.getAlignment().getHeight() - vextent;
if (seqIndex < 0)
{
seqIndex = 0;
public void setScrollValues(int x, int y)
{
- int width = av.alignment.getWidth();
- int height = av.alignment.getHeight();
+ int width = av.getAlignment().getWidth();
+ int height = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
width = av.getColumnSelection().findColumnPosition(width);
}
av.setStartSeq(y);
int endSeq = y + vextent;
- if (endSeq > av.alignment.getHeight())
+ if (endSeq > av.getAlignment().getHeight())
{
- endSeq = av.alignment.getHeight();
+ endSeq = av.getAlignment().getHeight();
}
av.setEndSeq(endSeq);
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
+ int maxwidth = av.getAlignment().getWidth();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
// remove old automatic annotation
// add any new annotation
- Vector gr = av.alignment.getGroups(); // OrderedBy(av.alignment.getSequencesArray());
+ ; // OrderedBy(av.alignment.getSequencesArray());
// intersect alignment annotation with alignment groups
- AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
Hashtable oldrfs = new Hashtable();
if (aan != null)
{
if (aan[an].autoCalculated && aan[an].groupRef != null)
{
oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.alignment.deleteAnnotation(aan[an]);
+ av.getAlignment().deleteAnnotation(aan[an]);
aan[an] = null;
}
}
}
- SequenceGroup sg;
- if (gr != null)
+ if (av.getAlignment().getGroups()!= null)
{
- for (int g = 0; g < gr.size(); g++)
+ for (SequenceGroup sg:av.getAlignment().getGroups())
{
updateCalcs = false;
- sg = (SequenceGroup) gr.elementAt(g);
if (applyGlobalSettings || !oldrfs.containsKey(sg))
{
// set defaults for this group's conservation/consensus
if (conv)
{
updateCalcs = true;
- av.alignment.addAnnotation(sg.getConservationRow(), 0);
+ av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
}
if (cons)
{
updateCalcs = true;
- av.alignment.addAnnotation(sg.getConsensus(), 0);
+ av.getAlignment().addAnnotation(sg.getConsensus(), 0);
}
// refresh the annotation rows
if (updateCalcs)
@Override
public AlignmentI getAlignment()
{
- return av.alignment;
+ return av.getAlignment();
}
@Override
public StructureSelectionManager getStructureSelectionManager()
{
return StructureSelectionManager.getStructureSelectionManager(av.applet);
}
+ @Override
+ public void raiseOOMWarning(String string, OutOfMemoryError error)
+ {
+ // TODO: JAL-960
+ System.err.println("Out of memory whilst '"+string+"'");
+ error.printStackTrace();
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
}
oldcs = av.getGlobalColourScheme();
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
oldgroupColours = new Hashtable();
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg: ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
if (sg.cs != null)
{
oldgroupColours.put(sg, sg.cs);
slider.addAdjustmentListener(this);
slider.addMouseListener(this);
- if (av.alignment.getAlignmentAnnotation() == null)
+ if (av.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
{
- String label = av.alignment.getAlignmentAnnotation()[i].label;
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
if (!list.contains(label))
list.addElement(label);
else
return;
}
- currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+ currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
.getSelectedIndex()];
int aboveThreshold = -1;
av.setGlobalColourScheme(acg);
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
-
+
if (sg.cs == null)
{
continue;
void reset()
{
av.setGlobalColourScheme(oldcs);
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.elementAt(g);
Object cs = oldgroupColours.get(sg);
if (cs instanceof ColourSchemeI)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
int getSelectedRow(int y)
{
int row = -2;
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (evt.getActionCommand().equals(ADDNEW))
{
AlignmentAnnotation newAnnotation = new AlignmentAnnotation("", null,
- new Annotation[ap.av.alignment.getWidth()]);
+ new Annotation[ap.av.getAlignment().getWidth()]);
if (!editLabelDescription(newAnnotation))
{
return;
}
- ap.av.alignment.addAnnotation(newAnnotation);
- ap.av.alignment.setAnnotationIndex(newAnnotation, 0);
+ ap.av.getAlignment().addAnnotation(newAnnotation);
+ ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
}
else if (evt.getActionCommand().equals(EDITNAME))
{
if (row > -1)
{
- ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(av.alignment.getAlignmentAnnotation()[row].getDescription(true), true, "\n");
+ ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(av.getAlignment().getAlignmentAnnotation()[row].getDescription(true), true, "\n");
if (tooltip == null)
{
tooltip = new Tooltip(phb.getNonHtmlContent(), this);
if (start>-1 && start != end)
{
// Swap these annotations
- AlignmentAnnotation startAA = ap.av.alignment
+ AlignmentAnnotation startAA = ap.av.getAlignment()
.getAlignmentAnnotation()[start];
if (end == -1)
{
- end = ap.av.alignment.getAlignmentAnnotation().length - 1;
+ end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
}
- AlignmentAnnotation endAA = ap.av.alignment
+ AlignmentAnnotation endAA = ap.av.getAlignment()
.getAlignmentAnnotation()[end];
- ap.av.alignment.getAlignmentAnnotation()[end] = startAA;
- ap.av.alignment.getAlignmentAnnotation()[start] = endAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
}
}
resizePanel = false;
// todo: move below to mouseClicked ?
selectedRow = getSelectedRow(evt.getY() + scrollOffset);
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
// DETECT RIGHT MOUSE BUTTON IN AWT
if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
jalview.appletgui.AlignFrame.copiedSequences.append(sq.getName() + "\t"
+ sq.getStart() + "\t" + sq.getEnd() + "\t"
+ sq.getSequenceAsString() + "\n");
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();
for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
g.translate(0, -scrollOffset);
g.setColor(Color.black);
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int y = 0, fy = g.getFont().getSize();
int x = 0, offset;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
import java.awt.*;
import java.awt.event.*;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
-import jalview.analysis.AAFrequency;
import jalview.datamodel.*;
-import jalview.schemes.ColourSchemeI;
+import jalview.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
-public class AnnotationPanel extends Panel implements AdjustmentListener,
+public class AnnotationPanel extends Panel implements AwtRenderPanelI, AdjustmentListener,
ActionListener, MouseListener, MouseMotionListener
{
AlignViewport av;
Vector activeRes;
- static String HELIX = "Helix";
+ final String HELIX = "Helix";
- static String SHEET = "Sheet";
+ final String SHEET = "Sheet";
- static String LABEL = "Label";
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ final String STEM = "RNA Helix";
- static String REMOVE = "Remove Annotation";
+ final String LABEL = "Label";
- static String COLOUR = "Colour";
+ final String REMOVE = "Remove Annotation";
- static Color HELIX_COLOUR = Color.red.darker();
+ final String COLOUR = "Colour";
- static Color SHEET_COLOUR = Color.green.darker().darker();
+ final Color HELIX_COLOUR = Color.red.darker();
+
+ final Color SHEET_COLOUR = Color.green.darker().darker();
Image image;
boolean MAC = false;
+ public final AnnotationRenderer renderer;
+
public AnnotationPanel(AlignmentPanel ap)
{
MAC = new jalview.util.Platform().isAMac();
addMouseListener(this);
// ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );
+ renderer = new AnnotationRenderer();
}
public AnnotationPanel(AlignViewport av)
{
this.av = av;
+ renderer = new AnnotationRenderer();
}
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
}
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
}
String label = "";
- if (av.colSel != null && av.colSel.size() > 0
- && anot[av.colSel.getMin()] != null)
+ if (av.getColumnSelection() != null && av.getColumnSelection().size() > 0
+ && anot[av.getColumnSelection().getMin()] != null)
label = anot[av.getColumnSelection().getMin()].displayCharacter;
if (evt.getActionCommand().equals(REMOVE))
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
}
}
+ aa[activeRow].validateRangeAndDisplay();
+
adjustPanelHeight();
repaint();
return null;
}
+ @Override
public void mousePressed(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
}
PopupMenu pop = new PopupMenu("Structure type");
- MenuItem item = new MenuItem(HELIX);
- item.addActionListener(this);
- pop.add(item);
- item = new MenuItem(SHEET);
- item.addActionListener(this);
- pop.add(item);
+ MenuItem item;
+ /*
+ * Just display the needed structure options
+ */
+ if (av.getAlignment().isNucleotide() == true)
+ {
+ item = new MenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
+ } else {
+ item = new MenuItem(HELIX);
+ item.addActionListener(this);
+ pop.add(item);
+ item = new MenuItem(SHEET);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new MenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
ap.scalePanel.mousePressed(evt);
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
graphStretch = -1;
ap.scalePanel.mouseReleased(evt);
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
boolean needValidating = false;
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (graphStretch > -1)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
- evt.getY();
- if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+ if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0;
}
graphStretchY = evt.getY();
calcPanelHeight();
}
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
int res = evt.getX() / av.getCharWidth() + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
}
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
ap.scalePanel.mouseEntered(evt);
}
+ @Override
public void mouseExited(MouseEvent evt)
{
ap.scalePanel.mouseExited(evt);
public int calcPanelHeight()
{
// setHeight of panels
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int height = 0;
if (aa != null)
{
if (activeRow == -1)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
activeRes.addElement(String.valueOf(i));
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
Dimension d = getSize();
public void fastPaint(int horizontal)
{
- if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null
- || av.alignment.getAlignmentAnnotation().length < 1)
+ if (horizontal == 0 || av.getAlignment().getAlignmentAnnotation() == null
+ || av.getAlignment().getAlignmentAnnotation().length < 1)
{
repaint();
return;
/**
* DOCUMENT ME!
- *
+ *
* @param g
* DOCUMENT ME!
* @param startRes
fm = g.getFontMetrics();
}
- if ((av.alignment.getAlignmentAnnotation() == null)
- || (av.alignment.getAlignmentAnnotation().length < 1))
+ if ((av.getAlignment().getAlignmentAnnotation() == null)
+ || (av.getAlignment().getAlignmentAnnotation().length < 1))
{
g.setColor(Color.white);
g.fillRect(0, 0, getSize().width, getSize().height);
return;
}
-
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
g.translate(0, -scrollOffset);
- int x = 0;
- int y = 0;
- int column = 0;
- char lastSS;
- int lastSSX;
- int iconOffset = av.charHeight / 2;
- boolean validRes = false;
- boolean validEnd = false;
- boolean labelAllCols = false;
- boolean centreColLabels, centreColLabelsDef = av
- .getCentreColumnLabels();
- boolean scaleColLabel = false;
- boolean[] graphGroupDrawn = new boolean[aa.length];
- int charOffset = 0; // offset for a label
- float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
- // column.
- // \u03B2 \u03B1
- for (int i = 0; i < aa.length; i++)
- {
- AlignmentAnnotation row = aa[i];
-
- if (!row.visible)
- {
- continue;
- }
- centreColLabels = row.centreColLabels || centreColLabelsDef;
- labelAllCols = row.showAllColLabels;
- scaleColLabel = row.scaleColLabel;
- lastSS = ' ';
- lastSSX = 0;
-
- if (row.graph > 0)
- {
- if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
- {
- continue;
- }
-
- // this is so that we draw the characters below the graph
- y += row.height;
-
- if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
- y -= av.charHeight;
- }
- }
- // TODO: else is the logic used in application, applet had no 'else'
- else if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
-
- }
- else
- {
- iconOffset = 0;
- }
-
- x = 0;
- while (x < endRes - startRes)
- {
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(
- startRes + x);
- if (column > row.annotations.length - 1)
- {
- break;
- }
- }
- else
- {
- column = startRes + x;
- }
-
- if ((row.annotations.length <= column)
- || (row.annotations[column] == null))
- {
- validRes = false;
- }
- else
- {
- validRes = true;
- }
-
- if (activeRow == i)
- {
- g.setColor(Color.red);
-
- if (av.getColumnSelection() != null)
- {
- for (int n = 0; n < av.getColumnSelection().size(); n++)
- {
- int v = av.getColumnSelection().columnAt(n);
-
- if (v == column)
- {
- g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
- }
- }
- }
- }
-
- if (av.validCharWidth
- && validRes
- && (row.annotations[column].displayCharacter != null && row.annotations[column].displayCharacter
- .length() > 0))
- {
-
- if (centreColLabels || scaleColLabel)
- {
- fmWidth = (float) fm.charsWidth(
- row.annotations[column].displayCharacter.toCharArray(),
- 0, row.annotations[column].displayCharacter.length());
-
- if (scaleColLabel)
- {
- // justify the label and scale to fit in column
- if (fmWidth > av.charWidth)
- {
- // scale only if the current font isn't already small enough
- fmScaling = av.charWidth;
- fmScaling /= fmWidth;
- // not 1.1 // g.setFont(new
- // Font(ofont,AffineTransform.getScaleInstance(fmScaling,
- // 1.0)));
- // and update the label's width to reflect the scaling.
- fmWidth = av.charWidth;
- }
- }
- }
- else
- {
- fmWidth = (float) fm
- .charWidth(row.annotations[column].displayCharacter
- .charAt(0));
- }
- charOffset = (int) ((av.charWidth - fmWidth) / 2f);
-
- if (row.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(row.annotations[column].colour);
-
- if (column == 0 || row.graph > 0)
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset + 3); // +
- // 3?
- }
- else if (row.annotations[column - 1] == null
- || (labelAllCols
- || !row.annotations[column].displayCharacter
- .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
- .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset + 3); // +3?
- }
- g.setFont(ofont);
- }
-
- if (row.hasIcons)
- {
- if (!validRes
- || (row.annotations[column].secondaryStructure != lastSS))
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset,
- (x * av.charWidth) - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0
- || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
- 180);
- x1 += av.charWidth / 2;
- }
-
- if (!validRes || row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth, y + 4
- + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
- 3);
-
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
-
- if (validRes)
- {
- lastSS = row.annotations[column].secondaryStructure;
- }
- else
- {
- lastSS = ' ';
- }
-
- lastSSX = (x * av.charWidth);
- }
- }
-
- column++;
- x++;
- }
-
- if (column >= row.annotations.length)
- {
- column = row.annotations.length - 1;
- validEnd = false;
- }
- else
- {
- validEnd = true;
- }
-
- // x ++;
-
- if (row.hasIcons)
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0 || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
- x1 += av.charWidth / 2;
- }
-
- if (row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth,
- y + 4 + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
-
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
-
- if (!validEnd || row.annotations[endRes] == null
- || row.annotations[endRes].secondaryStructure != 'E')
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
- }
- else
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, x * av.charWidth
- - lastSSX, 7);
- }
- break;
-
- default:
- g.setColor(Color.gray);
- if (!av.wrapAlignment || endRes == av.endRes)
- {
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
- }
-
- break;
- }
- }
-
- if (row.graph > 0 && row.graphHeight > 0)
- {
- if (row.graph == AlignmentAnnotation.LINE_GRAPH)
- {
- if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
- {
- float groupmax = -999999, groupmin = 9999999;
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup != row.graphGroup)
- {
- continue;
- }
-
- if (aa[gg] != row)
- {
- aa[gg].visible = false;
- }
-
- if (aa[gg].graphMax > groupmax)
- {
- groupmax = aa[gg].graphMax;
- }
- if (aa[gg].graphMin < groupmin)
- {
- groupmin = aa[gg].graphMin;
- }
- }
-
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup == row.graphGroup)
- {
- drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
- groupmax, row.graphHeight);
- }
- }
-
- graphGroupDrawn[row.graphGroup] = true;
- }
- else
- {
- drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
- row.graphMax, row.graphHeight);
- }
- }
- else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
- {
- drawBarGraph(g, row, startRes, endRes, row.graphMin,
- row.graphMax, y);
- }
- }
-
- if (row.graph > 0 && row.hasText)
- {
- y += av.charHeight;
- }
-
- if (row.graph == 0)
- {
- y += aa[i].height;
- }
- }
+ renderer.drawComponent(this, av, g, activeRow, startRes, endRes);
g.translate(0, +scrollOffset);
}
- public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, int y, float min, float max, int graphHeight)
- {
- if (sRes > aa.annotations.length)
- {
- return;
- }
-
- int x = 0;
-
- // Adjustment for fastpaint to left
- if (eRes < av.endRes)
- {
- eRes++;
- }
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int y1 = y, y2 = y;
- float range = max - min;
-
- // //Draw origin
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / range) * graphHeight);
- }
-
- g.setColor(Color.gray);
- g.drawLine(x - av.charWidth, y2, (eRes - sRes) * av.charWidth, y2);
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int column;
- int aaMax = aa.annotations.length - 1;
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null) // || coaa.annotations[column - 1] ==
- // null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
- if (column == 0 || aa.annotations[column - 1] == null)
- {
- y1 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
- }
- else
- {
- y1 = y
- - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
- }
- y2 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
-
- g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
- + av.charWidth / 2, y2);
- x++;
- }
-
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- }
- }
+ int scrollOffset = 0;
- public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, float min, float max, int y)
+ public void setScrollOffset(int value)
{
- ColourSchemeI profcolour = av.getGlobalColourScheme();
- if (profcolour == null)
- {
- profcolour = new jalview.schemes.ZappoColourScheme();
- }
- if (sRes > aa.annotations.length)
- {
- return;
- }
- Font ofont = g.getFont();
- eRes = Math.min(eRes, aa.annotations.length);
-
- int x = 0, y1 = y, y2 = y;
-
- float range = max - min;
-
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
- }
-
- g.setColor(Color.gray);
-
- g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
-
- int column;
- int aaMax = aa.annotations.length - 1;
- boolean renderHistogram = true, renderProfile = false;
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- { // TODO: generalise this to have render styles for consensus/profile data
- if (aa.groupRef != null)
- {
- renderHistogram = aa.groupRef.isShowConsensusHistogram();
- renderProfile = aa.groupRef.isShowSequenceLogo();
- }
- else
- {
- renderHistogram = av.isShowConsensusHistogram();
- renderProfile = av.isShowSequenceLogo();
- }
- }
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
-
- if (renderHistogram)
- {
- if (y1 - y2 > 0)
- {
- g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
- }
- else
- {
- g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
- }
- }
- // draw profile if available
- if (aa.annotations[column].value != 0 && renderProfile)
- {
- int profl[] = getProfileFor(aa, column);
- int ht = y1, htn = y2 - y1;// aa.graphHeight;
- float wdth;
- double ht2 = 0;
- char[] dc = new char[1];
- LineMetrics lm;
- for (int c = 1; profl != null && c < profl[0];)
- {
- dc[0] = (char) profl[c++];
- wdth = av.charWidth;
- wdth /= (float) fm.charsWidth(dc, 0, 1);
-
- if (c > 2)
- {
- ht += (int) ht2;
- }
- { // not java 1.1 compatible: Bug # 0060064
- g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
- wdth, (ht2 = (htn * ((double) profl[c++]) / 100.0))
- / av.charHeight)));
- lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
- g.setColor(profcolour.findColour(dc[0]));
- g.drawChars(dc, 0, 1, x * av.charWidth,
- (int) (ht + lm.getHeight()));
- }
- }
- g.setFont(ofont);
- }
-
- x++;
-
- }
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
- y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- }
+ scrollOffset = value;
+ repaint();
}
- private int[] getProfileFor(AlignmentAnnotation aa, int column)
+ @Override
+ public FontMetrics getFontMetrics()
{
- // if (aa.autoCalculated && aa.label.startsWith("Consensus")) {
- if (aa.groupRef != null && aa.groupRef.consensusData != null)
- {
- // && aa.groupRef.isShowSequenceLogo()) {
- return AAFrequency.extractProfile(aa.groupRef.consensusData[column],
- aa.groupRef.getIgnoreGapsConsensus());
- }
- // TODO extend annotation row to enable dynamic and static profile data to
- // be stored
- if (aa.groupRef == null && aa.sequenceRef == null)
- // && av.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(av.hconsensus[column],
- av.getIgnoreGapsConsensus());
- }
- // }
- return null;
+ return fm;
}
- // used by overview window
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
- int y, int sRes, int eRes)
+ @Override
+ public Image getFadedImage()
{
- eRes = Math.min(eRes, aa.annotations.length);
- g.setColor(Color.white);
- g.fillRect(0, 0, width, y);
- g.setColor(new Color(0, 0, 180));
-
- int x = 0, height;
-
- for (int j = sRes; j < eRes; j++)
- {
- if (aa.annotations[j].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[j].colour);
-
- height = (int) ((aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT);
- if (height > y)
- {
- height = y;
- }
- g.fillRect(x, y - height, av.charWidth, height);
- x += av.charWidth;
- }
+ return image;
}
- int scrollOffset = 0;
-
- public void setScrollOffset(int value)
+ @Override
+ public int getFadedImageWidth()
{
- scrollOffset = value;
- repaint();
+ return imgWidth;
}
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
MenuItem turn = new MenuItem("Turn Propensity");
MenuItem buried = new MenuItem("Buried Index");
+
+ MenuItem purinepyrimidine = new MenuItem("Purine/Pyrimidine");
MenuItem user = new MenuItem("User Defined Colours");
strand.addActionListener(this);
turn.addActionListener(this);
buried.addActionListener(this);
+ purinepyrimidine.addActionListener(this);
user.addActionListener(this);
jmolHelp.addActionListener(this);
coloursMenu.add(strand);
coloursMenu.add(turn);
coloursMenu.add(buried);
+ coloursMenu.add(purinepyrimidine);
coloursMenu.add(user);
coloursMenu.add(jmolColour);
helpMenu.add(jmolHelp);
setEnabled(buried);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
+ else if(evt.getSource() == purinepyrimidine)
+ {
+ jmb.setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
else if (evt.getSource() == user)
{
setEnabled(user);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.datamodel.*;
import jalview.io.*;
+import jalview.schemes.TCoffeeColourScheme;
public class CutAndPasteTransfer extends Panel implements ActionListener,
MouseListener
} catch (Exception ex)
{
+ // TODO: JAL-1102 - should have a warning message in dialog, not simply overwrite the broken input data with the exception
textarea.setText("Could not parse Newick file!\n" + ex);
return;
}
}
else if (annotationImport)
{
- if (new AnnotationFile().readAnnotationFile(
- alignFrame.viewport.alignment, textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE))
+ TCoffeeScoreFile tcf = null;
+ try
{
- alignFrame.alignPanel.fontChanged();
- alignFrame.alignPanel.setScrollValues(0, 0);
-
+ tcf = new TCoffeeScoreFile(textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE);
+ if (tcf.isValid())
+ {
+ if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(),
+ true))
+ {
+ alignFrame.tcoffeeColour.setEnabled(true);
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.changeColour(new TCoffeeColourScheme(
+ alignFrame.viewport.getAlignment()));
+ alignFrame.statusBar
+ .setText("Successfully pasted T-Coffee scores to alignment.");
+ }
+ else
+ {
+ // file valid but didn't get added to alignment for some reason
+ alignFrame.statusBar.setText("Failed to add T-Coffee scores: "+(tcf.getWarningMessage()!=null ? tcf.getWarningMessage():""));
+ }
+ }
+ else
+ {
+ tcf = null;
+ }
+ } catch (Exception x)
+ {
+ tcf = null;
}
- else
+ if (tcf == null)
{
- alignFrame.parseFeaturesFile(textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE);
+ if (new AnnotationFile().readAnnotationFile(
+ alignFrame.viewport.getAlignment(), textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE))
+ {
+ alignFrame.alignPanel.fontChanged();
+ alignFrame.alignPanel.setScrollValues(0, 0);
+ alignFrame.statusBar
+ .setText("Successfully pasted annotation to alignment.");
+
+ }
+ else
+ {
+ if (!alignFrame.parseFeaturesFile(textarea.getText(),
+ jalview.io.AppletFormatAdapter.PASTE))
+ {
+ alignFrame.statusBar.setText("Couldn't parse pasted text as a valid annotation, feature, GFF, or T-Coffee score file.");
+ }
+ }
}
}
else if (alignFrame != null)
else
{
alignFrame.addSequences(al.getSequencesArray());
+ alignFrame.statusBar
+ .setText("Successfully pasted alignment file");
}
}
}
-
+ // TODO: dialog should indicate if data was parsed correctly or not - see
+ // JAL-1102
if (this.getParent() instanceof Frame)
{
((Frame) this.getParent()).setVisible(false);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
av.featuresDisplayed = new Hashtable();
Vector allfeatures = new Vector();
minmax = new Hashtable();
-
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- SequenceFeature[] features = av.alignment.getSequenceAt(i)
+ SequenceFeature[] features = alignment.getSequenceAt(i)
.getSequenceFeatures();
if (features == null)
ArrayList allGroups = new ArrayList();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
alignmentHasFeatures = true;
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{
Vector allFeatures = new Vector();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
alignmentHasFeatures = true;
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
SequenceFeature[] tmpfeatures;
String group = null, type;
Vector visibleChecks = new Vector();
-
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- if (av.alignment.getSequenceAt(i).getSequenceFeatures() == null)
+ if (alignment.getSequenceAt(i).getSequenceFeatures() == null)
{
continue;
}
- tmpfeatures = av.alignment.getSequenceAt(i).getSequenceFeatures();
+ tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures();
int index = 0;
while (index < tmpfeatures.length)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
frame.setVisible(false);
}
+ private Font lastSelected=null;
+ private int lastSelStyle=0;
+ private int lastSelSize=0;
+ /**
+ * DOCUMENT ME!
+ */
void changeFont()
{
+ if (lastSelected==null)
+ {
+ // initialise with original font
+ lastSelected=oldFont;
+ lastSelSize=oldFont.getSize();
+ lastSelStyle=oldFont.getStyle();
+ }
+
Font newFont = new Font(fontName.getSelectedItem().toString(),
fontStyle.getSelectedIndex(), Integer.parseInt(fontSize
.getSelectedItem().toString()));
- if (ap != null)
- {
- ap.av.setFont(newFont);
- ap.fontChanged();
+ FontMetrics fm = getGraphics().getFontMetrics(newFont);
+ double mw=fm.getStringBounds("M", getGraphics())
+ .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+ .getWidth();
+ if (mw<1 || iw < 1) {
+ // TODO: JAL-1100
+ fontName.select(lastSelected.getName());
+ fontStyle.select(lastSelStyle);
+ fontSize.select(""+lastSelSize);
+ JVDialog d = new JVDialog(this.frame, "Invalid Font", true, 350,200);
+ Panel mp=new Panel();
+ d.cancel.setVisible(false);
+ mp.setLayout(new FlowLayout());
+ mp.add(new Label("Font doesn't have letters defined\nso cannot be used\nwith alignment data."));
+ d.setMainPanel(mp);
+ d.setVisible(true);
+ return;
}
- else if (tp != null)
+ if (tp != null)
{
tp.setTreeFont(newFont);
}
+ else if (ap != null)
+ {
+ ap.av.setFont(newFont);
+ ap.fontChanged();
+ }
+ // remember last selected
+ lastSelected=newFont;
}
protected void fontName_actionPerformed()
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
package jalview.appletgui;
import java.awt.*;
+import java.util.List;
import jalview.datamodel.*;
boolean fastPaint = false;
- java.util.Vector searchResults;
+ List<SequenceI> searchResults;
public IdCanvas(AlignViewport av)
{
((i - starty) * charHeight) + ypos + charHeight
- (charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.showHiddenMarkers)
{
drawMarker(i, starty, ypos);
}
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int maxwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
for (int i = starty; i < alheight; i++)
{
- SequenceI s = av.alignment.getSequenceAt(i);
+ SequenceI s = av.getAlignment().getSequenceAt(i);
gg.setFont(italic);
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
setHiddenFont(s);
}
for (int i = starty; i < endy; i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
if (seq == null)
{
continue;
}
gg.setFont(italic);
// boolean isrep=false;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
// isrep =
setHiddenFont(seq);
(((i - starty) * av.charHeight) + av.charHeight)
- (av.charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.showHiddenMarkers)
{
drawMarker(i, starty, 0);
}
}
}
- public void setHighlighted(java.util.Vector found)
+ public void setHighlighted(List<SequenceI> list)
{
- searchResults = found;
+ searchResults = list;
repaint();
}
void drawMarker(int i, int starty, int yoffset)
{
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
+ SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences;
// Use this method here instead of calling hiddenSeq adjust
// 3 times.
int hSize = hseqs.length;
Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
.getSize());
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.getHiddenRepSequences() != null
+ && av.getHiddenRepSequences().containsKey(seq))
{
gg.setFont(bold);
return true;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.*;
import java.awt.event.*;
+import java.util.List;
import java.util.Vector;
import jalview.datamodel.*;
}
if (mouseDragging && e.getY() >= getSize().height
- && av.alignment.getHeight() > av.getEndSeq())
+ && av.getAlignment().getHeight() > av.getEndSeq())
{
scrollThread = new ScrollThread(false);
}
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
if (e.isShiftDown() && lastid != -1)
av.sendSelection();
}
- public void highlightSearchResults(java.util.Vector found)
+ public void highlightSearchResults(List<SequenceI> list)
{
- idCanvas.setHighlighted(found);
+ idCanvas.setHighlighted(list);
- if (found == null)
+ if (list == null)
{
return;
}
- int index = av.alignment.findIndex((SequenceI) found.elementAt(0));
+ int index = av.getAlignment().findIndex(list.get(0));
// do we need to scroll the panel?
if (av.getStartSeq() > index || av.getEndSeq() < index)
{
selectSeqs(lastid - 1, seq);
}
- else if (seq > lastid && seq < av.alignment.getHeight())
+ else if (seq > lastid && seq < av.getAlignment().getHeight())
{
selectSeqs(lastid + 1, seq);
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
+import jalview.datamodel.AlignmentI;
+
import java.awt.*;
import java.awt.event.*;
fr.overview = true;
// scale the initial size of overviewpanel to shape of alignment
- float initialScale = (float) av.alignment.getWidth()
- / (float) av.alignment.getHeight();
+ float initialScale = (float) av.getAlignment().getWidth()
+ / (float) av.getAlignment().getHeight();
- if (av.hconsensus == null)
+ if (av.getSequenceConsensusHash() == null)
{
graphHeight = 0;
}
- if (av.alignment.getWidth() > av.alignment.getHeight())
+ if (av.getAlignment().getWidth() > av.getAlignment().getHeight())
{
// wider
width = 400;
addComponentListener(new ComponentAdapter()
{
+ @Override
public void componentResized(ComponentEvent evt)
{
if (getSize().width != width
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
+ @Override
public void mouseExited(MouseEvent evt)
{
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
}
+ @Override
public void mousePressed(MouseEvent evt)
{
boxX = evt.getX();
checkValid();
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
boxX = evt.getX();
checkValid();
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
boxX = evt.getX();
if (boxX > (width - boxWidth))
{
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
// Try smallest possible box
boxWidth = (int) ((av.endRes - av.startRes + 1) * av.getCharWidth() * scalew);
int col = (int) (boxX / scalew / av.getCharWidth());
int row = (int) (boxY / scaleh / av.getCharHeight());
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (!av.getColumnSelection().isVisible(col))
{
col = av.getColumnSelection().findColumnPosition(col);
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+ row = av.getAlignment().getHiddenSequences().findIndexWithoutHiddenSeqs(
row);
}
// the overview is being calculated
boolean resizeAgain = false;
+ @Override
public void run()
{
miniMe = null;
- int alwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int alwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
if (av.showSequenceFeatures)
{
int row, col, sameRow = 0, sameCol = 0;
jalview.datamodel.SequenceI seq;
boolean hiddenRow = false;
+ AlignmentI alignment=av.getAlignment();
for (row = 0; row <= sequencesHeight; row++)
{
if ((int) (row * sampleRow) == lastrow)
}
hiddenRow = false;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ seq = alignment.getHiddenSequences().getHiddenSequence(lastrow);
if (seq == null)
{
- int index = av.alignment.getHiddenSequences()
+ int index = alignment.getHiddenSequences()
.findIndexWithoutHiddenSeqs(lastrow);
- seq = av.alignment.getSequenceAt(index);
+ seq = alignment.getSequenceAt(index);
}
else
{
}
else
{
- seq = av.alignment.getSequenceAt(lastrow);
+ seq = alignment.getSequenceAt(lastrow);
}
for (col = 0; col < width; col++)
}
if (hiddenRow
- || (av.hasHiddenColumns && !av.getColumnSelection()
+ || (av.hasHiddenColumns() && !av.getColumnSelection()
.isVisible(lastcol)))
{
color = color.darker().darker();
sameRow = 1;
}
- if (av.conservation != null)
+ if (av.getAlignmentConservationAnnotation()!= null)
{
for (col = 0; col < width; col++)
{
lastcol = (int) (col * sampleCol);
{
mg.translate(col, sequencesHeight);
- ap.annotationPanel.drawGraph(mg, av.conservation,
+ ap.annotationPanel.renderer.drawGraph(mg, av.getAlignmentConservationAnnotation(),av.getAlignmentConservationAnnotation().annotations,
(int) (sampleCol) + 1, graphHeight,
(int) (col * sampleCol), (int) (col * sampleCol) + 1);
mg.translate(-col, -sequencesHeight);
public void setBoxPosition()
{
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
- int fullsizeHeight = (av.alignment.getHeight() + av.alignment
+ int fullsizeWidth = av.getAlignment().getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.getAlignment().getHeight() + av.getAlignment()
.getHiddenSequences().getSize()) * av.getCharHeight();
int startRes = av.getStartRes();
int endRes = av.getEndRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
int startSeq = av.startSeq;
int endSeq = av.endSeq;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- startSeq = av.alignment.getHiddenSequences().adjustForHiddenSeqs(
+ startSeq = av.getAlignment().getHiddenSequences().adjustForHiddenSeqs(
startSeq);
- endSeq = av.alignment.getHiddenSequences()
+ endSeq = av.getAlignment().getHiddenSequences()
.adjustForHiddenSeqs(endSeq);
}
boxX = (int) (startRes * av.getCharWidth() * scalew);
boxY = (int) (startSeq * av.getCharHeight() * scaleh);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
}
repaint();
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
Graphics og = offscreen.getGraphics();
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
useidentity=av.getAlignment().isNucleotide();
if (av.getSelectionGroup() == null)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
SeqCigar sq[] = seqstrings.getSequences();
int length = sq[0].getWidth();
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
import java.util.*;
+import java.util.List;
import java.awt.*;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
/**
* DOCUMENT ME!
- *
+ *
* @param comp
* DOCUMENT ME!
* @param al
else if (validateSequences && comp instanceof AlignmentPanel
&& source instanceof AlignmentPanel)
{
- validateSequences(((AlignmentPanel) source).av.alignment,
- ((AlignmentPanel) comp).av.alignment);
+ validateSequences(((AlignmentPanel) source).av.getAlignment(),
+ ((AlignmentPanel) comp).av.getAlignment());
}
if (comp instanceof AlignmentPanel && alignmentChanged)
{
if (i < comp.getHeight())
{
- comp.getSequences().insertElementAt(a1[i], i);
+ // TODO: the following does not trigger any recalculation of height/etc, or maintain the dataset
+ List<SequenceI> alsq;
+ synchronized (alsq=comp.getSequences()) {
+ alsq.add(i, a1[i]);
+ }
}
else
{
{
if (comps.elementAt(i) instanceof AlignmentPanel)
{
- tmp.addElement(((AlignmentPanel) comps.elementAt(i)));
+ tmp.addElement(comps.elementAt(i));
}
}
AlignmentPanel[] result = new AlignmentPanel[tmp.size()];
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
if (ap.av.getSelectionGroup() == null)
{
- seqs = ap.av.alignment.getSequencesArray();
+ seqs = ap.av.getAlignment().getSequencesArray();
}
else
{
- seqs = ap.av.getSelectionGroup().getSequencesInOrder(ap.av.alignment);
+ seqs = ap.av.getSelectionGroup().getSequencesInOrder(ap.av.getAlignment());
}
float scores[][] = new float[seqs.length][seqs.length];
double totscore = 0;
int count = ap.av.getSelectionGroup().getSize();
- String type = (ap.av.alignment.isNucleotide()) ? AlignSeq.DNA
+ String type = (ap.av.getAlignment().isNucleotide()) ? AlignSeq.DNA
: AlignSeq.PEP;
Sequence seq;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public class RedundancyPanel extends SliderPanel implements Runnable,
WindowListener
{
- AlignmentPanel ap;
-
Stack historyList = new Stack(); // simpler than synching with alignFrame.
float[] redundancy;
if ((sg != null) && (sg.getSize() >= 1))
{
- originalSequences = sg.getSequencesInOrder(ap.av.alignment);
+ originalSequences = sg.getSequencesInOrder(ap.av.getAlignment());
start = sg.getStartRes();
end = sg.getEndRes();
}
else
{
- originalSequences = ap.av.alignment.getSequencesArray();
+ originalSequences = ap.av.getAlignment().getSequencesArray();
start = 0;
- end = ap.av.alignment.getWidth();
+ end = ap.av.getAlignment().getWidth();
}
height = originalSequences.length;
}
EditCommand cut = new EditCommand("Remove Redundancy",
- EditCommand.CUT, deleted, 0, width, ap.av.alignment);
-
+ EditCommand.CUT, deleted, 0, width, ap.av.getAlignment());
+ AlignmentI alignment=ap.av.getAlignment();
for (int i = 0; i < del.size(); i++)
{
- ap.av.alignment.deleteSequence(deleted[i]);
+ alignment.deleteSequence(deleted[i]);
PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
if (sg != null)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
if (av.getSelectionGroup() != null)
{
av.getSelectionGroup().addOrRemove(found, true);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
else
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().addOrRemove(found, true);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
final int res;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(x);
}
{
av.hideColumns(res, res);
if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av.alignment
+ && av.getSelectionGroup().getSize() == av.getAlignment()
.getHeight())
{
av.setSelectionGroup(null);
av.getColumnSelection().addElement(res);
SequenceGroup sg = new SequenceGroup();
- for (int i = 0; i < av.alignment.getSequences().size(); i++)
+ for (int i = 0; i < av.getAlignment().getSequences().size(); i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
sg.setStartRes(res);
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (res > av.alignment.getWidth())
+ if (res > av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
res = 0;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res > av.alignment.getWidth())
+ if (res > av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (res < min)
public void mouseMoved(MouseEvent evt)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
return;
}
for (int i = 0; i < cs.size(); i++)
{
int sel = cs.columnAt(i);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
sel = av.getColumnSelection().findColumnPosition(sel);
}
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
gg.setColor(Color.blue);
int res;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
for (int i = scalestartx; i < endx; i += 10)
{
int value = i;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
{
FontMetrics fm = getFontMetrics(av.getFont());
ypos += av.charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startx = av.getColumnSelection().adjustForHiddenColumns(startx);
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
// WEST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- SequenceI seq = av.alignment.getSequenceAt(i);
+ SequenceI seq = av.getAlignment().getSequenceAt(i);
int index = startx;
int value = -1;
continue;
}
- value = av.alignment.getSequenceAt(i).findPosition(index);
+ value = av.getAlignment().getSequenceAt(i).findPosition(index);
break;
}
{
ypos += av.charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
SequenceI seq;
// EAST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
int index = endx;
int value = -1;
String mask = "0";
int maxWidth = 0;
int tmp;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- tmp = av.alignment.getSequenceAt(i).getEnd();
+ tmp = alignment.getSequenceAt(i).getEnd();
if (tmp > maxWidth)
{
maxWidth = tmp;
int endx;
int ypos = hgap;
- int maxwidth = av.alignment.getWidth() - 1;
+ int maxwidth = av.getAlignment().getWidth() - 1;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
{
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.showHiddenMarkers)
{
g.setColor(Color.blue);
int res;
void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
int endSeq, int offset)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
draw(g1, startRes, endRes, startSeq, endSeq, offset);
}
// ///////////////////////////
for (int i = startSeq; i < endSeq; i++)
{
- nextSeq = av.alignment.getSequenceAt(i);
+ nextSeq = av.getAlignment().getSequenceAt(i);
if (nextSeq == null)
{
continue;
}
- sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),
+ sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
startRes, endRes, offset + ((i - startSeq) * av.charHeight));
if (av.showSequenceFeatures)
}
if (av.getSelectionGroup() != null
- || av.alignment.getGroups().size() > 0)
+ || av.getAlignment().getGroups().size() > 0)
{
drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
}
int ex = -1;
int groupIndex = -1;
- if ((group == null) && (av.alignment.getGroups().size() > 0))
+ if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);
+ group = (SequenceGroup) av.getAlignment().getGroups().get(0);
groupIndex = 0;
}
boolean inGroup = false;
int top = -1;
int bottom = -1;
- int alHeight = av.alignment.getHeight() - 1;
+ int alHeight = av.getAlignment().getHeight() - 1;
for (i = startSeq; i < endSeq; i++)
{
if ((sx <= (endRes - startRes) * av.charWidth)
&& group.getSequences(null).contains(
- av.alignment.getSequenceAt(i)))
+ av.getAlignment().getSequenceAt(i)))
{
if ((bottom == -1)
&& (i >= alHeight || !group.getSequences(null)
- .contains(av.alignment.getSequenceAt(i + 1))))
+ .contains(av.getAlignment().getSequenceAt(i + 1))))
{
bottom = sy + av.charHeight;
}
{
if (((top == -1) && (i == 0))
|| !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i - 1)))
+ av.getAlignment().getSequenceAt(i - 1)))
{
top = sy;
}
groupIndex++;
- if (groupIndex >= av.alignment.getGroups().size())
+ if (groupIndex >= av.getAlignment().getGroups().size())
{
break;
}
- group = (SequenceGroup) av.alignment.getGroups().elementAt(
+ group = (SequenceGroup) av.getAlignment().getGroups().get(
groupIndex);
- } while (groupIndex < av.alignment.getGroups().size());
+ } while (groupIndex < av.getAlignment().getGroups().size());
}
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
seqCanvas.cursorX += dx;
seqCanvas.cursorY += dy;
- if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX))
+ if (av.hasHiddenColumns() && !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
int original = seqCanvas.cursorX - dx;
- int maxWidth = av.alignment.getWidth();
+ int maxWidth = av.getAlignment().getWidth();
- while (!av.colSel.isVisible(seqCanvas.cursorX)
+ while (!av.getColumnSelection().isVisible(seqCanvas.cursorX)
&& seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
{
seqCanvas.cursorX += dx;
}
if (seqCanvas.cursorX >= maxWidth
- || !av.colSel.isVisible(seqCanvas.cursorX))
+ || !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
seqCanvas.cursorX = original;
}
{
seqCanvas.cursorX = 0;
}
- else if (seqCanvas.cursorX > av.alignment.getWidth() - 1)
+ else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
{
- seqCanvas.cursorX = av.alignment.getWidth() - 1;
+ seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
}
if (seqCanvas.cursorY < 0)
{
seqCanvas.cursorY = 0;
}
- else if (seqCanvas.cursorY > av.alignment.getHeight() - 1)
+ else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
{
- seqCanvas.cursorY = av.alignment.getHeight() - 1;
+ seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
}
endEditing();
{
ap.scrollUp(false);
}
- while (seqCanvas.cursorX < av.colSel
+ while (seqCanvas.cursorX < av.getColumnSelection()
.adjustForHiddenColumns(av.startRes))
{
break;
}
}
- while (seqCanvas.cursorX > av.colSel
+ while (seqCanvas.cursorX > av.getColumnSelection()
.adjustForHiddenColumns(av.endRes))
{
if (!ap.scrollRight(true))
}
}
}
- setStatusMessage(av.alignment.getSequenceAt(seqCanvas.cursorY),
+ setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
seqCanvas.repaint();
if (av.getSelectionGroup() != null)
{
- SequenceGroup sg = av.selectionGroup;
+ SequenceGroup sg = av.getSelectionGroup();
// Find the top and bottom of this group
- int min = av.alignment.getHeight(), max = 0;
+ int min = av.getAlignment().getHeight(), max = 0;
for (int i = 0; i < sg.getSize(); i++)
{
- int index = av.alignment.findIndex(sg.getSequenceAt(i));
+ int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
if (index > max)
{
max = index;
else
{
// Now add any sequences between min and max
- sg.getSequences(null).removeAllElements();
+ sg.clear();
for (int i = min; i < max; i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
}
}
+ sequence.getName());
Object obj = null;
- if (av.alignment.isNucleotide())
+ if (av.getAlignment().isNucleotide())
{
obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
+ "");
public void mouseClicked(MouseEvent evt)
{
- SequenceI sequence = av.alignment.getSequenceAt(findSeq(evt));
+ SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
if (evt.getClickCount() > 1)
{
if (av.getSelectionGroup()!=null && av.getSelectionGroup().getSize() == 1
res = (x / av.getCharWidth()) + av.getStartRes();
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
y -= hgap;
seq = Math.min((y % cHeight) / av.getCharHeight(),
- av.alignment.getHeight() - 1);
+ av.getAlignment().getHeight() - 1);
if (seq < 0)
{
seq = -1;
else
{
seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
- av.alignment.getHeight() - 1);
+ av.getAlignment().getHeight() - 1);
if (seq < 0)
{
seq = -1;
+ sequence.getName());
Object obj = null;
- if (av.alignment.isNucleotide())
+ if (av.getAlignment().isNucleotide())
{
obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
+ "");
ap.alignFrame.statusBar.setText(text.toString());
StringBuffer tooltipText = new StringBuffer();
- SequenceGroup[] groups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
if (groups != null)
{
for (int g = 0; g < groups.length; g++)
boolean fixedColumns = false;
SequenceGroup sg = av.getSelectionGroup();
- SequenceI seq = av.alignment.getSequenceAt(startseq);
+ SequenceI seq = av.getAlignment().getSequenceAt(startseq);
- if (!groupEditing && av.hasHiddenRows)
+ if (!groupEditing && av.hasHiddenRows())
{
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = (SequenceGroup) av.getRepresentedSequences(seq);
groupEditing = true;
}
}
// Are we editing within a selection group?
if (groupEditing
- || (sg != null && sg.getSequences(av.hiddenRepSequences)
+ || (sg != null && sg.getSequences(av.getHiddenRepSequences())
.contains(seq)))
{
fixedColumns = true;
// but the sequence represents a group
if (sg == null)
{
- if (av.hiddenRepSequences == null
- || !av.hiddenRepSequences.containsKey(seq))
+ if (!av.isHiddenRepSequence(seq))
{
endEditing();
return;
}
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
}
fixedLeft = sg.getStartRes();
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
fixedColumns = true;
int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
if (groupEditing)
{
- Vector vseqs = sg.getSequences(av.hiddenRepSequences);
- int g, groupSize = vseqs.size();
- SequenceI[] groupSeqs = new SequenceI[groupSize];
- for (g = 0; g < groupSeqs.length; g++)
- {
- groupSeqs[g] = (SequenceI) vseqs.elementAt(g);
- }
+ SequenceI[] groupSeqs = sg.getSequences(av.getHiddenRepSequences()).toArray(new SequenceI[0]);
// drag to right
if (insertGap)
// If the user has selected the whole sequence, and is dragging to
// the right, we can still extend the alignment and selectionGroup
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
- && sg.getEndRes() == av.alignment.getWidth() - 1)
+ && sg.getEndRes() == av.getAlignment().getWidth() - 1)
{
- sg.setEndRes(av.alignment.getWidth() + startres - lastres);
+ sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
fixedRight = sg.getEndRes();
}
{
blank = true;
- for (g = 0; g < groupSize; g++)
+ for (SequenceI gs:groupSeqs)
{
for (int j = 0; j < startres - lastres; j++)
{
- if (!jalview.util.Comparison.isGap(groupSeqs[g]
+ if (!jalview.util.Comparison.isGap(gs
.getCharAt(fixedRight - j)))
{
blank = false;
if (!blank)
{
- if (sg.getSize() == av.alignment.getHeight())
+ if (sg.getSize() == av.getAlignment().getHeight())
{
- if ((av.hasHiddenColumns && startres < av.getColumnSelection()
+ if ((av.hasHiddenColumns() && startres < av.getColumnSelection()
.getHiddenBoundaryRight(startres)))
{
endEditing();
return;
}
- int alWidth = av.alignment.getWidth();
- if (av.hasHiddenRows)
+ int alWidth = av.getAlignment().getWidth();
+ if (av.hasHiddenRows())
{
- int hwidth = av.alignment.getHiddenSequences().getWidth();
+ int hwidth = av.getAlignment().getHiddenSequences().getWidth();
if (hwidth > alWidth)
{
alWidth = hwidth;
// / Are we able to delete?
// ie are all columns blank?
- for (g = 0; g < groupSize; g++)
+ for (SequenceI gs:groupSeqs)
{
for (int j = startres; j < lastres; j++)
{
- if (groupSeqs[g].getLength() <= j)
+ if (gs.getLength() <= j)
{
continue;
}
- if (!jalview.util.Comparison.isGap(groupSeqs[g].getCharAt(j)))
+ if (!jalview.util.Comparison.isGap(gs.getCharAt(j)))
{
// Not a gap, block edit not valid
endEditing();
else
{
editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
- startres, startres - lastres, av.alignment, true);
+ startres, startres - lastres, av.getAlignment(), true);
}
}
else
else
{
editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
- startres, lastres - startres, av.alignment, true);
+ startres, lastres - startres, av.getAlignment(), true);
}
}
else
{
editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
- { seq }, lastres, startres - lastres, av.alignment, true);
+ { seq }, lastres, startres - lastres, av.getAlignment(), true);
}
}
else
if (max > 0)
{
editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
- { seq }, startres, max, av.alignment, true);
+ { seq }, startres, max, av.getAlignment(), true);
}
}
}
}
editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
- av.alignment, true);
+ av.getAlignment(), true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.getAlignment(),
true);
}
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.getAlignment(),
true);
editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
- av.alignment, true);
+ av.getAlignment(), true);
}
// ////////////////////////////////////////
if (stretchGroup == null)
{
- stretchGroup = av.alignment.findGroup(sequence);
+ stretchGroup = av.getAlignment().findGroup(sequence);
if (stretchGroup != null && res > stretchGroup.getStartRes()
&& res < stretchGroup.getEndRes())
{
{
stretchGroup = null;
- SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence);
if (allGroups != null)
{
{
if (stretchGroup.cs instanceof ClustalxColourScheme)
{
- ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
- stretchGroup.getSequences(av.hiddenRepSequences),
- stretchGroup.getWidth());
+ ((ClustalxColourScheme) stretchGroup.cs).alignmentChanged(
+stretchGroup,av.getHiddenRepSequences());
}
if (stretchGroup.cs instanceof Blosum62ColourScheme
mouseDragging = true;
- if (y > av.alignment.getHeight())
+ if (y > av.getAlignment().getHeight())
{
- y = av.alignment.getHeight() - 1;
+ y = av.getAlignment().getHeight() - 1;
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (stretchGroup.getEndRes() == res)
dragDirection = -1;
}
- while ((y != oldSeq) && (oldSeq > -1) && (y < av.alignment.getHeight()))
+ while ((y != oldSeq) && (oldSeq > -1) && (y < av.getAlignment().getHeight()))
{
// This routine ensures we don't skip any sequences, as the
// selection is quite slow.
}
if (mouseDragging && evt.getY() >= getSize().height
- && av.alignment.getHeight() > av.getEndSeq())
+ && av.getAlignment().getHeight() > av.getEndSeq())
{
running = ap.scrollUp(false);
}
// rules are: colsel is copied if there is a real intersection between
// sequence selection
boolean repaint = false, copycolsel = true;
- if (av.selectionGroup == null || !av.isSelectionGroupChanged())
+ if (av.getSelectionGroup() == null || !av.isSelectionGroupChanged(true))
{
SequenceGroup sgroup = null;
if (seqsel != null && seqsel.getSize()>0)
{
- if (av.alignment == null)
+ if (av.getAlignment() == null)
{
System.out
.println("Selection message: alignviewport av SeqSetId="
+ " 's alignment is NULL! returning immediatly.");
return;
}
- sgroup = seqsel.intersect(av.alignment,
- (av.hasHiddenRows) ? av.hiddenRepSequences : null);
+ sgroup = seqsel.intersect(av.getAlignment(),
+ (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
if ((sgroup == null || sgroup.getSize() == 0)
&& (colsel == null || colsel.size() == 0))
{
{
av.setSelectionGroup(null);
}
- repaint = av.isSelectionGroupChanged();
+ repaint = av.isSelectionGroupChanged(true);
}
- if (copycolsel && (av.colSel == null || !av.isColSelChanged()))
+ if (copycolsel && (av.getColumnSelection() == null || !av.isColSelChanged(true)))
{
// the current selection is unset or from a previous message
// so import the new colsel.
if (colsel == null || colsel.size() == 0)
{
- if (av.colSel != null)
+ if (av.getColumnSelection() != null)
{
- av.colSel.clear();
+ av.getColumnSelection().clear();
}
}
else
{
// TODO: shift colSel according to the intersecting sequences
- if (av.colSel == null)
+ if (av.getColumnSelection() == null)
{
- av.colSel = new ColumnSelection(colsel);
+ av.setColumnSelection(new ColumnSelection(colsel));
}
else
{
- av.colSel.setElementsFrom(colsel);
+ av.getColumnSelection().setElementsFrom(colsel);
}
}
- repaint |= av.isColSelChanged();
+ repaint |= av.isColSelChanged(true);
}
- if (copycolsel && av.hasHiddenColumns
- && (av.colSel == null || av.colSel.getHiddenColumns() == null))
+ if (copycolsel && av.hasHiddenColumns()
+ && (av.getColumnSelection() == null || av.getColumnSelection().getHiddenColumns() == null))
{
System.err.println("Bad things");
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.appletgui;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
public Color getResidueBoxColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
{
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
return resBoxColour;
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq);
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
public Color findSequenceColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
drawBoxes(seq, i, i, 0);
return resBoxColour;
}
{
// cheat - use this if we have a consensus for each group: s =
// getDisplayChar(currentSequenceGroup.getConsensus(), i, s, '.');
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
}
}
else
graphics.setColor(resBoxColour);
}
}
- if (av.getShowunconserved())
+ if (av.getShowUnconserved())
{
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
}
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
package jalview.appletgui;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
conservationSlider.setTitle("Conservation Colour Increment (" + source
+ ")");
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
sp.setAllGroupsCheckEnabled(true);
}
}
PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
pid.setAllGroupsCheckEnabled(true);
}
}
ColourSchemeI toChange = null;
- Vector allGroups = null;
- int groupIndex = 0;
+ Iterator<SequenceGroup> allGroups = null;
if (allGroupsCheck.getState())
{
- allGroups = ap.av.alignment.getGroups();
- groupIndex = allGroups.size() - 1;
+ allGroups = ap.av.getAlignment().getGroups().listIterator();
}
else
{
toChange = cs;
}
- while (groupIndex > -1)
+ do
{
if (allGroups != null)
{
- toChange = ((SequenceGroup) allGroups.elementAt(groupIndex)).cs;
+ toChange = allGroups.next().cs;
}
if (forConservation)
toChange.setThreshold(i, ap.av.getIgnoreGapsConsensus());
}
- groupIndex--;
- }
+ } while (allGroups!=null && allGroups.hasNext());
ap.seqPanel.seqCanvas.repaint();
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
SequenceNode highlightNode;
- AlignmentPanel ap;
+ AlignmentPanel ap;
public TreeCanvas(AlignmentPanel ap, ScrollPane scroller)
{
this.ap = ap;
av.setSelectionGroup(selected);
}
- selected.setEndRes(av.alignment.getWidth() - 1);
+ selected.setEndRes(av.getAlignment().getWidth() - 1);
selected.addOrRemove(sequence, true);
}
if (node.element() instanceof SequenceI)
{
- SequenceI seq = (SequenceI) ((SequenceNode) node).element();
+ SequenceI seq = (SequenceI) node.element();
if (av.getSequenceColour(seq) == Color.white)
{
Rectangle rect = new Rectangle(xend + 10, ypos - charHeight,
charWidth, charHeight);
- nameHash.put((SequenceI) node.element(), rect);
+ nameHash.put(node.element(), rect);
// Colour selected leaves differently
SequenceGroup selected = av.getSelectionGroup();
if (selected != null
&& selected.getSequences(null).contains(
- (SequenceI) node.element()))
+ node.element()))
{
g.setColor(Color.gray);
int xend = (int) (height * scale) + offx;
int ypos = (int) (node.ycount * chunk) + offy;
- g.setColor(((SequenceNode) node).color.darker());
+ g.setColor(node.color.darker());
// Draw horizontal line
g.drawLine(xstart, ypos, xend, ypos);
}
}
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
if (tree == null)
// for
// scrollbar
- float wscale = (float) (width - labelLength - offx * 2)
+ float wscale = (width - labelLength - offx * 2)
/ tree.getMaxHeight();
SequenceNode top = tree.getTopNode();
}
int x = (int) (threshold
- * (float) (getSize().width - labelLength - 2 * offx) + offx);
+ * (getSize().width - labelLength - 2 * offx) + offx);
g.drawLine(x, 0, x, getSize().height);
}
}
+ @Override
public void mouseReleased(MouseEvent e)
{
}
+ @Override
public void mouseEntered(MouseEvent e)
{
}
+ @Override
public void mouseExited(MouseEvent e)
{
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
if (highlightNode != null)
}
}
+ @Override
public void mouseDragged(MouseEvent ect)
{
}
+ @Override
public void mouseMoved(MouseEvent evt)
{
av.setCurrentTree(tree);
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
av.setCurrentTree(tree);
setColor(tree.getTopNode(), Color.black);
av.setSelectionGroup(null);
- av.alignment.deleteAllGroups();
+ av.getAlignment().deleteAllGroups();
av.sequenceColours = null;
colourGroups();
ColourSchemeI cs = null;
+ SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
+ false, 0, av.getAlignment().getWidth() - 1);
+
if (av.getGlobalColourScheme() != null)
{
if (av.getGlobalColourScheme() instanceof UserColourScheme)
}
else
{
- cs = ColourSchemeProperty.getColour(sequences, av.alignment
- .getWidth(), ColourSchemeProperty.getColourName(av
+ cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
}
// cs is null if shading is an annotationColourGradient
av.getIgnoreGapsConsensus());
}
}
-
- SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
- false, 0, av.alignment.getWidth() - 1);
+ // TODO: cs used to be initialized with a sequence collection and recalcConservation called automatically
+ // instead we set it manually - recalc called after updateAnnotation
+ sg.cs=cs;
sg.setName("JTreeGroup:" + sg.hashCode());
sg.setIdColour(col);
sg.getStartRes(), sg.getEndRes());
c.calculate();
- c.verdict(false, av.ConsPercGaps);
+ c.verdict(false, av.getConsPercGaps());
cs.setConservation(c);
sg.cs = cs;
}
- av.alignment.addGroup(sg);
+ av.getAlignment().addGroup(sg);
}
ap.updateAnnotation();
-
+
}
public void setShowDistances(boolean state)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
if (odata == null)
{
- tree = new NJTree(av.alignment.getSequencesArray(), newtree);
+ tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
}
else
{
- tree = new NJTree(av.alignment.getSequencesArray(), odata,
+ tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
newtree);
}
if (av.getSelectionGroup() == null)
{
start = 0;
- end = av.alignment.getWidth();
- seqs = av.alignment.getSequencesArray();
+ end = av.getAlignment().getWidth();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
start = av.getSelectionGroup().getStartRes();
end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.GraduatedColor;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+import java.awt.Button;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dialog;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.awt.Panel;
+import java.awt.Rectangle;
+import java.awt.Scrollbar;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.MouseEvent;
+import java.util.Vector;
public class UserDefinedColours extends Panel implements ActionListener,
AdjustmentListener
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, null);
} catch (Exception ex)
{
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.bin;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
+
import java.awt.Color;
import java.io.*;
import java.text.DateFormat;
import java.util.*;
import org.apache.log4j.*;
-import org.biojava.dasobert.dasregistry.Das1Source;
/**
* Stores and retrieves Jalview Application Properties Lists and fields within
* histogram.</li>
* <li>SHOW_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
* logo.</li>
+ * <li>NORMALISE_CONSENSUS_LOGO (false) Show consensus annotation row's sequence
+ * logo normalised to row height rather than histogram height.</li>
* <li>FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
* respond to selections made in other alignments containing the same sequences.
* </li>
System.setProperty("http.proxyPort", getDefault("PROXY_PORT", null));
}
+ // LOAD THE AUTHORS FROM THE authors.props file
+ try
+ {
+ String authorDetails = "jar:".concat(Cache.class.getProtectionDomain()
+ .getCodeSource().getLocation().toString()
+ .concat("!/authors.props"));
+
+ java.net.URL localJarFileURL = new java.net.URL(authorDetails);
+
+ InputStream in = localJarFileURL.openStream();
+ applicationProperties.load(in);
+ in.close();
+ } catch (Exception ex)
+ {
+ System.out.println("Error reading author details: " + ex);
+ applicationProperties.remove("AUTHORS");
+ applicationProperties.remove("AUTHORFNAMES");
+ applicationProperties.remove("YEAR");
+ }
+
// FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar
// MUST FOLLOW READING OF LOCAL PROPERTIES FILE AS THE
// VERSION MAY HAVE CHANGED SINCE LAST USING JALVIEW
}
/**
- * generate Das1Sources from the local das source list
- *
- * @return Vector of Das1Sources
- */
- public static Vector getLocalDasSources()
- {
- Vector localSources = new Vector();
- String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
- if (local != null)
- {
- StringTokenizer st = new StringTokenizer(local, "\t");
- while (st.hasMoreTokens())
- {
- String token = st.nextToken();
- int bar = token.indexOf("|");
- Das1Source source = new Das1Source();
- source.setUrl(token.substring(bar + 1));
- if (source.getUrl().startsWith("sequence:"))
- {
- source.setUrl(source.getUrl().substring(9));
- // this source also serves sequences as well as features
- source.setCapabilities(new String[]
- { "sequence", "features" });
- }
- else
- {
- // default is that all user added sources serve features
- source.setCapabilities(new String[]
- { "features" });
- }
-
- source.setNickname(token.substring(0, bar));
-
- localSources.addElement(source);
- }
- }
- return localSources;
- }
-
- /**
* GA tracker object - actually JGoogleAnalyticsTracker null if tracking not
* enabled.
*/
}
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;
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
boolean seqlimits = suffix.equalsIgnoreCase("true");\r
if (alf.viewport.getSelectionGroup() != null)\r
{\r
+ // JBPNote: getSelectionAsNewSequence behaviour has changed - this method now returns a full copy of sequence data\r
+ // TODO consider using getSequenceSelection instead here\r
String reply = new AppletFormatAdapter().formatSequences(format,\r
new Alignment(alf.viewport.getSelectionAsNewSequence()),\r
seqlimits);\r
* jalview.bin.JalviewLiteJsApi#loadAnnotationFrom(jalview.appletgui.AlignFrame\r
* , java.lang.String)\r
*/\r
- public void loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay)\r
+ public boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay)\r
{\r
- alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, autoenabledisplay);\r
+ return alf.parseFeaturesFile(features, AppletFormatAdapter.PASTE, autoenabledisplay);\r
}\r
\r
\r
\r
if (protocol == jalview.io.AppletFormatAdapter.PASTE)\r
{\r
- newAlignFrame.setTitle("Sequences from "\r
- + applet.getDocumentBase());\r
+ newAlignFrame.setTitle("Sequences from " + applet.getDocumentBase());\r
}\r
\r
newAlignFrame.statusBar.setText("Successfully loaded file " + file);\r
}\r
}\r
\r
+\r
+ /*\r
+ * Try to load T-Coffee score file\r
+ */\r
+ String sScoreFile = applet.getParameter("scoreFile");\r
+ if( sScoreFile != null && !"".equals(sScoreFile) ) {\r
+ try {\r
+ if (debug) {\r
+ System.err.println("Attempting to load T-COFFEE score file from the scoreFile parameter");\r
+ }\r
+ if (!newAlignFrame.loadScoreFile(sScoreFile)) {\r
+ System.err.println("Failed to parse T-COFFEE parameter as a valid score file ('"+sScoreFile+"')");\r
+ }\r
+ }catch( Exception e ) {\r
+ System.err.printf("Cannot read score file: '%s'. Cause: %s \n", sScoreFile, e.getMessage());\r
+ }\r
+ }\r
+ \r
+\r
// ///////////////////////////\r
// modify display of features\r
// we do this before any features have been loaded, ensuring any hidden groups are hidden when features first displayed\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.commands;
import jalview.datamodel.*;
/**
- *
+ *
* <p>
* Title: EditCommmand
* </p>
- *
+ *
* <p>
* Description: Essential information for performing undo and redo for cut/paste
* insert/delete gap which can be stored in the HistoryList
* </p>
- *
+ *
* <p>
* Copyright: Copyright (c) 2006
* </p>
- *
+ *
* <p>
* Company: Dundee University
* </p>
- *
+ *
* @author not attributable
* @version 1.0
*/
public static final int REPLACE = 4;
+ public static final int INSERT_NUC=5;
+
Edit[] edits;
String description;
performEdit(0, null);
}
+ @Override
final public String getDescription()
{
return description;
}
+ @Override
public int getSize()
{
return edits == null ? 0 : edits.length;
* operation affects more alignment objects than the one referenced in al (for
* example, cut or pasting whole sequences). Use the form with an additional
* AlignmentI[] views parameter.
- *
+ *
* @param command
* @param seqs
* @param position
/**
* append a new edit command with a set of alignment views that may be
* operated on
- *
+ *
* @param command
* @param seqs
* @param position
case REPLACE:
replace(edits[e]);
break;
+ //TODO:add deleteNuc for UNDO
+// case INSERT_NUC:
+// insertNuc(edits[e]);
+// break;
}
}
}
+ @Override
final public void doCommand(AlignmentI[] views)
{
performEdit(0, views);
}
+ @Override
final public void undoCommand(AlignmentI[] views)
{
int e = 0, eSize = edits.length;
case REPLACE:
replace(edits[e]);
break;
- }
+ }
}
}
{
command.seqs[s].insertCharAt(command.position, command.number,
command.gapChar);
+// System.out.println("pos: "+command.position+" number: "+command.number);
}
adjustAnnotations(command, true, false, null);
}
+//
+// final void insertNuc(Edit command)
+// {
+//
+// for (int s = 0; s < command.seqs.length; s++)
+// {
+// System.out.println("pos: "+command.position+" number: "+command.number);
+// command.seqs[s].insertCharAt(command.position, command.number,'A');
+// }
+//
+// adjustAnnotations(command, true, false, null);
+// }
final void deleteGap(Edit command)
{
// read it to the alignment
if (command.alIndex[i] < command.al.getHeight())
{
- command.al.getSequences().insertElementAt(command.seqs[i],
- command.alIndex[i]);
+ List<SequenceI> sequences;
+ synchronized (sequences=command.al.getSequences()) {
+ sequences.add(command.alIndex[i], command.seqs[i]);
+ }
}
else
{
* cut addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT,
* cut, sg.getStartRes(), sg.getEndRes()-sg.getStartRes()+1,
* viewport.alignment));
- *
+ *
*/
/**
* then addHistoryItem(new EditCommand( "Add sequences",
* EditCommand.PASTE, sequences, 0, alignment.getWidth(), alignment) );
- *
+ *
*/
oldstring = command.seqs[i].getSequenceAsString();
tmp = new StringBuffer(oldstring.substring(0, start));
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
import java.util.*;
-import jalview.analysis.*;
-
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
/**
* @author JimP
- *
+ *
*/
public class Alignment implements AlignmentI
{
protected Alignment dataset;
- protected Vector sequences;
+ protected List<SequenceI> sequences;
- protected Vector groups = new Vector();
+ protected List<SequenceGroup> groups = java.util.Collections
+ .synchronizedList(new ArrayList<SequenceGroup>());
protected char gapCharacter = '-';
public static final int NUCLEOTIDE = 1;
+ public boolean hasRNAStructure = false;
+
/** DOCUMENT ME!! */
public AlignmentAnnotation[] annotations;
type = PROTEIN;
}
- sequences = new Vector();
+ sequences = java.util.Collections
+ .synchronizedList(new ArrayList<SequenceI>());
for (i = 0; i < seqs.length; i++)
{
- sequences.addElement(seqs[i]);
+ sequences.add(seqs[i]);
}
}
/**
* Make an alignment from an array of Sequences.
- *
+ *
* @param sequences
*/
public Alignment(SequenceI[] seqs)
/**
* Make a new alignment from an array of SeqCigars
- *
+ *
* @param seqs
* SeqCigar[]
*/
* compactAlignment does not contain hidden regions. JBPNote - must also check
* that compactAlignment resolves to a set of SeqCigars - or construct them
* appropriately.
- *
+ *
* @param compactAlignment
* CigarArray
*/
/**
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
- public Vector getSequences()
+ @Override
+ public List<SequenceI> getSequences()
+ {
+ return sequences;
+ }
+
+ @Override
+ public List<SequenceI> getSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
{
+ // TODO: in jalview 2.8 we don't do anything with hiddenreps - fix design to
+ // work on this.
return sequences;
}
+ @Override
public SequenceI[] getSequencesArray()
{
if (sequences == null)
return null;
- SequenceI[] reply = new SequenceI[sequences.size()];
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- reply[i] = (SequenceI) sequences.elementAt(i);
+ return sequences.toArray(new SequenceI[sequences.size()]);
}
- return reply;
}
/**
* DOCUMENT ME!
- *
+ *
* @param i
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
+ @Override
public SequenceI getSequenceAt(int i)
{
- if (i>-1 && i < sequences.size())
+ synchronized (sequences)
{
- return (SequenceI) sequences.elementAt(i);
+ if (i > -1 && i < sequences.size())
+ {
+ return sequences.get(i);
+ }
}
-
return null;
}
/**
* Adds a sequence to the alignment. Recalculates maxLength and size.
- *
+ *
* @param snew
*/
+ @Override
public void addSequence(SequenceI snew)
{
if (dataset != null)
}
else
{
- sequences.addElement(snew);
+ synchronized (sequences)
+ {
+ sequences.add(snew);
+ }
}
if (hiddenSequences != null)
hiddenSequences.adjustHeightSequenceAdded();
/**
* Adds a sequence to the alignment. Recalculates maxLength and size.
- *
+ *
* @param snew
*/
+ @Override
public void setSequenceAt(int i, SequenceI snew)
{
SequenceI oldseq = getSequenceAt(i);
- deleteSequence(oldseq);
-
- sequences.setElementAt(snew, i);
+ deleteSequence(i);
+ synchronized (sequences)
+ {
+ sequences.set(i, snew);
+ }
}
/**
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
- public Vector getGroups()
+ @Override
+ public List<SequenceGroup> getGroups()
{
return groups;
}
+ @Override
public void finalize()
{
if (getDataset() != null)
/**
* DOCUMENT ME!
- *
+ *
* @param s
* DOCUMENT ME!
*/
+ @Override
public void deleteSequence(SequenceI s)
{
deleteSequence(findIndex(s));
/**
* DOCUMENT ME!
- *
+ *
* @param i
* DOCUMENT ME!
*/
+ @Override
public void deleteSequence(int i)
{
if (i > -1 && i < getHeight())
{
- sequences.removeElementAt(i);
+ synchronized (sequences)
+ {
+ sequences.remove(i);
+ }
hiddenSequences.adjustHeightSequenceDeleted(i);
}
}
- /** */
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.datamodel.AlignmentI#findGroup(jalview.datamodel.SequenceI)
+ */
+ @Override
public SequenceGroup findGroup(SequenceI s)
{
- for (int i = 0; i < this.groups.size(); i++)
+ synchronized (groups)
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
-
- if (sg.getSequences(null).contains(s))
+ for (int i = 0; i < this.groups.size(); i++)
{
- return sg;
+ SequenceGroup sg = groups.get(i);
+
+ if (sg.getSequences(null).contains(s))
+ {
+ return sg;
+ }
}
}
-
return null;
}
- /**
- * DOCUMENT ME!
- *
- * @param s
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * jalview.datamodel.AlignmentI#findAllGroups(jalview.datamodel.SequenceI)
*/
+ @Override
public SequenceGroup[] findAllGroups(SequenceI s)
{
- Vector temp = new Vector();
+ ArrayList<SequenceGroup> temp = new ArrayList<SequenceGroup>();
- int gSize = groups.size();
- for (int i = 0; i < gSize; i++)
+ synchronized (groups)
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg == null || sg.getSequences(null) == null)
+ int gSize = groups.size();
+ for (int i = 0; i < gSize; i++)
{
- this.deleteGroup(sg);
- gSize--;
- continue;
- }
+ SequenceGroup sg = groups.get(i);
+ if (sg == null || sg.getSequences(null) == null)
+ {
+ this.deleteGroup(sg);
+ gSize--;
+ continue;
+ }
- if (sg.getSequences(null).contains(s))
- {
- temp.addElement(sg);
+ if (sg.getSequences(null).contains(s))
+ {
+ temp.add(sg);
+ }
}
}
-
SequenceGroup[] ret = new SequenceGroup[temp.size()];
-
- for (int i = 0; i < temp.size(); i++)
- {
- ret[i] = (SequenceGroup) temp.elementAt(i);
- }
-
- return ret;
+ return temp.toArray(ret);
}
/** */
+ @Override
public void addGroup(SequenceGroup sg)
{
- if (!groups.contains(sg))
+ synchronized (groups)
{
- if (hiddenSequences.getSize() > 0)
+ if (!groups.contains(sg))
{
- int i, iSize = sg.getSize();
- for (i = 0; i < iSize; i++)
+ if (hiddenSequences.getSize() > 0)
{
- if (!sequences.contains(sg.getSequenceAt(i)))
+ int i, iSize = sg.getSize();
+ for (i = 0; i < iSize; i++)
{
- sg.deleteSequence(sg.getSequenceAt(i), false);
- iSize--;
- i--;
+ if (!sequences.contains(sg.getSequenceAt(i)))
+ {
+ sg.deleteSequence(sg.getSequenceAt(i), false);
+ iSize--;
+ i--;
+ }
}
- }
- if (sg.getSize() < 1)
- {
- return;
+ if (sg.getSize() < 1)
+ {
+ return;
+ }
}
- }
- groups.addElement(sg);
+ groups.add(sg);
+ }
}
}
/**
* remove any annotation that references gp
- *
+ *
* @param gp
* (if null, removes all group associated annotation)
*/
}
}
+ @Override
public void deleteAllGroups()
{
- if (annotations != null)
+ synchronized (groups)
{
- removeAnnotationForGroup(null);
+ if (annotations != null)
+ {
+ removeAnnotationForGroup(null);
+ }
+ groups.clear();
}
- groups.removeAllElements();
}
/** */
+ @Override
public void deleteGroup(SequenceGroup g)
{
- if (groups.contains(g))
+ synchronized (groups)
{
- removeAnnotationForGroup(g);
- groups.removeElement(g);
+ if (groups.contains(g))
+ {
+ removeAnnotationForGroup(g);
+ groups.remove(g);
+ }
}
}
/** */
+ @Override
public SequenceI findName(String name)
{
return findName(name, false);
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#findName(java.lang.String, boolean)
*/
+ @Override
public SequenceI findName(String token, boolean b)
{
return findName(null, token, b);
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#findName(SequenceI, java.lang.String,
* boolean)
*/
+ @Override
public SequenceI findName(SequenceI startAfter, String token, boolean b)
{
return null;
}
+ @Override
public SequenceI[] findSequenceMatch(String name)
{
Vector matches = new Vector();
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SequenceI)
*/
+ @Override
public int findIndex(SequenceI s)
{
int i = 0;
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.datamodel.AlignmentI#findIndex(jalview.datamodel.SearchResults)
*/
+ @Override
public int findIndex(SearchResults results)
{
int i = 0;
/**
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
+ @Override
public int getHeight()
{
return sequences.size();
/**
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
+ @Override
public int getWidth()
{
int maxLength = -1;
/**
* DOCUMENT ME!
- *
+ *
* @param gc
* DOCUMENT ME!
*/
+ @Override
public void setGapCharacter(char gc)
{
gapCharacter = gc;
-
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- Sequence seq = (Sequence) sequences.elementAt(i);
- seq.setSequence(seq.getSequenceAsString().replace('.', gc)
- .replace('-', gc).replace(' ', gc));
+ for (SequenceI seq : sequences)
+ {
+ seq.setSequence(seq.getSequenceAsString().replace('.', gc)
+ .replace('-', gc).replace(' ', gc));
+ }
}
}
/**
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
+ @Override
public char getGapCharacter()
{
return gapCharacter;
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#isAligned()
*/
+ @Override
public boolean isAligned()
{
return isAligned(false);
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#isAligned(boolean)
*/
+ @Override
public boolean isAligned(boolean includeHidden)
{
int width = getWidth();
/*
* (non-Javadoc)
- *
+ *
* @seejalview.datamodel.AlignmentI#deleteAnnotation(jalview.datamodel.
* AlignmentAnnotation)
*/
+ @Override
public boolean deleteAnnotation(AlignmentAnnotation aa)
{
return deleteAnnotation(aa, true);
}
-
+
+ @Override
public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook)
{
int aSize = 1;
if (swap)
{
annotations = temp;
- if (unhook) {
+ if (unhook)
+ {
unhookAnnotation(aa);
}
}
/**
* remove any object references associated with this annotation
- *
+ *
* @param aa
*/
private void unhookAnnotation(AlignmentAnnotation aa)
/*
* (non-Javadoc)
- *
+ *
* @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
* AlignmentAnnotation)
*/
+ @Override
public void addAnnotation(AlignmentAnnotation aa)
{
addAnnotation(aa, -1);
/*
* (non-Javadoc)
- *
+ *
* @seejalview.datamodel.AlignmentI#addAnnotation(jalview.datamodel.
* AlignmentAnnotation, int)
*/
+ @Override
public void addAnnotation(AlignmentAnnotation aa, int pos)
{
+ if (aa.getRNAStruc() != null)
+ {
+ hasRNAStructure = true;
+ }
+
int aSize = 1;
if (annotations != null)
{
annotations = temp;
}
+ @Override
public void setAnnotationIndex(AlignmentAnnotation aa, int index)
{
if (aa == null || annotations == null || annotations.length - 1 < index)
annotations = temp;
}
+ @Override
/**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * returns all annotation on the alignment
*/
public AlignmentAnnotation[] getAlignmentAnnotation()
{
return annotations;
}
+ @Override
public void setNucleotide(boolean b)
{
if (b)
}
}
+ @Override
public boolean isNucleotide()
{
if (type == NUCLEOTIDE)
}
}
+ @Override
+ public boolean hasRNAStructure()
+ {
+ // TODO can it happen that structure is removed from alignment?
+ return hasRNAStructure;
+ }
+
+ @Override
public void setDataset(Alignment data)
{
if (dataset == null && data == null)
currentSeq = getSequenceAt(i);
if (currentSeq.getDatasetSequence() != null)
{
- seqs[i] = (Sequence) currentSeq.getDatasetSequence();
+ seqs[i] = currentSeq.getDatasetSequence();
}
else
{
alignmentRefs++;
}
+ @Override
public Alignment getDataset()
{
return dataset;
}
+ @Override
public boolean padGaps()
{
boolean modified = false;
/**
* Justify the sequences to the left or right by deleting and inserting gaps
* before the initial residue or after the terminal residue
- *
+ *
* @param right
* true if alignment padded to right, false to justify to left
* @return true if alignment was changed
*/
+ @Override
public boolean justify(boolean right)
{
boolean modified = false;
return modified;
}
+ @Override
public HiddenSequences getHiddenSequences()
{
return hiddenSequences;
}
+ @Override
public CigarArray getCompactAlignment()
{
- SeqCigar alseqs[] = new SeqCigar[sequences.size()];
- for (int i = 0; i < sequences.size(); i++)
+ synchronized (sequences)
{
- alseqs[i] = new SeqCigar((SequenceI) sequences.elementAt(i));
+ SeqCigar alseqs[] = new SeqCigar[sequences.size()];
+ int i = 0;
+ for (SequenceI seq : sequences)
+ {
+ alseqs[i++] = new SeqCigar(seq);
+ }
+ CigarArray cal = new CigarArray(alseqs);
+ cal.addOperation(CigarArray.M, getWidth());
+ return cal;
}
- CigarArray cal = new CigarArray(alseqs);
- cal.addOperation(CigarArray.M, getWidth());
- return cal;
}
+ @Override
public void setProperty(Object key, Object value)
{
if (alignmentProperties == null)
alignmentProperties.put(key, value);
}
+ @Override
public Object getProperty(Object key)
{
if (alignmentProperties != null)
return null;
}
+ @Override
public Hashtable getProperties()
{
return alignmentProperties;
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.datamodel.AlignmentI#addCodonFrame(jalview.datamodel.AlignedCodonFrame
* )
*/
+ @Override
public void addCodonFrame(AlignedCodonFrame codons)
{
if (codons == null)
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#getCodonFrame(int)
*/
+ @Override
public AlignedCodonFrame getCodonFrame(int index)
{
return codonFrameList[index];
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.datamodel.AlignmentI#getCodonFrame(jalview.datamodel.SequenceI)
*/
+ @Override
public AlignedCodonFrame[] getCodonFrame(SequenceI seq)
{
if (seq == null || codonFrameList == null)
/*
* (non-Javadoc)
- *
+ *
* @see jalview.datamodel.AlignmentI#getCodonFrames()
*/
+ @Override
public AlignedCodonFrame[] getCodonFrames()
{
return codonFrameList;
/*
* (non-Javadoc)
- *
+ *
* @seejalview.datamodel.AlignmentI#removeCodonFrame(jalview.datamodel.
* AlignedCodonFrame)
*/
+ @Override
public boolean removeCodonFrame(AlignedCodonFrame codons)
{
if (codons == null || codonFrameList == null)
return removed;
}
+ @Override
public void append(AlignmentI toappend)
{
+ if (toappend == this)
+ {
+ System.err.println("Self append may cause a deadlock.");
+ }
// TODO test this method for a future 2.5 release
// currently tested for use in jalview.gui.SequenceFetcher
boolean samegap = toappend.getGapCharacter() == getGapCharacter();
boolean hashidden = toappend.getHiddenSequences() != null
&& toappend.getHiddenSequences().hiddenSequences != null;
// get all sequences including any hidden ones
- Vector sqs = (hashidden) ? toappend.getHiddenSequences()
+ List<SequenceI> sqs = (hashidden) ? toappend.getHiddenSequences()
.getFullAlignment().getSequences() : toappend.getSequences();
if (sqs != null)
{
- Enumeration sq = sqs.elements();
- while (sq.hasMoreElements())
+ synchronized (sqs)
{
- SequenceI addedsq = (SequenceI) sq.nextElement();
- if (!samegap)
+ for (SequenceI addedsq : sqs)
{
- char[] oldseq = addedsq.getSequence();
- for (int c = 0; c < oldseq.length; c++)
+ if (!samegap)
{
- if (oldseq[c] == oldc)
+ char[] oldseq = addedsq.getSequence();
+ for (int c = 0; c < oldseq.length; c++)
{
- oldseq[c] = gapCharacter;
+ if (oldseq[c] == oldc)
+ {
+ oldseq[c] = gapCharacter;
+ }
}
}
+ addSequence(addedsq);
}
- addSequence(addedsq);
}
}
AlignmentAnnotation[] alan = toappend.getAlignmentAnnotation();
{
this.addCodonFrame(acod[a]);
}
- Vector sg = toappend.getGroups();
+ List<SequenceGroup> sg = toappend.getGroups();
if (sg != null)
{
- Enumeration el = sg.elements();
- while (el.hasMoreElements())
+ for (SequenceGroup _sg : sg)
{
- addGroup((SequenceGroup) el.nextElement());
+ addGroup(_sg);
}
}
if (toappend.getHiddenSequences() != null)
}
}
+ @Override
+ public AlignmentAnnotation findOrCreateAnnotation(String name,
+ boolean autoCalc, SequenceI seqRef, SequenceGroup groupRef)
+ {
+ for (AlignmentAnnotation annot : getAlignmentAnnotation())
+ {
+ if (annot.autoCalculated == autoCalc
+ && annot.getCalcId().equals(name)
+ && annot.sequenceRef == seqRef && annot.groupRef == groupRef)
+ {
+ return annot;
+ }
+ }
+ AlignmentAnnotation annot = new AlignmentAnnotation(name, name,
+ new Annotation[1], 0f, 0f, AlignmentAnnotation.BAR_GRAPH);
+ annot.hasText = false;
+ annot.setCalcId(new String(name));
+ annot.autoCalculated = autoCalc;
+ if (seqRef != null)
+ {
+ annot.setSequenceRef(seqRef);
+ }
+ annot.groupRef = groupRef;
+ addAnnotation(annot);
+
+ return annot;
+ }
+
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
+ {
+ ArrayList<AlignmentAnnotation> aa = new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation a : getAlignmentAnnotation())
+ {
+ if (a.getCalcId() == calcId
+ || (a.getCalcId() != null && calcId != null && a.getCalcId()
+ .equals(calcId)))
+ {
+ aa.add(a);
+ }
+ }
+ return aa;
+ }
+
+ @Override
+ public void moveSelectedSequencesByOne(SequenceGroup sg,
+ Map<SequenceI, SequenceCollectionI> map, boolean up)
+ {
+ synchronized (sequences)
+ {
+ if (up)
+ {
+
+ for (int i = 1, iSize = sequences.size(); i < iSize; i++)
+ {
+ SequenceI seq = sequences.get(i);
+ if (!sg.getSequences(map).contains(seq))
+ {
+ continue;
+ }
+
+ SequenceI temp = sequences.get(i - 1);
+ if (sg.getSequences(null).contains(temp))
+ {
+ continue;
+ }
+
+ sequences.set(i, temp);
+ sequences.set(i - 1, seq);
+ }
+ }
+ else
+ {
+ for (int i = sequences.size() - 2; i > -1; i--)
+ {
+ SequenceI seq = sequences.get(i);
+ if (!sg.getSequences(map).contains(seq))
+ {
+ continue;
+ }
+
+ SequenceI temp = sequences.get(i + 1);
+ if (sg.getSequences(map).contains(temp))
+ {
+ continue;
+ }
+
+ sequences.set(i, temp);
+ sequences.set(i + 1, seq);
+ }
+ }
+
+ }
+ }
+
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.datamodel;
+import jalview.analysis.Rna;
+import jalview.analysis.WUSSParseException;
+
import java.util.Enumeration;
import java.util.Hashtable;
public boolean autoCalculated = false;
public String annotationId;
-
+
public SequenceI sequenceRef;
/** DOCUMENT ME!! */
/** DOCUMENT ME!! */
public Annotation[] annotations;
+ /**
+ * RNA secondary structure contact positions
+ */
+ public SequenceFeature[] _rnasecstr = null;
+ /**
+ * position of annotation resulting in invalid WUSS parsing or -1
+ */
+ private long invalidrnastruc=-1;
+ /**
+ * Updates the _rnasecstr field Determines the positions that base pair and
+ * the positions of helices based on secondary structure from a Stockholm file
+ *
+ * @param RNAannot
+ */
+ private void _updateRnaSecStr(CharSequence RNAannot)
+ {
+ try {
+ _rnasecstr = Rna.GetBasePairs(RNAannot);
+ invalidrnastruc=-1;
+ }
+ catch (WUSSParseException px)
+ {
+ invalidrnastruc=px.getProblemPos();
+ }
+ if (invalidrnastruc>-1)
+ {
+ return;
+ }
+ Rna.HelixMap(_rnasecstr);
+ // setRNAStruc(RNAannot);
+
+ if (_rnasecstr != null && _rnasecstr.length > 0)
+ {
+ // show all the RNA secondary structure annotation symbols.
+ isrna=true;
+ showAllColLabels = true;
+ scaleColLabel = true;
+ }
+ // System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+ }
public java.util.Hashtable sequenceMapping;
/** DOCUMENT ME!! */
*/
public boolean centreColLabels = false;
+ private boolean isrna;
+
/*
* (non-Javadoc)
*
validateRangeAndDisplay();
}
+ /**
+ * Checks if annotation labels represent secondary structures
+ *
+ */
void areLabelsSecondaryStructure()
{
boolean nonSSLabel = false;
+ isrna = false;
+ StringBuffer rnastring = new StringBuffer();
+
char firstChar = 0;
for (int i = 0; i < annotations.length; i++)
{
{
hasIcons |= true;
}
+ else
+ // Check for RNA secondary structure
+ {
+ if (annotations[i].secondaryStructure == 'S')
+ {
+ hasIcons |= true;
+ isrna |= true;
+ }
+ }
- if (annotations[i].displayCharacter == null)
+ // System.out.println("displaychar " + annotations[i].displayCharacter);
+
+ if (annotations[i].displayCharacter == null
+ || annotations[i].displayCharacter.length() == 0)
{
+ rnastring.append('.');
continue;
}
if (annotations[i].displayCharacter.length() == 1)
firstChar != ' '
&& firstChar != 'H'
&& firstChar != 'E'
+ && firstChar != 'S'
&& firstChar != '-'
&& firstChar < jalview.schemes.ResidueProperties.aaIndex.length)
{
}
}
}
+ else
+ {
+ rnastring.append(annotations[i].displayCharacter.charAt(1));
+ }
if (annotations[i].displayCharacter.length() > 0)
{
}
}
+ else
+ {
+ if (isrna)
+ {
+ _updateRnaSecStr(new AnnotCharSequence());
+ }
+ }
annotationId = this.hashCode() + "";
}
-
/**
+ * flyweight access to positions in the alignment annotation row for RNA processing
+ * @author jimp
+ *
+ */
+ private class AnnotCharSequence implements CharSequence
+ {
+ int offset=0;
+ int max=0;
+
+ public AnnotCharSequence() {
+ this(0,annotations.length);
+ }
+ public AnnotCharSequence(int start, int end) {
+ offset=start;
+ max=end;
+ }
+ @Override
+ public CharSequence subSequence(int start, int end)
+ {
+ return new AnnotCharSequence(offset+start, offset+end);
+ }
+
+ @Override
+ public int length()
+ {
+ return max-offset;
+ }
+
+ @Override
+ public char charAt(int index)
+ {
+ String dc;
+ return ((index+offset<0) || (index+offset)>=max || annotations[index+offset]==null || (dc=annotations[index+offset].displayCharacter.trim()).length()<1)
+ ? '.' : dc.charAt(0);
+ }
+ public String toString()
+ {
+ char[] string=new char[max-offset];
+ int mx=annotations.length;
+
+ for (int i=offset;i<mx;i++)
+ {
+ String dc;
+ string[i]=(annotations[i]==null || (dc=annotations[i].displayCharacter.trim()).length()<1 )? '.' : dc.charAt(0);
+ }
+ return new String(string);
+ }
+ };
+
+ private long _lastrnaannot=-1;
+ public String getRNAStruc(){
+ if (isrna)
+ {
+ String rnastruc = new AnnotCharSequence().toString();
+ if (_lastrnaannot!=rnastruc.hashCode())
+ {
+ // ensure rna structure contacts are up to date
+ _lastrnaannot=rnastruc.hashCode();
+ _updateRnaSecStr(rnastruc);
+ }
+ return rnastruc;
+ }
+ return null;
+ }
+
+/**
* Creates a new AlignmentAnnotation object.
*
* @param label
* checks graphMin and graphMax, secondary structure symbols, sets graphType
* appropriately, sets null labels to the empty string if appropriate.
*/
- private void validateRangeAndDisplay()
+ public void validateRangeAndDisplay()
{
if (annotations == null)
this.label = annotation.label;
this.padGaps = annotation.padGaps;
this.visible = annotation.visible;
+ this.centreColLabels=annotation.centreColLabels;
+ this.scaleColLabel=annotation.scaleColLabel;
+ this.showAllColLabels=annotation.showAllColLabels;
+ this.calcId = annotation.calcId;
if (this.hasScore = annotation.hasScore)
{
this.score = annotation.score;
}
}
}
+ // TODO: check if we need to do this: JAL-952
+ //if (this.isrna=annotation.isrna)
+ {
+ // _rnasecstr=new SequenceFeature[annotation._rnasecstr];
+ }
validateRangeAndDisplay(); // construct hashcodes, etc.
}
}
return description;
}
+
+ public boolean isValidStruc()
+ {
+ return invalidrnastruc==-1;
+ }
+ public long getInvalidStrucPos()
+ {
+ return invalidrnastruc;
+ }
+
+ /**
+ * machine readable ID string indicating what generated this annotation
+ */
+ protected String calcId="";
+ public String getCalcId()
+ {
+ return calcId;
+ }
+
+ public void setCalcId(String calcId)
+ {
+ this.calcId = calcId;
+ }
+
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
/**
* Data structure to hold and manipulate a multiple sequence alignment
*/
-public interface AlignmentI
+public interface AlignmentI extends AnnotatedCollectionI
{
/**
* Calculates the number of sequences in an alignment
- *
+ *
* @return Number of sequences in alignment
*/
public int getHeight();
/**
* Calculates the maximum width of the alignment, including gaps.
- *
+ *
* @return Greatest sequence length within alignment.
*/
+ @Override
public int getWidth();
/**
* Calculates if this set of sequences (visible and invisible) are all the
* same length
- *
+ *
* @return true if all sequences in alignment are the same length
*/
public boolean isAligned();
/**
* Calculates if this set of sequences is all the same length
- *
+ *
* @param includeHidden
* optionally exclude hidden sequences from test
* @return true if all (or just visible) sequences are the same length
public boolean isAligned(boolean includeHidden);
/**
- * Gets sequences as a Vector
- *
+ * Gets sequences as a Synchronized collection
+ *
* @return All sequences in alignment.
*/
- public Vector getSequences();
+ @Override
+ public List<SequenceI> getSequences();
/**
* Gets sequences as a SequenceI[]
- *
+ *
* @return All sequences in alignment.
*/
public SequenceI[] getSequencesArray();
/**
* Find a specific sequence in this alignment.
- *
+ *
* @param i
* Index of required sequence.
- *
+ *
* @return SequenceI at given index.
*/
public SequenceI getSequenceAt(int i);
/**
* Add a new sequence to this alignment.
- *
+ *
* @param seq
* New sequence will be added at end of alignment.
*/
public void addSequence(SequenceI seq);
+
/**
* Used to set a particular index of the alignment with the given sequence.
- *
+ *
* @param i
* Index of sequence to be updated.
* @param seq
/**
* Deletes a sequence from the alignment
- *
+ *
* @param s
* Sequence to be deleted.
*/
/**
* Deletes a sequence from the alignment.
- *
+ *
* @param i
* Index of sequence to be deleted.
*/
/**
* Finds sequence in alignment using sequence name as query.
- *
+ *
* @param name
* Id of sequence to search for.
- *
+ *
* @return Sequence matching query, if found. If not found returns null.
*/
public SequenceI findName(String name);
/**
* Finds index of a given sequence in the alignment.
- *
+ *
* @param s
* Sequence to look for.
- *
+ *
* @return Index of sequence within the alignment or -1 if not found
*/
public int findIndex(SequenceI s);
/**
* Finds group that given sequence is part of.
- *
+ *
* @param s
* Sequence in alignment.
- *
+ *
* @return First group found for sequence. WARNING : Sequences may be members
* of several groups. This method is incomplete.
*/
/**
* Finds all groups that a given sequence is part of.
- *
+ *
* @param s
* Sequence in alignment.
- *
+ *
* @return All groups containing given sequence.
*/
public SequenceGroup[] findAllGroups(SequenceI s);
/**
* Adds a new SequenceGroup to this alignment.
- *
+ *
* @param sg
* New group to be added.
*/
/**
* Deletes a specific SequenceGroup
- *
+ *
* @param g
* Group will be deleted from alignment.
*/
/**
* Get all the groups associated with this alignment.
- *
- * @return All groups as a Vector.
+ *
+ * @return All groups as a list.
*/
- public Vector getGroups();
+ public List<SequenceGroup> getGroups();
/**
* Deletes all groups from this alignment.
/**
* Adds a new AlignmentAnnotation to this alignment
- *
+ *
* @note Care should be taken to ensure that annotation is at least as wide as
* the longest sequence in the alignment for rendering purposes.
*/
/**
* moves annotation to a specified index in alignment annotation display stack
- *
+ *
* @param aa
* the annotation object to be moved
* @param index
/**
* Deletes a specific AlignmentAnnotation from the alignment, and removes its
- * reference from any SequenceI or SequenceGroup object's annotation if and only if aa is
- * contained within the alignment's annotation vector. Otherwise, it will do
- * nothing.
- *
+ * reference from any SequenceI or SequenceGroup object's annotation if and
+ * only if aa is contained within the alignment's annotation vector.
+ * Otherwise, it will do nothing.
+ *
* @param aa
* the annotation to delete
* @return true if annotation was deleted from this alignment.
public boolean deleteAnnotation(AlignmentAnnotation aa);
/**
- * Deletes a specific AlignmentAnnotation from the alignment, and optionally removes any
- * reference from any SequenceI or SequenceGroup object's annotation if and only if aa is
- * contained within the alignment's annotation vector. Otherwise, it will do
- * nothing.
- *
+ * Deletes a specific AlignmentAnnotation from the alignment, and optionally
+ * removes any reference from any SequenceI or SequenceGroup object's
+ * annotation if and only if aa is contained within the alignment's annotation
+ * vector. Otherwise, it will do nothing.
+ *
* @param aa
* the annotation to delete
* @param unhook
- * flag indicating if any references should be removed from annotation - use this if you intend to add the annotation back into the alignment
+ * flag indicating if any references should be removed from
+ * annotation - use this if you intend to add the annotation back
+ * into the alignment
* @return true if annotation was deleted from this alignment.
*/
public boolean deleteAnnotation(AlignmentAnnotation aa, boolean unhook);
/**
* Get the annotation associated with this alignment (this can be null if no
* annotation has ever been created on the alignment)
- *
+ *
* @return array of AlignmentAnnotation objects
*/
+ @Override
public AlignmentAnnotation[] getAlignmentAnnotation();
/**
* Change the gap character used in this alignment to 'gc'
- *
+ *
* @param gc
* the new gap character.
*/
/**
* Get the gap character used in this alignment
- *
+ *
* @return gap character
*/
public char getGapCharacter();
/**
* Test for all nucleotide alignment
- *
+ *
* @return true if alignment is nucleotide sequence
*/
public boolean isNucleotide();
/**
+ * Test if alignment contains RNA structure
+ *
+ * @return true if RNA structure AligmnentAnnotation was added to alignment
+ */
+ public boolean hasRNAStructure();
+
+ /**
* Set alignment to be a nucleotide sequence
- *
+ *
*/
public void setNucleotide(boolean b);
/**
* Get the associated dataset for the alignment.
- *
+ *
* @return Alignment containing dataset sequences or null of this is a
* dataset.
*/
/**
* Set the associated dataset for the alignment, or create one.
- *
+ *
* @param dataset
* The dataset alignment or null to construct one.
*/
/**
* pads sequences with gaps (to ensure the set looks like an alignment)
- *
+ *
* @return boolean true if alignment was modified
*/
public boolean padGaps();
/**
* Compact representation of alignment
- *
+ *
* @return CigarArray
*/
public CigarArray getCompactAlignment();
/**
* Set an arbitrary key value pair for an alignment. Note: both key and value
* objects should return a meaningful, human readable response to .toString()
- *
+ *
* @param key
* @param value
*/
/**
* Get a named property from the alignment.
- *
+ *
* @param key
* @return value of property
*/
/**
* Get the property hashtable.
- *
+ *
* @return hashtable of alignment properties (or null if none are defined)
*/
public Hashtable getProperties();
/**
* add a reference to a frame of aligned codons for this alignment
- *
+ *
* @param codons
*/
public void addCodonFrame(AlignedCodonFrame codons);
/**
* remove a particular codon frame reference from this alignment
- *
+ *
* @param codons
* @return true if codon frame was removed.
*/
/**
* get all codon frames associated with this alignment
- *
+ *
* @return
*/
public AlignedCodonFrame[] getCodonFrames();
/**
* get a particular codon frame
- *
+ *
* @param index
* @return
*/
/**
* find sequence with given name in alignment
- *
+ *
* @param token
* name to find
* @param b
/**
* find next sequence with given name in alignment starting after a given
* sequence
- *
+ *
* @param startAfter
* the sequence after which the search will be started (usually the
* result of the last call to findName)
/**
* find first sequence in alignment which is involved in the given search
* result object
- *
+ *
* @param results
* @return -1 or index of sequence in alignment
*/
* gap characters, etc...). If you are uncertain, use the copy Alignment copy
* constructor to create a new version which can be appended without side
* effect.
- *
+ *
* @param toappend
* - the alignment to be appended.
*/
/**
* Justify the sequences to the left or right by deleting and inserting gaps
* before the initial residue or after the terminal residue
- *
+ *
* @param right
* true if alignment padded to right, false to justify to left
* @return true if alignment was changed TODO: return undo object
/**
* add given annotation row at given position (0 is start, -1 is end)
- *
+ *
* @param consensus
* @param i
*/
public void addAnnotation(AlignmentAnnotation consensus, int i);
+
+ /**
+ * search for or create a specific annotation row on the alignment
+ *
+ * @param method - CalcId for the annotation (must match)
+ * @param autoCalc - value of autocalc flag for the annotation
+ * @param seqRef - null or specific sequence reference
+ * @param groupRef - null or specific group reference
+ * @return existing annotation matching the given attributes
+ */
+ public AlignmentAnnotation findOrCreateAnnotation(String name, boolean autoCalc,
+ SequenceI seqRef, SequenceGroup groupRef);
+
+ /**
+ * move the given group up or down in the alignment by the given number of rows.
+ * Implementor assumes given group is already present on alignment - no recalculations are triggered.
+ * @param sg
+ * @param map
+ * @param up
+ * @param i
+ */
+ public void moveSelectedSequencesByOne(SequenceGroup sg,
+ Map<SequenceI, SequenceCollectionI> map, boolean up);
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
\r
import java.io.PrintStream;\r
import java.util.Enumeration;\r
+import java.util.List;\r
import java.util.Vector;\r
\r
/**\r
SequenceI[] selseqs;\r
if (selection != null)\r
{\r
- Vector sel = selection.getSequences(null);\r
+ List<SequenceI> sel = selection.getSequences(null);\r
this.selected = new Vector();\r
selseqs = selection.getSequencesInOrder(alignment, selectedRegionOnly);\r
}\r
\r
// get the alignment's group list and make a copy\r
Vector grps = new Vector();\r
- Vector gg = alignment.getGroups();\r
- Enumeration gge = gg.elements();\r
- while (gge.hasMoreElements())\r
- {\r
- grps.addElement(gge.nextElement());\r
- }\r
+ List<SequenceGroup> gg = alignment.getGroups();\r
+ grps.addAll(gg);\r
ScGroup[] sgrps = null;\r
boolean addedgps[] = null;\r
if (grps != null)\r
+ " wide and has " + visal.getHeight() + " seqs.");\r
if (visal.getGroups() != null && visal.getGroups().size() > 0)\r
{\r
- SequenceGroup sg;\r
- Enumeration en = visal.getGroups().elements();\r
+ \r
int i = 1;\r
- while (en.hasMoreElements())\r
+ for (SequenceGroup sg:visal.getGroups())\r
{\r
- sg = (SequenceGroup) en.nextElement();\r
os.println("Group " + (i++) + " begins at column "\r
+ sg.getStartRes() + " and ends at " + sg.getEndRes());\r
}\r
--- /dev/null
+package jalview.datamodel;
+
+public interface AnnotatedCollectionI extends SequenceCollectionI
+{
+
+ /**
+ * TODO: decide if null is a valid response if there is no annotation on the object
+ * @return null
+ */
+ AlignmentAnnotation[] getAlignmentAnnotation();
+
+ Iterable<AlignmentAnnotation> findAnnotation(String calcId);
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public String description = ""; // currently used as mouse over
/** DOCUMENT ME!! */
- public char secondaryStructure = ' '; // recognises H and E
+ public char secondaryStructure = ' '; // recognises H, E and S(?)
/** DOCUMENT ME!! */
public float value;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* PFAM ID\r
*/\r
public static String PFAM = "PFAM";\r
+ \r
+ /**\r
+ * RFAM ID\r
+ */\r
+ public static String RFAM = "RFAM";\r
\r
/**\r
* GeneDB ID\r
{ PDB };\r
\r
public static final String[] DOMAINDBS =\r
- { PFAM };\r
+ { PFAM, RFAM };\r
\r
/**\r
* set of unique DBRefSource property constants. These could be used to\r
public static final Object DNACODINGSEQDB = "XONCODING";\r
\r
/**\r
- * DB returns several sequences associated with a protein domain\r
+ * DB returns several sequences associated with a protein/nucleotide domain\r
*/\r
public static final Object DOMAINDB = "DOMAIN";\r
\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.datamodel;
alignment.deleteSequence(sequence);
}
- public Vector showAll(Hashtable hiddenReps)
+ public Vector showAll(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
Vector revealedSeqs = new Vector();
for (int i = 0; i < hiddenSequences.length; i++)
{
if (hiddenSequences[i] != null)
{
- Vector tmp = showSequence(i, hiddenReps);
+ Vector tmp = showSequence(i, hiddenRepSequences);
for (int t = 0; t < tmp.size(); t++)
{
revealedSeqs.addElement(tmp.elementAt(t));
return revealedSeqs;
}
- public Vector showSequence(int alignmentIndex, Hashtable hiddenReps)
+ public Vector showSequence(int alignmentIndex,
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
{
Vector revealedSeqs = new Vector();
SequenceI repSequence = alignment.getSequenceAt(alignmentIndex);
- if (repSequence != null && hiddenReps != null
- && hiddenReps.containsKey(repSequence))
+ if (repSequence != null && hiddenRepSequences != null
+ && hiddenRepSequences.containsKey(repSequence))
{
- hiddenReps.remove(repSequence);
+ hiddenRepSequences.remove(repSequence);
revealedSeqs.addElement(repSequence);
}
end = hiddenSequences.length - 1;
}
- for (int index = end; index > start; index--)
+ List<SequenceI> asequences;
+ synchronized (asequences = alignment.getSequences())
{
- SequenceI seq = hiddenSequences[index];
- hiddenSequences[index] = null;
-
- if (seq != null)
+ for (int index = end; index > start; index--)
{
- if (seq.getLength() > 0)
- {
- revealedSeqs.addElement(seq);
- alignment.getSequences().insertElementAt(seq, alignmentIndex);
- }
- else
+ SequenceI seq = hiddenSequences[index];
+ hiddenSequences[index] = null;
+
+ if (seq != null)
{
- System.out.println(seq.getName()
- + " has been deleted whilst hidden");
+ if (seq.getLength() > 0)
+ {
+ revealedSeqs.addElement(seq);
+ asequences.add(alignmentIndex, seq);
+ }
+ else
+ {
+ System.out.println(seq.getName()
+ + " has been deleted whilst hidden");
+ }
}
- }
+ }
}
return revealedSeqs;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.datamodel;
-import java.util.*;
+import jalview.analysis.AlignSeq;
-import jalview.analysis.*;
+import java.util.Enumeration;
+import java.util.Vector;
/**
*
* to the residues of this sequence
*/
Vector annotation;
+
+ /**
+ * The index of the sequence in a MSA
+ */
+ int index = -1;
/** array of seuqence features - may not be null for a valid sequence object */
public SequenceFeature[] sequenceFeatures;
{
this.annotation = new Vector();
}
-
- this.annotation.addElement(annotation);
+ if (!this.annotation.contains(annotation))
+ {
+ this.annotation.addElement(annotation);
+ }
annotation.setSequenceRef(this);
}
}
}
+ /**
+ * @return The index (zero-based) on this sequence in the MSA.
+ * It returns {@code -1} if this information is not available.
+ */
+ public int getIndex() { return index; }
+
+ /**
+ * Defines the position of this sequence in the MSA.
+ * Use the value {@code -1} if this information is undefined.
+ *
+ * @param The position for this sequence. This value is zero-based (zero for this first sequence)
+ */
+ public void setIndex(int value) { index = value; }
}
--- /dev/null
+package jalview.datamodel;
+
+import java.util.List;
+import java.util.Map;
+
+public interface SequenceCollectionI
+{
+ List<SequenceI> getSequences();
+ List<SequenceI> getSequences(Map<SequenceI,SequenceCollectionI> hiddenReps);
+ int getWidth();
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public Hashtable otherDetails;
public java.util.Vector links;
-
+
// Feature group can be set from a features file
// as a group of features between STARTGROUP and ENDGROUP markers
public String featureGroup;
}
}
}
-
+
public SequenceFeature(String type, String desc, String status,
int begin, int end, String featureGroup)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
package jalview.datamodel;
import java.util.*;
+import java.util.List;
import java.awt.*;
* @author $author$
* @version $Revision$
*/
-public class SequenceGroup
+public class SequenceGroup implements AnnotatedCollectionI
{
String groupName;
/**
* group members
*/
- private Vector sequences = new Vector();
+ private Vector<SequenceI> sequences = new Vector<SequenceI>();
/**
* representative sequence for this group (if any)
* consensus calculation property
*/
private boolean showSequenceLogo = false;
+ /**
+ * flag indicating if logo should be rendered normalised
+ */
+ private boolean normaliseSequenceLogo;
+
/**
* @return the includeAllConsSymbols
if (seqsel != null)
{
sequences = new Vector();
- Enumeration sq = seqsel.sequences.elements();
+ Enumeration<SequenceI> sq = seqsel.sequences.elements();
while (sq.hasMoreElements())
{
sequences.addElement(sq.nextElement());
return eres;
}
-
- public Vector getSequences(Hashtable hiddenReps)
+ public List<SequenceI> getSequences()
+ {
+ return sequences;
+ }
+ public List<SequenceI> getSequences(Map<SequenceI, SequenceCollectionI> hiddenReps)
{
if (hiddenReps == null)
{
else
{
Vector allSequences = new Vector();
- SequenceI seq, seq2;
+ SequenceI seq;
for (int i = 0; i < sequences.size(); i++)
{
seq = (SequenceI) sequences.elementAt(i);
allSequences.addElement(seq);
if (hiddenReps.containsKey(seq))
{
- SequenceGroup hsg = (SequenceGroup) hiddenReps.get(seq);
- for (int h = 0; h < hsg.getSize(); h++)
+ SequenceCollectionI hsg = hiddenReps.get(seq);
+ for (SequenceI seq2:hsg.getSequences())
{
- seq2 = hsg.getSequenceAt(h);
if (seq2 != seq && !allSequences.contains(seq2))
{
allSequences.addElement(seq2);
}
}
- public SequenceI[] getSequencesAsArray(Hashtable hiddenReps)
+ public SequenceI[] getSequencesAsArray(Map<SequenceI, SequenceCollectionI> map)
{
- Vector tmp = getSequences(hiddenReps);
- if (tmp == null)
+ List<SequenceI> tmp = getSequences(map);
+ if (tmp==null)
{
return null;
}
- SequenceI[] result = new SequenceI[tmp.size()];
- for (int i = 0; i < result.length; i++)
- {
- result[i] = (SequenceI) tmp.elementAt(i);
- }
-
- return result;
+ return tmp.toArray(new SequenceI[tmp.size()]);
}
/**
{
return;
}
-
+ if (cs!=null)
+ {
+ cs.alignmentChanged(this,null);
+ }
try
{
Hashtable cnsns[] = AAFrequency.calculate(sequences, startRes,
if (cs != null)
{
cs.setConsensus(cnsns);
-
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(sequences, getWidth());
- }
+ cs.alignmentChanged(this,null);
}
if ((conservation != null)
if (cs.conservationApplied())
{
cs.setConservation(c);
-
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(sequences,
- getWidth());
- }
+ cs.alignmentChanged(this,null);
}
}
}
*
* @param alignment
* (may not be null)
- * @param hashtable
+ * @param map
* (may be null)
* @return new group containing sequences common to this group and alignment
*/
- public SequenceGroup intersect(AlignmentI alignment, Hashtable hashtable)
+ public SequenceGroup intersect(AlignmentI alignment, Map<SequenceI, SequenceCollectionI> map)
{
SequenceGroup sgroup = new SequenceGroup(this);
SequenceI[] insect = getSequencesInOrder(alignment);
sgroup.sequences = new Vector();
for (int s = 0; insect != null && s < insect.length; s++)
{
- if (hashtable == null || hashtable.containsKey(insect[s]))
+ if (map == null || map.containsKey(insect[s]))
{
sgroup.sequences.addElement(insect[s]);
}
{
return showConsensusHistogram;
}
+
+ /**
+ * set flag indicating if logo should be normalised when rendered
+ * @param norm
+ */
+ public void setNormaliseSequenceLogo(boolean norm)
+ {
+ normaliseSequenceLogo=norm;
+ }
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+ @Override
+ /**
+ * returns a new array with all annotation involving this group
+ */
+ public AlignmentAnnotation[] getAlignmentAnnotation()
+ {
+ // TODO add in other methods like 'getAlignmentAnnotation(String label), etc'
+ ArrayList<AlignmentAnnotation> annot = new ArrayList<AlignmentAnnotation>();
+ for (SequenceI seq:(Vector<SequenceI>)sequences)
+ {
+ for (AlignmentAnnotation al: seq.getAnnotation())
+ {
+ if (al.groupRef==this)
+ {
+ annot.add(al);
+ }
+ }
+ }
+ if (consensus!=null)
+ {
+ annot.add(consensus);
+ }
+ if (conservation!=null)
+ {
+ annot.add(conservation);
+ }
+ return annot.toArray(new AlignmentAnnotation[0]);
+ }
+ @Override
+ public Iterable<AlignmentAnnotation> findAnnotation(String calcId)
+ {
+ ArrayList<AlignmentAnnotation> aa=new ArrayList<AlignmentAnnotation>();
+ for (AlignmentAnnotation a:getAlignmentAnnotation())
+ {
+ if (a.getCalcId()==calcId)
+ {
+ aa.add(a);
+ }
+ }
+ return aa;
+ }
+
+ public void clear()
+ {
+ sequences.clear();
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.datamodel;
-import java.util.*;
+import java.util.Vector;
/**
* DOCUMENT ME!
* null or mapping from entry's numbering to local start/end
*/
public void transferAnnotation(SequenceI entry, Mapping mp);
+
+ /**
+ * @param index The sequence index in the MSA
+ */
+ public void setIndex(int index);
+
+ /**
+ * @return The index of the sequence in the alignment
+ */
+ public int getIndex();
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
{\r
StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
-\r
+ // RACE CONDITION - getMapping only returns Jmol loaded filenames once Jmol callback has completed. \r
if (mapping == null || mapping.length < 1)\r
continue;\r
\r
String mset[] = new String[viewer.getModelCount()];\r
_modelFileNameMap = new int[mset.length];\r
int j = 1;\r
- mset[0] = viewer.getModelFileName(0);\r
+ String m=viewer.getModelFileName(0);\r
+ if (m!=null)\r
+ {\r
+ mset[0] = new File(m).getAbsolutePath();\r
+ }\r
for (int i = 1; i < mset.length; i++)\r
{\r
- mset[j] = viewer.getModelFileName(i);\r
+ m=viewer.getModelFileName(i);\r
+ if (m!=null) {\r
+ mset[j] = new File(m).getAbsolutePath();\r
+ }\r
_modelFileNameMap[j] = i; // record the model index for the filename\r
// skip any additional models in the same file (NMR structures)\r
if ((mset[j] == null ? mset[j] != mset[j - 1]\r
try\r
{\r
// recover PDB filename for the model hovered over.\r
- pdbfilename = viewer\r
- .getModelFileName(new Integer(mdlId).intValue() - 1);\r
+ int _mp=_modelFileNameMap.length-1,\r
+ mnumber=new Integer(mdlId).intValue() - 1;\r
+ while(mnumber<_modelFileNameMap[_mp])\r
+ {\r
+ _mp--;\r
+ }\r
+ pdbfilename = modelFileNames[_mp];\r
+ if (pdbfilename==null) {pdbfilename=new File(viewer\r
+ .getModelFileName(mnumber)).getAbsolutePath();\r
+ }\r
+ \r
} catch (Exception e)\r
{\r
}\r
}\r
else\r
{\r
- if (matches = pdbentry[pe].getFile().equals(fileName))\r
+ File fl;\r
+ if (matches = (fl=new File(pdbentry[pe].getFile())).equals(new File(fileName)))\r
{\r
foundEntry = true;\r
// TODO: Jmol can in principle retrieve from CLASSLOADER but\r
String protocol = AppletFormatAdapter.URL;\r
try\r
{\r
- File fl = new java.io.File(pdbentry[pe].getFile());\r
if (fl.exists())\r
{\r
protocol = AppletFormatAdapter.FILE;\r
} catch (Error e)\r
{\r
}\r
- ;\r
+ //Explicitly map to the filename used by Jmol ;\r
pdb = ssm.setMapping(sequence[pe], chains[pe],\r
- pdbentry[pe].getFile(), protocol);\r
+ fileName, protocol);\r
+ //pdbentry[pe].getFile(), protocol);\r
\r
}\r
}\r
{\r
String chid = new String(pdb.id + ":"\r
+ ((MCview.PDBChain) pdb.chains.elementAt(i)).id);\r
- chainFile.put(chid, pdbentry[pe].getFile());\r
+ chainFile.put(chid, fileName);\r
chainNames.addElement(chid);\r
}\r
notifyLoaded = true;\r
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package jalview.ext.varna;\r
+\r
+import java.io.File;\r
+\r
+import java.net.URL;\r
+import java.util.*;\r
+import java.applet.Applet;\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.JPanel;\r
+\r
+import jalview.api.AlignmentViewPanel;\r
+import jalview.api.FeatureRenderer;\r
+import jalview.api.SequenceRenderer;\r
+import jalview.api.SequenceStructureBinding;\r
+import jalview.api.StructureSelectionManagerProvider;\r
+import jalview.datamodel.*;\r
+import jalview.structure.*;\r
+import jalview.io.*;\r
+\r
+import org.jmol.api.*;\r
+import org.jmol.adapter.smarter.SmarterJmolAdapter;\r
+\r
+import org.jmol.popup.*;\r
+import org.jmol.viewer.JmolConstants;\r
+import org.jmol.viewer.Viewer;\r
+\r
+import jalview.schemes.*;\r
+\r
+import fr.orsay.lri.varna.applications.*;\r
+\r
+\r
+public abstract class JalviewVarnaBinding implements StructureListener, SequenceStructureBinding,\r
+ ComponentListener, StructureSelectionManagerProvider\r
+\r
+{\r
+ \r
+}\r
--- /dev/null
+/**\r
+ * \r
+ */\r
+package jalview.ext.varna;\r
+\r
+import jalview.api.FeatureRenderer;\r
+import jalview.api.SequenceRenderer;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.structure.StructureMapping;\r
+import jalview.structure.StructureSelectionManager;\r
+import jalview.util.Comparison;\r
+\r
+import java.awt.Color;\r
+import java.util.ArrayList;\r
+\r
+/**\r
+ * Routines for generating Jmol commands for Jalview/Jmol binding\r
+ * another cruisecontrol test.\r
+ * \r
+ * @author JimP\r
+ *\r
+ */\r
+public class VarnaCommands\r
+{\r
+\r
+ /**\r
+ * Jmol utility which constructs the commands to colour chains by the given alignment\r
+ * \r
+ */\r
+ public static String[] getColourBySequenceCommand(StructureSelectionManager ssm, String[] files, SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment)\r
+ {\r
+ ArrayList<String> str = new ArrayList<String>();\r
+ StringBuffer command = new StringBuffer();\r
+ \r
+ for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)\r
+ {\r
+ StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);\r
+ \r
+ if (mapping == null || mapping.length < 1)\r
+ continue;\r
+ \r
+ int lastPos = -1;\r
+ for (int s = 0; s < sequence[pdbfnum].length; s++)\r
+ {\r
+ for (int sp, m = 0; m < mapping.length; m++)\r
+ {\r
+ if (mapping[m].getSequence() == sequence[pdbfnum][s]\r
+ && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1)\r
+ {\r
+ SequenceI asp = alignment.getSequenceAt(sp);\r
+ for (int r = 0; r < asp.getLength(); r++)\r
+ {\r
+ // no mapping to gaps in sequence\r
+ if (jalview.util.Comparison.isGap(asp.getCharAt(r)))\r
+ {\r
+ continue;\r
+ }\r
+ int pos = mapping[m].getPDBResNum(asp.findPosition(r));\r
+ \r
+ if (pos < 1 || pos == lastPos)\r
+ continue;\r
+ \r
+ lastPos = pos;\r
+ \r
+ Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r);\r
+ \r
+ if (fr != null)\r
+ col = fr.findFeatureColour(col, sequence[pdbfnum][s], r);\r
+ String newSelcom = (mapping[m].getChain() != " " ? ":"\r
+ + mapping[m].getChain() : "")\r
+ + "/"\r
+ + (pdbfnum + 1)\r
+ + ".1"\r
+ + ";color["\r
+ + col.getRed()\r
+ + ","\r
+ + col.getGreen()\r
+ + ","\r
+ + col.getBlue() + "]";\r
+ if (command.length()>newSelcom.length() && command.substring(command.length()-newSelcom.length()).equals(newSelcom))\r
+ {\r
+ command = VarnaCommands.condenseCommand(command, pos);\r
+ continue;\r
+ }\r
+ // TODO: deal with case when buffer is too large for Jmol to parse\r
+ // - execute command and flush\r
+ \r
+ command.append(";");\r
+ if (command.length()>51200)\r
+ {\r
+ // add another chunk\r
+ str.add(command.toString());\r
+ command.setLength(0);\r
+ }\r
+ command.append("select " + pos);\r
+ command.append(newSelcom);\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ {\r
+ // add final chunk\r
+ str.add(command.toString());\r
+ command.setLength(0);\r
+ }\r
+ return str.toArray(new String[str.size()]);\r
+ }\r
+\r
+ public static StringBuffer condenseCommand(StringBuffer command, int pos)\r
+ {\r
+ \r
+ // work back to last 'select'\r
+ int p=command.length(),q=p;\r
+ do {\r
+ p-=6;\r
+ if (p<1) { p=0; };\r
+ } while ((q=command.indexOf("select",p))==-1 && p>0);\r
+ \r
+ StringBuffer sb = new StringBuffer(command.substring(0,q+7));\r
+ \r
+ command = command.delete(0,q+7);\r
+ \r
+ String start;\r
+ \r
+ if (command.indexOf("-") > -1)\r
+ {\r
+ start = command.substring(0, command.indexOf("-"));\r
+ }\r
+ else\r
+ {\r
+ start = command.substring(0, command.indexOf(":"));\r
+ }\r
+ \r
+ sb.append(start + "-" + pos + command.substring(command.indexOf(":")));\r
+ \r
+ return sb;\r
+ }\r
+\r
+}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import jalview.io.JalviewFileView;
import jalview.io.JnetAnnotationMaker;
import jalview.io.NewickFile;
+import jalview.io.TCoffeeScoreFile;
import jalview.jbgui.GAlignFrame;
import jalview.schemes.Blosum62ColourScheme;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.HydrophobicColourScheme;
import jalview.schemes.NucleotideColourScheme;
import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAHelicesColourChooser;
import jalview.schemes.ResidueProperties;
import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TCoffeeColourScheme;
import jalview.schemes.TaylorColourScheme;
import jalview.schemes.TurnColourScheme;
import jalview.schemes.UserColourScheme;
import jalview.schemes.ZappoColourScheme;
-import jalview.ws.WSMenuEntryProviderI;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
import javax.swing.JButton;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
/**
* Creates a new AlignFrame object with specific width and height.
- *
+ *
* @param al
* @param width
* @param height
/**
* Creates a new AlignFrame object with specific width, height and
* sequenceSetId
- *
+ *
* @param al
* @param width
* @param height
/**
* Creates a new AlignFrame object with specific width, height and
* sequenceSetId
- *
+ *
* @param al
* @param width
* @param height
/**
* new alignment window with hidden columns
- *
+ *
* @param al
* AlignmentI
* @param hiddenColumns
/**
* Create alignment frame for al with hiddenColumns, a specific width and
* height, and specific sequenceId
- *
+ *
* @param al
* @param hiddenColumns
* @param width
/**
* Create alignment frame for al with hiddenColumns, a specific width and
* height, and specific sequenceId
- *
+ *
* @param al
* @param hiddenColumns
* @param width
/**
* Make a new AlignFrame from exisiting alignmentPanels
- *
+ *
* @param ap
* AlignmentPanel
* @param av
*/
void init()
{
- if (viewport.conservation == null)
+ if (viewport.getAlignmentConservationAnnotation() == null)
{
BLOSUM62Colour.setEnabled(false);
conservationMenuItem.setEnabled(false);
{
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
addServiceListeners();
- setGUINucleotide(viewport.alignment.isNucleotide());
+ setGUINucleotide(viewport.getAlignment().isNucleotide());
}
setMenusFromViewport(viewport);
/**
* Change the filename and format for the alignment, and enable the 'reload'
* button functionality.
- *
+ *
* @param file
* valid filename
* @param format
{
addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
if (viewport.cursorMode
}
break;
+ // case KeyEvent.VK_A:
+ // if (viewport.cursorMode)
+ // {
+ // alignPanel.seqPanel.insertNucAtCursor(false,"A");
+ // //System.out.println("A");
+ // }
+ // break;
+ /*
+ * case KeyEvent.VK_CLOSE_BRACKET: if (viewport.cursorMode) {
+ * System.out.println("closing bracket"); } break;
+ */
case KeyEvent.VK_DELETE:
case KeyEvent.VK_BACK_SPACE:
if (!viewport.cursorMode)
}
}
+ @Override
public void keyReleased(KeyEvent evt)
{
switch (evt.getKeyCode())
if (newPanel)
{
- if (ap.av.padGaps)
+ if (ap.av.isPadGaps())
{
- ap.av.alignment.padGaps();
+ ap.av.getAlignment().padGaps();
}
ap.av.updateConservation(ap);
ap.av.updateConsensus(ap);
+ ap.av.updateStrucConsensus(ap);
}
}
Desktop.instance.addJalviewPropertyChangeListener("services",
thisListener = new java.beans.PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
// // System.out.println("Discoverer property change.");
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
System.err
});
addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
{
+ @Override
public void internalFrameClosed(
javax.swing.event.InternalFrameEvent evt)
{
// Finally, build the menu once to get current service state
new Thread(new Runnable()
{
+ @Override
public void run()
{
BuildWebServiceMenu();
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
+ rnahelicesColour.setEnabled(nucleotide);
+ purinePyrimidineColour.setEnabled(nucleotide);
// Remember AlignFrame always starts as protein
- if (!nucleotide)
- {
- calculateMenu.remove(calculateMenu.getItemCount() - 2);
- }
+ // if (!nucleotide)
+ // {
+ // showTr
+ // calculateMenu.remove(calculateMenu.getItemCount() - 2);
+ // }
}
/**
/**
* Need to call this method when tabs are selected for multiple views, or when
* loading from Jalview2XML.java
- *
+ *
* @param av
* AlignViewport
*/
void setMenusFromViewport(AlignViewport av)
{
- padGapsMenuitem.setSelected(av.padGaps);
+ padGapsMenuitem.setSelected(av.isPadGaps());
colourTextMenuItem.setSelected(av.showColourText);
abovePIDThreshold.setSelected(av.getAbovePIDThreshold());
conservationMenuItem.setSelected(av.getConservationSelected());
annotationPanelMenuItem.setState(av.showAnnotation);
viewBoxesMenuItem.setSelected(av.showBoxes);
viewTextMenuItem.setSelected(av.showText);
- showNonconservedMenuItem.setSelected(av.showUnconserved);
- showGroupConsensus.setSelected(av.showGroupConsensus);
- showGroupConservation.setSelected(av.showGroupConservation);
- showConsensusHistogram.setSelected(av.showConsensusHistogram);
- showSequenceLogo.setSelected(av.showSequenceLogo);
+ showNonconservedMenuItem.setSelected(av.getShowUnconserved());
+ showGroupConsensus.setSelected(av.isShowGroupConsensus());
+ showGroupConservation.setSelected(av.isShowGroupConservation());
+ showConsensusHistogram.setSelected(av.isShowConsensusHistogram());
+ showSequenceLogo.setSelected(av.isShowSequenceLogo());
+ normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo());
+
setColourSelected(ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
showSeqFeatures.setSelected(av.showSequenceFeatures);
hiddenMarkers.setState(av.showHiddenMarkers);
- applyToAllGroups.setState(av.colourAppliesToAllGroups);
+ applyToAllGroups.setState(av.getColourAppliesToAllGroups());
showNpFeatsMenuitem.setSelected(av.isShowNpFeats());
showDbRefsMenuitem.setSelected(av.isShowDbRefs());
autoCalculate.setSelected(av.autoCalculateConsensus);
sortByTree.setSelected(av.sortByTree);
listenToViewSelections.setSelected(av.followSelection);
-
+ rnahelicesColour.setEnabled(av.getAlignment().hasRNAStructure());
+ rnahelicesColour
+ .setSelected(av.getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour);
setShowProductsEnabled();
updateEditMenuBar();
/*
* (non-Javadoc)
- *
+ *
* @see jalview.gui.IProgressIndicator#setProgressBar(java.lang.String, long)
*/
+ @Override
public void setProgressBar(String message, long id)
{
if (progressBars == null)
validate();
}
+ @Override
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
cancel.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
handler.cancelActivity(id);
}
/**
- *
+ *
* @return true if any progress bars are still active
*/
public boolean operationInProgress()
return alignPanel.seqPanel.seqCanvas.getFeatureRenderer();
}
+ @Override
public void fetchSequence_actionPerformed(ActionEvent e)
{
new SequenceFetcher(this);
}
+ @Override
public void addFromFile_actionPerformed(ActionEvent e)
{
Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport);
}
+ @Override
public void reload_actionPerformed(ActionEvent e)
{
if (fileName != null)
{
+ // TODO: JAL-1108 - ensure all associated frames are closed regardless of
+ // originating file's format
// TODO: work out how to recover feature settings for correct view(s) when
// file is reloaded.
if (currentFileFormat.equals("Jalview"))
final FeatureSettings nfs = newframe.featureSettings;
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
nfs.frame.setBounds(fspos);
}
}
+ @Override
public void addFromText_actionPerformed(ActionEvent e)
{
Desktop.instance.inputTextboxMenuItem_actionPerformed(viewport);
}
+ @Override
public void addFromURL_actionPerformed(ActionEvent e)
{
Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
}
+ @Override
public void save_actionPerformed(ActionEvent e)
{
if (fileName == null
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void saveAs_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
int reply = JOptionPane
.showInternalConfirmDialog(
}
}
FormatAdapter f = new FormatAdapter();
- String output = f.formatSequences(format,
- (Alignment) viewport.alignment, // class cast exceptions will
+ String output = f.formatSequences(
+ format,
+ viewport.getAlignment(), // class cast exceptions will
// occur in the distant future
- omitHidden, f.getCacheSuffixDefault(format), viewport.colSel);
+ omitHidden, f.getCacheSuffixDefault(format),
+ viewport.getColumnSelection());
if (output == null)
{
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void outputText_actionPerformed(ActionEvent e)
{
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
int reply = JOptionPane
.showInternalConfirmDialog(
try
{
cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(),
- viewport.alignment, omitHidden, viewport.colSel));
+ viewport.getAlignment(), omitHidden,
+ viewport.getColumnSelection()));
Desktop.addInternalFrame(cap,
"Alignment output - " + e.getActionCommand(), 600, 500);
} catch (OutOfMemoryError oom)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
new HTMLOutput(alignPanel,
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void createPNG(File f)
{
alignPanel.makePNG(f);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void createEPS(File f)
{
alignPanel.makeEPS(f);
}
+ @Override
public void pageSetup_actionPerformed(ActionEvent e)
{
PrinterJob printJob = PrinterJob.getPrinterJob();
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void printMenuItem_actionPerformed(ActionEvent e)
{
// Putting in a thread avoids Swing painting problems
thread.start();
}
+ @Override
public void exportFeatures_actionPerformed(ActionEvent e)
{
new AnnotationExporter().exportFeatures(alignPanel);
}
+ @Override
public void exportAnnotations_actionPerformed(ActionEvent e)
{
- new AnnotationExporter().exportAnnotations(
- alignPanel,
- viewport.showAnnotation ? viewport.alignment
- .getAlignmentAnnotation() : null, viewport.alignment
- .getGroups(),
- ((Alignment) viewport.alignment).alignmentProperties);
+ new AnnotationExporter().exportAnnotations(alignPanel,
+ viewport.showAnnotation ? viewport.getAlignment()
+ .getAlignmentAnnotation() : null, viewport
+ .getAlignment().getGroups(), ((Alignment) viewport
+ .getAlignment()).alignmentProperties);
}
+ @Override
public void associatedData_actionPerformed(ActionEvent e)
{
// Pick the tree file
/**
* Close the current view or all views in the alignment frame. If the frame
* only contains one view then the alignment will be removed from memory.
- *
+ *
* @param closeAllTabs
*/
+ @Override
public void closeMenuItem_actionPerformed(boolean closeAllTabs)
{
if (alignPanels != null && alignPanels.size() < 2)
/**
* close alignPanel2 and shuffle tabs appropriately.
- *
+ *
* @param alignPanel2
*/
public void closeView(AlignmentPanel alignPanel2)
viewport.historyList.push(command);
viewport.redoList.clear();
updateEditMenuBar();
- viewport.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
+ viewport.updateHiddenColumns();
+ // viewport.hasHiddenColumns = (viewport.getColumnSelection() != null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
}
}
/**
- *
+ *
* @return alignment objects for all views
*/
AlignmentI[] getViewAlignments()
if (viewport != null)
{
return new AlignmentI[]
- { viewport.alignment };
+ { viewport.getAlignment() };
}
return null;
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void undoMenuItem_actionPerformed(ActionEvent e)
{
if (viewport.historyList.empty())
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for undo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void redoMenuItem_actionPerformed(ActionEvent e)
{
if (viewport.redoList.size() < 1)
if (originalSource != null)
{
- originalSource.hasHiddenColumns = (viewport.colSel != null
- && viewport.colSel.getHiddenColumns() != null && viewport.colSel
- .getHiddenColumns().size() > 0);
- originalSource.firePropertyChange("alignment", null,
- originalSource.alignment.getSequences());
+
+ if (originalSource != viewport)
+ {
+ Cache.log
+ .warn("Implementation worry: mismatch of viewport origin for redo");
+ }
+ originalSource.updateHiddenColumns();
+ // originalSource.hasHiddenColumns = (viewport.getColumnSelection() !=
+ // null
+ // && viewport.getColumnSelection().getHiddenColumns() != null &&
+ // viewport.getColumnSelection()
+ // .getHiddenColumns().size() > 0);
+ originalSource.firePropertyChange("alignment", null, originalSource
+ .getAlignment().getSequences());
}
}
{
if (comps.elementAt(i) instanceof AlignmentPanel)
{
- if (al == ((AlignmentPanel) comps.elementAt(i)).av.alignment)
+ if (al == ((AlignmentPanel) comps.elementAt(i)).av.getAlignment())
{
originalSource = ((AlignmentPanel) comps.elementAt(i)).av;
break;
// the current view against the closed view first
if (al != null)
{
- PaintRefresher.validateSequences(al, viewport.alignment);
+ PaintRefresher.validateSequences(al, viewport.getAlignment());
}
originalSource = viewport;
/**
* DOCUMENT ME!
- *
+ *
* @param up
* DOCUMENT ME!
*/
{
return;
}
-
- if (up)
- {
- for (int i = 1; i < viewport.alignment.getHeight(); i++)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
-
- if (!sg.getSequences(null).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
-
- if (sg.getSequences(null).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i - 1);
- }
- }
- else
- {
- for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
- {
- SequenceI seq = viewport.alignment.getSequenceAt(i);
-
- if (!sg.getSequences(null).contains(seq))
- {
- continue;
- }
-
- SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
-
- if (sg.getSequences(null).contains(temp))
- {
- continue;
- }
-
- viewport.alignment.getSequences().setElementAt(temp, i);
- viewport.alignment.getSequences().setElementAt(seq, i + 1);
- }
- }
-
+ viewport.getAlignment().moveSelectedSequencesByOne(sg, viewport.getHiddenRepSequences(), up);
alignPanel.paintAlignment(true);
}
synchronized void slideSequences(boolean right, int size)
{
- Vector sg = new Vector();
+ List<SequenceI> sg = new Vector();
if (viewport.cursorMode)
{
- sg.addElement(viewport.alignment
- .getSequenceAt(alignPanel.seqPanel.seqCanvas.cursorY));
+ sg.add(viewport.getAlignment().getSequenceAt(
+ alignPanel.seqPanel.seqCanvas.cursorY));
}
else if (viewport.getSelectionGroup() != null
- && viewport.getSelectionGroup().getSize() != viewport.alignment
- .getHeight())
+ && viewport.getSelectionGroup().getSize() != viewport
+ .getAlignment().getHeight())
{
sg = viewport.getSelectionGroup().getSequences(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
if (sg.size() < 1)
Vector invertGroup = new Vector();
- for (int i = 0; i < viewport.alignment.getHeight(); i++)
+ for (int i = 0; i < viewport.getAlignment().getHeight(); i++)
{
- if (!sg.contains(viewport.alignment.getSequenceAt(i)))
- invertGroup.add(viewport.alignment.getSequenceAt(i));
+ if (!sg.contains(viewport.getAlignment().getSequenceAt(i)))
+ invertGroup.add(viewport.getAlignment().getSequenceAt(i));
}
- SequenceI[] seqs1 = new SequenceI[sg.size()];
- for (int i = 0; i < sg.size(); i++)
- seqs1[i] = (SequenceI) sg.elementAt(i);
+ SequenceI[] seqs1 = sg.toArray(new SequenceI[0]);
SequenceI[] seqs2 = new SequenceI[invertGroup.size()];
for (int i = 0; i < invertGroup.size(); i++)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void copy_actionPerformed(ActionEvent e)
{
System.gc();
SequenceI[] seqs = viewport.getSelectionAsNewSequence();
String[] omitHidden = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
omitHidden = viewport.getViewAsString(true);
}
}
Vector hiddenColumns = null;
- if (viewport.hasHiddenColumns)
+ if (viewport.hasHiddenColumns())
{
hiddenColumns = new Vector();
int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
}
Desktop.jalviewClipboard = new Object[]
- { seqs, viewport.alignment.getDataset(), hiddenColumns };
+ { seqs, viewport.getAlignment().getDataset(), hiddenColumns };
statusBar.setText("Copied " + seqs.length + " sequences to clipboard.");
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void pasteNew_actionPerformed(ActionEvent e)
{
paste(true);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void pasteThis_actionPerformed(ActionEvent e)
{
paste(false);
/**
* Paste contents of Jalview clipboard
- *
+ *
* @param newAlignment
* true to paste to a new alignment, otherwise add to this.
*/
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void cut_actionPerformed(ActionEvent e)
{
copy_actionPerformed(null);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void delete_actionPerformed(ActionEvent evt)
{
}
// If the cut affects all sequences, remove highlighted columns
- if (sg.getSize() == viewport.alignment.getHeight())
+ if (sg.getSize() == viewport.getAlignment().getHeight())
{
viewport.getColumnSelection().removeElements(sg.getStartRes(),
sg.getEndRes() + 1);
*/
addHistoryItem(new EditCommand("Cut Sequences", EditCommand.CUT, cut,
sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
- viewport.alignment));
+ viewport.getAlignment()));
viewport.setSelectionGroup(null);
viewport.sendSelection();
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void deleteGroups_actionPerformed(ActionEvent e)
{
- viewport.alignment.deleteAllGroups();
+ viewport.getAlignment().deleteAllGroups();
viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
SequenceGroup sg = new SequenceGroup();
sg.addSequence(viewport.getAlignment().getSequenceAt(i), false);
}
- sg.setEndRes(viewport.alignment.getWidth() - 1);
+ sg.setEndRes(viewport.getAlignment().getWidth() - 1);
viewport.setSelectionGroup(sg);
viewport.sendSelection();
alignPanel.paintAlignment(true);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
{
if (viewport.cursorMode)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
{
SequenceGroup sg = viewport.getSelectionGroup();
viewport.sendSelection();
}
+ @Override
public void invertColSel_actionPerformed(ActionEvent e)
{
viewport.invertColumnSelection();
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
{
trimAlignment(true);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void remove2RightMenuItem_actionPerformed(ActionEvent e)
{
trimAlignment(false);
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
TrimRegionCommand trimRegion;
{
trimRegion = new TrimRegionCommand("Remove Left",
TrimRegionCommand.TRIM_LEFT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
viewport.setStartRes(0);
}
else
{
trimRegion = new TrimRegionCommand("Remove Right",
TrimRegionCommand.TRIM_RIGHT, seqs, column,
- viewport.alignment, viewport.colSel,
- viewport.selectionGroup);
+ viewport.getAlignment(), viewport.getColumnSelection(),
+ viewport.getSelectionGroup());
}
statusBar.setText("Removed " + trimRegion.getSize() + " columns.");
addHistoryItem(trimRegion);
- Vector groups = viewport.alignment.getGroups();
-
- for (int i = 0; i < groups.size(); i++)
+ for (SequenceGroup sg :viewport.getAlignment().getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.get(i);
-
if ((trimLeft && !sg.adjustForRemoveLeft(column))
|| (!trimLeft && !sg.adjustForRemoveRight(column)))
{
- viewport.alignment.deleteGroup(sg);
+ viewport.getAlignment().deleteGroup(sg);
}
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
RemoveGapColCommand removeGapCols = new RemoveGapColCommand(
- "Remove Gapped Columns", seqs, start, end, viewport.alignment);
+ "Remove Gapped Columns", seqs, start, end,
+ viewport.getAlignment());
addHistoryItem(removeGapCols);
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
// ShiftList shifts;
// viewport.getAlignment().removeGaps(shifts=new ShiftList());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
{
- int start = 0, end = viewport.alignment.getWidth() - 1;
+ int start = 0, end = viewport.getAlignment().getWidth() - 1;
SequenceI[] seqs;
if (viewport.getSelectionGroup() != null)
{
seqs = viewport.getSelectionGroup().getSequencesAsArray(
- viewport.hiddenRepSequences);
+ viewport.getHiddenRepSequences());
start = viewport.getSelectionGroup().getStartRes();
end = viewport.getSelectionGroup().getEndRes();
}
else
{
- seqs = viewport.alignment.getSequencesArray();
+ seqs = viewport.getAlignment().getSequencesArray();
}
// This is to maintain viewport position on first residue
// of first sequence
- SequenceI seq = viewport.alignment.getSequenceAt(0);
+ SequenceI seq = viewport.getAlignment().getSequenceAt(0);
int startRes = seq.findPosition(viewport.startRes);
addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end,
- viewport.alignment));
+ viewport.getAlignment()));
viewport.setStartRes(seq.findIndex(startRes) - 1);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void padGapsMenuitem_actionPerformed(ActionEvent e)
{
- viewport.padGaps = padGapsMenuitem.isSelected();
+ viewport.setPadGaps(padGapsMenuitem.isSelected());
viewport.firePropertyChange("alignment", null, viewport.getAlignment()
.getSequences());
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void findMenuItem_actionPerformed(ActionEvent e)
{
new Finder();
}
+ @Override
public void newView_actionPerformed(ActionEvent e)
{
newView(true);
}
/**
- *
+ *
* @param copyAnnotation
* if true then duplicate all annnotation, groups and settings
* @return new alignment panel, already displayed.
}
/**
- *
+ *
* @param viewTitle
* title of newly created view
* @return new alignment panel, already displayed.
}
/**
- *
+ *
* @param viewTitle
* title of newly created view
* @param copyAnnotation
if (!copyAnnotation)
{
// just remove all the current annotation except for the automatic stuff
- newap.av.alignment.deleteAllGroups();
- for (AlignmentAnnotation alan : newap.av.alignment
+ newap.av.getAlignment().deleteAllGroups();
+ for (AlignmentAnnotation alan : newap.av.getAlignment()
.getAlignmentAnnotation())
{
if (!alan.autoCalculated)
{
- newap.av.alignment.deleteAnnotation(alan);
+ newap.av.getAlignment().deleteAnnotation(alan);
}
;
}
return newap;
}
+ @Override
public void expandViews_actionPerformed(ActionEvent e)
{
Desktop.instance.explodeViews(this);
}
+ @Override
public void gatherViews_actionPerformed(ActionEvent e)
{
Desktop.instance.gatherViews(this);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void font_actionPerformed(ActionEvent e)
{
new FontChooser(alignPanel);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void seqLimit_actionPerformed(ActionEvent e)
{
viewport.setShowJVSuffix(seqLimits.isSelected());
alignPanel.paintAlignment(true);
}
+ @Override
public void idRightAlign_actionPerformed(ActionEvent e)
{
viewport.rightAlignIds = idRightAlign.isSelected();
alignPanel.paintAlignment(true);
}
+ @Override
public void centreColumnLabels_actionPerformed(ActionEvent e)
{
viewport.centreColumnLabels = centreColumnLabelsMenuItem.getState();
/*
* (non-Javadoc)
- *
+ *
* @see jalview.jbgui.GAlignFrame#followHighlight_actionPerformed()
*/
+ @Override
protected void followHighlight_actionPerformed()
{
if (viewport.followHighlight = this.followHighlightMenuItem.getState())
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void colourTextMenuItem_actionPerformed(ActionEvent e)
{
viewport.setColourText(colourTextMenuItem.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void wrapMenuItem_actionPerformed(ActionEvent e)
{
scaleAbove.setVisible(wrapMenuItem.isSelected());
alignPanel.setWrapAlignment(wrapMenuItem.isSelected());
}
+ @Override
public void showAllSeqs_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenSeqs();
}
+ @Override
public void showAllColumns_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenColumns();
repaint();
}
+ @Override
public void hideSelSequences_actionPerformed(ActionEvent e)
{
viewport.hideAllSelectedSeqs();
/**
* called by key handler and the hide all/show all menu items
- *
+ *
* @param toggleSeqs
* @param toggleCols
*/
// Hide everything by the current selection - this is a hack - we do the
// invert and then hide
// first check that there will be visible columns after the invert.
- if ((viewport.colSel != null && viewport.colSel.getSelected() != null && viewport.colSel
- .getSelected().size() > 0)
+ if ((viewport.getColumnSelection() != null
+ && viewport.getColumnSelection().getSelected() != null && viewport
+ .getColumnSelection().getSelected().size() > 0)
|| (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg
.getEndRes()))
{
if (toggleSeqs)
{
- if (sg != null && sg.getSize() != viewport.alignment.getHeight())
+ if (sg != null && sg.getSize() != viewport.getAlignment().getHeight())
{
hideSelSequences_actionPerformed(null);
hide = true;
}
- else if (!(toggleCols && viewport.colSel.getSelected().size() > 0))
+ else if (!(toggleCols && viewport.getColumnSelection().getSelected()
+ .size() > 0))
{
showAllSeqs_actionPerformed(null);
}
if (toggleCols)
{
- if (viewport.colSel.getSelected().size() > 0)
+ if (viewport.getColumnSelection().getSelected().size() > 0)
{
hideSelColumns_actionPerformed(null);
if (!toggleSeqs)
{
- viewport.selectionGroup = sg;
+ viewport.setSelectionGroup(sg);
}
}
else if (!hide)
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#hideAllButSelection_actionPerformed(java.awt.
* event.ActionEvent)
*/
+ @Override
public void hideAllButSelection_actionPerformed(ActionEvent e)
{
toggleHiddenRegions(false, false);
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#hideAllSelection_actionPerformed(java.awt.event
* .ActionEvent)
*/
+ @Override
public void hideAllSelection_actionPerformed(ActionEvent e)
{
SequenceGroup sg = viewport.getSelectionGroup();
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showAllhidden_actionPerformed(java.awt.event.
* ActionEvent)
*/
+ @Override
public void showAllhidden_actionPerformed(ActionEvent e)
{
viewport.showAllHiddenColumns();
alignPanel.paintAlignment(true);
}
+ @Override
public void hideSelColumns_actionPerformed(ActionEvent e)
{
viewport.hideSelectedColumns();
alignPanel.paintAlignment(true);
}
+ @Override
public void hiddenMarkers_actionPerformed(ActionEvent e)
{
viewport.setShowHiddenMarkers(hiddenMarkers.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleAbove_actionPerformed(ActionEvent e)
{
viewport.setScaleAboveWrapped(scaleAbove.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleLeft_actionPerformed(ActionEvent e)
{
viewport.setScaleLeftWrapped(scaleLeft.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void scaleRight_actionPerformed(ActionEvent e)
{
viewport.setScaleRightWrapped(scaleRight.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowBoxes(viewBoxesMenuItem.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void viewTextMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowText(viewTextMenuItem.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
{
viewport.setRenderGaps(renderGapsMenuItem.isSelected());
public FeatureSettings featureSettings;
+ @Override
public void featureSettings_actionPerformed(ActionEvent e)
{
if (featureSettings != null)
/**
* Set or clear 'Show Sequence Features'
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void showSeqFeatures_actionPerformed(ActionEvent evt)
{
viewport.setShowSequenceFeatures(showSeqFeatures.isSelected());
/**
* Set or clear 'Show Sequence Features'
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void showSeqFeaturesHeight_actionPerformed(ActionEvent evt)
{
viewport.setShowSequenceFeaturesHeight(showSeqFeaturesHeight
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());
alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());
}
+ @Override
public void alignmentProperties()
{
JEditorPane editPane = new JEditorPane("text/html", "");
editPane.setEditable(false);
- StringBuffer contents = new AlignmentProperties(viewport.alignment)
+ StringBuffer contents = new AlignmentProperties(viewport.getAlignment())
.formatAsHtml();
editPane.setText("<html>" + contents.toString() + "</html>");
JInternalFrame frame = new JInternalFrame();
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void overviewMenuItem_actionPerformed(ActionEvent e)
{
if (alignPanel.overviewPanel != null)
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
{
+ @Override
public void internalFrameClosed(
javax.swing.event.InternalFrameEvent evt)
{
alignPanel.setOverviewPanel(overview);
}
+ @Override
public void textColour_actionPerformed(ActionEvent e)
{
new TextColourChooser().chooseColour(alignPanel, null);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
changeColour(null);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void clustalColour_actionPerformed(ActionEvent e)
{
- changeColour(new ClustalxColourScheme(
- viewport.alignment.getSequences(),
- viewport.alignment.getWidth()));
+ changeColour(new ClustalxColourScheme(viewport.getAlignment(), viewport.getHiddenRepSequences()));
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void zappoColour_actionPerformed(ActionEvent e)
{
changeColour(new ZappoColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void taylorColour_actionPerformed(ActionEvent e)
{
changeColour(new TaylorColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void hydrophobicityColour_actionPerformed(ActionEvent e)
{
changeColour(new HydrophobicColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void helixColour_actionPerformed(ActionEvent e)
{
changeColour(new HelixColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void strandColour_actionPerformed(ActionEvent e)
{
changeColour(new StrandColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void turnColour_actionPerformed(ActionEvent e)
{
changeColour(new TurnColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void buriedColour_actionPerformed(ActionEvent e)
{
changeColour(new BuriedColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void nucleotideColour_actionPerformed(ActionEvent e)
{
changeColour(new NucleotideColourScheme());
}
+ @Override
+ public void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ changeColour(new PurinePyrimidineColourScheme());
+ }
+
+ /*
+ * public void covariationColour_actionPerformed(ActionEvent e) {
+ * changeColour(new
+ * CovariationColourScheme(viewport.getAlignment().getAlignmentAnnotation
+ * ()[0])); }
+ */
+ @Override
public void annotationColour_actionPerformed(ActionEvent e)
{
new AnnotationColourChooser(viewport, alignPanel);
}
+ @Override
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+ new RNAHelicesColourChooser(viewport, alignPanel);
+ }
+
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void applyToAllGroups_actionPerformed(ActionEvent e)
{
viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param cs
* DOCUMENT ME!
*/
public void changeColour(ColourSchemeI cs)
{
+ // TODO: compare with applet and pull up to model method
int threshold = 0;
if (cs != null)
if (viewport.getConservationSelected())
{
- Alignment al = (Alignment) viewport.alignment;
+ Alignment al = (Alignment) viewport.getAlignment();
Conservation c = new Conservation("All",
ResidueProperties.propHash, 3, al.getSequences(), 0,
al.getWidth() - 1);
c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
+ c.verdict(false, viewport.getConsPercGaps());
cs.setConservation(c);
cs.setConservation(null);
}
- cs.setConsensus(viewport.hconsensus);
+ cs.setConsensus(viewport.getSequenceConsensusHash());
}
viewport.setGlobalColourScheme(cs);
if (viewport.getColourAppliesToAllGroups())
{
- Vector groups = viewport.alignment.getGroups();
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
+ for (SequenceGroup sg:viewport.getAlignment().getGroups())
+ {
if (cs == null)
{
sg.cs = null;
if (cs instanceof ClustalxColourScheme)
{
- sg.cs = new ClustalxColourScheme(
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getWidth());
+ sg.cs = new ClustalxColourScheme(sg, viewport
+ .getHiddenRepSequences());
}
else if (cs instanceof UserColourScheme)
{
{
try
{
- sg.cs = (ColourSchemeI) cs.getClass().newInstance();
+ sg.cs = cs.getClass().newInstance();
} catch (Exception ex)
{
}
sg.cs.setThreshold(threshold, viewport.getIgnoreGapsConsensus());
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(viewport.hiddenRepSequences),
+ sg.getSequences(viewport.getHiddenRepSequences()),
sg.getStartRes(), sg.getEndRes() + 1));
}
else
if (viewport.getConservationSelected())
{
Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3,
- sg.getSequences(viewport.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1);
+ ResidueProperties.propHash, 3, sg.getSequences(viewport
+ .getHiddenRepSequences()), sg.getStartRes(),
+ sg.getEndRes() + 1);
c.calculate();
- c.verdict(false, viewport.ConsPercGaps);
+ c.verdict(false, viewport.getConsPercGaps());
sg.cs.setConservation(c);
}
else
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void modifyPID_actionPerformed(ActionEvent e)
{
if (viewport.getAbovePIDThreshold()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setPIDSliderSource(alignPanel,
viewport.getGlobalColourScheme(), "Background");
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void modifyConservation_actionPerformed(ActionEvent e)
{
if (viewport.getConservationSelected()
- && viewport.globalColourScheme != null)
+ && viewport.getGlobalColourScheme() != null)
{
SliderPanel.setConservationSlider(alignPanel,
- viewport.globalColourScheme, "Background");
+ viewport.getGlobalColourScheme(), "Background");
SliderPanel.showConservationSlider();
}
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void conservationMenuItem_actionPerformed(ActionEvent e)
{
viewport.setConservationSelected(conservationMenuItem.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void abovePIDThreshold_actionPerformed(ActionEvent e)
{
viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void userDefinedColour_actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("User Defined..."))
radioItem.setName("USER_DEFINED");
radioItem.addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (evt.isControlDown()
{
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
});
radioItem.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent evt)
{
userDefinedColour_actionPerformed(evt);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void PIDColour_actionPerformed(ActionEvent e)
{
changeColour(new PIDColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void BLOSUM62Colour_actionPerformed(ActionEvent e)
{
changeColour(new Blosum62ColourScheme());
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByPID(viewport.getAlignment(), viewport
.getAlignment().getSequenceAt(0), null);
addHistoryItem(new OrderCommand("Pairwise Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortIDMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByID(viewport.getAlignment());
- addHistoryItem(new OrderCommand("ID Sort", oldOrder, viewport.alignment));
+ addHistoryItem(new OrderCommand("ID Sort", oldOrder,
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortLengthMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByLength(viewport.getAlignment());
addHistoryItem(new OrderCommand("Length Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void sortGroupMenuItem_actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByGroup(viewport.getAlignment());
addHistoryItem(new OrderCommand("Group Sort", oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
{
new RedundancyPanel(alignPanel, this);
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
{
if ((viewport.getSelectionGroup() == null)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void PCAMenuItem_actionPerformed(ActionEvent e)
{
if (((viewport.getSelectionGroup() != null)
new PCAPanel(alignPanel);
}
+ @Override
public void autoCalculate_actionPerformed(ActionEvent e)
{
viewport.autoCalculateConsensus = autoCalculate.isSelected();
.getAlignment().getSequences());
}
}
+
+ @Override
public void sortByTreeOption_actionPerformed(ActionEvent e)
{
viewport.sortByTree = sortByTree.isSelected();
{
viewport.followSelection = listenToViewSelections.isSelected();
}
+
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
{
NewTreePanel("AV", "PID", "Average distance tree using PID");
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
{
NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
{
NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
/**
* DOCUMENT ME!
- *
+ *
* @param type
* DOCUMENT ME!
* @param pwType
return;
}
- int s = 0;
SequenceGroup sg = viewport.getSelectionGroup();
/* Decide if the selection is a column region */
- while (s < sg.getSize())
+ for (SequenceI _s:sg.getSequences())
{
- if (((SequenceI) sg.getSequences(null).elementAt(s++)).getLength() < sg
+ if (_s.getLength() < sg
.getEndRes())
{
JOptionPane
else
{
// are the visible sequences aligned?
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
JOptionPane
.showMessageDialog(
return;
}
- if (viewport.alignment.getHeight() < 2)
+ if (viewport.getAlignment().getHeight() < 2)
{
return;
}
/**
* DOCUMENT ME!
- *
+ *
* @param title
* DOCUMENT ME!
* @param order
sort.add(item);
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
// pointers
AlignmentSorter.sortBy(viewport.getAlignment(), order);
- addHistoryItem(new OrderCommand(order.getName(), oldOrder,
- viewport.alignment));
+ addHistoryItem(new OrderCommand(order.getName(), oldOrder, viewport
+ .getAlignment()));
alignPanel.paintAlignment(true);
}
/**
* Add a new sort by annotation score menu item
- *
+ *
* @param sort
* the menu to add the option to
* @param scoreLabel
sort.add(item);
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();
AlignmentSorter.sortByAnnotationScore(scoreLabel,
viewport.getAlignment());// ,viewport.getSelectionGroup());
addHistoryItem(new OrderCommand("Sort by " + scoreLabel, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
alignPanel.paintAlignment(true);
}
});
* search the alignment and rebuild the sort by annotation score submenu the
* last alignment annotation vector hash is stored to minimize cost of
* rebuilding in subsequence calls.
- *
+ *
*/
+ @Override
public void buildSortByAnnotationScoresMenu()
{
- if (viewport.alignment.getAlignmentAnnotation() == null)
+ if (viewport.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
- if (viewport.alignment.getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
+ if (viewport.getAlignment().getAlignmentAnnotation().hashCode() != _annotationScoreVectorHash)
{
sortByAnnotScore.removeAll();
// almost certainly a quicker way to do this - but we keep it simple
Hashtable scoreSorts = new Hashtable();
AlignmentAnnotation aann[];
- Enumeration sq = viewport.alignment.getSequences().elements();
- while (sq.hasMoreElements())
+ for (SequenceI sqa:viewport.getAlignment().getSequences())
{
- aann = ((SequenceI) sq.nextElement()).getAnnotation();
+ aann = sqa.getAnnotation();
for (int i = 0; aann != null && i < aann.length; i++)
{
if (aann[i].hasScore() && aann[i].sequenceRef != null)
sortByAnnotScore.setVisible(scoreSorts.size() > 0);
scoreSorts.clear();
- _annotationScoreVectorHash = viewport.alignment
+ _annotationScoreVectorHash = viewport.getAlignment()
.getAlignmentAnnotation().hashCode();
}
}
* call. Listeners are added to remove the menu item when the treePanel is
* closed, and adjust the tree leaf to sequence mapping when the alignment is
* modified.
- *
+ *
* @param treePanel
* Displayed tree window.
* @param title
* SortBy menu item title.
*/
+ @Override
public void buildTreeMenu()
{
sortByTreeMenu.removeAll();
final NJTree tree = ((TreePanel) treePanels.elementAt(i)).getTree();
item.addActionListener(new java.awt.event.ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
tp.sortByTree_actionPerformed(null);
addHistoryItem(tp.sortAlignmentIn(alignPanel));
-
+
}
});
if (undoname != null)
{
addHistoryItem(new OrderCommand(undoname, oldOrder,
- viewport.alignment));
+ viewport.getAlignment()));
}
alignPanel.paintAlignment(true);
return true;
/**
* Work out whether the whole set of sequences or just the selected set will
* be submitted for multiple alignment.
- *
+ *
*/
public jalview.datamodel.AlignmentView gatherSequencesForAlignment()
{
/*
* SequenceGroup seqs = viewport.getSelectionGroup(); int sz; msa = new
* SequenceI[sz = seqs.getSize(false)];
- *
+ *
* for (int i = 0; i < sz; i++) { msa[i] = (SequenceI)
* seqs.getSequenceAt(i); }
*/
{
/*
* Vector seqs = viewport.getAlignment().getSequences();
- *
+ *
* if (seqs.size() > 1) { msa = new SequenceI[seqs.size()];
- *
+ *
* for (int i = 0; i < seqs.size(); i++) { msa[i] = (SequenceI)
* seqs.elementAt(i); } }
*/
}
// limit sequences - JBPNote in future - could spawn multiple prediction
// jobs
- // TODO: viewport.alignment.isAligned is a global state - the local
+ // TODO: viewport.getAlignment().isAligned is a global state - the local
// selection may well be aligned - we preserve 2.0.8 behaviour for moment.
- if (!viewport.alignment.isAligned(false))
+ if (!viewport.getAlignment().isAligned(false))
{
seqs.setSequences(new SeqCigar[]
{ seqs.getSequences()[0] });
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
{
// Pick the tree file
}
}
+ @Override
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent e)
+ {
+ changeColour(new TCoffeeColourScheme(alignPanel.getAlignment()));
+ }
+
public TreePanel ShowNewickTree(NewickFile nf, String title)
{
return ShowNewickTree(nf, title, 600, 500, 4, 5);
/**
* Add a treeviewer for the tree extracted from a newick file object to the
* current alignment view
- *
+ *
* @param nf
* the tree
* @param title
/**
* Generates menu items and listener event actions for web service clients
- *
+ *
*/
public void BuildWebServiceMenu()
{
buildingMenu = true;
new Thread(new Runnable()
{
+ @Override
public void run()
{
try
// TODO: group services by location as well as function and/or
// introduce
// object broker mechanism.
- final Vector wsmenu = new Vector();
+ final Vector<JMenu> wsmenu = new Vector<JMenu>();
final IProgressIndicator af = me;
final JMenu msawsmenu = new JMenu("Alignment");
final JMenu secstrmenu = new JMenu(
"Secondary Structure Prediction");
- final JMenu seqsrchmenu = new JMenu(
- "Sequence Database Search");
- final JMenu analymenu = new JMenu(
- "Analysis");
- // JAL-940 - only show secondary structure prediction services from the legacy server
+ final JMenu seqsrchmenu = new JMenu("Sequence Database Search");
+ final JMenu analymenu = new JMenu("Analysis");
+ final JMenu dismenu = new JMenu("Disorder");
+ // JAL-940 - only show secondary structure prediction services from
+ // the legacy server
if (// Cache.getDefault("SHOW_JWS1_SERVICES", true)
- // &&
- Discoverer.services != null
- && (Discoverer.services.size() > 0))
+ // &&
+ Discoverer.services != null && (Discoverer.services.size() > 0))
{
// TODO: refactor to allow list of AbstractName/Handler bindings to
// be
Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS");
Vector secstrpr = (Vector) Discoverer.services
.get("SecStrPred");
- Vector seqsrch = null; // (Vector) Discoverer.services.get("SeqSearch");
+ Vector seqsrch = null; // (Vector)
+ // Discoverer.services.get("SeqSearch");
// TODO: move GUI generation code onto service implementation - so a
// client instance attaches itself to the GUI with method call like
// jalview.ws.MsaWSClient.bind(servicehandle, Desktop.instance,
}
}
- // TODO: move into separate menu builder class.
- if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
- {
- Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
- if (jws2servs != null)
- {
- if (jws2servs.hasServices())
- {
- jws2servs.attachWSMenuEntry(msawsmenu, me);
- }
- }
- }
- // Add all submenus in the order they should appear on the web services menu
+ // Add all submenus in the order they should appear on the web
+ // services menu
wsmenu.add(msawsmenu);
wsmenu.add(secstrmenu);
+ wsmenu.add(dismenu);
wsmenu.add(analymenu);
+ // final ArrayList<JMenu> submens=new ArrayList<JMenu>();
+ // submens.add(msawsmenu);
+ // submens.add(secstrmenu);
+ // submens.add(dismenu);
+ // submens.add(analymenu);
+
// No search services yet
// wsmenu.add(seqsrchmenu);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
try
{
for (int i = 0, j = wsmenu.size(); i < j; i++)
{
- webService.add((JMenu) wsmenu.get(i));
+ webService.add(wsmenu.get(i));
}
}
else
{
webService.add(me.webServiceNoServices);
}
+ // TODO: move into separate menu builder class.
+ if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
+ {
+ Jws2Discoverer jws2servs = Jws2Discoverer.getDiscoverer();
+ if (jws2servs != null)
+ {
+ if (jws2servs.hasServices())
+ {
+ jws2servs.attachWSMenuEntry(webService, me);
+ }
+ if (jws2servs.isRunning())
+ {
+ JMenuItem tm = new JMenuItem(
+ "Still discovering JABA Services");
+ tm.setEnabled(false);
+ webService.add(tm);
+ }
+ }
+ }
+
build_urlServiceMenu(me.webService);
build_fetchdbmenu(webService);
+ for (JMenu item : wsmenu)
+ {
+ if (item.getItemCount() == 0)
+ {
+ item.setEnabled(false);
+ }
+ else
+ {
+ item.setEnabled(true);
+ }
+ }
} catch (Exception e)
{
}
}
-
/**
* construct any groupURL type service menu entries.
- *
+ *
* @param webService
*/
private void build_urlServiceMenu(JMenu webService)
/*
* JMenuItem testAlView = new JMenuItem("Test AlignmentView"); final
* AlignFrame af = this; testAlView.addActionListener(new ActionListener() {
- *
+ *
* @Override public void actionPerformed(ActionEvent e) {
- * jalview.datamodel.AlignmentView.testSelectionViews(af.viewport.alignment,
- * af.viewport.colSel, af.viewport.selectionGroup); }
- *
+ * jalview.datamodel.AlignmentView
+ * .testSelectionViews(af.viewport.getAlignment(),
+ * af.viewport.getColumnSelection(), af.viewport.selectionGroup); }
+ *
* }); webService.add(testAlView);
*/
// TODO: refactor to RestClient discoverer and merge menu entries for
// rest-style services with other types of analysis/calculation service
// SHmmr test client - still being implemented.
// DEBUG - alignmentView
-
- for (jalview.ws.rest.RestClient client: jalview.ws.rest.RestClient.getRestClients()) {
- client.attachWSMenuEntry(JvSwingUtils.findOrCreateMenu(webService, client.getAction()), this);
+
+ for (jalview.ws.rest.RestClient client : jalview.ws.rest.RestClient
+ .getRestClients())
+ {
+ client.attachWSMenuEntry(
+ JvSwingUtils.findOrCreateMenu(webService, client.getAction()),
+ this);
}
if (Cache.getDefault("SHOW_ENFIN_SERVICES", true))
* public void vamsasStore_actionPerformed(ActionEvent e) { JalviewFileChooser
* chooser = new JalviewFileChooser(jalview.bin.Cache.
* getProperty("LAST_DIRECTORY"));
- *
+ *
* chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Export
* to Vamsas file"); chooser.setToolTipText("Export");
- *
+ *
* int value = chooser.showSaveDialog(this);
- *
+ *
* if (value == JalviewFileChooser.APPROVE_OPTION) {
* jalview.io.VamsasDatastore vs = new jalview.io.VamsasDatastore(viewport);
* //vs.store(chooser.getSelectedFile().getAbsolutePath() ); vs.storeJalview(
*/
/**
* prototype of an automatically enabled/disabled analysis function
- *
+ *
*/
protected void setShowProductsEnabled()
{
/**
* search selection for sequence xRef products and build the show products
* menu.
- *
+ *
* @param selection
* @param dataset
* @return true if showProducts menu should be enabled.
xtype.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
// TODO: new thread for this call with vis-delay
Runnable foo = new Runnable()
{
+ @Override
public void run()
{
final long sttime = System.currentTimeMillis();
ths.setProgressBar("Searching for sequences from " + fsrc, sttime);
try
{
- Alignment ds = ths.getViewport().alignment.getDataset(); // update
+ Alignment ds = ths.getViewport().getAlignment().getDataset(); // update
// our local
// dataset
// reference
}
}
+ @Override
public void showProducts_actionPerformed(ActionEvent e)
{
// /////////////////////////////
}
}
+ @Override
public void showTranslation_actionPerformed(ActionEvent e)
{
// /////////////////////////////
{
al = jalview.analysis.Dna.CdnaTranslate(selection, seqstring,
viewport.getViewAsVisibleContigs(true), viewport
- .getGapCharacter(), viewport.alignment
- .getAlignmentAnnotation(), viewport.alignment
+ .getGapCharacter(), viewport.getAlignment()
+ .getAlignmentAnnotation(), viewport.getAlignment()
.getWidth(), viewport.getAlignment().getDataset());
} catch (Exception ex)
{
/**
* Try to load a features file onto the alignment.
- *
+ *
* @param file
* contents or path to retrieve file
* @param type
boolean featuresFile = false;
try
{
- featuresFile = new FeaturesFile(file, type)
- .parse(viewport.alignment.getDataset(),
- alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureColours,
- false, jalview.bin.Cache.getDefault(
- "RELAXEDSEQIDMATCHING", false));
+ featuresFile = new FeaturesFile(file, type).parse(viewport
+ .getAlignment().getDataset(), alignPanel.seqPanel.seqCanvas
+ .getFeatureRenderer().featureColours, false,
+ jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false));
} catch (Exception ex)
{
ex.printStackTrace();
return featuresFile;
}
+ @Override
public void dragEnter(DropTargetDragEvent evt)
{
}
+ @Override
public void dragExit(DropTargetEvent evt)
{
}
+ @Override
public void dragOver(DropTargetDragEvent evt)
{
}
+ @Override
public void dropActionChanged(DropTargetDragEvent evt)
{
}
+ @Override
public void drop(DropTargetDropEvent evt)
{
Transferable t = evt.getTransferable();
int l = 0, c = pdbfn.indexOf(".");
while (mtch == null && c != -1)
{
- do
+ do
{
l = c;
} while ((c = pdbfn.indexOf(".", l)) > l);
// try and associate
// TODO: may want to set a standard ID naming formalism for
// associating PDB files which have no IDs.
- for (SequenceI toassoc: (SequenceI[])fm[2]) {
- PDBEntry pe = new AssociatePdbFileWithSeq()
- .associatePdbWithSeq((String) fm[0], (String) fm[1],
- toassoc, false);
- if (pe != null)
+ for (SequenceI toassoc : (SequenceI[]) fm[2])
{
- System.err
- .println("Associated file : " + ((String) fm[0])
- + " with "
- + toassoc.getDisplayId(true));
- assocfiles++;
- }
+ PDBEntry pe = new AssociatePdbFileWithSeq()
+ .associatePdbWithSeq((String) fm[0],
+ (String) fm[1], toassoc, false);
+ if (pe != null)
+ {
+ System.err.println("Associated file : "
+ + ((String) fm[0]) + " with "
+ + toassoc.getDisplayId(true));
+ assocfiles++;
+ }
}
alignPanel.paintAlignment(true);
}
* it's and Annotation file, then a JNet file, and finally a features file. If
* all are false then the user may have dropped an alignment file onto this
* AlignFrame.
- *
+ *
* @param file
* either a filename or a URL string.
*/
// try to parse as annotation.
boolean isAnnotation = (format == null || format
.equalsIgnoreCase("PFAM")) ? new AnnotationFile()
- .readAnnotationFile(viewport.alignment, file, protocol)
+ .readAnnotationFile(viewport.getAlignment(), file, protocol)
: false;
if (!isAnnotation)
{
- // try to see if its a JNet 'concise' style annotation file *before* we
- // try to parse it as a features file
- if (format == null)
+ // first see if its a T-COFFEE score file
+ TCoffeeScoreFile tcf = null;
+ try
{
- format = new IdentifyFile().Identify(file, protocol);
- }
- if (format.equalsIgnoreCase("JnetFile"))
+ tcf = new TCoffeeScoreFile(file, protocol);
+ if (tcf.isValid())
+ {
+ if (tcf.annotateAlignment(viewport.getAlignment(), true))
+ {
+ tcoffeeColour.setEnabled(true);
+ tcoffeeColour.setSelected(true);
+ changeColour(new TCoffeeColourScheme(viewport.getAlignment()));
+ isAnnotation = true;
+ statusBar
+ .setText("Successfully pasted T-Coffee scores to alignment.");
+ }
+ else
+ {
+ // some problem - if no warning its probable that the ID matching process didn't work
+ JOptionPane.showMessageDialog(Desktop.desktop,
+ tcf.getWarningMessage()==null ? "Check that the file matches sequence IDs in the alignment." : tcf.getWarningMessage(),
+ "Problem reading T-COFFEE score file",
+ JOptionPane.WARNING_MESSAGE);
+ }
+ }
+ else
+ {
+ tcf = null;
+ }
+ } catch (Exception x)
{
- jalview.io.JPredFile predictions = new jalview.io.JPredFile(file,
- protocol);
- new JnetAnnotationMaker().add_annotation(predictions,
- viewport.getAlignment(), 0, false);
- isAnnotation = true;
+ Cache.log.debug("Exception when processing data source as T-COFFEE score file",x);
+ tcf = null;
}
- else
+ if (tcf == null)
{
- /*
- * if (format.equalsIgnoreCase("PDB")) {
- *
- * String pdbfn = ""; // try to match up filename with sequence id try
- * { if (protocol == jalview.io.FormatAdapter.FILE) { File fl = new
- * File(file); pdbfn = fl.getName(); } else if (protocol ==
- * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
- * url.getFile(); } } catch (Exception e) { } ; if (assocSeq == null)
- * { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
- * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) { //
- * attempt to find a match in the alignment SequenceI mtch =
- * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
- * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) > l)
- * { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch =
- * idm.findIdMatch(pdbfn); } if (mtch != null) { // try and associate
- * // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null) {
- * System.err.println("Associated file : " + file + " with " +
- * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
- * TODO: maybe need to load as normal otherwise return; } }
- */
+ // try to see if its a JNet 'concise' style annotation file *before*
+ // we
// try to parse it as a features file
- boolean isGroupsFile = parseFeaturesFile(file, protocol);
- // if it wasn't a features file then we just treat it as a general
- // alignment file to load into the current view.
- if (!isGroupsFile)
+ if (format == null)
+ {
+ format = new IdentifyFile().Identify(file, protocol);
+ }
+ if (format.equalsIgnoreCase("JnetFile"))
{
- new FileLoader().LoadFile(viewport, file, protocol, format);
+ jalview.io.JPredFile predictions = new jalview.io.JPredFile(
+ file, protocol);
+ new JnetAnnotationMaker().add_annotation(predictions,
+ viewport.getAlignment(), 0, false);
+ isAnnotation = true;
}
else
{
- alignPanel.paintAlignment(true);
+ /*
+ * if (format.equalsIgnoreCase("PDB")) {
+ *
+ * String pdbfn = ""; // try to match up filename with sequence id
+ * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl =
+ * new File(file); pdbfn = fl.getName(); } else if (protocol ==
+ * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
+ * url.getFile(); } } catch (Exception e) { } ; if (assocSeq ==
+ * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
+ * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) {
+ * // attempt to find a match in the alignment SequenceI mtch =
+ * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
+ * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) >
+ * l) { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch
+ * = idm.findIdMatch(pdbfn); } if (mtch != null) { // try and
+ * associate // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
+ * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null)
+ * { System.err.println("Associated file : " + file + " with " +
+ * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
+ * TODO: maybe need to load as normal otherwise return; } }
+ */
+ // try to parse it as a features file
+ boolean isGroupsFile = parseFeaturesFile(file, protocol);
+ // if it wasn't a features file then we just treat it as a general
+ // alignment file to load into the current view.
+ if (!isGroupsFile)
+ {
+ new FileLoader().LoadFile(viewport, file, protocol, format);
+ }
+ else
+ {
+ alignPanel.paintAlignment(true);
+ }
}
}
}
}
}
+ @Override
public void tabSelectionChanged(int index)
{
if (index > -1)
}
}
+ @Override
public void tabbedPane_mousePressed(MouseEvent e)
{
if (SwingUtilities.isRightMouseButton(e))
/**
* Open the dialog for regex description parsing.
*/
+ @Override
protected void extractScores_actionPerformed(ActionEvent e)
{
ParseProperties pp = new jalview.analysis.ParseProperties(
- viewport.alignment);
+ viewport.getAlignment());
// TODO: verify regex and introduce GUI dialog for version 2.5
// if (pp.getScoresFromDescription("col", "score column ",
// "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)",
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showDbRefs_actionPerformed(java.awt.event.ActionEvent
* )
*/
+ @Override
protected void showDbRefs_actionPerformed(ActionEvent e)
{
viewport.setShowDbRefs(showDbRefsMenuitem.isSelected());
/*
* (non-Javadoc)
- *
+ *
* @seejalview.jbgui.GAlignFrame#showNpFeats_actionPerformed(java.awt.event.
* ActionEvent)
*/
+ @Override
protected void showNpFeats_actionPerformed(ActionEvent e)
{
viewport.setShowNpFeats(showNpFeatsMenuitem.isSelected());
/**
* find the viewport amongst the tabs in this alignment frame and close that
* tab
- *
+ *
* @param av
*/
public boolean closeView(AlignViewport av)
fetchr.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
new jalview.ws.DBRefFetcher(alignPanel.av
final AlignFrame me = this;
new Thread(new Runnable()
{
+ @Override
public void run()
{
final jalview.ws.SequenceFetcher sf = SequenceFetcher
.getSequenceFetcherSingleton(me);
- final String[] otherdb = sf.getOrderedSupportedSources();
- // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
- // jalview.util.QuickSort.sort(otherdb, otherdb);
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
-
+ String[] dbclasses = sf.getOrderedSupportedSources();
+ // sf.getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);
+ // jalview.util.QuickSort.sort(otherdb, otherdb);
+ List<DbSourceProxy> otherdb;
JMenu dfetch = new JMenu();
- JMenuItem fetchr;
- rfetch.add(dfetch);
- int comp = 0, mcomp = 15;
+ JMenu ifetch = new JMenu();
+ JMenuItem fetchr = null;
+ int comp = 0, icomp = 0, mcomp = 15;
String mname = null;
- if (otherdb != null && otherdb.length > 0)
+ int dbi = 0;
+ for (String dbclass : dbclasses)
{
- for (int i = 0; i < otherdb.length; i++)
+ otherdb = sf.getSourceProxy(dbclass);
+ // add a single entry for this class, or submenu allowing 'fetch
+ // all' or pick one
+ if (otherdb == null || otherdb.size() < 1)
{
- String dbname = sf.getSourceProxy(otherdb[i]).getDbName();
- if (mname == null)
- {
- mname = "from '" + dbname + "'";
- }
- fetchr = new JMenuItem(otherdb[i]);
- final String[] dassource = new String[]
- { otherdb[i] };
+ continue;
+ }
+ // List<DbSourceProxy> dbs=otherdb;
+ // otherdb=new ArrayList<DbSourceProxy>();
+ // for (DbSourceProxy db:dbs)
+ // {
+ // if (!db.isA(DBRefSource.ALIGNMENTDB)
+ // }
+ if (mname == null)
+ {
+ mname = "From " + dbclass;
+ }
+ if (otherdb.size() == 1)
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem(src.getDbSource());
fetchr.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
new jalview.ws.DBRefFetcher(alignPanel.av
}
});
- fetchr.setToolTipText("Retrieve from " + dbname);
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from "
+ + src.getDbName()) + "<html>");
+ dfetch.add(fetchr);
+ comp++;
+ }
+ else
+ {
+ final DbSourceProxy[] dassource = otherdb
+ .toArray(new DbSourceProxy[0]);
+ // fetch all entry
+ DbSourceProxy src = otherdb.get(0);
+ fetchr = new JMenuItem("Fetch All '" + src.getDbSource()
+ + "'");
+ fetchr.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassource)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+ });
+
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from all "
+ + otherdb.size() + " sources in "
+ + src.getDbSource() + "<br>First is :"
+ + src.getDbName()) + "<html>");
dfetch.add(fetchr);
- if (comp++ == mcomp || i == (otherdb.length - 1))
+ comp++;
+ // and then build the rest of the individual menus
+ ifetch = new JMenu("Sources from " + src.getDbSource());
+ icomp = 0;
+ String imname = null;
+ int i = 0;
+ for (DbSourceProxy sproxy : otherdb)
{
- dfetch.setText(mname + " to '" + dbname + "'");
- rfetch.add(dfetch);
- dfetch = new JMenu();
- mname = null;
- comp = 0;
+ String dbname = sproxy.getDbName();
+ String sname = dbname.length() > 5 ? dbname.substring(0,
+ 5) + "..." : dbname;
+ String msname = dbname.length() > 10 ? dbname.substring(
+ 0, 10) + "..." : dbname;
+ if (imname == null)
+ {
+ imname = "from '" + sname + "'";
+ }
+ fetchr = new JMenuItem(msname);
+ final DbSourceProxy[] dassrc =
+ { sproxy };
+ fetchr.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new Thread(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ new jalview.ws.DBRefFetcher(alignPanel.av
+ .getSequenceSelection(),
+ alignPanel.alignFrame, dassrc)
+ .fetchDBRefs(false);
+ }
+ }).start();
+ }
+
+ });
+ fetchr.setToolTipText("<html>"
+ + JvSwingUtils.wrapTooltip("Retrieve from "
+ + dbname) + "</html>");
+ ifetch.add(fetchr);
+ ++i;
+ if (++icomp >= mcomp || i == (otherdb.size()))
+ {
+ ifetch.setText(imname + " to '" + sname + "'");
+ dfetch.add(ifetch);
+ ifetch = new JMenu();
+ imname = null;
+ icomp = 0;
+ comp++;
+ }
}
}
+ ++dbi;
+ if (comp >= mcomp || dbi >= (dbclasses.length))
+ {
+ dfetch.setText(mname + " to '" + dbclass + "'");
+ rfetch.add(dfetch);
+ dfetch = new JMenu();
+ mname = null;
+ comp = 0;
+ }
}
}
});
/**
* Left justify the whole alignment.
*/
+ @Override
protected void justifyLeftMenuItem_actionPerformed(ActionEvent e)
{
AlignmentI al = viewport.getAlignment();
/**
* Right justify the whole alignment.
*/
+ @Override
protected void justifyRightMenuItem_actionPerformed(ActionEvent e)
{
AlignmentI al = viewport.getAlignment();
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showUnconservedMenuItem_actionPerformed(java.
* awt.event.ActionEvent)
*/
+ @Override
protected void showUnconservedMenuItem_actionPerformed(ActionEvent e)
{
viewport.setShowUnconserved(showNonconservedMenuItem.getState());
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showGroupConsensus_actionPerformed(java.awt.event
* .ActionEvent)
*/
+ @Override
protected void showGroupConsensus_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConsensus(showGroupConsensus.getState());
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showGroupConservation_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showGroupConservation_actionPerformed(ActionEvent e)
{
viewport.setShowGroupConservation(showGroupConservation.getState());
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showConsensusHistogram_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showConsensusHistogram_actionPerformed(ActionEvent e)
{
viewport.setShowConsensusHistogram(showConsensusHistogram.getState());
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#showConsensusProfile_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void showSequenceLogo_actionPerformed(ActionEvent e)
{
viewport.setShowSequenceLogo(showSequenceLogo.getState());
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
}
+ @Override
+ protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+ {
+ viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState());
+ alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
+ }
+
+ @Override
protected void applyAutoAnnotationSettings_actionPerformed(ActionEvent e)
{
alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());
/*
* (non-Javadoc)
- *
+ *
* @see
* jalview.jbgui.GAlignFrame#makeGrpsFromSelection_actionPerformed(java.awt
* .event.ActionEvent)
*/
+ @Override
protected void makeGrpsFromSelection_actionPerformed(ActionEvent e)
{
if (viewport.getSelectionGroup() != null)
SequenceGroup[] gps = jalview.analysis.Grouping.makeGroupsFrom(
viewport.getSequenceSelection(),
viewport.getAlignmentView(true).getSequenceStrings(
- viewport.getGapCharacter()),
- viewport.alignment.getGroups());
- viewport.alignment.deleteAllGroups();
+ viewport.getGapCharacter()), viewport.getAlignment()
+ .getGroups());
+ viewport.getAlignment().deleteAllGroups();
viewport.sequenceColours = null;
viewport.setSelectionGroup(null);
// set view properties for each group
{
gps[g].setShowNonconserved(viewport.getShowUnconserved());
gps[g].setshowSequenceLogo(viewport.isShowSequenceLogo());
- viewport.alignment.addGroup(gps[g]);
+ viewport.getAlignment().addGroup(gps[g]);
Color col = new Color((int) (Math.random() * 255),
(int) (Math.random() * 255), (int) (Math.random() * 255));
col = col.brighter();
- for (Enumeration sq = gps[g].getSequences(null).elements(); sq
- .hasMoreElements(); viewport.setSequenceColour(
- (SequenceI) sq.nextElement(), col))
+ for (SequenceI s:gps[g].getSequences())
+ viewport.setSequenceColour(
+ s, col)
;
}
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
/**
* make the given alignmentPanel the currently selected tab
- *
+ *
* @param alignmentPanel
*/
public void setDisplayedView(AlignmentPanel alignmentPanel)
"Implementation error: cannot show a view from another alignment in an AlignFrame.");
}
if (tabbedPane != null
- & alignPanels.indexOf(alignmentPanel) != tabbedPane.getSelectedIndex())
+ & alignPanels.indexOf(alignmentPanel) != tabbedPane
+ .getSelectedIndex())
{
tabbedPane.setSelectedIndex(alignPanels.indexOf(alignmentPanel));
}
static PageFormat pf;
+ @Override
public void run()
{
PrinterJob printJob = PrinterJob.getPrinterJob();
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.*;
import jalview.analysis.*;
-import jalview.api.StructureSelectionManagerProvider;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.OOMHandlerI;
import jalview.bin.*;
import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
import jalview.structure.VamsasSource;
+import jalview.viewmodel.AlignmentViewport;
+import jalview.workers.AlignCalcManager;
+import jalview.workers.ConsensusThread;
+import jalview.workers.ConservationThread;
+import jalview.workers.StrucConsensusThread;
/**
* DOCUMENT ME!
* @author $author$
* @version $Revision: 1.141 $
*/
-public class AlignViewport implements SelectionSource, VamsasSource
+public class AlignViewport extends AlignmentViewport implements SelectionSource, VamsasSource, AlignViewportI
{
private static final int RIGHT_JUSTIFY = 1;
boolean showAnnotation = true;
- boolean colourAppliesToAllGroups = true;
-
- ColourSchemeI globalColourScheme = null;
-
- boolean conservationColourSelected = false;
-
- boolean abovePIDThreshold = false;
-
- SequenceGroup selectionGroup;
-
int charHeight;
int charWidth;
boolean seqNameItalics;
- AlignmentI alignment;
-
- ColumnSelection colSel = new ColumnSelection();
-
- int threshold;
-
- int increment;
NJTree currentTree = null;
boolean scaleRightWrapped = true;
- boolean hasHiddenColumns = false;
-
- boolean hasHiddenRows = false;
-
boolean showHiddenMarkers = true;
boolean cursorMode = false;
*/
Hashtable featuresDisplayed = null;
- /** DOCUMENT ME!! */
- public Hashtable[] hconsensus;
-
- AlignmentAnnotation consensus;
-
- AlignmentAnnotation conservation;
-
- AlignmentAnnotation quality;
-
- AlignmentAnnotation[] groupConsensus;
-
- AlignmentAnnotation[] groupConservation;
-
- boolean autoCalculateConsensus = true;
-
- /** DOCUMENT ME!! */
- public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
-
- // JBPNote Prolly only need this in the applet version.
- private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
- this);
-
- boolean ignoreGapsInConsensusCalculation = false;
-
- boolean isDataset = false;
-
boolean antiAlias = false;
- boolean padGaps = false;
-
Rectangle explodedPosition;
String viewName;
- String sequenceSetID;
-
boolean gatherViewsHere = false;
Stack historyList = new Stack();
boolean rightAlignIds = false;
- Hashtable hiddenRepSequences;
-
- boolean sortByTree;
-
/**
* Creates a new AlignViewport object.
*
centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false);
autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
- padGaps = Cache.getDefault("PAD_GAPS", true);
+ setPadGaps(Cache.getDefault("PAD_GAPS", true));
shownpfeats = Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true);
showdbrefs = Cache.getDefault("SHOW_DBREFS_TOOLTIP", true);
{
if (!alignment.isNucleotide())
{
- conservation = new AlignmentAnnotation("Conservation",
- "Conservation of total alignment less than " + ConsPercGaps
- + "% gaps", new Annotation[1], 0f, 11f,
- AlignmentAnnotation.BAR_GRAPH);
- conservation.hasText = true;
- conservation.autoCalculated = true;
-
- if (Cache.getDefault("SHOW_CONSERVATION", true))
- {
- alignment.addAnnotation(conservation);
- }
-
- if (Cache.getDefault("SHOW_QUALITY", true))
- {
- quality = new AlignmentAnnotation("Quality",
- "Alignment Quality based on Blosum62 scores",
- new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
- quality.hasText = true;
- quality.autoCalculated = true;
-
- alignment.addAnnotation(quality);
- }
+ showConservation=Cache.getDefault("SHOW_CONSERVATION", true);
+ showQuality=Cache.getDefault("SHOW_QUALITY", true);
showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
false);
-
- {
-
- }
- }
+ }
showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
true);
showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
+ normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO", false);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
- // TODO: add menu option action that nulls or creates consensus object
- // depending on if the user wants to see the annotation or not in a
- // specific alignment
+ showConsensus=Cache.getDefault("SHOW_IDENTITY", true);
consensus = new AlignmentAnnotation("Consensus", "PID",
new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
consensus.hasText = true;
consensus.autoCalculated = true;
-
- if (Cache.getDefault("SHOW_IDENTITY", true))
- {
- alignment.addAnnotation(consensus);
- }
}
-
+ initAutoAnnotation();
if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
{
globalColourScheme = ColourSchemeProperty.getColour(alignment,
return showSequenceFeatures;
}
- ConservationThread conservationThread;
-
- ConsensusThread consensusThread;
-
- boolean consUpdateNeeded = false;
-
- static boolean UPDATING_CONSENSUS = false;
-
- static boolean UPDATING_CONSERVATION = false;
-
- boolean updatingConsensus = false;
-
- boolean updatingConservation = false;
-
/**
* centre columnar annotation labels in displayed alignment annotation TODO:
* add to jalviewXML and annotation display settings
private boolean shownpfeats;
- /**
- * trigger update of conservation annotation
- */
- public void updateConservation(final AlignmentPanel ap)
- {
- // see note in mantis : issue number 8585
- if (alignment.isNucleotide() || conservation == null
- || !autoCalculateConsensus)
- {
- return;
- }
-
- conservationThread = new ConservationThread(this, ap);
- conservationThread.start();
- }
-
- /**
- * trigger update of consensus annotation
- */
- public void updateConsensus(final AlignmentPanel ap)
- {
- // see note in mantis : issue number 8585
- if (consensus == null || !autoCalculateConsensus)
- {
- return;
- }
- consensusThread = new ConsensusThread(ap);
- consensusThread.start();
- }
-
- class ConsensusThread extends Thread
- {
- AlignmentPanel ap;
-
- public ConsensusThread(AlignmentPanel ap)
- {
- this.ap = ap;
- }
-
- public void run()
- {
- updatingConsensus = true;
- while (UPDATING_CONSENSUS)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
-
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- UPDATING_CONSENSUS = true;
-
- try
- {
- int aWidth = (alignment != null) ? alignment.getWidth() : -1; // null
- // pointer
- // possibility
- // here.
- if (aWidth <= 0)
- {
- updatingConsensus = false;
- UPDATING_CONSENSUS = false;
- return;
- }
-
- consensus.annotations = null;
- consensus.annotations = new Annotation[aWidth];
-
- hconsensus = new Hashtable[aWidth];
- AAFrequency.calculate(alignment.getSequencesArray(), 0,
- alignment.getWidth(), hconsensus, true);
- updateAnnotation(true);
-
- if (globalColourScheme != null)
- {
- globalColourScheme.setConsensus(hconsensus);
- }
-
- } catch (OutOfMemoryError error)
- {
- alignment.deleteAnnotation(consensus);
-
- consensus = null;
- hconsensus = null;
- new OOMWarning("calculating consensus", error);
- }
- UPDATING_CONSENSUS = false;
- updatingConsensus = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
- }
-
- /**
- * update the consensus annotation from the sequence profile data using
- * current visualization settings.
- */
- public void updateAnnotation()
- {
- updateAnnotation(false);
- }
-
- protected void updateAnnotation(boolean immediate)
- {
- // TODO: make calls thread-safe, so if another thread calls this method,
- // it will either return or wait until one calculation is finished.
- if (immediate
- || (!updatingConsensus && consensus != null && hconsensus != null))
- {
- AAFrequency.completeConsensus(consensus, hconsensus, 0,
- hconsensus.length, ignoreGapsInConsensusCalculation,
- showSequenceLogo);
- }
- }
- }
+ // --------END Structure Conservation
/**
* get the consensus sequence as displayed under the PID consensus annotation
}
/**
- *
- *
- * @return null or the currently selected sequence region
- */
- public SequenceGroup getSelectionGroup()
- {
- return selectionGroup;
- }
-
- /**
- * Set the selection group for this window.
- *
- * @param sg - group holding references to sequences in this alignment view
- *
- */
- public void setSelectionGroup(SequenceGroup sg)
- {
- selectionGroup = sg;
- }
-
- /**
- * GUI state
- * @return true if conservation based shading is enabled
- */
- public boolean getConservationSelected()
- {
- return conservationColourSelected;
- }
-
- /**
- * GUI state
- * @param b
- * enable conservation based shading
- */
- public void setConservationSelected(boolean b)
- {
- conservationColourSelected = b;
- }
-
- /**
- * GUI state
- * @return true if percent identity threshold is applied to shading
- */
- public boolean getAbovePIDThreshold()
- {
- return abovePIDThreshold;
- }
-
- /**
- * GUI state
- *
- *
- * @param b indicate if percent identity threshold is applied to shading
- */
- public void setAbovePIDThreshold(boolean b)
- {
- abovePIDThreshold = b;
- }
-
- /**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
/**
* DOCUMENT ME!
*
- * @param cs
- * DOCUMENT ME!
- */
- public void setGlobalColourScheme(ColourSchemeI cs)
- {
- globalColourScheme = cs;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public ColourSchemeI getGlobalColourScheme()
- {
- return globalColourScheme;
- }
-
- /**
- * DOCUMENT ME!
- *
* @param res
* DOCUMENT ME!
*/
{
if (alignment != null && alignment.getCodonFrames() != null)
{
- StructureSelectionManager.getStructureSelectionManager(Desktop.instance)
- .removeMappings(alignment.getCodonFrames());
+ StructureSelectionManager.getStructureSelectionManager(
+ Desktop.instance).removeMappings(alignment.getCodonFrames());
}
this.alignment = align;
- if (alignment.getCodonFrames() != null)
+ if (alignment!=null && alignment.getCodonFrames() != null)
{
- StructureSelectionManager.getStructureSelectionManager(Desktop.instance).addMappings(
- alignment.getCodonFrames());
+ StructureSelectionManager.getStructureSelectionManager(
+ Desktop.instance).addMappings(alignment.getCodonFrames());
}
}
/**
* DOCUMENT ME!
*
- * @param thresh
- * DOCUMENT ME!
- */
- public void setThreshold(int thresh)
- {
- threshold = thresh;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getThreshold()
- {
- return threshold;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param inc
- * DOCUMENT ME!
- */
- public void setIncrement(int inc)
- {
- increment = inc;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public int getIncrement()
- {
- return increment;
- }
-
- /**
- * DOCUMENT ME!
- *
* @return DOCUMENT ME!
*/
public ColumnSelection getColumnSelection()
/**
* DOCUMENT ME!
*
- * @param b
- * DOCUMENT ME!
- */
- public void setColourAppliesToAllGroups(boolean b)
- {
- colourAppliesToAllGroups = b;
- }
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean getColourAppliesToAllGroups()
- {
- return colourAppliesToAllGroups;
- }
-
- /**
- * DOCUMENT ME!
- *
* @return DOCUMENT ME!
*/
public boolean getShowJVSuffix()
scaleRightWrapped = b;
}
- /**
- * Property change listener for changes in alignment
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void addPropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.addPropertyChangeListener(listener);
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param listener
- * DOCUMENT ME!
- */
- public void removePropertyChangeListener(
- java.beans.PropertyChangeListener listener)
- {
- changeSupport.removePropertyChangeListener(listener);
- }
-
- /**
- * Property change listener for changes in alignment
- *
- * @param prop
- * DOCUMENT ME!
- * @param oldvalue
- * DOCUMENT ME!
- * @param newvalue
- * DOCUMENT ME!
- */
- public void firePropertyChange(String prop, Object oldvalue,
- Object newvalue)
- {
- changeSupport.firePropertyChange(prop, oldvalue, newvalue);
- }
-
- public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
- {
- ignoreGapsInConsensusCalculation = b;
- updateConsensus(ap);
- if (globalColourScheme != null)
- {
- globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
- ignoreGapsInConsensusCalculation);
- }
- }
-
- public boolean getIgnoreGapsConsensus()
- {
- return ignoreGapsInConsensusCalculation;
- }
public void setDataset(boolean b)
{
return isDataset;
}
- public void hideSelectedColumns()
- {
- if (colSel.size() < 1)
- {
- return;
- }
- colSel.hideSelectedColumns();
- setSelectionGroup(null);
- hasHiddenColumns = true;
+ public boolean getShowHiddenMarkers()
+ {
+ return showHiddenMarkers;
+ }
+
+ public void setShowHiddenMarkers(boolean show)
+ {
+ showHiddenMarkers = show;
}
- public void hideColumns(int start, int end)
+ public Color getSequenceColour(SequenceI seq)
{
- if (start == end)
+ if (sequenceColours == null || !sequenceColours.containsKey(seq))
{
- colSel.hideColumns(start);
+ return Color.white;
}
else
{
- colSel.hideColumns(start, end);
+ return (Color) sequenceColours.get(seq);
}
-
- hasHiddenColumns = true;
}
- public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
+ public void setSequenceColour(SequenceI seq, Color col)
{
- int sSize = sg.getSize();
- if (sSize < 2)
+ if (sequenceColours == null)
{
- return;
+ sequenceColours = new Hashtable();
}
- if (hiddenRepSequences == null)
+ if (col == null)
{
- hiddenRepSequences = new Hashtable();
- }
-
- hiddenRepSequences.put(repSequence, sg);
-
- // Hide all sequences except the repSequence
- SequenceI[] seqs = new SequenceI[sSize - 1];
- int index = 0;
- for (int i = 0; i < sSize; i++)
- {
- if (sg.getSequenceAt(i) != repSequence)
- {
- if (index == sSize - 1)
- {
- return;
- }
-
- seqs[index++] = sg.getSequenceAt(i);
- }
- }
- sg.setSeqrep(repSequence);
- sg.setHidereps(true);
- hideSequence(seqs);
-
- }
-
- public void hideAllSelectedSeqs()
- {
- if (selectionGroup == null || selectionGroup.getSize() < 1)
- {
- return;
- }
-
- SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
-
- hideSequence(seqs);
-
- setSelectionGroup(null);
- }
-
- public void hideSequence(SequenceI[] seq)
- {
- if (seq != null)
- {
- for (int i = 0; i < seq.length; i++)
- {
- alignment.getHiddenSequences().hideSequence(seq[i]);
- }
- hasHiddenRows = true;
- firePropertyChange("alignment", null, alignment.getSequences());
- }
- }
-
- public void showSequence(int index)
- {
- Vector tmp = alignment.getHiddenSequences().showSequence(index,
- hiddenRepSequences);
- if (tmp.size() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
-
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- }
-
- if (alignment.getHiddenSequences().getSize() < 1)
- {
- hasHiddenRows = false;
- }
- }
-
- public void showColumn(int col)
- {
- colSel.revealHiddenColumns(col);
- if (colSel.getHiddenColumns() == null)
- {
- hasHiddenColumns = false;
- }
- }
-
- public void showAllHiddenColumns()
- {
- colSel.revealAllHiddenColumns();
- hasHiddenColumns = false;
- }
-
- public void showAllHiddenSeqs()
- {
- if (alignment.getHiddenSequences().getSize() > 0)
- {
- if (selectionGroup == null)
- {
- selectionGroup = new SequenceGroup();
- selectionGroup.setEndRes(alignment.getWidth() - 1);
- }
- Vector tmp = alignment.getHiddenSequences().showAll(
- hiddenRepSequences);
- for (int t = 0; t < tmp.size(); t++)
- {
- selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
- }
- firePropertyChange("alignment", null, alignment.getSequences());
- sendSelection();
- hasHiddenRows = false;
- hiddenRepSequences = null;
- }
- }
-
- public void invertColumnSelection()
- {
- colSel.invertColumnSelection(0, alignment.getWidth());
- }
-
- public int adjustForHiddenSeqs(int alignmentIndex)
- {
- return alignment.getHiddenSequences().adjustForHiddenSeqs(
- alignmentIndex);
- }
-
- /**
- * This method returns an array of new SequenceI objects derived from the
- * whole alignment or just the current selection with start and end points
- * adjusted
- *
- * @note if you need references to the actual SequenceI objects in the
- * alignment or currently selected then use getSequenceSelection()
- * @return selection as new sequenceI objects
- */
- public SequenceI[] getSelectionAsNewSequence()
- {
- SequenceI[] sequences;
-
- if (selectionGroup == null)
- {
- sequences = alignment.getSequencesArray();
- AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
- for (int i = 0; i < sequences.length; i++)
- {
- sequences[i] = new Sequence(sequences[i], annots); // construct new
- // sequence with
- // subset of visible
- // annotation
- }
- }
- else
- {
- sequences = selectionGroup.getSelectionAsNewSequences(alignment);
- }
-
- return sequences;
- }
-
- /**
- * get the currently selected sequence objects or all the sequences in the
- * alignment.
- *
- * @return array of references to sequence objects
- */
- public SequenceI[] getSequenceSelection()
- {
- SequenceI[] sequences = null;
- if (selectionGroup != null)
- {
- sequences = selectionGroup.getSequencesInOrder(alignment);
- }
- if (sequences == null)
- {
- sequences = alignment.getSequencesArray();
- }
- return sequences;
- }
-
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public jalview.datamodel.CigarArray getViewAsCigars(
- boolean selectedRegionOnly)
- {
- return new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? colSel : null), (selectedRegionOnly ? selectionGroup : null));
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
- {
- return getAlignmentView(selectedOnly, false);
- }
-
- /**
- * return a compact representation of the current alignment selection to pass
- * to an analysis function
- *
- * @param selectedOnly
- * boolean true to just return the selected view
- * @param markGroups
- * boolean true to annotate the alignment view with groups on the alignment (and intersecting with selected region if selectedOnly is true)
- * @return AlignmentView
- */
- public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups)
- {
- return new AlignmentView(alignment, colSel, selectionGroup, hasHiddenColumns, selectedOnly, markGroups);
- }
-
- /**
- * This method returns the visible alignment as text, as seen on the GUI, ie
- * if columns are hidden they will not be returned in the result. Use this for
- * calculating trees, PCA, redundancy etc on views which contain hidden
- * columns.
- *
- * @return String[]
- */
- public String[] getViewAsString(boolean selectedRegionOnly)
- {
- String[] selection = null;
- SequenceI[] seqs = null;
- int i, iSize;
- int start = 0, end = 0;
- if (selectedRegionOnly && selectionGroup != null)
- {
- iSize = selectionGroup.getSize();
- seqs = selectionGroup.getSequencesInOrder(alignment);
- start = selectionGroup.getStartRes();
- end = selectionGroup.getEndRes() + 1;
- }
- else
- {
- iSize = alignment.getHeight();
- seqs = alignment.getSequencesArray();
- end = alignment.getWidth();
- }
-
- selection = new String[iSize];
- if (hasHiddenColumns)
- {
- selection = colSel.getVisibleSequenceStrings(start, end, seqs);
- }
- else
- {
- for (i = 0; i < iSize; i++)
- {
- selection[i] = seqs[i].getSequenceAsString(start, end);
- }
-
- }
- return selection;
- }
-
- public int[][] getVisibleRegionBoundaries(int min, int max)
- {
- Vector regions = new Vector();
- int start = min;
- int end = max;
-
- do
- {
- if (hasHiddenColumns)
- {
- if (start == 0)
- {
- start = colSel.adjustForHiddenColumns(start);
- }
-
- end = colSel.getHiddenBoundaryRight(start);
- if (start == end)
- {
- end = max;
- }
- if (end > max)
- {
- end = max;
- }
- }
-
- regions.addElement(new int[]
- { start, end });
-
- if (hasHiddenColumns)
- {
- start = colSel.adjustForHiddenColumns(end);
- start = colSel.getHiddenBoundaryLeft(start) + 1;
- }
- } while (end < max);
-
- int[][] startEnd = new int[regions.size()][2];
-
- regions.copyInto(startEnd);
-
- return startEnd;
-
- }
-
- public boolean getShowHiddenMarkers()
- {
- return showHiddenMarkers;
- }
-
- public void setShowHiddenMarkers(boolean show)
- {
- showHiddenMarkers = show;
- }
-
- public String getSequenceSetId()
- {
- if (sequenceSetID == null)
- {
- sequenceSetID = alignment.hashCode() + "";
- }
-
- return sequenceSetID;
- }
-
- /**
- * unique viewId for synchronizing state with stored Jalview Project
- *
- */
- private String viewId = null;
-
- public String getViewId()
- {
- if (viewId == null)
- {
- viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
- }
- return viewId;
- }
-
- public void alignmentChanged(AlignmentPanel ap)
- {
- if (padGaps)
- {
- alignment.padGaps();
- }
- if (hconsensus != null && autoCalculateConsensus)
- {
- updateConservation(ap);
- }
- if (autoCalculateConsensus)
- {
- updateConsensus(ap);
- }
-
- // Reset endRes of groups if beyond alignment width
- int alWidth = alignment.getWidth();
- Vector groups = alignment.getGroups();
- if (groups != null)
- {
- for (int i = 0; i < groups.size(); i++)
- {
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
- if (sg.getEndRes() > alWidth)
- {
- sg.setEndRes(alWidth - 1);
- }
- }
- }
-
- if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
- {
- selectionGroup.setEndRes(alWidth - 1);
- }
-
- resetAllColourSchemes();
-
- // alignment.adjustSequenceAnnotations();
- }
-
- void resetAllColourSchemes()
- {
- ColourSchemeI cs = globalColourScheme;
- if (cs != null)
- {
- if (cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
- alignment.getWidth());
- }
-
- cs.setConsensus(hconsensus);
- if (cs.conservationApplied())
- {
- Alignment al = (Alignment) alignment;
- Conservation c = new Conservation("All",
- ResidueProperties.propHash, 3, al.getSequences(), 0,
- al.getWidth() - 1);
- c.calculate();
- c.verdict(false, ConsPercGaps);
-
- cs.setConservation(c);
- }
- }
-
- int s, sSize = alignment.getGroups().size();
- for (s = 0; s < sSize; s++)
- {
- SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
- if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
- {
- ((ClustalxColourScheme) sg.cs).resetClustalX(
- sg.getSequences(hiddenRepSequences), sg.getWidth());
- }
- sg.recalcConservation();
- }
- }
-
- public Color getSequenceColour(SequenceI seq)
- {
- if (sequenceColours == null || !sequenceColours.containsKey(seq))
- {
- return Color.white;
- }
- else
- {
- return (Color) sequenceColours.get(seq);
- }
- }
-
- public void setSequenceColour(SequenceI seq, Color col)
- {
- if (sequenceColours == null)
- {
- sequenceColours = new Hashtable();
- }
-
- if (col == null)
- {
- sequenceColours.remove(seq);
+ sequenceColours.remove(seq);
}
else
{
public void updateSequenceIdColours()
{
- Vector groups = alignment.getGroups();
if (sequenceColours == null)
{
sequenceColours = new Hashtable();
}
- for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
+ for (SequenceGroup sg:alignment.getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
if (sg.idColour != null)
{
- Vector sqs = sg.getSequences(hiddenRepSequences);
- for (int s = 0, sSize = sqs.size(); s < sSize; s++)
+ for (SequenceI s:sg.getSequences(getHiddenRepSequences()))
{
- sequenceColours.put(sqs.elementAt(s), sg.idColour);
+ sequenceColours.put(s, sg.idColour);
}
}
}
return followSelection;
}
- private long sgrouphash = -1, colselhash = -1;
-
boolean showSeqFeaturesHeight;
- /**
- * checks current SelectionGroup against record of last hash value, and
- * updates record.
- * @param b update the record of last hash value
- *
- * @return true if SelectionGroup changed since last call (when b is true)
- */
- boolean isSelectionGroupChanged(boolean b)
- {
- int hc = (selectionGroup == null || selectionGroup.getSize()==0) ? -1 : selectionGroup.hashCode();
- if (hc!=-1 && hc != sgrouphash)
- {
- if (b) {sgrouphash = hc;}
- return true;
- }
- return false;
- }
-
- /**
- * checks current colsel against record of last hash value, and optionally updates
- * record.
-
- * @param b update the record of last hash value
- * @return true if colsel changed since last call (when b is true)
- */
- boolean isColSelChanged(boolean b)
- {
- int hc = (colSel == null || colSel.size()==0) ? -1 : colSel.hashCode();
- if (hc!=-1 && hc != colselhash)
- {
- if (b) {colselhash = hc;}
- return true;
- }
- return false;
- }
-
public void sendSelection()
{
jalview.structure.StructureSelectionManager
return showSeqFeaturesHeight;
}
- boolean showUnconserved = false;
-
- public boolean getShowUnconserved()
- {
- return showUnconserved;
- }
-
- public void setShowUnconserved(boolean showunconserved)
- {
- showUnconserved = showunconserved;
- }
-
/**
* return the alignPanel containing the given viewport. Use this to get the
* components currently handling the given viewport.
}
/**
- * should conservation rows be shown for groups
- */
- boolean showGroupConservation = false;
-
- /**
- * should consensus rows be shown for groups
- */
- boolean showGroupConsensus = false;
-
- /**
- * should consensus profile be rendered by default
- */
- public boolean showSequenceLogo = false;
-
- /**
- * should consensus histograms be rendered by default
- */
- public boolean showConsensusHistogram = true;
-
- /**
- * @return the showConsensusProfile
- */
- public boolean isShowSequenceLogo()
- {
- return showSequenceLogo;
- }
-
- /**
- * @param showSequenceLogo
- * the new value
- */
- public void setShowSequenceLogo(boolean showSequenceLogo)
- {
- if (showSequenceLogo != this.showSequenceLogo)
- {
- // TODO: decouple settings setting from calculation when refactoring
- // annotation update method from alignframe to viewport
- this.showSequenceLogo = showSequenceLogo;
- if (consensusThread != null)
- {
- consensusThread.updateAnnotation();
- }
- }
- this.showSequenceLogo = showSequenceLogo;
- }
-
- /**
- * @param showConsensusHistogram
- * the showConsensusHistogram to set
- */
- public void setShowConsensusHistogram(boolean showConsensusHistogram)
- {
- this.showConsensusHistogram = showConsensusHistogram;
- }
-
- /**
- * @return the showGroupConservation
- */
- public boolean isShowGroupConservation()
- {
- return showGroupConservation;
- }
-
- /**
- * @param showGroupConservation
- * the showGroupConservation to set
- */
- public void setShowGroupConservation(boolean showGroupConservation)
- {
- this.showGroupConservation = showGroupConservation;
- }
-
- /**
- * @return the showGroupConsensus
- */
- public boolean isShowGroupConsensus()
- {
- return showGroupConsensus;
- }
-
- /**
- * @param showGroupConsensus
- * the showGroupConsensus to set
- */
- public void setShowGroupConsensus(boolean showGroupConsensus)
- {
- this.showGroupConsensus = showGroupConsensus;
- }
-
- /**
- *
- * @return flag to indicate if the consensus histogram should be rendered by
- * default
- */
- public boolean isShowConsensusHistogram()
- {
- return this.showConsensusHistogram;
- }
-
- /**
* synthesize a column selection if none exists so it covers the given
* selection group. if wholewidth is false, no column selection is made if the
* selection group covers the whole alignment width.
public StructureSelectionManager getStructureSelectionManager()
{
- return StructureSelectionManager.getStructureSelectionManager(Desktop.instance);
+ return StructureSelectionManager
+ .getStructureSelectionManager(Desktop.instance);
}
/**
*
* @param pdbEntries
- * @return a series of SequenceI arrays, one for each PDBEntry, listing which sequence in the alignment holds a reference to it
+ * @return a series of SequenceI arrays, one for each PDBEntry, listing which
+ * sequence in the alignment holds a reference to it
*/
public SequenceI[][] collateForPDB(PDBEntry[] pdbEntries)
{
ArrayList<SequenceI[]> seqvectors = new ArrayList<SequenceI[]>();
- for (PDBEntry pdb: pdbEntries) {
- ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
- for (int i = 0; i < alignment.getHeight(); i++)
+ for (PDBEntry pdb : pdbEntries)
{
- Vector pdbs = alignment.getSequenceAt(i)
- .getDatasetSequence().getPDBId();
- if (pdbs == null)
- continue;
- SequenceI sq;
- for (int p = 0; p < pdbs.size(); p++)
+ ArrayList<SequenceI> seqs = new ArrayList<SequenceI>();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
- if (p1.getId().equals(pdb.getId()))
+ Vector pdbs = alignment.getSequenceAt(i).getDatasetSequence()
+ .getPDBId();
+ if (pdbs == null)
+ continue;
+ SequenceI sq;
+ for (int p = 0; p < pdbs.size(); p++)
{
- if (!seqs.contains(sq=alignment.getSequenceAt(i)))
- seqs.add(sq);
+ PDBEntry p1 = (PDBEntry) pdbs.elementAt(p);
+ if (p1.getId().equals(pdb.getId()))
+ {
+ if (!seqs.contains(sq = alignment.getSequenceAt(i)))
+ seqs.add(sq);
- continue;
+ continue;
+ }
}
}
- }
- seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
+ seqvectors.add(seqs.toArray(new SequenceI[seqs.size()]));
}
return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
}
+
+
+ public boolean isNormaliseSequenceLogo()
+ {
+ return normaliseSequenceLogo;
+ }
+
+ public void setNormaliseSequenceLogo(boolean state)
+ {
+ normaliseSequenceLogo = state;
+ }
+
+
+ /**
+ *
+ * @return true if alignment characters should be displayed
+ */
+ public boolean isValidCharWidth()
+ {
+ return validCharWidth;
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.datamodel.*;
import jalview.jbgui.*;
import jalview.schemes.*;
-import jalview.structure.SelectionSource;
import jalview.structure.StructureSelectionManager;
/**
// do we need to scroll the panel?
// TODO: tons of nullpointereexceptions raised here.
if (results != null && results.getSize() > 0 && av != null
- && av.alignment != null)
+ && av.getAlignment() != null)
{
- int seqIndex = av.alignment.findIndex(results);
+ int seqIndex = av.getAlignment().findIndex(results);
if (seqIndex == -1)
{
return false;
}
- SequenceI seq = av.alignment.getSequenceAt(seqIndex);
+ SequenceI seq = av.getAlignment().getSequenceAt(seqIndex);
- int[] r=results.getResults(seq, 0, av.alignment.getWidth());
+ int[] r=results.getResults(seq, 0, av.getAlignment().getWidth());
if (r == null)
{
return false;
{
return false;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
start = av.getColumnSelection().findColumnPosition(start);
end = av.getColumnSelection().findColumnPosition(end);
if (start==end)
{
- if (!av.colSel.isVisible(r[0]))
+ if (!av.getColumnSelection().isVisible(r[0]))
{
// don't scroll - position isn't visible
return false;
public void setScrollValues(int x, int y)
{
// System.err.println("Scroll to "+x+","+y);
- if (av == null || av.alignment == null)
+ if (av == null || av.getAlignment() == null)
{
return;
}
- int width = av.alignment.getWidth();
- int height = av.alignment.getHeight();
+ int width = av.getAlignment().getWidth();
+ int height = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
width = av.getColumnSelection().findColumnPosition(width);
}
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
+ int maxwidth = av.getAlignment().getWidth();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
endSeq = av.getAlignment().getHeight();
}
- int pagesHigh = ((av.alignment.getHeight() / totalSeq) + 1) * pheight;
+ int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1) * pheight;
if (av.showAnnotation)
{
pg.translate(idWidth, 0);
seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
- if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
+ if (av.showAnnotation && (endSeq == av.getAlignment().getHeight()))
{
pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
alabels.drawComponent((Graphics2D) pg, idWidth);
pg.translate(idWidth + 3, 0);
- annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes + 1);
+ annotationPanel.renderer.drawComponent(annotationPanel, av, (Graphics2D) pg, -1, startRes, endRes + 1);
}
return Printable.PAGE_EXISTS;
int idWidth = getVisibleIdWidth(false);
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
do
{
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
pg.setFont(idPanel.idCanvas.idfont);
- SequenceI s = av.alignment.getSequenceAt(i);
+ SequenceI s = av.getAlignment().getSequenceAt(i);
String string = s.getDisplayId(av.getShowJVSuffix());
int xPos = 0;
if (av.rightAlignIds)
void makeAlignmentImage(int type, File file)
{
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
}
- int height = ((av.alignment.getHeight() + 1) * av.charHeight)
+ int height = ((av.getAlignment().getHeight() + 1) * av.charHeight)
+ scalePanel.getHeight();
int width = getVisibleIdWidth(false) + (maxwidth * av.charWidth);
{
try
{
- int s, sSize = av.alignment.getHeight(), res, alwidth = av.alignment
+ int s, sSize = av.getAlignment().getHeight(), res, alwidth = av.getAlignment()
.getWidth(), g, gSize, f, fSize, sy;
StringBuffer text = new StringBuffer();
PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
{
sy = s * av.charHeight + scaleHeight;
- SequenceI seq = av.alignment.getSequenceAt(s);
+ SequenceI seq = av.getAlignment().getSequenceAt(s);
SequenceFeature[] features = seq.getDatasetSequence()
.getSequenceFeatures();
- SequenceGroup[] groups = av.alignment.findAllGroups(seq);
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(seq);
for (res = 0; res < alwidth; res++)
{
text = new StringBuffer();
Object obj = null;
- if (av.alignment.isNucleotide())
+ if (av.getAlignment().isNucleotide())
{
obj = ResidueProperties.nucleotideName.get(seq.getCharAt(res)
+ "");
int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
+ annotationHeight;
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
jalview.structure.StructureSelectionManager ssm = av.getStructureSelectionManager();
ssm.removeStructureViewerListener(seqPanel, null);
ssm.removeSelectionListener(seqPanel);
- av.alignment = null;
+ av.setAlignment(null);
av = null;
}
else
boolean cons = av.isShowGroupConsensus();
boolean showprf = av.isShowSequenceLogo();
boolean showConsHist = av.isShowConsensusHistogram();
+ boolean normLogo = av.isNormaliseSequenceLogo();
boolean sortg = true;
// remove old automatic annotation
// add any new annotation
- Vector gr = av.alignment.getGroups(); // OrderedBy(av.alignment.getSequencesArray());
// intersect alignment annotation with alignment groups
- AlignmentAnnotation[] aan = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aan = av.getAlignment().getAlignmentAnnotation();
Hashtable oldrfs = new Hashtable();
if (aan != null)
{
if (aan[an].autoCalculated && aan[an].groupRef != null)
{
oldrfs.put(aan[an].groupRef, aan[an].groupRef);
- av.alignment.deleteAnnotation(aan[an]);
+ av.getAlignment().deleteAnnotation(aan[an]);
aan[an] = null;
}
}
}
- SequenceGroup sg;
- if (gr != null)
+ if (av.getAlignment().getGroups()!=null)
{
- for (int g = 0; g < gr.size(); g++)
+ for (SequenceGroup sg:av.getAlignment().getGroups())
{
updateCalcs = false;
- sg = (SequenceGroup) gr.elementAt(g);
if (applyGlobalSettings || !oldrfs.containsKey(sg))
{
// set defaults for this group's conservation/consensus
sg.setshowSequenceLogo(showprf);
sg.setShowConsensusHistogram(showConsHist);
+ sg.setNormaliseSequenceLogo(normLogo);
}
if (conv)
{
updateCalcs = true;
- av.alignment.addAnnotation(sg.getConservationRow(), 0);
+ av.getAlignment().addAnnotation(sg.getConservationRow(), 0);
}
if (cons)
{
updateCalcs = true;
- av.alignment.addAnnotation(sg.getConsensus(), 0);
+ av.getAlignment().addAnnotation(sg.getConsensus(), 0);
}
// refresh the annotation rows
if (updateCalcs)
@Override
public AlignmentI getAlignment()
{
- return av.alignment;
+ return av.getAlignment();
}
/**
{
return av.getStructureSelectionManager();
}
+
+ @Override
+ public void raiseOOMWarning(String string, OutOfMemoryError error)
+ {
+ new OOMWarning(string, error, this);
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap)
{
oldcs = av.getGlobalColourScheme();
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
oldgroupColours = new Hashtable();
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.get(g);
if (sg.cs != null)
{
oldgroupColours.put(sg, sg.cs);
}
});
- if (av.alignment.getAlignmentAnnotation() == null)
+ if (av.getAlignment().getAlignmentAnnotation() == null)
{
return;
}
adjusting = true;
Vector list = new Vector();
int index = 1;
- for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
{
- String label = av.alignment.getAlignmentAnnotation()[i].label;
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
if (!list.contains(label))
list.addElement(label);
else
return;
}
- currentAnnotation = av.alignment.getAlignmentAnnotation()[annotations
+ currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annotations
.getSelectedIndex()];
int aboveThreshold = -1;
av.setGlobalColourScheme(acg);
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.get(g);
-
if (sg.cs == null)
{
continue;
void reset()
{
av.setGlobalColourScheme(oldcs);
- if (av.alignment.getGroups() != null)
+ if (av.getAlignment().getGroups() != null)
{
- Vector allGroups = ap.av.alignment.getGroups();
- SequenceGroup sg;
- for (int g = 0; g < allGroups.size(); g++)
+
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- sg = (SequenceGroup) allGroups.get(g);
sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
}
}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
package jalview.gui;\r
\r
import java.util.*;\r
+import java.util.List;\r
\r
import java.awt.*;\r
import java.awt.event.*;\r
\r
AlignmentAnnotation[] annotations;\r
\r
- Vector sequenceGroups;\r
+ List<SequenceGroup> sequenceGroups;\r
\r
Hashtable alignmentProperties;\r
\r
}\r
\r
public void exportAnnotations(AlignmentPanel ap,\r
- AlignmentAnnotation[] annotations, Vector sequenceGroups,\r
+ AlignmentAnnotation[] annotations, List<SequenceGroup> list,\r
Hashtable alProperties)\r
{\r
this.ap = ap;\r
GFFFormat.setVisible(false);\r
CSVFormat.setVisible(true);\r
this.annotations = annotations;\r
- this.sequenceGroups = sequenceGroups;\r
+ this.sequenceGroups = list;\r
this.alignmentProperties = alProperties;\r
frame.setTitle("Export Annotations");\r
}\r
{\r
if (GFFFormat.isSelected())\r
{\r
- text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
.getDataset().getSequencesArray(),\r
getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//);\r
}\r
else\r
{\r
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
.getDataset().getSequencesArray(),\r
getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed);\r
}\r
{\r
if (GFFFormat.isSelected())\r
{\r
- text = new FeaturesFile().printGFFFormat(ap.av.alignment\r
+ text = new FeaturesFile().printGFFFormat(ap.av.getAlignment()\r
.getDataset().getSequencesArray(),\r
getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
}\r
else\r
{\r
- text = new FeaturesFile().printJalviewFormat(ap.av.alignment\r
+ text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()\r
.getDataset().getSequencesArray(),\r
getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());\r
}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
void getSelectedRow(int y)
{
int height = 0;
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
selectedRow = -2;
if (aa != null)
{
*/
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
if (evt.getActionCommand().equals(ADDNEW))
{
AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null,
- null, new Annotation[ap.av.alignment.getWidth()]);
+ null, new Annotation[ap.av.getAlignment().getWidth()]);
if (!editLabelDescription(newAnnotation))
{
return;
}
- ap.av.alignment.addAnnotation(newAnnotation);
- ap.av.alignment.setAnnotationIndex(newAnnotation, 0);
+ ap.av.getAlignment().addAnnotation(newAnnotation);
+ ap.av.getAlignment().setAnnotationIndex(newAnnotation, 0);
}
else if (evt.getActionCommand().equals(EDITNAME))
{
}
else if (evt.getActionCommand().equals(DELETE))
{
- ap.av.alignment.deleteAnnotation(aa[selectedRow]);
+ ap.av.getAlignment().deleteAnnotation(aa[selectedRow]);
}
else if (evt.getActionCommand().equals(SHOWALL))
{
if (start != end)
{
// Swap these annotations
- AlignmentAnnotation startAA = ap.av.alignment
+ AlignmentAnnotation startAA = ap.av.getAlignment()
.getAlignmentAnnotation()[start];
if (end == -1)
{
- end = ap.av.alignment.getAlignmentAnnotation().length - 1;
+ end = ap.av.getAlignment().getAlignmentAnnotation().length - 1;
}
- AlignmentAnnotation endAA = ap.av.alignment.getAlignmentAnnotation()[end];
+ AlignmentAnnotation endAA = ap.av.getAlignment().getAlignmentAnnotation()[end];
- ap.av.alignment.getAlignmentAnnotation()[end] = startAA;
- ap.av.alignment.getAlignmentAnnotation()[start] = endAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA;
+ ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA;
}
resizePanel = false;
getSelectedRow(evt.getY() - scrollOffset);
if (selectedRow > -1
- && ap.av.alignment.getAlignmentAnnotation().length > selectedRow)
+ && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow)
{
- AlignmentAnnotation aa = ap.av.alignment.getAlignmentAnnotation()[selectedRow];
+ AlignmentAnnotation aa = ap.av.getAlignment().getAlignmentAnnotation()[selectedRow];
StringBuffer desc = new StringBuffer();
if (aa.description != null
*/
public void mouseClicked(MouseEvent evt)
{
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
if (SwingUtilities.isLeftMouseButton(evt))
{
if (selectedRow > -1 && selectedRow < aa.length)
}
});
pop.add(cprofl);
+ final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem(
+ "Normalise Group Logo",
+ aa[selectedRow].groupRef.isNormaliseSequenceLogo());
+ cproflnorm.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState());
+ // automatically enable logo display if we're clicked
+ aaa.groupRef.setshowSequenceLogo(true);
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cproflnorm);
}
else
{
// can be
// updated.
av.setShowConsensusHistogram(chist.getState());
+ ap.alignFrame.setMenusForViewport();
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
// can be
// updated.
av.setShowSequenceLogo(cprof.getState());
+ ap.alignFrame.setMenusForViewport();
ap.repaint();
// ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
}
});
pop.add(cprof);
+ final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem(
+ "Normalise Logo", av.isNormaliseSequenceLogo());
+ cprofnorm.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: pass on reference
+ // to ap
+ // so the
+ // view
+ // can be
+ // updated.
+ av.setShowSequenceLogo(true);
+ av.setNormaliseSequenceLogo(cprofnorm.getState());
+ ap.alignFrame.setMenusForViewport();
+ ap.repaint();
+ // ap.annotationPanel.paint(ap.annotationPanel.getGraphics());
+ }
+ });
+ pop.add(cprofnorm);
}
final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ);
consclipbrd.addActionListener(this);
sq.setDatasetSequence(dseqs[0]);
}
Alignment ds = new Alignment(dseqs);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
omitHidden = av.getColumnSelection().getVisibleSequenceStrings(0,
sq.getLength(), seqs);
.setContents(new StringSelection(output), Desktop.instance);
Vector hiddenColumns = null;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
hiddenColumns = new Vector();
for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
g.translate(0, scrollOffset);
g.setColor(Color.black);
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int fontHeight = g.getFont().getSize();
int y = 0;
int x = 0;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import java.awt.*;
import java.awt.event.*;
-import java.awt.font.LineMetrics;
-import java.awt.geom.AffineTransform;
import java.awt.image.*;
-import java.util.Hashtable;
-
import javax.swing.*;
-import jalview.analysis.AAFrequency;
import jalview.datamodel.*;
-import jalview.schemes.ColourSchemeI;
+import jalview.renderer.AnnotationRenderer;
+import jalview.renderer.AwtRenderPanelI;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
-public class AnnotationPanel extends JPanel implements MouseListener,
- MouseMotionListener, ActionListener, AdjustmentListener
+public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
+ MouseListener, MouseMotionListener, ActionListener,
+ AdjustmentListener
{
final String HELIX = "Helix";
final String SHEET = "Sheet";
+ /**
+ * For RNA secondary structure "stems" aka helices
+ */
+ final String STEM = "RNA Helix";
+
final String LABEL = "Label";
final String REMOVE = "Remove Annotation";
final String COLOUR = "Colour";
- final Color HELIX_COLOUR = Color.red.darker();
+ public final Color HELIX_COLOUR = Color.red.darker();
+
+ public final Color SHEET_COLOUR = Color.green.darker().darker();
- final Color SHEET_COLOUR = Color.green.darker().darker();
+ public final Color STEM_COLOUR = Color.blue.darker();
/** DOCUMENT ME!! */
- AlignViewport av;
+ public AlignViewport av;
AlignmentPanel ap;
- int activeRow = -1;
+ public int activeRow = -1;
- BufferedImage image;
+ public BufferedImage image;
- BufferedImage fadedImage;
+ public volatile BufferedImage fadedImage;
Graphics2D gg;
- FontMetrics fm;
+ public FontMetrics fm;
- int imgWidth = 0;
+ public int imgWidth = 0;
boolean fastPaint = false;
boolean MAC = false;
+ // for editing cursor
+ int cursorX = 0;
+
+ int cursorY = 0;
+
+ public final AnnotationRenderer renderer;
+
/**
* Creates a new AnnotationPanel object.
- *
+ *
* @param ap
* DOCUMENT ME!
*/
addMouseMotionListener(this);
ap.annotationScroller.getVerticalScrollBar()
.addAdjustmentListener(this);
+ renderer = new AnnotationRenderer();
}
public AnnotationPanel(AlignViewport av)
{
this.av = av;
+ renderer = new AnnotationRenderer();
}
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
ap.alabels.setScrollOffset(-evt.getValue());
* Calculates the height of the annotation displayed in the annotation panel.
* Callers should normally call the ap.adjustAnnotationHeight method to ensure
* all annotation associated components are updated correctly.
- *
+ *
*/
public int adjustPanelHeight()
{
- int height=calcPanelHeight();
+ int height = calcPanelHeight();
this.setPreferredSize(new Dimension(1, height));
if (ap != null)
{
}
/**
- * calculate the height for visible annotation, revalidating bounds where necessary
- * ABSTRACT GUI METHOD
+ * calculate the height for visible annotation, revalidating bounds where
+ * necessary ABSTRACT GUI METHOD
+ *
* @return total height of annotation
*/
public int calcPanelHeight()
{
// setHeight of panels
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
int height = 0;
if (aa != null)
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void actionPerformed(ActionEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
symbol = "\u03B2";
}
+ // Added by LML to color stems
+ else if (evt.getActionCommand().equals(STEM))
+ {
+ type = 'S';
+ symbol = "\u03C3";
+ }
+
if (!aa[activeRow].hasIcons)
{
aa[activeRow].hasIcons = true;
{
int index = av.getColumnSelection().columnAt(i);
- if (!av.colSel.isVisible(index))
+ if (!av.getColumnSelection().isVisible(index))
continue;
if (anot[index] == null)
anot[index].displayCharacter = label;
}
}
+ aa[activeRow].validateRangeAndDisplay();
adjustPanelHeight();
repaint();
{
String collatedInput = "";
String last = "";
+ ColumnSelection viscols=av.getColumnSelection();
+ // TODO: refactor and save av.getColumnSelection for efficiency
for (int i = 0; i < columnSelection.size(); i++)
{
int index = columnSelection.columnAt(i);
// always check for current display state - just in case
- if (!av.colSel.isVisible(index))
+ if (!viscols.isVisible(index))
continue;
String tlabel = null;
if (anot[index] != null)
- {
+ { // LML added stem code
if (label2.equals(HELIX) || label2.equals(SHEET)
- || label2.equals(LABEL))
+ || label2.equals(STEM) || label2.equals(LABEL))
{
tlabel = anot[index].description;
if (tlabel == null || tlabel.length() < 1)
{
- if (label2.equals(HELIX) || label2.equals(SHEET))
+ if (label2.equals(HELIX) || label2.equals(SHEET)
+ || label2.equals(STEM))
{
tlabel = "" + anot[index].secondaryStructure;
}
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
return;
}
JPopupMenu pop = new JPopupMenu("Structure type");
- JMenuItem item = new JMenuItem(HELIX);
- item.addActionListener(this);
- pop.add(item);
- item = new JMenuItem(SHEET);
- item.addActionListener(this);
- pop.add(item);
+ JMenuItem item;
+ /*
+ * Just display the needed structure options
+ */
+ if (av.getAlignment().isNucleotide() == true)
+ {
+ item = new JMenuItem(STEM);
+ item.addActionListener(this);
+ pop.add(item);
+ }
+ else
+ {
+ item = new JMenuItem(HELIX);
+ item.addActionListener(this);
+ pop.add(item);
+ item = new JMenuItem(SHEET);
+ item.addActionListener(this);
+ pop.add(item);
+ }
item = new JMenuItem(LABEL);
item.addActionListener(this);
pop.add(item);
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent evt)
{
graphStretch = -1;
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent evt)
{
ap.scalePanel.mouseEntered(evt);
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent evt)
{
ap.scalePanel.mouseExited(evt);
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (graphStretch > -1)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY
- evt.getY();
- if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
+ if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0)
{
- av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
+ av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0;
}
graphStretchY = evt.getY();
adjustPanelHeight();
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent evt)
{
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
if (aa == null)
{
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
if (row > -1 && aa[row].annotations != null
- && res < (int) aa[row].annotations.length)
+ && res < aa[row].annotations.length)
{
if (aa[row].graphGroup > -1)
{
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseClicked(MouseEvent evt)
{
+ if (activeRow != -1)
+ {
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
+ AlignmentAnnotation anot = aa[activeRow];
+
+ if (anot.description.equals("secondary structure"))
+ {
+ // System.out.println(anot.description+" "+anot.getRNAStruc());
+ }
+ }
}
+ // TODO mouseClicked-content and drawCursor are quite experimental!
+ public void drawCursor(Graphics graphics, SequenceI seq, int res, int x1,
+ int y1)
+ {
+ int pady = av.charHeight / 5;
+ int charOffset = 0;
+ graphics.setColor(Color.black);
+ graphics.fillRect(x1, y1, av.charWidth, av.charHeight);
+
+ if (av.validCharWidth)
+ {
+ graphics.setColor(Color.white);
+
+ char s = seq.getCharAt(res);
+
+ charOffset = (av.charWidth - fm.charWidth(s)) / 2;
+ graphics.drawString(String.valueOf(s), charOffset + x1,
+ (y1 + av.charHeight) - pady);
+ }
+
+ }
+ private volatile boolean imageFresh=false;
/**
* DOCUMENT ME!
- *
+ *
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
g.setColor(Color.white);
fm = gg.getFontMetrics();
gg.setColor(Color.white);
gg.fillRect(0, 0, imgWidth, image.getHeight());
+ imageFresh=true;
}
drawComponent(gg, av.startRes, av.endRes + 1);
+ imageFresh=false;
g.drawImage(image, 0, 0, this);
}
/**
* non-Thread safe repaint
- *
+ *
* @param horizontal
* repaint with horizontal shift in alignment
*/
{
if ((horizontal == 0) || gg == null
- || av.alignment.getAlignmentAnnotation() == null
- || av.alignment.getAlignmentAnnotation().length < 1
- || av.updatingConsensus || av.updatingConservation)
+ || av.getAlignment().getAlignmentAnnotation() == null
+ || av.getAlignment().getAlignmentAnnotation().length < 1
+ || av.isCalcInProgress())
{
repaint();
return;
repaint();
}
-
+ private volatile boolean lastImageGood=false;
/**
* DOCUMENT ME!
- *
+ *
* @param g
* DOCUMENT ME!
* @param startRes
*/
public void drawComponent(Graphics g, int startRes, int endRes)
{
- if (av.updatingConsensus || av.updatingConservation)
+ BufferedImage oldFaded=fadedImage;
+ if (av.isCalcInProgress())
{
if (image == null)
{
+ lastImageGood=false;
return;
}
// We'll keep a record of the old image,
// and draw a faded image until the calculation
// has completed
- if (fadedImage == null || fadedImage.getWidth() != imgWidth
- || fadedImage.getHeight() != image.getHeight())
+ if (lastImageGood && (fadedImage == null || fadedImage.getWidth() != imgWidth
+ || fadedImage.getHeight() != image.getHeight()))
{
+// System.err.println("redraw faded image ("+(fadedImage==null ? "null image" : "") + " lastGood="+lastImageGood+")");
fadedImage = new BufferedImage(imgWidth, image.getHeight(),
BufferedImage.TYPE_INT_RGB);
fadedG.drawImage(image, 0, 0, this);
}
+ // make sure we don't overwrite the last good faded image until all calculations have finished
+ lastImageGood=false;
}
else
{
+ if (fadedImage!=null)
+ {
+ oldFaded=fadedImage;
+ }
fadedImage = null;
}
fm = g.getFontMetrics();
}
- if ((av.alignment.getAlignmentAnnotation() == null)
- || (av.alignment.getAlignmentAnnotation().length < 1))
+ if ((av.getAlignment().getAlignmentAnnotation() == null)
+ || (av.getAlignment().getAlignmentAnnotation().length < 1))
{
g.setColor(Color.white);
g.fillRect(0, 0, getWidth(), getHeight());
return;
}
-
- AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
-
- int x = 0, y = 0;
- int column = 0;
- char lastSS;
- int lastSSX;
- int iconOffset = 0;
- boolean validRes = false;
- boolean validEnd = false;
- boolean labelAllCols = false;
- boolean centreColLabels, centreColLabelsDef = av
- .getCentreColumnLabels();
- boolean scaleColLabel = false;
- boolean[] graphGroupDrawn = new boolean[aa.length];
- int charOffset = 0; // offset for a label
- float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
- // column.
- Font ofont = g.getFont();
- // \u03B2 \u03B1
- for (int i = 0; i < aa.length; i++)
- {
- AlignmentAnnotation row = aa[i];
-
- if (!row.visible)
- {
- continue;
- }
- centreColLabels = row.centreColLabels || centreColLabelsDef;
- labelAllCols = row.showAllColLabels;
- scaleColLabel = row.scaleColLabel;
- lastSS = ' ';
- lastSSX = 0;
-
- if (row.graph > 0)
- {
- if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
- {
- continue;
- }
-
- // this is so that we draw the characters below the graph
- y += row.height;
-
- if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
- y -= av.charHeight;
- }
- }
- else if (row.hasText)
- {
- iconOffset = av.charHeight - fm.getDescent();
-
- }
- else
- {
- iconOffset = 0;
- }
-
- if (av.updatingConsensus && aa[i] == av.consensus)
- {
- y += av.charHeight;
-
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
- g.setColor(Color.black);
- // g.drawString("Calculating Consensus....",20, y-row.height/2);
-
- continue;
- }
- else if (av.updatingConservation
- && aa[i].label.equals("Conservation"))
- {
-
- y += av.charHeight;
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
-
- g.setColor(Color.black);
- // g.drawString("Calculating Conservation.....",20, y-row.height/2);
-
- continue;
- }
- else if (av.updatingConservation && aa[i].label.equals("Quality"))
- {
-
- y += av.charHeight;
- g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
- - row.height, imgWidth, y, this);
- g.setColor(Color.black);
- // / g.drawString("Calculating Quality....",20, y-row.height/2);
-
- continue;
- }
-
- x = 0;
- while (x < endRes - startRes)
- {
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(
- startRes + x);
- if (column > row.annotations.length - 1)
- {
- break;
- }
- }
- else
- {
- column = startRes + x;
- }
-
- if ((row.annotations == null) || (row.annotations.length <= column)
- || (row.annotations[column] == null))
- {
- validRes = false;
- }
- else
- {
- validRes = true;
- }
-
- if (activeRow == i)
- {
- g.setColor(Color.red);
-
- if (av.getColumnSelection() != null)
- {
- for (int n = 0; n < av.getColumnSelection().size(); n++)
- {
- int v = av.getColumnSelection().columnAt(n);
-
- if (v == column)
- {
- g.fillRect(x * av.charWidth, y, av.charWidth, av.charHeight);
- }
- }
- }
- }
-
- if (av.validCharWidth && validRes
- && row.annotations[column].displayCharacter != null
- && (row.annotations[column].displayCharacter.length() > 0))
- {
-
- if (centreColLabels || scaleColLabel)
- {
- fmWidth = (float) fm.charsWidth(
- row.annotations[column].displayCharacter.toCharArray(),
- 0, row.annotations[column].displayCharacter.length());
-
- if (scaleColLabel)
- {
- // justify the label and scale to fit in column
- if (fmWidth > av.charWidth)
- {
- // scale only if the current font isn't already small enough
- fmScaling = av.charWidth;
- fmScaling /= fmWidth;
- g.setFont(ofont.deriveFont(AffineTransform
- .getScaleInstance(fmScaling, 1.0)));
- // and update the label's width to reflect the scaling.
- fmWidth = av.charWidth;
- }
- }
- }
- else
- {
- fmWidth = (float) fm
- .charWidth(row.annotations[column].displayCharacter
- .charAt(0));
- }
- charOffset = (int) ((av.charWidth - fmWidth) / 2f);
-
- if (row.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(row.annotations[column].colour);
-
- if (column == 0 || row.graph > 0)
- {
- g.drawString(row.annotations[column].displayCharacter,
- (x * av.charWidth) + charOffset, y + iconOffset);
- }
- else if (row.annotations[column - 1] == null
- || (labelAllCols
- || !row.annotations[column].displayCharacter
- .equals(row.annotations[column - 1].displayCharacter) || (row.annotations[column].displayCharacter
- .length() < 2 && row.annotations[column].secondaryStructure == ' ')))
- {
- g.drawString(row.annotations[column].displayCharacter, x
- * av.charWidth + charOffset, y + iconOffset);
- }
- g.setFont(ofont);
- }
-
- if (row.hasIcons)
- {
- if (!validRes
- || (row.annotations[column].secondaryStructure != lastSS))
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset,
- (x * av.charWidth) - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0
- || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
- 180);
- x1 += av.charWidth / 2;
- }
-
- if (!validRes || row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth, y + 4
- + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
- 3);
-
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
-
- if (validRes)
- {
- lastSS = row.annotations[column].secondaryStructure;
- }
- else
- {
- lastSS = ' ';
- }
-
- lastSSX = (x * av.charWidth);
- }
- }
-
- column++;
- x++;
- }
-
- if (column >= row.annotations.length)
- {
- column = row.annotations.length - 1;
- validEnd = false;
- }
- else
- {
- validEnd = true;
- }
-
- // x ++;
-
- if (row.hasIcons)
- {
- switch (lastSS)
- {
- case 'H':
- g.setColor(HELIX_COLOUR);
- if (MAC)
- {
- // Off by 1 offset when drawing rects and ovals
- // to offscreen image on the MAC
- g.fillRoundRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX, 7, 8, 8);
- break;
- }
-
- int sCol = (lastSSX / av.charWidth) + startRes;
- int x1 = lastSSX;
- int x2 = (x * av.charWidth);
-
- if (sCol == 0 || row.annotations[sCol - 1] == null
- || row.annotations[sCol - 1].secondaryStructure != 'H')
- {
- g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
- x1 += av.charWidth / 2;
- }
-
- if (row.annotations[column] == null
- || row.annotations[column].secondaryStructure != 'H')
- {
- g.fillArc((x * av.charWidth) - av.charWidth,
- y + 4 + iconOffset, av.charWidth, 8, 270, 180);
- x2 -= av.charWidth / 2;
- }
-
- g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
-
- break;
-
- case 'E':
- g.setColor(SHEET_COLOUR);
-
- if (!validEnd || row.annotations[endRes] == null
- || row.annotations[endRes].secondaryStructure != 'E')
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x * av.charWidth)
- - lastSSX - 4, 7);
- g.fillPolygon(new int[]
- { (x * av.charWidth) - 4, (x * av.charWidth) - 4,
- (x * av.charWidth) }, new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset }, 3);
- }
- else
- {
- g.fillRect(lastSSX, y + 4 + iconOffset, (x + 1) * av.charWidth
- - lastSSX, 7);
- }
- break;
-
- default:
- g.setColor(Color.gray);
- g.fillRect(lastSSX, y + 6 + iconOffset, (x * av.charWidth)
- - lastSSX, 2);
-
- break;
- }
- }
-
- if (row.graph > 0 && row.graphHeight > 0)
- {
- if (row.graph == AlignmentAnnotation.LINE_GRAPH)
- {
- if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
- {
- float groupmax = -999999, groupmin = 9999999;
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup != row.graphGroup)
- {
- continue;
- }
-
- if (aa[gg] != row)
- {
- aa[gg].visible = false;
- }
-
- if (aa[gg].graphMax > groupmax)
- {
- groupmax = aa[gg].graphMax;
- }
- if (aa[gg].graphMin < groupmin)
- {
- groupmin = aa[gg].graphMin;
- }
- }
-
- for (int gg = 0; gg < aa.length; gg++)
- {
- if (aa[gg].graphGroup == row.graphGroup)
- {
- drawLineGraph(g, aa[gg], startRes, endRes, y, groupmin,
- groupmax, row.graphHeight);
- }
- }
-
- graphGroupDrawn[row.graphGroup] = true;
- }
- else
- {
- drawLineGraph(g, row, startRes, endRes, y, row.graphMin,
- row.graphMax, row.graphHeight);
- }
- }
- else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
- {
- drawBarGraph(g, row, startRes, endRes, row.graphMin,
- row.graphMax, y);
- }
- }
-
- if (row.graph > 0 && row.hasText)
- {
- y += av.charHeight;
- }
-
- if (row.graph == 0)
- {
- y += aa[i].height;
- }
- }
- }
-
- public void drawLineGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, int y, float min, float max, int graphHeight)
- {
- if (sRes > aa.annotations.length)
- {
- return;
- }
-
- int x = 0;
-
- // Adjustment for fastpaint to left
- if (eRes < av.endRes)
- {
- eRes++;
- }
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- if (sRes == 0)
- {
- x++;
- }
-
- int y1 = y, y2 = y;
- float range = max - min;
-
- // //Draw origin
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / range) * graphHeight);
- }
-
- g.setColor(Color.gray);
- g.drawLine(x - av.charWidth, y2, (eRes - sRes + 1) * av.charWidth, y2);
-
- eRes = Math.min(eRes, aa.annotations.length);
-
- int column;
- int aaMax = aa.annotations.length - 1;
-
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null
- || aa.annotations[column - 1] == null)
- {
- x++;
- continue;
- }
-
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column - 1].value - min) / range) * graphHeight);
- y2 = y
- - (int) (((aa.annotations[column].value - min) / range) * graphHeight);
-
- g.drawLine(x * av.charWidth - av.charWidth / 2, y1, x * av.charWidth
- + av.charWidth / 2, y2);
- x++;
- }
-
- if (aa.threshold != null)
+ lastImageGood = renderer.drawComponent(this, av, g, activeRow, startRes, endRes);
+ if (!lastImageGood && fadedImage==null)
{
- g.setColor(aa.threshold.colour);
- Graphics2D g2 = (Graphics2D) g;
- g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- g2.setStroke(new BasicStroke());
+ fadedImage=oldFaded;
}
}
- public void drawBarGraph(Graphics g, AlignmentAnnotation aa, int sRes,
- int eRes, float min, float max, int y)
+ @Override
+ public FontMetrics getFontMetrics()
{
- ColourSchemeI profcolour = av.getGlobalColourScheme();
- if (profcolour == null)
- {
- profcolour = new jalview.schemes.ZappoColourScheme();
- }
- if (sRes > aa.annotations.length)
- {
- return;
- }
- Font ofont = g.getFont();
- eRes = Math.min(eRes, aa.annotations.length);
-
- int x = 0, y1 = y, y2 = y;
-
- float range = max - min;
-
- if (min < 0)
- {
- y2 = y - (int) ((0 - min / (range)) * aa.graphHeight);
- }
-
- g.setColor(Color.gray);
-
- g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
-
- int column;
- int aaMax = aa.annotations.length - 1;
- boolean renderHistogram = true, renderProfile = true;
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- {
- // TODO: generalise this to have render styles for consensus/profile data
- if (aa.groupRef != null)
- {
- renderHistogram = aa.groupRef.isShowConsensusHistogram();
- renderProfile = aa.groupRef.isShowSequenceLogo();
- }
- else
- {
- renderHistogram = av.isShowConsensusHistogram();
- renderProfile = av.isShowSequenceLogo();
- }
- }
- while (x < eRes - sRes)
- {
- column = sRes + x;
- if (av.hasHiddenColumns)
- {
- column = av.getColumnSelection().adjustForHiddenColumns(column);
- }
-
- if (column > aaMax)
- {
- break;
- }
-
- if (aa.annotations[column] == null)
- {
- x++;
- continue;
- }
- if (aa.annotations[column].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[column].colour);
-
- y1 = y
- - (int) (((aa.annotations[column].value - min) / (range)) * aa.graphHeight);
-
- if (renderHistogram)
- {
- if (y1 - y2 > 0)
- {
- g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
- }
- else
- {
- g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
- }
- }
- // draw profile if available
- if (renderProfile && aa.annotations[column].value != 0)
- {
- int profl[] = getProfileFor(aa, column);
- int ht = y1, htn = y2 - y1;// aa.graphHeight;
- float wdth;
- double ht2 = 0;
- char[] dc = new char[1];
- LineMetrics lm;
- for (int c = 1; profl != null && c < profl[0];)
- {
- dc[0] = (char) profl[c++];
- wdth = av.charWidth;
- wdth /= (float) fm.charsWidth(dc, 0, 1);
-
- if (c > 2)
- {
- ht += (int) ht2;
- }
- {
- // if (aa.annotations[column].value==0) {
- // g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(wdth,
- // (ht2=(aa.graphHeight*0.1/av.charHeight)))));
- // ht = y2-(int)ht2;
- // } else {
- g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
- wdth, (ht2 = (htn * ((double) profl[c++]) / 100.0))
- / av.charHeight)));
- lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
- // htn -=ht2;
- // }
- g.setColor(profcolour.findColour(dc[0])); // (av.globalColourScheme!=null)
- // ? );// try to get a
- // colourscheme for the
- // group(aa.groupRef.cs==null)
- // ? av.textColour2 :
- // cs.findColour(dc));
- g.drawChars(dc, 0, 1, x * av.charWidth,
- (int) (ht + lm.getHeight()));
- // ht+=g.getFontMetrics().getAscent()-g.getFontMetrics().getDescent();
- }
- }
- g.setFont(ofont);
- }
- x++;
- }
- if (aa.threshold != null)
- {
- g.setColor(aa.threshold.colour);
- Graphics2D g2 = (Graphics2D) g;
- g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_ROUND, 3f, new float[]
- { 5f, 3f }, 0f));
-
- y2 = (int) (y - ((aa.threshold.value - min) / range) * aa.graphHeight);
- g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
- g2.setStroke(new BasicStroke());
- }
+ return fm;
}
- private int[] getProfileFor(AlignmentAnnotation aa, int column)
+ @Override
+ public Image getFadedImage()
{
- if (aa.autoCalculated && aa.label.startsWith("Consensus"))
- {
- if (aa.groupRef != null && aa.groupRef.consensusData != null
- && aa.groupRef.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(
- aa.groupRef.consensusData[column],
- aa.groupRef.getIgnoreGapsConsensus());
- }
- // TODO extend annotation row to enable dynamic and static profile data to
- // be stored
- if (aa.groupRef == null && aa.sequenceRef == null
- && av.isShowSequenceLogo())
- {
- return AAFrequency.extractProfile(av.hconsensus[column],
- av.getIgnoreGapsConsensus());
- }
- }
- return null;
+ return fadedImage;
}
- // used by overview window
- public void drawGraph(Graphics g, AlignmentAnnotation aa, int width,
- int y, int sRes, int eRes)
+ @Override
+ public int getFadedImageWidth()
{
- eRes = Math.min(eRes, aa.annotations.length);
- g.setColor(Color.white);
- g.fillRect(0, 0, width, y);
- g.setColor(new Color(0, 0, 180));
-
- int x = 0, height;
-
- for (int j = sRes; j < eRes; j++)
- {
- if (aa.annotations[j] != null)
- {
- if (aa.annotations[j].colour == null)
- g.setColor(Color.black);
- else
- g.setColor(aa.annotations[j].colour);
-
- height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
- if (height > y)
- {
- height = y;
- }
-
- g.fillRect(x, y - height, av.charWidth, height);
- }
- x += av.charWidth;
- }
+ return imgWidth;
}
-
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.datamodel.PDBEntry;
import jalview.io.*;
import jalview.schemes.*;
+import jalview.util.Platform;
public class AppJmol extends GStructureViewer implements Runnable,
SequenceStructureBinding, ViewSetProvider
openNewJmol(ap, new PDBEntry[] { pdbentry }, new SequenceI[][] { seq });
}
private void openNewJmol(AlignmentPanel ap, PDBEntry[] pdbentrys, SequenceI[][] seqs) {
- boolean promptUser=pdbentrys.length==1;
progressBar = ap.alignFrame;
jmb = new AppJmolBinding(this, ap.getStructureSelectionManager(), pdbentrys, seqs, null, null);
addAlignmentPanel(ap);
setSize(400, 400); // probably should be a configurable/dynamic default here
initMenus();
worker=null;
- String filelist="";
-// for (PDBEntry pe: pdbentrys)
-// {
-// if (pe.getFile()==null)
{
addingStructures = false;
worker = new Thread(this);
worker.start();
-// break;
}
-// filelist+=" \""+pe.getFile()+"\"";
-
-/* }
- if (worker==null)
- {
- initJmol("load"+(pdbentrys.length>1 ? " APPEND" : "") + filelist);
- }
-*/
this.addInternalFrameListener(new InternalFrameAdapter()
{
public void internalFrameClosing(InternalFrameEvent internalFrameEvent)
{
// just transfer the file name from the first sequence's first
// PDBEntry
- jmb.pdbentry[pi].setFile(file = ((PDBEntry) pdbseq
- .getSequenceAt(0).getPDBId().elementAt(0)).getFile());
- files.append(" \"" + file + "\"");
+ file = new File(((PDBEntry) pdbseq
+ .getSequenceAt(0).getPDBId().elementAt(0)).getFile()).getAbsolutePath();
+ jmb.pdbentry[pi].setFile(file);
+
+ files.append(" \"" + Platform.escapeString(file) + "\"");
}
else
{
}
if (file != null)
{
- files.append(" \"" + file + "\"");
+ files.append(" \"" + Platform.escapeString(file) + "\"");
}
}
}
buriedColour.setSelected(true);
jmb.setJalviewColourScheme(new BuriedColourScheme());
}
-
+
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+ setJalviewColourScheme(new PurinePyrimidineColourScheme());
+ }
+
public void userColour_actionPerformed(ActionEvent actionEvent)
{
userColour.setSelected(true);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.awt.*;
+
+import javax.swing.*;
+import javax.swing.event.*;
+
+import java.awt.event.*;
+import java.io.*;
+
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.SequenceStructureBinding;
+import jalview.bin.Cache;
+import jalview.datamodel.*;
+import jalview.gui.ViewSelectionMenu.ViewSetProvider;
+import jalview.structure.*;
+import jalview.io.*;
+import jalview.schemes.*;
+import jalview.util.ShiftList;
+import fr.orsay.lri.varna.VARNAPanel;
+import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener;
+import fr.orsay.lri.varna.models.BaseList;
+import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
+import fr.orsay.lri.varna.models.rna.ModeleBase;
+import fr.orsay.lri.varna.models.rna.ModeleBaseNucleotide;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarna extends JInternalFrame implements
+ InterfaceVARNAListener, SelectionListener,
+ SecondaryStructureListener// implements
+ // Runnable,SequenceStructureBinding,
+ // ViewSetProvider
+ , InterfaceVARNASelectionListener, VamsasSource
+
+{
+ AppVarnaBinding vab;
+
+ VARNAPanel varnaPanel;
+
+ public String name;
+
+ public StructureSelectionManager ssm;
+
+ /*
+ * public AppVarna(){ vab = new AppVarnaBinding(); initVarna(); }
+ */
+
+ AlignmentPanel ap;
+
+ public AppVarna(String sname, SequenceI seq, String strucseq, String struc,
+ String name, AlignmentPanel ap)
+ {
+ this.ap = ap;
+ ArrayList<RNA> rnaList = new ArrayList<RNA>();
+ RNA rna1 = new RNA(name);
+ try
+ {
+ rna1.setRNA(strucseq, replaceOddGaps(struc));
+ } catch (ExceptionUnmatchedClosingParentheses e2)
+ {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3)
+ {
+ e3.printStackTrace();
+ }
+ RNA trim = trimRNA(rna1, "trimmed "+sname);
+ rnaList.add(trim);
+ rnaList.add(rna1);
+ rnas.put(seq, rna1);
+ rnas.put(seq, trim);
+ rna1.setName(sname+" (with gaps)");
+
+ {
+ seqs.put(trim, seq);
+ seqs.put(rna1, seq);
+
+ /**
+ * if (false || seq.getStart()!=1) { for (RNA rshift:rnaList) { ShiftList
+ * shift=offsets.get(rshift); if (shift==null) { offsets.put(rshift,
+ * shift=new ShiftList());} shift.addShift(1, seq.getStart()-1);
+ * offsetsInv.put(rshift, shift.getInverse()); } }
+ **/
+ }
+ vab = new AppVarnaBinding(rnaList);
+ // vab = new AppVarnaBinding(seq,struc);
+ // System.out.println("Hallo: "+name);
+ this.name = sname+" trimmed to "+name;
+ initVarna();
+ ssm = ap.getStructureSelectionManager();
+ ssm.addStructureViewerListener(this);
+ ssm.addSelectionListener(this);
+ }
+
+ public void initVarna()
+ {
+ // vab.setFinishedInit(false);
+ varnaPanel = vab.get_varnaPanel();
+ setBackground(Color.white);
+ JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true,
+ vab.getListPanel(), varnaPanel);
+ getContentPane().setLayout(new BorderLayout());
+ getContentPane().add(split, BorderLayout.CENTER);
+ // getContentPane().add(vab.getTools(), BorderLayout.NORTH);
+ varnaPanel.addVARNAListener(this);
+ varnaPanel.addSelectionListener(this);
+ jalview.gui.Desktop.addInternalFrame(this, "VARNA -" + name,
+ getBounds().width, getBounds().height);
+ this.pack();
+ showPanel(true);
+ }
+
+ public String replaceOddGaps(String oldStr)
+ {
+ String patternStr = "[^([{<>}])]";
+ String replacementStr = ".";
+ Pattern pattern = Pattern.compile(patternStr);
+ Matcher matcher = pattern.matcher(oldStr);
+ String newStr = matcher.replaceAll(replacementStr);
+ return newStr;
+ }
+
+ public RNA trimRNA(RNA rna, String name)
+ {
+ ShiftList offset = new ShiftList();
+ RNA rnaTrim = new RNA(name);
+ try
+ {
+ rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(rna.getStructDBN()));
+ } catch (ExceptionUnmatchedClosingParentheses e2)
+ {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3)
+ {
+ e3.printStackTrace();
+ }
+
+ StringBuffer seq = new StringBuffer(rnaTrim.getSeq());
+ StringBuffer struc = new StringBuffer(rnaTrim.getStructDBN());
+ int ofstart = -1, sleng = rnaTrim.getSeq().length();
+ for (int i = 0; i < sleng; i++)
+ {
+ // TODO: Jalview utility for gap detection java.utils.isGap()
+ // TODO: Switch to jalview rna datamodel
+ if (jalview.util.Comparison.isGap(seq.charAt(i)))
+ {
+ if (ofstart == -1)
+ {
+ ofstart = i;
+ }
+ if (!rnaTrim.findPair(i).isEmpty())
+ {
+ int m = rnaTrim.findPair(i).get(1);
+ int l = rnaTrim.findPair(i).get(0);
+
+ struc.replace(m, m + 1, "*");
+ struc.replace(l, l + 1, "*");
+ }
+ else
+ {
+ struc.replace(i, i + 1, "*");
+ }
+ }
+ else
+ {
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - i);
+ ofstart = -1;
+ }
+ }
+ }
+ // final gap
+ if (ofstart > -1)
+ {
+ offset.addShift(offset.shift(ofstart), ofstart - sleng);
+ ofstart = -1;
+ }
+ String newSeq = rnaTrim.getSeq().replace("-", "");
+ rnaTrim.getSeq().replace(".", "");
+ String newStruc = struc.toString().replace("*", "");
+
+ try
+ {
+ rnaTrim.setRNA(newSeq, newStruc);
+ registerOffset(rnaTrim, offset);
+ } catch (ExceptionUnmatchedClosingParentheses e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return rnaTrim;
+ }
+
+ // needs to be many-many
+ Map<RNA, SequenceI> seqs = new Hashtable<RNA, SequenceI>();
+
+ Map<SequenceI, RNA> rnas = new Hashtable<SequenceI, RNA>();
+
+ Map<RNA, ShiftList> offsets = new Hashtable<RNA, ShiftList>();
+
+ Map<RNA, ShiftList> offsetsInv = new Hashtable<RNA, ShiftList>();
+
+ private void registerOffset(RNA rnaTrim, ShiftList offset)
+ {
+ offsets.put(rnaTrim, offset);
+ offsetsInv.put(rnaTrim, offset.getInverse());
+ }
+
+ public void showPanel(boolean show)
+ {
+ this.setVisible(show);
+ }
+
+ private boolean _started = false;
+
+ public void run()
+ {
+ _started = true;
+
+ try
+ {
+ initVarna();
+ } catch (OutOfMemoryError oomerror)
+ {
+ new OOMWarning("When trying to open the Varna viewer!", oomerror);
+ } catch (Exception ex)
+ {
+ Cache.log.error("Couldn't open Varna viewer!", ex);
+ }
+ }
+
+ @Override
+ public void onUINewStructure(VARNAConfig v, RNA r)
+ {
+
+ }
+
+ @Override
+ public void onWarningEmitted(String s)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ private class VarnaHighlighter
+ {
+ private HighlightRegionAnnotation _lastHighlight;
+
+ private RNA _lastRNAhighlighted = null;
+
+ public void highlightRegion(RNA rna, int start, int end)
+ {
+ clearSelection(null);
+ HighlightRegionAnnotation highlight = new HighlightRegionAnnotation(
+ rna.getBasesBetween(start, end));
+ rna.addHighlightRegion(highlight);
+ _lastHighlight = highlight;
+ _lastRNAhighlighted = rna;
+
+ }
+
+ public HighlightRegionAnnotation getLastHighlight()
+ {
+ return _lastHighlight;
+ }
+
+ public RNA getLastRNA()
+ {
+ return _lastRNAhighlighted;
+ }
+
+ public void clearSelection(AppVarnaBinding vab)
+ {
+ if (_lastRNAhighlighted != null)
+ {
+ _lastRNAhighlighted.removeHighlightRegion(_lastHighlight);
+ if (vab != null)
+ {
+ vab.updateSelectedRNA(_lastRNAhighlighted);
+ }
+ _lastRNAhighlighted = null;
+ _lastHighlight = null;
+
+ }
+ }
+ }
+
+ VarnaHighlighter mouseOverHighlighter = new VarnaHighlighter(),
+ selectionHighlighter = new VarnaHighlighter();
+
+ /**
+ * If a mouseOver event from the AlignmentPanel is noticed the currently
+ * selected RNA in the VARNA window is highlighted at the specific position.
+ * To be able to remove it before the next highlight it is saved in
+ * _lastHighlight
+ */
+ @Override
+ public void mouseOverSequence(SequenceI sequence, int index)
+ {
+ RNA rna = vab.getSelectedRNA();
+ if (seqs.get(rna) == sequence)
+ {
+ ShiftList shift = offsets.get(rna);
+ if (shift != null)
+ {
+ // System.err.print("Orig pos:"+index);
+ index = shift.shift(index);
+ // System.err.println("\nFinal pos:"+index);
+ }
+ mouseOverHighlighter.highlightRegion(rna, index, index);
+ vab.updateSelectedRNA(rna);
+ }
+ }
+
+ @Override
+ public void onStructureRedrawn()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void selection(SequenceGroup seqsel, ColumnSelection colsel,
+ SelectionSource source)
+ {
+ if (source != ap.av)
+ {
+ // ignore events from anything but our parent alignpanel
+ // TODO - reuse many-one panel-view system in jmol viewer
+ return;
+ }
+ if (seqsel != null && seqsel.getSize() > 0)
+ {
+ int start = seqsel.getStartRes(), end = seqsel.getEndRes();
+ RNA rna = vab.getSelectedRNA();
+ ShiftList shift = offsets.get(rna);
+ if (shift != null)
+ {
+ start = shift.shift(start);
+ end = shift.shift(end);
+ }
+ selectionHighlighter.highlightRegion(rna, start, end);
+ selectionHighlighter.getLastHighlight().setOutlineColor(
+ seqsel.getOutlineColour());
+ // TODO - translate column markings to positions on structure if present.
+ vab.updateSelectedRNA(rna);
+ }
+ else
+ {
+ selectionHighlighter.clearSelection(vab);
+ }
+ }
+
+ @Override
+ public void onHoverChanged(ModeleBase arg0, ModeleBase arg1)
+ {
+ RNA rna = vab.getSelectedRNA();
+ ShiftList shift = offsetsInv.get(rna);
+ SequenceI seq = seqs.get(rna);
+ if (arg1 != null && seq != null)
+ {
+ if (shift != null)
+ {
+ int i = shift.shift(arg1.getIndex());
+ // System.err.println("shifted "+(arg1.getIndex())+" to "+i);
+ ssm.mouseOverVamsasSequence(seq, i, this);
+ }
+ else
+ {
+ ssm.mouseOverVamsasSequence(seq, arg1.getIndex(), this);
+ }
+ }
+ }
+
+ @Override
+ public void onSelectionChanged(BaseList arg0, BaseList arg1, BaseList arg2)
+ {
+ // TODO translate selected regions in VARNA to a selection on the
+ // alignpanel.
+
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.datatransfer.DataFlavor;
+import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.awt.dnd.DropTargetDragEvent;
+import java.awt.dnd.DropTargetDropEvent;
+import java.awt.dnd.DropTargetEvent;
+import java.awt.dnd.DropTargetListener;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.File;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.DefaultListModel;
+import javax.swing.DefaultListSelectionModel;
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTextField;
+import javax.swing.ListModel;
+import javax.swing.ListSelectionModel;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import fr.orsay.lri.varna.VARNAPanel;
+import fr.orsay.lri.varna.components.ReorderableJList;
+import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
+import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed;
+import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
+import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
+import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
+import fr.orsay.lri.varna.models.FullBackup;
+import fr.orsay.lri.varna.models.VARNAConfig;
+import fr.orsay.lri.varna.models.rna.Mapping;
+import fr.orsay.lri.varna.models.rna.RNA;
+
+public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding
+ implements DropTargetListener, InterfaceVARNAListener,
+ MouseListener
+{
+
+ /**
+ *
+ */
+ // private static final long serialVersionUID = -790155708306987257L;
+
+ private String DEFAULT_SEQUENCE = "CAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIACAGCACGACACUAGCAGUCAGUGUCAGACUGCAIA";
+
+ private String DEFAULT_STRUCTURE1 = "..(((((...(((((...(((((...(((((.....)))))...))))).....(((((...(((((.....)))))...))))).....)))))...)))))..";
+
+ private String DEFAULT_STRUCTURE2 = "..(((((...(((((...(((((........(((((...(((((.....)))))...)))))..................))))).....)))))...)))))..";
+
+ public VARNAPanel vp;
+
+ protected JPanel _tools = new JPanel();
+
+ private JPanel _input = new JPanel();
+
+ private JPanel _seqPanel = new JPanel();
+
+ private JPanel _strPanel = new JPanel();
+
+ private JLabel _info = new JLabel();
+
+ private JTextField _str = new JTextField();
+
+ private JTextField _seq = new JTextField();
+
+ private JLabel _strLabel = new JLabel(" Str:");
+
+ private JLabel _seqLabel = new JLabel(" Seq:");
+
+ private JButton _createButton = new JButton("Create");
+
+ private JButton _updateButton = new JButton("Update");
+
+ private JButton _deleteButton = new JButton("Delete");
+
+ private JButton _duplicateButton = new JButton("Snapshot");
+
+ protected JPanel _listPanel = new JPanel();
+
+ private ReorderableJList _sideList = null;
+
+ private static String errorOpt = "error";
+
+ @SuppressWarnings("unused")
+ private boolean _error;
+
+ private Color _backgroundColor = Color.white;
+
+ private static int _nextID = 1;
+
+ @SuppressWarnings("unused")
+ private int _algoCode;
+
+ private BackupHolder _rnaList;
+
+ /*
+ * public AppVarnaBinding() { //super("VARNA in Jalview");
+ * //this.set_seq("ATGC"); //this.set_str(".()."); //RNAPanelDemoInit();
+ *
+ * //initVarna("ATGCATGATATATATATAT","....((((...))))....");
+ * initVarna(this.DEFAULT_SEQUENCE,this.DEFAULT_STRUCTURE1); }
+ */
+
+ public AppVarnaBinding(String seq, String struc)
+ {
+ // super("VARNA in Jalview");
+ initVarna(seq, struc);
+ }
+
+ public AppVarnaBinding(ArrayList<RNA> rnaList)
+ {
+ // super("VARNA in Jalview");
+ initVarnaEdit(rnaList);
+ }
+
+ private void initVarna(String seq, String str)
+ {
+ DefaultListModel dlm = new DefaultListModel();
+
+ DefaultListSelectionModel m = new DefaultListSelectionModel();
+ m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ m.setLeadAnchorNotificationEnabled(false);
+
+ _sideList = new ReorderableJList();
+ _sideList.setModel(dlm);
+ _sideList.addMouseListener(this);
+ _sideList.setSelectionModel(m);
+ _sideList.setPreferredSize(new Dimension(100, 0));
+ _sideList.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent arg0)
+ {
+ if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
+ {
+ FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+ Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
+ .getSize(), sel.rna.getSize());
+ vp.showRNAInterpolated(sel.rna, sel.config, map);
+ _seq.setText(sel.rna.getSeq());
+ _str.setText(sel.rna.getStructDBN());
+ }
+ }
+ });
+
+ _rnaList = new BackupHolder(dlm, _sideList);
+ RNA _RNA1 = new RNA("User defined 1");
+
+ try
+ {
+ vp = new VARNAPanel("0", ".");
+ _RNA1.setRNA(seq, str);
+ _RNA1.drawRNARadiate(vp.getConfig());
+ } catch (ExceptionNonEqualLength e)
+ {
+ vp.errorDialog(e);
+ } catch (ExceptionUnmatchedClosingParentheses e2)
+ {
+ e2.printStackTrace();
+ } catch (ExceptionFileFormatOrSyntax e3)
+ {
+ e3.printStackTrace();
+ }
+ vp.setPreferredSize(new Dimension(400, 400));
+ _rnaList.add(vp.getConfig().clone(), _RNA1, generateDefaultName(), true);
+
+ // TODO setBackground(_backgroundColor);
+ vp.setBackground(_backgroundColor);
+
+ // TODO getContentPane().setLayout(new BorderLayout());
+ // TODO getContentPane().add(vp, BorderLayout.CENTER);
+
+ // setVisible(true);
+ vp.addVARNAListener(this);
+ }
+
+ private void initVarnaEdit(ArrayList<RNA> rnaInList)
+ {
+ DefaultListModel dlm = new DefaultListModel();
+
+ int marginTools = 40;
+
+ DefaultListSelectionModel m = new DefaultListSelectionModel();
+ m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ m.setLeadAnchorNotificationEnabled(false);
+
+ _sideList = new ReorderableJList();
+ _sideList.setModel(dlm);
+ _sideList.addMouseListener(this);
+ _sideList.setSelectionModel(m);
+ _sideList.setPreferredSize(new Dimension(100, 0));
+ _sideList.addListSelectionListener(new ListSelectionListener()
+ {
+ public void valueChanged(ListSelectionEvent arg0)
+ {
+ // System.out.println(arg0);
+ if (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting())
+ {
+ FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+ Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA()
+ .getSize(), sel.rna.getSize());
+ vp.showRNAInterpolated(sel.rna, sel.config, map);
+ // _seq.setText(sel.rna.getSeq());
+ _str.setText(sel.rna.getStructDBN());
+ }
+ }
+ });
+ _rnaList = new BackupHolder(dlm, _sideList);
+
+ try
+ {
+ vp = new VARNAPanel("0", ".");
+ for (int i = 0; i < rnaInList.size(); i++)
+ {
+ rnaInList.get(i).drawRNARadiate(vp.getConfig());
+ }
+ } catch (ExceptionNonEqualLength e)
+ {
+ vp.errorDialog(e);
+ }
+ vp.setPreferredSize(new Dimension(400, 400));
+ for (int i = 0; i < rnaInList.size(); i++)
+ {
+ if (i < rnaInList.size() - 1)
+ {
+ _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
+ .get(i).getName());
+ }
+ else
+ {
+ _rnaList.add(vp.getConfig().clone(), rnaInList.get(i), rnaInList
+ .get(i).getName(), true);
+ }
+ }
+
+ /*
+ * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
+ * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
+ */
+
+ JScrollPane listScroller = new JScrollPane(_sideList);
+ listScroller.setPreferredSize(new Dimension(150, 0));
+
+ vp.setBackground(_backgroundColor);
+
+ Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
+
+ // _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
+ // _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
+ _seq.setFont(textFieldsFont);
+ _seq.setText(rnaInList.get(0).getSeq());
+
+ _updateButton.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ FullBackup sel = (FullBackup) _sideList.getSelectedValue();
+ sel.rna.setSequence("A");
+ }
+ });
+
+ // _seqPanel.setLayout(new BorderLayout());
+ // _seqPanel.add(_seqLabel, BorderLayout.WEST);
+ // _seqPanel.add(_seq, BorderLayout.CENTER);
+
+ _strLabel.setPreferredSize(new Dimension(marginTools, 15));
+ _strLabel.setHorizontalTextPosition(JLabel.LEFT);
+ _str.setFont(textFieldsFont);
+ _strPanel.setLayout(new BorderLayout());
+ _strPanel.add(_strLabel, BorderLayout.WEST);
+ _strPanel.add(_str, BorderLayout.CENTER);
+
+ _input.setLayout(new GridLayout(1, 0));
+ // _input.add(_seqPanel);
+ _input.add(_strPanel);
+
+ JPanel goPanel = new JPanel();
+ goPanel.setLayout(new BorderLayout());
+
+ _tools.setLayout(new BorderLayout());
+ _tools.add(_input, BorderLayout.CENTER);
+ // _tools.add(_info, BorderLayout.SOUTH);
+ _tools.add(goPanel, BorderLayout.EAST);
+
+ /*
+ * _deleteButton.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
+ * _duplicateButton.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) {
+ * _rnaList.add((VARNAConfig)vp.getConfig().
+ * clone(),vp.getRNA().clone(),vp.getRNA
+ * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
+ * Date()),true); }});
+ */
+ goPanel.add(_updateButton, BorderLayout.CENTER);
+
+ JPanel ops = new JPanel();
+ ops.setLayout(new GridLayout(1, 2));
+ ops.add(_deleteButton);
+ ops.add(_duplicateButton);
+
+ JLabel j = new JLabel("Structures Manager", JLabel.CENTER);
+ _listPanel.setLayout(new BorderLayout());
+
+ //_listPanel.add(ops, BorderLayout.SOUTH);
+ _listPanel.add(j, BorderLayout.NORTH);
+ _listPanel.add(listScroller, BorderLayout.CENTER);
+
+ // JSplitPane split = new
+ // JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
+ /**
+ * TODO getContentPane().setLayout(new BorderLayout());
+ * getContentPane().add(split, BorderLayout.CENTER);
+ * getContentPane().add(_tools, BorderLayout.NORTH);
+ */
+
+ // TODO setVisible(true);
+ DropTarget dt = new DropTarget(vp, this);
+
+ vp.addVARNAListener(this);
+ }
+
+ public JPanel getTools()
+ {
+ return _tools;
+ }
+
+ public JPanel getListPanel()
+ {
+ return _listPanel;
+ }
+
+ /**
+ * TODO: Is it effective to transfer the whole RNA?
+ *
+ * @return Currently selected RNA
+ */
+ public RNA getSelectedRNA()
+ {
+ return _rnaList.getElementAt(_sideList.getSelectedIndex()).rna;
+ }
+
+ /**
+ * Substitute currently selected RNA with the edited one
+ *
+ * @param rnaEdit
+ */
+ public void updateSelectedRNA(RNA rnaEdit)
+ {
+ vp.repaint();
+ vp.showRNA(rnaEdit);
+ }
+
+ /*
+ * private void RNAPanelDemoInit() { DefaultListModel dlm = new
+ * DefaultListModel();
+ *
+ *
+ * int marginTools = 40;
+ *
+ * DefaultListSelectionModel m = new DefaultListSelectionModel();
+ * m.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ * m.setLeadAnchorNotificationEnabled(false);
+ *
+ *
+ * _sideList = new ReorderableJList(); _sideList.setModel(dlm);
+ * _sideList.addMouseListener(this); _sideList.setSelectionModel(m);
+ * _sideList.setPreferredSize(new Dimension(100, 0));
+ * _sideList.addListSelectionListener( new ListSelectionListener(){ public
+ * void valueChanged(ListSelectionEvent arg0) { //System.out.println(arg0); if
+ * (!_sideList.isSelectionEmpty() && !arg0.getValueIsAdjusting()) { FullBackup
+ * sel = (FullBackup) _sideList.getSelectedValue(); Mapping map =
+ * Mapping.DefaultOutermostMapping(vp.getRNA().getSize(), sel.rna.getSize());
+ * vp.showRNAInterpolated(sel.rna,sel.config,map);
+ * _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); } }
+ * });
+ *
+ * _rnaList = new BackupHolder(dlm,_sideList); RNA _RNA1 = new
+ * RNA("User defined 1"); RNA _RNA2 = new RNA("User defined 2"); try { vp =
+ * new VARNAPanel("0","."); _RNA1.setRNA(DEFAULT_SEQUENCE,
+ * DEFAULT_STRUCTURE1); _RNA1.drawRNARadiate(vp.getConfig());
+ * _RNA2.setRNA(DEFAULT_SEQUENCE, DEFAULT_STRUCTURE2);
+ * _RNA2.drawRNARadiate(vp.getConfig()); } catch (ExceptionNonEqualLength e) {
+ * vp.errorDialog(e); } catch (ExceptionUnmatchedClosingParentheses e2) {
+ * e2.printStackTrace(); } catch (ExceptionFileFormatOrSyntax e3) {
+ * e3.printStackTrace(); } vp.setPreferredSize(new Dimension(400, 400));
+ * _rnaList.add(vp.getConfig().clone(),_RNA2,generateDefaultName());
+ * _rnaList.add(vp.getConfig().clone(),_RNA1,generateDefaultName(),true);
+ *
+ * JScrollPane listScroller = new JScrollPane(_sideList);
+ * listScroller.setPreferredSize(new Dimension(150, 0));
+ *
+ * setBackground(_backgroundColor); vp.setBackground(_backgroundColor);
+ *
+ *
+ * Font textFieldsFont = Font.decode("MonoSpaced-PLAIN-12");
+ *
+ * _seqLabel.setHorizontalTextPosition(JLabel.LEFT);
+ * _seqLabel.setPreferredSize(new Dimension(marginTools, 15));
+ * _seq.setFont(textFieldsFont); _seq.setText(DEFAULT_SEQUENCE);
+ *
+ * _createButton.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { try { RNA nRNA = new
+ * RNA(generateDefaultName()); nRNA.setRNA(_seq.getText(), _str.getText());
+ * nRNA.drawRNARadiate(vp.getConfig()); _rnaList.add(new
+ * VARNAConfig(),nRNA,true); } catch (ExceptionUnmatchedClosingParentheses e1)
+ * { JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
+ * JOptionPane.ERROR_MESSAGE); } catch (ExceptionFileFormatOrSyntax e1) {
+ * JOptionPane.showMessageDialog(vp, e1.getMessage(),"Error",
+ * JOptionPane.ERROR_MESSAGE); } } });
+ *
+ *
+ * _seqPanel.setLayout(new BorderLayout()); _seqPanel.add(_seqLabel,
+ * BorderLayout.WEST); _seqPanel.add(_seq, BorderLayout.CENTER);
+ *
+ * _strLabel.setPreferredSize(new Dimension(marginTools, 15));
+ * _strLabel.setHorizontalTextPosition(JLabel.LEFT);
+ * _str.setFont(textFieldsFont); _strPanel.setLayout(new BorderLayout());
+ * _strPanel.add(_strLabel, BorderLayout.WEST); _strPanel.add(_str,
+ * BorderLayout.CENTER);
+ *
+ * _input.setLayout(new GridLayout(2, 0)); _input.add(_seqPanel);
+ * _input.add(_strPanel);
+ *
+ * JPanel goPanel = new JPanel(); goPanel.setLayout(new BorderLayout());
+ *
+ * _tools.setLayout(new BorderLayout()); _tools.add(_input,
+ * BorderLayout.CENTER); _tools.add(_info, BorderLayout.SOUTH);
+ * _tools.add(goPanel, BorderLayout.EAST);
+ *
+ * _deleteButton.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) { _rnaList.removeSelected(); } });
+ * _duplicateButton.addActionListener(new ActionListener() { public void
+ * actionPerformed(ActionEvent e) {
+ * _rnaList.add((VARNAConfig)vp.getConfig().clone
+ * (),vp.getRNA().clone(),vp.getRNA
+ * ().getName()+"-"+DateFormat.getTimeInstance(DateFormat.LONG).format(new
+ * Date()),true); }});
+ *
+ * JPanel ops = new JPanel(); ops.setLayout(new GridLayout(1,2));
+ * ops.add(_deleteButton); ops.add(_duplicateButton);
+ *
+ * JLabel j = new JLabel("Structures Manager",JLabel.CENTER);
+ * _listPanel.setLayout(new BorderLayout());
+ *
+ * _listPanel.add(ops,BorderLayout.SOUTH);
+ * _listPanel.add(j,BorderLayout.NORTH);
+ * _listPanel.add(listScroller,BorderLayout.CENTER);
+ *
+ * goPanel.add(_createButton, BorderLayout.CENTER);
+ *
+ * JSplitPane split = new
+ * JSplitPane(JSplitPane.HORIZONTAL_SPLIT,true,_listPanel,vp);
+ * getContentPane().setLayout(new BorderLayout()); getContentPane().add(split,
+ * BorderLayout.CENTER); getContentPane().add(_tools, BorderLayout.NORTH);
+ *
+ * setVisible(true); DropTarget dt = new DropTarget(vp, this);
+ *
+ * vp.addVARNAListener(this); }
+ */
+ public static String generateDefaultName()
+ {
+ return "User file #" + _nextID++;
+ }
+
+ public RNA getRNA()
+ {
+ return (RNA) _sideList.getSelectedValue();
+ }
+
+ public String[][] getParameterInfo()
+ {
+ String[][] info =
+ {
+ // Parameter Name Kind of Value Description,
+ { "sequenceDBN", "String", "A raw RNA sequence" },
+ { "structureDBN", "String",
+ "An RNA structure in dot bracket notation (DBN)" },
+ { errorOpt, "boolean", "To show errors" }, };
+ return info;
+ }
+
+ public void init()
+ {
+ vp.setBackground(_backgroundColor);
+ _error = true;
+ }
+
+ @SuppressWarnings("unused")
+ private Color getSafeColor(String col, Color def)
+ {
+ Color result;
+ try
+ {
+ result = Color.decode(col);
+ } catch (Exception e)
+ {
+ try
+ {
+ result = Color.getColor(col, def);
+ } catch (Exception e2)
+ {
+ return def;
+ }
+ }
+ return result;
+ }
+
+ public VARNAPanel get_varnaPanel()
+ {
+ return vp;
+ }
+
+ public void set_varnaPanel(VARNAPanel surface)
+ {
+ vp = surface;
+ }
+
+ public String get_seq()
+ {
+ return _seq.getText();
+ }
+
+ public void set_seq(String _seq)
+ {
+ this._seq.setText(_seq);
+ }
+
+ public String get_str()
+ {
+ return _str.getText();
+ }
+
+ public void set_str(String _str)
+ {
+ this._str.setText(_str);
+ }
+
+ public JLabel get_info()
+ {
+ return _info;
+ }
+
+ public void set_info(JLabel _info)
+ {
+ this._info = _info;
+ }
+
+ /*
+ * public static void main(String[] args) { AppVarnaBinding d = new
+ * AppVarnaBinding(); d.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ * d.pack(); d.setVisible(true); }
+ */
+
+ public void dragEnter(DropTargetDragEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dragExit(DropTargetEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dragOver(DropTargetDragEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void drop(DropTargetDropEvent dtde)
+ {
+ try
+ {
+ Transferable tr = dtde.getTransferable();
+ DataFlavor[] flavors = tr.getTransferDataFlavors();
+ for (int i = 0; i < flavors.length; i++)
+ {
+ if (flavors[i].isFlavorJavaFileListType())
+ {
+ dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
+ Object ob = tr.getTransferData(flavors[i]);
+ if (ob instanceof List)
+ {
+ List list = (List) ob;
+ for (int j = 0; j < list.size(); j++)
+ {
+ Object o = list.get(j);
+
+ if (dtde.getSource() instanceof DropTarget)
+ {
+ DropTarget dt = (DropTarget) dtde.getSource();
+ Component c = dt.getComponent();
+ if (c instanceof VARNAPanel)
+ {
+ String path = o.toString();
+ VARNAPanel vp = (VARNAPanel) c;
+ try
+ {
+ FullBackup bck = VARNAPanel.importSession(path);
+ _rnaList.add(bck.config, bck.rna, bck.name, true);
+ } catch (ExceptionLoadingFailed e3)
+ {
+ int mn=1;
+ Collection<RNA> mdls=fr.orsay.lri.varna.factories.RNAFactory.loadSecStr(path);
+ for (RNA r:mdls)
+ {
+ r.drawRNA(vp.getConfig());
+ String name = r.getName();
+ if (name.equals(""))
+ {
+ name = path.substring(path
+ .lastIndexOf(File.separatorChar) + 1);
+ }
+ if (mdls.size()>1)
+ {
+ name += " (Model "+mn+++")";
+ }
+ _rnaList.add(vp.getConfig().clone(), r, name, true);
+ }
+ }
+ }
+ }
+ }
+ }
+ // If we made it this far, everything worked.
+ dtde.dropComplete(true);
+ return;
+ }
+ }
+ // Hmm, the user must not have dropped a file list
+ dtde.rejectDrop();
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ dtde.rejectDrop();
+ }
+
+ }
+
+ public void dropActionChanged(DropTargetDragEvent arg0)
+ {
+ }
+
+ private class BackupHolder
+ {
+ private DefaultListModel _rnaList;
+
+ private ArrayList<RNA> _rnas = new ArrayList<RNA>();
+
+ JList _l;
+
+ public BackupHolder(DefaultListModel rnaList, JList l)
+ {
+ _rnaList = rnaList;
+ _l = l;
+ }
+
+ public void add(VARNAConfig c, RNA r)
+ {
+ add(c, r, r.getName(), false);
+ }
+
+ public void add(VARNAConfig c, RNA r, boolean select)
+ {
+ add(c, r, r.getName(), select);
+ }
+
+ public void add(VARNAConfig c, RNA r, String name)
+ {
+ add(c, r, name, false);
+ }
+
+ public void add(VARNAConfig c, RNA r, String name, boolean select)
+ {
+ if (select)
+ {
+ _l.removeSelectionInterval(0, _rnaList.size());
+ }
+ if (name.equals(""))
+ {
+ name = generateDefaultName();
+ }
+ FullBackup bck = new FullBackup(c, r, name);
+ _rnas.add(0, r);
+ _rnaList.add(0, bck);
+ if (select)
+ {
+ _l.setSelectedIndex(0);
+ }
+ }
+
+ public void remove(int i)
+ {
+ _rnas.remove(i);
+ _rnaList.remove(i);
+
+ }
+
+ public DefaultListModel getModel()
+ {
+ return _rnaList;
+ }
+
+ public boolean contains(RNA r)
+ {
+ return _rnas.contains(r);
+ }
+
+ /*
+ * public int getSize() { return _rnaList.getSize(); }
+ */
+ public FullBackup getElementAt(int i)
+ {
+ return (FullBackup) _rnaList.getElementAt(i);
+ }
+
+ public void removeSelected()
+ {
+ int i = _l.getSelectedIndex();
+ if (i != -1)
+ {
+ if (_rnaList.getSize() == 1)
+ {
+ RNA r = new RNA();
+ try
+ {
+ r.setRNA(" ", ".");
+ } catch (ExceptionUnmatchedClosingParentheses e1)
+ {
+ } catch (ExceptionFileFormatOrSyntax e1)
+ {
+ }
+ vp.showRNA(r);
+ vp.repaint();
+ }
+ else
+ {
+ int newi = i + 1;
+ if (newi == _rnaList.getSize())
+ {
+ newi = _rnaList.getSize() - 2;
+ }
+ FullBackup bck = (FullBackup) _rnaList.getElementAt(newi);
+ _l.setSelectedValue(bck, true);
+ }
+ _rnaList.remove(i);
+ }
+
+ }
+ }
+
+ public void onLayoutChanged()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void onUINewStructure(VARNAConfig v, RNA r)
+ {
+ _rnaList.add(v, r, "", true);
+ }
+
+ public void onWarningEmitted(String s)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ if (e.getClickCount() == 2)
+ {
+ int index = _sideList.locationToIndex(e.getPoint());
+ ListModel dlm = _sideList.getModel();
+ FullBackup item = (FullBackup) dlm.getElementAt(index);
+ ;
+ _sideList.ensureIndexIsVisible(index);
+ /*
+ * TODO Object newName = JOptionPane.showInputDialog( this,
+ * "Specify a new name for this RNA", "Rename RNA",
+ * JOptionPane.QUESTION_MESSAGE, (Icon)null, null, item.toString()); if
+ * (newName!=null) { item.name = newName.toString();
+ * this._sideList.repaint(); }
+ */
+ }
+ }
+
+ public void mouseEntered(MouseEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mouseExited(MouseEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mousePressed(MouseEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void mouseReleased(MouseEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Color getColour(int atomIndex, int pdbResNum, String chain,
+ String pdbId)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getPdbFile()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public void highlightAtom(int atomIndex, int pdbResNum, String chain,
+ String pdbId)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void mouseOverStructure(int atomIndex, String strInfo)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void releaseReferences(Object svl)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void updateColours(Object source)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentHidden(ComponentEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentMoved(ComponentEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentResized(ComponentEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void componentShown(ComponentEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onStructureRedrawn()
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
+
+/*
+ * public static void main(String[] args) { JTextField str = new
+ * JTextField("ATGC");
+ *
+ * AppVarnaBinding vab = new AppVarnaBinding(); vab.varnagui.set_seq(str);
+ * vab.varnagui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ * vab.varnagui.pack(); vab.varnagui.setVisible(true); } }
+ */
\ No newline at end of file
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- */
-package jalview.gui;
-
-import jalview.analysis.Conservation;
-import jalview.datamodel.Annotation;
-
-import java.awt.Color;
-
-class ConservationThread extends Thread
-{
- /**
- *
- */
- private AlignViewport alignViewport;
-
- AlignmentPanel ap;
-
- public ConservationThread(AlignViewport alignViewport, AlignmentPanel ap)
- {
- this.alignViewport = alignViewport;
- this.ap = ap;
- }
-
- public void run()
- {
- try
- {
- this.alignViewport.updatingConservation = true;
-
- while (AlignViewport.UPDATING_CONSERVATION)
- {
- try
- {
- if (ap != null)
- {
- ap.paintAlignment(false);
- }
- Thread.sleep(200);
- } catch (Exception ex)
- {
- ex.printStackTrace();
- }
- }
-
- AlignViewport.UPDATING_CONSERVATION = true;
-
- int alWidth;
-
- if (alignViewport==null || alignViewport.alignment==null || (alWidth=alignViewport.alignment.getWidth())< 0)
- {
- this.alignViewport.updatingConservation = false;
- AlignViewport.UPDATING_CONSERVATION = false;
- return;
- }
-
- Conservation cons = new jalview.analysis.Conservation("All",
- jalview.schemes.ResidueProperties.propHash, 3,
- this.alignViewport.alignment.getSequences(), 0, alWidth - 1);
-
- cons.calculate();
- cons.verdict(false, this.alignViewport.ConsPercGaps);
-
- if (this.alignViewport.quality != null)
- {
- cons.findQuality();
- }
- cons.completeAnnotations(alignViewport.conservation,
- alignViewport.quality, 0, alWidth);
- } catch (OutOfMemoryError error)
- {
- new OOMWarning("calculating conservation", error);
-
- this.alignViewport.conservation = null;
- this.alignViewport.quality = null;
-
- }
-
- AlignViewport.UPDATING_CONSERVATION = false;
- this.alignViewport.updatingConservation = false;
-
- if (ap != null)
- {
- ap.paintAlignment(true);
- }
-
- }
-}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.jbgui.*;
/**
- * DOCUMENT ME!
+ * Cut'n'paste files into the desktop
+ * See JAL-1105
*
* @author $author$
* @version $Revision$
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
*/\r
package jalview.gui;\r
\r
-import java.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
-import javax.swing.event.*;\r
-import javax.swing.table.*;\r
-\r
-import org.biojava.dasobert.dasregistry.*;\r
-import jalview.jbgui.*;\r
-import jalview.util.*;\r
+import jalview.jbgui.GDasSourceBrowser;\r
+import jalview.util.TableSorter;\r
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+\r
+import java.awt.BorderLayout;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.MouseAdapter;\r
+import java.awt.event.MouseEvent;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Properties;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JCheckBox;\r
+import javax.swing.JLabel;\r
+import javax.swing.JOptionPane;\r
+import javax.swing.JPanel;\r
+import javax.swing.JTextField;\r
+import javax.swing.ListSelectionModel;\r
+import javax.swing.SwingUtilities;\r
+import javax.swing.event.ListSelectionEvent;\r
+import javax.swing.event.ListSelectionListener;\r
+import javax.swing.table.AbstractTableModel;\r
+\r
+import org.biodas.jdas.schema.sources.CAPABILITY;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
+import org.biodas.jdas.schema.sources.PROP;\r
+import org.biodas.jdas.schema.sources.VERSION;\r
\r
public class DasSourceBrowser extends GDasSourceBrowser implements\r
Runnable, ListSelectionListener\r
{\r
- static DasSource[] dasSources = null;\r
-\r
- Hashtable localSources = null;\r
-\r
- Vector selectedSources;\r
+ DasSourceRegistryI sourceRegistry = null;\r
\r
- public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das1/sources/";\r
-\r
- /**\r
- * true if thread is running and we are talking to DAS registry service\r
- */\r
- public boolean loadingDasSources = false;\r
-\r
- protected static String getDasRegistryURL()\r
- {\r
- String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
- DEFAULT_REGISTRY);\r
-\r
- if (registry.indexOf("/registry/das1/sources/") > -1)\r
- {\r
- jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,\r
- DEFAULT_REGISTRY);\r
- registry = DEFAULT_REGISTRY;\r
- }\r
- return registry;\r
- }\r
+ Vector<String> selectedSources;\r
\r
public DasSourceBrowser(FeatureSettings featureSettings)\r
{\r
fs = featureSettings;\r
- String registry = getDasRegistryURL();\r
+ // TODO DasSourceRegistryProvider API\r
+ sourceRegistry = jalview.bin.Cache.getDasSourceRegistry();\r
+ String registry = sourceRegistry.getDasRegistryURL();\r
\r
registryURL.setText(registry);\r
\r
}\r
});\r
\r
- if (dasSources != null)\r
+ if (sourceRegistry.getSources() != null)\r
{\r
init();\r
}\r
\r
FeatureSettings fs = null;\r
\r
+ private boolean loadingDasSources;\r
+\r
public DasSourceBrowser()\r
{\r
this(null);\r
\r
public void paintComponent(java.awt.Graphics g)\r
{\r
- if (dasSources == null && !loadingDasSources)\r
+ if (sourceRegistry == null)\r
{\r
Thread worker = new Thread(this);\r
worker.start();\r
\r
void init()\r
{\r
- int dSize = dasSources.length;\r
+ List<jalviewSourceI> sources = sourceRegistry.getSources();\r
+ int dSize = sources.size();\r
Object[][] data = new Object[dSize][2];\r
for (int i = 0; i < dSize; i++)\r
{\r
- data[i][0] = dasSources[i].getNickname();\r
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
- .getNickname()));\r
+ data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname\r
+ data[i][1] = new Boolean(selectedSources.contains(sources.get(i)\r
+ .getTitle()));\r
}\r
\r
refreshTableData(data);\r
- setCapabilities(dasSources);\r
+ setCapabilities(sourceRegistry);\r
\r
javax.swing.SwingUtilities.invokeLater(new Runnable()\r
{\r
return;\r
}\r
\r
- int dSize = dasSources.length;\r
- for (int i = 0; i < dSize; i++)\r
+ int dSize = sourceRegistry.getSources().size();\r
+ for (jalviewSourceI ds : sourceRegistry.getSources())\r
{\r
- if (!dasSources[i].getNickname().equals(nickName))\r
+ if (!ds.getTitle().equals(nickName))\r
{\r
continue;\r
}\r
\r
- DasSource ds = dasSources[i];\r
-\r
- text.append("<font color=\"#0000FF\">Id:</font> "\r
- + dasSources[i].getId() + "<br>");\r
+ VERSION latest = ds.getVersion();\r
+ text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()\r
+ + "<br>");\r
text.append("<font color=\"#0000FF\">Nickname:</font> "\r
- + dasSources[i].getNickname() + "<br>");\r
- text.append("<font color=\"#0000FF\">URL:</font> "\r
- + dasSources[i].getUrl() + "<br>");\r
+ + ds.getTitle() + "<br>");\r
+\r
+ text.append("<font color=\"#0000FF\">URL:</font> <a href=\""\r
+ + ds.getSourceURL() + "\">" + ds.getSourceURL() + "</a>"\r
+ + "<br>");\r
+ if (!ds.isLocal())\r
+ {\r
+ if (ds.getDocHref() != null && ds.getDocHref().length() > 0)\r
+ {\r
+ text.append("<font color=\"#0000FF\">Site:</font> <a href=\""\r
+ + ds.getDocHref() + "\">" + ds.getDocHref() + "</a>"\r
+ + "<br>");\r
+ }\r
\r
- text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
- + dasSources[i].getAdminemail()\r
- + "\">"\r
- + dasSources[i].getAdminemail() + "</a>" + "<br>");\r
+ text.append("<font color=\"#0000FF\">Description:</font> "\r
+ + ds.getDescription() + "<br>");\r
\r
- text.append("<font color=\"#0000FF\">Registered at:</font> "\r
- + dasSources[i].getRegisterDate() + "<br>");\r
+ text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
+ + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");\r
\r
- text.append("<font color=\"#0000FF\">Last successful test:</font> "\r
- + dasSources[i].getLeaseDate() + "<br>");\r
+ text.append("<font color=\"#0000FF\">Registered at:</font> "\r
+ + latest.getCreated() + "<br>");\r
\r
+ // TODO: Identify last successful test date\r
+ // text.append("<font color=\"#0000FF\">Last successful test:</font> "\r
+ // + latest.dasSources[i].getLeaseDate() + "<br>");\r
+ }\r
+ else\r
+ {\r
+ text.append("Source was added manually.<br/>");\r
+ }\r
text.append("<font color=\"#0000FF\">Labels:</font> ");\r
- for (int s = 0; s < dasSources[i].getLabels().length; s++)\r
+ boolean b = false;\r
+ for (PROP labl : latest.getPROP())\r
{\r
- text.append(dasSources[i].getLabels()[s]);\r
- if (s < dasSources[i].getLabels().length - 1)\r
+ if (labl.getName().equalsIgnoreCase("LABEL"))\r
{\r
- text.append(",");\r
+ if (b)\r
+ {\r
+ text.append(",");\r
+ }\r
+ text.append(" ");\r
+\r
+ text.append(labl.getValue());\r
+ b = true;\r
}\r
- text.append(" ");\r
+ ;\r
}\r
text.append("<br>");\r
\r
text.append("<font color=\"#0000FF\">Capabilities:</font> ");\r
- String[] scap = dasSources[i].getCapabilities();\r
+ CAPABILITY[] scap = latest.getCAPABILITY().toArray(new CAPABILITY[0]);\r
for (int j = 0; j < scap.length; j++)\r
{\r
- text.append(scap[j]);\r
+ text.append(scap[j].getType());\r
if (j < scap.length - 1)\r
{\r
text.append(", ");\r
}\r
text.append("<br>");\r
\r
- text.append("<font color=\"#0000FF\">Coordinates:</font> ");\r
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
- for (int j = 0; j < dcs.length; j++)\r
+ text.append("<font color=\"#0000FF\">Coordinates:</font>");\r
+ int i=1;\r
+ for (COORDINATES dcs : latest.getCOORDINATES())\r
{\r
- text.append("(" + dcs[j].getUniqueId() + ") "\r
- + dcs[j].getCategory() + ", " + dcs[j].getName());\r
- if (dcs[j].getNCBITaxId() != 0)\r
+ text.append("<br/>"+i+++". ");\r
+ text.append(dcs.getAuthority()+" : "+dcs.getSource());\r
+ if (dcs.getTaxid() != null && dcs.getTaxid().trim().length() > 0)\r
{\r
- text.append(", " + dcs[j].getNCBITaxId());\r
+ text.append(" [TaxId:" + dcs.getTaxid()+"]");\r
}\r
- if (dcs[j].getOrganismName().length() > 0)\r
+ if (dcs.getVersion() != null\r
+ && dcs.getVersion().trim().length() > 0)\r
{\r
- text.append(", " + dcs[j].getOrganismName());\r
+ {\r
+ text.append(" {v. " + dcs.getVersion()+"}");\r
+ }\r
}\r
-\r
- text.append("<br>");\r
- }\r
-\r
- text.append("<font color=\"#0000FF\">Description:</font> "\r
- + dasSources[i].getDescription() + "<br>");\r
-\r
- if (dasSources[i].getHelperurl() != null\r
- && dasSources[i].getHelperurl().length() > 0)\r
- {\r
- text.append("<font color=\"#0000FF\"><a href=\""\r
- + dasSources[i].getHelperurl()\r
- + "\">Go to site</a></font<br>");\r
+ text.append(" (<a href=\""+dcs.getUri() +"\">"+dcs.getUri() + "</a>)");\r
}\r
-\r
text.append("</font></html>");\r
\r
break;\r
progressBar.setIndeterminate(true);\r
setParentGuiEnabled(false);\r
// Refresh the source list.\r
- dasSources = null;\r
- getDASSource();\r
+ sourceRegistry.refreshSources();\r
\r
init();\r
\r
}\r
}\r
\r
- public Vector getSelectedSources()\r
+ public Vector<jalviewSourceI> getSelectedSources()\r
{\r
// wait around if we're still loading.\r
- while (dasSources == null)\r
+ while (sourceRegistry == null)\r
{\r
if (!loadingDasSources)\r
{\r
}\r
}\r
\r
- Vector selected = new Vector();\r
- for (int r = 0; r < selectedSources.size(); r++)\r
+ Vector<jalviewSourceI> selected = new Vector<jalviewSourceI>();\r
+ for (String source : selectedSources)\r
{\r
- for (int i = 0; i < dasSources.length; i++)\r
+ jalviewSourceI srce = sourceRegistry.getSource(source);\r
+ if (srce != null)\r
{\r
- if (dasSources[i].getNickname()\r
- .equals(selectedSources.elementAt(r)))\r
- {\r
- selected.addElement(dasSources[i]);\r
- break;\r
- }\r
+ selected.addElement(srce);\r
}\r
}\r
-\r
return selected;\r
}\r
\r
- /**\r
- * retrieve das sources from registry and add local source list\r
- * \r
- * @return\r
- */\r
- public DasSource[] getDASSource()\r
- {\r
- if (dasSources == null)\r
- {\r
- dasSources = jalview.ws.DasSequenceFeatureFetcher.getDASSources();\r
- appendLocalSources();\r
- }\r
-\r
- return dasSources;\r
- }\r
-\r
public void refresh_actionPerformed(ActionEvent e)\r
{\r
saveProperties(jalview.bin.Cache.applicationProperties);\r
worker.start();\r
}\r
\r
- private void setCapabilities(DasSource[] sources)\r
+ private void setCapabilities(DasSourceRegistryI sourceRegistry2)\r
{\r
- Vector authority = new Vector();\r
- Vector type = new Vector();\r
- Vector label = new Vector();\r
+ Vector<String> authority = new Vector<String>();\r
+ Vector<String> type = new Vector<String>();\r
+ Vector<String> label = new Vector<String>();\r
+ Vector<String> taxIds = new Vector<String>();\r
+ authority.add("Any");\r
+ type.add("Any");\r
+ label.add("Any");\r
\r
- authority.addElement("Any");\r
- type.addElement("Any");\r
- label.addElement("Any");\r
-\r
- for (int i = 0; i < sources.length; i++)\r
+ for (jalviewSourceI ds : sourceRegistry2.getSources())\r
{\r
- DasSource ds = sources[i];\r
-\r
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
+ VERSION latest = ds.getVersion();\r
\r
- for (int j = 0; j < dcs.length; j++)\r
+ for (COORDINATES cs : latest.getCOORDINATES())\r
{\r
- if (!type.contains(dcs[j].getCategory()))\r
+ if (!type.contains(cs.getSource()))\r
{\r
- type.addElement(dcs[j].getCategory());\r
+ type.add(cs.getSource()); // source==category\r
}\r
\r
- if (!authority.contains(dcs[j].getName()))\r
+ if (!authority.contains(cs.getAuthority()))\r
{\r
- authority.addElement(dcs[j].getName());\r
+ authority.add(cs.getAuthority());\r
}\r
}\r
\r
- String[] slabels = ds.getLabels();\r
- for (int s = 0; s < slabels.length; s++)\r
+ for (PROP slabel : latest.getPROP())\r
{\r
- if (!label.contains(slabels[s]))\r
+ if (slabel.getName().equalsIgnoreCase("LABEL")\r
+ && !label.contains(slabel.getValue()))\r
{\r
- label.addElement(slabels[s]);\r
+ label.add(slabel.getValue());\r
}\r
}\r
\r
filter1.setListData(authority);\r
filter2.setListData(type);\r
filter3.setListData(label);\r
+ // filter4 taxIds\r
\r
javax.swing.SwingUtilities.invokeLater(new Runnable()\r
{\r
{\r
int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
nickname = table.getValueAt(selectedRow, 0).toString();\r
- url = ((DasSource) localSources.get(nickname)).getUrl();\r
- seqsrc = ((DasSource) localSources.get(nickname))\r
- .hasCapability("sequence");\r
+ jalviewSourceI source = sourceRegistry.getSource(nickname);\r
+ url = source.getUri();\r
+ seqsrc = source.isSequenceSource();\r
}\r
\r
JTextField nametf = new JTextField(nickname, 40);\r
urltf.setText(urltf.getText() + "/");\r
}\r
\r
- Das1Source local = new Das1Source();\r
+ jalviewSourceI local = sourceRegistry.createLocalSource(\r
+ urltf.getText(), nametf.getText(), seqs.isSelected(), true);\r
+ List sources = sourceRegistry.getSources();\r
+ int osize = sources.size();\r
+ int size = osize + (newSource ? 1 : 0);\r
\r
- local.setUrl(urltf.getText());\r
- local.setNickname(nametf.getText());\r
- if (seqs.isSelected())\r
- {\r
- local.setCapabilities(new String[]\r
- { "features", "sequence" });\r
- }\r
- if (localSources == null)\r
+ Object[][] data = new Object[size][2];\r
+ DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table\r
+ .getModel()).getTableModel() : null;\r
+ for (int i = 0; i < osize; i++)\r
{\r
- localSources = new Hashtable();\r
- }\r
-\r
- localSources.put(local.getNickname(), local);\r
-\r
- if (!newSource && !nickname.equals(nametf.getText()))\r
- {\r
- localSources.remove(nickname);\r
- }\r
-\r
- int size = dasSources.length;\r
- int adjust = newSource ? 1 : 0;\r
-\r
- Object[][] data = new Object[size + adjust][2];\r
- for (int i = 0; i < size; i++)\r
- {\r
- if (!newSource && dasSources[i].getNickname().equals(nickname))\r
+ String osrc = (dtm == null || i >= osize) ? null : (String) dtm\r
+ .getValueAt(i, 0);\r
+ if (!newSource && osrc != null\r
+ && dtm.getValueAt(i, 0).equals(nickname))\r
{\r
- ((DasSource) dasSources[i]).setNickname(local.getNickname());\r
- ((DasSource) dasSources[i]).setUrl(local.getUrl());\r
- data[i][0] = local.getNickname();\r
+ data[i][0] = local.getTitle();\r
data[i][1] = new Boolean(true);\r
}\r
else\r
{\r
- data[i][0] = dasSources[i].getNickname();\r
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
- .getNickname()));\r
+ data[i][0] = osrc;\r
+ data[i][1] = new Boolean(selectedSources.contains(osrc));\r
}\r
}\r
-\r
- if (newSource)\r
- {\r
- data[size][0] = local.getNickname();\r
- data[size][1] = new Boolean(true);\r
- selectedSources.add(local.getNickname());\r
- }\r
-\r
- DasSource[] tmp = new DasSource[size + adjust];\r
-\r
- System.arraycopy(dasSources, 0, tmp, 0, size);\r
-\r
+ // Always add a new source at the end\r
if (newSource)\r
{\r
- tmp[size] = local;\r
+ data[osize][0] = local.getTitle();\r
+ data[osize][1] = new Boolean(true);\r
+ selectedSources.add(local.getTitle());\r
}\r
\r
- dasSources = tmp;\r
-\r
refreshTableData(data);\r
\r
SwingUtilities.invokeLater(new Runnable()\r
}\r
});\r
\r
- displayFullDetails(local.getNickname());\r
+ displayFullDetails(local.getTitle());\r
}\r
\r
public void editRemoveLocalSource(MouseEvent evt)\r
\r
String nickname = table.getValueAt(selectedRow, 0).toString();\r
\r
- if (!localSources.containsKey(nickname))\r
+ if (!sourceRegistry.getSource(nickname).isLocal())\r
{\r
JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
"You can only edit or remove local DAS Sources!",\r
amendLocal(false);\r
break;\r
case 1:\r
- localSources.remove(nickname);\r
+ sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));\r
selectedSources.remove(nickname);\r
- Object[][] data = new Object[dasSources.length - 1][2];\r
- DasSource[] tmp = new DasSource[dasSources.length - 1];\r
- int index = 0;\r
- for (int i = 0; i < dasSources.length; i++)\r
+ Object[][] data = new Object[sourceRegistry.getSources().size()][2];\r
+ int index = 0,\r
+ l = table.getRowCount();\r
+\r
+ for (int i = 0; i < l; i++)\r
{\r
- if (dasSources[i].getNickname().equals(nickname))\r
+ String nm;\r
+ if ((nm = (String) table.getValueAt(i, 0)).equals(nickname))\r
{\r
continue;\r
}\r
else\r
{\r
- tmp[index] = dasSources[i];\r
- data[index][0] = dasSources[i].getNickname();\r
- data[index][1] = new Boolean(\r
- selectedSources.contains(dasSources[i].getNickname()));\r
+ data[index][0] = nm;\r
+ data[index][1] = new Boolean(selectedSources.contains(nm));\r
index++;\r
}\r
}\r
- dasSources = tmp;\r
refreshTableData(data);\r
SwingUtilities.invokeLater(new Runnable()\r
{\r
}\r
}\r
\r
- void appendLocalSources()\r
- {\r
- if (localSources == null)\r
- {\r
- return;\r
- }\r
- // note - we add all das sources to list so they can be filtered for the\r
- // standard fetchDbRefs function\r
- int size = dasSources != null ? dasSources.length : 0;\r
- int lsize = localSources.size();\r
-\r
- Object[][] data = new Object[size + lsize][2];\r
- for (int i = 0; i < size; i++)\r
- {\r
- data[i][0] = dasSources[i].getNickname();\r
- data[i][1] = new Boolean(selectedSources.contains(dasSources[i]\r
- .getNickname()));\r
- }\r
-\r
- DasSource[] tmp = new DasSource[size + lsize];\r
- if (dasSources != null)\r
- {\r
- System.arraycopy(dasSources, 0, tmp, 0, size);\r
- }\r
-\r
- Enumeration en = localSources.keys();\r
- int index = size;\r
- while (en.hasMoreElements())\r
- {\r
- String key = en.nextElement().toString();\r
- data[index][0] = key;\r
- data[index][1] = new Boolean(false);\r
- tmp[index] = new Das1Source();\r
- tmp[index].setNickname(key);\r
- tmp[index].setUrl(((DasSource) localSources.get(key)).getUrl());\r
-\r
- index++;\r
- }\r
-\r
- dasSources = tmp;\r
-\r
- refreshTableData(data);\r
- }\r
-\r
public void valueChanged(ListSelectionEvent evt)\r
{\r
// Called when the MainTable selection changes\r
displayFullDetails(null);\r
\r
// Filter the displayed data sources\r
- int dSize = dasSources.length;\r
\r
ArrayList names = new ArrayList();\r
ArrayList selected = new ArrayList();\r
- DasSource ds;\r
\r
// The features filter is not visible, but we must still\r
// filter the das source list here.\r
// July 2006 - only 6 sources fo not serve features\r
Object[] dummyFeatureList = new Object[]\r
{ "features" };\r
-\r
- for (int i = 0; i < dSize; i++)\r
+ List<jalviewSourceI> srcs = sourceRegistry.getSources();\r
+ for (jalviewSourceI ds : srcs)\r
{\r
- ds = dasSources[i];\r
- DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
\r
- if (dcs.length == 0 && ds.getCapabilities().length == 0\r
- && filter1.getSelectedIndex() == 0\r
- && filter2.getSelectedIndex() == 0\r
- && filter3.getSelectedIndex() == 0)\r
+ VERSION v = ds.getVersion();\r
+ List<COORDINATES> coords = v.getCOORDINATES();\r
+ if (ds.isLocal()\r
+ || ((coords == null || coords.size() == 0)\r
+ && filter1.getSelectedIndex() == 0\r
+ && filter2.getSelectedIndex() == 0 && filter3\r
+ .getSelectedIndex() == 0))\r
{\r
// THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT\r
// HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT\r
// IS ADDED FROM THE REGISTRY\r
- names.add(ds.getNickname());\r
- selected.add(new Boolean(selectedSources.contains(ds.getNickname())));\r
+ names.add(ds.getTitle());\r
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
continue;\r
}\r
\r
- if (!selectedInList(dummyFeatureList, ds.getCapabilities())\r
+ if (!selectedInList(dummyFeatureList, ds.getCapabilityList(v))\r
|| !selectedInList(filter3.getSelectedValues(),\r
- ds.getLabels()))\r
+ ds.getLabelsFor(v)))\r
{\r
continue;\r
}\r
\r
- for (int j = 0; j < dcs.length; j++)\r
+ for (int j = 0; j < coords.size(); j++)\r
{\r
if (selectedInList(filter1.getSelectedValues(), new String[]\r
- { dcs[j].getName() })\r
+ { coords.get(j).getAuthority() })\r
&& selectedInList(filter2.getSelectedValues(), new String[]\r
- { dcs[j].getCategory() }))\r
+ { coords.get(j).getSource() }))\r
{\r
- names.add(ds.getNickname());\r
- selected.add(new Boolean(selectedSources.contains(ds\r
- .getNickname())));\r
+ names.add(ds.getTitle());\r
+ selected.add(new Boolean(selectedSources.contains(ds.getTitle())));\r
break;\r
}\r
}\r
}\r
\r
- dSize = names.size();\r
+ int dSize = names.size();\r
Object[][] data = new Object[dSize][2];\r
for (int d = 0; d < dSize; d++)\r
{\r
refreshTableData(data);\r
}\r
\r
- boolean selectedInList(Object[] selection, String[] items)\r
+ private boolean selectedInList(Object[] selection, String[] items)\r
{\r
for (int i = 0; i < selection.length; i++)\r
{\r
{\r
return true;\r
}\r
-\r
+ if (items == null || items.length == 0)\r
+ {\r
+ return false;\r
+ }\r
+ String sel = (items[0].startsWith("das1:") ? "das1:" : "")\r
+ + selection[i];\r
for (int j = 0; j < items.length; j++)\r
{\r
- if (selection[i].equals(items[j]))\r
+ if (sel.equals(items[j]))\r
{\r
return true;\r
}\r
{\r
selectedSources.addElement(st.nextToken());\r
}\r
-\r
- Vector _localSources = jalview.bin.Cache.getLocalDasSources();\r
- if (_localSources != null)\r
- {\r
- if (localSources == null)\r
- {\r
- localSources = new Hashtable();\r
- }\r
- Enumeration sources = _localSources.elements();\r
- while (sources.hasMoreElements())\r
- {\r
- Das1Source source = (Das1Source) sources.nextElement();\r
- localSources.put(source.getNickname(), source);\r
- }\r
- }\r
}\r
\r
public void reset_actionPerformed(ActionEvent e)\r
{\r
- registryURL.setText(DEFAULT_REGISTRY);\r
+ registryURL.setText(sourceRegistry.getDasRegistryURL());\r
}\r
\r
/**\r
properties.setProperty(jalview.bin.Cache.DAS_ACTIVE_SOURCE,\r
sb.toString());\r
\r
- if (localSources != null)\r
- {\r
- sb = new StringBuffer();\r
- Enumeration en = localSources.keys();\r
- while (en.hasMoreElements())\r
- {\r
- String token = en.nextElement().toString();\r
- sb.append(token\r
- + "|"\r
- + (((DasSource) localSources.get(token))\r
- .hasCapability("sequence") ? "sequence:" : "")\r
- + ((DasSource) localSources.get(token)).getUrl() + "\t");\r
- }\r
-\r
- properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE,\r
- sb.toString());\r
- }\r
-\r
+ String sourceprop = sourceRegistry.getLocalSourceString();\r
+ properties.setProperty(jalview.bin.Cache.DAS_LOCAL_SOURCE, sourceprop);\r
}\r
\r
class DASTableModel extends AbstractTableModel\r
}\r
});\r
thr.start();\r
- while (loadingDasSources || dasSources == null)\r
+ while (loadingDasSources || sourceRegistry == null)\r
{\r
try\r
{\r
}\r
}\r
\r
- public Vector resolveSourceNicknames(Vector sources)\r
- {\r
-\r
- Vector resolved = new Vector();\r
- if (sources != null)\r
- {\r
- for (int i = 0; i < dasSources.length; i++)\r
- {\r
- if (sources.contains(dasSources[i].getNickname()))\r
- {\r
- if (!resolved.contains(dasSources[i]))\r
- {\r
- resolved.addElement(dasSources[i]);\r
- }\r
- }\r
- }\r
- }\r
- return resolved;\r
- }\r
-\r
/**\r
* disable or enable the buttons on the source browser\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
public void aboutMenuItem_actionPerformed(ActionEvent e)
{
- StringBuffer message = new StringBuffer("Jalview version "
- + jalview.bin.Cache.getProperty("VERSION") + "; last updated: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+ StringBuffer message = getAboutMessage(false);
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
- if (!jalview.bin.Cache.getProperty("LATEST_VERSION").equals(
- jalview.bin.Cache.getProperty("VERSION")))
+ message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ public StringBuffer getAboutMessage(boolean shortv)
+ {
+ StringBuffer message = new StringBuffer();
+ message.append("<html>");
+ if (shortv)
{
- message.append("\n\n!! Jalview version "
- + jalview.bin.Cache.getProperty("LATEST_VERSION")
- + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!\n");
+ message.append("<h1><strong>Jalview "
+ + jalview.bin.Cache.getProperty("VERSION")
+ + "</strong></h1><br>");
+ message.append("<strong>Last Updated: <em>"
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
+ + "</em></strong>");
}
- // TODO: update this text for each release or centrally store it for lite
- // and application
- message.append("\nAuthors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,\n David Martin & Geoff Barton."
- + "\nDevelopment managed by The Barton Group, University of Dundee, Scotland, UK.\n"
- + "\nFor help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list\n"
- + "\nIf you use Jalview, please cite:"
- + "\nWaterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
- + "\nJalview Version 2 - a multiple sequence alignment editor and analysis workbench"
- + "\nBioinformatics doi: 10.1093/bioinformatics/btp033");
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ else
+ {
- message.toString(), "About Jalview", JOptionPane.INFORMATION_MESSAGE);
+ message.append("<strong>Jalview version "
+ + jalview.bin.Cache.getProperty("VERSION")
+ + "; last updated: "
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+ }
+
+ if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
+ "Checking"))
+ {
+ message.append("<br>...Checking latest version...</br>");
+ }
+ else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
+ .equals(jalview.bin.Cache.getProperty("VERSION")))
+ {
+ boolean red = false;
+ if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+ .indexOf("automated build") == -1)
+ {
+ red = true;
+ // Displayed when code version and jnlp version do not match and code
+ // version is not a development build
+ message.append("<div style=\"color: #FF0000;font-style: bold;\">");
+ }
+
+ message.append("<br>!! Jalview version "
+ + jalview.bin.Cache.getDefault("LATEST_VERSION",
+ "..Checking..")
+ + " is available for download from "
+ + jalview.bin.Cache.getDefault("www.jalview.org",
+ "http://www.jalview.org") + " !!");
+ if (red)
+ {
+ message.append("</div>");
+ }
+ }
+ message.append("<br>Authors: "
+ + jalview.bin.Cache
+ .getDefault(
+ "AUTHORNAMES",
+ "Jim Procter, Andrew Waterhouse, Jan Engelhardt, Lauren Lui, Michele Clamp, James Cuff, Steve Searle, David Martin & Geoff Barton")
+ + "<br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
+ + "<br>For help, see the FAQ at www.jalview.org and/or join the jalview-discuss@jalview.org mailing list"
+ + "<br>If you use Jalview, please cite:"
+ + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ + "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033"
+ + "</html>");
+ return message;
}
/**
source.viewport.gatherViewsHere = true;
source.viewport.explodedPosition = source.getBounds();
JInternalFrame[] frames = desktop.getAllFrames();
- String viewId = source.viewport.sequenceSetID;
+ String viewId = source.viewport.getSequenceSetId();
for (int t = 0; t < frames.length; t++)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
minmax = new Hashtable();
}
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ AlignmentI alignment=av.getAlignment();
+ for (int i = 0; i < alignment.getHeight(); i++)
{
- SequenceFeature[] features = av.alignment.getSequenceAt(i)
+ SequenceFeature[] features = alignment.getSequenceAt(i)
.getDatasetSequence().getSequenceFeatures();
if (features == null)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.io.*;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
-import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import jalview.io.*;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.GraduatedColor;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
public class FeatureSettings extends JPanel
{
Vector allGroups = new Vector();
SequenceFeature[] tmpfeatures;
String group;
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- if (af.getViewport().alignment.getSequenceAt(i).getDatasetSequence()
+ if (af.getViewport().getAlignment().getSequenceAt(i).getDatasetSequence()
.getSequenceFeatures() == null)
{
continue;
}
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
.getDatasetSequence().getSequenceFeatures();
int index = 0;
// Find out which features should be visible depending on which groups
// are selected / deselected
// and recompute average width ordering
- for (int i = 0; i < af.getViewport().alignment.getHeight(); i++)
+ for (int i = 0; i < af.getViewport().getAlignment().getHeight(); i++)
{
- tmpfeatures = af.getViewport().alignment.getSequenceAt(i)
+ tmpfeatures = af.getViewport().getAlignment().getSequenceAt(i)
.getDatasetSequence().getSequenceFeatures();
if (tmpfeatures == null)
{
* @param checkDbRefs
* @param promptFetchDbRefs
*/
- private void doDasFeatureFetch(Vector selectedSources,
+ private void doDasFeatureFetch(List<jalviewSourceI> selectedSources,
boolean checkDbRefs, boolean promptFetchDbRefs)
{
SequenceI[] dataset, seqs;
* Vector of Strings to resolve to DAS source nicknames.
* @return sources that are present in source list.
*/
- public Vector resolveSourceNicknames(Vector sources)
+ public List<jalviewSourceI> resolveSourceNicknames(Vector sources)
{
- return dassourceBrowser.resolveSourceNicknames(sources);
+ return dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
}
/**
public void fetchDasFeatures(Vector sources, boolean block)
{
initDasSources();
- Vector resolved = resolveSourceNicknames(sources);
+ List<jalviewSourceI> resolved = dassourceBrowser.sourceRegistry.resolveSourceNicknames(sources);
if (resolved.size() == 0)
{
resolved = dassourceBrowser.getSelectedSources();
}
if (resolved.size() > 0)
{
- final Vector dassources = resolved;
+ final List<jalviewSourceI> dassources = resolved;
fetchDAS.setEnabled(false);
// cancelDAS.setEnabled(true); doDasFetch does this.
Runnable fetcher = new Runnable()
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
// TODO: add switches to control what is searched - sequences, IDS,
// descriptions, features
jalview.analysis.Finder finder = new jalview.analysis.Finder(
- av.alignment, av.getSelectionGroup(), seqIndex, resIndex);
+ av.getAlignment(), av.getSelectionGroup(), seqIndex, resIndex);
finder.setCaseSensitive(caseSensitive.isSelected());
finder.setFindAll(findAll);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
}
}
+ private Font lastSelected=null;
+ private int lastSelStyle=0;
+ private int lastSelSize=0;
+ private boolean lastSelMono=false;
/**
* DOCUMENT ME!
*/
void changeFont()
{
+ if (lastSelected==null)
+ {
+ // initialise with original font
+ lastSelected=oldFont;
+ lastSelSize=oldFont.getSize();
+ lastSelStyle=oldFont.getStyle();
+ FontMetrics fm = getGraphics().getFontMetrics(oldFont);
+ double mw=fm.getStringBounds("M", getGraphics())
+ .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+ .getWidth();
+ lastSelMono=mw==iw;
+ }
+
Font newFont = new Font(fontName.getSelectedItem().toString(),
fontStyle.getSelectedIndex(), Integer.parseInt(fontSize
.getSelectedItem().toString()));
+ FontMetrics fm = getGraphics().getFontMetrics(newFont);
+ double mw=fm.getStringBounds("M", getGraphics())
+ .getWidth(),iw=fm.getStringBounds("I", getGraphics())
+ .getWidth();
+ if (mw<1 || iw < 1) {
+ fontName.setSelectedItem(lastSelected.getName());
+ fontStyle.setSelectedIndex(lastSelStyle);
+ fontSize.setSelectedItem(""+lastSelSize);
+ monospaced.setSelected(lastSelMono);
+ JOptionPane.showInternalMessageDialog(this, "Font doesn't have letters defined\nso cannot be used\nwith alignment data.", "Invalid Font", JOptionPane.WARNING_MESSAGE);
+ return;
+ }
if (tp != null)
{
tp.setTreeFont(newFont);
ap.fontChanged();
}
- FontMetrics fm = getGraphics().getFontMetrics(newFont);
-
- monospaced.setSelected(fm.getStringBounds("M", getGraphics())
- .getWidth() == fm.getStringBounds("|", getGraphics())
- .getWidth());
+ monospaced.setSelected(mw==iw);
+ // remember last selected
+ lastSelected=newFont;
}
/**
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.*;
import java.awt.image.*;
+import java.util.List;
+
import javax.swing.*;
import jalview.datamodel.*;
boolean fastPaint = false;
- java.util.Vector searchResults;
+ List<SequenceI> searchResults;
FontMetrics fm;
gg.drawString(s.getDisplayId(av.getShowJVSuffix()), xPos,
(((i - starty + 1) * charHeight) + ypos) - (charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.showHiddenMarkers)
{
drawMarker(i, starty, ypos);
}
if (av.getWrapAlignment())
{
- int maxwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight();
+ int maxwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
{
for (int i = starty; i < alheight; i++)
{
- SequenceI s = av.alignment.getSequenceAt(i);
- if (av.hasHiddenRows)
+ SequenceI s = av.getAlignment().getSequenceAt(i);
+ if (av.hasHiddenRows())
{
setHiddenFont(s);
}
// Now draw the id strings
for (int i = starty; i < endy; i++)
{
- sequence = av.alignment.getSequenceAt(i);
+ sequence = av.getAlignment().getSequenceAt(i);
if (sequence == null)
{
continue;
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
setHiddenFont(sequence);
}
(((i - starty) * av.charHeight) + av.charHeight)
- (av.charHeight / 5));
- if (av.hasHiddenRows && av.showHiddenMarkers)
+ if (av.hasHiddenRows() && av.showHiddenMarkers)
{
drawMarker(i, starty, 0);
}
void drawMarker(int i, int starty, int yoffset)
{
- SequenceI[] hseqs = av.alignment.getHiddenSequences().hiddenSequences;
+ SequenceI[] hseqs = av.getAlignment().getHiddenSequences().hiddenSequences;
// Use this method here instead of calling hiddenSeq adjust
// 3 times.
int hSize = hseqs.length;
Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont()
.getSize());
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
gg.setFont(bold);
}
/**
* DOCUMENT ME!
*
- * @param found
+ * @param list
* DOCUMENT ME!
*/
- public void setHighlighted(java.util.Vector found)
+ public void setHighlighted(List<SequenceI> list)
{
- searchResults = found;
+ searchResults = list;
repaint();
}
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import java.awt.*;
import java.awt.event.*;
+import java.util.List;
import java.util.Vector;
import javax.swing.*;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
/**
* Creates a new IdPanel object.
- *
+ *
* @param av
* DOCUMENT ME!
* @param parent
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent e)
{
SeqPanel sp = alignPanel.seqPanel;
int seq = Math.max(0, sp.findSeq(e));
String tmp;
- if (seq > -1 && seq < av.alignment.getHeight())
+ if (seq > -1 && seq < av.getAlignment().getHeight())
{
- SequenceI sequence = av.alignment.getSequenceAt(seq);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
StringBuffer tip = new StringBuffer();
tip.append("<i>");
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent e)
{
mouseDragging = true;
alignPanel.paintAlignment(true);
}
+ @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume();
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseClicked(MouseEvent e)
{
if (e.getClickCount() < 2)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent e)
{
if (scrollThread != null)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent e)
{
if (av.getWrapAlignment())
}
if (mouseDragging && (e.getY() >= getHeight())
- && (av.alignment.getHeight() > av.getEndSeq()))
+ && (av.getAlignment().getHeight() > av.getEndSeq()))
{
scrollThread = new ScrollThread(false);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent e)
{
if (e.getClickCount() == 2)
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
- av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);
+ av.getSelectionGroup().setEndRes(av.getAlignment().getWidth() - 1);
}
if (e.isShiftDown() && (lastid != -1))
/**
* DOCUMENT ME!
- *
+ *
* @param seq
* DOCUMENT ME!
*/
/**
* DOCUMENT ME!
- *
+ *
* @param start
* DOCUMENT ME!
* @param end
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent e)
{
if (scrollThread != null)
/**
* DOCUMENT ME!
- *
- * @param found
+ *
+ * @param list
* DOCUMENT ME!
*/
- public void highlightSearchResults(java.util.Vector found)
+ public void highlightSearchResults(List<SequenceI> list)
{
- idCanvas.setHighlighted(found);
+ idCanvas.setHighlighted(list);
- if (found == null)
+ if (list == null)
{
return;
}
- int index = av.alignment.findIndex((SequenceI) found.get(0));
+ int index = av.getAlignment().findIndex(list.get(0));
// do we need to scroll the panel?
if ((av.getStartSeq() > index) || (av.getEndSeq() < index))
running = false;
}
+ @Override
public void run()
{
running = true;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.gui;
+
+import jalview.bin.Cache;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTree;
+import javax.swing.event.TreeSelectionEvent;
+import javax.swing.event.TreeSelectionListener;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeCellRenderer;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeCellRenderer;
+import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
+
+public class JDatabaseTree extends JalviewDialog implements KeyListener
+{
+ boolean allowMultiSelections = false;
+
+ JButton getDatabaseSelectorButton()
+ {
+ final JButton viewdbs = new JButton("--- Select Database ---");
+ viewdbs.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent arg0)
+ {
+ showDialog(null);
+ }
+ });
+ return viewdbs;
+ }
+
+ JScrollPane svp;
+
+ JTree dbviews;
+
+ private jalview.ws.SequenceFetcher sfetcher;
+
+ private JLabel dbstatus, dbstatex;
+
+ public JDatabaseTree(jalview.ws.SequenceFetcher sfetch)
+ {
+ initDialogFrame(this, true, false, "Select Database Retrieval Source",
+ 650, 490);
+ /*
+ * Dynamically generated database list will need a translation function from
+ * internal source to externally distinct names. UNIPROT and UP_NAME are
+ * identical DB sources, and should be collapsed.
+ */
+ DefaultMutableTreeNode tn = null, root = new DefaultMutableTreeNode();
+ Hashtable<String, DefaultMutableTreeNode> source = new Hashtable<String, DefaultMutableTreeNode>();
+ sfetcher = sfetch;
+ String dbs[] = sfetch.getSupportedDb();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
+ for (int i = 0; i < dbs.length; i++)
+ {
+ tn = source.get(dbs[i]);
+ List<DbSourceProxy> srcs = sfetch.getSourceProxy(dbs[i]);
+ if (tn == null)
+ {
+ source.put(dbs[i], tn = new DefaultMutableTreeNode(dbs[i], true));
+ }
+ for (DbSourceProxy dbp : srcs)
+ {
+ if (ht.get(dbp.getDbName()) == null)
+ {
+ tn.add(new DefaultMutableTreeNode(dbp, false));
+ ht.put(dbp.getDbName(), dbp.getDbName());
+ }
+ else
+ {
+ System.err.println("dupe ig for : " + dbs[i] + " \t"
+ + dbp.getDbName() + " (" + dbp.getDbSource() + ")");
+ source.remove(tn);
+ }
+ }
+ }
+ for (int i = 0; i < dbs.length; i++)
+ {
+ tn = source.get(dbs[i]);
+ if (tn == null)
+ {
+ continue;
+ }
+ if (tn.getChildCount() == 1)
+ {
+ DefaultMutableTreeNode ttn = (DefaultMutableTreeNode) tn
+ .getChildAt(0);
+ // remove nodes with only one child
+ tn.setUserObject(ttn.getUserObject());
+ tn.removeAllChildren();
+ source.put(dbs[i], tn);
+ tn.setAllowsChildren(false);
+ }
+ root.add(tn);
+ }
+ svp = new JScrollPane();
+ // svp.setAutoscrolls(true);
+ dbviews = new JTree(new DefaultTreeModel(root, false));
+ dbviews.setCellRenderer(new DbTreeRenderer(this));
+
+ dbviews.getSelectionModel().setSelectionMode(
+ TreeSelectionModel.SINGLE_TREE_SELECTION);
+ svp.getViewport().setView(dbviews);
+ // svp.getViewport().setMinimumSize(new Dimension(300,200));
+ // svp.setSize(300,250);
+ // JPanel panel=new JPanel();
+ // panel.setSize(new Dimension(350,220));
+ // panel.add(svp);
+ dbviews.addTreeSelectionListener(new TreeSelectionListener()
+ {
+
+ @Override
+ public void valueChanged(TreeSelectionEvent arg0)
+ {
+ _setSelectionState();
+ }
+ });
+ JPanel jc = new JPanel(new BorderLayout()), j = new JPanel(
+ new FlowLayout());
+ jc.add(svp, BorderLayout.CENTER);
+
+ java.awt.Font f;
+ // TODO: make the panel stay a fixed size for longest dbname+example set.
+ JPanel dbstat = new JPanel(new GridLayout(2, 1));
+ dbstatus = new JLabel(" "); // set the height correctly for layout
+ dbstatus.setFont(f = JvSwingUtils.getLabelFont(false, true));
+ dbstatus.setSize(new Dimension(290, 50));
+ dbstatex = new JLabel(" ");
+ dbstatex.setFont(f);
+ dbstatex.setSize(new Dimension(290, 50));
+ dbstat.add(dbstatus);
+ dbstat.add(dbstatex);
+ jc.add(dbstat, BorderLayout.SOUTH);
+ jc.validate();
+ // j.setPreferredSize(new Dimension(300,50));
+ add(jc, BorderLayout.CENTER);
+ j.add(ok);
+ j.add(cancel);
+ add(j, BorderLayout.SOUTH);
+ dbviews.addKeyListener(this);
+ validate();
+ }
+
+ private class DbTreeRenderer extends DefaultTreeCellRenderer implements
+ TreeCellRenderer
+ {
+ JDatabaseTree us;
+
+ public DbTreeRenderer(JDatabaseTree me)
+ {
+ us = me;
+ }
+
+ private Component returnLabel(String txt)
+ {
+ JLabel jl = new JLabel(txt);
+ jl.setFont(JvSwingUtils.getLabelFont());
+ return jl;
+ }
+
+ @Override
+ public Component getTreeCellRendererComponent(JTree tree, Object value,
+ boolean selected, boolean expanded, boolean leaf, int row,
+ boolean hasFocus)
+ {
+ String val = "";
+ if (value != null && value instanceof DefaultMutableTreeNode)
+ {
+ DefaultMutableTreeNode vl = (DefaultMutableTreeNode) value;
+ value = vl.getUserObject();
+ if (value instanceof DbSourceProxy)
+ {
+ val = (((DbSourceProxy) value).getDbName());
+ }
+ else
+ {
+ if (value instanceof String)
+ {
+ val = ((String) value);
+ }
+ }
+ }
+ if (value == null)
+ {
+ val = ("");
+ }
+ return super.getTreeCellRendererComponent(tree, val, selected,
+ expanded, leaf, row, hasFocus);
+
+ }
+ }
+
+ List<DbSourceProxy> oldselection, selection = null;
+
+ TreePath[] tsel = null, oldtsel = null;
+
+ @Override
+ protected void raiseClosed()
+ {
+ for (ActionListener al : lstners)
+ {
+ al.actionPerformed(null);
+ }
+ }
+
+ @Override
+ protected void okPressed()
+ {
+ _setSelectionState();
+ closeDialog();
+ }
+
+ @Override
+ protected void cancelPressed()
+ {
+ selection = oldselection;
+ tsel = oldtsel;
+ _revertSelectionState();
+ closeDialog();
+ }
+
+ private void showDialog(Container parent)
+ {
+ oldselection = selection;
+ oldtsel = tsel;
+ validate();
+ waitForInput();
+ }
+
+ public boolean hasSelection()
+ {
+ return selection == null ? false : selection.size() == 0 ? false : true;
+ }
+
+ public List<DbSourceProxy> getSelectedSources()
+ {
+ return selection;
+ }
+
+ /**
+ * disable or enable selection handler
+ */
+ boolean handleSelections = true;
+
+ private void _setSelectionState()
+ {
+ if (!handleSelections)
+ {
+ return;
+ }
+ if (dbviews.getSelectionCount() == 0)
+ {
+ selection = null;
+ }
+ tsel = dbviews.getSelectionPaths();
+ boolean forcedFirstChild = false;
+ List<DbSourceProxy> srcs = new ArrayList<DbSourceProxy>();
+ if (tsel != null)
+ {
+ for (TreePath tp : tsel)
+ {
+ DefaultMutableTreeNode admt, dmt = (DefaultMutableTreeNode) tp
+ .getLastPathComponent();
+ if (dmt.getUserObject() != null)
+ {
+ if (dmt.getUserObject() instanceof DbSourceProxy)
+ {
+ srcs.add((DbSourceProxy) dmt.getUserObject());
+ }
+ else
+ {
+ if (allowMultiSelections)
+ {
+ srcs.addAll(sfetcher.getSourceProxy((String) dmt
+ .getUserObject()));
+ }
+ else
+ {
+ if ((admt = dmt.getFirstLeaf()) != null
+ && admt.getUserObject() != null)
+ {
+ // modify db selection to just first leaf.
+ if (admt.getUserObject() instanceof DbSourceProxy)
+ {
+ srcs.add((DbSourceProxy) admt.getUserObject());
+ }
+ else
+ {
+ srcs.add(sfetcher.getSourceProxy(
+ (String) admt.getUserObject()).get(0));
+ }
+ forcedFirstChild = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ updateDbStatus(srcs, forcedFirstChild);
+ selection = srcs;
+ }
+
+ private void _revertSelectionState()
+ {
+ handleSelections = false;
+ if (selection == null || selection.size() == 0)
+ {
+ dbviews.clearSelection();
+ }
+ else
+ {
+ dbviews.setSelectionPaths(tsel);
+ }
+ handleSelections = true;
+ }
+
+ private void updateDbStatus(List<DbSourceProxy> srcs,
+ boolean forcedFirstChild)
+ {
+ int x = 0;
+ String nm = "", qr = "";
+ for (DbSourceProxy dbs : srcs)
+ {
+ String tq = dbs.getTestQuery();
+ nm = dbs.getDbName();
+ if (tq != null && tq.trim().length() > 0 && dbs.isValidReference(tq))
+ {
+ qr = tq;
+ x++;
+ }
+ }
+
+ if (allowMultiSelections)
+ {
+ dbstatus.setText("Selected "
+ + srcs.size()
+ + " database"
+ + (srcs.size() == 1 ? "" : "s")
+ + " to fetch from"
+ + (srcs.size() > 0 ? " with " + x + " test quer"
+ + (x == 1 ? "y" : "ies") : "."));
+ dbstatex.setText(" ");
+ }
+ else
+ {
+ if (nm.length() > 0)
+ {
+ dbstatus.setText("Database: " + nm);
+ if (qr.length() > 0)
+ {
+ dbstatex.setText("Example: " + qr);
+ }
+ else
+ {
+ dbstatex.setText(" ");
+ }
+ }
+ else
+ {
+ dbstatus.setText(" ");
+ }
+ }
+ dbstatus.invalidate();
+ dbstatex.invalidate();
+ }
+
+ public String getSelectedItem()
+ {
+ if (hasSelection())
+ {
+ return getSelectedSources().get(0).getDbName();
+ }
+ return null;
+ }
+
+ public String getExampleQueries()
+ {
+ if (!hasSelection())
+ {
+ return null;
+ }
+ StringBuffer sb = new StringBuffer();
+ HashSet<String> hs = new HashSet<String>();
+ for (DbSourceProxy dbs : getSelectedSources())
+ {
+ String tq = dbs.getTestQuery();
+ ;
+ if (hs.add(tq))
+ {
+ if (sb.length() > 0)
+ {
+ sb.append(";");
+ }
+ sb.append(tq);
+ }
+ }
+ return sb.toString();
+ }
+
+ List<ActionListener> lstners = new Vector<ActionListener>();
+
+ public void addActionListener(ActionListener actionListener)
+ {
+ lstners.add(actionListener);
+ }
+
+ public void removeActionListener(ActionListener actionListener)
+ {
+ lstners.remove(actionListener);
+ }
+
+ public static void main(String args[])
+ {
+ Cache.getDasSourceRegistry();
+ JDatabaseTree jdt = new JDatabaseTree(new jalview.ws.SequenceFetcher());
+ JFrame foo = new JFrame();
+ foo.setLayout(new BorderLayout());
+ foo.add(jdt.getDatabaseSelectorButton(), BorderLayout.CENTER);
+ foo.pack();
+ foo.setVisible(true);
+ int nultimes = 5;
+ final Thread us = Thread.currentThread();
+ jdt.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ us.interrupt();
+ }
+ });
+ do
+ {
+ try
+ {
+ Thread.sleep(50);
+ } catch (InterruptedException x)
+ {
+ nultimes--;
+ if (!jdt.hasSelection())
+ {
+ System.out.println("No Selection");
+ }
+ else
+ {
+ System.out.println("Selection: " + jdt.getSelectedItem());
+ int s = 1;
+ for (DbSourceProxy pr : jdt.getSelectedSources())
+ {
+ System.out.println("Source " + s++ + ": " + pr.getDbName()
+ + " (" + pr.getDbSource() + ") Version "
+ + pr.getDbVersion() + ". Test:\t" + pr.getTestQuery());
+ }
+ System.out.println("Test queries: " + jdt.getExampleQueries());
+ }
+ }
+ } while (nultimes > 0 && foo.isVisible());
+ foo.setVisible(false);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent arg0)
+ {
+ if (!arg0.isConsumed() && arg0.getKeyCode() == KeyEvent.VK_ENTER)
+ {
+ okPressed();
+ }
+ if (!arg0.isConsumed() && arg0.getKeyChar() == KeyEvent.VK_ESCAPE)
+ {
+ cancelPressed();
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void keyTyped(KeyEvent arg0)
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import org.exolab.castor.xml.*;
-import uk.ac.vamsas.objects.utils.MapList;
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceI;
import jalview.schemabinding.version2.*;
import jalview.schemes.*;
-import jalview.structure.StructureSelectionManager;
+import jalview.util.Platform;
import jalview.util.jarInputStreamProvider;
/**
* Write out the current jalview desktop state as a Jalview XML stream.
- *
+ *
* Note: the vamsas objects referred to here are primitive versions of the
* VAMSAS project schema elements - they are not the same and most likely never
* will be :)
- *
+ *
* @author $author$
* @version $Revision: 1.134 $
*/
{
/**
* create/return unique hash string for sq
- *
+ *
* @param sq
* @return new or existing unique string for sq
*/
/**
* Writes a jalview project archive to the given Jar output stream.
- *
+ *
* @param jout
*/
public void SaveState(JarOutputStream jout)
/**
* create a JalviewModel from an algnment view and marshall it to a
* JarOutputStream
- *
+ *
* @param ap
* panel to create jalview model for
* @param fileName
object.setCreationDate(new java.util.Date(System.currentTimeMillis()));
object.setVersion(jalview.bin.Cache.getProperty("VERSION"));
- jalview.datamodel.AlignmentI jal = av.alignment;
+ jalview.datamodel.AlignmentI jal = av.getAlignment();
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
jal = jal.getHiddenSequences().getFullAlignment();
}
jseq.setId(id); // jseq id should be a string not a number
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- jseq.setHidden(av.alignment.getHiddenSequences().isHidden(jds));
+ jseq.setHidden(av.getAlignment().getHiddenSequences().isHidden(jds));
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(jal.getSequenceAt(i)))
+ if (av.isHiddenRepSequence(jal.getSequenceAt(i)))
{
- jalview.datamodel.SequenceI[] reps = ((jalview.datamodel.SequenceGroup) av.hiddenRepSequences
- .get(jal.getSequenceAt(i))).getSequencesInOrder(jal);
+ jalview.datamodel.SequenceI[] reps = av.getRepresentedSequences(jal.getSequenceAt(i)).getSequencesInOrder(jal);
for (int h = 0; h < reps.length; h++)
{
for (int smap = 0; smap < jmol.jmb.sequence[peid].length; smap++)
{
- if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+// if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1)
+ if (jds==jmol.jmb.sequence[peid][smap])
{
StructureState state = new StructureState();
state.setVisible(true);
jms.addJSeq(jseq);
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- jal = av.alignment;
+ jal = av.getAlignment();
}
// SAVE MAPPINGS
if (jal.getCodonFrames() != null && jal.getCodonFrames().length > 0)
{
TreePanel tp = (TreePanel) frames[t];
- if (tp.treeCanvas.av.alignment == jal)
+ if (tp.treeCanvas.av.getAlignment() == jal)
{
Tree tree = new Tree();
tree.setTitle(tp.getTitle());
an.setCentreColLabels(aa[i].centreColLabels);
an.setScaleColLabels(aa[i].scaleColLabel);
an.setShowAllColLabels(aa[i].showAllColLabels);
+ an.setBelowAlignment(aa[i].belowAlignment);
if (aa[i].graph > 0)
{
an.setLabel(aa[i].label);
- if (aa[i] == av.quality || aa[i] == av.conservation
- || aa[i] == av.consensus || aa[i].autoCalculated)
+ if (aa[i] == av.getAlignmentQualityAnnot() || aa[i] == av.getAlignmentConservationAnnotation()
+ || aa[i] == av.getAlignmentConsensusAnnotation() || aa[i].autoCalculated)
{
// new way of indicating autocalculated annotation -
an.setAutoCalculated(aa[i].autoCalculated);
{
an.setScore(aa[i].getScore());
}
+
+ if (aa[i].getCalcId()!=null)
+ {
+ an.setCalcId(aa[i].getCalcId());
+ }
+
AnnotationElement ae;
if (aa[i].annotations != null)
{
if (jal.getGroups() != null)
{
JGroup[] groups = new JGroup[jal.getGroups().size()];
-
- for (int i = 0; i < groups.length; i++)
+ int i = -1;
+ for (jalview.datamodel.SequenceGroup sg:jal.getGroups())
{
- groups[i] = new JGroup();
+ groups[++i] = new JGroup();
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) jal
- .getGroups().elementAt(i);
groups[i].setStart(sg.getStartRes());
groups[i].setEnd(sg.getEndRes());
groups[i].setName(sg.getName());
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (av.getColumnSelection() == null
|| av.getColumnSelection().getHiddenColumns() == null)
/**
* Construct a unique ID for jvobj using either existing bindings or if none
* exist, the result of the hashcode call for the object.
- *
+ *
* @param jvobj
* jalview data object
* @return unique ID for referring to jvobj
/**
* return local jalview object mapped to ID, if it exists
- *
+ *
* @param idcode
* (may be null)
* @return null or object bound to idcode
/**
* Load a jalview project archive from a jar file
- *
+ *
* @param file
* - HTTP URL or filename
*/
return new jarInputStreamProvider()
{
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
if (_url != null)
}
}
+ @Override
public String getFilename()
{
return file;
* initialise uniqueSetSuffix, seqRefIds, viewportsAdded and frefedSequence
* themselves. Any null fields will be initialised with default values,
* non-null fields are left alone.
- *
+ *
* @param jprovider
* @return
*/
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
* Currently (28th Sep 2008) things will go horribly wrong in vamsas document
* sync if this is set to true.
*/
- private boolean updateLocalViews = false;
+ private final boolean updateLocalViews = false;
String loadPDBFile(jarInputStreamProvider jprovider, String pdbId)
{
}
;
out.close();
-
- alreadyLoadedPDB.put(pdbId, outFile.getAbsolutePath());
- return outFile.getAbsolutePath();
+ String t=outFile.getAbsolutePath();
+ alreadyLoadedPDB.put(pdbId, t);
+ return t;
}
else
{
/**
* Load alignment frame from jalview XML DOM object
- *
+ *
* @param object
* DOM
* @param file
if (seqRefIds.get(seqId) != null)
{
- tmpseqs.add((jalview.datamodel.Sequence) seqRefIds.get(seqId));
+ tmpseqs.add(seqRefIds.get(seqId));
multipleView = true;
}
else
hiddenSeqs = new Vector();
}
- hiddenSeqs.addElement((jalview.datamodel.Sequence) seqRefIds
+ hiddenSeqs.addElement(seqRefIds
.get(seqId));
}
{
jaa.graphHeight = an[i].getGraphHeight();
}
+ if (an[i].hasBelowAlignment())
+ {
+ jaa.belowAlignment=an[i].isBelowAlignment();
+ }
+ jaa.setCalcId(an[i].getCalcId());
+
if (jaa.autoCalculated)
{
autoAlan.add(new JvAnnotRow(i, jaa));
// file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
// seqs_file 2}, boolean[] {
// linkAlignPanel,superposeWithAlignpanel}} from hash
- Object[] jmoldat = (Object[]) jmolViewIds.get(sviewid);
+ Object[] jmoldat = jmolViewIds.get(sviewid);
((boolean[]) jmoldat[3])[0] |= ids[p].getStructureState(s)
.hasAlignwithAlignPanel() ? ids[p].getStructureState(
s).getAlignwithAlignPanel() : false;
}
if (ids[p].getFile() != null)
{
+ File mapkey=new File(ids[p].getFile());
Object[] seqstrmaps = (Object[]) ((Hashtable) jmoldat[2])
- .get(ids[p].getFile());
+ .get(mapkey);
if (seqstrmaps == null)
{
((Hashtable) jmoldat[2]).put(
- new File(ids[p].getFile()).toString(),
+ mapkey,
seqstrmaps = new Object[]
{ pdbFile, ids[p].getId(), new Vector(),
new Vector() });
Object[] svattrib = entry.getValue();
int[] geom = (int[]) svattrib[0];
String state = (String) svattrib[1];
- Hashtable<String, Object[]> oldFiles = (Hashtable<String, Object[]>) svattrib[2];
+ Hashtable<File, Object[]> oldFiles = (Hashtable<File, Object[]>) svattrib[2];
final boolean useinJmolsuperpos = ((boolean[]) svattrib[3])[0], usetoColourbyseq = ((boolean[]) svattrib[3])[1], jmolColouring = ((boolean[]) svattrib[3])[2];
int x = geom[0], y = geom[1], width = geom[2], height = geom[3];
// collate the pdbfile -> sequence mappings from this view
{
newFileLoc = new StringBuffer();
}
+ do {
+ // look for next filename in load statement
newFileLoc.append(state.substring(cp,
ncp = (state.indexOf("\"", ncp + 1) + 1)));
String oldfilenam = state.substring(ncp,
// recover the new mapping data for this old filename
// have to normalize filename - since Jmol and jalview do filename
// translation differently.
- Object[] filedat = oldFiles.get(new File(oldfilenam)
- .toString());
- newFileLoc.append(((String) filedat[0]));
+ Object[] filedat = oldFiles.get(new File(oldfilenam));
+ newFileLoc.append(Platform.escapeString((String) filedat[0]));
pdbfilenames.addElement((String) filedat[0]);
pdbids.addElement((String) filedat[1]);
- seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
+ seqmaps.addElement(((Vector<SequenceI>) filedat[2])
.toArray(new SequenceI[0]));
newFileLoc.append("\"");
cp = ecp + 1; // advance beyond last \" and set cursor so we can
// look for next file statement.
+ } while ((ncp=state.indexOf("/*file*/",cp))>-1);
}
if (cp > 0)
{
.print("Ignoring incomplete Jmol state for PDB ids: ");
newFileLoc = new StringBuffer(state);
newFileLoc.append("; load append ");
- for (String id : oldFiles.keySet())
+ for (File id : oldFiles.keySet())
{
// add this and any other pdb files that should be present in
// the viewer
newFileLoc.append(((String) filedat[0]));
pdbfilenames.addElement((String) filedat[0]);
pdbids.addElement((String) filedat[1]);
- seqmaps.addElement((SequenceI[]) ((Vector<SequenceI>) filedat[2])
+ seqmaps.addElement(((Vector<SequenceI>) filedat[2])
.toArray(new SequenceI[0]));
newFileLoc.append(" \"");
newFileLoc.append((String) filedat[0]);
// TODO: assemble String[] { pdb files }, String[] { id for each
// file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, {
// seqs_file 2}} from hash
- final String[] pdbf = (String[]) pdbfilenames
- .toArray(new String[pdbfilenames.size()]), id = (String[]) pdbids
+ final String[] pdbf = pdbfilenames
+ .toArray(new String[pdbfilenames.size()]), id = pdbids
.toArray(new String[pdbids.size()]);
- final SequenceI[][] sq = (SequenceI[][]) seqmaps
+ final SequenceI[][] sq = seqmaps
.toArray(new SequenceI[seqmaps.size()][]);
final String fileloc = newFileLoc.toString(), vid = sviewid;
final AlignFrame alf = af;
{
javax.swing.SwingUtilities.invokeAndWait(new Runnable()
{
+ @Override
public void run()
{
AppJmol sview = null;
// add mapping for sequences in this view to an already open Jmol
// instance
- for (String id : oldFiles.keySet())
+ for (File id : oldFiles.keySet())
{
// add this and any other pdb files that should be present in the
// viewer
Object[] filedat = oldFiles.get(id);
String pdbFile = (String) filedat[0];
- SequenceI[] seq = (SequenceI[]) ((Vector<SequenceI>) filedat[2])
+ SequenceI[] seq = ((Vector<SequenceI>) filedat[2])
.toArray(new SequenceI[0]);
- ((AppJmol) comp).jmb.ssm.setMapping(seq, null, pdbFile,
+ comp.jmb.ssm.setMapping(seq, null, pdbFile,
jalview.io.AppletFormatAdapter.FILE);
- ((AppJmol) comp).jmb.addSequenceForStructFile(pdbFile, seq);
+ comp.jmb.addSequenceForStructFile(pdbFile, seq);
}
// and add the AlignmentPanel's reference to the Jmol view
- ((AppJmol) comp).addAlignmentPanel(ap);
+ comp.addAlignmentPanel(ap);
if (useinJmolsuperpos)
{
- ((AppJmol) comp).useAlignmentPanelForSuperposition(ap);
+ comp.useAlignmentPanelForSuperposition(ap);
}
else
{
- ((AppJmol) comp).excludeAlignmentPanelForSuperposition(ap);
+ comp.excludeAlignmentPanelForSuperposition(ap);
}
if (usetoColourbyseq)
{
- ((AppJmol) comp).useAlignmentPanelForColourbyseq(ap,
+ comp.useAlignmentPanelForColourbyseq(ap,
!jmolColouring);
}
else
{
- ((AppJmol) comp).excludeAlignmentPanelForColourbyseq(ap);
+ comp.excludeAlignmentPanelForColourbyseq(ap);
}
}
}
for (int i = 0; i < JSEQ.length; i++)
{
- af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),
+ af.viewport.setSequenceColour(af.viewport.getAlignment().getSequenceAt(i),
new java.awt.Color(JSEQ[i].getColour()));
}
jalview.gui.AlignViewport av = (jalview.gui.AlignViewport) viewportsAdded
.get(uniqueSeqSetId);
- af.viewport.sequenceSetID = uniqueSeqSetId;
+ af.viewport.setSequenceSetId(uniqueSeqSetId);
if (av != null)
{
// propagate shared settings to this new view
else if (view.getBgColour().startsWith("Annotation"))
{
// int find annotation
- if (af.viewport.alignment.getAlignmentAnnotation() != null)
+ if (af.viewport.getAlignment().getAlignmentAnnotation() != null)
{
- for (int i = 0; i < af.viewport.alignment
+ for (int i = 0; i < af.viewport.getAlignment()
.getAlignmentAnnotation().length; i++)
{
- if (af.viewport.alignment.getAlignmentAnnotation()[i].label
+ if (af.viewport.getAlignment().getAlignmentAnnotation()[i].label
.equals(view.getAnnotationColours().getAnnotation()))
{
- if (af.viewport.alignment.getAlignmentAnnotation()[i]
+ if (af.viewport.getAlignment().getAlignmentAnnotation()[i]
.getThreshold() == null)
{
- af.viewport.alignment.getAlignmentAnnotation()[i]
+ af.viewport.getAlignment().getAlignmentAnnotation()[i]
.setThreshold(new jalview.datamodel.GraphLine(view
.getAnnotationColours().getThreshold(),
"Threshold", java.awt.Color.black)
.equals("None"))
{
cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
+ af.viewport.getAlignment().getAlignmentAnnotation()[i],
new java.awt.Color(view.getAnnotationColours()
.getMinColour()), new java.awt.Color(view
.getAnnotationColours().getMaxColour()),
.startsWith("ucs"))
{
cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
+ af.viewport.getAlignment().getAlignmentAnnotation()[i],
GetUserColourScheme(jms, view
.getAnnotationColours().getColourScheme()),
view.getAnnotationColours().getAboveThreshold());
else
{
cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
+ af.viewport.getAlignment().getAlignmentAnnotation()[i],
ColourSchemeProperty.getColour(al, view
.getAnnotationColours().getColourScheme()),
view.getAnnotationColours().getAboveThreshold());
{
for (int g = 0; g < al.getGroups().size(); g++)
{
- jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) al
- .getGroups().elementAt(g);
+ jalview.datamodel.SequenceGroup sg = al
+ .getGroups().get(g);
if (sg.cs == null)
{
* if
* (view.getAnnotationColours().getColourScheme().equals("None"
* )) { sg.cs = new AnnotationColourGradient(
- * af.viewport.alignment.getAlignmentAnnotation()[i], new
+ * af.viewport.getAlignment().getAlignmentAnnotation()[i], new
* java.awt.Color(view.getAnnotationColours().
* getMinColour()), new
* java.awt.Color(view.getAnnotationColours().
*/
{
sg.cs = new AnnotationColourGradient(
- af.viewport.alignment.getAlignmentAnnotation()[i],
+ af.viewport.getAlignment().getAlignmentAnnotation()[i],
sg.cs, view.getAnnotationColours()
.getAboveThreshold());
}
if (cs != null)
{
cs.setThreshold(view.getPidThreshold(), true);
- cs.setConsensus(af.viewport.hconsensus);
+ cs.setConsensus(af.viewport.getSequenceConsensusHash());
}
}
}
if (view.hasIgnoreGapsinConsensus())
{
- af.viewport.ignoreGapsInConsensusCalculation = view
- .getIgnoreGapsinConsensus();
+ af.viewport.setIgnoreGapsConsensus(view
+ .getIgnoreGapsinConsensus(), null);
}
if (view.hasFollowHighlight())
{
}
if (view.hasShowSequenceLogo())
{
- af.viewport.showSequenceLogo = view.getShowSequenceLogo();
+ af.viewport.setShowSequenceLogo(view.getShowSequenceLogo());
}
else
{
- af.viewport.showSequenceLogo = false;
+ af.viewport.setShowSequenceLogo(false);
}
if (view.hasShowDbRefTooltip())
{
/**
* TODO remove this method
- *
+ *
* @param view
* @return AlignFrame bound to sequenceSetId from view, if one exists. private
* AlignFrame getSkippedFrame(Viewport view) { if (skipList==null) {
/**
* Check if the Jalview view contained in object should be skipped or not.
- *
+ *
* @param object
* @return true if view's sequenceSetId is a key in skipList
*/
}
/**
- *
+ *
* @param vamsasSeq
* sequence definition to create/merge dataset sequence for
* @param ds
jalview.datamodel.SequenceI dsq = null;
if (sq != null && sq.getDatasetSequence() != null)
{
- dsq = (jalview.datamodel.SequenceI) sq.getDatasetSequence();
+ dsq = sq.getDatasetSequence();
}
String sqid = vamsasSeq.getDsseqid();
/**
* make a new dataset ID for this jalview dataset alignment
- *
+ *
* @param dataset
* @return
*/
af.closeMenuItem_actionPerformed(true);
/*
- * if(ap.av.alignment.getAlignmentAnnotation()!=null) { for(int i=0;
- * i<ap.av.alignment.getAlignmentAnnotation().length; i++) {
- * if(!ap.av.alignment.getAlignmentAnnotation()[i].autoCalculated) {
- * af.alignPanel.av.alignment.getAlignmentAnnotation()[i] =
- * ap.av.alignment.getAlignmentAnnotation()[i]; } } }
+ * if(ap.av.getAlignment().getAlignmentAnnotation()!=null) { for(int i=0;
+ * i<ap.av.getAlignment().getAlignmentAnnotation().length; i++) {
+ * if(!ap.av.getAlignment().getAlignmentAnnotation()[i].autoCalculated) {
+ * af.alignPanel.av.getAlignment().getAlignmentAnnotation()[i] =
+ * ap.av.getAlignment().getAlignmentAnnotation()[i]; } } }
*/
return af.alignPanel;
* flag indicating if hashtables should be cleared on finalization TODO this
* flag may not be necessary
*/
- private boolean _cleartables = true;
+ private final boolean _cleartables = true;
private Hashtable jvids2vobj;
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Object#finalize()
*/
+ @Override
protected void finalize() throws Throwable
{
// really make sure we have no buried refs left.
* finalize and clearSeqRefs will not clear the tables when the Jalview2XML
* object goes out of scope. - also populates the datasetIds hashtable with
* alignment objects containing dataset sequences
- *
+ *
* @param vobj2jv
* Map from ID strings to jalview datamodel
* @param jv2vobj
* Map from jalview datamodel to ID strings
- *
- *
+ *
+ *
*/
public void setObjectMappingTables(Hashtable vobj2jv,
IdentityHashMap jv2vobj)
* set the uniqueSetSuffix used to prefix/suffix object IDs for jalview
* objects created from the project archive. If string is null (default for
* construction) then suffix will be set automatically.
- *
+ *
* @param string
*/
public void setUniqueSetSuffix(String string)
/**
* uses skipList2 as the skipList for skipping views on sequence sets
* associated with keys in the skipList
- *
+ *
* @param skipList2
*/
public void setSkipList(Hashtable skipList2)
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
\r
for (int i = 0; i < JSEQ.length; i++)\r
{\r
- af.viewport.setSequenceColour(af.viewport.alignment.getSequenceAt(i),\r
+ af.viewport.setSequenceColour(af.viewport.getAlignment().getSequenceAt(i),\r
new java.awt.Color(JSEQ[i].getColour()));\r
}\r
\r
if (cs != null)\r
{\r
cs.setThreshold(view.getPidThreshold(), true);\r
- cs.setConsensus(af.viewport.hconsensus);\r
+ cs.setConsensus(af.viewport.getSequenceConsensusHash());\r
}\r
}\r
\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
+import jalview.renderer.AnnotationRenderer;
+
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
AlignmentPanel ap;
+ final AnnotationRenderer renderer = new AnnotationRenderer();
float scalew = 1f;
float scaleh = 1f;
/**
* Creates a new OverviewPanel object.
- *
+ *
* @param ap
* DOCUMENT ME!
*/
fr = new FeatureRenderer(ap);
// scale the initial size of overviewpanel to shape of alignment
- float initialScale = (float) av.alignment.getWidth()
- / (float) av.alignment.getHeight();
+ float initialScale = (float) av.getAlignment().getWidth()
+ / (float) av.getAlignment().getHeight();
- if (av.conservation == null)
+ if (av.getAlignmentConservationAnnotation()== null)
{
graphHeight = 0;
}
- if (av.alignment.getWidth() > av.alignment.getHeight())
+ if (av.getAlignment().getWidth() > av.getAlignment().getHeight())
{
// wider
width = 400;
addComponentListener(new ComponentAdapter()
{
+ @Override
public void componentResized(ComponentEvent evt)
{
if ((getWidth() != width)
addMouseMotionListener(new MouseMotionAdapter()
{
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (!av.wrapAlignment)
addMouseListener(new MouseAdapter()
{
+ @Override
public void mousePressed(MouseEvent evt)
{
if (!av.wrapAlignment)
if (boxX > (width - boxWidth))
{
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
// Try smallest possible box
boxWidth = (int) ((av.endRes - av.startRes + 1) * av.getCharWidth() * scalew);
int col = (int) (boxX / scalew / av.getCharWidth());
int row = (int) (boxY / scaleh / av.getCharHeight());
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (!av.getColumnSelection().isVisible(col))
{
col = av.getColumnSelection().findColumnPosition(col);
}
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- row = av.alignment.getHiddenSequences().findIndexWithoutHiddenSeqs(
+ row = av.getAlignment().getHiddenSequences().findIndexWithoutHiddenSeqs(
row);
}
/**
* DOCUMENT ME!
*/
+ @Override
public void run()
{
miniMe = null;
fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer());
}
- int alwidth = av.alignment.getWidth();
- int alheight = av.alignment.getHeight()
- + av.alignment.getHiddenSequences().getSize();
+ int alwidth = av.getAlignment().getWidth();
+ int alheight = av.getAlignment().getHeight()
+ + av.getAlignment().getHiddenSequences().getSize();
setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));
lastrow = (int) (row * sampleRow);
hiddenRow = false;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- seq = av.alignment.getHiddenSequences().getHiddenSequence(lastrow);
+ seq = av.getAlignment().getHiddenSequences().getHiddenSequence(lastrow);
if (seq == null)
{
- int index = av.alignment.getHiddenSequences()
+ int index = av.getAlignment().getHiddenSequences()
.findIndexWithoutHiddenSeqs(lastrow);
- seq = av.alignment.getSequenceAt(index);
+ seq = av.getAlignment().getSequenceAt(index);
}
else
{
}
else
{
- seq = av.alignment.getSequenceAt(lastrow);
+ seq = av.getAlignment().getSequenceAt(lastrow);
}
if (seq == null)
}
if (hiddenRow
- || (av.hasHiddenColumns && !av.getColumnSelection()
+ || (av.hasHiddenColumns() && !av.getColumnSelection()
.isVisible(lastcol)))
{
color = new Color(color).darker().darker().getRGB();
}
}
- if (av.conservation != null)
+ if (av.getAlignmentConservationAnnotation()!= null)
{
+ renderer.updateFromAlignViewport(av);
for (col = 0; col < width; col++)
{
lastcol = (int) (col * sampleCol);
{
mg.translate(col, sequencesHeight);
- ap.annotationPanel.drawGraph(mg, av.conservation,
+ renderer.drawGraph(mg, av.getAlignmentConservationAnnotation(),av.getAlignmentConservationAnnotation().annotations,
(int) (sampleCol) + 1, graphHeight,
(int) (col * sampleCol), (int) (col * sampleCol) + 1);
mg.translate(-col, -sequencesHeight);
*/
public void setBoxPosition()
{
- int fullsizeWidth = av.alignment.getWidth() * av.getCharWidth();
- int fullsizeHeight = (av.alignment.getHeight() + av.alignment
+ int fullsizeWidth = av.getAlignment().getWidth() * av.getCharWidth();
+ int fullsizeHeight = (av.getAlignment().getHeight() + av.getAlignment()
.getHiddenSequences().getSize()) * av.getCharHeight();
int startRes = av.getStartRes();
int endRes = av.getEndRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startRes = av.getColumnSelection().adjustForHiddenColumns(startRes);
endRes = av.getColumnSelection().adjustForHiddenColumns(endRes);
int startSeq = av.startSeq;
int endSeq = av.endSeq;
- if (av.hasHiddenRows)
+ if (av.hasHiddenRows())
{
- startSeq = av.alignment.getHiddenSequences().adjustForHiddenSeqs(
+ startSeq = av.getAlignment().getHiddenSequences().adjustForHiddenSeqs(
startSeq);
- endSeq = av.alignment.getHiddenSequences()
+ endSeq = av.getAlignment().getHiddenSequences()
.adjustForHiddenSeqs(endSeq);
}
boxX = (int) (startRes * av.getCharWidth() * scalew);
boxY = (int) (startSeq * av.getCharHeight() * scaleh);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
boxWidth = (int) ((endRes - startRes + 1) * av.getCharWidth() * scalew);
}
/**
* DOCUMENT ME!
- *
+ *
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
if (resizing)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
nucleotide=av.getAlignment().isNucleotide();
if (av.getSelectionGroup() == null)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
SeqCigar sq[] = seqstrings.getSequences();
int length = sq[0].getWidth();
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import java.util.*;
+import java.util.List;
import java.awt.*;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision$
*/
/**
* DOCUMENT ME!
- *
+ *
* @param comp
* DOCUMENT ME!
* @param al
if (validateSequences && comp instanceof AlignmentPanel
&& source instanceof AlignmentPanel)
{
- validateSequences(((AlignmentPanel) source).av.alignment,
- ((AlignmentPanel) comp).av.alignment);
+ validateSequences(((AlignmentPanel) source).av.getAlignment(),
+ ((AlignmentPanel) comp).av.getAlignment());
}
if (comp instanceof AlignmentPanel && alignmentChanged)
{
if (i < comp.getHeight())
{
- comp.getSequences().insertElementAt(a1[i], i);
+ // TODO: the following does not trigger any recalculation of height/etc, or maintain the dataset
+ if (comp.getDataset()!=source.getDataset())
+ {
+ // raise an implementation warning here - not sure if this situation will ever occur
+ System.err.println("IMPLEMENTATION PROBLEM: DATASET out of sync due to an insert whilst calling PaintRefresher.validateSequences(AlignmentI, ALignmentI)");
+ }
+ List<SequenceI> alsq;
+ synchronized (alsq=comp.getSequences()) {
+ alsq.add(i, a1[i]);
+ }
}
else
{
{
if (comps.elementAt(i) instanceof AlignmentPanel)
{
- tmp.addElement(((AlignmentPanel) comps.elementAt(i)));
+ tmp.addElement(comps.elementAt(i));
}
}
AlignmentPanel[] result = new AlignmentPanel[tmp.size()];
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
if (av.getSelectionGroup() == null)
{
- seqs = av.alignment.getSequencesArray();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
- String type = (av.alignment.isNucleotide()) ? AlignSeq.DNA
+ String type = (av.getAlignment().isNucleotide()) ? AlignSeq.DNA
: AlignSeq.PEP;
float[][] scores = new float[seqs.length][seqs.length];
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ // protected JRadioButtonMenuItem covariationColour = new
+ // JRadioButtonMenuItem();
+
JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();
protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();
JMenuItem sequenceName = new JMenuItem();
- Sequence sequence;
+ SequenceI sequence;
JMenuItem unGroupMenuItem = new JMenuItem();
* @param links
* @param groupLinks
*/
- public PopupMenu(final AlignmentPanel ap, Sequence seq, Vector links,
+ public PopupMenu(final AlignmentPanel ap, final SequenceI seq, Vector links,
Vector groupLinks)
{
// /////////////////////////////////////////////////////////
colours.add(userDefinedColour);
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
+ colours.add(purinePyrimidineColour);
+ // colours.add(covariationColour);
for (int i = 0; i < jalview.io.FormatAdapter.WRITEABLE_FORMATS.length; i++)
{
}
else
{
+ if (ap.av.getAlignment().isNucleotide() == false)
+ {
structureMenu.remove(viewStructureMenu);
+ }
// structureMenu.remove(colStructureMenu);
}
+ if (ap.av.getAlignment().isNucleotide() == true)
+ {
+ AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation();
+ for (int i = 0; i < aa.length; i++)
+ {
+ if (aa[i].getRNAStruc() != null)
+ {
+ final String rnastruc = aa[i].getRNAStruc();
+ final String structureLine=aa[i].label;
+ menuItem = new JMenuItem();
+ menuItem.setText("2D RNA "+structureLine);
+ menuItem.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq
+ .getName(), ap);
+ }
+ });
+ viewStructureMenu.add(menuItem);
+ }
+ }
+
+ // SequenceFeatures[] test = seq.getSequenceFeatures();
+
+ if (seq.getAnnotation() != null)
+ {
+ AlignmentAnnotation seqAnno[] = seq.getAnnotation();
+ for (int i = 0; i < seqAnno.length; i++)
+ {
+ if (seqAnno[i].getRNAStruc() != null)
+ {
+ final String rnastruc = seqAnno[i].getRNAStruc();
+
+ // TODO: make rnastrucF a bit more nice
+ menuItem = new JMenuItem();
+ menuItem.setText("2D RNA - "+seq.getName());
+ menuItem.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ // TODO: VARNA does'nt print gaps in the sequence
+ new AppVarna(seq.getName()+" structure",seq,seq.getSequenceAsString(), rnastruc, seq
+ .getName(), ap);
+ }
+ });
+ viewStructureMenu.add(menuItem);
+ }
+ }
+ }
+
+
+ }
+
menuItem = new JMenuItem("Hide Sequences");
menuItem.addActionListener(new java.awt.event.ActionListener()
{
sequenceMenu.add(menuItem);
}
- if (ap.av.hasHiddenRows)
+ if (ap.av.hasHiddenRows())
{
- final int index = ap.av.alignment.findIndex(seq);
+ final int index = ap.av.getAlignment().findIndex(seq);
if (ap.av.adjustForHiddenSeqs(index)
- ap.av.adjustForHiddenSeqs(index - 1) > 1)
}
}
// for the case when no sequences are even visible
- if (ap.av.hasHiddenRows) {
+ if (ap.av.hasHiddenRows()) {
{
menuItem = new JMenuItem("Reveal All");
menuItem.addActionListener(new ActionListener()
{
clustalColour.setSelected(true);
}
+ else if (sg.cs instanceof PurinePyrimidineColourScheme)
+ {
+ purinePyrimidineColour.setSelected(true);
+ }
+ /*
+ * else if (sg.cs instanceof CovariationColourScheme) {
+ * covariationColour.setSelected(true); }
+ */
else
{
noColourmenuItem.setSelected(true);
editMenu.setVisible(false);
}
- if (!ap.av.alignment.getGroups().contains(sg))
+ if (!ap.av.getAlignment().getGroups().contains(sg))
{
unGroupMenuItem.setVisible(false);
}
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideMenuItem);
+ if (ap.getAlignment().isNucleotide()) {
+ colourMenu.add(purinePyrimidineColour);
+ }
+ // colourMenu.add(covariationColour);
colourMenu.add(userDefinedColour);
if (jalview.gui.UserDefinedColours.getUserColourSchemes() != null)
BLOSUM62Colour_actionPerformed();
}
});
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed();
+ }
+ });
+ /*
+ * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+ * public void actionPerformed(ActionEvent e) {
+ * covariationColour_actionPerformed(); } });
+ */
+
conservationMenuItem.setText("Conservation");
conservationMenuItem
.addActionListener(new java.awt.event.ActionListener()
{
SequenceGroup sg = getGroup();
sg.cs = new ClustalxColourScheme(
- sg.getSequences(ap.av.hiddenRepSequences),
- ap.av.alignment.getWidth());
+ sg,ap.av.getHiddenRepSequences());
refresh();
}
refresh();
}
+ protected void purinePyrimidineColour_actionPerformed()
+ {
+ getGroup().cs = new PurinePyrimidineColourScheme();
+ refresh();
+ }
+
+ /*
+ * protected void covariationColour_actionPerformed() { getGroup().cs = new
+ * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); }
+ */
/**
* DOCUMENT ME!
*
if (abovePIDColour.isSelected())
{
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+ sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
sg.getEndRes() + 1));
int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup()
SequenceGroup sg = getGroup();
sg.cs = new PIDColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+ sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
sg.getEndRes() + 1));
refresh();
}
sg.cs = new Blosum62ColourScheme();
sg.cs.setConsensus(AAFrequency.calculate(
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+ sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
sg.getEndRes() + 1));
refresh();
{
Conservation c = new Conservation("Group",
ResidueProperties.propHash, 3,
- sg.getSequences(ap.av.hiddenRepSequences), sg.getStartRes(),
+ sg.getSequences(ap.av.getHiddenRepSequences()), sg.getStartRes(),
sg.getEndRes() + 1);
c.calculate();
- c.verdict(false, ap.av.ConsPercGaps);
+ c.verdict(false, ap.av.getConsPercGaps());
sg.cs.setConservation(c);
// this method won't add a new group if it already exists
if (sg != null)
{
- ap.av.alignment.addGroup(sg);
+ ap.av.getAlignment().addGroup(sg);
}
return sg;
void unGroupMenuItem_actionPerformed()
{
SequenceGroup sg = ap.av.getSelectionGroup();
- ap.av.alignment.deleteGroup(sg);
+ ap.av.getAlignment().deleteGroup(sg);
ap.av.setSelectionGroup(null);
refresh();
}
}
ChangeCaseCommand caseCommand = new ChangeCaseCommand(description,
- sg.getSequencesAsArray(ap.av.hiddenRepSequences), startEnd,
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), startEnd,
caseChange);
ap.alignFrame.addHistoryItem(caseCommand);
ColumnSelection csel = new ColumnSelection(ap.av.getColumnSelection());
omitHidden = ap.av.getViewAsString(true);
Alignment oal = new Alignment(ap.av.getSequenceSelection());
- AlignmentAnnotation[] nala = ap.av.alignment.getAlignmentAnnotation();
+ AlignmentAnnotation[] nala = ap.av.getAlignment().getAlignmentAnnotation();
if (nala != null)
{
for (int i = 0; i < nala.length; i++)
public void discoverPDB_actionPerformed()
{
- final SequenceI[] sequences = ((ap.av.selectionGroup == null) ? new Sequence[]
+ final SequenceI[] sequences = ((ap.av.getSelectionGroup() == null) ? new SequenceI[]
{ sequence }
- : ap.av.selectionGroup.getSequencesInOrder(ap.av.alignment));
+ : ap.av.getSequenceSelection());
Thread discpdb = new Thread(new Runnable()
{
public void run()
AlignmentAnnotation an = new AlignmentAnnotation("Structure",
"Coloured by " + pdbid, anots);
- ap.av.alignment.addAnnotation(an);
+ ap.av.getAlignment().addAnnotation(an);
an.createSequenceMapping(sequence, 0, true);
// an.adjustForAlignment();
- ap.av.alignment.setAnnotationIndex(an, 0);
+ ap.av.getAlignment().setAnnotationIndex(an, 0);
ap.adjustAnnotationHeight();
EditCommand editCommand = new EditCommand("Edit Sequences",
EditCommand.REPLACE, dialog.getName().replace(' ',
ap.av.getGapCharacter()),
- sg.getSequencesAsArray(ap.av.hiddenRepSequences),
- sg.getStartRes(), sg.getEndRes() + 1, ap.av.alignment);
+ sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
+ sg.getStartRes(), sg.getEndRes() + 1, ap.av.getAlignment());
ap.alignFrame.addHistoryItem(editCommand);
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
if ((sg != null) && (sg.getSize() >= 1))
{
- originalSequences = sg.getSequencesInOrder(ap.av.alignment);
+ originalSequences = sg.getSequencesInOrder(ap.av.getAlignment());
start = sg.getStartRes();
end = sg.getEndRes();
}
else
{
- originalSequences = ap.av.alignment.getSequencesArray();
+ originalSequences = ap.av.getAlignment().getSequencesArray();
start = 0;
- end = ap.av.alignment.getWidth();
+ end = ap.av.getAlignment().getWidth();
}
height = originalSequences.length;
redundancy[i] = 0f;
}
- if (ap.av.hasHiddenColumns)
+ if (ap.av.hasHiddenColumns())
{
omitHidden = ap.av.getViewAsString(sg != null);
}
}
EditCommand cut = new EditCommand("Remove Redundancy",
- EditCommand.CUT, deleted, 0, width, ap.av.alignment);
+ EditCommand.CUT, deleted, 0, width, ap.av.getAlignment());
for (int i = 0; i < del.size(); i++)
{
- ap.av.alignment.deleteSequence(deleted[i]);
+ ap.av.getAlignment().deleteSequence(deleted[i]);
PaintRefresher.Refresh(this, ap.av.getSequenceSetId(), true, true);
if (sg != null)
{
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import javax.swing.JPanel;
import javax.swing.event.ListSelectionEvent;
-import com.sun.tools.corba.se.idl.InvalidArgument;
-
import net.miginfocom.swing.MigLayout;
import jalview.jbgui.GRestInputParamEditDialog;
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
aps[a].av.setSelectionGroup(new SequenceGroup());
aps[a].av.getSelectionGroup().addOrRemove(found, true);
aps[a].av.getSelectionGroup().setEndRes(
- aps[a].av.alignment.getWidth() - 1);
+ aps[a].av.getAlignment().getWidth() - 1);
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
int x = (evt.getX() / av.getCharWidth()) + av.getStartRes();
final int res;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
x = av.getColumnSelection().adjustForHiddenColumns(x);
}
- if (x >= av.alignment.getWidth())
+ if (x >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
else
{
{
av.hideColumns(res, res);
if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av.alignment
+ && av.getSelectionGroup().getSize() == av.getAlignment()
.getHeight())
{
av.setSelectionGroup(null);
av.getColumnSelection().addElement(res);
SequenceGroup sg = new SequenceGroup();
// try to be as quick as possible
- SequenceI[] iVec = av.alignment.getSequencesArray();
+ SequenceI[] iVec = av.getAlignment().getSequencesArray();
for (int i = 0; i < iVec.length; i++)
{
sg.addSequence(iVec[i], false);
int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (!stretchingGroup)
res = 0;
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (res < min)
public void mouseMoved(MouseEvent evt)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
return;
}
for (int i = 0; i < cs.size(); i++)
{
int sel = cs.columnAt(i);
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
if (cs.isVisible(sel))
{
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
gg.setColor(Color.blue);
int res;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
for (int i = scalestartx; i < endx; i += 10)
{
int value = i;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
value = av.getColumnSelection().adjustForHiddenColumns(value);
}
FontMetrics fm = getFontMetrics(av.getFont());
ypos += av.charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
startx = av.getColumnSelection().adjustForHiddenColumns(startx);
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
- int maxwidth = av.alignment.getWidth();
- if (av.hasHiddenColumns)
+ int maxwidth = av.getAlignment().getWidth();
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
// WEST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- SequenceI seq = av.alignment.getSequenceAt(i);
+ SequenceI seq = av.getAlignment().getSequenceAt(i);
int index = startx;
int value = -1;
continue;
}
- value = av.alignment.getSequenceAt(i).findPosition(index);
+ value = av.getAlignment().getSequenceAt(i).findPosition(index);
break;
}
{
ypos += av.charHeight;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
endx = av.getColumnSelection().adjustForHiddenColumns(endx);
}
SequenceI seq;
// EAST SCALE
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- seq = av.alignment.getSequenceAt(i);
+ seq = av.getAlignment().getSequenceAt(i);
int index = endx;
int value = -1;
String mask = "00";
int maxWidth = 0;
int tmp;
- for (int i = 0; i < av.alignment.getHeight(); i++)
+ for (int i = 0; i < av.getAlignment().getHeight(); i++)
{
- tmp = av.alignment.getSequenceAt(i).getEnd();
+ tmp = av.getAlignment().getSequenceAt(i).getEnd();
if (tmp > maxWidth)
{
maxWidth = tmp;
int endx;
int ypos = hgap;
- int maxwidth = av.alignment.getWidth() - 1;
+ int maxwidth = av.getAlignment().getWidth() - 1;
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
}
drawNorthScale(g, startRes, endx, ypos);
}
- if (av.hasHiddenColumns && av.showHiddenMarkers)
+ if (av.hasHiddenColumns() && av.showHiddenMarkers)
{
g.setColor(Color.blue);
int res;
annotations = new AnnotationPanel(av);
}
- annotations.drawComponent((Graphics2D) g, startRes, endx + 1);
+ annotations.renderer.drawComponent(annotations, av, (Graphics2D) g, -1, startRes, endx + 1);
g.translate(0, -cHeight - ypos - 3);
}
g.setClip(clip);
void drawPanel(Graphics g1, int startRes, int endRes, int startSeq,
int endSeq, int offset)
{
- if (!av.hasHiddenColumns)
+ if (!av.hasHiddenColumns())
{
draw(g1, startRes, endRes, startSeq, endSeq, offset);
}
// ///////////////////////////
for (int i = startSeq; i < endSeq; i++)
{
- nextSeq = av.alignment.getSequenceAt(i);
+ nextSeq = av.getAlignment().getSequenceAt(i);
if (nextSeq == null)
{
// occasionally, a race condition occurs such that the alignment row is
// empty
continue;
}
- sr.drawSequence(nextSeq, av.alignment.findAllGroups(nextSeq),
+ sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq),
startRes, endRes, offset + ((i - startSeq) * av.charHeight));
if (av.showSequenceFeatures)
}
if (av.getSelectionGroup() != null
- || av.alignment.getGroups().size() > 0)
+ || av.getAlignment().getGroups().size() > 0)
{
drawGroupsBoundaries(g, startRes, endRes, startSeq, endSeq, offset);
}
int groupIndex = -1;
int visWidth = (endRes - startRes + 1) * av.charWidth;
- if ((group == null) && (av.alignment.getGroups().size() > 0))
+ if ((group == null) && (av.getAlignment().getGroups().size() > 0))
{
- group = (SequenceGroup) av.alignment.getGroups().elementAt(0);
+ group = (SequenceGroup) av.getAlignment().getGroups().get(0);
groupIndex = 0;
}
if ((sx <= (endRes - startRes) * av.charWidth)
&& group.getSequences(null).contains(
- av.alignment.getSequenceAt(i)))
+ av.getAlignment().getSequenceAt(i)))
{
if ((bottom == -1)
&& !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i + 1)))
+ av.getAlignment().getSequenceAt(i + 1)))
{
bottom = sy + av.charHeight;
}
{
if (((top == -1) && (i == 0))
|| !group.getSequences(null).contains(
- av.alignment.getSequenceAt(i - 1)))
+ av.getAlignment().getSequenceAt(i - 1)))
{
top = sy;
}
g.setStroke(new BasicStroke());
- if (groupIndex >= av.alignment.getGroups().size())
+ if (groupIndex >= av.getAlignment().getGroups().size())
{
break;
}
- group = (SequenceGroup) av.alignment.getGroups().elementAt(
+ group = (SequenceGroup) av.getAlignment().getGroups().get(
groupIndex);
- } while (groupIndex < av.alignment.getGroups().size());
+ } while (groupIndex < av.getAlignment().getGroups().size());
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
/**
* DOCUMENT ME!
- *
+ *
* @author $author$
* @version $Revision: 1.130 $
*/
/**
* Creates a new SeqPanel object.
- *
+ *
* @param avp
* DOCUMENT ME!
* @param p
res = (x / av.getCharWidth()) + av.getStartRes();
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
res = av.getColumnSelection().adjustForHiddenColumns(res);
}
y -= hgap;
seq = Math.min((y % cHeight) / av.getCharHeight(),
- av.alignment.getHeight() - 1);
+ av.getAlignment().getHeight() - 1);
}
else
{
seq = Math.min((y / av.getCharHeight()) + av.getStartSeq(),
- av.alignment.getHeight() - 1);
+ av.getAlignment().getHeight() - 1);
}
return seq;
void setCursorPosition()
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+ SequenceI sequence = av.getAlignment().getSequenceAt(
seqCanvas.cursorY);
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1() - 1);
{
seqCanvas.cursorX += dx;
seqCanvas.cursorY += dy;
- if (av.hasHiddenColumns && !av.colSel.isVisible(seqCanvas.cursorX))
+ if (av.hasHiddenColumns() && !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
int original = seqCanvas.cursorX - dx;
- int maxWidth = av.alignment.getWidth();
+ int maxWidth = av.getAlignment().getWidth();
- while (!av.colSel.isVisible(seqCanvas.cursorX)
+ while (!av.getColumnSelection().isVisible(seqCanvas.cursorX)
&& seqCanvas.cursorX < maxWidth && seqCanvas.cursorX > 0)
{
seqCanvas.cursorX += dx;
}
if (seqCanvas.cursorX >= maxWidth
- || !av.colSel.isVisible(seqCanvas.cursorX))
+ || !av.getColumnSelection().isVisible(seqCanvas.cursorX))
{
seqCanvas.cursorX = original;
}
{
seqCanvas.cursorX = 0;
}
- else if (seqCanvas.cursorX > av.alignment.getWidth() - 1)
+ else if (seqCanvas.cursorX > av.getAlignment().getWidth() - 1)
{
- seqCanvas.cursorX = av.alignment.getWidth() - 1;
+ seqCanvas.cursorX = av.getAlignment().getWidth() - 1;
}
if (seqCanvas.cursorY < 0)
{
seqCanvas.cursorY = 0;
}
- else if (seqCanvas.cursorY > av.alignment.getHeight() - 1)
+ else if (seqCanvas.cursorY > av.getAlignment().getHeight() - 1)
{
- seqCanvas.cursorY = av.alignment.getHeight() - 1;
+ seqCanvas.cursorY = av.getAlignment().getHeight() - 1;
}
endEditing();
}
if (!av.wrapAlignment)
{
- while (seqCanvas.cursorX < av.colSel
+ while (seqCanvas.cursorX < av.getColumnSelection()
.adjustForHiddenColumns(av.startRes))
{
if (!ap.scrollRight(false))
break;
}
}
- while (seqCanvas.cursorX > av.colSel
+ while (seqCanvas.cursorX > av.getColumnSelection()
.adjustForHiddenColumns(av.endRes))
{
if (!ap.scrollRight(true))
}
}
}
- setStatusMessage(av.alignment.getSequenceAt(seqCanvas.cursorY),
+ setStatusMessage(av.getAlignment().getSequenceAt(seqCanvas.cursorY),
seqCanvas.cursorX, seqCanvas.cursorY);
seqCanvas.repaint();
void setSelectionAreaAtCursor(boolean topLeft)
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+ SequenceI sequence = av.getAlignment().getSequenceAt(
seqCanvas.cursorY);
if (av.getSelectionGroup() != null)
{
- SequenceGroup sg = av.selectionGroup;
+ SequenceGroup sg = av.getSelectionGroup();
// Find the top and bottom of this group
- int min = av.alignment.getHeight(), max = 0;
+ int min = av.getAlignment().getHeight(), max = 0;
for (int i = 0; i < sg.getSize(); i++)
{
- int index = av.alignment.findIndex(sg.getSequenceAt(i));
+ int index = av.getAlignment().findIndex(sg.getSequenceAt(i));
if (index > max)
{
max = index;
sg.getSequences(null).clear();
for (int i = min; i < max; i++)
{
- sg.addSequence(av.alignment.getSequenceAt(i), false);
+ sg.addSequence(av.getAlignment().getSequenceAt(i), false);
}
}
}
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX;
- editSequence(true, seqCanvas.cursorX + getKeyboardNo1());
+ editSequence(true, false, seqCanvas.cursorX + getKeyboardNo1());
endEditing();
}
groupEditing = group;
startseq = seqCanvas.cursorY;
lastres = seqCanvas.cursorX + getKeyboardNo1();
- editSequence(false, seqCanvas.cursorX);
+ editSequence(false, false, seqCanvas.cursorX);
endEditing();
}
+ void insertNucAtCursor(boolean group,String nuc){
+ groupEditing = group;
+ startseq = seqCanvas.cursorY;
+ lastres = seqCanvas.cursorX;
+ editSequence(false, true, seqCanvas.cursorX + getKeyboardNo1());
+ endEditing();
+ }
+
void numberPressed(char value)
{
if (keyboardNo1 == null)
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseReleased(MouseEvent evt)
{
mouseDragging = false;
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mousePressed(MouseEvent evt)
{
lastMousePress = evt.getPoint();
String lastMessage;
+ @Override
public void mouseOverSequence(SequenceI sequence, int index, int pos)
{
String tmp = sequence.hashCode() + " " + index + " " + pos;
lastMessage = tmp;
}
+ @Override
public void highlightSequence(SearchResults results)
{
if (av.followHighlight)
seqCanvas.highlightSearchResults(results);
}
+ @Override
public void updateColours(SequenceI seq, int index)
{
System.out.println("update the seqPanel colours");
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseMoved(MouseEvent evt)
{
if (editingSeqs)
tooltipText.setLength(6); // Cuts the buffer back to <html>
- SequenceGroup[] groups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] groups = av.getAlignment().findAllGroups(sequence);
if (groups != null)
{
for (int g = 0; g < groups.length; g++)
/**
* appends the features at rpos to the given stringbuffer ready for display in
* a tooltip
- *
+ *
* @param tooltipText2
* @param linkImageURL
* @param rpos
/**
* Set status message in alignment panel
- *
+ *
* @param sequence
* aligned sequence object
* @param res
+ sequence.getName());
Object obj = null;
- if (av.alignment.isNucleotide())
+ if (av.getAlignment().isNucleotide())
{
obj = ResidueProperties.nucleotideName.get(sequence.getCharAt(res)
+ "");
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void mouseDragged(MouseEvent evt)
{
if (mouseWheelPressed)
if ((res < av.getAlignment().getWidth()) && (res < lastres))
{
// dragLeft, delete gap
- editSequence(false, res);
+ editSequence(false, false,res);
}
else
{
- editSequence(true, res);
+ editSequence(true, false,res);
}
mouseDragging = true;
}
}
- synchronized void editSequence(boolean insertGap, int startres)
+ //TODO: Make it more clever than many booleans
+ synchronized void editSequence(boolean insertGap, boolean editSeq, int startres)
{
int fixedLeft = -1;
int fixedRight = -1;
boolean fixedColumns = false;
SequenceGroup sg = av.getSelectionGroup();
- SequenceI seq = av.alignment.getSequenceAt(startseq);
+ SequenceI seq = av.getAlignment().getSequenceAt(startseq);
// No group, but the sequence may represent a group
- if (!groupEditing && av.hasHiddenRows)
+ if (!groupEditing && av.hasHiddenRows())
{
- if (av.hiddenRepSequences != null
- && av.hiddenRepSequences.containsKey(seq))
+ if (av.isHiddenRepSequence(seq))
{
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
groupEditing = true;
}
}
// Are we editing within a selection group?
if (groupEditing
- || (sg != null && sg.getSequences(av.hiddenRepSequences)
+ || (sg != null && sg.getSequences(av.getHiddenRepSequences())
.contains(seq)))
{
fixedColumns = true;
// but the sequence represents a group
if (sg == null)
{
- if (av.hiddenRepSequences == null
- || !av.hiddenRepSequences.containsKey(seq))
+ if (!av.isHiddenRepSequence(seq))
{
endEditing();
return;
}
- sg = (SequenceGroup) av.hiddenRepSequences.get(seq);
+ sg = av.getRepresentedSequences(seq);
}
fixedLeft = sg.getStartRes();
}
}
- if (av.hasHiddenColumns)
+ if (av.hasHiddenColumns())
{
fixedColumns = true;
int y1 = av.getColumnSelection().getHiddenBoundaryLeft(startres);
if (groupEditing)
{
- Vector vseqs = sg.getSequences(av.hiddenRepSequences);
+ List<SequenceI> vseqs = sg.getSequences(av.getHiddenRepSequences());
int g, groupSize = vseqs.size();
SequenceI[] groupSeqs = new SequenceI[groupSize];
for (g = 0; g < groupSeqs.length; g++)
{
- groupSeqs[g] = (SequenceI) vseqs.elementAt(g);
+ groupSeqs[g] = vseqs.get(g);
}
// drag to right
// If the user has selected the whole sequence, and is dragging to
// the right, we can still extend the alignment and selectionGroup
if (sg.getStartRes() == 0 && sg.getEndRes() == fixedRight
- && sg.getEndRes() == av.alignment.getWidth() - 1)
+ && sg.getEndRes() == av.getAlignment().getWidth() - 1)
{
- sg.setEndRes(av.alignment.getWidth() + startres - lastres);
+ sg.setEndRes(av.getAlignment().getWidth() + startres - lastres);
fixedRight = sg.getEndRes();
}
if (!blank)
{
- if (sg.getSize() == av.alignment.getHeight())
+ if (sg.getSize() == av.getAlignment().getHeight())
{
- if ((av.hasHiddenColumns && startres < av.getColumnSelection()
+ if ((av.hasHiddenColumns() && startres < av.getColumnSelection()
.getHiddenBoundaryRight(startres)))
{
endEditing();
return;
}
- int alWidth = av.alignment.getWidth();
- if (av.hasHiddenRows)
+ int alWidth = av.getAlignment().getWidth();
+ if (av.hasHiddenRows())
{
- int hwidth = av.alignment.getHiddenSequences().getWidth();
+ int hwidth = av.getAlignment().getHiddenSequences().getWidth();
if (hwidth > alWidth)
{
alWidth = hwidth;
else
{
editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
- startres, startres - lastres, av.alignment, true);
+ startres, startres - lastres, av.getAlignment(), true);
}
}
else
else
{
editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
- startres, lastres - startres, av.alignment, true);
+ startres, lastres - startres, av.getAlignment(), true);
}
}
else
{
editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
- { seq }, lastres, startres - lastres, av.alignment, true);
- }
+ { seq }, lastres, startres - lastres, av.getAlignment(), true);
+ }
}
else
{
+ if(!editSeq){
// dragging to the left
if (fixedColumns && fixedRight != -1)
{
if (max > 0)
{
editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
- { seq }, startres, max, av.alignment, true);
+ { seq }, startres, max, av.getAlignment(), true);
}
}
+ }else{//insertGap==false AND editSeq==TRUE;
+ if (fixedColumns && fixedRight != -1)
+ {
+ for (int j = lastres; j < startres; j++)
+ {
+ insertChar(j, new SequenceI[]
+ { seq }, fixedRight);
+ }
+ }
+ else
+ {
+ editCommand.appendEdit(EditCommand.INSERT_NUC, new SequenceI[]
+ { seq }, lastres, startres - lastres, av.getAlignment(), true);
+ }
+ }
}
}
}
editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
- av.alignment, true);
+ av.getAlignment(), true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1, av.getAlignment(),
true);
}
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.alignment,
+ editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1, av.getAlignment(),
true);
editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
- av.alignment, true);
+ av.getAlignment(), true);
}
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseEntered(MouseEvent e)
{
if (oldSeq < 0)
/**
* DOCUMENT ME!
- *
+ *
* @param e
* DOCUMENT ME!
*/
+ @Override
public void mouseExited(MouseEvent e)
{
if (av.getWrapAlignment())
}
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
SequenceGroup sg = null;
- SequenceI sequence = av.alignment.getSequenceAt(findSeq(evt));
+ SequenceI sequence = av.getAlignment().getSequenceAt(findSeq(evt));
if (evt.getClickCount() > 1)
{
sg = av.getSelectionGroup();
}
}
+ @Override
public void mouseWheelMoved(MouseWheelEvent e)
{
e.consume();
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
startWrapBlock = wrappedBlock;
- if (av.wrapAlignment && seq > av.alignment.getHeight())
+ if (av.wrapAlignment && seq > av.getAlignment().getHeight())
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
"Cannot edit annotations in wrapped view.",
return;
}
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
if ((sequence == null) || (res > sequence.getLength()))
{
if (stretchGroup == null)
{
- stretchGroup = av.alignment.findGroup(sequence);
+ stretchGroup = av.getAlignment().findGroup(sequence);
if ((stretchGroup != null) && (res > stretchGroup.getStartRes())
&& (res < stretchGroup.getEndRes()))
{
stretchGroup = null;
- SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);
+ SequenceGroup[] allGroups = av.getAlignment().findAllGroups(sequence);
if (allGroups != null)
{
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
{
if (stretchGroup.cs instanceof ClustalxColourScheme)
{
- ((ClustalxColourScheme) stretchGroup.cs).resetClustalX(
- stretchGroup.getSequences(av.hiddenRepSequences),
- stretchGroup.getWidth());
+ ((ClustalxColourScheme) stretchGroup.cs).alignmentChanged(
+ stretchGroup,av.getHiddenRepSequences());
}
if (stretchGroup.cs.conservationApplied())
/**
* DOCUMENT ME!
- *
+ *
* @param evt
* DOCUMENT ME!
*/
return;
}
- if (res >= av.alignment.getWidth())
+ if (res >= av.getAlignment().getWidth())
{
- res = av.alignment.getWidth() - 1;
+ res = av.getAlignment().getWidth() - 1;
}
if (stretchGroup.getEndRes() == res)
dragDirection = -1;
}
- while ((y != oldSeq) && (oldSeq > -1) && (y < av.alignment.getHeight()))
+ while ((y != oldSeq) && (oldSeq > -1) && (y < av.getAlignment().getHeight()))
{
// This routine ensures we don't skip any sequences, as the
// selection is quite slow.
running = false;
}
+ @Override
public void run()
{
running = true;
}
if (mouseDragging && (evt.getY() >= getHeight())
- && (av.alignment.getHeight() > av.getEndSeq()))
+ && (av.getAlignment().getHeight() > av.getEndSeq()))
{
running = ap.scrollUp(false);
}
/**
* modify current selection according to a received message.
*/
+ @Override
public void selection(SequenceGroup seqsel, ColumnSelection colsel,
SelectionSource source)
{
SequenceGroup sgroup = null;
if (seqsel != null && seqsel.getSize()>0)
{
- if (av.alignment == null)
+ if (av.getAlignment() == null)
{
jalview.bin.Cache.log.warn("alignviewport av SeqSetId="
+ av.getSequenceSetId() + " ViewId=" + av.getViewId()
+ " 's alignment is NULL! returning immediatly.");
return;
}
- sgroup = seqsel.intersect(av.alignment,
- (av.hasHiddenRows) ? av.hiddenRepSequences : null);
+ sgroup = seqsel.intersect(av.getAlignment(),
+ (av.hasHiddenRows()) ? av.getHiddenRepSequences() : null);
if ((sgroup == null || sgroup.getSize() == 0)
|| (colsel == null || colsel.size() == 0))
{
// so import the new colsel.
if (colsel == null || colsel.size() == 0)
{
- if (av.colSel != null)
+ if (av.getColumnSelection() != null)
{
- av.colSel.clear();
+ av.getColumnSelection().clear();
repaint=true;
}
}
else
{
// TODO: shift colSel according to the intersecting sequences
- if (av.colSel == null)
+ if (av.getColumnSelection() == null)
{
- av.colSel = new ColumnSelection(colsel);
+ av.setColumnSelection(new ColumnSelection(colsel));
}
else
{
- av.colSel.setElementsFrom(colsel);
+ av.getColumnSelection().setElementsFrom(colsel);
}
}
av.isColSelChanged(true);
repaint = true;
}
- if (copycolsel && av.hasHiddenColumns
- && (av.colSel == null || av.colSel.getHiddenColumns() == null))
+ if (copycolsel && av.hasHiddenColumns()
+ && (av.getColumnSelection() == null || av.getColumnSelection().getHiddenColumns() == null))
{
System.err.println("Bad things");
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
-import java.io.*;
import java.util.*;
+import java.util.List;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
-
-import MCview.*;
+import javax.swing.tree.DefaultMutableTreeNode;
import jalview.datamodel.*;
-import jalview.datamodel.xdb.embl.*;
-import java.io.File;
import jalview.io.*;
-import jalview.ws.DBRefFetcher;
-import jalview.ws.ebi.EBIFetchClient;
-import jalview.ws.seqfetcher.ASequenceFetcher;
+import jalview.util.DBRefUtils;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.seqfetcher.DbSourceProxy;
-
-import java.awt.Rectangle;
import java.awt.BorderLayout;
-import java.awt.Dimension;
public class SequenceFetcher extends JPanel implements Runnable
{
final String noDbSelected = "-- Select Database --";
- Hashtable sources = new Hashtable();
-
private static jalview.ws.SequenceFetcher sfetch = null;
- private static String dasRegistry = null;
+ private static long lastDasSourceRegistry = -3;
+
+ private static DasSourceRegistryI dasRegistry = null;
private static boolean _initingFetcher = false;
/**
* Blocking method that initialises and returns the shared instance of the
* SequenceFetcher client
- *
+ *
* @param guiWindow
* - where the initialisation delay message should be shown
* @return the singleton instance of the sequence fetcher client
}
}
if (sfetch == null
- || dasRegistry != DasSourceBrowser.getDasRegistryURL())
+ || dasRegistry != jalview.bin.Cache.getDasSourceRegistry()
+ || lastDasSourceRegistry != (jalview.bin.Cache
+ .getDasSourceRegistry().getDasRegistryURL() + jalview.bin.Cache
+ .getDasSourceRegistry().getLocalSourceString())
+ .hashCode())
{
_initingFetcher = true;
initingThread = Thread.currentThread();
guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
Thread.currentThread().hashCode());
}
- dasRegistry = DasSourceBrowser.getDasRegistryURL();
+ dasRegistry = jalview.bin.Cache.getDasSourceRegistry();
+ dasRegistry.refreshSources();
+
jalview.ws.SequenceFetcher sf = new jalview.ws.SequenceFetcher();
if (guiWindow != null)
{
guiWindow.setProgressBar("Initialising Sequence Database Fetchers",
Thread.currentThread().hashCode());
}
+ lastDasSourceRegistry = (dasRegistry.getDasRegistryURL() + dasRegistry
+ .getLocalSourceString()).hashCode();
sfetch = sf;
_initingFetcher = false;
initingThread = null;
Thread sf = new Thread(new Runnable()
{
+ @Override
public void run()
{
if (getSequenceFetcherSingleton(guiWindow) != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane
sf.start();
}
+ private class DatabaseAuthority extends DefaultMutableTreeNode
+ {
+
+ };
+
+ private class DatabaseSource extends DefaultMutableTreeNode
+ {
+
+ };
+
/**
* called by thread spawned by constructor
- *
+ *
* @param guiWindow
*/
private void initGui(IProgressIndicator guiWindow)
{
alignFrame = (AlignFrame) guiWindow;
}
-
- database.addItem(noDbSelected);
- /*
- * Dynamically generated database list will need a translation function from
- * internal source to externally distinct names. UNIPROT and UP_NAME are
- * identical DB sources, and should be collapsed.
- */
-
- String dbs[] = sfetch.getOrderedSupportedSources();
- for (int i = 0; i < dbs.length; i++)
- {
- if (!sources.containsValue(dbs[i]))
- {
- String name = sfetch.getSourceProxy(dbs[i]).getDbName();
- // duplicate source names are thrown away, here.
- if (!sources.containsKey(name))
- {
- database.addItem(name);
- }
- // overwrite with latest version of the retriever for this source
- sources.put(name, dbs[i]);
- }
- }
+ database = new JDatabaseTree(sfetch);
try
{
jbInit();
ok.setText("OK");
ok.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
ok_actionPerformed();
clear.setText("Clear");
clear.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
clear_actionPerformed();
example.setText("Example");
example.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
example_actionPerformed();
close.setText("Close");
close.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
close_actionPerformed(e);
textArea.setLineWrap(true);
textArea.addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_ENTER)
jPanel1.add(close);
jPanel3.add(jPanel2, java.awt.BorderLayout.CENTER);
jPanel2.setLayout(borderLayout3);
-
+ databaseButt = database.getDatabaseSelectorButton();
+ databaseButt.setFont(JvSwingUtils.getLabelFont());
database.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
- DbSourceProxy db = null;
try
{
- db = sfetch.getSourceProxy((String) sources.get(database
- .getSelectedItem()));
- String eq = db.getTestQuery();
+ databaseButt.setText(database.getSelectedItem()
+ + (database.getSelectedSources().size() > 1 ? " (and "
+ + database.getSelectedSources().size()
+ + " others)" : ""));
+ String eq = database.getExampleQueries();
dbeg.setText("Example query: " + eq);
- replacePunctuation.setEnabled(!(eq != null && eq.indexOf(",") > -1));
+ boolean enablePunct=!(eq != null && eq.indexOf(",") > -1);
+ for (DbSourceProxy dbs:database.getSelectedSources()) {
+ if (dbs instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)
+ {
+ enablePunct = false;
+ break;
+ }
+ }
+ replacePunctuation.setEnabled(enablePunct);
+
} catch (Exception ex)
{
dbeg.setText("");
}
});
dbeg.setText("");
- jPanel2.add(database, java.awt.BorderLayout.NORTH);
+ jPanel2.add(databaseButt, java.awt.BorderLayout.NORTH);
jPanel2.add(dbeg, java.awt.BorderLayout.CENTER);
JPanel jPanel2a = new JPanel(new BorderLayout());
jPanel2a.add(jLabel1, java.awt.BorderLayout.NORTH);
DbSourceProxy db = null;
try
{
- db = sfetch.getSourceProxy((String) sources.get(database
- .getSelectedItem()));
- textArea.setText(db.getTestQuery());
+ textArea.setText(database.getExampleQueries());
} catch (Exception ex)
{
}
JLabel dbeg = new JLabel();
- JComboBox database = new JComboBox();
+ JDatabaseTree database;
+
+ JButton databaseButt;
JLabel jLabel1 = new JLabel();
close.setEnabled(true);
}
+ @Override
public void run()
{
String error = "";
- if (database.getSelectedItem().equals(noDbSelected))
+ if (!database.hasSelection())
{
error += "Please select the source database\n";
}
resetDialog();
return;
}
- ArrayList<String> aresultq=new ArrayList<String>();
- ArrayList<AlignmentI> aresult = new ArrayList<AlignmentI>();
- Object source = database.getSelectedItem();
- Enumeration en = new StringTokenizer(textArea.getText(), ";");
- boolean isAliSource=false;
- try
- {
- guiWindow.setProgressBar(
- "Fetching Sequences from " + database.getSelectedItem(),
- Thread.currentThread().hashCode());
- DbSourceProxy proxy = sfetch.getSourceProxy((String) sources
- .get(source));
- isAliSource = proxy.isA(DBRefSource.ALIGNMENTDB);
- if (proxy.getAccessionSeparator() == null)
+ // indicate if successive sources should be merged into one alignment.
+ boolean addToLast=false;
+ ArrayList<String> aresultq = new ArrayList<String>(), presultTitle = new ArrayList<String>();
+ ArrayList<AlignmentI> presult = new ArrayList<AlignmentI>(), aresult = new ArrayList<AlignmentI>();
+ Iterator<DbSourceProxy> proxies = database.getSelectedSources()
+ .iterator();
+ String[] qries;
+ List<String> nextfetch = Arrays.asList(qries = textArea.getText()
+ .split(";"));
+ Iterator<String> en = Arrays.asList(new String[0]).iterator();
+ int nqueries = qries.length;
+ while (proxies.hasNext() && (en.hasNext() || nextfetch.size() > 0))
+ {
+ if (!en.hasNext() && nextfetch.size() > 0)
+ {
+ en = nextfetch.iterator();
+ nqueries = nextfetch.size();
+ // save the remaining queries in the original array
+ qries = nextfetch.toArray(new String[nqueries]);
+ nextfetch = new ArrayList<String>();
+ }
+
+ DbSourceProxy proxy = proxies.next();
+ boolean isAliSource = false;
+ try
{
- while (en.hasMoreElements())
+ // update status
+ guiWindow.setProgressBar("Fetching " + nqueries
+ + " sequence queries from " + proxy.getDbName(), Thread
+ .currentThread().hashCode());
+ isAliSource = proxy.isA(DBRefSource.ALIGNMENTDB);
+ if (proxy.getAccessionSeparator() == null)
{
- String item = (String) en.nextElement();
- try
+ while (en.hasNext())
{
- if (aresult != null)
+ String item = en.next();
+ try
{
+ if (aresult != null)
+ {
+ try
+ {
+ // give the server a chance to breathe
+ Thread.sleep(5);
+ } catch (Exception e)
+ {
+ //
+ }
+
+ }
+
+ AlignmentI indres = null;
try
{
- // give the server a chance to breathe
- Thread.sleep(5);
- } catch (Exception e)
+ indres = proxy.getSequenceRecords(item);
+ } catch (OutOfMemoryError oome)
{
- //
+ new OOMWarning("fetching " + item + " from "
+ + proxy.getDbName(), oome, this);
}
-
+ if (indres != null)
+ {
+ aresultq.add(item);
+ aresult.add(indres);
+ }
+ else
+ {
+ nextfetch.add(item);
+ }
+ } catch (Exception e)
+ {
+ jalview.bin.Cache.log.info("Error retrieving " + item
+ + " from " + proxy.getDbName(), e);
+ nextfetch.add(item);
}
-
- AlignmentI indres = null;
- try
+ }
+ }
+ else
+ {
+ StringBuffer multiacc = new StringBuffer();
+ ArrayList<String> tosend = new ArrayList<String>();
+ while (en.hasNext())
+ {
+ String nel = en.next();
+ tosend.add(nel);
+ multiacc.append(nel);
+ if (en.hasNext())
{
- indres = proxy.getSequenceRecords(item);
- } catch (OutOfMemoryError oome)
+ multiacc.append(proxy.getAccessionSeparator());
+ }
+ }
+ try
+ {
+ AlignmentI rslt;
+ SequenceI[] rs;
+ List<String> nores = new ArrayList<String>();
+ rslt = proxy.getSequenceRecords(multiacc.toString());
+ if (rslt == null || rslt.getHeight() == 0)
{
- new OOMWarning("fetching " + item + " from "
- + database.getSelectedItem(), oome, this);
+ // no results - pass on all queries to next source
+ nextfetch.addAll(tosend);
}
- if (indres != null)
+ else
{
- aresultq.add(item);
- aresult.add(indres);
+ aresultq.add(multiacc.toString());
+ aresult.add(rslt);
+
+ rs = rslt.getSequencesArray();
+ // search for each query in the dbrefs associated with each
+ // sequence
+ // returned.
+ // ones we do not find will be used to query next source (if any)
+ for (String q : tosend)
+ {
+ DBRefEntry dbr = new DBRefEntry(), found[] = null;
+ dbr.setSource(proxy.getDbSource());
+ boolean rfound = false;
+ for (int r = 0; r < rs.length; r++)
+ {
+ if (rs[r] != null
+ && (found = DBRefUtils.searchRefs(
+ rs[r].getDBRef(), dbr)) != null
+ && found.length > 0)
+ {
+ rfound = true;
+ rs[r] = null;
+ continue;
+ }
+ }
+ if (!rfound)
+ {
+ nextfetch.add(q);
+ }
+ }
}
- } catch (Exception e)
+ } catch (OutOfMemoryError oome)
{
- jalview.bin.Cache.log.info("Error retrieving " + item
- + " from " + source, e);
+ new OOMWarning("fetching " + multiacc + " from "
+ + database.getSelectedItem(), oome, this);
}
}
+
+ } catch (Exception e)
+ {
+ showErrorMessage("Error retrieving " + textArea.getText()
+ + " from " + database.getSelectedItem());
+ // error
+ // +="Couldn't retrieve sequences from "+database.getSelectedItem();
+ System.err.println("Retrieval failed for source ='"
+ + database.getSelectedItem() + "' and query\n'"
+ + textArea.getText() + "'\n");
+ e.printStackTrace();
+ } catch (OutOfMemoryError e)
+ {
+ // resets dialog box - so we don't use OOMwarning here.
+ showErrorMessage("Out of Memory when retrieving "
+ + textArea.getText()
+ + " from "
+ + database.getSelectedItem()
+ + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n");
+ e.printStackTrace();
+ } catch (Error e)
+ {
+ showErrorMessage("Serious Error retrieving " + textArea.getText()
+ + " from " + database.getSelectedItem());
+ e.printStackTrace();
}
- else
+ // Stack results ready for opening in alignment windows
+ if (aresult != null && aresult.size() > 0)
{
- StringBuffer multiacc = new StringBuffer();
- while (en.hasMoreElements())
+ AlignmentI ar = null;
+ if (isAliSource)
{
- multiacc.append(en.nextElement());
- if (en.hasMoreElements())
+ addToLast=false;
+ // new window for each result
+ while (aresult.size() > 0)
{
- multiacc.append(proxy.getAccessionSeparator());
+ presult.add(aresult.remove(0));
+ presultTitle.add(aresultq.remove(0) + " "
+ + getDefaultRetrievalTitle());
}
}
- try
- {
- aresultq.add(multiacc.toString());
- aresult.add(proxy.getSequenceRecords(multiacc.toString()));
- } catch (OutOfMemoryError oome)
+ else
{
- new OOMWarning("fetching " + multiacc + " from "
- + database.getSelectedItem(), oome, this);
+ String titl=null;
+ if (addToLast && presult.size()>0)
+ {
+ ar=presult.remove(presult.size()-1);
+ titl=presultTitle.remove(presultTitle.size()-1);
+ }
+ // concatenate all results in one window
+ while (aresult.size() > 0)
+ {
+ if (ar == null)
+ {
+ ar = aresult.remove(0);
+ }
+ else
+ {
+ ar.append(aresult.remove(0));
+ }
+ ;
+ }
+ addToLast=true;
+ presult.add(ar);
+ presultTitle.add(titl);
}
-
}
-
- } catch (Exception e)
- {
- showErrorMessage("Error retrieving " + textArea.getText() + " from "
- + database.getSelectedItem());
- // error +="Couldn't retrieve sequences from "+database.getSelectedItem();
- System.err.println("Retrieval failed for source ='"
- + database.getSelectedItem() + "' and query\n'"
- + textArea.getText() + "'\n");
- e.printStackTrace();
- } catch (OutOfMemoryError e)
- {
- // resets dialog box - so we don't use OOMwarning here.
- showErrorMessage("Out of Memory when retrieving "
- + textArea.getText()
- + " from "
- + database.getSelectedItem()
- + "\nPlease see the Jalview FAQ for instructions for increasing the memory available to Jalview.\n");
- e.printStackTrace();
- } catch (Error e)
- {
- showErrorMessage("Serious Error retrieving " + textArea.getText()
- + " from " + database.getSelectedItem());
- e.printStackTrace();
+ guiWindow.setProgressBar("Finished querying", Thread.currentThread().hashCode());
}
- if (aresult != null && aresult.size()>0)
+ guiWindow.setProgressBar((presult.size()>0) ? "Parsing results.":"Processing ..", Thread.currentThread().hashCode());
+ // process results
+ while (presult.size() > 0)
{
- AlignmentI ar=null;
- if (isAliSource) {
- // new window for each result
- while (aresult.size()>0)
+ parseResult(presult.remove(0), presultTitle.remove(0), null);
+ }
+ // only remove visual delay after we finished parsing.
+ guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
+ if (nextfetch.size() > 0)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("Didn't retrieve the following "
+ + (nextfetch.size() == 1 ? "query" : nextfetch.size()
+ + " queries") + ": \n");
+ int l = sb.length(),lr=0;
+ for (String s : nextfetch)
+ {
+ if (l != sb.length())
{
- parseResult(aresult.remove(0), aresultq.remove(0)+" "+getDefaultRetrievalTitle(), null);
+ sb.append("; ");
}
- } else {
- // concatenate all results in one window
- while (aresult.size()>0)
+ if (lr-sb.length()>40)
{
- if (ar==null) { ar = aresult.remove(0);}
- else { ar.append(aresult.remove(0)); };
+ sb.append("\n");
}
- parseResult(ar, null, null);
- }
+ sb.append(s);
+ }
+ showErrorMessage(sb.toString());
}
- // only remove visual delay after we finished parsing.
- guiWindow.setProgressBar(null, Thread.currentThread().hashCode());
resetDialog();
}
- /*
- * result = new StringBuffer(); if
- * (database.getSelectedItem().equals("Uniprot")) {
- * getUniprotFile(textArea.getText()); } else if
- * (database.getSelectedItem().equals("EMBL") ||
- * database.getSelectedItem().equals("EMBLCDS")) { String DBRefSource =
- * database.getSelectedItem().equals("EMBLCDS") ?
- * jalview.datamodel.DBRefSource.EMBLCDS : jalview.datamodel.DBRefSource.EMBL;
- *
- * StringTokenizer st = new StringTokenizer(textArea.getText(), ";");
- * SequenceI[] seqs = null; while(st.hasMoreTokens()) { EBIFetchClient dbFetch
- * = new EBIFetchClient(); String qry =
- * database.getSelectedItem().toString().toLowerCase( ) + ":" +
- * st.nextToken(); File reply = dbFetch.fetchDataAsFile( qry, "emblxml",null);
- *
- * jalview.datamodel.xdb.embl.EmblFile efile=null; if (reply != null &&
- * reply.exists()) { efile =
- * jalview.datamodel.xdb.embl.EmblFile.getEmblFile(reply); } if (efile!=null)
- * { for (Iterator i=efile.getEntries().iterator(); i.hasNext(); ) { EmblEntry
- * entry = (EmblEntry) i.next(); SequenceI[] seqparts =
- * entry.getSequences(false,true, DBRefSource); if (seqparts!=null) {
- * SequenceI[] newseqs = null; int si=0; if (seqs==null) { newseqs = new
- * SequenceI[seqparts.length]; } else { newseqs = new
- * SequenceI[seqs.length+seqparts.length];
- *
- * for (;si<seqs.length; si++) { newseqs[si] = seqs[si]; seqs[si] = null; } }
- * for (int j=0;j<seqparts.length; si++, j++) { newseqs[si] =
- * seqparts[j].deriveSequence(); // place DBReferences on dataset and refer }
- * seqs=newseqs; } } } else { result.append("# no response for "+qry); } } if
- * (seqs!=null && seqs.length>0) { if (parseResult(new Alignment(seqs), null,
- * null)!=null) { result.append("# Successfully parsed the
- * "+database.getSelectedItem()+" Queries into an Alignment"); } } } else if
- * (database.getSelectedItem().equals("PDB")) { StringTokenizer qset = new
- * StringTokenizer(textArea.getText(), ";"); String query; SequenceI[] seqs =
- * null; while (qset.hasMoreTokens() && ((query = qset.nextToken())!=null)) {
- * SequenceI[] seqparts = getPDBFile(query.toUpperCase()); if (seqparts !=
- * null) { if (seqs == null) { seqs = seqparts; } else { SequenceI[] newseqs =
- * new SequenceI[seqs.length+seqparts.length]; int i=0; for (; i <
- * seqs.length; i++) { newseqs[i] = seqs[i]; seqs[i] = null; } for (int
- * j=0;j<seqparts.length; i++, j++) { newseqs[i] = seqparts[j]; }
- * seqs=newseqs; } result.append("# Success for "+query.toUpperCase()+"\n"); }
- * } if (seqs != null && seqs.length > 0) { if (parseResult(new
- * Alignment(seqs), null, null)!=null) { result.append( "# Successfully parsed
- * the PDB File Queries into an
- * Alignment"); } } } else if( database.getSelectedItem().equals("PFAM")) {
- * try { result.append(new FastaFile(
- * "http://www.sanger.ac.uk/cgi-bin/Pfam/getalignment.pl?format=fal&acc=" +
- * textArea.getText().toUpperCase(), "URL").print() );
- *
- * if(result.length()>0) { parseResult( result.toString(),
- * textArea.getText().toUpperCase() ); } } catch (java.io.IOException ex) {
- * result = null; } }
- *
- * if (result == null || result.length() == 0) { showErrorMessage("Error
- * retrieving " + textArea.getText() + " from " + database.getSelectedItem());
- * }
- *
- * resetDialog(); return; }
- *
- * void getUniprotFile(String id) { EBIFetchClient ebi = new EBIFetchClient();
- * File file = ebi.fetchDataAsFile("uniprot:" + id, "xml", null);
- *
- * DBRefFetcher dbref = new DBRefFetcher(); Vector entries =
- * dbref.getUniprotEntries(file);
- *
- * if (entries != null) { //First, make the new sequences Enumeration en =
- * entries.elements(); while (en.hasMoreElements()) { UniprotEntry entry =
- * (UniprotEntry) en.nextElement();
- *
- * StringBuffer name = new StringBuffer(">UniProt/Swiss-Prot"); Enumeration
- * en2 = entry.getAccession().elements(); while (en2.hasMoreElements()) {
- * name.append("|"); name.append(en2.nextElement()); } en2 =
- * entry.getName().elements(); while (en2.hasMoreElements()) {
- * name.append("|"); name.append(en2.nextElement()); }
- *
- * if (entry.getProtein() != null) { name.append(" " +
- * entry.getProtein().getName().elementAt(0)); }
- *
- * result.append(name + "\n" + entry.getUniprotSequence().getContent() +
- * "\n"); }
- *
- * //Then read in the features and apply them to the dataset Alignment al =
- * parseResult(result.toString(), null); for (int i = 0; i < entries.size();
- * i++) { UniprotEntry entry = (UniprotEntry) entries.elementAt(i);
- * Enumeration e = entry.getDbReference().elements(); Vector onlyPdbEntries =
- * new Vector(); while (e.hasMoreElements()) { PDBEntry pdb = (PDBEntry)
- * e.nextElement(); if (!pdb.getType().equals("PDB")) { continue; }
- *
- * onlyPdbEntries.addElement(pdb); }
- *
- * Enumeration en2 = entry.getAccession().elements(); while
- * (en2.hasMoreElements()) {
- * al.getSequenceAt(i).getDatasetSequence().addDBRef(new DBRefEntry(
- * DBRefSource.UNIPROT, "0", en2.nextElement().toString())); }
- *
- *
- *
- *
- * al.getSequenceAt(i).getDatasetSequence().setPDBId(onlyPdbEntries); if
- * (entry.getFeature() != null) { e = entry.getFeature().elements(); while
- * (e.hasMoreElements()) { SequenceFeature sf = (SequenceFeature)
- * e.nextElement(); sf.setFeatureGroup("Uniprot");
- * al.getSequenceAt(i).getDatasetSequence().addSequenceFeature( sf ); } } } }
- * }
- *
- * SequenceI[] getPDBFile(String id) { Vector result = new Vector(); String
- * chain = null; if (id.indexOf(":") > -1) { chain =
- * id.substring(id.indexOf(":") + 1); id = id.substring(0, id.indexOf(":")); }
- *
- * EBIFetchClient ebi = new EBIFetchClient(); String file =
- * ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw"). getAbsolutePath(); if (file
- * == null) { return null; } try { PDBfile pdbfile = new PDBfile(file,
- * jalview.io.AppletFormatAdapter.FILE); for (int i = 0; i <
- * pdbfile.chains.size(); i++) { if (chain == null || ( (PDBChain)
- * pdbfile.chains.elementAt(i)).id. toUpperCase().equals(chain)) { PDBChain
- * pdbchain = (PDBChain) pdbfile.chains.elementAt(i); // Get the Chain's
- * Sequence - who's dataset includes any special features added from the PDB
- * file SequenceI sq = pdbchain.sequence; // Specially formatted name for the
- * PDB chain sequences retrieved from the PDB
- * sq.setName("PDB|"+id+"|"+sq.getName()); // Might need to add more metadata
- * to the PDBEntry object // like below /* PDBEntry entry = new PDBEntry(); //
- * Construct the PDBEntry entry.setId(id); if (entry.getProperty() == null)
- * entry.setProperty(new Hashtable()); entry.getProperty().put("chains",
- * pdbchain.id + "=" + sq.getStart() + "-" + sq.getEnd());
- * sq.getDatasetSequence().addPDBId(entry); // Add PDB DB Refs // We make a
- * DBRefEtntry because we have obtained the PDB file from a verifiable source
- * // JBPNote - PDB DBRefEntry should also carry the chain and mapping
- * information DBRefEntry dbentry = new
- * DBRefEntry(jalview.datamodel.DBRefSource.PDB, "0", id + pdbchain.id);
- * sq.addDBRef(dbentry); // and add seuqence to the retrieved set
- * result.addElement(sq.deriveSequence()); } }
- *
- * if (result.size() < 1) { throw new Exception("WsDBFetch for PDB id resulted
- * in zero result size"); } } catch (Exception ex) // Problem parsing PDB file
- * { jalview.bin.Cache.log.warn("Exception when retrieving " +
- * textArea.getText() + " from " + database.getSelectedItem(), ex); return
- * null; }
- *
- *
- * SequenceI[] results = new SequenceI[result.size()]; for (int i = 0, j =
- * result.size(); i < j; i++) { results[i] = (SequenceI) result.elementAt(i);
- * result.setElementAt(null,i); } return results; }
- */
AlignmentI parseResult(String result, String title)
{
String format = new IdentifyFile().Identify(result, "Paste");
}
/**
- *
- * @return a standard title for any results retrieved using the currently selected source and settings
+ *
+ * @return a standard title for any results retrieved using the currently
+ * selected source and settings
*/
- public String getDefaultRetrievalTitle() {
+ public String getDefaultRetrievalTitle()
+ {
return "Retrieved from " + database.getSelectedItem();
}
+
AlignmentI parseResult(AlignmentI al, String title,
String currentFileFormat)
{
title = getDefaultRetrievalTitle();
}
SequenceFeature[] sfs = null;
- for (Enumeration sq = al.getSequences().elements(); sq
- .hasMoreElements();)
+ List<SequenceI> alsqs;
+ synchronized (alsqs = al.getSequences())
{
- if ((sfs = ((SequenceI) sq.nextElement()).getDatasetSequence()
- .getSequenceFeatures()) != null)
+ for (SequenceI sq : alsqs)
{
- if (sfs.length > 0)
+ if ((sfs = (sq).getDatasetSequence().getSequenceFeatures()) != null)
{
- af.setShowSeqFeatures(true);
- break;
+ if (sfs.length > 0)
+ {
+ af.setShowSeqFeatures(true);
+ break;
+ }
}
- }
+ }
}
Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
{
for (int i = 0; i < al.getHeight(); i++)
{
- alignFrame.viewport.alignment.addSequence(al.getSequenceAt(i)); // this
+ alignFrame.viewport.getAlignment().addSequence(
+ al.getSequenceAt(i)); // this
// also
// creates
// dataset
// sequence
// entries
}
- alignFrame.viewport.setEndSeq(alignFrame.viewport.alignment
+ alignFrame.viewport.setEndSeq(alignFrame.viewport.getAlignment()
.getHeight());
- alignFrame.viewport.alignment.getWidth();
+ alignFrame.viewport.getAlignment().getWidth();
alignFrame.viewport.firePropertyChange("alignment", null,
alignFrame.viewport.getAlignment().getSequences());
}
resetDialog();
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
JOptionPane.showInternalMessageDialog(Desktop.desktop, error,
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.gui;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ColourSchemeI;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import java.awt.Color;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
/**
* DOCUMENT ME!
public Color getResidueBoxColour(SequenceI seq, int i)
{
- allGroups = av.alignment.findAllGroups(seq);
+ allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
{
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
return resBoxColour;
{
if (cs != null)
{
- resBoxColour = cs.findColour(seq.getCharAt(i), i);
+ resBoxColour = cs.findColour(seq.getCharAt(i), i, seq);
}
else if (forOverview
&& !jalview.util.Comparison.isGap(seq.getCharAt(i)))
}
else if (av.getShowBoxes())
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
}
if (currentSequenceGroup.getShowNonconserved()) // todo optimize
{
// todo - use sequence group consensus
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
}
if (av.getColourText())
{
getboxColour = true;
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
if (av.getShowBoxes())
{
{
if (!getboxColour)
{
- getBoxColour(av.globalColourScheme, seq, i);
+ getBoxColour(av.getGlobalColourScheme(), seq, i);
}
if (resBoxColour.getRed() + resBoxColour.getBlue()
graphics.setColor(av.textColour2);
}
}
- if (av.showUnconserved)
+ if (av.getShowUnconserved())
{
- s = getDisplayChar(av.consensus, i, s, '.');
+ s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, '.');
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
conservationSlider.setTitle("Conservation Colour Increment (" + source
+ ")");
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
sp.setAllGroupsCheckEnabled(true);
}
PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");
- if (ap.av.alignment.getGroups() != null)
+ if (ap.av.getAlignment().getGroups() != null)
{
pid.setAllGroupsCheckEnabled(true);
}
}
ColourSchemeI toChange = null;
- Vector allGroups = null;
+ List<SequenceGroup> allGroups = null;
int groupIndex = 0;
if (allGroupsCheck.isSelected())
{
- allGroups = ap.av.alignment.getGroups();
+ allGroups = ap.av.getAlignment().getGroups();
groupIndex = allGroups.size() - 1;
}
else
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import java.awt.*;
import java.awt.event.*;
+
import javax.swing.*;
/**
{
boolean visible = true;
+ JPanel iconimg = new JPanel(new BorderLayout());
+
+ JTextPane authlist = new JTextPane();
+
JInternalFrame iframe;
Image image;
t.start();
}
+ MouseAdapter closer = new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent evt)
+ {
+ try
+ {
+ visible = false;
+ closeSplash();
+ } catch (Exception ex)
+ {
+ }
+ }
+ };
+
/**
* ping the jalview version page then create and display the jalview
* splashscreen window.
*/
void initSplashScreenWindow()
{
- addMouseListener(new MouseAdapter()
- {
- public void mousePressed(MouseEvent evt)
- {
- try
- {
- visible = false;
- closeSplash();
- } catch (Exception ex)
- {
- }
- }
- });
-
+ addMouseListener(closer);
try
{
java.net.URL url = getClass().getResource("/images/logo.gif");
iframe = new JInternalFrame();
iframe.setFrameIcon(null);
iframe.setClosable(false);
+ this.setLayout(new BorderLayout());
iframe.setContentPane(this);
iframe.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.desktop.add(iframe);
+ SplashImage splashimg = new SplashImage(image);
+ iconimg.add(splashimg, BorderLayout.CENTER);
+ add(iconimg, BorderLayout.WEST);
+ add(authlist, BorderLayout.CENTER);
+ authlist.setEditable(false);
+ authlist.addMouseListener(closer);
+ refreshText();
+ }
- iframe.setVisible(true);
- iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
- (int) ((Desktop.instance.getHeight() - 160) / 2), 750, 190);
+ long oldtext = -1;
+
+ /**
+ * update text in author text panel reflecting current version information
+ */
+ protected boolean refreshText()
+ {
+ String newtext = Desktop.instance.getAboutMessage(true).toString();
+ System.err.println("Text found: \n"+newtext+"\nEnd of newtext.");
+ if (oldtext != newtext.length())
+ {
+ iframe.setVisible(false);
+ oldtext = newtext.length();
+ authlist=new JTextPane();
+ authlist.setEditable(false);
+ authlist.addMouseListener(closer);
+ authlist.setContentType("text/html");
+ authlist.setText(newtext);
+ authlist.setVisible(true);
+ add(authlist, BorderLayout.CENTER);
+ iframe.pack();
+ iframe.setVisible(true);
+ iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2),
+ (int) ((Desktop.instance.getHeight() - 160) / 2), 750,
+ iframe.getPreferredSize().height);
+ System.err.println("New preferred size: "+iframe.getPreferredSize().height);
+
+ return true;
+ }
+ return false;
}
/**
public void run()
{
initSplashScreenWindow();
+
long startTime = System.currentTimeMillis() / 1000;
while (visible)
{
try
{
- Thread.sleep(1000);
+ Thread.sleep(500);
} catch (Exception ex)
{
}
{
visible = false;
}
- else
- repaint();
+
+ if (visible && refreshText())
+ {
+ repaint();
+ }
}
closeSplash();
}
}
- /**
- * DOCUMENT ME!
- *
- * @param g
- * DOCUMENT ME!
- */
- public void paintComponent(Graphics g)
+ public class SplashImage extends JPanel
{
- g.setColor(Color.white);
- g.fillRect(0, 0, getWidth(), getHeight());
- g.setColor(Color.black);
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
+ Image image;
- if (image != null)
+ public SplashImage(Image todisplay)
{
- g.drawImage(image, 5, yoffset + 12, this);
+ image = todisplay;
+ setPreferredSize(new Dimension(image.getWidth(this) + 8,
+ image.getHeight(this)));
}
- int y = yoffset;
-
- g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
- y);
-
- FontMetrics fm = g.getFontMetrics();
- int vwidth = fm.stringWidth("Jalview "
- + jalview.bin.Cache.getProperty("VERSION"));
- g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));
- g.drawString(
- "Last updated: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
- 50 + vwidth + 5, y);
- if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
- "Checking"))
+ public void paintComponent(Graphics g)
{
- // Displayed when code version and jnlp version do not match
- g.drawString("...Checking latest version...", 50, y += fontSize + 10);
- y += 5;
+ g.setColor(Color.white);
+ g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.black);
- }
- else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
- .equals(jalview.bin.Cache.getProperty("VERSION")))
- {
- if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
- .indexOf("automated build") == -1)
+ g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));
+
+ if (image != null)
{
- // Displayed when code version and jnlp version do not match and code
- // version is not a development build
- g.setColor(Color.red);
+ g.drawImage(image, 4, (getHeight() - image.getHeight(this)) / 2,
+ this);
}
- g.drawString(
- "!! Jalview version "
- + jalview.bin.Cache.getDefault("LATEST_VERSION",
- "..Checking..")
- + " is available for download from "+jalview.bin.Cache.getDefault("www.jalview.org","http://www.jalview.org")+" !!",
- 50, y += fontSize + 10);
- y += 5;
- g.setColor(Color.black);
}
-
- g.setFont(new Font("Verdana", Font.BOLD, fontSize));
- g.drawString(
- "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,",
- 50, y += fontSize + 4);
- g.drawString("David Martin & Geoff Barton.", 60, y += fontSize + 4);
- g.drawString(
- "Development managed by The Barton Group, University of Dundee.",
- 50, y += fontSize + 4);
- g.drawString("If you use Jalview, please cite: ", 50,
- y += fontSize + 4);
- g.drawString(
- "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)",
- 50, y += fontSize + 4);
- g.drawString(
- "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench",
- 50, y += fontSize + 4);
- g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", 50,
- y += fontSize + 4);
+ /*
+ * int y = yoffset;
+ *
+ * g.drawString("Jalview " + jalview.bin.Cache.getProperty("VERSION"), 50,
+ * y);
+ *
+ * FontMetrics fm = g.getFontMetrics(); int vwidth =
+ * fm.stringWidth("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
+ * g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2)); g.drawString(
+ * "Last updated: " + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"),
+ * 50 + vwidth + 5, y); if (jalview.bin.Cache.getDefault("LATEST_VERSION",
+ * "Checking").equals( "Checking")) { // Displayed when code version and
+ * jnlp version do not match g.drawString("...Checking latest version...",
+ * 50, y += fontSize + 10); y += 5; g.setColor(Color.black); } else if
+ * (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
+ * .equals(jalview.bin.Cache.getProperty("VERSION"))) { if
+ * (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+ * .indexOf("automated build") == -1) { // Displayed when code version and
+ * jnlp version do not match and code // version is not a development build
+ * g.setColor(Color.red); } g.drawString( "!! Jalview version " +
+ * jalview.bin.Cache.getDefault("LATEST_VERSION", "..Checking..") +
+ * " is available for download from "
+ * +jalview.bin.Cache.getDefault("www.jalview.org"
+ * ,"http://www.jalview.org")+" !!", 50, y += fontSize + 10); y += 5;
+ * g.setColor(Color.black); }
+ *
+ * g.setFont(new Font("Verdana", Font.BOLD, fontSize)); g.drawString(
+ * "Authors: Jim Procter, Andrew Waterhouse, Michele Clamp, James Cuff, Steve Searle,"
+ * , 50, y += fontSize + 4); g.drawString("David Martin & Geoff Barton.",
+ * 60, y += fontSize + 4); g.drawString(
+ * "Development managed by The Barton Group, University of Dundee.", 50, y
+ * += fontSize + 4); g.drawString("If you use Jalview, please cite: ", 50,
+ * y += fontSize + 4); g.drawString(
+ * "Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ * , 50, y += fontSize + 4); g.drawString(
+ * "Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ * , 50, y += fontSize + 4);
+ * g.drawString("Bioinformatics doi: 10.1093/bioinformatics/btp033", 50, y
+ * += fontSize + 4); }
+ */
}
-}
+}
\ No newline at end of file
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
if (sg == null)
{
ap.av.textColour = col;
- if (ap.av.colourAppliesToAllGroups)
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
if (sg == null)
{
ap.av.textColour2 = col;
- if (ap.av.colourAppliesToAllGroups)
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
if (sg == null)
{
ap.av.thresholdTextColour = value;
- if (ap.av.colourAppliesToAllGroups)
+ if (ap.av.getColourAppliesToAllGroups())
{
setGroupTextColour();
}
void setGroupTextColour()
{
- if (ap.av.alignment.getGroups() == null)
+ if (ap.av.getAlignment().getGroups() == null)
{
return;
}
- Vector groups = ap.av.alignment.getGroups();
+
- for (int i = 0; i < groups.size(); i++)
+ for (SequenceGroup sg:ap.av.getAlignment().getGroups())
{
- SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
sg.textColour = ap.av.textColour;
sg.textColour2 = ap.av.textColour2;
sg.thresholdTextColour = ap.av.thresholdTextColour;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
aps[a].av.setSelectionGroup(selected);
}
- selected.setEndRes(aps[a].av.alignment.getWidth() - 1);
+ selected.setEndRes(aps[a].av.getAlignment().getWidth() - 1);
selected.addOrRemove(sequence, true);
}
}
for (int a = 0; a < aps.length; a++)
{
aps[a].av.setSelectionGroup(null);
- aps[a].av.alignment.deleteAllGroups();
+ aps[a].av.getAlignment().deleteAllGroups();
aps[a].av.sequenceColours = null;
}
colourGroups();
}
ColourSchemeI cs = null;
+ SequenceGroup sg = new SequenceGroup(sequences, null, cs, true, true,
+ false, 0, av.getAlignment().getWidth() - 1);
if (av.getGlobalColourScheme() != null)
{
}
else
{
- cs = ColourSchemeProperty.getColour(sequences, av.alignment
- .getWidth(), ColourSchemeProperty.getColourName(av
+ cs = ColourSchemeProperty.getColour(sg, ColourSchemeProperty.getColourName(av
.getGlobalColourScheme()));
}
// cs is null if shading is an annotationColourGradient
av.getIgnoreGapsConsensus());
}
}
-
- SequenceGroup sg = new SequenceGroup(sequences, null, cs, true, true,
- false, 0, av.alignment.getWidth() - 1);
-
+ sg.cs=cs;
+// sg.recalcConservation();
sg.setName("JTreeGroup:" + sg.hashCode());
sg.setIdColour(col);
for (int a = 0; a < aps.length; a++)
sg.getStartRes(), sg.getEndRes());
c.calculate();
- c.verdict(false, aps[a].av.ConsPercGaps);
+ c.verdict(false, aps[a].av.getConsPercGaps());
sg.cs.setConservation(c);
}
- aps[a].av.alignment.addGroup(sg);
+ aps[a].av.getAlignment().addGroup(sg);
}
}
// notify the panel to redo any group specific stuff.
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
if (odata == null)
{
- tree = new NJTree(av.alignment.getSequencesArray(), newtree);
+ tree = new NJTree(av.getAlignment().getSequencesArray(), newtree);
}
else
{
- tree = new NJTree(av.alignment.getSequencesArray(), odata,
+ tree = new NJTree(av.getAlignment().getSequencesArray(), odata,
newtree);
}
if (!tree.hasOriginalSequenceData())
if (av.getSelectionGroup() == null)
{
start = 0;
- end = av.alignment.getWidth();
- seqs = av.alignment.getSequencesArray();
+ end = av.getAlignment().getWidth();
+ seqs = av.getAlignment().getSequencesArray();
}
else
{
start = av.getSelectionGroup().getStartRes();
end = av.getSelectionGroup().getEndRes() + 1;
- seqs = av.getSelectionGroup().getSequencesInOrder(av.alignment);
+ seqs = av.getSelectionGroup().getSequencesInOrder(av.getAlignment());
}
tree = new NJTree(seqs, seqStrings, type, pwtype, start, end);
AlignmentSorter.sortByTree(av.getAlignment(), tree);
CommandI undo;
undo=new OrderCommand("Tree Sort", oldOrder,
- av.alignment);
+ av.getAlignment());
ap.paintAlignment(true);
return undo;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.gui;
-import java.io.*;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
+import jalview.datamodel.SequenceGroup;
+import jalview.io.JalviewFileChooser;
+import jalview.jbgui.GUserDefinedColours;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.UserColourScheme;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JButton;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
/**
* DOCUMENT ME!
{
try
{
- col = oldColourScheme.findColour(aa.charAt(0), -1);
+ col = oldColourScheme.findColour(aa.charAt(0), -1, null);
} catch (Exception ex)
{
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
String[] vobj = new String[seqsel.getSize()];
int o = 0;
- Enumeration sels = seqsel.getSequences(null).elements();
- while (sels.hasMoreElements())
+ for (SequenceI sel:seqsel.getSequences(null))
{
- SequenceI sel = (SequenceI) sels.nextElement();
VorbaId v = (VorbaId) jv2vobj.get(sel);
if (v != null)
{
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import jalview.ws.jws2.JabaParamStore;
import jalview.ws.jws2.JabaPreset;
import jalview.ws.jws2.Jws2Discoverer;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.OptionI;
import jalview.ws.params.ParamDatastoreI;
e.printStackTrace();
return;
}
- Jws2Discoverer.Jws2Instance lastserv = null;
- for (Jws2Discoverer.Jws2Instance service : disc.getServices())
+ Jws2Instance lastserv = null;
+ for (Jws2Instance service : disc.getServices())
{
lastserv = service;
if (p >= args.length || service.serviceType.equalsIgnoreCase(args[p]))
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.gui;
+import jalview.bin.Cache;
+import jalview.jbgui.GWsPreferences;
+import jalview.ws.jws2.Jws2Discoverer;
+import jalview.ws.rest.RestServiceDescription;
+
import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.Vector;
-import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JTable;
import javax.swing.JTextField;
-
-import jalview.bin.Cache;
-import jalview.jbgui.GWsPreferences;
-import jalview.ws.rest.RestServiceDescription;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableCellRenderer;
public class WsPreferences extends GWsPreferences
{
+
public WsPreferences()
{
super();
initFromPreferences();
}
- Vector<String> wsUrls, oldUrls,rsbsUrls,oldRsbsUrls;
+ Vector<String> wsUrls, oldUrls, rsbsUrls, oldRsbsUrls;
private boolean needWsMenuUpdate;
oldUrls = null;
wsUrls = new Vector<String>();
}
+ wsList.setDefaultRenderer(Integer.class, new JabaWSStatusRenderer());
+ wsList.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
updateList();
rsbsUrls = jalview.ws.rest.RestClient.getRsbsDescriptions();
if (rsbsUrls != null)
};
- private void updateList()
+ private void updateList() {
+ Object tdat[][] = new Object[wsUrls.size()][2];
+ int r=0;
+ for (String url : wsUrls)
+ {
+ int status = Jws2Discoverer.getDiscoverer().getServerStatusFor(url);
+ tdat[r][1]=new Integer(status);
+ tdat[r++][0]=url;
+ }
+
+ wsList.setModel(new WsUrlTableModel(tdat));
+ wsList.getColumn("Status").setMinWidth(10);
+ }
+ private class JabaWSStatusRenderer extends JPanel implements TableCellRenderer
{
- wsList.setListData(wsUrls);
+ public JabaWSStatusRenderer()
+ {
+ setOpaque(true);
+ setMinimumSize(new Dimension(10,10));
+// setText(" ");
+
+ }
+ /**
+ * render an Integer reflecting service status as a colour and symbol
+ */
+
+ @Override
+ public Component getTableCellRendererComponent(JTable arg0,
+ Object status, boolean isSelected, boolean hasFocus, int row, int column)
+ {
+ Color c;
+ String t=new String("");
+ switch (((Integer) status).intValue())
+ {
+ case 1:
+// cb.setSelected(true);
+ //cb.setBackground(
+ c=Color.green;
+ break;
+ case 0:
+// cb.setSelected(true);
+// cb.setBackground(
+ c=Color.lightGray;
+ break;
+ case -1:
+ //cb.setSelected(false);
+ //cb.setBackground(
+ c=Color.red;
+ break;
+ default:
+ //cb.setSelected(false);
+ //cb.setBackground(
+ c=Color.orange;
+ }
+ setBackground(c);
+ //setText(t);
+ return this;
+
+ }
+
}
+ private class WsUrlTableModel extends AbstractTableModel {
+
+ private Object[][] data;
+ public WsUrlTableModel(Object[][] tdat)
+ {
+ this.data=tdat;
+ }
+ @Override
+ public int getColumnCount()
+ {
+ return 2;
+ }
+ @Override
+ public String getColumnName(int column)
+ {
+ if (column==1)
+ {
+ return "Status";
+ }
+ return "Service URL";
+ }
+ @Override
+ public int getRowCount()
+ {
+ if (data==null)
+ {
+ return 0;
+ }
+ return data.length;
+ }
+ @Override
+ public java.lang.Class<?> getColumnClass(int columnIndex) {
+ return getValueAt(0, columnIndex).getClass();
+ };
+ @Override
+ public Object getValueAt(int rowIndex, int columnIndex)
+ {
+ return data[rowIndex][columnIndex];
+ }
+
+ }
private void updateRsbsList()
{
sbrsList.setListData(rsbsUrls);
@Override
protected void deleteWsUrl_actionPerformed(ActionEvent e)
{
- int sel = wsList.getSelectedIndex();
+ int sel = wsList.getSelectedRow();
if (sel > -1)
{
wsUrls.removeElementAt(sel);
@Override
protected void editWsUrl_actionPerformed(ActionEvent e)
{
- int sel = wsList.getSelectedIndex();
+ int sel = wsList.getSelectedRow();
if (sel > -1)
{
String url = editUrl(wsUrls.elementAt(sel), "Edit JABAWS URL");
}
}
}
+
@Override
protected void newSbrsUrl_actionPerformed(ActionEvent e)
{
RestServiceEditorPane rse = new RestServiceEditorPane();
rse.showDialog("Add a new Simple Bioinformatics Rest Service");
String rservice = rse.getEditedRestService();
- if (rservice!=null && !rsbsUrls.contains(rservice))
+ if (rservice != null && !rsbsUrls.contains(rservice))
{
rsbsUrls.add(rservice);
update++;
updateRsbsList();
}
}
+
@Override
protected void editSbrsUrl_actionPerformed(ActionEvent e)
{
int sel = sbrsList.getSelectedIndex();
if (sel > -1)
{
- RestServiceEditorPane rse = new RestServiceEditorPane(new RestServiceDescription(rsbsUrls.elementAt(sel)));
+ RestServiceEditorPane rse = new RestServiceEditorPane(
+ new RestServiceDescription(rsbsUrls.elementAt(sel)));
rse.showDialog("Edit Simple Bioinformatics Rest Service entry");
String rservice = rse.getEditedRestService();
- if (rservice!=null)
+ if (rservice != null)
{
int present = rsbsUrls.indexOf(rservice);
- if (present==-1) {
+ if (present == -1)
+ {
update++;
- rsbsUrls.setElementAt(rservice,sel);
+ rsbsUrls.setElementAt(rservice, sel);
updateRsbsList();
- } else {
- if (present!=sel) {
+ }
+ else
+ {
+ if (present != sel)
+ {
rsbsUrls.removeElementAt(sel);
update++;
updateRsbsList();
}
}
}
-
+
void updateWsMenuConfig(boolean old)
{
if (old)
{
- if (oldUrls!=wsUrls || (wsUrls!=null && oldUrls!=null && !wsUrls.equals(oldUrls)))
+ if (oldUrls != wsUrls
+ || (wsUrls != null && oldUrls != null && !wsUrls
+ .equals(oldUrls)))
{
update++;
}
wsUrls = (oldUrls == null) ? null : new Vector(oldUrls);
- if (oldRsbsUrls!=rsbsUrls || (rsbsUrls!=null && oldRsbsUrls!=null && !oldRsbsUrls.equals(rsbsUrls)))
+ if (oldRsbsUrls != rsbsUrls
+ || (rsbsUrls != null && oldRsbsUrls != null && !oldRsbsUrls
+ .equals(rsbsUrls)))
{
update++;
}
"WSMENU_BYTYPE",
Boolean.valueOf(old ? oldIndexByType : indexByType.isSelected())
.toString());
-
- Cache.setProperty("SHOW_WSDISCOVERY_ERRORS",
- Boolean.valueOf(old ? oldWsWarning : displayWsWarning.isSelected()).toString());
+
+ Cache.setProperty(
+ "SHOW_WSDISCOVERY_ERRORS",
+ Boolean.valueOf(
+ old ? oldWsWarning : displayWsWarning.isSelected())
+ .toString());
updateServiceList();
updateRsbsServiceList();
}
@Override
protected void moveWsUrlDown_actionPerformed(ActionEvent e)
{
- int p = wsList.getSelectedIndex();
+ int p = wsList.getSelectedRow();
if (p > -1 && p < wsUrls.size() - 1)
{
String t = wsUrls.get(p + 1);
wsUrls.setElementAt(wsUrls.elementAt(p), p + 1);
wsUrls.setElementAt(t, p);
updateList();
- wsList.setSelectedIndex(p + 1);
+ wsList.getSelectionModel().setSelectionInterval(p+1,p + 1);
update++;
}
}
@Override
protected void moveWsUrlUp_actionPerformed(ActionEvent e)
{
- int p = wsList.getSelectedIndex();
+ int p = wsList.getSelectedRow();
if (p > 0)
{
String t = wsUrls.get(p - 1);
wsUrls.setElementAt(wsUrls.elementAt(p), p - 1);
wsUrls.setElementAt(t, p);
updateList();
- wsList.setSelectedIndex(p - 1);
+ wsList.getSelectionModel().setSelectionInterval(p-1,p - 1);
update++;
}
}
// TODO: do a better job of checking that the url is a valid discovery
// URL for web services.
String tx = urltf.getText().trim();
- while (tx.length()>0 && tx.lastIndexOf('/')==tx.length()-1)
+ while (tx.length() > 0 && tx.lastIndexOf('/') == tx.length() - 1)
{
- tx = tx.substring(0, tx.length()-1);
+ tx = tx.substring(0, tx.length() - 1);
}
foo = new URL(tx);
valid = true;
{
if (!wsUrls.contains(url))
{
- int selind = wsList.getSelectedIndex();
+ int selind = wsList.getSelectedRow();
if (selind > -1)
{
wsUrls.insertElementAt(url, selind);
lastrefresh = update;
Desktop.instance.startServiceDiscovery(true); // wait around for all
// threads to complete
+ updateList();
+
}
progressBar.setIndeterminate(false);
progressBar.setVisible(false);
{
lastrefresh = update;
Desktop.instance.startServiceDiscovery(true);
+ updateList();
}
Desktop.instance.setProgressBar(null, ct);
}
{
jalview.ws.jws2.Jws2Discoverer.setServiceUrls(null);
Vector nwsUrls = jalview.ws.jws2.Jws2Discoverer.getServiceUrls();
- if (!wsUrls.equals(nwsUrls)) {
+ if (!wsUrls.equals(nwsUrls))
+ {
update++;
}
- wsUrls=nwsUrls;
+ wsUrls = nwsUrls;
updateList();
-
+
updateAndRefreshWsMenuConfig(true);
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.io;
-import java.io.*;
-import java.util.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* DOCUMENT ME!
/**
* Sequences to be added to form a new alignment.
*/
- protected Vector seqs;
+ protected Vector<SequenceI> seqs;
/**
* annotation to be added to generated alignment object
public AlignFile(String inFile, String type) throws IOException
{
super(inFile, type);
-
initData();
-
parse();
+ // sets the index of each sequence in the alignment
+ for( int i=0,c=seqs.size(); i<c; i++ ) {
+ seqs.get(i).setIndex(i);
+ }
}
/**
super(source);
initData();
parse();
+ // sets the index of each sequence in the alignment
+ for( int i=0,c=seqs.size(); i<c; i++ ) {
+ seqs.get(i).setIndex(i);
+ }
}
/**
* Return the seqs Vector
*/
- public Vector getSeqs()
+ public Vector<SequenceI> getSeqs()
{
return seqs;
}
addProperties(al);
for (int i = 0; i < annotations.size(); i++)
{
- al.addAnnotation((AlignmentAnnotation) annotations.elementAt(i));
+ // detect if annotations.elementAt(i) rna secondary structure
+ // if so then do:
+ /*
+ * SequenceFeature[] pairArray =
+ * Rna.GetBasePairsFromAlignmentAnnotation(annotations.elementAt(i));
+ * Rna.HelixMap(pairArray);
+ */
+ AlignmentAnnotation an = (AlignmentAnnotation) annotations
+ .elementAt(i);
+ an.validateRangeAndDisplay();
+ al.addAnnotation(an);
}
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* columns or hidden row keywords.\r
* \r
* @param annotations\r
- * @param groups\r
+ * @param list\r
* @param properties\r
* @return feature file as a string.\r
*/\r
public String printAnnotations(AlignmentAnnotation[] annotations,\r
- Vector groups, Hashtable properties)\r
+ List<SequenceGroup> list, Hashtable properties)\r
{\r
- return printAnnotations(annotations, groups, properties, null);\r
+ return printAnnotations(annotations, list, properties, null);\r
\r
}\r
\r
* properties and views.\r
* \r
* @param annotations\r
- * @param groups\r
+ * @param list\r
* @param properties\r
* @param views\r
* @return annotation file\r
*/\r
public String printAnnotations(AlignmentAnnotation[] annotations,\r
- Vector groups, Hashtable properties, ViewDef[] views)\r
+ List<SequenceGroup> list, Hashtable properties, ViewDef[] views)\r
{\r
// TODO: resolve views issue : annotationFile could contain visible region,\r
// or full data + hidden region specifications for a view.\r
text.append(rowprops.toString());\r
}\r
\r
- if (groups != null)\r
+ if (list != null)\r
{\r
- printGroups(groups);\r
+ printGroups(list);\r
}\r
\r
if (properties != null)\r
return text.toString();\r
}\r
\r
- public void printGroups(Vector sequenceGroups)\r
+ public void printGroups(List<SequenceGroup> list)\r
{\r
- SequenceGroup sg;\r
SequenceI seqrep = null;\r
- for (int i = 0; i < sequenceGroups.size(); i++)\r
+ for (SequenceGroup sg:list)\r
{\r
- sg = (SequenceGroup) sequenceGroups.elementAt(i);\r
if (!sg.hasSeqrep())\r
{\r
text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
}\r
// Finally, resolve the groupRefs\r
Enumeration en = groupRefRows.keys();\r
- SequenceGroup theGroup = null;\r
-\r
+ \r
while (en.hasMoreElements())\r
{\r
groupRef = (String) en.nextElement();\r
boolean matched = false;\r
// Resolve group: TODO: add a getGroupByName method to alignments\r
- Vector grps = al.getGroups();\r
- for (int g = 0, gSize = grps.size(); g < gSize; g++)\r
+ for (SequenceGroup theGroup : al.getGroups())\r
{\r
- theGroup = (SequenceGroup) grps.elementAt(g);\r
if (theGroup.getName().equals(groupRef))\r
{\r
if (matched)\r
}\r
}\r
if (hasSymbols\r
- && (token.equals("H") || token.equals("E") || token\r
+ && (token.equals("H") || token.equals("E") || token.equals("S") || token\r
.equals(" ")))\r
{\r
// Either this character represents a helix or sheet\r
{\r
return;\r
}\r
- SequenceGroup sg = null;\r
-\r
+ \r
String name = st.nextToken();\r
-\r
- Vector groups = al.getGroups();\r
- for (int i = 0; i < groups.size(); i++)\r
+ SequenceGroup sg=null;\r
+ for (SequenceGroup _sg:al.getGroups())\r
{\r
- sg = (SequenceGroup) groups.elementAt(i);\r
- if (sg.getName().equals(name))\r
+ if ((sg=_sg).getName().equals(name))\r
{\r
break;\r
}\r
sg.getStartRes(), sg.getEndRes() + 1);\r
\r
c.calculate();\r
- c.verdict(false, 25);\r
+ c.verdict(false, 25); // TODO: refer to conservation percent threshold\r
\r
sg.cs.setConservation(c);\r
\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
public static final String[] READABLE_EXTENSIONS = new String[]
{ "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar",
- "sto" }; // ,
+ "sto,stk" }; // ,
// ".blast"
// };
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
int i = 0;
boolean flag = false;
-
+ boolean rna=false;
+ boolean top=false;
+ StringBuffer pssecstr=new StringBuffer(),consstr=new StringBuffer();
Vector headers = new Vector();
Hashtable seqhash = new Hashtable();
StringBuffer tempseq;
{
while ((line = nextLine()) != null)
{
+ if (line.length()==0)
+ {
+ top=true;
+ }
if (line.indexOf(" ") != 0)
{
str = new StringTokenizer(line, " ");
{
tempseq.append(str.nextToken());
}
+ top=false;
}
}
}
{
flag = true;
}
+ } else {
+ if (line.matches("\\s+(-|\\.|\\(|\\[|\\]|\\))+"))
+ {
+ if (top)
+ {
+ pssecstr.append(line.trim());
+ } else {
+ consstr.append(line.trim());
+ }
+ }
}
}
} catch (IOException e)
+ headers.elementAt(i));
}
}
+ AlignmentAnnotation lastssa=null;
+ if (pssecstr.length()==maxLength)
+ {
+ Vector ss=new Vector();
+ AlignmentAnnotation ssa=lastssa=StockholmFile.parseAnnotationRow(ss, "secondary structure", pssecstr.toString());
+ ssa.label="Secondary Structure";
+ annotations.addElement(ssa);
+ }
+ if (consstr.length()==maxLength)
+ {
+ Vector ss=new Vector();
+ AlignmentAnnotation ssa=StockholmFile.parseAnnotationRow(ss, "secondary structure", consstr.toString());
+ ssa.label="Consensus Secondary Structure";
+ if (lastssa==null || !lastssa.getRNAStruc().equals(ssa.getRNAStruc().replace('-', '.')))
+ {
+ annotations.addElement(ssa);
+ }
+ }
}
}
-
public String print()
{
return print(getSeqsAsArray());
+ // TODO: locaRNA style aln output
}
public String print(SequenceI[] s)
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
{
if (viewport != null)
{
+ // TODO: create undo object for this JAL-1101
for (int i = 0; i < al.getHeight(); i++)
{
viewport.getAlignment().addSequence(al.getSequenceAt(i));
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
// SelectAllFilter needs to be set first before adding further
// file filters to fix bug on Mac OSX
setAcceptAllFileFilterUsed(selectAll);
-
+
for (int i = 0; i < suffix.length; i++)
{
JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);
addChoosableFileFilter(jvf);
-
if ((selected != null) && selected.equalsIgnoreCase(desc[i]))
{
chosen = jvf;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
\r
import com.stevesoft.pat.*;\r
import jalview.datamodel.*;\r
+import jalview.analysis.Rna;\r
\r
// import org.apache.log4j.*;\r
\r
Hashtable seqs = new Hashtable();\r
Regex p, r, rend, s, x;\r
\r
+ // Temporary line for processing RNA annotation\r
+ // String RNAannot = "";\r
+\r
// ------------------ Parsing File ----------------------\r
// First, we have to check that this file has STOCKHOLM format, i.e. the\r
// first line must match\r
r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence\r
\r
+ // Convert all bracket types to parentheses (necessary for passing to VARNA)\r
+ Regex openparen = new Regex("(<|\\[)", "(");\r
+ Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+ // Detect if file is RNA by looking for bracket types\r
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
rend.optimize();\r
p.optimize();\r
s.optimize();\r
r.optimize();\r
x.optimize();\r
+ openparen.optimize();\r
+ closeparen.optimize();\r
\r
while ((line = nextLine()) != null)\r
{\r
int start = 1;\r
int end = -1;\r
String sid = acc;\r
- // Retrieve hash of annotations for this accession\r
+ /*\r
+ * Retrieve hash of annotations for this accession\r
+ * Associate Annotation with accession\r
+ */\r
Hashtable accAnnotations = null;\r
\r
if (seqAnn != null && seqAnn.containsKey(acc))\r
{\r
accAnnotations = (Hashtable) seqAnn.remove(acc);\r
+ //TODO: add structures to sequence\r
}\r
\r
// Split accession in id and from/to\r
jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn);\r
// seqO.addDBRef(dbref);\r
}\r
+ } \r
+ if (accAnnotations != null && accAnnotations.containsKey("SS"))\r
+ {\r
+ Vector v = (Vector) accAnnotations.get("SS");\r
+ \r
+ for (int i = 0; i < v.size(); i++)\r
+ {\r
+ AlignmentAnnotation an = (AlignmentAnnotation) v.elementAt(i);\r
+ seqO.addAlignmentAnnotation(an);\r
+ //annotations.add(an);\r
+ }\r
}\r
+ \r
Hashtable features = null;\r
// We need to adjust the positions of all features to account for gaps\r
try\r
ann = new Hashtable();\r
seqAnn.put(acc, ann);\r
}\r
-\r
+ //TODO test structure, call parseAnnotationRow with vector from hashtable for specific sequence\r
Hashtable features;\r
// Get an object with all the content for an annotation\r
if (ann.containsKey("features"))\r
}\r
ns += seq;\r
content.put(description, ns);\r
+
+ if(type.equals("SS")){\r
+ Hashtable strucAnn;\r
+ if (seqAnn.containsKey(acc))\r
+ {\r
+ strucAnn = (Hashtable) seqAnn.get(acc);\r
+ }\r
+ else\r
+ {\r
+ strucAnn = new Hashtable();\r
+ }\r
+ \r
+ Vector newStruc=new Vector();\r
+ parseAnnotationRow(newStruc, type,ns);\r
+ \r
+ strucAnn.put(type, newStruc);\r
+ seqAnn.put(acc, strucAnn);\r
+ }\r
}\r
else\r
{\r
}\r
}\r
\r
- private AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
+ protected static AlignmentAnnotation parseAnnotationRow(Vector annotation,\r
String label, String annots)\r
{\r
+ String convert1, convert2 = null;\r
+\r
+ // Convert all bracket types to parentheses\r
+ Regex openparen = new Regex("(<|\\[)", "(");\r
+ Regex closeparen = new Regex("(>|\\])", ")");\r
+\r
+ // Detect if file is RNA by looking for bracket types\r
+ Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))");\r
+\r
+ convert1 = openparen.replaceAll(annots);\r
+ convert2 = closeparen.replaceAll(convert1);\r
+ annots = convert2;\r
+\r
String type = (label.indexOf("_cons") == label.length() - 5) ? label\r
.substring(0, label.length() - 5) : label;\r
boolean ss = false;\r
// be written out\r
if (ss)\r
{\r
- ann.secondaryStructure = jalview.schemes.ResidueProperties\r
- .getDssp3state(pos).charAt(0);\r
+ if (detectbrackets.search(pos))\r
+ {\r
+ ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+ .getRNASecStrucState(pos).charAt(0);\r
+ }\r
+ else\r
+ {\r
+ ann.secondaryStructure = jalview.schemes.ResidueProperties\r
+ .getDssp3state(pos).charAt(0);\r
+ }\r
+\r
if (ann.secondaryStructure == pos.charAt(0) || pos.charAt(0) == 'C')\r
{\r
ann.displayCharacter = ""; // null; // " ";\r
annot.annotations.length);\r
System.arraycopy(els, 0, anns, annot.annotations.length, els.length);\r
annot.annotations = anns;\r
+ //System.out.println("else: ");\r
}\r
return annot;\r
}\r
}\r
}\r
\r
- private String id2type(String id)\r
+ protected static String id2type(String id)\r
{\r
if (typeIds.containsKey(id))\r
{\r
+ id);\r
return id;\r
}\r
+ /**\r
+ * //ssline is complete secondary structure line private AlignmentAnnotation\r
+ * addHelices(Vector annotation, String label, String ssline) {\r
+ * \r
+ * // decide on secondary structure or not. Annotation[] els = new\r
+ * Annotation[ssline.length()]; for (int i = 0; i < ssline.length(); i++) {\r
+ * String pos = ssline.substring(i, i + 1); Annotation ann; ann = new\r
+ * Annotation(pos, "", ' ', 0f); // 0f is 'valid' null - will not\r
+ * \r
+ * ann.secondaryStructure =\r
+ * jalview.schemes.ResidueProperties.getRNAssState(pos).charAt(0);\r
+ * \r
+ * ann.displayCharacter = "x" + ann.displayCharacter;\r
+ * \r
+ * System.out.println(ann.displayCharacter);\r
+ * \r
+ * els[i] = ann; } AlignmentAnnotation helicesAnnot = null; Enumeration e =\r
+ * annotation.elements(); while (e.hasMoreElements()) { helicesAnnot =\r
+ * (AlignmentAnnotation) e.nextElement(); if (helicesAnnot.label.equals(type))\r
+ * break; helicesAnnot = null; } if (helicesAnnot == null) { helicesAnnot =\r
+ * new AlignmentAnnotation(type, type, els);\r
+ * annotation.addElement(helicesAnnot); } else { Annotation[] anns = new\r
+ * Annotation[helicesAnnot.annotations.length + els.length];\r
+ * System.arraycopy(helicesAnnot.annotations, 0, anns, 0,\r
+ * helicesAnnot.annotations.length); System.arraycopy(els, 0, anns,\r
+ * helicesAnnot.annotations.length, els.length); helicesAnnot.annotations =\r
+ * anns; }\r
+ * \r
+ * helicesAnnot.features = Rna.GetBasePairs(ssline);\r
+ * Rna.HelixMap(helicesAnnot.features);\r
+ * \r
+ * \r
+ * return helicesAnnot; }\r
+ */\r
}\r
--- /dev/null
+package jalview.io;
+
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A file parse for T-Coffee score ascii format. This file contains the alignment consensus
+ * for each resude in any sequence.
+ * <p>
+ * This file is procuded by <code>t_coffee</code> providing the option
+ * <code>-output=score_ascii </code> to the program command line
+ *
+ * An example file is the following
+ *
+ * <pre>
+ * T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)
+ * Cedric Notredame
+ * CPU TIME:0 sec.
+ * SCORE=90
+ * *
+ * BAD AVG GOOD
+ * *
+ * 1PHT : 89
+ * 1BB9 : 90
+ * 1UHC : 94
+ * 1YCS : 94
+ * 1OOT : 93
+ * 1ABO : 94
+ * 1FYN : 94
+ * 1QCF : 94
+ * cons : 90
+ *
+ * 1PHT 999999999999999999999999998762112222543211112134
+ * 1BB9 99999999999999999999999999987-------4322----2234
+ * 1UHC 99999999999999999999999999987-------5321----2246
+ * 1YCS 99999999999999999999999999986-------4321----1-35
+ * 1OOT 999999999999999999999999999861-------3------1135
+ * 1ABO 99999999999999999999999999986-------422-------34
+ * 1FYN 99999999999999999999999999985-------32--------35
+ * 1QCF 99999999999999999999999999974-------2---------24
+ * cons 999999999999999999999999999851000110321100001134
+ *
+ *
+ * 1PHT ----------5666642367889999999999889
+ * 1BB9 1111111111676653-355679999999999889
+ * 1UHC ----------788774--66789999999999889
+ * 1YCS ----------78777--356789999999999889
+ * 1OOT ----------78877--356789999999997-67
+ * 1ABO ----------687774--56779999999999889
+ * 1FYN ----------6888842356789999999999889
+ * 1QCF ----------6878742356789999999999889
+ * cons 00100000006877641356789999999999889
+ * </pre>
+ *
+ *
+ * @author Paolo Di Tommaso
+ *
+ */
+public class TCoffeeScoreFile extends AlignFile {
+
+ public TCoffeeScoreFile(String inFile, String type) throws IOException
+ {
+ super(inFile, type);
+
+ }
+
+ public TCoffeeScoreFile(FileParse source) throws IOException
+ {
+ super(source);
+ }
+
+ /** The {@link Header} structure holder */
+ Header header;
+
+ /**
+ * Holds the consensues values for each sequences. It uses a LinkedHashMap to maintaint the
+ * insertion order.
+ */
+ LinkedHashMap<String,StringBuilder> scores;
+
+ Integer fWidth;
+
+ /**
+ * Parse the provided reader for the T-Coffee scores file format
+ *
+ * @param reader
+ public static TCoffeeScoreFile load(Reader reader) {
+
+ try {
+ BufferedReader in = (BufferedReader) (reader instanceof BufferedReader ? reader : new BufferedReader(reader));
+ TCoffeeScoreFile result = new TCoffeeScoreFile();
+ result.doParsing(in);
+ return result.header != null && result.scores != null ? result : null;
+ }
+ catch( Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ */
+
+ /**
+ * @return The 'height' of the score matrix i.e. the numbers of score rows that should matches
+ * the number of sequences in the alignment
+ */
+ public int getHeight() {
+ // the last entry will always be the 'global' alingment consensus scores, so it is removed
+ // from the 'height' count to make this value compatible with the number of sequences in the MSA
+ return scores != null && scores.size() > 0 ? scores.size()-1 : 0;
+ }
+
+ /**
+ * @return The 'width' of the score matrix i.e. the number of columns.
+ * Since teh score value are supposd to be calculated for an 'aligned' MSA, all the entries
+ * have to have the same width.
+ */
+ public int getWidth() {
+ return fWidth != null ? fWidth : 0;
+ }
+
+
+ /**
+ * Get the string of score values for the specified seqeunce ID.
+ * @param id The sequence ID
+ * @return The scores as a string of values e.g. {@code 99999987-------432}.
+ * It return an empty string when the specified ID is missing.
+ */
+ public String getScoresFor( String id ) {
+ return scores!=null && scores.containsKey(id) ? scores.get(id).toString() : "";
+ }
+
+ /**
+ * @return The list of score string as a {@link List} object, in the same ordeer of the insertion i.e. in the MSA
+ */
+ public List<String> getScoresList() {
+ if (scores==null)
+ {
+ return null;
+ }
+ List<String> result = new ArrayList<String>( scores.size() );
+ for( Map.Entry<String,StringBuilder> it : scores.entrySet() ) {
+ result.add(it.getValue().toString());
+ }
+
+ return result;
+ }
+
+ /**
+ * @return The parsed score values a matrix of bytes
+ */
+ public byte[][] getScoresArray() {
+ if (scores==null)
+ {
+ return null;
+ }
+ byte[][] result = new byte[ scores.size() ][];
+
+ int rowCount = 0;
+ for( Map.Entry<String,StringBuilder> it : scores.entrySet() ) {
+ String line = it.getValue().toString();
+ byte[] seqValues = new byte[ line.length() ];
+ for( int j=0, c=line.length(); j<c; j++ ) {
+
+ byte val = (byte)(line.charAt(j) - '0');
+
+ seqValues[j] = ( val >= 0 && val <= 9 ) ? val : -1;
+ }
+
+ result[rowCount++] = seqValues;
+ }
+
+ return result;
+ }
+
+
+ public void parse() throws IOException
+ {
+ /*
+ * read the header
+ */
+ header = readHeader(this);
+
+ if( header == null ) { error=true; return;}
+ scores = new LinkedHashMap<String,StringBuilder>();
+
+ /*
+ * initilize the structure
+ */
+ for( Map.Entry<String,Integer> entry : header.scores.entrySet() ) {
+ scores.put( entry.getKey(), new StringBuilder());
+ }
+
+ /*
+ * go with the reading
+ */
+ Block block;
+ while( (block = readBlock(this,header.scores.size())) != null ) {
+
+ /*
+ * append sequences read in the block
+ */
+ for( Map.Entry<String,String> entry : block.items.entrySet() ) {
+ StringBuilder scoreStringBuilder = scores.get(entry.getKey());
+ if( scoreStringBuilder == null ) {
+ error=true;
+ errormessage=String.format("Invalid T-Coffee score file: Sequence ID '%s' is not declared in header section", entry.getKey());
+ return ;
+ }
+
+ scoreStringBuilder.append( entry.getValue() );
+ }
+ }
+
+ /*
+ * verify that all rows have the same width
+ */
+ for( StringBuilder str : scores.values() ) {
+ if( fWidth == null ) {
+ fWidth = str.length();
+ }
+ else if( fWidth != str.length() ) {
+ error=true;
+ errormessage="Invalid T-Coffee score file: All the score sequences must have the same length";
+ return ;
+ }
+ }
+
+
+ return;
+ }
+
+
+ static int parseInt( String str ) {
+ try {
+ return Integer.parseInt(str);
+ }
+ catch( NumberFormatException e ) {
+ // TODO report a warning ?
+ return 0;
+ }
+ }
+
+ /**
+ * Reaad the header section in the T-Coffee score file format
+ *
+ * @param reader The scores reader
+ * @return The parser {@link Header} instance
+ * @throws RuntimeException when the header is not in the expected format
+ */
+ static Header readHeader(FileParse reader) throws IOException {
+
+ Header result = null;
+ try {
+ result = new Header();
+ result.head = reader.nextLine();
+
+ String line;
+
+ while( (line = reader.nextLine()) != null ) {
+ if( line.startsWith("SCORE=")) {
+ result.score = parseInt( line.substring(6).trim() );
+ break;
+ }
+ }
+
+ if( (line=reader.nextLine())==null || !"*".equals(line.trim())) { error(reader,"Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)"); return null;}
+ if( (line=reader.nextLine())==null || !"BAD AVG GOOD".equals(line.trim())) { error(reader,"Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)"); return null;}
+ if( (line=reader.nextLine())==null || !"*".equals(line.trim())) {error(reader,"Invalid T-COFFEE score format (NO BAD/AVG/GOOD header)"); return null;}
+
+ /*
+ * now are expected a list if sequences ID up to the first blank line
+ */
+ while( (line=reader.nextLine()) != null ) {
+ if( "".equals(line) ) {
+ break;
+ }
+
+ int p = line.indexOf(":");
+ if( p == -1 ) {
+ // TODO report a warning
+ continue;
+ }
+
+ String id = line.substring(0,p).trim();
+ int val = parseInt(line.substring(p+1).trim());
+ if( "".equals(id) ) {
+ // TODO report warning
+ continue;
+ }
+
+ result.scores.put(id,val);
+ }
+
+ if (result==null) {
+ error(reader, "T-COFFEE score file had no per-sequence scores");
+ }
+
+ }
+ catch( IOException e ) {
+ error(reader,"Unexpected problem parsing T-Coffee score ascii file");
+ throw e;
+ }
+
+ return result;
+ }
+ private static void error(FileParse reader, String errm)
+ {
+ reader.error=true;
+ if (reader.errormessage==null)
+ { reader.errormessage=errm;
+ } else {
+ reader.errormessage+="\n"+errm;
+ }
+ }
+ /**
+ * Read a scores block ihe provided stream.
+ *
+ * @param reader The stream to parse
+ * @param size The expected number of the sequence to be read
+ * @return The {@link Block} instance read or {link null} null if the end of file has reached.
+ * @throws IOException Something went wrong on the 'wire'
+ */
+ static Block readBlock( FileParse reader, int size ) throws IOException {
+ Block result = new Block(size);
+ String line;
+
+ /*
+ * read blank lines (eventually)
+ */
+ while( (line=reader.nextLine()) != null && "".equals(line.trim())) {
+ // consume blank lines
+ }
+
+ if( line == null ) { return null; }
+
+ /*
+ * read the scores block
+ */
+ do {
+ if( "".equals(line.trim()) ) {
+ // terminated
+ break;
+ }
+
+ // split the line on the first blank
+ // the first part have to contain the sequence id
+ // the remaining part are the scores values
+ int p = line.indexOf(" ");
+ if( p == -1 ) {
+ if (reader.warningMessage==null) { reader.warningMessage=""; }
+ reader.warningMessage+="Possible parsing error - expected to find a space in line: '"+line+"'\n";
+ continue;
+ }
+
+ String id = line.substring(0,p).trim();
+ String val = line.substring(p+1).trim();
+
+ result.items.put(id, val);
+
+ } while( (line = reader.nextLine()) != null );
+
+
+ return result;
+ }
+
+ /*
+ * The score file header
+ */
+ static class Header {
+ String head;
+ int score;
+
+ LinkedHashMap<String,Integer> scores = new LinkedHashMap<String,Integer>();
+
+ public int getScoreAvg() { return score; }
+
+ public int getScoreFor( String ID ) {
+
+ return scores.containsKey(ID) ? scores.get(ID) : -1;
+
+ }
+ }
+
+ /*
+ * Hold a single block values block in the score file
+ */
+ static class Block {
+ int size;
+ Map<String,String> items;
+
+ public Block( int size ) {
+ this.size = size;
+ this.items = new HashMap<String,String>(size);
+ }
+
+ String getScoresFor( String id ) {
+ return items.get(id);
+ }
+
+ String getConsensus() {
+ return items.get("cons");
+ }
+ }
+ /**
+ * TCOFFEE score colourscheme
+ */
+ static final Color[] colors = {
+ new Color( 102, 102, 255 ), // #6666FF
+ new Color( 0, 255, 0), // #00FF00
+ new Color( 102, 255, 0), // #66FF00
+ new Color( 204, 255, 0), // #CCFF00
+ new Color( 255, 255, 0), // #FFFF00
+ new Color( 255, 204, 0), // #FFCC00
+ new Color( 255, 153, 0), // #FF9900
+ new Color( 255, 102, 0), // #FF6600
+ new Color( 255, 51, 0), // #FF3300
+ new Color( 255, 34, 0) // #FF2000
+ };
+ public final static String TCOFFEE_SCORE="TCoffeeScore";
+ /**
+ * generate annotation for this TCoffee score set on the given alignment
+ * @param al alignment to annotate
+ * @param matchids if true, annotate sequences based on matching sequence names
+ * @return true if alignment annotation was modified, false otherwise.
+ */
+ public boolean annotateAlignment(AlignmentI al, boolean matchids)
+ {
+ if (al.getHeight()!=getHeight() || al.getWidth()!=getWidth())
+ {
+ warningMessage="Alignment shape does not match T-Coffee score file shape.";
+ return false;
+ }
+ boolean added=false;
+ int i=0;
+ SequenceIdMatcher sidmatcher = new SequenceIdMatcher(al.getSequencesArray());
+ byte[][] scoreMatrix=getScoresArray();
+ // for 2.8 - we locate any existing TCoffee annotation and remove it first before adding this.
+ for (Map.Entry<String,StringBuilder> id:scores.entrySet())
+ {
+ byte[] srow=scoreMatrix[i];
+ SequenceI s;
+ if (matchids)
+ {
+ s=sidmatcher.findIdMatch(id.getKey());
+ } else {
+ s=al.getSequenceAt(i);
+ }
+ i++;
+ if (s==null && i!=scores.size() && !id.getKey().equals("cons"))
+ {
+ System.err.println("No "+(matchids ? "match ":" sequences left ")+" for TCoffee score set : "+id.getKey());
+ continue;
+ }
+ int jSize=al.getWidth()< srow.length ? al.getWidth() : srow.length;
+ Annotation[] annotations=new Annotation[al.getWidth()];
+ for (int j=0;j<jSize;j++) {
+ byte val = srow[j];
+ if (s!=null && jalview.util.Comparison.isGap(s.getCharAt(j)))
+ {
+ annotations[j]=null;
+ if (val>0)
+ {
+ System.err.println("Warning: non-zero value for positional T-COFFEE score for gap at "+j+" in sequence "+s.getName());
+ }
+ } else {
+ annotations[j]=new Annotation(s==null ? ""+val:null,s==null ? ""+val:null,'\0',val*1f,val >= 0 && val < colors.length ? colors[val] : Color.white);
+ }
+ }
+ // this will overwrite any existing t-coffee scores for the alignment
+ AlignmentAnnotation aa=al.findOrCreateAnnotation(TCOFFEE_SCORE,false,s,null);
+ if (s!=null)
+ {
+ aa.label="T-COFFEE";
+ aa.description=""+id.getKey();
+ aa.annotations=annotations;
+ aa.visible=false;
+ aa.belowAlignment=false;
+ aa.setScore(header.getScoreFor(id.getKey()));
+ aa.createSequenceMapping(s, s.getStart(),true);
+ s.addAlignmentAnnotation(aa);
+ aa.adjustForAlignment();
+ } else {
+ aa.graph=AlignmentAnnotation.NO_GRAPH;
+ aa.label="T-COFFEE";
+ aa.description="TCoffee column reliability score";
+ aa.annotations=annotations;
+ aa.belowAlignment=true;
+ aa.visible=true;
+ aa.setScore(header.getScoreAvg());
+ }
+ aa.showAllColLabels=true;
+ aa.validateRangeAndDisplay();
+ added=true;
+ }
+
+ return added;
+ }
+
+ @Override
+ public String print()
+ {
+ // TODO Auto-generated method stub
+ return "Not valid.";
+ }
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.io;
import jalview.bin.Cache;
import jalview.datamodel.AlignedCodonFrame;
import jalview.datamodel.AlignmentAnnotation;
-import jalview.datamodel.AlignmentI;
-import jalview.datamodel.AlignmentView;
-import jalview.datamodel.DBRefEntry;
import jalview.datamodel.GraphLine;
-import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import jalview.io.vamsas.DatastoreItem;
import jalview.io.vamsas.DatastoreRegistry;
import jalview.io.vamsas.Rangetype;
-import jalview.util.UrlLink;
-
import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.IdentityHashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
import java.util.jar.JarInputStream;
import java.util.jar.JarOutputStream;
import uk.ac.vamsas.objects.utils.Properties;
/*
- *
+ *
* static {
* org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty(
* "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); }
- *
+ *
*/
/*
- * TODO: check/verify consistency for vamsas sync with group associated alignment annotation
+ * TODO: check/verify consistency for vamsas sync with group associated alignment annotation
*/
public class VamsasAppDatastore
{
}
/**
- *
+ *
* @param vobj
* @return Jalview datamodel object bound to the vamsas document object
*/
/**
* put the alignment viewed by AlignViewport into cdoc.
- *
+ *
* @param av
* alignViewport to be stored
* @param aFtitle
/*
* We do not put local Alignment Sequence Features into the vamsas
* document yet.
- *
- *
+ *
+ *
* jalview.datamodel.SequenceFeature[] features = alseq
* .getSequenceFeatures(); for (int f = 0; f < features.length; f++) {
* if (features[f] != null) { AlignmentSequenceAnnotation valseqf = (
* AlignmentSequenceAnnotation) getjv2vObj(features[i]); if (valseqf
* == null) {
- *
+ *
* valseqf = (AlignmentSequenceAnnotation) getDSAnnotationFromJalview(
* new AlignmentSequenceAnnotation(), features[i]);
* valseqf.setGraph(false);
else
{
// first find the alignment sequence to associate this with.
- SequenceI jvalsq = null;
- Enumeration jval = av.getAlignment().getSequences()
- .elements();
- while (jval.hasMoreElements())
- {
- jvalsq = (SequenceI) jval.nextElement();
+ for (SequenceI jvalsq:av.getAlignment().getSequences()) {
// saveDatasetSequenceAnnotation(AlSeqMaps,(uk.ac.vamsas.objects.core.Sequence)
// sref, aa[i]);
if (jvalsq.getDatasetSequence() == aa[i].sequenceRef)
* very quick test to see if the viewport would be stored in the vamsas
* document. Reasons for not storing include the unaligned flag being false
* (for all sequences, including the hidden ones!)
- *
+ *
* @param av
* @return true if alignment associated with this view will be stored in
* document.
/**
* remove docseqs from the given alignment marking provenance appropriately
* and removing any references to the sequences.
- *
+ *
* @param alignment
* @param docseqs
*/
* vamsas alignment sequence for jvalsq and adds it to the alignment if
* necessary. unbounddocseq is a duplicate of the vamsas alignment sequences
* and these are removed after being processed w.r.t a bound jvalsq
- *
+ *
*/
private boolean syncToAlignmentSequence(SequenceI jvalsq,
Alignment alignment, Vector unbounddocseq)
* creates/syncs the jvalsq from the alignment sequence
*/
private boolean syncFromAlignmentSequence(AlignmentSequence valseq,
- char valGapchar, char gapChar, Vector dsseqs)
+ char valGapchar, char gapChar, List<SequenceI> dsseqs)
{
boolean modal = false;
/**
* set vamsas annotation object type from jalview annotation
- *
+ *
* @param an
* @param alan
*/
/**
* get start<end range of segment, adjusting for inclusivity flag and
* polarity.
- *
+ *
* @param visSeg
* @param ensureDirection
* when true - always ensure start is less than end.
}
/**
- *
+ *
* @param annotation
* @return true if annotation is not to be stored in document
*/
/**
* list of alignment views created when updating Jalview from document.
*/
- private Vector newAlignmentViews = new Vector();
+ private final Vector newAlignmentViews = new Vector();
/**
* update local jalview view settings from the stored appdata (if any)
jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider()
{
+ @Override
public String getFilename()
{
return "Jalview Vamsas Document Client Data";
}
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
jalview.bin.Cache.log
jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider()
{
+ @Override
public String getFilename()
{
return "Jalview Vamsas Document User Data";
}
+ @Override
public JarInputStream getJarInputStream() throws IOException
{
jalview.bin.Cache.log
/**
* replaces oldjvobject with newjvobject in the Jalview Object <> VorbaID
* binding tables
- *
+ *
* @param oldjvobject
* @param newjvobject
* (may be null)
Object vobject = jv2vobj.remove(oldjvobject);
if (vobject == null)
{
+ // NOTE: this happens if user deletes object in one session then updates from another client
throw new Error(
"IMPLEMENTATION ERROR: old jalview object is not bound ! ("
+ oldjvobject + ")");
/**
* translate the Vobject keys to strings for use in Jalview2XML
- *
+ *
* @param jv2vobj2
* @return
*/
/**
* translate the Vobject values to strings for use in Jalview2XML
- *
+ *
* @param vobj2jv2
* @return hashtable with string values
*/
/**
* synchronize Jalview from the vamsas document
- *
+ *
* @return number of new views from document
*/
public int updateToJalview()
// ///LOAD DATASET
DataSet dataset = root.getDataSet(_ds);
int i, iSize = dataset.getSequenceCount();
- Vector dsseqs;
+ List<SequenceI> dsseqs;
jalview.datamodel.Alignment jdataset = (jalview.datamodel.Alignment) getvObj2jv(dataset);
int jremain = 0;
if (jdataset == null)
SequenceI[] seqs = new SequenceI[dsseqs.size()];
for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
{
- seqs[i] = (SequenceI) dsseqs.elementAt(i);
- dsseqs.setElementAt(null, i);
+ seqs[i] = dsseqs.get(i);
+ dsseqs.set(i, null);
}
jdataset = new jalview.datamodel.Alignment(seqs);
Cache.log.debug("New vamsas dataset imported into jalview.");
SequenceI[] seqs = new SequenceI[dsseqs.size()];
for (i = 0, iSize = dsseqs.size(); i < iSize; i++)
{
- seqs[i] = (SequenceI) dsseqs.elementAt(i);
- dsseqs.setElementAt(null, i);
+ seqs[i] = dsseqs.get(i);
+ dsseqs.set(i,null);
}
jal = new jalview.datamodel.Alignment(seqs);
Cache.log.debug("New vamsas alignment imported into jalview "
* jalview.datamodel.Annotation[] rows Two annotation rows are made if there
* are distinct annotation for both at 'pos' and 'after pos' at any particular
* site.
- *
+ *
* @param annotation
* @return { boolean[static int constants ], int[ae.length] - map to annotated
* object frame, jalview.datamodel.Annotation[],
* get real bounds of a RangeType's specification. start and end are an
* inclusive range within which all segments and positions lie. TODO: refactor
* to vamsas utils
- *
+ *
* @param dseta
* @return int[] { start, end}
*/
/**
* map from a rangeType's internal frame to the referenced object's coordinate
* frame.
- *
+ *
* @param dseta
* @return int [] { ref(pos)...} for all pos in rangeType's frame.
*/
}
/**
- *
+ *
* @param maprange
* where the from range is the local mapped range, and the to range
* is the 'mapped' range in the MapRangeType
/**
* initialise a range type object from a set of start/end inclusive intervals
- *
+ *
* @param mrt
* @param range
*/
/**
* initialise a MapType object from a MapList object.
- *
+ *
* @param maprange
* @param ml
* @param setUnits
* App and Action here. Provenance prov = new Provenance();
* org.exolab.castor.types.Date date = new org.exolab.castor.types.Date( new
* java.util.Date()); Entry provEntry;
- *
+ *
* if (jprov != null) { entries = jprov.getEntries(); for (int i = 0; i <
* entries.length; i++) { provEntry = new Entry(); try { date = new
* org.exolab.castor.types.Date(entries[i].getDate()); } catch (Exception ex)
* { ex.printStackTrace();
- *
+ *
* date = new org.exolab.castor.types.Date(entries[i].getDate()); }
* provEntry.setDate(date); provEntry.setUser(entries[i].getUser());
* provEntry.setAction(entries[i].getAction()); prov.addEntry(provEntry); } }
* provEntry.setUser(System.getProperty("user.name")); // TODO: ext string
* provEntry.setApp("JVAPP"); // TODO: ext string provEntry.setAction(action);
* prov.addEntry(provEntry); }
- *
+ *
* return prov; }
*/
jalview.datamodel.Provenance getJalviewProvenance(Provenance prov)
}
/**
- *
+ *
* @return default initial provenance list for a Jalview created vamsas
* object.
*/
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.io.vamsas;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
+import java.util.List;
import java.util.Vector;
import jalview.analysis.NJTree;
-import jalview.analysis.SequenceIdMatcher;
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
import jalview.datamodel.SequenceNode;
-import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import jalview.gui.TreePanel;
import jalview.io.NewickFile;
/*
* (non-Javadoc)
- *
+ *
* @see jalview.io.vamsas.DatastoreItem#addFromDocument()
*/
+ @Override
public void addFromDocument()
{
tree = (uk.ac.vamsas.objects.core.Tree) vobj; // vtree;
/*
* (non-Javadoc)
- *
+ *
* @see jalview.io.vamsas.DatastoreItem#conflict()
*/
+ @Override
public void conflict()
{
Cache.log
/*
* (non-Javadoc)
- *
+ *
* @see jalview.io.vamsas.DatastoreItem#update()
*/
+ @Override
public void updateToDoc()
{
if (isModifiable(tree.getModifiable()))
/*
* (non-Javadoc)
- *
+ *
* @see jalview.io.vamsas.DatastoreItem#updateFromDoc()
*/
+ @Override
public void updateFromDoc()
{
// should probably just open a new tree panel in the same place as the old
// TODO: Tree.updateFromDoc
/*
* TreePanel tp = (TreePanel) jvobj; // getvObj2jv(tree);
- *
+ *
* // make a new tree Object[] idata =
* recoverInputData(tree.getProvenance()); try { if (idata != null &&
* idata[0] != null) { inputData = (AlignmentView) idata[0]; } ntree =
/**
* correctly creates provenance for trees calculated on an alignment by
* jalview.
- *
+ *
* @param jal
* @param tp
* @return
/**
* look up SeqCigars in an existing alignment.
- *
+ *
* @param jal
* @param sequences
* @return vector of alignment sequences in order of SeqCigar array (but
SeqCigar[] tseqs = new SeqCigar[sequences.length];
System.arraycopy(sequences, 0, tseqs, 0, sequences.length);
Vector alsq = new Vector();
- Enumeration as = jal.getSequences().elements();
- while (as.hasMoreElements())
+ List<SequenceI> jalsqs;
+ synchronized (jalsqs=jal.getSequences())
+ {for (SequenceI asq:jalsqs)
{
- SequenceI asq = (SequenceI) as.nextElement();
for (int t = 0; t < sequences.length; t++)
{
if (tseqs[t] != null
alsq.add(asq);
}
}
- }
+ }}
if (alsq.size() < sequences.length)
Cache.log
.warn("Not recovered all alignment sequences for given set of input sequence CIGARS");
}
/**
- *
+ *
* Update jalview newick representation with TreeNode map
- *
+ *
* @param tp
* the treepanel that this tree is bound to.
*/
// / TODO: refactor to vamsas :start
/**
* construct treenode mappings for mapped sequences
- *
+ *
* @param ntree
* @param newick
* @return
/**
* call to match up Treenode specs to NJTree parsed from document object.
- *
+ *
* @param nodespec
* @param leaves
* as returned from NJTree.findLeaves( .., ..) ..
// todo: end refactor to vamsas library
/**
* add jalview object to vamsas document
- *
+ *
*/
+ @Override
public void addToDocument()
{
tree = new uk.ac.vamsas.objects.core.Tree();
/**
* note: this function assumes that all sequence and alignment objects
* referenced in input data has already been associated with jalview objects.
- *
+ *
* @param tp
* @param alignFrame
* @return Object[] { AlignmentView, AlignmentI - reference alignment for
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
* @param alf
* @param features - gff or features file
* @param autoenabledisplay - when true, feature display will be enabled if any features can be parsed from the string.
+ * @return true if data parsed as features
*/
- public abstract void loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
+ public abstract boolean loadFeaturesFrom(AlignFrame alf, String features, boolean autoenabledisplay);
/**
* get the sequence features in the given format (Jalview or GFF)
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.jbgui;
-import java.awt.*;
-import java.awt.event.*;
-
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.schemes.*;
+import jalview.schemes.ColourSchemeProperty;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GridLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusAdapter;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JInternalFrame;
+import javax.swing.JLabel;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JRadioButtonMenuItem;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.MenuEvent;
+import javax.swing.event.MenuListener;
public class GAlignFrame extends JInternalFrame
{
protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();
+ protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
+ // protected JRadioButtonMenuItem covariationColour = new
+ // JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem tcoffeeColour = new JRadioButtonMenuItem();
+
+
JMenuItem njTreeBlosumMenuItem = new JMenuItem();
JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();
public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
- protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();
-
JMenuItem deleteGroups = new JMenuItem();
JMenuItem delete = new JMenuItem();
JMenuItem epsFile = new JMenuItem();
JMenuItem LoadtreeMenuItem = new JMenuItem();
-
+
public JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();
public JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();
protected JMenu showProducts = new JMenu();
- public JMenuItem featureSettings = new JMenuItem();
+ public JMenuItem openFeatureSettings = new JMenuItem();
JMenuItem fetchSequence = new JMenuItem();
JMenuItem annotationColour = new JMenuItem();
+ protected JMenuItem rnahelicesColour = new JMenuItem();
+
JMenuItem associatedData = new JMenuItem();
protected JCheckBoxMenuItem autoCalculate = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem showSequenceLogo = new JCheckBoxMenuItem();
+ protected JCheckBoxMenuItem normaliseSequenceLogo = new JCheckBoxMenuItem();
+
protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
private JMenuItem grpsFromSelection = new JMenuItem();
colours.add(PIDColour);
colours.add(BLOSUM62Colour);
colours.add(nucleotideColour);
+ colours.add(purinePyrimidineColour);
+ // colours.add(covariationColour);
+ colours.add(tcoffeeColour);
setColourSelected(jalview.bin.Cache
.getDefault("DEFAULT_COLOUR", "None"));
nucleotideColour.setSelected(true);
break;
+
+ case ColourSchemeProperty.TCOFFEE:
+ tcoffeeColour.setSelected(true);
+ break;
+ case ColourSchemeProperty.PURINEPYRIMIDINE:
+ purinePyrimidineColour.setSelected(true);
+
+ break;
+ /*
+ * case ColourSchemeProperty.COVARIATION:
+ * covariationColour.setSelected(true);
+ *
+ * break;
+ */
case ColourSchemeProperty.USER_DEFINED:
userDefinedColour.setSelected(true);
BLOSUM62Colour_actionPerformed(e);
}
});
+ nucleotideColour.setText("Nucleotide");
+ nucleotideColour.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ nucleotideColour_actionPerformed(e);
+ }
+ });
+
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour
+ .addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ purinePyrimidineColour_actionPerformed(e);
+ }
+ });
+ /*
+ * covariationColour.setText("Covariation");
+ * covariationColour.addActionListener(new java.awt.event.ActionListener() {
+ * public void actionPerformed(ActionEvent e) {
+ * covariationColour_actionPerformed(e); } });
+ */
+
avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62");
avDistanceTreeBlosumMenuItem
.addActionListener(new java.awt.event.ActionListener()
}
});
+ normaliseSequenceLogo.setText("Normalise Consensus Logo");
+ normaliseSequenceLogo.addActionListener(new ActionListener()
+ {
+
+ public void actionPerformed(ActionEvent e)
+ {
+ normaliseSequenceLogo_actionPerformed(e);
+ }
+
+ });
applyAutoAnnotationSettings.setText("Apply to all groups");
applyAutoAnnotationSettings.setState(false);
applyAutoAnnotationSettings.setVisible(true);
nucleotideColour_actionPerformed(e);
}
});
+
+ tcoffeeColour.setText("T-Coffee scores");
+ tcoffeeColour.setEnabled(false);
+ tcoffeeColour.addActionListener( new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ tcoffeeColorScheme_actionPerformed(e);
+ }
+ } );
+
+
deleteGroups.setText("Undefine groups");
deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit()
}
});
LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");
- LoadtreeMenuItem.setText("Load Associated Tree");
+ LoadtreeMenuItem.setText("Load Associated Tree");
LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(ActionEvent e)
LoadtreeMenuItem_actionPerformed(e);
}
});
+
scaleAbove.setVisible(false);
scaleAbove.setText("Scale Above");
scaleAbove.addActionListener(new java.awt.event.ActionListener()
* public void actionPerformed(ActionEvent e) {
* showProducts_actionPerformed(e); } });
*/
- featureSettings.setText("Feature Settings...");
- featureSettings.addActionListener(new ActionListener()
+ openFeatureSettings.setText("Feature Settings...");
+ openFeatureSettings.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
annotationColour_actionPerformed(e);
}
});
+
+ rnahelicesColour.setText("By RNA helices");
+ rnahelicesColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ rnahelicesColour_actionPerformed(e);
+ }
+ });
+
associatedData.setText("Load Features / Annotations");
associatedData.addActionListener(new ActionListener()
{
autoAnnMenu.add(applyAutoAnnotationSettings);
autoAnnMenu.add(showConsensusHistogram);
autoAnnMenu.add(showSequenceLogo);
+ autoAnnMenu.add(normaliseSequenceLogo);
autoAnnMenu.addSeparator();
autoAnnMenu.add(showGroupConservation);
autoAnnMenu.add(showGroupConsensus);
viewMenu.add(showSeqFeatures);
// viewMenu.add(showSeqFeaturesHeight);
- viewMenu.add(featureSettings);
+ viewMenu.add(openFeatureSettings);
tooltipSettingsMenu.add(showDbRefsMenuitem);
tooltipSettingsMenu.add(showNpFeatsMenuitem);
viewMenu.add(tooltipSettingsMenu);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
colourMenu.add(nucleotideColour);
+ colourMenu.add(purinePyrimidineColour);
+ // colourMenu.add(covariationColour);
+ colourMenu.add(tcoffeeColour);
colourMenu.add(userDefinedColour);
colourMenu.addSeparator();
colourMenu.add(conservationMenuItem);
colourMenu.add(abovePIDThreshold);
colourMenu.add(modifyPID);
colourMenu.add(annotationColour);
+ colourMenu.add(rnahelicesColour);
calculateMenu.add(sort);
calculateMenu.add(calculateTree);
calculateMenu.addSeparator();
//selectMenu.add(listenToViewSelections);
}
+ protected void normaliseSequenceLogo_actionPerformed(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void listenToViewSelections_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
{
}
+ protected void purinePyrimidineColour_actionPerformed(ActionEvent e)
+ {
+ }
+
+ /*
+ * protected void covariationColour_actionPerformed(ActionEvent e) { }
+ */
+
protected void noColourmenuItem_actionPerformed(ActionEvent e)
{
}
protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
{
+
+ }
+
+ /**
+ * Template method to handle the 'load T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event The raised event
+ */
+ protected void loadScores_actionPerformed(ActionEvent event) {
+
+ }
+
+
+ /**
+ * Template method to handle the 'Color T-Coffee scores' menu event.
+ * <p>
+ * Subclasses override this method to provide a custom action.
+ *
+ * @param event The raised event
+ */
+ protected void tcoffeeColorScheme_actionPerformed(ActionEvent event) {
+
}
+
protected void jpred_actionPerformed(ActionEvent e)
{
}
+ public void rnahelicesColour_actionPerformed(ActionEvent e)
+ {
+
+ }
+
public void associatedData_actionPerformed(ActionEvent e)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.jbgui;
+
+import javax.swing.*;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+public class GRnaStructureViewer extends JInternalFrame
+{
+ public GRnaStructureViewer()
+ {
+ try
+ {
+ jbInit();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void jbInit() throws Exception
+ {
+
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
buriedColour_actionPerformed(actionEvent);
}
});
+ purinePyrimidineColour.setText("Purine/Pyrimidine");
+ purinePyrimidineColour.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent actionEvent)
+ {
+ purinePyrimidineColour_actionPerformed(actionEvent);
+ }
+ });
+
userColour.setText("User Defined ...");
userColour.addActionListener(new ActionListener()
{
colourMenu.add(strandColour);
colourMenu.add(turnColour);
colourMenu.add(buriedColour);
+ colourMenu.add(purinePyrimidineColour);
colourMenu.add(userColour);
colourMenu.add(jmolColour);
colourMenu.add(backGround);
protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();
protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem();
+
protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem();
{
}
+
+ public void purinePyrimidineColour_actionPerformed(ActionEvent actionEvent)
+ {
+
+ }
public void userColour_actionPerformed(ActionEvent actionEvent)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
+import javax.swing.JTable;
import javax.swing.ListSelectionModel;
-import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
/**
protected JButton deleteSbrsUrl = new JButton();
- protected JList wsList = new JList();
-
+ // Web service status and url table
+ protected JTable wsList=new JTable();
+
protected TitledBorder wsListTitleBorder = new TitledBorder(
"Web Service Discovery URLS");
progressBar.setString("");
wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
wsListUrlPanel.setLayout(new BorderLayout());
- // wsListUrlPanel.setPreferredSize(new Dimension(482,202));
wsListPane.setBorder(BorderFactory.createEtchedBorder());
wsListPane.getViewport().add(wsList);
- // wsListPane.setPreferredSize(new Dimension(380, 80));
+ wsList.setPreferredSize(new Dimension(482,202));
+ wsListPane.setPreferredSize(new Dimension(380, 80));
wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ wsList.setColumnSelectionAllowed(false);
wsList.addMouseListener(new MouseListener()
{
}
});
- // wsListButtons.setPreferredSize(new Dimension(480, 60));
wsListButtons.setLayout(new FlowLayout());
- // wsListButtons.add(moveWsUrlUp);
- // wsListButtons.add(moveWsUrlDown);
wsListButtons.add(newWsUrl);
wsListButtons.add(editWsUrl);
wsListButtons.add(deleteWsUrl);
+ wsListButtons.setMinimumSize(new Dimension(350,80));
wsListNavButs.setSize(new Dimension(80, 80));
wsListNavButs.setPreferredSize(new Dimension(80, 80));
wsListNavButs.setLayout(new FlowLayout());
srbsListUrlPanel.setLayout(new BorderLayout());
srbsListPane.setBorder(BorderFactory.createEtchedBorder());
srbsListPane.getViewport().add(sbrsList);
- //srbsListPane.setMinimumSize(new Dimension(380, 80));
sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
sbrsList.addMouseListener(new MouseListener()
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.renderer;
+
+import jalview.analysis.AAFrequency;
+import jalview.analysis.StructureFrequency;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.schemes.ColourSchemeI;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.font.LineMetrics;
+import java.awt.geom.AffineTransform;
+import java.awt.image.ImageObserver;
+import java.util.Hashtable;
+
+import com.stevesoft.pat.Regex;
+
+public class AnnotationRenderer
+{
+
+ public AnnotationRenderer()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ public void drawStemAnnot(Graphics g, Annotation[] row_annotations,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+ g.setColor(STEM_COLOUR);
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+ Regex closeparen = new Regex("(\\))");
+
+ String dc = (column == 0 || row_annotations[column - 1] == null) ? ""
+ : row_annotations[column - 1].displayCharacter;
+
+ boolean diffupstream = sCol == 0 || row_annotations[sCol - 1] == null
+ || !dc.equals(row_annotations[sCol - 1].displayCharacter);
+ boolean diffdownstream = !validRes || !validEnd
+ || row_annotations[column] == null
+ || !dc.equals(row_annotations[column].displayCharacter);
+ // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream);
+ // If a closing base pair half of the stem, display a backward arrow
+ if (column > 0 && closeparen.search(dc))
+ {
+ if (diffupstream)
+ // if (validRes && column>1 && row_annotations[column-2]!=null &&
+ // dc.equals(row_annotations[column-2].displayCharacter))
+ {
+ g.fillPolygon(new int[]
+ { lastSSX + 5, lastSSX + 5, lastSSX }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x1 += 5;
+ }
+ if (diffdownstream)
+ {
+ x2 -= 1;
+ }
+ }
+ else
+ {
+ // display a forward arrow
+ if (diffdownstream)
+ {
+ g.fillPolygon(new int[]
+ { x2 - 5, x2 - 5, x2 }, new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset }, 3);
+ x2 -= 5;
+ }
+ if (diffupstream)
+ {
+ x1 += 1;
+ }
+ }
+ // draw arrow body
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7);
+ }
+
+ private int charWidth, endRes, charHeight;
+
+ private boolean validCharWidth, hasHiddenColumns;
+
+ private FontMetrics fm;
+
+ private final boolean MAC = new jalview.util.Platform().isAMac();
+
+ boolean av_renderHistogram = true, av_renderProfile = true,
+ av_normaliseProfile = false;
+
+ ColourSchemeI profcolour = null;
+
+ private ColumnSelection columnSelection;
+
+ private Hashtable[] hconsensus;
+
+ private Hashtable[] hStrucConsensus;
+
+ private boolean av_ignoreGapsConsensus;
+
+ /**
+ * attributes set from AwtRenderPanelI
+ */
+ /**
+ * old image used when data is currently being calculated and cannot be
+ * rendered
+ */
+ private Image fadedImage;
+
+ /**
+ * panel being rendered into
+ */
+ private ImageObserver annotationPanel;
+
+ /**
+ * width of image to render in panel
+ */
+ private int imgWidth;
+
+ // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI
+ // av)
+ public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel,
+ AlignViewportI av)
+ {
+ fm = annotPanel.getFontMetrics();
+ annotationPanel = annotPanel;
+ fadedImage = annotPanel.getFadedImage();
+ imgWidth = annotPanel.getFadedImageWidth();
+ updateFromAlignViewport(av);
+ }
+
+ public void updateFromAlignViewport(AlignViewportI av)
+ {
+ charWidth = av.getCharWidth();
+ endRes = av.getEndRes();
+ charHeight = av.getCharHeight();
+ hasHiddenColumns = av.hasHiddenColumns();
+ validCharWidth = av.isValidCharWidth();
+ av_renderHistogram = av.isShowConsensusHistogram();
+ av_renderProfile = av.isShowSequenceLogo();
+ av_normaliseProfile = av.isNormaliseSequenceLogo();
+ profcolour = av.getGlobalColourScheme();
+ if (profcolour == null)
+ {
+ // Set the default colour for sequence logo if the alignnent has no
+ // colourscheme set
+ profcolour = av.getAlignment().isNucleotide() ? new jalview.schemes.NucleotideColourScheme()
+ : new jalview.schemes.ZappoColourScheme();
+ }
+ columnSelection = av.getColumnSelection();
+ hconsensus = av.getSequenceConsensusHash();// hconsensus;
+ hStrucConsensus = av.getRnaStructureConsensusHash(); // hStrucConsensus;
+ av_ignoreGapsConsensus = av.getIgnoreGapsConsensus();
+ }
+
+ public int[] getProfileFor(AlignmentAnnotation aa, int column)
+ {
+ // TODO : consider refactoring the global alignment calculation
+ // properties/rendering attributes as a global 'alignment group' which holds
+ // all vis settings for the alignment as a whole rather than a subset
+ //
+ if (aa.autoCalculated && aa.label.startsWith("Consensus"))
+ {
+ if (aa.groupRef != null && aa.groupRef.consensusData != null
+ && aa.groupRef.isShowSequenceLogo())
+ {
+ return AAFrequency.extractProfile(
+ aa.groupRef.consensusData[column],
+ aa.groupRef.getIgnoreGapsConsensus());
+ }
+ // TODO extend annotation row to enable dynamic and static profile data to
+ // be stored
+ if (aa.groupRef == null && aa.sequenceRef == null && av_renderProfile)
+ {
+ return AAFrequency.extractProfile(hconsensus[column],
+ av_ignoreGapsConsensus);
+ }
+ }
+ else
+ {
+ if (aa.autoCalculated && aa.label.startsWith("StrucConsensus"))
+ {
+ // TODO implement group structure consensus
+ /*
+ * if (aa.groupRef != null && aa.groupRef.consensusData != null &&
+ * aa.groupRef.isShowSequenceLogo()) { //TODO check what happens for
+ * group selections return StructureFrequency.extractProfile(
+ * aa.groupRef.consensusData[column], aa.groupRef
+ * .getIgnoreGapsConsensus()); }
+ */
+ // TODO extend annotation row to enable dynamic and static profile data
+ // to
+ // be stored
+ if (aa.groupRef == null && aa.sequenceRef == null
+ && av_renderProfile && hStrucConsensus != null
+ && hStrucConsensus.length > column)
+ {
+ return StructureFrequency.extractProfile(hStrucConsensus[column],
+ av_ignoreGapsConsensus);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Render the annotation rows associated with an alignment.
+ * @param annotPanel
+ * container frame
+ * @param av
+ * data and view settings to render
+ * @param g
+ * destination for graphics
+ * @param activeRow
+ * row where a mouse event occured (or -1)
+ * @param startRes
+ * first column that will be drawn
+ * @param endRes
+ * last column that will be drawn
+ * @return true if the fadedImage was used for any alignment annotation rows currently being calculated
+ */
+ public boolean drawComponent(AwtRenderPanelI annotPanel, AlignViewportI av,
+ Graphics g, int activeRow, int startRes, int endRes)
+ {
+ boolean usedFaded=false;
+ // NOTES:
+ // AnnotationPanel needs to implement: ImageObserver, access to
+ // AlignViewport
+ updateFromAwtRenderPanel(annotPanel, av);
+ fm = g.getFontMetrics();
+ AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation();
+
+ int x = 0, y = 0;
+ int column = 0;
+ char lastSS;
+ int lastSSX;
+ int iconOffset = 0;
+ boolean validRes = false;
+ boolean validEnd = false;
+ boolean labelAllCols = false;
+ boolean centreColLabels, centreColLabelsDef = av
+ .getCentreColumnLabels();
+ boolean scaleColLabel = false;
+ boolean[] graphGroupDrawn = new boolean[aa.length];
+ int charOffset = 0; // offset for a label
+ float fmWidth, fmScaling = 1f; // scaling for a label to fit it into a
+ // column.
+ Font ofont = g.getFont();
+ // \u03B2 \u03B1
+ for (int i = 0; i < aa.length; i++)
+ {
+ AlignmentAnnotation row = aa[i];
+ Annotation[] row_annotations=row.annotations;
+ if (!row.visible)
+ {
+ continue;
+ }
+ centreColLabels = row.centreColLabels || centreColLabelsDef;
+ labelAllCols = row.showAllColLabels;
+ scaleColLabel = row.scaleColLabel;
+ lastSS = ' ';
+ lastSSX = 0;
+ if (row.graph > 0)
+ {
+ if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
+ {
+ continue;
+ }
+
+ // this is so that we draw the characters below the graph
+ y += row.height;
+
+ if (row.hasText)
+ {
+ iconOffset = charHeight - fm.getDescent();
+ y -= charHeight;
+ }
+ }
+ else if (row.hasText)
+ {
+ iconOffset = charHeight - fm.getDescent();
+
+ }
+ else
+ {
+ iconOffset = 0;
+ }
+
+ if (row.autoCalculated && av.isCalculationInProgress(row))
+ {
+ y += charHeight;
+ usedFaded=true;
+ g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y
+ - row.height, imgWidth, y, annotationPanel);
+ g.setColor(Color.black);
+ // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2);
+
+ continue;
+ }
+
+ /*
+ * else if (annotationPanel.av.updatingConservation &&
+ * aa[i].label.equals("Conservation")) {
+ *
+ * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
+ * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
+ * annotationPanel.imgWidth, y, annotationPanel);
+ *
+ * g.setColor(Color.black); //
+ * g.drawString("Calculating Conservation.....",20, y-row.height/2);
+ *
+ * continue; } else if (annotationPanel.av.updatingConservation &&
+ * aa[i].label.equals("Quality")) {
+ *
+ * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y -
+ * row.height, annotationPanel.imgWidth, y, 0, y - row.height,
+ * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black);
+ * // / g.drawString("Calculating Quality....",20, y-row.height/2);
+ *
+ * continue; }
+ */
+ // first pass sets up state for drawing continuation from left-hand column
+ // of startRes
+ x = (startRes == 0) ? 0 : -1;
+ while (x < endRes - startRes)
+ {
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(startRes + x);
+ if (column > row_annotations.length - 1)
+ {
+ break;
+ }
+ }
+ else
+ {
+ column = startRes + x;
+ }
+
+ if ((row_annotations == null) || (row_annotations.length <= column)
+ || (row_annotations[column] == null))
+ {
+ validRes = false;
+ }
+ else
+ {
+ validRes = true;
+ }
+ if (x > -1)
+ {
+ if (activeRow == i)
+ {
+ g.setColor(Color.red);
+
+ if (columnSelection != null)
+ {
+ for (int n = 0; n < columnSelection.size(); n++)
+ {
+ int v = columnSelection.columnAt(n);
+
+ if (v == column)
+ {
+ g.fillRect(x * charWidth, y, charWidth, charHeight);
+ }
+ }
+ }
+ }
+ if (!row.isValidStruc())
+ {
+ g.setColor(Color.orange);
+ g.fillRect((int) row.getInvalidStrucPos() * charWidth, y,
+ charWidth, charHeight);
+ }
+ if (validCharWidth
+ && validRes
+ && row_annotations[column].displayCharacter != null
+ && (row_annotations[column].displayCharacter.length() > 0))
+ {
+
+ if (centreColLabels || scaleColLabel)
+ {
+ fmWidth = fm.charsWidth(
+ row_annotations[column].displayCharacter
+ .toCharArray(), 0,
+ row_annotations[column].displayCharacter.length());
+
+ if (scaleColLabel)
+ {
+ // justify the label and scale to fit in column
+ if (fmWidth > charWidth)
+ {
+ // scale only if the current font isn't already small enough
+ fmScaling = charWidth;
+ fmScaling /= fmWidth;
+ g.setFont(ofont.deriveFont(AffineTransform
+ .getScaleInstance(fmScaling, 1.0)));
+ // and update the label's width to reflect the scaling.
+ fmWidth = charWidth;
+ }
+ }
+ }
+ else
+ {
+ fmWidth = fm
+ .charWidth(row_annotations[column].displayCharacter
+ .charAt(0));
+ }
+ charOffset = (int) ((charWidth - fmWidth) / 2f);
+
+ if (row_annotations[column].colour == null)
+ g.setColor(Color.black);
+ else
+ g.setColor(row_annotations[column].colour);
+
+ if (column == 0 || row.graph > 0)
+ {
+ g.drawString(row_annotations[column].displayCharacter,
+ (x * charWidth) + charOffset, y + iconOffset);
+ }
+ else if (row_annotations[column - 1] == null
+ || (labelAllCols
+ || !row_annotations[column].displayCharacter
+ .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter
+ .length() < 2 && row_annotations[column].secondaryStructure == ' ')))
+ {
+ g.drawString(row_annotations[column].displayCharacter, x
+ * charWidth + charOffset, y + iconOffset);
+ }
+ g.setFont(ofont);
+ }
+ }
+ if (row.hasIcons)
+ {
+ char ss = validRes ? row_annotations[column].secondaryStructure
+ : ' ';
+ if (ss == 'S')
+ {
+ // distinguish between forward/backward base-pairing
+ if (row_annotations[column].displayCharacter.indexOf(')') > -1)
+ {
+ ss = 's';
+ }
+ }
+ if (!validRes || (ss != lastSS))
+ {
+ if (x > -1)
+ {
+ switch (lastSS)
+ {
+ case 'H':
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+
+ case 'E':
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+
+ case 'S': // Stem case for RNA secondary structure
+ case 's': // and opposite direction
+ drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+
+ default:
+ g.setColor(Color.gray);
+ g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth)
+ - lastSSX, 2);
+
+ break;
+ }
+ }
+ if (validRes)
+ {
+ lastSS = ss;
+ }
+ else
+ {
+ lastSS = ' ';
+ }
+ if (x > -1)
+ {
+ lastSSX = (x * charWidth);
+ }
+ }
+ }
+ column++;
+ x++;
+ }
+ if (column >= row_annotations.length)
+ {
+ column = row_annotations.length - 1;
+ validEnd = false;
+ }
+ else
+ {
+ validEnd = true;
+ }
+ if ((row_annotations == null) || (row_annotations.length <= column)
+ || (row_annotations[column] == null))
+ {
+ validRes = false;
+ }
+ else
+ {
+ validRes = true;
+ }
+
+ // x ++;
+
+ if (row.hasIcons)
+ {
+ switch (lastSS)
+ {
+ case 'H':
+ drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+
+ case 'E':
+ drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+ case 's':
+ case 'S': // Stem case for RNA secondary structure
+ drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+ default:
+ drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, startRes,
+ column, validRes, validEnd);
+ break;
+ }
+ }
+
+ if (row.graph > 0 && row.graphHeight > 0)
+ {
+ if (row.graph == AlignmentAnnotation.LINE_GRAPH)
+ {
+ if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
+ {
+ float groupmax = -999999, groupmin = 9999999;
+ for (int gg = 0; gg < aa.length; gg++)
+ {
+ if (aa[gg].graphGroup != row.graphGroup)
+ {
+ continue;
+ }
+
+ if (aa[gg] != row)
+ {
+ aa[gg].visible = false;
+ }
+
+ if (aa[gg].graphMax > groupmax)
+ {
+ groupmax = aa[gg].graphMax;
+ }
+ if (aa[gg].graphMin < groupmin)
+ {
+ groupmin = aa[gg].graphMin;
+ }
+ }
+
+ for (int gg = 0; gg < aa.length; gg++)
+ {
+ if (aa[gg].graphGroup == row.graphGroup)
+ {
+ drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, endRes, y, groupmin,
+ groupmax, row.graphHeight);
+ }
+ }
+
+ graphGroupDrawn[row.graphGroup] = true;
+ }
+ else
+ {
+ drawLineGraph(g, row, row_annotations, startRes, endRes, y, row.graphMin,
+ row.graphMax, row.graphHeight);
+ }
+ }
+ else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
+ {
+ drawBarGraph(g, row, row_annotations, startRes, endRes, row.graphMin,
+ row.graphMax, y);
+ }
+ }
+
+ if (row.graph > 0 && row.hasText)
+ {
+ y += charHeight;
+ }
+
+ if (row.graph == 0)
+ {
+ y += aa[i].height;
+ }
+ }
+ return !usedFaded;
+ }
+
+ private final Color GLYPHLINE_COLOR = Color.gray;
+
+ private final Color SHEET_COLOUR = Color.green;
+
+ private final Color HELIX_COLOUR = Color.red;
+
+ private final Color STEM_COLOUR = Color.blue;
+
+ public void drawGlyphLine(Graphics g, Annotation[] row,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+ g.setColor(GLYPHLINE_COLOR);
+ g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2);
+ }
+
+ public void drawSheetAnnot(Graphics g, Annotation[] row,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+ g.setColor(SHEET_COLOUR);
+
+ if (!validEnd || !validRes || row==null || row[column] == null
+ || row[column].secondaryStructure != 'E')
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset,
+ (x * charWidth) - lastSSX - 4, 7);
+ g.fillPolygon(new int[]
+ { (x * charWidth) - 4, (x * charWidth) - 4, (x * charWidth) },
+ new int[]
+ { y + iconOffset, y + 14 + iconOffset, y + 7 + iconOffset },
+ 3);
+ }
+ else
+ {
+ g.fillRect(lastSSX, y + 4 + iconOffset,
+ (x + 1) * charWidth - lastSSX, 7);
+ }
+
+ }
+
+ public void drawHelixAnnot(Graphics g, Annotation[] row,
+ int lastSSX, int x, int y, int iconOffset, int startRes,
+ int column, boolean validRes, boolean validEnd)
+ {
+ g.setColor(HELIX_COLOUR);
+
+ int sCol = (lastSSX / charWidth) + startRes;
+ int x1 = lastSSX;
+ int x2 = (x * charWidth);
+
+ if (MAC)
+ {
+ int ofs = charWidth / 2;
+ // Off by 1 offset when drawing rects and ovals
+ // to offscreen image on the MAC
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1, 8, 8, 8);
+ if (sCol == 0 || row[sCol - 1] == null
+ || row[sCol - 1].secondaryStructure != 'H')
+ {
+ }
+ else
+ {
+ // g.setColor(Color.orange);
+ g.fillRoundRect(lastSSX, y + 4 + iconOffset, x2 - x1 - ofs + 1, 8,
+ 0, 0);
+ }
+ if (!validRes || row[column] == null
+ || row[column].secondaryStructure != 'H')
+ {
+
+ }
+ else
+ {
+ // g.setColor(Color.magenta);
+ g.fillRoundRect(lastSSX + ofs, y + 4 + iconOffset, x2 - x1 - ofs
+ + 1, 8, 0, 0);
+
+ }
+
+ return;
+ }
+
+ if (sCol == 0 || row[sCol - 1] == null
+ || row[sCol - 1].secondaryStructure != 'H')
+ {
+ g.fillArc(lastSSX, y + 4 + iconOffset, charWidth, 8, 90, 180);
+ x1 += charWidth / 2;
+ }
+
+ if (!validRes || row[column] == null
+ || row[column].secondaryStructure != 'H')
+ {
+ g.fillArc((x * charWidth) - charWidth, y + 4 + iconOffset, charWidth,
+ 8, 270, 180);
+ x2 -= charWidth / 2;
+ }
+
+ g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
+ }
+
+ public void drawLineGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
+ int eRes, int y, float min, float max, int graphHeight)
+ {
+ if (sRes > aa_annotations.length)
+ {
+ return;
+ }
+
+ int x = 0;
+
+ // Adjustment for fastpaint to left
+ if (eRes < endRes)
+ {
+ eRes++;
+ }
+
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ if (sRes == 0)
+ {
+ x++;
+ }
+
+ int y1 = y, y2 = y;
+ float range = max - min;
+
+ // //Draw origin
+ if (min < 0)
+ {
+ y2 = y - (int) ((0 - min / range) * graphHeight);
+ }
+
+ g.setColor(Color.gray);
+ g.drawLine(x - charWidth, y2, (eRes - sRes + 1) * charWidth, y2);
+
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ int column;
+ int aaMax = aa_annotations.length - 1;
+
+ while (x < eRes - sRes)
+ {
+ column = sRes + x;
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(column);
+ }
+
+ if (column > aaMax)
+ {
+ break;
+ }
+
+ if (aa_annotations[column] == null
+ || aa_annotations[column - 1] == null)
+ {
+ x++;
+ continue;
+ }
+
+ if (aa_annotations[column].colour == null)
+ g.setColor(Color.black);
+ else
+ g.setColor(aa_annotations[column].colour);
+
+ y1 = y
+ - (int) (((aa_annotations[column - 1].value - min) / range) * graphHeight);
+ y2 = y
+ - (int) (((aa_annotations[column].value - min) / range) * graphHeight);
+
+ g.drawLine(x * charWidth - charWidth / 2, y1, x * charWidth
+ + charWidth / 2, y2);
+ x++;
+ }
+
+ if (_aa.threshold != null)
+ {
+ g.setColor(_aa.threshold.colour);
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
+ BasicStroke.JOIN_ROUND, 3f, new float[]
+ { 5f, 3f }, 0f));
+
+ y2 = (int) (y - ((_aa.threshold.value - min) / range) * graphHeight);
+ g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
+ g2.setStroke(new BasicStroke());
+ }
+ }
+
+ public void drawBarGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes,
+ int eRes, float min, float max, int y)
+ {
+ if (sRes > aa_annotations.length)
+ {
+ return;
+ }
+ Font ofont = g.getFont();
+ eRes = Math.min(eRes, aa_annotations.length);
+
+ int x = 0, y1 = y, y2 = y;
+
+ float range = max - min;
+
+ if (min < 0)
+ {
+ y2 = y - (int) ((0 - min / (range)) * _aa.graphHeight);
+ }
+
+ g.setColor(Color.gray);
+
+ g.drawLine(x, y2, (eRes - sRes) * charWidth, y2);
+
+ int column;
+ int aaMax = aa_annotations.length - 1;
+ boolean renderHistogram = true, renderProfile = true, normaliseProfile = false;
+ // if (aa.autoCalculated && aa.label.startsWith("Consensus"))
+ {
+ // TODO: generalise this to have render styles for consensus/profile data
+ if (_aa.groupRef != null)
+ {
+ renderHistogram = _aa.groupRef.isShowConsensusHistogram();
+ renderProfile = _aa.groupRef.isShowSequenceLogo();
+ normaliseProfile = _aa.groupRef.isNormaliseSequenceLogo();
+ }
+ else
+ {
+ renderHistogram = av_renderHistogram;
+ renderProfile = av_renderProfile;
+ normaliseProfile = av_normaliseProfile;
+ }
+ }
+ while (x < eRes - sRes)
+ {
+ column = sRes + x;
+ if (hasHiddenColumns)
+ {
+ column = columnSelection.adjustForHiddenColumns(column);
+ }
+
+ if (column > aaMax)
+ {
+ break;
+ }
+
+ if (aa_annotations[column] == null)
+ {
+ x++;
+ continue;
+ }
+ if (aa_annotations[column].colour == null)
+ g.setColor(Color.black);
+ else
+ g.setColor(aa_annotations[column].colour);
+
+ y1 = y
+ - (int) (((aa_annotations[column].value - min) / (range)) * _aa.graphHeight);
+
+ if (renderHistogram)
+ {
+ if (y1 - y2 > 0)
+ {
+ g.fillRect(x * charWidth, y2, charWidth, y1 - y2);
+ }
+ else
+ {
+ g.fillRect(x * charWidth, y1, charWidth, y2 - y1);
+ }
+ }
+ // draw profile if available
+ if (renderProfile)
+ {
+
+ int profl[] = getProfileFor(_aa, column);
+ // just try to draw the logo if profl is not null
+ if (profl != null && profl[1] != 0)
+ {
+ float ht = normaliseProfile ? y - _aa.graphHeight : y1;
+ double htn = normaliseProfile ? _aa.graphHeight : (y2 - y1);// aa.graphHeight;
+ double hght;
+ float wdth;
+ double ht2 = 0;
+ char[] dc;
+
+ /**
+ * profl.length == 74 indicates that the profile of a secondary
+ * structure conservation row was accesed. Therefore dc gets length 2,
+ * to have space for a basepair instead of just a single nucleotide
+ */
+ if (profl.length == 74)
+ {
+ dc = new char[2];
+ }
+ else
+ {
+ dc = new char[1];
+ }
+ LineMetrics lm = g.getFontMetrics(ofont).getLineMetrics("Q", g);
+ double scale = 1f / (normaliseProfile ? profl[1] : 100f);
+ float ofontHeight = 1f / lm.getAscent();// magnify to fill box
+ double scl = 0.0;
+ for (int c = 2; c < profl[0];)
+ {
+ dc[0] = (char) profl[c++];
+
+ if (_aa.label.startsWith("StrucConsensus"))
+ {
+ dc[1] = (char) profl[c++];
+ }
+
+ wdth = charWidth;
+ wdth /= fm.charsWidth(dc, 0, dc.length);
+
+ ht += scl;
+ {
+ scl = htn * scale * profl[c++];
+ lm = ofont.getLineMetrics(dc, 0, 1, g.getFontMetrics()
+ .getFontRenderContext());
+ g.setFont(ofont.deriveFont(AffineTransform.getScaleInstance(
+ wdth, scl / lm.getAscent())));
+ lm = g.getFontMetrics().getLineMetrics(dc, 0, 1, g);
+
+ // Debug - render boxes around characters
+ // g.setColor(Color.red);
+ // g.drawRect(x*av.charWidth, (int)ht, av.charWidth,
+ // (int)(scl));
+ // g.setColor(profcolour.findColour(dc[0]).darker());
+ g.setColor(profcolour.findColour(dc[0], column,null));
+
+ hght = (ht + (scl - lm.getDescent() - lm.getBaselineOffsets()[lm
+ .getBaselineIndex()]));
+
+ g.drawChars(dc, 0, dc.length, x * charWidth, (int) hght);
+ }
+ }
+ g.setFont(ofont);
+ }
+ }
+ x++;
+ }
+ if (_aa.threshold != null)
+ {
+ g.setColor(_aa.threshold.colour);
+ Graphics2D g2 = (Graphics2D) g;
+ g2.setStroke(new BasicStroke(1, BasicStroke.CAP_SQUARE,
+ BasicStroke.JOIN_ROUND, 3f, new float[]
+ { 5f, 3f }, 0f));
+
+ y2 = (int) (y - ((_aa.threshold.value - min) / range) * _aa.graphHeight);
+ g.drawLine(0, y2, (eRes - sRes) * charWidth, y2);
+ g2.setStroke(new BasicStroke());
+ }
+ }
+
+ // used by overview window
+ public void drawGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int width,
+ int y, int sRes, int eRes)
+ {
+ eRes = Math.min(eRes, aa_annotations.length);
+ g.setColor(Color.white);
+ g.fillRect(0, 0, width, y);
+ g.setColor(new Color(0, 0, 180));
+
+ int x = 0, height;
+
+ for (int j = sRes; j < eRes; j++)
+ {
+ if (aa_annotations[j] != null)
+ {
+ if (aa_annotations[j].colour == null)
+ g.setColor(Color.black);
+ else
+ g.setColor(aa_annotations[j].colour);
+
+ height = (int) ((aa_annotations[j].value / _aa.graphMax) * y);
+ if (height > y)
+ {
+ height = y;
+ }
+
+ g.fillRect(x, y - height, charWidth, height);
+ }
+ x += charWidth;
+ }
+ }
+}
--- /dev/null
+package jalview.renderer;
+
+import java.awt.FontMetrics;
+import java.awt.Image;
+import java.awt.image.ImageObserver;
+
+public interface AwtRenderPanelI extends ImageObserver
+{
+ /**
+ * old image used when data is currently being calculated and cannot be rendered
+ */
+ Image getFadedImage();
+
+ /**
+ * FontMetrics to use for rendering into Panel
+ * @return
+ */
+ FontMetrics getFontMetrics();
+
+ /**
+ * width of image to render in panel
+ */
+ int getFadedImageWidth();
+
+}
-#Wed Aug 03 09:15:24 BST 2011
+#Thu May 24 20:06:46 BST 2012
jalview.schemabinding.version2.ThresholdLine=jalview.schemabinding.version2.descriptors.ThresholdLineDescriptor
jalview.schemabinding.version2.SequenceSetProperties=jalview.schemabinding.version2.descriptors.SequenceSetPropertiesDescriptor
jalview.schemabinding.version2.StructureState=jalview.schemabinding.version2.descriptors.StructureStateDescriptor
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
private boolean _has_autoCalculated;
/**
+ * is to be shown below the alignment - introduced in Jalview
+ * 2.8 for visualizing T-COFFEE alignment scores
+ */
+ private boolean _belowAlignment = true;
+
+ /**
+ * keeps track of state for field: _belowAlignment
+ */
+ private boolean _has_belowAlignment;
+
+ /**
+ * Optional string identifier used to group sets of annotation
+ * produced by a particular calculation. Values are opaque
+ * strings but have semantic meaning to Jalview's renderer,
+ * data importer and calculation system.
+ */
+ private java.lang.String _calcId;
+
+ /**
* Field _annotationElementList.
*/
private java.util.Vector _annotationElementList;
/**
*/
+ public void deleteBelowAlignment(
+ ) {
+ this._has_belowAlignment= false;
+ }
+
+ /**
+ */
public void deleteCentreColLabels(
) {
this._has_centreColLabels= false;
}
/**
+ * Returns the value of field 'belowAlignment'. The field
+ * 'belowAlignment' has the following description: is to be
+ * shown below the alignment - introduced in Jalview 2.8 for
+ * visualizing T-COFFEE alignment scores
+ *
+ * @return the value of field 'BelowAlignment'.
+ */
+ public boolean getBelowAlignment(
+ ) {
+ return this._belowAlignment;
+ }
+
+ /**
+ * Returns the value of field 'calcId'. The field 'calcId' has
+ * the following description: Optional string identifier used
+ * to group sets of annotation produced by a particular
+ * calculation. Values are opaque strings but have semantic
+ * meaning to Jalview's renderer, data importer and calculation
+ * system.
+ *
+ * @return the value of field 'CalcId'.
+ */
+ public java.lang.String getCalcId(
+ ) {
+ return this._calcId;
+ }
+
+ /**
* Returns the value of field 'centreColLabels'.
*
* @return the value of field 'CentreColLabels'.
}
/**
+ * Method hasBelowAlignment.
+ *
+ * @return true if at least one BelowAlignment has been added
+ */
+ public boolean hasBelowAlignment(
+ ) {
+ return this._has_belowAlignment;
+ }
+
+ /**
* Method hasCentreColLabels.
*
* @return true if at least one CentreColLabels has been added
}
/**
+ * Returns the value of field 'belowAlignment'. The field
+ * 'belowAlignment' has the following description: is to be
+ * shown below the alignment - introduced in Jalview 2.8 for
+ * visualizing T-COFFEE alignment scores
+ *
+ * @return the value of field 'BelowAlignment'.
+ */
+ public boolean isBelowAlignment(
+ ) {
+ return this._belowAlignment;
+ }
+
+ /**
* Returns the value of field 'centreColLabels'.
*
* @return the value of field 'CentreColLabels'.
}
/**
+ * Sets the value of field 'belowAlignment'. The field
+ * 'belowAlignment' has the following description: is to be
+ * shown below the alignment - introduced in Jalview 2.8 for
+ * visualizing T-COFFEE alignment scores
+ *
+ * @param belowAlignment the value of field 'belowAlignment'.
+ */
+ public void setBelowAlignment(
+ final boolean belowAlignment) {
+ this._belowAlignment = belowAlignment;
+ this._has_belowAlignment = true;
+ }
+
+ /**
+ * Sets the value of field 'calcId'. The field 'calcId' has the
+ * following description: Optional string identifier used to
+ * group sets of annotation produced by a particular
+ * calculation. Values are opaque strings but have semantic
+ * meaning to Jalview's renderer, data importer and calculation
+ * system.
+ *
+ * @param calcId the value of field 'calcId'.
+ */
+ public void setCalcId(
+ final java.lang.String calcId) {
+ this._calcId = calcId;
+ }
+
+ /**
* Sets the value of field 'centreColLabels'.
*
* @param centreColLabels the value of field 'centreColLabels'.
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
-/*******************************************************************************
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- *******************************************************************************/
/*
* This class was automatically generated with
* <a href="http://www.castor.org">Castor 1.1</a>, using an XML
fieldValidator.setValidator(typeValidator);
}
desc.setValidator(fieldValidator);
+ //-- _belowAlignment
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_belowAlignment", "belowAlignment", org.exolab.castor.xml.NodeType.Attribute);
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {
+ public java.lang.Object getValue( java.lang.Object object )
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ if (!target.hasBelowAlignment()) { return null; }
+ return (target.getBelowAlignment() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+ }
+ public void setValue( java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try {
+ Annotation target = (Annotation) object;
+ // if null, use delete method for optional primitives
+ if (value == null) {
+ target.deleteBelowAlignment();
+ return;
+ }
+ target.setBelowAlignment( ((java.lang.Boolean) value).booleanValue());
+ } catch (java.lang.Exception ex) {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent) {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ //-- validation code for: _belowAlignment
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { //-- local scope
+ org.exolab.castor.xml.validators.BooleanValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.BooleanValidator();
+ fieldValidator.setValidator(typeValidator);
+ }
+ desc.setValidator(fieldValidator);
+ //-- _calcId
+ desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_calcId", "calcId", org.exolab.castor.xml.NodeType.Attribute);
+ desc.setImmutable(true);
+ handler = new org.exolab.castor.xml.XMLFieldHandler() {
+ public java.lang.Object getValue( java.lang.Object object )
+ throws IllegalStateException
+ {
+ Annotation target = (Annotation) object;
+ return target.getCalcId();
+ }
+ public void setValue( java.lang.Object object, java.lang.Object value)
+ throws IllegalStateException, IllegalArgumentException
+ {
+ try {
+ Annotation target = (Annotation) object;
+ target.setCalcId( (java.lang.String) value);
+ } catch (java.lang.Exception ex) {
+ throw new IllegalStateException(ex.toString());
+ }
+ }
+ public java.lang.Object newInstance(java.lang.Object parent) {
+ return null;
+ }
+ };
+ desc.setHandler(handler);
+ desc.setMultivalued(false);
+ addFieldDescriptor(desc);
+
+ //-- validation code for: _calcId
+ fieldValidator = new org.exolab.castor.xml.FieldValidator();
+ { //-- local scope
+ org.exolab.castor.xml.validators.StringValidator typeValidator;
+ typeValidator = new org.exolab.castor.xml.validators.StringValidator();
+ fieldValidator.setValidator(typeValidator);
+ typeValidator.setWhiteSpace("preserve");
+ }
+ desc.setValidator(fieldValidator);
//-- initialize element descriptors
//-- _annotationElementList
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.GraphLine;
+import jalview.datamodel.SequenceI;
-import jalview.datamodel.*;
+import java.awt.Color;
public class AnnotationColourGradient extends ResidueColourScheme
{
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour = Color.white;
if (colourScheme != null)
{
- currentColour = colourScheme.findColour(c, j);
+ currentColour = colourScheme.findColour(c, j, seq);
}
else if (range != 0)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
-
-import jalview.analysis.*;
+import jalview.analysis.AAFrequency;
+import java.awt.Color;
+import jalview.datamodel.SequenceI;
public class Blosum62ColourScheme extends ResidueColourScheme
{
public Blosum62ColourScheme()
super();
}
- public Color findColour(char res, int j)
+ @Override
+ public Color findColour(char res, int j, SequenceI seq)
{
if ('a' <= res && res <= 'z')
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.util.*;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import java.awt.*;
-
-import jalview.datamodel.*;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
public class ClustalxColourScheme extends ResidueColourScheme // implements
// IParameterizable
colhash.put("YELLOW", new Color((float) 0.8, (float) 0.8, (float) 0.0));
}
- public ClustalxColourScheme(Vector seqs, int maxWidth)
+ public ClustalxColourScheme(AnnotatedCollectionI alignment, Map<SequenceI, SequenceCollectionI> hiddenReps)
{
- resetClustalX(seqs, maxWidth);
+ alignmentChanged(alignment,hiddenReps);
}
-
- public void resetClustalX(Vector seqs, int maxWidth)
- {
+ public void alignmentChanged(AnnotatedCollectionI alignment, Map<SequenceI, SequenceCollectionI> hiddenReps) {
+ int maxWidth=alignment.getWidth();
+ List<SequenceI> seqs=alignment.getSequences(hiddenReps);
cons2 = new int[maxWidth][24];
includeGaps = isIncludeGaps(); // does nothing - TODO replace with call to
// get the current setting of the
int j = 0;
char[] seq;
- while (j < seqs.size())
+ for (SequenceI sq: seqs)
{
- seq = ((SequenceI) seqs.elementAt(j)).getSequence();
+ seq = sq.getSequence();
int end_j = seq.length - 1;
ResidueColour[19] = colours[0]; // V
}
+ @Override
public Color findColour(char c)
{
return Color.pink;
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
+import java.awt.Color;
+import java.util.Map;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
public interface ColourSchemeI
{
public Color findColour(char c);
- public Color findColour(char c, int j);
+ public Color findColour(char c, int j, SequenceI seq);
public void setConsensus(java.util.Hashtable[] h);
public void setThreshold(int ct, boolean ignoreGaps);
+ public void alignmentChanged(AnnotatedCollectionI alignment, Map<SequenceI, SequenceCollectionI> hiddenReps);
+
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
- *
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.AnnotatedCollectionI;
+
+import java.awt.Color;
/**
- * ColourSchemeProperty Binds names to hardwired colourschemes and tries to deal
+ * ColourSchemeProperty binds names to hardwired colourschemes and tries to deal
* intelligently with mapping unknown names to user defined colourschemes (that
* exist or can be created from the string representation of the colourscheme
* name - either a hex RGB triplet or a named colour under java.awt.color ). The
* values of the colourscheme constants is important for callers of
* getColourName(int i), since it can be used to enumerate the set of built in
* colours. The FIRST_COLOUR and LAST_COLOUR symbols are provided for this.
- *
+ *
* @author $author$
* @version $Revision$
*/
public static final int COVARIATION = 14;
+ public static final int TCOFFEE = 15;
+
+
/**
* index of first colourscheme (includes 'None')
*/
/**
* DOCUMENT ME!
- *
+ *
* @param name
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
public static int getColourIndexFromName(String name)
{
ret = NUCLEOTIDE;
}
+ else if (name.equalsIgnoreCase("T-Coffee Scores"))
+ {
+ ret = TCOFFEE;
+ }
+
else if (name.equalsIgnoreCase("User Defined"))
{
ret = USER_DEFINED;
{
ret = NONE;
}
+ else if (name.equalsIgnoreCase("Purine/Pyrimidine"))
+ {
+ ret = PURINEPYRIMIDINE;
+ }
+ // else if (name.equalsIgnoreCase("Covariation"))
+ // {
+ // ret = COVARIATION;
+ // }
return ret;
}
/**
* DOCUMENT ME!
- *
+ *
* @param cs
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
public static String getColourName(ColourSchemeI cs)
{
index = NUCLEOTIDE;
}
+ else if (cs instanceof PurinePyrimidineColourScheme)
+ {
+ index = PURINEPYRIMIDINE;
+ }
+ else if (cs instanceof TCoffeeColourScheme)
+ {
+ index = TCOFFEE;
+ }
+ /*
+ * else if (cs instanceof CovariationColourScheme) { index = COVARIATION; }
+ */
else if (cs instanceof UserColourScheme)
{
if ((((UserColourScheme) cs).getName() != null)
/**
* DOCUMENT ME!
- *
+ *
* @param index
* DOCUMENT ME!
- *
+ *
* @return DOCUMENT ME!
*/
public static String getColourName(int index)
break;
+ case PURINEPYRIMIDINE:
+ ret = "Purine/Pyrimidine";
+
+ break;
+
+ case TCOFFEE:
+ ret = "T-Coffee Scores";
+
+ break;
+ /*
+ * case COVARIATION: ret = "Covariation";
+ *
+ * break;
+ */
case USER_DEFINED:
ret = "User Defined";
return ret;
}
-
- /**
- * DOCUMENT ME!
- *
- * @param al
- * DOCUMENT ME!
- * @param name
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,
- String name)
- {
- return getColour(al.getSequences(), al.getWidth(), name);
- }
-
/**
* retrieve or create colourscheme associated with name
- *
+ *
* @param seqs
* sequences to colour
* @param width
* string to parse as colour for new coloursheme
* @return Valid Colourscheme
*/
- public static ColourSchemeI getColour(java.util.Vector seqs, int width,
+ public static ColourSchemeI getColour(AnnotatedCollectionI alignment,
String name)
{
int colindex = getColourIndexFromName(name);
}
}
}
- return getColour(seqs, width, getColourIndexFromName(name));
+ return getColour(alignment, getColourIndexFromName(name));
}
/**
- * DOCUMENT ME!
- *
+ * Construct an instance of ColourSchemeI corresponding to the given colourscheme index
+ *
* @param seqs
- * DOCUMENT ME!
+ * sequences to be coloured by colourscheme
* @param width
- * DOCUMENT ME!
+ * geometry of alignment
* @param index
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * colourscheme number
+ *
+ * @return null or an instance of the colourscheme configured to colour given sequence set
*/
- public static ColourSchemeI getColour(java.util.Vector seqs, int width,
- int index)
+ public static ColourSchemeI getColour(jalview.datamodel.AnnotatedCollectionI coll, int index)
{
+ // TODO 3.0 2.8 refactor signature to take an alignmentI like container so colourschemes based on annotation can be initialised
ColourSchemeI cs = null;
switch (index)
{
case CLUSTAL:
- cs = new ClustalxColourScheme(seqs, width);
+ cs = new ClustalxColourScheme(coll, null);
break;
break;
+ case PURINEPYRIMIDINE:
+ cs = new PurinePyrimidineColourScheme();
+
+ break;
+
+ case TCOFFEE:
+ cs = new TCoffeeColourScheme(coll);
+ // case COVARIATION:
+ // cs = new CovariationColourScheme(annotation);
+
+ // break;
+
case USER_DEFINED:
Color[] col = new Color[24];
for (int i = 0; i < 24; i++)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * Became RNAHelicesColour.java. Placeholder for true covariation color scheme
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class CovariationColourScheme extends ResidueColourScheme
+{
+ public Hashtable helixcolorhash = new Hashtable();
+
+ public Hashtable positionsToHelix = new Hashtable();
+
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new CovariationColourScheme object.
+ */
+ public CovariationColourScheme(AlignmentAnnotation annotation)
+ {
+ this.annotation = annotation;
+
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+ // System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ // this.annotation._rnasecstr[x].getBegin());
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ // pairs.put(this.annotation._rnasecstr[x].getBegin(),
+ // this.annotation._rnasecstr[x].getEnd());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x].getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+
+ for (int j = 0; j <= numHelix; j++)
+ {
+ helixcolorhash.put(Integer.toString(j), jalview.util.ColorUtils
+ .generateRandomColor(Color.white));
+ }
+
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c)
+ {
+ // System.out.println("called"); log.debug
+ // Generate a random pastel color
+
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];// jalview.util.ColorUtils.generateRandomColor(Color.white);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param n
+ * DOCUMENT ME!
+ * @param j
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ // System.out.println(c + " " + j);
+ currentHelix = (String) positionsToHelix.get(j);
+ // System.out.println(positionsToHelix.get(j));
+
+ if (currentHelix != null)
+ {
+ currentColour = (Color) helixcolorhash.get(currentHelix);
+ }
+
+ // System.out.println(c + " " + j + " helix " + currentHelix + " " +
+ // currentColour);
+ return currentColour;
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
+ @Override
public Color findColour(char c)
{
// System.out.println("called"); log.debug
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
if ((threshold == 0) || aboveThreshold(c, j))
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.analysis.AAFrequency;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import java.awt.Color;
public class PIDColourScheme extends ResidueColourScheme
{
this.thresholds = ResidueProperties.pidThresholds;
}
- public Color findColour(char c, int j)
+
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
if ('a' <= c && c <= 'z')
{
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+
+/**
+ * Class is based off of NucleotideColourScheme
+ *
+ * @author Lauren Michelle Lui
+ */
+public class PurinePyrimidineColourScheme extends ResidueColourScheme
+{
+ /**
+ * Creates a new PurinePyrimidineColourScheme object.
+ */
+ public PurinePyrimidineColourScheme()
+ {
+ super(ResidueProperties.purinepyrimidine, 0);
+ }
+
+ /**
+ * Finds the corresponding color for the type of character inputed
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return Color from purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties
+ */
+ public Color findColour(char c)
+ {
+ return colors[ResidueProperties.purinepyrimidineIndex[c]];
+ }
+
+ /**
+ * Returns color based on conservation
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * Threshold
+ *
+ * @return Color in RGB
+ */
+ public Color findColour(char c, int j)
+ {
+ Color currentColour;
+ if ((threshold == 0) || aboveThreshold(c, j))
+ {
+ try
+ {
+ currentColour = colors[ResidueProperties.purinepyrimidineIndex[c]];
+ } catch (Exception ex)
+ {
+ return Color.white;
+ }
+ }
+ else
+ {
+ return Color.white;
+ }
+
+ if (conservationColouring)
+ {
+ currentColour = applyConservation(currentColour, j);
+ }
+
+ return currentColour;
+ }
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.awt.*;
+import java.util.Hashtable;
+
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * Looks at the information computed from an RNA Stockholm format file on the
+ * secondary structure of the alignment. Extracts the information on the
+ * positions of the helices present and assigns colors.
+ *
+ * @author Lauren Michelle Lui
+ * @version 2.5
+ */
+public class RNAHelicesColour extends ResidueColourScheme
+{
+
+ /**
+ * Stores random colors generated for the number of helices
+ */
+ public Hashtable helixcolorhash = new Hashtable();
+
+ /**
+ * Maps sequence positions to the RNA helix they belong to. Key: position,
+ * Value: helix
+ */
+ public Hashtable positionsToHelix = new Hashtable();
+
+ /**
+ * Number of helices in the RNA secondary structure
+ */
+ int numHelix = 0;
+
+ public AlignmentAnnotation annotation;
+
+ /**
+ * Creates a new RNAHelicesColour object.
+ */
+ public RNAHelicesColour(AlignmentAnnotation annotation)
+ {
+ this.annotation = annotation;
+ refresh();
+ }
+
+ private long lastrefresh = -1;
+
+ public void refresh()
+ {
+ if (lastrefresh != annotation._rnasecstr.hashCode() && annotation.isValidStruc())
+ {
+ annotation.getRNAStruc();
+ lastrefresh = annotation._rnasecstr.hashCode();
+ numHelix = 0;
+ positionsToHelix = new Hashtable();
+
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < this.annotation._rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+
+ positionsToHelix.put(this.annotation._rnasecstr[x].getBegin(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+ positionsToHelix.put(this.annotation._rnasecstr[x].getEnd(),
+ this.annotation._rnasecstr[x].getFeatureGroup());
+
+ if (Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup()) > numHelix)
+ {
+ numHelix = Integer.parseInt(this.annotation._rnasecstr[x]
+ .getFeatureGroup());
+ }
+
+ }
+
+ // Generate random colors and store
+ for (int j = 0; j <= numHelix; j++)
+ {
+ if (!helixcolorhash.containsKey(Integer.toString(j)))
+ {
+ helixcolorhash.put(Integer.toString(j),
+ jalview.util.ColorUtils.generateRandomColor(Color.white));
+ }
+ }
+ }
+ }
+
+ /**
+ * Returns default color base on purinepyrimidineIndex in
+ * jalview.schemes.ResidueProperties (Allows coloring in sequence logo)
+ *
+ * @param c
+ * Character in sequence
+ *
+ * @return color in RGB
+ */
+ public Color findColour(char c)
+ {
+ return ResidueProperties.purinepyrimidine[ResidueProperties.purinepyrimidineIndex[c]];
+ // random colors for all positions
+ // jalview.util.ColorUtils.generateRandomColor(Color.white); If you want
+ }
+
+ /**
+ * Returns color based on helices
+ *
+ * @param c
+ * Character in sequence
+ * @param j
+ * Threshold
+ *
+ * @return Color in RGB
+ */
+ public Color findColour(char c, int j)
+ {
+ refresh();
+ Color currentColour = Color.white;
+ String currentHelix = null;
+ currentHelix = (String) positionsToHelix.get(j);
+
+ if (currentHelix != null)
+ {
+ currentColour = (Color) helixcolorhash.get(currentHelix);
+ }
+
+ // System.out.println(c + " " + j + " helix " + currentHelix + " " +
+ // currentColour);
+ return currentColour;
+ }
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.schemes;
+
+import java.util.*;
+import java.awt.event.*;
+
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.*;
+import jalview.schemes.*;
+
+/**
+ * Helps generate the colors for RNA secondary structure. Future: add option to
+ * change colors based on covariation.
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RNAHelicesColourChooser
+{
+
+ AlignViewportI av;
+
+ AlignmentViewPanel ap;
+
+ ColourSchemeI oldcs;
+
+ Hashtable oldgroupColours;
+
+ jalview.datamodel.AlignmentAnnotation currentAnnotation;
+
+ boolean adjusting = false;
+
+ public RNAHelicesColourChooser(AlignViewportI av, final AlignmentViewPanel ap)
+ {
+ oldcs = av.getGlobalColourScheme();
+ if (av.getAlignment().getGroups() != null)
+ {
+ oldgroupColours = new Hashtable();
+ for (SequenceGroup sg:ap.getAlignment().getGroups())
+ {
+ if (sg.cs != null)
+ {
+ oldgroupColours.put(sg, sg.cs);
+ }
+ }
+ }
+ this.av = av;
+ this.ap = ap;
+
+ if (oldcs instanceof RNAHelicesColour)
+ {
+ RNAHelicesColour rhc = (RNAHelicesColour) oldcs;
+
+ }
+
+ adjusting = true;
+ Vector list = new Vector();
+ int index = 1;
+ for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++)
+ {
+ String label = av.getAlignment().getAlignmentAnnotation()[i].label;
+ if (!list.contains(label))
+ list.addElement(label);
+ else
+ list.addElement(label + "_" + (index++));
+ }
+
+ adjusting = false;
+
+ changeColour();
+
+ }
+
+ void changeColour()
+ {
+ // Check if combobox is still adjusting
+ if (adjusting)
+ {
+ return;
+ }
+
+ currentAnnotation = av.getAlignment().getAlignmentAnnotation()[0];// annotations.getSelectedIndex()];
+
+ RNAHelicesColour rhc = null;
+
+ rhc = new RNAHelicesColour(currentAnnotation);
+
+ av.setGlobalColourScheme(rhc);
+
+ if (av.getAlignment().getGroups() != null)
+ {
+ for (SequenceGroup sg:ap.getAlignment().getGroups())
+ {
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ sg.cs = new RNAHelicesColour(currentAnnotation);
+
+ }
+ }
+
+ ap.paintAlignment(false);
+ }
+
+ void reset()
+ {
+ av.setGlobalColourScheme(oldcs);
+ if (av.getAlignment().getGroups() != null)
+ {
+ for (SequenceGroup sg:ap.getAlignment().getGroups())
+ {
+ sg.cs = (ColourSchemeI) oldgroupColours.get(sg);
+ }
+ }
+ }
+
+ public void annotations_actionPerformed(ActionEvent e)
+ {
+ changeColour();
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.util.*;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
-import java.awt.*;
-
-import jalview.analysis.*;
+import java.awt.Color;
+import java.util.Hashtable;
+import java.util.Map;
/**
* DOCUMENT ME!
: colors[ResidueProperties.aaIndex[c]];
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
return currentColour;
}
-
/**
* Get the percentage threshold for this colour scheme
*
return currentColour;
}
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment,
+ Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ }
+
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
public static final int[] nucleotideIndex;
+ public static final int[] purinepyrimidineIndex;
+
public static final Hashtable aa3Hash = new Hashtable();
public static final Hashtable aa2Triplet = new Hashtable();
nucleotideName.put("y", "Unknown Pyrimidine");
nucleotideName.put("N", "Unknown");
nucleotideName.put("n", "Unknown");
+ nucleotideName.put("W", "Weak nucleotide (A or T)");
+ nucleotideName.put("w", "Weak nucleotide (A or T)");
+ nucleotideName.put("S", "Strong nucleotide (G or C)");
+ nucleotideName.put("s", "Strong nucleotide (G or C)");
+ nucleotideName.put("M", "Amino (A or C)");
+ nucleotideName.put("m", "Amino (A or C)");
+ nucleotideName.put("K", "Keto (G or T)");
+ nucleotideName.put("k", "Keto (G or T)");
+ nucleotideName.put("B", "Not A (G or C or T)");
+ nucleotideName.put("b", "Not A (G or C or T)");
+ nucleotideName.put("H", "Not G (A or C or T)");
+ nucleotideName.put("h", "Not G (A or C or T)");
+ nucleotideName.put("D", "Not C (A or G or T)");
+ nucleotideName.put("d", "Not C (A or G or T)");
+ nucleotideName.put("V", "Not T (A or G or C");
+ nucleotideName.put("v", "Not T (A or G or C");
+
+ }
+
+ static
+ {
+ purinepyrimidineIndex = new int[255];
+ for (int i = 0; i < 255; i++)
+ {
+ purinepyrimidineIndex[i] = 3; // non-nucleotide symbols are all non-gap
+ // gaps.
+ }
+
+ purinepyrimidineIndex['A'] = 0;
+ purinepyrimidineIndex['a'] = 0;
+ purinepyrimidineIndex['C'] = 1;
+ purinepyrimidineIndex['c'] = 1;
+ purinepyrimidineIndex['G'] = 0;
+ purinepyrimidineIndex['g'] = 0;
+ purinepyrimidineIndex['T'] = 1;
+ purinepyrimidineIndex['t'] = 1;
+ purinepyrimidineIndex['U'] = 1;
+ purinepyrimidineIndex['u'] = 1;
+ purinepyrimidineIndex['I'] = 2;
+ purinepyrimidineIndex['i'] = 2;
+ purinepyrimidineIndex['X'] = 2;
+ purinepyrimidineIndex['x'] = 2;
+ purinepyrimidineIndex['R'] = 0;
+ purinepyrimidineIndex['r'] = 0;
+ purinepyrimidineIndex['Y'] = 1;
+ purinepyrimidineIndex['y'] = 1;
+ purinepyrimidineIndex['N'] = 2;
+ purinepyrimidineIndex['n'] = 2;
}
static
new Color(235, 65, 60), // G
new Color(60, 136, 238), // T
new Color(60, 136, 238), // U
- Color.white, // I
- Color.white, // X
+ Color.white, // I (inosine)
+ Color.white, // X (xanthine)
Color.white, // R
Color.white, // Y
Color.white, // N
Color.white, // Gap
};
+ // Added for PurinePyrimidineColourScheme
+ public static final Color[] purinepyrimidine =
+ { new Color(255, 131, 250), // A, G, R purines purplish/orchid
+ new Color(64, 224, 208), // C,U, T, Y pyrimidines turquoise
+ Color.white, // all other nucleotides
+ Color.white // Gap
+ };
+
// Zappo
public static final Color[] zappo =
{ Color.pink, // A
return ss.toString();
}
+ /**
+ * Used by getRNASecStrucState
+ *
+ */
+ public static Hashtable toRNAssState;
+ static
+ {
+ toRNAssState = new Hashtable();
+ toRNAssState.put(")", "S");
+ toRNAssState.put("(", "S");
+ }
+
+ /**
+ * translate to RNA secondary structure representation
+ *
+ * @param ssstring
+ * @return ssstring as a RNA-state secondary structure assignment.
+ */
+ public static String getRNASecStrucState(String ssstring)
+ {
+ if (ssstring == null)
+ {
+ return null;
+ }
+ StringBuffer ss = new StringBuffer();
+ for (int i = 0; i < ssstring.length(); i++)
+ {
+ String ssc = ssstring.substring(i, i + 1);
+ if (toRNAssState.containsKey(ssc))
+ {
+ ss.append((String) toRNAssState.get(ssc));
+ }
+ else
+ {
+ ss.append(" ");
+ }
+ }
+ return ss.toString();
+ }
+
// main method generates perl representation of residue property hash
// / cut here
public static void main(String[] args)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.awt.*;
+import jalview.datamodel.SequenceI;
+
+import java.awt.Color;
/**
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
if (threshold > 0)
{
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.schemes;
+
+import jalview.analysis.SequenceIdMatcher;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AnnotatedCollectionI;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceI;
+import jalview.io.TCoffeeScoreFile;
+
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * Defines the color score for T-Coffee MSA
+ * <p>
+ * See http://tcoffee.org
+ *
+ *
+ * @author Paolo Di Tommaso
+ *
+ */
+public class TCoffeeColourScheme extends ResidueColourScheme {
+
+ static final Color[] colors = {
+ new Color( 102, 102, 255 ), // #6666FF
+ new Color( 0, 255, 0), // #00FF00
+ new Color( 102, 255, 0), // #66FF00
+ new Color( 204, 255, 0), // #CCFF00
+ new Color( 255, 255, 0), // #FFFF00
+ new Color( 255, 204, 0), // #FFCC00
+ new Color( 255, 153, 0), // #FF9900
+ new Color( 255, 102, 0), // #FF6600
+ new Color( 255, 51, 0), // #FF3300
+ new Color( 255, 34, 0) // #FF2000
+ };
+
+
+ IdentityHashMap<SequenceI, Color[]> seqMap;
+ /**
+ * the color scheme needs to look at the alignment to get and cache T-COFFEE scores
+ *
+ * @param alignment - annotated sequences to be searched
+ */
+ public TCoffeeColourScheme(AnnotatedCollectionI alignment) {
+ alignmentChanged(alignment, null);
+ }
+ @Override
+ public void alignmentChanged(AnnotatedCollectionI alignment, Map<SequenceI, SequenceCollectionI> hiddenReps)
+ {
+ // TODO: if sequences have been represented and they have scores, could compute an average sequence score for the representative
+
+ // assume only one set of TCOFFEE scores - but could have more than one potentially.
+ ArrayList<AlignmentAnnotation> annots = new ArrayList<AlignmentAnnotation>();
+ // Search alignment to get all tcoffee annotation and pick one set of annotation to use to colour seqs.
+ seqMap = new IdentityHashMap<SequenceI, Color[]>();
+ int w=0;
+ for (AlignmentAnnotation al:alignment.findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE))
+ {
+ if (al.sequenceRef!=null && !al.belowAlignment)
+ {
+ annots.add(al);
+ if (w<al.annotations.length)
+ {
+ w=al.annotations.length;
+ }
+ Color[] scores=new Color[al.annotations.length];
+ int i=0;
+ for (Annotation an:al.annotations)
+ {
+ scores[i++]=(an!=null) ? an.colour : Color.white;
+ }
+ seqMap.put(al.sequenceRef, scores);
+ }
+ }
+ // TODO: compute average colour for each symbol type in each column - gives
+ // a second order colourscheme for colouring a sequence logo derived from
+ // the alignment (colour reflects quality of alignment for each residue
+ // class)
+ }
+ @Override
+ public Color findColour(char c, int j, SequenceI seq) {
+ Color[] cols;
+
+ if( seqMap==null || (cols=seqMap.get(seq))==null) {
+// see above TODO about computing a colour for each residue in each column: cc = _rcols[i][indexFor[c]];
+ return Color.white;
+ }
+
+ if( j < 0 || j>= cols.length ) {
+ return Color.white;
+ }
+ return cols[j];
+ }
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.schemes;
-import java.util.*;
-
-import java.awt.*;
+import java.awt.Color;
+import java.util.StringTokenizer;
+import jalview.datamodel.SequenceI;
public class UserColourScheme extends ResidueColourScheme
{
}
- public Color findColour(char c, int j)
+ @Override
+ public Color findColour(char c, int j, SequenceI seq)
{
Color currentColour;
int index = ResidueProperties.aaIndex[c];
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.structure;
+
+import jalview.datamodel.*;
+
+public interface SecondaryStructureListener
+{
+ // TODO - redefine to allow RNA mouseovers to be passed back correctly to listeners
+ public void mouseOverSequence(SequenceI sequence, int index);
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
int atomNo = 0;
for (int i = 0; i < listeners.size(); i++)
{
- if (listeners.elementAt(i) instanceof StructureListener)
+ Object listener=listeners.elementAt(i);
+ if (listener==source)
{
- sl = (StructureListener) listeners.elementAt(i);
+ continue;
+ }
+ if (listener instanceof StructureListener)
+ {
+ sl = (StructureListener) listener;
if (mappings == null)
{
continue;
else
{
if (relaySeqMappings && hasSequenceListeners
- && listeners.elementAt(i) instanceof SequenceListener)
+ && listener instanceof SequenceListener)
{
// DEBUG
// System.err.println("relay Seq " + seq.getDisplayId(false) + " " +
}
if (hasSequenceListeners)
{
- ((SequenceListener) listeners.elementAt(i))
+ ((SequenceListener) listener)
.highlightSequence(results);
}
}
- else if (listeners.elementAt(i) instanceof VamsasListener
+ else if (listener instanceof VamsasListener
&& !handlingVamsasMo)
{
// DEBUG
// index);
// pass the mouse over and absolute position onto the
// VamsasListener(s)
- ((VamsasListener) listeners.elementAt(i)).mouseOver(seq,
+ ((VamsasListener) listener).mouseOver(seq,
indexpos, source);
}
+ else if(listener instanceof SecondaryStructureListener){
+ ((SecondaryStructureListener) listener).mouseOverSequence(seq,indexpos);
+ }
}
}
}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * author: Lauren Michelle Lui
+ */
+
+package jalview.util;
+
+import java.awt.Color;
+import java.util.Random;
+
+public class ColorUtils
+{
+
+ /**
+ * Generates a random color, will mix with input color. Code taken from
+ * http://stackoverflow
+ * .com/questions/43044/algorithm-to-randomly-generate-an-aesthetically
+ * -pleasing-color-palette
+ *
+ * @param mix
+ * @return Random color in RGB
+ */
+ public static final Color generateRandomColor(Color mix)
+ {
+ Random random = new Random();
+ int red = random.nextInt(256);
+ int green = random.nextInt(256);
+ int blue = random.nextInt(256);
+
+ // mix the color
+ if (mix != null)
+ {
+ red = (red + mix.getRed()) / 2;
+ green = (green + mix.getGreen()) / 2;
+ blue = (blue + mix.getBlue()) / 2;
+ }
+
+ Color color = new Color(red, green, blue);
+ return color;
+
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
// TODO: determine nominal limits for most platforms.\r
return 2046; // this is the max length for a windows NT system.\r
}\r
+\r
+ /**\r
+ * escape a string according to the local platform's escape character\r
+ * @param file\r
+ * @return escaped file\r
+ */\r
+ public static String escapeString(String file)\r
+ {\r
+ StringBuffer f=new StringBuffer();\r
+ int p=0,lastp=0;\r
+ while ((p=file.indexOf('\\',lastp))>-1)\r
+ {\r
+ f.append(file.subSequence(lastp,p));\r
+ f.append("\\\\");\r
+ lastp=p+1;\r
+ }\r
+ f.append(file.substring(lastp));\r
+ return f.toString();\r
+ }\r
}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.viewmodel;
+
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceCollectionI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.workers.AlignCalcManager;
+import jalview.workers.ConsensusThread;
+import jalview.workers.StrucConsensusThread;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * base class holding visualization and analysis attributes and common logic for
+ * an active alignment view displayed in the GUI
+ *
+ * @author jimp
+ *
+ */
+public abstract class AlignmentViewport implements AlignViewportI
+{
+ /**
+ * alignment displayed in the viewport. Please use get/setter
+ */
+ protected AlignmentI alignment;
+
+ protected String sequenceSetID;
+
+ /**
+ * probably unused indicator that view is of a dataset rather than an
+ * alignment
+ */
+ protected boolean isDataset = false;
+
+ private Map<SequenceI, SequenceCollectionI> hiddenRepSequences;
+
+ protected ColumnSelection colSel = new ColumnSelection();
+
+ public boolean autoCalculateConsensus = true;
+
+ protected boolean autoCalculateStrucConsensus = true;
+
+ protected boolean ignoreGapsInConsensusCalculation = false;
+
+ protected ColourSchemeI globalColourScheme = null;
+
+ /**
+ * gui state - changes to colour scheme propagated to all groups
+ */
+ private boolean colourAppliesToAllGroups;
+
+ /**
+ * @param value
+ * indicating if subsequent colourscheme changes will be propagated
+ * to all groups
+ */
+ public void setColourAppliesToAllGroups(boolean b)
+ {
+ colourAppliesToAllGroups = b;
+ }
+
+ /**
+ *
+ *
+ * @return flag indicating if colourchanges propagated to all groups
+ */
+ public boolean getColourAppliesToAllGroups()
+ {
+ return colourAppliesToAllGroups;
+ }
+
+ boolean abovePIDThreshold = false;
+
+ /**
+ * GUI state
+ *
+ * @return true if percent identity threshold is applied to shading
+ */
+ public boolean getAbovePIDThreshold()
+ {
+ return abovePIDThreshold;
+ }
+
+ /**
+ * GUI state
+ *
+ *
+ * @param b
+ * indicate if percent identity threshold is applied to shading
+ */
+ public void setAbovePIDThreshold(boolean b)
+ {
+ abovePIDThreshold = b;
+ }
+
+ int threshold;
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param thresh
+ * DOCUMENT ME!
+ */
+ public void setThreshold(int thresh)
+ {
+ threshold = thresh;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public int getThreshold()
+ {
+ return threshold;
+ }
+
+ int increment;
+
+ /**
+ *
+ * @param inc
+ * set the scalar for bleaching colourschemes according to degree of
+ * conservation
+ */
+ public void setIncrement(int inc)
+ {
+ increment = inc;
+ }
+
+ /**
+ * GUI State
+ *
+ * @return get scalar for bleaching colourschemes by conservation
+ */
+ public int getIncrement()
+ {
+ return increment;
+ }
+
+ boolean conservationColourSelected = false;
+
+ /**
+ * GUI state
+ *
+ * @return true if conservation based shading is enabled
+ */
+ public boolean getConservationSelected()
+ {
+ return conservationColourSelected;
+ }
+
+ /**
+ * GUI state
+ *
+ * @param b
+ * enable conservation based shading
+ */
+ public void setConservationSelected(boolean b)
+ {
+ conservationColourSelected = b;
+ }
+
+ @Override
+ public void setGlobalColourScheme(ColourSchemeI cs)
+ {
+ // TODO: logic refactored from AlignFrame changeColour -
+ // autorecalc stuff should be changed to rely on the worker system
+ // check to see if we should implement a changeColour(cs) method rather than
+ // put th logic in here
+ // - means that caller decides if they want to just modify state and defer
+ // calculation till later or to do all calculations in thread.
+ // via changecolour
+ globalColourScheme = cs;
+ if (getColourAppliesToAllGroups())
+ {
+ for (SequenceGroup sg : getAlignment().getGroups())
+ {
+ if (cs == null)
+ {
+ sg.cs = null;
+ continue;
+ }
+ if (cs instanceof ClustalxColourScheme)
+ {
+ sg.cs = new ClustalxColourScheme(sg, getHiddenRepSequences());
+ }
+ else
+ {
+ try
+ {
+ sg.cs = cs.getClass().newInstance();
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ sg.cs = cs;
+ }
+ }
+
+ if (getAbovePIDThreshold() || cs instanceof PIDColourScheme
+ || cs instanceof Blosum62ColourScheme)
+ {
+ sg.cs.setThreshold(threshold, getIgnoreGapsConsensus());
+ sg.cs.setConsensus(AAFrequency.calculate(
+ sg.getSequences(getHiddenRepSequences()), 0,
+ sg.getWidth()));
+ }
+ else
+ {
+ sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+ }
+
+ if (getConservationSelected())
+ {
+ Conservation c = new Conservation("Group",
+ ResidueProperties.propHash, 3,
+ sg.getSequences(getHiddenRepSequences()), 0,
+ getAlignment().getWidth() - 1);
+ c.calculate();
+ c.verdict(false, getConsPercGaps());
+ sg.cs.setConservation(c);
+ }
+ else
+ {
+ sg.cs.setConservation(null);
+ sg.cs.setThreshold(0, getIgnoreGapsConsensus());
+ }
+
+ }
+ }
+
+ }
+
+ @Override
+ public ColourSchemeI getGlobalColourScheme()
+ {
+ return globalColourScheme;
+ }
+
+ protected AlignmentAnnotation consensus;
+
+ protected AlignmentAnnotation strucConsensus;
+
+ protected AlignmentAnnotation conservation;
+
+ protected AlignmentAnnotation quality;
+
+ protected AlignmentAnnotation[] groupConsensus;
+
+ protected AlignmentAnnotation[] groupConservation;
+
+ /**
+ * results of alignment consensus analysis for visible portion of view
+ */
+ protected Hashtable[] hconsensus = null;
+
+ /**
+ * results of secondary structure base pair consensus for visible portion of
+ * view
+ */
+ protected Hashtable[] hStrucConsensus = null;
+
+ /**
+ * percentage gaps allowed in a column before all amino acid properties should
+ * be considered unconserved
+ */
+ int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
+
+ @Override
+ public int getConsPercGaps()
+ {
+ return ConsPercGaps;
+ }
+
+ @Override
+ public void setSequenceConsensusHash(Hashtable[] hconsensus)
+ {
+ this.hconsensus = hconsensus;
+
+ }
+
+ @Override
+ public Hashtable[] getSequenceConsensusHash()
+ {
+ return hconsensus;
+ }
+
+ @Override
+ public Hashtable[] getRnaStructureConsensusHash()
+ {
+ return hStrucConsensus;
+ }
+
+ @Override
+ public void setRnaStructureConsensusHash(Hashtable[] hStrucConsensus)
+ {
+ this.hStrucConsensus = hStrucConsensus;
+
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentQualityAnnot()
+ {
+ return quality;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentConservationAnnotation()
+ {
+ return conservation;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentConsensusAnnotation()
+ {
+ return consensus;
+ }
+
+ @Override
+ public AlignmentAnnotation getAlignmentStrucConsensusAnnotation()
+ {
+ return strucConsensus;
+ }
+
+ protected AlignCalcManagerI calculator = new AlignCalcManager();
+
+ /**
+ * trigger update of conservation annotation
+ */
+ public void updateConservation(final AlignmentViewPanel ap)
+ {
+ // see note in mantis : issue number 8585
+ if (alignment.isNucleotide() || conservation == null
+ || !autoCalculateConsensus)
+ {
+ return;
+ }
+ if (calculator
+ .getRegisteredWorkersOfClass(jalview.workers.ConservationThread.class)==null)
+ {
+ calculator.registerWorker(new jalview.workers.ConservationThread(
+ this, ap));
+ }
+ }
+
+ /**
+ * trigger update of consensus annotation
+ */
+ public void updateConsensus(final AlignmentViewPanel ap)
+ {
+ // see note in mantis : issue number 8585
+ if (consensus == null || !autoCalculateConsensus)
+ {
+ return;
+ }
+ if (calculator.getRegisteredWorkersOfClass(ConsensusThread.class)==null)
+ {
+ calculator.registerWorker(new ConsensusThread(this, ap));
+ }
+ }
+
+ // --------START Structure Conservation
+ public void updateStrucConsensus(final AlignmentViewPanel ap)
+ {
+ if (autoCalculateStrucConsensus && strucConsensus == null
+ && alignment.isNucleotide() && alignment.hasRNAStructure())
+ {
+
+ }
+
+ // see note in mantis : issue number 8585
+ if (strucConsensus == null || !autoCalculateStrucConsensus)
+ {
+ return;
+ }
+ if (calculator
+ .getRegisteredWorkersOfClass(StrucConsensusThread.class)==null)
+ {
+ calculator.registerWorker(new StrucConsensusThread(this, ap));
+ }
+ }
+
+ public boolean isCalcInProgress()
+ {
+ return calculator.isWorking();
+ }
+
+ @Override
+ public boolean isCalculationInProgress(
+ AlignmentAnnotation alignmentAnnotation)
+ {
+ if (!alignmentAnnotation.autoCalculated)
+ return false;
+ if (calculator.workingInvolvedWith(alignmentAnnotation))
+ {
+ // System.err.println("grey out ("+alignmentAnnotation.label+")");
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isClosed()
+ {
+ // TODO: check that this isClosed is only true after panel is closed, not
+ // before it is fully constructed.
+ return alignment == null;
+ }
+
+ @Override
+ public AlignCalcManagerI getCalcManager()
+ {
+ return calculator;
+ }
+
+ /**
+ * should conservation rows be shown for groups
+ */
+ protected boolean showGroupConservation = false;
+
+ /**
+ * should consensus rows be shown for groups
+ */
+ protected boolean showGroupConsensus = false;
+
+ /**
+ * should consensus profile be rendered by default
+ */
+ protected boolean showSequenceLogo = false;
+
+ /**
+ * should consensus profile be rendered normalised to row height
+ */
+ protected boolean normaliseSequenceLogo = false;
+
+ /**
+ * should consensus histograms be rendered by default
+ */
+ protected boolean showConsensusHistogram = true;
+
+ /**
+ * @return the showConsensusProfile
+ */
+ @Override
+ public boolean isShowSequenceLogo()
+ {
+ return showSequenceLogo;
+ }
+
+ /**
+ * @param showSequenceLogo
+ * the new value
+ */
+ public void setShowSequenceLogo(boolean showSequenceLogo)
+ {
+ if (showSequenceLogo != this.showSequenceLogo)
+ {
+ // TODO: decouple settings setting from calculation when refactoring
+ // annotation update method from alignframe to viewport
+ this.showSequenceLogo = showSequenceLogo;
+ calculator.updateAnnotationFor(ConsensusThread.class);
+ calculator.updateAnnotationFor(StrucConsensusThread.class);
+ }
+ this.showSequenceLogo = showSequenceLogo;
+ }
+
+ /**
+ * @param showConsensusHistogram
+ * the showConsensusHistogram to set
+ */
+ public void setShowConsensusHistogram(boolean showConsensusHistogram)
+ {
+ this.showConsensusHistogram = showConsensusHistogram;
+ }
+
+ /**
+ * @return the showGroupConservation
+ */
+ public boolean isShowGroupConservation()
+ {
+ return showGroupConservation;
+ }
+
+ /**
+ * @param showGroupConservation
+ * the showGroupConservation to set
+ */
+ public void setShowGroupConservation(boolean showGroupConservation)
+ {
+ this.showGroupConservation = showGroupConservation;
+ }
+
+ /**
+ * @return the showGroupConsensus
+ */
+ public boolean isShowGroupConsensus()
+ {
+ return showGroupConsensus;
+ }
+
+ /**
+ * @param showGroupConsensus
+ * the showGroupConsensus to set
+ */
+ public void setShowGroupConsensus(boolean showGroupConsensus)
+ {
+ this.showGroupConsensus = showGroupConsensus;
+ }
+
+ /**
+ *
+ * @return flag to indicate if the consensus histogram should be rendered by
+ * default
+ */
+ @Override
+ public boolean isShowConsensusHistogram()
+ {
+ return this.showConsensusHistogram;
+ }
+
+ /**
+ * show non-conserved residues only
+ */
+ protected boolean showUnconserved = false;
+
+ /**
+ * when set, updateAlignment will always ensure sequences are of equal length
+ */
+ private boolean padGaps = false;
+
+ /**
+ * when set, alignment should be reordered according to a newly opened tree
+ */
+ public boolean sortByTree = false;
+
+ public boolean getShowUnconserved()
+ {
+ return showUnconserved;
+ }
+
+ public void setShowUnconserved(boolean showunconserved)
+ {
+ showUnconserved = showunconserved;
+ }
+
+ /**
+ * @param showNonconserved
+ * the showUnconserved to set
+ */
+ public void setShowunconserved(boolean displayNonconserved)
+ {
+ this.showUnconserved = displayNonconserved;
+ }
+
+ /**
+ *
+ *
+ * @return null or the currently selected sequence region
+ */
+ public SequenceGroup getSelectionGroup()
+ {
+ return selectionGroup;
+ }
+
+ /**
+ * Set the selection group for this window.
+ *
+ * @param sg
+ * - group holding references to sequences in this alignment view
+ *
+ */
+ public void setSelectionGroup(SequenceGroup sg)
+ {
+ selectionGroup = sg;
+ }
+
+ public void setHiddenColumns(ColumnSelection colsel)
+ {
+ this.colSel = colsel;
+ if (colSel.getHiddenColumns() != null)
+ {
+ hasHiddenColumns = true;
+ }
+ }
+
+ @Override
+ public ColumnSelection getColumnSelection()
+ {
+ return colSel;
+ }
+
+ public void setColumnSelection(ColumnSelection colSel)
+ {
+ this.colSel = colSel;
+ }
+
+ /**
+ *
+ * @return
+ */
+ @Override
+ public Map<SequenceI, SequenceCollectionI> getHiddenRepSequences()
+ {
+ return hiddenRepSequences;
+ }
+
+ @Override
+ public void setHiddenRepSequences(
+ Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+ {
+ this.hiddenRepSequences = hiddenRepSequences;
+ }
+
+ protected boolean hasHiddenColumns = false;
+
+ public void updateHiddenColumns()
+ {
+ hasHiddenColumns = colSel.getHiddenColumns() != null;
+ }
+
+ protected boolean hasHiddenRows = false;
+
+ public boolean hasHiddenRows()
+ {
+ return hasHiddenRows;
+ }
+
+ protected SequenceGroup selectionGroup;
+
+ public void setSequenceSetId(String newid)
+ {
+ if (sequenceSetID != null)
+ {
+ System.err
+ .println("Warning - overwriting a sequenceSetId for a viewport!");
+ }
+ sequenceSetID = new String(newid);
+ }
+
+ public String getSequenceSetId()
+ {
+ if (sequenceSetID == null)
+ {
+ sequenceSetID = alignment.hashCode() + "";
+ }
+
+ return sequenceSetID;
+ }
+
+ /**
+ * unique viewId for synchronizing state (e.g. with stored Jalview Project)
+ *
+ */
+ protected String viewId = null;
+
+ public String getViewId()
+ {
+ if (viewId == null)
+ {
+ viewId = this.getSequenceSetId() + "." + this.hashCode() + "";
+ }
+ return viewId;
+ }
+
+ public void setIgnoreGapsConsensus(boolean b, AlignmentViewPanel ap)
+ {
+ ignoreGapsInConsensusCalculation = b;
+ if (ap != null)
+ {
+ updateConsensus(ap);
+ if (globalColourScheme != null)
+ {
+ globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
+ ignoreGapsInConsensusCalculation);
+ }
+ }
+
+ }
+
+ private long sgrouphash = -1, colselhash = -1;
+
+ /**
+ * checks current SelectionGroup against record of last hash value, and
+ * updates record.
+ *
+ * @param b
+ * update the record of last hash value
+ *
+ * @return true if SelectionGroup changed since last call (when b is true)
+ */
+ public boolean isSelectionGroupChanged(boolean b)
+ {
+ int hc = (selectionGroup == null || selectionGroup.getSize() == 0) ? -1
+ : selectionGroup.hashCode();
+ if (hc != -1 && hc != sgrouphash)
+ {
+ if (b)
+ {
+ sgrouphash = hc;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * checks current colsel against record of last hash value, and optionally
+ * updates record.
+ *
+ * @param b
+ * update the record of last hash value
+ * @return true if colsel changed since last call (when b is true)
+ */
+ public boolean isColSelChanged(boolean b)
+ {
+ int hc = (colSel == null || colSel.size() == 0) ? -1 : colSel
+ .hashCode();
+ if (hc != -1 && hc != colselhash)
+ {
+ if (b)
+ {
+ colselhash = hc;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean getIgnoreGapsConsensus()
+ {
+ return ignoreGapsInConsensusCalculation;
+ }
+
+ // / property change stuff
+
+ // JBPNote Prolly only need this in the applet version.
+ private final java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
+ this);
+
+ protected boolean showConservation = true;
+
+ protected boolean showQuality = true;
+
+ protected boolean showConsensus = true;
+
+ /**
+ * Property change listener for changes in alignment
+ *
+ * @param listener
+ * DOCUMENT ME!
+ */
+ public void addPropertyChangeListener(
+ java.beans.PropertyChangeListener listener)
+ {
+ changeSupport.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param listener
+ * DOCUMENT ME!
+ */
+ public void removePropertyChangeListener(
+ java.beans.PropertyChangeListener listener)
+ {
+ changeSupport.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Property change listener for changes in alignment
+ *
+ * @param prop
+ * DOCUMENT ME!
+ * @param oldvalue
+ * DOCUMENT ME!
+ * @param newvalue
+ * DOCUMENT ME!
+ */
+ public void firePropertyChange(String prop, Object oldvalue,
+ Object newvalue)
+ {
+ changeSupport.firePropertyChange(prop, oldvalue, newvalue);
+ }
+
+ // common hide/show column stuff
+
+ public void hideSelectedColumns()
+ {
+ if (colSel.size() < 1)
+ {
+ return;
+ }
+
+ colSel.hideSelectedColumns();
+ setSelectionGroup(null);
+
+ hasHiddenColumns = true;
+ }
+
+ public void hideColumns(int start, int end)
+ {
+ if (start == end)
+ {
+ colSel.hideColumns(start);
+ }
+ else
+ {
+ colSel.hideColumns(start, end);
+ }
+
+ hasHiddenColumns = true;
+ }
+
+ public void showColumn(int col)
+ {
+ colSel.revealHiddenColumns(col);
+ if (colSel.getHiddenColumns() == null)
+ {
+ hasHiddenColumns = false;
+ }
+ }
+
+ public void showAllHiddenColumns()
+ {
+ colSel.revealAllHiddenColumns();
+ hasHiddenColumns = false;
+ }
+
+ // common hide/show seq stuff
+ public void showAllHiddenSeqs()
+ {
+ if (alignment.getHiddenSequences().getSize() > 0)
+ {
+ if (selectionGroup == null)
+ {
+ selectionGroup = new SequenceGroup();
+ selectionGroup.setEndRes(alignment.getWidth() - 1);
+ }
+ Vector tmp = alignment.getHiddenSequences().showAll(
+ hiddenRepSequences);
+ for (int t = 0; t < tmp.size(); t++)
+ {
+ selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ }
+
+ hasHiddenRows = false;
+ hiddenRepSequences = null;
+
+ firePropertyChange("alignment", null, alignment.getSequences());
+ // used to set hasHiddenRows/hiddenRepSequences here, after the property
+ // changed event
+ sendSelection();
+ }
+ }
+
+ public void showSequence(int index)
+ {
+ Vector tmp = alignment.getHiddenSequences().showSequence(index,
+ hiddenRepSequences);
+ if (tmp.size() > 0)
+ {
+ if (selectionGroup == null)
+ {
+ selectionGroup = new SequenceGroup();
+ selectionGroup.setEndRes(alignment.getWidth() - 1);
+ }
+
+ for (int t = 0; t < tmp.size(); t++)
+ {
+ selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
+ }
+ // JBPNote: refactor: only update flag if we modified visiblity (used to
+ // do this regardless)
+ if (alignment.getHiddenSequences().getSize() < 1)
+ {
+ hasHiddenRows = false;
+ }
+ firePropertyChange("alignment", null, alignment.getSequences());
+ sendSelection();
+ }
+ }
+
+ public void hideAllSelectedSeqs()
+ {
+ if (selectionGroup == null || selectionGroup.getSize() < 1)
+ {
+ return;
+ }
+
+ SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
+
+ hideSequence(seqs);
+
+ setSelectionGroup(null);
+ }
+
+ public void hideSequence(SequenceI[] seq)
+ {
+ if (seq != null)
+ {
+ for (int i = 0; i < seq.length; i++)
+ {
+ alignment.getHiddenSequences().hideSequence(seq[i]);
+ }
+ hasHiddenRows = true;
+ firePropertyChange("alignment", null, alignment.getSequences());
+ }
+ }
+
+ public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
+ {
+ int sSize = sg.getSize();
+ if (sSize < 2)
+ {
+ return;
+ }
+
+ if (hiddenRepSequences == null)
+ {
+ hiddenRepSequences = new Hashtable();
+ }
+
+ hiddenRepSequences.put(repSequence, sg);
+
+ // Hide all sequences except the repSequence
+ SequenceI[] seqs = new SequenceI[sSize - 1];
+ int index = 0;
+ for (int i = 0; i < sSize; i++)
+ {
+ if (sg.getSequenceAt(i) != repSequence)
+ {
+ if (index == sSize - 1)
+ {
+ return;
+ }
+
+ seqs[index++] = sg.getSequenceAt(i);
+ }
+ }
+ sg.setSeqrep(repSequence); // note: not done in 2.7applet
+ sg.setHidereps(true); // note: not done in 2.7applet
+ hideSequence(seqs);
+
+ }
+
+ public boolean isHiddenRepSequence(SequenceI seq)
+ {
+ return hiddenRepSequences != null
+ && hiddenRepSequences.containsKey(seq);
+ }
+
+ public SequenceGroup getRepresentedSequences(SequenceI seq)
+ {
+ return (SequenceGroup) (hiddenRepSequences == null ? null
+ : hiddenRepSequences.get(seq));
+ }
+
+ public int adjustForHiddenSeqs(int alignmentIndex)
+ {
+ return alignment.getHiddenSequences().adjustForHiddenSeqs(
+ alignmentIndex);
+ }
+
+ // Selection manipulation
+ /**
+ * broadcast selection to any interested parties
+ */
+ public abstract void sendSelection();
+
+ public void invertColumnSelection()
+ {
+ colSel.invertColumnSelection(0, alignment.getWidth());
+ }
+
+ /**
+ * This method returns an array of new SequenceI objects derived from the
+ * whole alignment or just the current selection with start and end points
+ * adjusted
+ *
+ * @note if you need references to the actual SequenceI objects in the
+ * alignment or currently selected then use getSequenceSelection()
+ * @return selection as new sequenceI objects
+ */
+ public SequenceI[] getSelectionAsNewSequence()
+ {
+ SequenceI[] sequences;
+ // JBPNote: Need to test jalviewLite.getSelectedSequencesAsAlignmentFrom -
+ // this was the only caller in the applet for this method
+ // JBPNote: in applet, this method returned references to the alignment
+ // sequences, and it did not honour the presence/absence of annotation
+ // attached to the alignment (probably!)
+ if (selectionGroup == null)
+ {
+ sequences = alignment.getSequencesArray();
+ AlignmentAnnotation[] annots = alignment.getAlignmentAnnotation();
+ for (int i = 0; i < sequences.length; i++)
+ {
+ sequences[i] = new Sequence(sequences[i], annots); // construct new
+ // sequence with
+ // subset of visible
+ // annotation
+ }
+ }
+ else
+ {
+ sequences = selectionGroup.getSelectionAsNewSequences(alignment);
+ }
+
+ return sequences;
+ }
+
+ /**
+ * get the currently selected sequence objects or all the sequences in the
+ * alignment.
+ *
+ * @return array of references to sequence objects
+ */
+ public SequenceI[] getSequenceSelection()
+ {
+ SequenceI[] sequences = null;
+ if (selectionGroup != null)
+ {
+ sequences = selectionGroup.getSequencesInOrder(alignment);
+ }
+ if (sequences == null)
+ {
+ sequences = alignment.getSequencesArray();
+ }
+ return sequences;
+ }
+
+ /**
+ * This method returns the visible alignment as text, as seen on the GUI, ie
+ * if columns are hidden they will not be returned in the result. Use this for
+ * calculating trees, PCA, redundancy etc on views which contain hidden
+ * columns.
+ *
+ * @return String[]
+ */
+ public jalview.datamodel.CigarArray getViewAsCigars(
+ boolean selectedRegionOnly)
+ {
+ return new jalview.datamodel.CigarArray(alignment,
+ (hasHiddenColumns ? colSel : null),
+ (selectedRegionOnly ? selectionGroup : null));
+ }
+
+ /**
+ * return a compact representation of the current alignment selection to pass
+ * to an analysis function
+ *
+ * @param selectedOnly
+ * boolean true to just return the selected view
+ * @return AlignmentView
+ */
+ public jalview.datamodel.AlignmentView getAlignmentView(
+ boolean selectedOnly)
+ {
+ return getAlignmentView(selectedOnly, false);
+ }
+
+ /**
+ * return a compact representation of the current alignment selection to pass
+ * to an analysis function
+ *
+ * @param selectedOnly
+ * boolean true to just return the selected view
+ * @param markGroups
+ * boolean true to annotate the alignment view with groups on the
+ * alignment (and intersecting with selected region if selectedOnly
+ * is true)
+ * @return AlignmentView
+ */
+ public jalview.datamodel.AlignmentView getAlignmentView(
+ boolean selectedOnly, boolean markGroups)
+ {
+ return new AlignmentView(alignment, colSel, selectionGroup,
+ hasHiddenColumns, selectedOnly, markGroups);
+ }
+
+ /**
+ * This method returns the visible alignment as text, as seen on the GUI, ie
+ * if columns are hidden they will not be returned in the result. Use this for
+ * calculating trees, PCA, redundancy etc on views which contain hidden
+ * columns.
+ *
+ * @return String[]
+ */
+ public String[] getViewAsString(boolean selectedRegionOnly)
+ {
+ String[] selection = null;
+ SequenceI[] seqs = null;
+ int i, iSize;
+ int start = 0, end = 0;
+ if (selectedRegionOnly && selectionGroup != null)
+ {
+ iSize = selectionGroup.getSize();
+ seqs = selectionGroup.getSequencesInOrder(alignment);
+ start = selectionGroup.getStartRes();
+ end = selectionGroup.getEndRes() + 1;
+ }
+ else
+ {
+ iSize = alignment.getHeight();
+ seqs = alignment.getSequencesArray();
+ end = alignment.getWidth();
+ }
+
+ selection = new String[iSize];
+ if (hasHiddenColumns)
+ {
+ selection = colSel.getVisibleSequenceStrings(start, end, seqs);
+ }
+ else
+ {
+ for (i = 0; i < iSize; i++)
+ {
+ selection[i] = seqs[i].getSequenceAsString(start, end);
+ }
+
+ }
+ return selection;
+ }
+
+ /**
+ * return visible region boundaries within given column range
+ *
+ * @param min
+ * first column (inclusive, from 0)
+ * @param max
+ * last column (exclusive)
+ * @return int[][] range of {start,end} visible positions
+ */
+ public int[][] getVisibleRegionBoundaries(int min, int max)
+ {
+ Vector regions = new Vector();
+ int start = min;
+ int end = max;
+
+ do
+ {
+ if (hasHiddenColumns)
+ {
+ if (start == 0)
+ {
+ start = colSel.adjustForHiddenColumns(start);
+ }
+
+ end = colSel.getHiddenBoundaryRight(start);
+ if (start == end)
+ {
+ end = max;
+ }
+ if (end > max)
+ {
+ end = max;
+ }
+ }
+
+ regions.addElement(new int[]
+ { start, end });
+
+ if (hasHiddenColumns)
+ {
+ start = colSel.adjustForHiddenColumns(end);
+ start = colSel.getHiddenBoundaryLeft(start) + 1;
+ }
+ } while (end < max);
+
+ int[][] startEnd = new int[regions.size()][2];
+
+ regions.copyInto(startEnd);
+
+ return startEnd;
+
+ }
+
+ /**
+ * @return the padGaps
+ */
+ public boolean isPadGaps()
+ {
+ return padGaps;
+ }
+
+ /**
+ * @param padGaps
+ * the padGaps to set
+ */
+ public void setPadGaps(boolean padGaps)
+ {
+ this.padGaps = padGaps;
+ }
+
+ /**
+ * apply any post-edit constraints and trigger any calculations needed after
+ * an edit has been performed on the alignment
+ *
+ * @param ap
+ */
+ public void alignmentChanged(AlignmentViewPanel ap)
+ {
+ if (isPadGaps())
+ {
+ alignment.padGaps();
+ }
+ if (autoCalculateConsensus)
+ {
+ updateConsensus(ap);
+ }
+ if (hconsensus != null && autoCalculateConsensus)
+ {
+ updateConservation(ap);
+ }
+ if (autoCalculateStrucConsensus)
+ {
+ updateStrucConsensus(ap);
+ }
+
+ // Reset endRes of groups if beyond alignment width
+ int alWidth = alignment.getWidth();
+ List<SequenceGroup> groups = alignment.getGroups();
+ if (groups != null)
+ {
+ for (SequenceGroup sg : groups)
+ {
+ if (sg.getEndRes() > alWidth)
+ {
+ sg.setEndRes(alWidth - 1);
+ }
+ }
+ }
+
+ if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
+ {
+ selectionGroup.setEndRes(alWidth - 1);
+ }
+
+ resetAllColourSchemes();
+ calculator.restartWorkers();
+ // alignment.adjustSequenceAnnotations();
+ }
+
+ /**
+ * reset scope and do calculations for all applied colourschemes on alignment
+ */
+ void resetAllColourSchemes()
+ {
+ ColourSchemeI cs = globalColourScheme;
+ if (cs != null)
+ {
+ cs.alignmentChanged(alignment, null);
+
+ cs.setConsensus(hconsensus);
+ if (cs.conservationApplied())
+ {
+ cs.setConservation(Conservation.calculateConservation("All",
+ ResidueProperties.propHash, 3, alignment.getSequences(), 0,
+ alignment.getWidth(), false, getConsPercGaps(), false));
+ }
+ }
+
+ for (SequenceGroup sg : alignment.getGroups())
+ {
+ if (sg.cs != null)
+ {
+ sg.cs.alignmentChanged(sg, hiddenRepSequences);
+ }
+ sg.recalcConservation();
+ }
+ }
+
+ protected void initAutoAnnotation()
+ {
+ // TODO: add menu option action that nulls or creates consensus object
+ // depending on if the user wants to see the annotation or not in a
+ // specific alignment
+
+ if (hconsensus == null && !isDataset)
+ {
+ if (!alignment.isNucleotide())
+ {
+ if (showConservation)
+ {
+ if (conservation == null)
+ {
+ conservation = new AlignmentAnnotation("Conservation",
+ "Conservation of total alignment less than "
+ + getConsPercGaps() + "% gaps",
+ new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH);
+ conservation.hasText = true;
+ conservation.autoCalculated = true;
+ alignment.addAnnotation(conservation);
+ }
+ }
+ if (showQuality)
+ {
+ if (quality == null)
+ {
+ quality = new AlignmentAnnotation("Quality",
+ "Alignment Quality based on Blosum62 scores",
+ new Annotation[1], 0f, 11f,
+ AlignmentAnnotation.BAR_GRAPH);
+ quality.hasText = true;
+ quality.autoCalculated = true;
+ alignment.addAnnotation(quality);
+ }
+ }
+ }
+ else
+ {
+ if (alignment.hasRNAStructure())
+ {
+ strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID",
+ new Annotation[1], 0f, 100f,
+ AlignmentAnnotation.BAR_GRAPH);
+ strucConsensus.hasText = true;
+ strucConsensus.autoCalculated = true;
+ }
+ }
+
+ consensus = new AlignmentAnnotation("Consensus", "PID",
+ new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
+ consensus.hasText = true;
+ consensus.autoCalculated = true;
+
+ if (showConsensus)
+ {
+ alignment.addAnnotation(consensus);
+ if (strucConsensus != null)
+ {
+ alignment.addAnnotation(strucConsensus);
+ }
+ }
+ }
+ }
+
+}
--- /dev/null
+package jalview.workers;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentAnnotation;
+
+public class AlignCalcManager implements AlignCalcManagerI
+{
+ private volatile List<AlignCalcWorkerI> restartable = Collections
+ .synchronizedList(new ArrayList<AlignCalcWorkerI>());
+
+ private volatile List<Class> blackList = Collections
+ .synchronizedList(new ArrayList<Class>());
+
+ /**
+ * global record of calculations in progress
+ */
+ private volatile Map<Class, AlignCalcWorkerI> inProgress = Collections
+ .synchronizedMap(new Hashtable<Class, AlignCalcWorkerI>());
+
+ /**
+ * record of calculations pending or in progress in the current context
+ */
+ private volatile Map<Class, List<AlignCalcWorkerI>> updating = Collections
+ .synchronizedMap(new Hashtable<Class, List<AlignCalcWorkerI>>());
+
+ @Override
+ public void notifyStart(AlignCalcWorkerI worker)
+ {
+ synchronized (updating)
+ {
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd == null)
+ {
+ updating.put(
+ worker.getClass(),
+ upd = Collections
+ .synchronizedList(new ArrayList<AlignCalcWorkerI>()));
+ }
+ synchronized (upd)
+ {
+ upd.add(worker);
+ }
+ }
+ }
+
+ @Override
+ public boolean alreadyDoing(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+ return inProgress.containsKey(worker.getClass());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.api.AlignCalcManagerI#isPending(jalview.api.AlignCalcWorkerI)
+ */
+ @Override
+ public boolean isPending(AlignCalcWorkerI workingClass)
+ {
+ List<AlignCalcWorkerI> upd;
+ synchronized (updating)
+ {
+ upd = updating.get(workingClass.getClass());
+ if (upd == null)
+ {
+ return false;
+ }
+ synchronized (upd)
+ {
+ if (upd.size() > 1)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ // TODO make into api method if needed ?
+ public int numberLive(AlignCalcWorkerI worker)
+ {
+ synchronized (updating)
+ {
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd == null)
+ {
+ return 0;
+ }
+ ;
+ return upd.size();
+ }
+ }
+
+ @Override
+ public boolean notifyWorking(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+ // TODO: decide if we should throw exceptions here if multiple workers
+ // start to work
+ if (inProgress.get(worker.getClass()) != null)
+ {
+ if (false)
+ {
+ System.err
+ .println("Warning: Multiple workers are running of type "
+ + worker.getClass());
+ }
+ return false;
+ }
+ inProgress.put(worker.getClass(), worker);
+ }
+ return true;
+ }
+
+ private final HashSet<AlignCalcWorkerI> canUpdate = new HashSet<AlignCalcWorkerI>();
+
+ @Override
+ public void workerComplete(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {
+// System.err.println("Worker "+worker.getClass()+" marked as complete.");
+ inProgress.remove(worker.getClass());
+ List<AlignCalcWorkerI> upd = updating.get(worker.getClass());
+ if (upd != null)
+ {
+ synchronized (upd)
+ {
+ upd.remove(worker);
+ }
+ canUpdate.add(worker);
+ }
+ }
+ }
+
+ @Override
+ public void workerCannotRun(AlignCalcWorkerI worker)
+ {
+ synchronized (blackList)
+ {
+ blackList.add(worker.getClass());
+ }
+ }
+
+ public boolean isBlackListed(Class workerType)
+ {
+ synchronized (blackList)
+ {
+ return blackList.contains(workerType);
+ }
+ }
+
+ @Override
+ public void startWorker(AlignCalcWorkerI worker)
+ {
+// System.err.println("Starting "+worker.getClass());
+// new Exception("").printStackTrace();
+ Thread tw = new Thread(worker);
+ tw.setName(worker.getClass().toString());
+ tw.start();
+ }
+
+ @Override
+ public boolean isWorking(AlignCalcWorkerI worker)
+ {
+ synchronized (inProgress)
+ {// System.err.println("isWorking : worker "+(worker!=null ?
+ // worker.getClass():"null")+ " "+hashCode());
+ return worker != null && inProgress.get(worker.getClass()) == worker;
+ }
+ }
+
+ @Override
+ public boolean isWorking()
+ {
+ synchronized (inProgress)
+ {
+ // System.err.println("isWorking "+hashCode());
+ return inProgress.size() > 0;
+ }
+ }
+
+ @Override
+ public void registerWorker(AlignCalcWorkerI worker)
+ {
+ synchronized (restartable)
+ {
+ if (!restartable.contains(worker))
+ {
+ restartable.add(worker);
+ }
+ startWorker(worker);
+ }
+ }
+
+ @Override
+ public void restartWorkers()
+ {
+ synchronized (restartable)
+ {
+ for (AlignCalcWorkerI worker : restartable)
+ {
+ startWorker(worker);
+ }
+ }
+ }
+
+ @Override
+ public boolean workingInvolvedWith(AlignmentAnnotation alignmentAnnotation)
+ {
+ synchronized (inProgress)
+ {
+ for (AlignCalcWorkerI worker : inProgress.values())
+ {
+ if (worker.involves(alignmentAnnotation))
+ {
+ return true;
+ }
+ }
+ }
+ synchronized (updating)
+ {
+ for (List<AlignCalcWorkerI> workers : updating.values())
+ {
+ for (AlignCalcWorkerI worker : workers)
+ if (worker.involves(alignmentAnnotation))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void updateAnnotationFor(Class workerClass)
+ {
+
+ AlignCalcWorkerI[] workers;
+ synchronized (canUpdate)
+ {
+ workers = canUpdate.toArray(new AlignCalcWorkerI[0]);
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (workerClass.equals(worker.getClass()))
+ {
+ worker.updateAnnotation();
+ }
+ }
+ }
+
+ @Override
+ public List<AlignCalcWorkerI> getRegisteredWorkersOfClass(
+ Class workerClass)
+ {
+ List<AlignCalcWorkerI> workingClass = new ArrayList<AlignCalcWorkerI>();
+ AlignCalcWorkerI[] workers;
+ synchronized (canUpdate)
+ {
+ workers = canUpdate.toArray(new AlignCalcWorkerI[0]);
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (workerClass.equals(worker.getClass()))
+ {
+ workingClass.add(worker);
+ }
+ }
+ return (workingClass.size() == 0) ? null : workingClass;
+ }
+
+ @Override
+ public boolean startRegisteredWorkersOfClass(Class workerClass)
+ {
+ List<AlignCalcWorkerI> workers = getRegisteredWorkersOfClass(workerClass);
+ if (workers == null)
+ {
+ return false;
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (!isPending(worker))
+ {
+ startWorker(worker);
+ }
+ else
+ {
+ System.err.println("Pending exists for " + workerClass);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void workerMayRun(AlignCalcWorkerI worker)
+ {
+ synchronized (blackList)
+ {
+ if (blackList.contains(worker.getClass()))
+ {
+ blackList.remove(worker.getClass());
+ }
+ }
+ }
+}
--- /dev/null
+/**
+ *
+ */
+package jalview.workers;
+
+import java.util.List;
+
+import jalview.api.AlignCalcManagerI;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+
+/**
+ * Base class for alignment calculation workers
+ * @author jimp
+ *
+ */
+public abstract class AlignCalcWorker implements AlignCalcWorkerI
+{
+ /**
+ * manager and data source for calculations
+ */
+ protected AlignViewportI alignViewport;
+ protected AlignCalcManagerI calcMan;
+ protected AlignmentViewPanel ap;
+ protected List<AlignmentAnnotation> ourAnnots=null;
+
+ public AlignCalcWorker(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ this.alignViewport = alignViewport;
+ calcMan=alignViewport.getCalcManager();
+ ap = alignPanel;
+ }
+ protected void abortAndDestroy()
+ {
+ if (calcMan!=null) {
+ calcMan.workerComplete(this);
+ }
+ alignViewport=null;
+ calcMan=null;
+ ap=null;
+
+ }
+ public boolean involves(AlignmentAnnotation i)
+ {
+ return ourAnnots!=null && ourAnnots.contains(i);
+ }
+
+ // TODO: allow GUI to query workers associated with annotation to add items to annotation label panel popup menu
+
+}
--- /dev/null
+package jalview.workers;
+
+import jalview.analysis.AAFrequency;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.schemes.ColourSchemeI;
+
+import java.util.Hashtable;
+
+public class ConsensusThread extends AlignCalcWorker implements AlignCalcWorkerI
+{
+ public ConsensusThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ @Override
+ public void run()
+ {
+ if (calcMan.isPending(this))
+ {
+ return;
+ }
+ calcMan.notifyStart(this);
+ long started=System.currentTimeMillis();
+ try
+ {
+ AlignmentAnnotation consensus = alignViewport.getAlignmentConsensusAnnotation();
+ if (consensus==null || calcMan.isPending(this)) {
+ calcMan.workerComplete(this);
+ return;
+ }
+ while (!calcMan.notifyWorking(this))
+ {
+ // System.err.println("Thread (Consensus"+Thread.currentThread().getName()+") Waiting around.");
+ try
+ {
+ if (ap != null)
+ {
+ ap.paintAlignment(false);
+ }
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ }
+ AlignmentI alignment = alignViewport.getAlignment();
+
+ int aWidth = -1;
+
+ if (alignment == null || (aWidth = alignment.getWidth()) < 0)
+ {
+ calcMan.workerComplete(this);
+ // .updatingConservation = false;
+ // AlignViewport.UPDATING_CONSERVATION = false;
+
+ return;
+ }
+ consensus = alignViewport
+ .getAlignmentConsensusAnnotation();
+
+ consensus.annotations = null;
+ consensus.annotations = new Annotation[aWidth];
+ Hashtable[] hconsensus = alignViewport.getSequenceConsensusHash();
+ hconsensus = new Hashtable[aWidth];
+ try {
+ AAFrequency.calculate(alignment.getSequencesArray(), 0,
+ alignment.getWidth(), hconsensus, true);
+ } catch (ArrayIndexOutOfBoundsException x){
+ // this happens due to a race condition -
+ // alignment was edited at same time as calculation was running
+ //
+// calcMan.workerCannotRun(this);
+ calcMan.workerComplete(this);
+ return;
+ }
+ alignViewport.setSequenceConsensusHash(hconsensus);
+ updateResultAnnotation(true);
+ ColourSchemeI globalColourScheme = alignViewport
+ .getGlobalColourScheme();
+ if (globalColourScheme != null)
+ {
+ globalColourScheme.setConsensus(hconsensus);
+ }
+
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ ap.raiseOOMWarning("calculating consensus", error);
+ }
+
+ calcMan.workerComplete(this);
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+ AlignmentAnnotation consensus = alignViewport
+ .getAlignmentConsensusAnnotation();
+ Hashtable[] hconsensus = alignViewport.getSequenceConsensusHash();
+ if (immediate || !calcMan.isWorking(this) && consensus!=null && hconsensus!=null)
+ {
+ AAFrequency.completeConsensus(consensus, hconsensus, 0,
+ hconsensus.length, alignViewport.getIgnoreGapsConsensus(),
+ alignViewport.isShowSequenceLogo());
+ }
+ }
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.workers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jalview.analysis.Conservation;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignmentViewPanel;
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+
+public class ConservationThread extends AlignCalcWorker implements AlignCalcWorkerI
+{
+
+ private int ConsPercGaps = 25; // JBPNote : This should be a configurable property!
+
+ public ConservationThread(AlignViewportI alignViewport, AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ ConsPercGaps = alignViewport.getConsPercGaps();
+ }
+
+ private Conservation cons;
+ AlignmentAnnotation conservation,quality;
+ int alWidth;
+ @Override
+ public void run()
+ {
+ try
+ {
+ calcMan.notifyStart(this); // updatingConservation = true;
+
+ while (!calcMan.notifyWorking(this))
+ {
+ try
+ {
+ if (ap != null)
+ {
+ // ap.paintAlignment(false);
+ }
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed()) {
+ abortAndDestroy();
+ }
+ List<AlignmentAnnotation>ourAnnot = new ArrayList<AlignmentAnnotation>();
+ AlignmentI alignment=alignViewport.getAlignment();
+ conservation=alignViewport.getAlignmentConservationAnnotation();
+ quality=alignViewport.getAlignmentQualityAnnot();
+ ourAnnot.add(conservation);
+ ourAnnot.add(quality);
+ ourAnnots = ourAnnot;
+
+ // AlignViewport.UPDATING_CONSERVATION = true;
+
+ if (alignment==null || (alWidth=alignment.getWidth())< 0)
+ {
+ calcMan.workerComplete(this);
+ //.updatingConservation = false;
+ //AlignViewport.UPDATING_CONSERVATION = false;
+
+ return;
+ }
+ try {
+ cons = Conservation.calculateConservation("All",
+ jalview.schemes.ResidueProperties.propHash, 3,
+ alignment.getSequences(), 0, alWidth - 1, false, ConsPercGaps, quality!=null);
+ } catch (IndexOutOfBoundsException x)
+ {
+ // probable race condition. just finish and return without any fuss.
+ calcMan.workerComplete(this);
+ return;
+ }
+ updateResultAnnotation(true);
+ } catch (OutOfMemoryError error)
+ {
+ ap.raiseOOMWarning("calculating conservation", error);
+ calcMan.workerCannotRun(this);
+ // alignViewport.conservation = null;
+ // this.alignViewport.quality = null;
+
+ }
+ calcMan.workerComplete(this);
+
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+
+ }
+
+ private void updateResultAnnotation(boolean b)
+ {
+ if (b || !calcMan.isWorking(this) && cons!=null && conservation!=null && quality!=null)
+ cons.completeAnnotations(conservation,
+ quality, 0, alWidth);
+ }
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+
+ }
+}
--- /dev/null
+package jalview.workers;
+
+import java.util.Hashtable;
+
+import jalview.analysis.StructureFrequency;
+import jalview.api.AlignCalcWorkerI;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+
+public class StrucConsensusThread extends AlignCalcWorker implements
+ AlignCalcWorkerI
+{
+ public StrucConsensusThread(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ AlignmentAnnotation strucConsensus;
+
+ Hashtable[] hStrucConsensus;
+
+ @Override
+ public void run()
+ {
+ try
+ {
+ if (calcMan.isPending(this))
+ {
+ return;
+ }
+ calcMan.notifyStart(this);
+ while (!calcMan.notifyWorking(this))
+ {
+ try
+ {
+ if (ap != null)
+ {
+ // ap.paintAlignment(false);
+ }
+
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ }
+ AlignmentI alignment = alignViewport.getAlignment();
+
+ int aWidth = -1;
+
+ if (alignment == null || (aWidth = alignment.getWidth()) < 0)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+ strucConsensus = alignViewport.getAlignmentStrucConsensusAnnotation();
+ hStrucConsensus = alignViewport.getRnaStructureConsensusHash();
+ strucConsensus.annotations = null;
+ strucConsensus.annotations = new Annotation[aWidth];
+
+ hStrucConsensus = new Hashtable[aWidth];
+
+ AlignmentAnnotation[] aa = alignViewport.getAlignment()
+ .getAlignmentAnnotation();
+ AlignmentAnnotation rnaStruc = null;
+ // select rna struct to use for calculation
+ for (int i = 0; i < aa.length; i++)
+ {
+ if (aa[i].getRNAStruc() != null && aa[i].isValidStruc())
+ {
+ rnaStruc = aa[i];
+ break;
+ }
+ }
+ // check to see if its valid
+
+ if (rnaStruc == null || !rnaStruc.isValidStruc())
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+
+ try {
+ jalview.analysis.StructureFrequency.calculate(
+ alignment.getSequencesArray(), 0, alignment.getWidth(),
+ hStrucConsensus, true, rnaStruc);
+ } catch (ArrayIndexOutOfBoundsException x)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+ alignViewport.setRnaStructureConsensusHash(hStrucConsensus);
+ // TODO AlignmentAnnotation rnaStruc!!!
+ updateResultAnnotation(true);
+ if (alignViewport.getGlobalColourScheme() != null)
+ {
+ alignViewport.getGlobalColourScheme().setConsensus(hStrucConsensus);
+ }
+
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ ap.raiseOOMWarning("calculating RNA structure consensus", error);
+ } finally
+ {
+ calcMan.workerComplete(this);
+ if (ap != null)
+ {
+ ap.paintAlignment(true);
+ }
+ }
+
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+ if (immediate || !calcMan.isWorking(this) && strucConsensus != null
+ && hStrucConsensus != null)
+ {
+ StructureFrequency.completeConsensus(strucConsensus, hStrucConsensus,
+ 0, hStrucConsensus.length,
+ alignViewport.getIgnoreGapsConsensus(),
+ alignViewport.isShowSequenceLogo());
+ }
+ }
+
+}
\ No newline at end of file
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
import jalview.gui.Desktop;\r
import jalview.gui.IProgressIndicator;\r
import jalview.gui.OOMWarning;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.seqfetcher.DbSourceProxy;\r
\r
import java.lang.reflect.Array;\r
+import java.util.ArrayList;\r
import java.util.Enumeration;\r
import java.util.Hashtable;\r
+import java.util.List;\r
import java.util.StringTokenizer;\r
import java.util.Vector;\r
\r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-\r
import uk.ac.ebi.picr.model.UPEntry;\r
\r
/**\r
// The key will be the seq name or accession id of the seq\r
Hashtable seqRefs;\r
\r
- String[] dbSources;\r
+ DbSourceProxy[] dbSources;\r
\r
SequenceFetcher sfetcher;\r
\r
* @param sources\r
* array of database source strings to query references from\r
*/\r
- public DBRefFetcher(SequenceI[] seqs, AlignFrame af, String[] sources)\r
+ public DBRefFetcher(SequenceI[] seqs, AlignFrame af, DbSourceProxy[] sources)\r
{\r
this.af = af;\r
alseqs = new SequenceI[seqs.length];\r
{\r
// af.featureSettings_actionPerformed(null);\r
String[] defdb = null, otherdb = sfetcher\r
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);\r
- Vector selsources = new Vector(), dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
+ .getDbInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
+ List<DbSourceProxy> selsources = new ArrayList<DbSourceProxy>();\r
+ Vector dasselsrc = (af.featureSettings != null) ? af.featureSettings\r
.getSelectedSources() : new jalview.gui.DasSourceBrowser()\r
.getSelectedSources();\r
- Enumeration en = dasselsrc.elements();\r
+ Enumeration<jalviewSourceI> en = dasselsrc.elements();\r
while (en.hasMoreElements())\r
{\r
- DasSource src = (DasSource) en.nextElement();\r
- selsources.addElement(src.getNickname());\r
- }\r
- int osel = 0;\r
- for (int o = 0; otherdb != null && o < otherdb.length; o++)\r
- {\r
- if (!selsources.contains(otherdb[o]))\r
+ jalviewSourceI src = en.nextElement();\r
+ List<DbSourceProxy> sp=src.getSequenceSourceProxies();\r
+ selsources.addAll(sp);\r
+ if (sp.size()>1)\r
{\r
- otherdb[o] = null;\r
- }\r
- else\r
- {\r
- osel++;\r
+ Cache.log.debug("Added many Db Sources for :"+src.getTitle());\r
}\r
}\r
// select appropriate databases based on alignFrame context.\r
{\r
defdb = DBRefSource.PROTEINDBS;\r
}\r
- // append the selected sequence sources to the default dbs\r
- dbSources = new String[defdb.length + osel];\r
- System.arraycopy(defdb, 0, dbSources, 0, defdb.length);\r
- for (int o = 0, op = defdb.length; otherdb != null\r
- && o < otherdb.length; o++)\r
- {\r
- if (otherdb[o] != null)\r
- {\r
- dbSources[op++] = otherdb[o];\r
- }\r
+ List<DbSourceProxy> srces=new ArrayList<DbSourceProxy>();\r
+ for (String ddb:defdb) {\r
+ srces.addAll(sfetcher.getSourceProxy(ddb));\r
}\r
+ \r
+ // append the selected sequence sources to the default dbs\r
+ srces.addAll(selsources);\r
+ dbSources = srces.toArray(new DbSourceProxy[0]);\r
}\r
else\r
{\r
{\r
if (dbSources == null)\r
{\r
- dbSources = new String[]\r
- {};\r
+ dbSources = new DbSourceProxy[0];\r
}\r
// append additional sources\r
- String[] otherdb = sfetcher\r
- .getDbInstances(jalview.ws.dbsources.DasSequenceSource.class);\r
+ DbSourceProxy[] otherdb=sfetcher\r
+ .getDbSourceProxyInstances(jalview.ws.dbsources.das.datamodel.DasSequenceSource.class);\r
if (otherdb != null && otherdb.length > 0)\r
{\r
- String[] newsrc = new String[dbSources.length + otherdb.length];\r
+ DbSourceProxy[] newsrc = new DbSourceProxy[dbSources.length + otherdb.length];\r
System.arraycopy(dbSources, 0, newsrc, 0, dbSources.length);\r
System.arraycopy(otherdb, 0, newsrc, dbSources.length, otherdb.length);\r
dbSources = newsrc;\r
while (sdataset.size() > 0 && db < dbSources.length)\r
{\r
int maxqlen = 1; // default number of queries made to at one time\r
- System.err.println("Verifying against " + dbSources[db]);\r
- jalview.ws.seqfetcher.DbSourceProxy dbsource = sfetcher\r
- .getSourceProxy(dbSources[db]);\r
- if (dbsource == null)\r
- {\r
- System.err.println("No proxy for " + dbSources[db]);\r
- db++;\r
- continue;\r
- }\r
- if (dbsource.getDbSourceProperties()\r
- .containsKey(DBRefSource.MULTIACC))\r
- {\r
- maxqlen = ((Integer) dbsource.getDbSourceProperties().get(\r
- DBRefSource.MULTIACC)).intValue();\r
- }\r
- else\r
- {\r
- maxqlen = 1;\r
- }\r
+ System.err.println("Verifying against " + dbSources[db].getDbName());\r
+ boolean dn = false;\r
+\r
// iterate through db for each remaining un-verified sequence\r
SequenceI[] currSeqs = new SequenceI[sdataset.size()];\r
sdataset.copyInto(currSeqs);// seqs that are to be validated against\r
\r
int seqIndex = 0;\r
\r
- while (queries.size() > 0 || seqIndex < currSeqs.length)\r
+ jalview.ws.seqfetcher.DbSourceProxy dbsource = dbSources[db];\r
{\r
- if (queries.size() > 0)\r
+ // for moment, we dumbly iterate over all retrieval sources for a particular database\r
+ // TODO: introduce multithread multisource queries and logic to remove a query from other sources if any source for a database returns a record\r
+ if (dbsource.getDbSourceProperties().containsKey(\r
+ DBRefSource.MULTIACC))\r
{\r
- // Still queries to make for current seqIndex\r
- StringBuffer queryString = new StringBuffer("");\r
- int numq = 0, nqSize = (maxqlen > queries.size()) ? queries\r
- .size() : maxqlen;\r
-\r
- while (queries.size() > 0 && numq < nqSize)\r
+ maxqlen = ((Integer) dbsource.getDbSourceProperties().get(\r
+ DBRefSource.MULTIACC)).intValue();\r
+ }\r
+ else\r
+ {\r
+ maxqlen = 1;\r
+ }\r
+ while (queries.size() > 0 || seqIndex < currSeqs.length)\r
+ {\r
+ if (queries.size() > 0)\r
{\r
- String query = (String) queries.elementAt(0);\r
- if (dbsource.isValidReference(query))\r
+ // Still queries to make for current seqIndex\r
+ StringBuffer queryString = new StringBuffer("");\r
+ int numq = 0, nqSize = (maxqlen > queries.size()) ? queries\r
+ .size() : maxqlen;\r
+\r
+ while (queries.size() > 0 && numq < nqSize)\r
{\r
- queryString.append((numq == 0) ? "" : dbsource\r
- .getAccessionSeparator());\r
- queryString.append(query);\r
- numq++;\r
+ String query = (String) queries.elementAt(0);\r
+ if (dbsource.isValidReference(query))\r
+ {\r
+ queryString.append((numq == 0) ? "" : dbsource\r
+ .getAccessionSeparator());\r
+ queryString.append(query);\r
+ numq++;\r
+ }\r
+ // remove the extracted query string\r
+ queries.removeElementAt(0);\r
}\r
- // remove the extracted query string\r
- queries.removeElementAt(0);\r
- }\r
- // make the queries and process the response\r
- AlignmentI retrieved = null;\r
- try\r
- {\r
- if (jalview.bin.Cache.log.isDebugEnabled())\r
+ // make the queries and process the response\r
+ AlignmentI retrieved = null;\r
+ try\r
+ {\r
+ if (jalview.bin.Cache.log.isDebugEnabled())\r
+ {\r
+ jalview.bin.Cache.log.debug("Querying "\r
+ + dbsource.getDbName() + " with : '"\r
+ + queryString.toString() + "'");\r
+ }\r
+ retrieved = dbsource.getSequenceRecords(queryString\r
+ .toString());\r
+ } catch (Exception ex)\r
{\r
- jalview.bin.Cache.log.debug("Querying "\r
- + dbsource.getDbName() + " with : '"\r
- + queryString.toString() + "'");\r
+ ex.printStackTrace();\r
+ } catch (OutOfMemoryError err)\r
+ {\r
+ new OOMWarning("retrieving database references ("\r
+ + queryString.toString() + ")", err);\r
+ }\r
+ if (retrieved != null)\r
+ {\r
+ transferReferences(sdataset, dbsource.getDbSource(), retrieved);\r
}\r
- retrieved = dbsource.getSequenceRecords(queryString.toString());\r
- } catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- } catch (OutOfMemoryError err)\r
- {\r
- new OOMWarning("retrieving database references ("\r
- + queryString.toString() + ")", err);\r
- }\r
- if (retrieved != null)\r
- {\r
- transferReferences(sdataset, dbSources[db], retrieved);\r
}\r
- }\r
- else\r
- {\r
- // make some more strings for use as queries\r
- for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)\r
+ else\r
{\r
- SequenceI sequence = dataset[seqIndex];\r
- DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
- sequence.getDBRef(), new String[]\r
- { dbSources[db] }); // jalview.datamodel.DBRefSource.UNIPROT\r
- // });\r
- // check for existing dbrefs to use\r
- if (uprefs != null && uprefs.length > 0)\r
+ // make some more strings for use as queries\r
+ for (int i = 0; (seqIndex < dataset.length) && (i < 50); seqIndex++, i++)\r
{\r
- for (int j = 0; j < uprefs.length; j++)\r
+ SequenceI sequence = dataset[seqIndex];\r
+ DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
+ sequence.getDBRef(), new String[]\r
+ { dbsource.getDbSource() }); // jalview.datamodel.DBRefSource.UNIPROT\r
+ // });\r
+ // check for existing dbrefs to use\r
+ if (uprefs != null && uprefs.length > 0)\r
{\r
- addSeqId(sequence, uprefs[j].getAccessionId());\r
- queries.addElement(uprefs[j].getAccessionId().toUpperCase());\r
+ for (int j = 0; j < uprefs.length; j++)\r
+ {\r
+ addSeqId(sequence, uprefs[j].getAccessionId());\r
+ queries.addElement(uprefs[j].getAccessionId()\r
+ .toUpperCase());\r
+ }\r
}\r
- }\r
- else\r
- {\r
- // generate queries from sequence ID string\r
- StringTokenizer st = new StringTokenizer(sequence.getName(),\r
- "|");\r
- while (st.hasMoreTokens())\r
+ else\r
{\r
- String token = st.nextToken();\r
- UPEntry[] presp = null;\r
- if (picrClient != null)\r
+ // generate queries from sequence ID string\r
+ StringTokenizer st = new StringTokenizer(\r
+ sequence.getName(), "|");\r
+ while (st.hasMoreTokens())\r
{\r
- // resolve the string against PICR to recover valid IDs\r
- try\r
+ String token = st.nextToken();\r
+ UPEntry[] presp = null;\r
+ if (picrClient != null)\r
{\r
- presp = picrClient\r
- .getUPIForAccession(token, null,\r
- picrClient.getMappedDatabaseNames(),\r
- null, true);\r
- } catch (Exception e)\r
+ // resolve the string against PICR to recover valid IDs\r
+ try\r
+ {\r
+ presp = picrClient.getUPIForAccession(token, null,\r
+ picrClient.getMappedDatabaseNames(), null,\r
+ true);\r
+ } catch (Exception e)\r
+ {\r
+ System.err.println("Exception with Picr for '"\r
+ + token + "'\n");\r
+ e.printStackTrace();\r
+ }\r
+ }\r
+ if (presp != null && presp.length > 0)\r
{\r
- System.err.println("Exception with Picr for '" + token\r
- + "'\n");\r
- e.printStackTrace();\r
+ for (int id = 0; id < presp.length; id++)\r
+ {\r
+ // construct sequences from response if sequences are\r
+ // present, and do a transferReferences\r
+ // otherwise transfer non sequence x-references directly.\r
+ }\r
+ System.out\r
+ .println("Validated ID against PICR... (for what its worth):"\r
+ + token);\r
+ addSeqId(sequence, token);\r
+ queries.addElement(token.toUpperCase());\r
}\r
- }\r
- if (presp != null && presp.length > 0)\r
- {\r
- for (int id = 0; id < presp.length; id++)\r
+ else\r
{\r
- // construct sequences from response if sequences are\r
- // present, and do a transferReferences\r
- // otherwise transfer non sequence x-references directly.\r
+ // if ()\r
+ // System.out.println("Not querying source with token="+token+"\n");\r
+ addSeqId(sequence, token);\r
+ queries.addElement(token.toUpperCase());\r
}\r
- System.out\r
- .println("Validated ID against PICR... (for what its worth):"\r
- + token);\r
- addSeqId(sequence, token);\r
- queries.addElement(token.toUpperCase());\r
- }\r
- else\r
- {\r
- // if ()\r
- // System.out.println("Not querying source with token="+token+"\n");\r
- addSeqId(sequence, token);\r
- queries.addElement(token.toUpperCase());\r
}\r
}\r
}\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
*/\r
package jalview.ws;\r
\r
-import java.net.*;\r
-import java.util.*;\r
-\r
-import javax.swing.*;\r
-\r
-import org.biojava.dasobert.das.*;\r
-import org.biojava.dasobert.das2.*;\r
-import org.biojava.dasobert.das2.io.*;\r
-import org.biojava.dasobert.dasregistry.*;\r
-import org.biojava.dasobert.eventmodel.*;\r
import jalview.bin.Cache;\r
-import jalview.datamodel.*;\r
-import jalview.gui.*;\r
+import jalview.datamodel.DBRefEntry;\r
+import jalview.datamodel.SequenceFeature;\r
+import jalview.datamodel.SequenceI;\r
+import jalview.gui.AlignFrame;\r
+import jalview.gui.Desktop;\r
+import jalview.gui.FeatureSettings;\r
import jalview.util.UrlLink;\r
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.Enumeration;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Set;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JOptionPane;\r
+\r
+import org.biodas.jdas.client.FeaturesClient;\r
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter;\r
+import org.biodas.jdas.client.adapters.features.DasGFFAdapter.GFFAdapter;\r
+import org.biodas.jdas.client.threads.FeaturesClientMultipleSources;\r
+import org.biodas.jdas.schema.features.ERRORSEGMENT;\r
+import org.biodas.jdas.schema.features.FEATURE;\r
+import org.biodas.jdas.schema.features.LINK;\r
+import org.biodas.jdas.schema.features.SEGMENT;\r
+import org.biodas.jdas.schema.features.TYPE;\r
+import org.biodas.jdas.schema.features.UNKNOWNFEATURE;\r
+import org.biodas.jdas.schema.features.UNKNOWNSEGMENT;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
\r
/**\r
* DOCUMENT ME!\r
\r
StringBuffer sbuffer = new StringBuffer();\r
\r
- Vector selectedSources;\r
+ List<jalviewSourceI> selectedSources;\r
\r
boolean cancelled = false;\r
\r
\r
long startTime;\r
\r
+ private DasSourceRegistryI sourceRegistry;\r
+ private boolean useJDASMultiThread=true;\r
/**\r
* Creates a new SequenceFeatureFetcher object. Uses default\r
* \r
public DasSequenceFeatureFetcher(SequenceI[] sequences,\r
FeatureSettings fsettings, Vector selectedSources)\r
{\r
- this(sequences, fsettings, selectedSources, true, true);\r
+ this(sequences, fsettings, selectedSources, true, true, true);\r
}\r
\r
public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
- FeatureSettings fsettings, Vector ourselectedSources,\r
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
boolean checkDbrefs, boolean promptFetchDbrefs)\r
{\r
- this.selectedSources = new Vector();\r
- Enumeration sources = ourselectedSources.elements();\r
+ this(oursequences,fsettings,selectedSources2,checkDbrefs,promptFetchDbrefs,true);\r
+ }\r
+ public DasSequenceFeatureFetcher(SequenceI[] oursequences,\r
+ FeatureSettings fsettings, List<jalviewSourceI> selectedSources2,\r
+ boolean checkDbrefs, boolean promptFetchDbrefs, boolean useJDasMultiThread)\r
+ {\r
+ this.useJDASMultiThread=useJDasMultiThread;\r
+ this.selectedSources = new ArrayList<jalviewSourceI>();\r
// filter both sequences and sources to eliminate duplicates\r
- while (sources.hasMoreElements())\r
+ for (jalviewSourceI src : selectedSources2)\r
{\r
- Object src = sources.nextElement();\r
if (!selectedSources.contains(src))\r
{\r
- selectedSources.addElement(src);\r
+ selectedSources.add(src);\r
}\r
;\r
}\r
af.setShowSeqFeatures(true);\r
}\r
int uniprotCount = 0;\r
- for (int i = 0; i < selectedSources.size(); i++)\r
+ for (jalviewSourceI source : selectedSources)\r
{\r
- DasSource source = (DasSource) selectedSources.elementAt(i);\r
- DasCoordinateSystem[] coords = source.getCoordinateSystem();\r
- for (int c = 0; c < coords.length; c++)\r
+ for (COORDINATES coords : source.getVersion().getCOORDINATES())\r
{\r
// TODO: match UniProt coord system canonically (?) - does\r
// UniProt==uniprot==UNIPROT ?\r
- if (coords[c].getName().indexOf("UniProt") > -1)\r
+ if (coords.getAuthority().toLowerCase().equals("uniprot"))\r
{\r
uniprotCount++;\r
break;\r
}\r
else\r
{\r
- startFetching();\r
+ _startFetching();\r
}\r
}\r
else\r
{\r
- startFetching();\r
+ _startFetching();\r
}\r
\r
}\r
-\r
+ private void _startFetching()\r
+ {\r
+ running=true;\r
+ new Thread(new FetchSeqFeatures()).start();\r
+ }\r
+ class FetchSeqFeatures implements Runnable\r
+ {\r
+ public void run()\r
+ {\r
+ startFetching();\r
+ setGuiFetchComplete();\r
+ }\r
+ }\r
class FetchDBRefs implements Runnable\r
{\r
public void run()\r
{\r
+ running=true;\r
new DBRefFetcher(sequences, af).fetchDBRefs(true);\r
startFetching();\r
+ setGuiFetchComplete();\r
}\r
}\r
\r
/**\r
- * Spawns a number of dasobert Fetcher threads to add features to sequences in\r
- * the dataset\r
+ * Spawns Fetcher threads to add features to sequences in the dataset\r
*/\r
void startFetching()\r
{\r
+ running=true;\r
cancelled = false;\r
startTime = System.currentTimeMillis();\r
if (af != null)\r
{\r
af.setProgressBar("Fetching DAS Sequence Features", startTime);\r
}\r
-\r
+ if (sourceRegistry == null)\r
+ {\r
+ sourceRegistry = Cache.getDasSourceRegistry();\r
+ }\r
if (selectedSources == null || selectedSources.size() == 0)\r
{\r
try\r
{\r
- DasSource[] sources = new jalview.gui.DasSourceBrowser()\r
- .getDASSource();\r
-\r
+ jalviewSourceI[] sources = sourceRegistry.getSources().toArray(\r
+ new jalviewSourceI[0]);\r
String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE",\r
"uniprot");\r
StringTokenizer st = new StringTokenizer(active, "\t");\r
token = st.nextToken();\r
for (int i = 0; i < sources.length; i++)\r
{\r
- if (sources[i].getNickname().equals(token))\r
+ if (sources[i].getTitle().equals(token))\r
{\r
- selectedSources.addElement(sources[i]);\r
+ selectedSources.add(sources[i]);\r
break;\r
}\r
}\r
}\r
\r
sourcesRemaining = selectedSources.size();\r
+ FeaturesClientMultipleSources fc = new FeaturesClientMultipleSources();\r
+ fc.setConnProps(sourceRegistry.getSessionHandler());\r
// Now sending requests one at a time to each server\r
- for (int sourceIndex = 0; sourceIndex < selectedSources.size()\r
- && !cancelled; sourceIndex++)\r
+ ArrayList<jalviewSourceI> srcobj = new ArrayList<jalviewSourceI>();\r
+ ArrayList<String> src = new ArrayList<String>();\r
+ List<List<String>> ids = new ArrayList<List<String>>();\r
+ List<List<DBRefEntry>> idobj = new ArrayList<List<DBRefEntry>>();\r
+ List<Map<String, SequenceI>> sqset = new ArrayList<Map<String, SequenceI>>();\r
+ for (jalviewSourceI _sr : selectedSources)\r
+ {\r
+\r
+ Map<String, SequenceI> slist = new HashMap<String, SequenceI>();\r
+ List<DBRefEntry> idob = new ArrayList<DBRefEntry>();\r
+ List<String> qset = new ArrayList<String>();\r
+\r
+ for (SequenceI seq : sequences)\r
+ {\r
+ Object[] idset = nextSequence(_sr, seq);\r
+ if (idset != null)\r
+ {\r
+ List<DBRefEntry> _idob = (List<DBRefEntry>) idset[0];\r
+ List<String> _qset = (List<String>) idset[1];\r
+ if (_idob.size() > 0)\r
+ {\r
+ // add sequence's ref for each id derived from it\r
+ // (space inefficient, but most unambiguous)\r
+ // could replace with hash with _qset values as keys.\r
+ Iterator<DBRefEntry> dbobj = _idob.iterator();\r
+ for (String q : _qset)\r
+ {\r
+ SequenceI osq = slist.get(q);\r
+ DBRefEntry dr = dbobj.next();\r
+ if (osq != null && osq != seq)\r
+ {\r
+ // skip - non-canonical query\r
+ }\r
+ else\r
+ {\r
+ idob.add(dr);\r
+ qset.add(q);\r
+ slist.put(q, seq);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if (idob.size() > 0)\r
+ {\r
+ srcobj.add(_sr);\r
+ src.add(_sr.getSourceURL());\r
+ ids.add(qset);\r
+ idobj.add(idob);\r
+ sqset.add(slist);\r
+ }\r
+ }\r
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
+ Map<String, Map<List<String>, DasGFFAdapter>> results = new HashMap<String, Map<List<String>, DasGFFAdapter>>();\r
+ if (!useJDASMultiThread)\r
+ {\r
+ Iterator<String> sources=src.iterator();\r
+ // iterate over each query for each source and do each one individually\r
+ for (List<String> idl:ids)\r
+ {\r
+ String source=sources.next();\r
+ FeaturesClient featuresc=new FeaturesClient(sourceRegistry.getSessionHandler().getConnectionPropertyProviderFor(source));\r
+ for (String id:idl)\r
+ {\r
+ List<String> qid=Arrays.asList(new String[] { id});\r
+ try {\r
+ DasGFFAdapter dga=featuresc.fetchData(source, qid);\r
+ Map<List<String>,DasGFFAdapter> ers=results.get(source);\r
+ if (ers==null)\r
+ {\r
+ results.put(source, ers=new HashMap<List<String>,DasGFFAdapter>());\r
+ }\r
+ ers.put(qid, dga);\r
+ } catch (Exception ex)\r
+ {\r
+ Map<List<String>,Exception> ers=errors.get(source);\r
+ if (ers==null)\r
+ {\r
+ errors.put(source, ers=new HashMap<List<String>,Exception>());\r
+ }\r
+ ers.put(qid, ex);\r
+ }\r
+ }\r
+ }\r
+ } else {\r
+ // pass them all at once\r
+ fc.fetchData(src, ids, false, results, errors);\r
+ fc.shutDown();\r
+ while (!fc.isTerminated())\r
{\r
- DasSource dasSource = (DasSource) selectedSources\r
- .elementAt(sourceIndex);\r
+ try\r
+ {\r
+ Thread.sleep(200);\r
+ } catch (InterruptedException x)\r
+ {\r
\r
- nextSequence(dasSource, sequences[0]);\r
+ }\r
+ }\r
+ }\r
+ Iterator<List<String>> idset = ids.iterator();\r
+ Iterator<List<DBRefEntry>> idobjset = idobj.iterator();\r
+ Iterator<Map<String, SequenceI>> seqset = sqset.iterator();\r
+ for (jalviewSourceI source : srcobj)\r
+ {\r
+ processResponse(seqset.next(), source, idset.next(), idobjset.next(),\r
+ results.get(source.getSourceURL()),\r
+ errors.get(source.getSourceURL()));\r
+ }\r
+ }\r
+\r
+ private void processResponse(Map<String, SequenceI> sequencemap,\r
+ jalviewSourceI jvsource, List<String> ids,\r
+ List<DBRefEntry> idobj, Map<List<String>, DasGFFAdapter> results,\r
+ Map<List<String>, Exception> errors)\r
+ {\r
+ Set<SequenceI> sequences = new HashSet<SequenceI>();\r
+ String source = jvsource.getSourceURL();\r
+ // process features\r
+ DasGFFAdapter result = (results == null) ? null : results.get(ids);\r
+ Exception error = (errors == null) ? null : errors.get(ids);\r
+ if (result == null)\r
+ {\r
+ debug("das source " + source + " could not be contacted. "\r
+ + (error == null ? "" : error.toString()));\r
+ }\r
+ else\r
+ {\r
+\r
+ GFFAdapter gff = result.getGFF();\r
+ List<SEGMENT> segments = gff.getSegments();\r
+ List<ERRORSEGMENT> errorsegs = gff.getErrorSegments();\r
+ List<UNKNOWNFEATURE> unkfeats = gff.getUnknownFeatures();\r
+ List<UNKNOWNSEGMENT> unksegs = gff.getUnknownSegments();\r
+ debug("das source " + source + " returned " + gff.getTotal()\r
+ + " responses. " + (errorsegs != null ? errorsegs.size() : 0)\r
+ + " were incorrect segment queries, "\r
+ + (unkfeats != null ? unkfeats.size() : 0)\r
+ + " were unknown features "\r
+ + (unksegs != null ? unksegs.size() : 0)\r
+ + " were unknown segments and "\r
+ + (segments != null ? segments.size() : 0)\r
+ + " were segment responses.");\r
+ Iterator<DBRefEntry> dbr = idobj.iterator();\r
+ if (segments != null)\r
+ {\r
+ for (SEGMENT seg : segments)\r
+ {\r
+ String id = seg.getId();\r
+ DBRefEntry dbref = idobj.get(ids.indexOf(id));\r
+ SequenceI sequence = sequencemap.get(id);\r
+ boolean added = false;\r
+ sequences.add(sequence);\r
+\r
+ for (FEATURE feat : seg.getFEATURE())\r
+ {\r
+ // standard DAS feature-> jalview sequence feature transformation\r
+ SequenceFeature f = newSequenceFeature(feat, jvsource.getTitle());\r
+ if (!parseSeqFeature(sequence, f, feat, jvsource))\r
+ {\r
+ if (dbref.getMap() != null && f.getBegin() > 0\r
+ && f.getEnd() > 0)\r
+ {\r
+ debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
+ SequenceFeature vf[] = null;\r
+\r
+ try\r
+ {\r
+ vf = dbref.getMap().locateFeature(f);\r
+ } catch (Exception ex)\r
+ {\r
+ Cache.log\r
+ .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");\r
+ Cache.log.info("Mapping feature from " + f.getBegin()\r
+ + " to " + f.getEnd() + " in dbref "\r
+ + dbref.getAccessionId() + " in "\r
+ + dbref.getSource());\r
+ Cache.log.info("using das Source " + source);\r
+ Cache.log.info("Exception", ex);\r
+ }\r
+\r
+ if (vf != null)\r
+ {\r
+ for (int v = 0; v < vf.length; v++)\r
+ {\r
+ debug("mapping to " + v + ": " + vf[v].getBegin()\r
+ + " - " + vf[v].getEnd());\r
+ sequence.addSequenceFeature(vf[v]);\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ sequence.addSequenceFeature(f);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ featuresAdded(sequences);\r
+ }\r
+ else\r
+ {\r
+ // System.out.println("No features found for " + seq.getName()\r
+ // + " from: " + e.getDasSource().getNickname());\r
+ }\r
}\r
}\r
\r
}\r
\r
int sourcesRemaining = 0;\r
-\r
- void responseComplete(DasSource dasSource, SequenceI seq)\r
- {\r
- if (seq != null)\r
- {\r
- for (int seqIndex = 0; seqIndex < sequences.length - 1 && !cancelled; seqIndex++)\r
- {\r
- if (sequences[seqIndex] == seq)\r
- {\r
- nextSequence(dasSource, sequences[++seqIndex]);\r
- return;\r
- }\r
- }\r
- }\r
-\r
- sourcesRemaining--;\r
-\r
- if (sourcesRemaining == 0)\r
- {\r
- System.err.println("Fetching Complete.");\r
- setGuiFetchComplete();\r
- }\r
-\r
- }\r
-\r
+ private boolean running=false;\r
private void setGuiFetchComplete()\r
{\r
-\r
+ running=false;\r
if (!cancelled && af != null)\r
{\r
// only update the progress bar if we've completed the fetch normally\r
}\r
}\r
\r
- void featuresAdded(SequenceI seq)\r
+ void featuresAdded(Set<SequenceI> seqs)\r
{\r
if (af == null)\r
{\r
int index;\r
for (index = start; index < end; index++)\r
{\r
- if (seq == af.getViewport().getAlignment().getSequenceAt(index)\r
- .getDatasetSequence())\r
+ for (SequenceI seq : seqs)\r
{\r
- af.alignPanel.paintAlignment(true);\r
- break;\r
+ if (seq == af.getViewport().getAlignment().getSequenceAt(index)\r
+ .getDatasetSequence())\r
+ {\r
+ af.alignPanel.paintAlignment(true);\r
+ index = end;\r
+ break;\r
+ }\r
}\r
}\r
}\r
\r
- void nextSequence(DasSource dasSource, SequenceI seq)\r
+ Object[] nextSequence(jalviewSourceI dasSource, SequenceI seq)\r
{\r
if (cancelled)\r
- return;\r
+ return null;\r
DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(\r
seq.getDBRef(), new String[]\r
{\r
// TODO: minimal list of DAS queries to make by querying with untyped ID if\r
// distinct from any typed IDs\r
\r
+ List<DBRefEntry> ids = new ArrayList<DBRefEntry>();\r
+ List<String> qstring = new ArrayList<String>();\r
boolean dasCoordSysFound = false;\r
\r
if (uprefs != null)\r
// do any of these ids match the source's coordinate system ?\r
for (int j = 0; !dasCoordSysFound && j < uprefs.length; j++)\r
{\r
- DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
\r
- for (int csIndex = 0; csIndex < cs.length && !dasCoordSysFound; csIndex++)\r
+ for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())\r
{\r
- if (cs.length > 0\r
- && jalview.util.DBRefUtils.isDasCoordinateSystem(\r
- cs[csIndex].getName(), uprefs[j]))\r
+ if (jalview.util.DBRefUtils.isDasCoordinateSystem(\r
+ csys.getAuthority(), uprefs[j]))\r
{\r
debug("Launched fetcher for coordinate system "\r
- + cs[0].getName());\r
+ + csys.getAuthority());\r
// Will have to pass any mapping information to the fetcher\r
// - the start/end for the DBRefEntry may not be the same as the\r
// sequence's start/end\r
\r
System.out.println(seq.getName() + " "\r
+ (seq.getDatasetSequence() == null) + " "\r
- + dasSource.getUrl());\r
+ + csys.getUri());\r
\r
dasCoordSysFound = true; // break's out of the loop\r
- createFeatureFetcher(seq, dasSource, uprefs[j]);\r
+ ids.add(uprefs[j]);\r
+ qstring.add(uprefs[j].getAccessionId());\r
}\r
else\r
- System.out.println("IGNORE " + cs[csIndex].getName());\r
+ System.out.println("IGNORE " + csys.getAuthority());\r
}\r
}\r
}\r
}\r
if (id != null)\r
{\r
+ DBRefEntry dbre = new DBRefEntry();\r
+ dbre.setAccessionId(id);\r
// Should try to call a general feature fetcher that\r
// queries many sources with name to discover applicable ID references\r
- createFeatureFetcher(seq, dasSource, id);\r
+ ids.add(dbre);\r
+ qstring.add(dbre.getAccessionId());\r
}\r
}\r
\r
- }\r
-\r
- /**\r
- * fetch and add das features to a sequence using the given source URL and\r
- * compatible DbRef id. new features are mapped using the DbRef mapping to the\r
- * local coordinate system.\r
- * \r
- * @param seq\r
- * @param SourceUrl\r
- * @param dbref\r
- */\r
- protected void createFeatureFetcher(final SequenceI seq,\r
- final DasSource dasSource, final DBRefEntry dbref)\r
- {\r
-\r
- // ////////////\r
- // / fetch DAS features\r
- final Das1Source source = new Das1Source();\r
- source.setUrl(dasSource.getUrl());\r
- source.setNickname(dasSource.getNickname());\r
- if (dbref == null || dbref.getAccessionId() == null\r
- || dbref.getAccessionId().length() < 1)\r
- {\r
- responseComplete(dasSource, seq); // reduce thread count anyhow\r
- return;\r
- }\r
- debug("new Das Feature Fetcher for " + dbref.getSource() + ":"\r
- + dbref.getAccessionId() + " querying " + dasSource.getUrl());\r
- FeatureThread fetcher = new FeatureThread(dbref.getAccessionId()\r
- // + ":" + start + "," + end,\r
- , source);\r
-\r
- fetcher.addFeatureListener(new FeatureListener()\r
- {\r
- public void comeBackLater(FeatureEvent e)\r
- {\r
- responseComplete(dasSource, seq);\r
- debug("das source " + e.getSource().getNickname()\r
- + " asked us to come back in " + e.getComeBackLater()\r
- + " secs.");\r
- }\r
-\r
- public void newFeatures(FeatureEvent e)\r
- {\r
-\r
- Das1Source ds = e.getSource();\r
-\r
- Map[] features = e.getFeatures();\r
- // add features to sequence\r
- debug("das source " + ds.getUrl() + " returned " + features.length\r
- + " features");\r
-\r
- if (features.length > 0)\r
- {\r
- for (int i = 0; i < features.length; i++)\r
- {\r
- // standard DAS feature-> jalview sequence feature transformation\r
- SequenceFeature f = newSequenceFeature(features[i],\r
- source.getNickname());\r
- if (!parseSeqFeature(seq, f, features[i], source))\r
- {\r
- if (dbref.getMap() != null && f.getBegin() > 0\r
- && f.getEnd() > 0)\r
- {\r
- debug("mapping from " + f.getBegin() + " - " + f.getEnd());\r
- SequenceFeature vf[] = null;\r
-\r
- try\r
- {\r
- vf = dbref.getMap().locateFeature(f);\r
- } catch (Exception ex)\r
- {\r
- Cache.log\r
- .info("Error in 'experimental' mapping of features. Please try to reproduce and then report info to jalview-discuss@jalview.org.");\r
- Cache.log.info("Mapping feature from " + f.getBegin()\r
- + " to " + f.getEnd() + " in dbref "\r
- + dbref.getAccessionId() + " in "\r
- + dbref.getSource());\r
- Cache.log.info("using das Source " + ds.getUrl());\r
- Cache.log.info("Exception", ex);\r
- }\r
-\r
- if (vf != null)\r
- {\r
- for (int v = 0; v < vf.length; v++)\r
- {\r
- debug("mapping to " + v + ": " + vf[v].getBegin()\r
- + " - " + vf[v].getEnd());\r
- seq.addSequenceFeature(vf[v]);\r
- }\r
- }\r
- }\r
- else\r
- {\r
- seq.addSequenceFeature(f);\r
- }\r
- }\r
- }\r
- featuresAdded(seq);\r
- }\r
- else\r
- {\r
- // System.out.println("No features found for " + seq.getName()\r
- // + " from: " + e.getDasSource().getNickname());\r
- }\r
- responseComplete(dasSource, seq);\r
-\r
- }\r
- }\r
-\r
- );\r
-\r
- fetcher.start();\r
- }\r
-\r
- protected void createFeatureFetcher(final SequenceI seq,\r
- final DasSource dasSource, String id)\r
- {\r
- // ////////////\r
- // / fetch DAS features\r
- final Das1Source source = new Das1Source();\r
- source.setUrl(dasSource.getUrl());\r
- source.setNickname(dasSource.getNickname());\r
-\r
- if (id != null)\r
- {\r
- id = id.trim();\r
- }\r
- if (id != null && id.length() > 0)\r
- {\r
- debug("new Das Feature Fetcher for " + id + " querying "\r
- + dasSource.getUrl());\r
- FeatureThread fetcher = new FeatureThread(id\r
- // + ":" + start + "," + end,\r
- , source);\r
-\r
- fetcher.addFeatureListener(new FeatureListener()\r
- {\r
- public void comeBackLater(FeatureEvent e)\r
- {\r
- responseComplete(dasSource, seq);\r
- debug("das source " + e.getSource().getNickname()\r
- + " asked us to come back in " + e.getComeBackLater()\r
- + " secs.");\r
- }\r
-\r
- public void newFeatures(FeatureEvent e)\r
- {\r
-\r
- Das1Source ds = e.getSource();\r
-\r
- Map[] features = e.getFeatures();\r
- // add features to sequence\r
- debug("das source " + ds.getUrl() + " returned "\r
- + features.length + " features");\r
-\r
- if (features.length > 0)\r
- {\r
- for (int i = 0; i < features.length; i++)\r
- {\r
- // standard DAS feature-> jalview sequence feature transformation\r
- SequenceFeature f = newSequenceFeature(features[i],\r
- source.getNickname());\r
- if (!parseSeqFeature(seq, f, features[i], source))\r
- {\r
- // just add as a simple sequence feature\r
- seq.addSequenceFeature(f);\r
- }\r
- }\r
-\r
- featuresAdded(seq);\r
- }\r
- else\r
- {\r
- // System.out.println("No features found for " + seq.getName()\r
- // + " from: " + e.getDasSource().getNickname());\r
- }\r
- responseComplete(dasSource, seq);\r
-\r
- }\r
- }\r
-\r
- );\r
-\r
- fetcher.start();\r
- }\r
- else\r
- {\r
- // invalid fetch - indicate it is finished.\r
- debug("Skipping empty ID for querying " + dasSource.getUrl());\r
- responseComplete(dasSource, seq);\r
- }\r
+ return new Object[]\r
+ { ids, qstring };\r
}\r
\r
/**\r
* @return true if feature was consumed as another kind of annotation.\r
*/\r
protected boolean parseSeqFeature(SequenceI seq, SequenceFeature f,\r
- Map map, Das1Source source)\r
+ FEATURE feature, jalviewSourceI source)\r
{\r
SequenceI mseq = seq;\r
while (seq.getDatasetSequence() != null)\r
// try to parse the accession out\r
\r
DBRefEntry dbr = new DBRefEntry();\r
- dbr.setVersion(source.getNickname());\r
+ dbr.setVersion(source.getTitle());\r
StringTokenizer st = new StringTokenizer(f.getDescription(), ":");\r
if (st.hasMoreTokens())\r
{\r
/**\r
* creates a jalview sequence feature from a das feature document\r
* \r
- * @param dasfeature\r
+ * @param feat\r
* @return sequence feature object created using dasfeature information\r
*/\r
- SequenceFeature newSequenceFeature(Map dasfeature, String nickname)\r
+ SequenceFeature newSequenceFeature(FEATURE feat, String nickname)\r
{\r
- if (dasfeature == null)\r
+ if (feat == null)\r
{\r
return null;\r
}\r
* qName.equals("SCORE")\r
*/\r
String desc = new String();\r
- if (dasfeature.containsKey("NOTE"))\r
+ if (feat.getNOTE() != null)\r
{\r
- desc += (String) dasfeature.get("NOTE");\r
+ for (String note : feat.getNOTE())\r
+ {\r
+ desc += (String) note;\r
+ }\r
}\r
\r
int start = 0, end = 0;\r
\r
try\r
{\r
- start = Integer.parseInt(dasfeature.get("START").toString());\r
+ start = Integer.parseInt(feat.getSTART().toString());\r
} catch (Exception ex)\r
{\r
}\r
try\r
{\r
- end = Integer.parseInt(dasfeature.get("END").toString());\r
+ end = Integer.parseInt(feat.getEND().toString());\r
} catch (Exception ex)\r
{\r
}\r
try\r
{\r
- Object scr = dasfeature.get("SCORE");\r
+ Object scr = feat.getSCORE();\r
if (scr != null)\r
{\r
score = (float) Double.parseDouble(scr.toString());\r
}\r
\r
SequenceFeature f = new SequenceFeature(\r
- (String) dasfeature.get("TYPE"), desc, start, end, score,\r
+ getTypeString(feat.getTYPE()), desc, start, end, score,\r
nickname);\r
\r
- if (dasfeature.containsKey("LINK"))\r
+ if (feat.getLINK() != null)\r
{\r
- // Do not put feature extent in link text for non-positional features\r
- if (f.begin == 0 && f.end == 0)\r
- {\r
- f.addLink(f.getType() + "|" + dasfeature.get("LINK"));\r
- }\r
- else\r
+ for (LINK link : feat.getLINK())\r
{\r
- f.addLink(f.getType() + " " + f.begin + "_" + f.end + "|"\r
- + dasfeature.get("LINK"));\r
+ // Do not put feature extent in link text for non-positional features\r
+ if (f.begin == 0 && f.end == 0)\r
+ {\r
+ f.addLink(f.getType() + " " + link.getContent() + "|"\r
+ + link.getHref());\r
+ }\r
+ else\r
+ {\r
+ f.addLink(f.getType() + " " + f.begin + "_" + f.end + " "\r
+ + link.getContent() + "|" + link.getHref());\r
+ }\r
}\r
}\r
\r
System.out.println("ERRR " + e);\r
e.printStackTrace();\r
System.out.println("############");\r
- debug("Failed to parse " + dasfeature.toString(), e);\r
+ debug("Failed to parse " + feat.toString(), e);\r
return null;\r
}\r
}\r
\r
- /**\r
- * query the default DAS Source Registry for sources. Uses value of jalview\r
- * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that\r
- * doesn't exist.\r
- * \r
- * @return list of sources\r
- */\r
- public static DasSource[] getDASSources()\r
+ private String getTypeString(TYPE type)\r
{\r
-\r
- String registryURL = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
- DasSourceBrowser.DEFAULT_REGISTRY);\r
- return getDASSources(registryURL);\r
+ return type.getContent();\r
}\r
\r
- /**\r
- * query the given URL for DasSources.\r
- * \r
- * @param registryURL\r
- * return sources from registryURL\r
- */\r
- public static DasSource[] getDASSources(String registryURL)\r
+ public boolean isRunning()\r
{\r
- DasSourceReaderImpl reader = new DasSourceReaderImpl();\r
-\r
- try\r
- {\r
- URL url = new URL(registryURL);\r
-\r
- DasSource[] sources = reader.readDasSource(url);\r
-\r
- List das1sources = new ArrayList();\r
- for (int i = 0; i < sources.length; i++)\r
- {\r
- DasSource ds = sources[i];\r
- if (ds instanceof Das2Source)\r
- {\r
- Das2Source d2s = (Das2Source) ds;\r
- if (d2s.hasDas1Capabilities())\r
- {\r
- Das1Source d1s = DasSourceConverter.toDas1Source(d2s);\r
- das1sources.add(d1s);\r
- }\r
-\r
- }\r
- else if (ds instanceof Das1Source)\r
- {\r
- das1sources.add((Das1Source) ds);\r
- }\r
- }\r
-\r
- return (Das1Source[]) das1sources.toArray(new Das1Source[das1sources\r
- .size()]);\r
- } catch (Exception ex)\r
- {\r
- System.err.println("Failed to contact DAS1 registry at "\r
- + registryURL);\r
- ex.printStackTrace();\r
- return null;\r
- }\r
+ return running;\r
}\r
\r
}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
*/\r
package jalview.ws;\r
\r
-import java.util.ArrayList;\r
-import java.util.Enumeration;\r
-import java.util.Vector;\r
-\r
-import org.biojava.dasobert.das2.Das2Source;\r
-import org.biojava.dasobert.dasregistry.Das1Source;\r
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-\r
import jalview.datamodel.Alignment;\r
import jalview.datamodel.AlignmentI;\r
import jalview.datamodel.DBRefSource;\r
import jalview.datamodel.SequenceI;\r
-import jalview.ws.dbsources.DasSequenceSource;\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.dbsources.das.datamodel.DasSequenceSource;\r
import jalview.ws.seqfetcher.ASequenceFetcher;\r
import jalview.ws.seqfetcher.DbSourceProxy;\r
\r
+import java.util.ArrayList;\r
+import java.util.Enumeration;\r
+import java.util.List;\r
+import java.util.Vector;\r
+\r
/**\r
* This is the the concrete implementation of the sequence retrieval interface\r
* and abstract class in jalview.ws.seqfetcher. This implements the run-time\r
// alignment is\r
// 'default' for\r
// PFAM\r
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class);\r
+ addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class);\r
registerDasSequenceSources();\r
}\r
\r
/**\r
- * return an ordered list of database sources suitable for using in a GUI\r
- * element\r
+ * return an ordered list of database sources where non-das database classes\r
+ * appear before das database classes\r
*/\r
public String[] getOrderedSupportedSources()\r
{\r
String[] srcs = this.getSupportedDb();\r
- ArrayList dassrc = new ArrayList(), nondas = new ArrayList();\r
+ ArrayList<String> dassrc = new ArrayList<String>(), nondas = new ArrayList<String>();\r
for (int i = 0; i < srcs.length; i++)\r
{\r
- String nm = getSourceProxy(srcs[i]).getDbName();\r
- if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.DasSequenceSource)\r
+ boolean das = false,skip=false;\r
+ String nm;\r
+ for (DbSourceProxy dbs : getSourceProxy(srcs[i]))\r
{\r
- if (nm.startsWith("das:"))\r
+ // Skip the alignment databases for the moment - they're not useful for verifying a single sequence against its reference source\r
+ if (dbs.isA(DBRefSource.ALIGNMENTDB))\r
{\r
- nm = nm.substring(4);\r
+ skip=true;\r
+ } else {\r
+ nm = dbs.getDbName();\r
+ if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)\r
+ {\r
+ if (nm.startsWith("das:"))\r
+ {\r
+ nm = nm.substring(4);\r
+ das = true;\r
+ }\r
+ break;\r
+ }\r
}\r
- dassrc.add(new String[]\r
- { srcs[i], nm.toUpperCase() });\r
+ }\r
+ if (skip)\r
+ {\r
+ continue;\r
+ }\r
+ if (das)\r
+ {\r
+ dassrc.add(srcs[i]);\r
}\r
else\r
{\r
- nondas.add(new String[]\r
- { srcs[i], nm.toUpperCase() });\r
+ nondas.add(srcs[i]);\r
+ }\r
+ }\r
+ String[] tosort = nondas.toArray(new String[0]), sorted = nondas\r
+ .toArray(new String[0]);\r
+ for (int j = 0, jSize = sorted.length; j < jSize; j++)\r
+ {\r
+ tosort[j] = tosort[j].toLowerCase();\r
+ }\r
+ jalview.util.QuickSort.sort(tosort, sorted);\r
+ // construct array with all sources listed\r
+\r
+ srcs = new String[sorted.length + dassrc.size()];\r
+ int i = 0;\r
+ for (int j = sorted.length - 1; j >= 0; j--, i++)\r
+ {\r
+ srcs[i] = sorted[j];\r
+ sorted[j] = null;\r
+ }\r
+\r
+ sorted = dassrc.toArray(new String[0]);\r
+ tosort = dassrc.toArray(new String[0]);\r
+ for (int j = 0, jSize = sorted.length; j < jSize; j++)\r
+ {\r
+ tosort[j] = tosort[j].toLowerCase();\r
+ }\r
+ jalview.util.QuickSort.sort(tosort, sorted);\r
+ for (int j = sorted.length - 1; j >= 0; j--, i++)\r
+ {\r
+ srcs[i] = sorted[j];\r
+ }\r
+ return srcs;\r
+ }\r
+\r
+ /**\r
+ * return plaintext databse list suitable for using in a GUI element\r
+ */\r
+ public String[] _getOrderedSupportedSources()\r
+ {\r
+ String[] srcs = this.getSupportedDb();\r
+ ArrayList dassrc = new ArrayList(), nondas = new ArrayList();\r
+ for (int i = 0; i < srcs.length; i++)\r
+ {\r
+ for (DbSourceProxy dbs : getSourceProxy(srcs[i]))\r
+ {\r
+ String nm = dbs.getDbName();\r
+ if (getSourceProxy(srcs[i]) instanceof jalview.ws.dbsources.das.datamodel.DasSequenceSource)\r
+ {\r
+ if (nm.startsWith("das:"))\r
+ {\r
+ nm = nm.substring(4);\r
+ }\r
+ dassrc.add(new String[]\r
+ { srcs[i], nm.toUpperCase() });\r
+ }\r
+ else\r
+ {\r
+ nondas.add(new String[]\r
+ { srcs[i], nm.toUpperCase() });\r
+ }\r
}\r
}\r
Object[] sorted = nondas.toArray();\r
}\r
jalview.util.QuickSort.sort(tosort, sorted);\r
int i = 0;\r
+ // construct array with all sources listed\r
+ srcs = new String[sorted.length + dassrc.size()];\r
for (int j = sorted.length - 1; j >= 0; j--, i++)\r
{\r
srcs[i] = ((String[]) sorted[j])[0];\r
+ "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to <DBNAME> and retrieve <ACCNO> from it.";\r
if (argv != null && argv.length > 0)\r
{\r
- DbSourceProxy sp = new SequenceFetcher().getSourceProxy(argv[0]);\r
- if (sp != null)\r
+ List<DbSourceProxy> sps = new SequenceFetcher()\r
+ .getSourceProxy(argv[0]);\r
+\r
+ if (sps != null)\r
{\r
- AlignmentI al = null;\r
- try\r
- {\r
- al = sp.getSequenceRecords(argv[1]);\r
- } catch (Exception e)\r
+ for (DbSourceProxy sp : sps)\r
{\r
- e.printStackTrace();\r
- System.err.println("Error when retrieving " + argv[1] + " from "\r
- + argv[0] + "\nUsage: " + usage);\r
- }\r
- SequenceI[] prod = al.getSequencesArray();\r
- if (al != null)\r
- {\r
- for (int p = 0; p < prod.length; p++)\r
+ AlignmentI al = null;\r
+ try\r
+ {\r
+ al = sp.getSequenceRecords(argv[1]);\r
+ } catch (Exception e)\r
{\r
- System.out.println("Prod " + p + ": "\r
- + prod[p].getDisplayId(true) + " : "\r
- + prod[p].getDescription());\r
+ e.printStackTrace();\r
+ System.err.println("Error when retrieving " + argv[1]\r
+ + " from " + argv[0] + "\nUsage: " + usage);\r
+ }\r
+ SequenceI[] prod = al.getSequencesArray();\r
+ if (al != null)\r
+ {\r
+ for (int p = 0; p < prod.length; p++)\r
+ {\r
+ System.out.println("Prod " + p + ": "\r
+ + prod[p].getDisplayId(true) + " : "\r
+ + prod[p].getDescription());\r
+ }\r
}\r
}\r
return;\r
+ new SequenceFetcher().getSupportedDb());\r
}\r
System.out.println(usage);\r
+ return;\r
}\r
ASequenceFetcher sfetcher = new SequenceFetcher();\r
String[] dbSources = sfetcher.getSupportedDb();\r
// skip me\r
if (db.equals(DBRefSource.PDB))\r
continue;\r
- DbSourceProxy sp = sfetcher.getSourceProxy(db);\r
- System.out.println("Source: " + sp.getDbName() + " (" + db\r
- + "): retrieving test:" + sp.getTestQuery());\r
- AlignmentI al = null;\r
- try\r
+ for (DbSourceProxy sp : sfetcher.getSourceProxy(db))\r
{\r
- al = sp.getSequenceRecords(sp.getTestQuery());\r
- if (al != null && al.getHeight() > 0\r
- && sp.getDbSourceProperties() != null)\r
+ System.out.println("Source: " + sp.getDbName() + " (" + db\r
+ + "): retrieving test:" + sp.getTestQuery());\r
+ AlignmentI al = null;\r
+ try\r
{\r
- boolean dna = sp.getDbSourceProperties().containsKey(\r
- DBRefSource.DNACODINGSEQDB)\r
- || sp.getDbSourceProperties().containsKey(\r
- DBRefSource.DNASEQDB)\r
- || sp.getDbSourceProperties().containsKey(\r
- DBRefSource.CODINGSEQDB);\r
- // try and find products\r
- String types[] = jalview.analysis.CrossRef.findSequenceXrefTypes(\r
- dna, al.getSequencesArray());\r
- if (types != null)\r
+ al = sp.getSequenceRecords(sp.getTestQuery());\r
+ if (al != null && al.getHeight() > 0\r
+ && sp.getDbSourceProperties() != null)\r
{\r
- System.out.println("Xref Types for: " + (dna ? "dna" : "prot"));\r
- for (int t = 0; t < types.length; t++)\r
+ boolean dna = sp.getDbSourceProperties().containsKey(\r
+ DBRefSource.DNACODINGSEQDB)\r
+ || sp.getDbSourceProperties().containsKey(\r
+ DBRefSource.DNASEQDB)\r
+ || sp.getDbSourceProperties().containsKey(\r
+ DBRefSource.CODINGSEQDB);\r
+ // try and find products\r
+ String types[] = jalview.analysis.CrossRef\r
+ .findSequenceXrefTypes(dna, al.getSequencesArray());\r
+ if (types != null)\r
{\r
- System.out.println("Type: " + types[t]);\r
- SequenceI[] prod = jalview.analysis.CrossRef\r
- .findXrefSequences(al.getSequencesArray(), dna,\r
- types[t]).getSequencesArray();\r
- System.out.println("Found "\r
- + ((prod == null) ? "no" : "" + prod.length)\r
- + " products");\r
- if (prod != null)\r
+ System.out.println("Xref Types for: "\r
+ + (dna ? "dna" : "prot"));\r
+ for (int t = 0; t < types.length; t++)\r
{\r
- for (int p = 0; p < prod.length; p++)\r
+ System.out.println("Type: " + types[t]);\r
+ SequenceI[] prod = jalview.analysis.CrossRef\r
+ .findXrefSequences(al.getSequencesArray(), dna,\r
+ types[t]).getSequencesArray();\r
+ System.out.println("Found "\r
+ + ((prod == null) ? "no" : "" + prod.length)\r
+ + " products");\r
+ if (prod != null)\r
{\r
- System.out.println("Prod " + p + ": "\r
- + prod[p].getDisplayId(true));\r
+ for (int p = 0; p < prod.length; p++)\r
+ {\r
+ System.out.println("Prod " + p + ": "\r
+ + prod[p].getDisplayId(true));\r
+ }\r
}\r
}\r
}\r
+ else\r
+ {\r
+ noProds.addElement((dna ? new Object[]\r
+ { al, al } : new Object[]\r
+ { al }));\r
+ }\r
+\r
}\r
- else\r
- {\r
- noProds.addElement((dna ? new Object[]\r
- { al, al } : new Object[]\r
- { al }));\r
- }\r
+ } catch (Exception ex)\r
+ {\r
+ System.out.println("ERROR:Failed to retrieve test query.");\r
+ ex.printStackTrace(System.out);\r
+ }\r
\r
+ if (al == null)\r
+ {\r
+ System.out.println("ERROR:No alignment retrieved.");\r
+ StringBuffer raw = sp.getRawRecords();\r
+ if (raw != null)\r
+ System.out.println(raw.toString());\r
+ else\r
+ System.out.println("ERROR:No Raw results.");\r
}\r
- } catch (Exception ex)\r
- {\r
- System.out.println("ERROR:Failed to retrieve test query.");\r
- ex.printStackTrace(System.out);\r
- }\r
- if (al == null)\r
- {\r
- System.out.println("ERROR:No alignment retrieved.");\r
- StringBuffer raw = sp.getRawRecords();\r
- if (raw != null)\r
- System.out.println(raw.toString());\r
else\r
- System.out.println("ERROR:No Raw results.");\r
- }\r
- else\r
- {\r
- System.out.println("Retrieved " + al.getHeight() + " sequences.");\r
- for (int s = 0; s < al.getHeight(); s++)\r
{\r
- SequenceI sq = al.getSequenceAt(s);\r
- while (sq.getDatasetSequence() != null)\r
+ System.out.println("Retrieved " + al.getHeight() + " sequences.");\r
+ for (int s = 0; s < al.getHeight(); s++)\r
{\r
- sq = sq.getDatasetSequence();\r
+ SequenceI sq = al.getSequenceAt(s);\r
+ while (sq.getDatasetSequence() != null)\r
+ {\r
+ sq = sq.getDatasetSequence();\r
\r
- }\r
- if (ds == null)\r
- {\r
- ds = new Alignment(new SequenceI[]\r
- { sq });\r
+ }\r
+ if (ds == null)\r
+ {\r
+ ds = new Alignment(new SequenceI[]\r
+ { sq });\r
\r
- }\r
- else\r
- {\r
- ds.addSequence(sq);\r
+ }\r
+ else\r
+ {\r
+ ds.addSequence(sq);\r
+ }\r
}\r
}\r
- }\r
- System.out.flush();\r
- System.err.flush();\r
-\r
- }\r
- if (noProds.size() > 0)\r
- {\r
- Enumeration ts = noProds.elements();\r
- while (ts.hasMoreElements())\r
+ System.out.flush();\r
+ System.err.flush();\r
\r
+ }\r
+ if (noProds.size() > 0)\r
{\r
- Object[] typeSq = (Object[]) ts.nextElement();\r
- boolean dna = (typeSq.length > 1);\r
- AlignmentI al = (AlignmentI) typeSq[0];\r
- System.out.println("Trying getProducts for "\r
- + al.getSequenceAt(0).getDisplayId(true));\r
- System.out.println("Search DS Xref for: " + (dna ? "dna" : "prot"));\r
- // have a bash at finding the products amongst all the retrieved\r
- // sequences.\r
- SequenceI[] seqs = al.getSequencesArray();\r
- Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(\r
- seqs, dna, null, ds);\r
- System.out.println("Found "\r
- + ((prodal == null) ? "no" : "" + prodal.getHeight())\r
- + " products");\r
- if (prodal != null)\r
+ Enumeration ts = noProds.elements();\r
+ while (ts.hasMoreElements())\r
+\r
{\r
- SequenceI[] prod = prodal.getSequencesArray(); // note\r
- // should\r
- // test\r
- // rather\r
- // than\r
- // throw\r
- // away\r
- // codon\r
- // mapping\r
- // (if\r
- // present)\r
- for (int p = 0; p < prod.length; p++)\r
+ Object[] typeSq = (Object[]) ts.nextElement();\r
+ boolean dna = (typeSq.length > 1);\r
+ AlignmentI al = (AlignmentI) typeSq[0];\r
+ System.out.println("Trying getProducts for "\r
+ + al.getSequenceAt(0).getDisplayId(true));\r
+ System.out.println("Search DS Xref for: "\r
+ + (dna ? "dna" : "prot"));\r
+ // have a bash at finding the products amongst all the retrieved\r
+ // sequences.\r
+ SequenceI[] seqs = al.getSequencesArray();\r
+ Alignment prodal = jalview.analysis.CrossRef.findXrefSequences(\r
+ seqs, dna, null, ds);\r
+ System.out.println("Found "\r
+ + ((prodal == null) ? "no" : "" + prodal.getHeight())\r
+ + " products");\r
+ if (prodal != null)\r
{\r
- System.out.println("Prod " + p + ": "\r
- + prod[p].getDisplayId(true));\r
+ SequenceI[] prod = prodal.getSequencesArray(); // note\r
+ // should\r
+ // test\r
+ // rather\r
+ // than\r
+ // throw\r
+ // away\r
+ // codon\r
+ // mapping\r
+ // (if\r
+ // present)\r
+ for (int p = 0; p < prod.length; p++)\r
+ {\r
+ System.out.println("Prod " + p + ": "\r
+ + prod[p].getDisplayId(true));\r
+ }\r
}\r
}\r
+\r
}\r
\r
}\r
*/\r
public void registerDasSequenceSources()\r
{\r
- DasSource[] sources = jalview.ws.DasSequenceFeatureFetcher\r
- .getDASSources();\r
- if (sources != null)\r
- {\r
- for (int s = 0; sources != null && s < sources.length; s++)\r
- {\r
- addDasSequenceSource(sources[s]);\r
- }\r
- }\r
-\r
- Vector localsources = jalview.bin.Cache.getLocalDasSources();\r
- if (localsources != null)\r
- {\r
- for (Enumeration ls = localsources.elements(); ls.hasMoreElements();)\r
- {\r
- addDasSequenceSource((DasSource) ls.nextElement());\r
- }\r
- }\r
- }\r
-\r
- /**\r
- * Try to create and add a DasSequenceSource to the list of sources.\r
- * \r
- * @param source\r
- * @return null if no source was added, or the new DasSequenceSource created\r
- */\r
- DasSequenceSource addDasSequenceSource(DasSource source)\r
- {\r
- DasSequenceSource ds = null;\r
- Das1Source d1s = null;\r
- if (source.hasCapability("sequence"))\r
- {\r
- if (source instanceof Das2Source)\r
- {\r
- if (((Das2Source) source).hasDas1Capabilities())\r
- {\r
- try\r
- {\r
- d1s = org.biojava.dasobert.das2.DasSourceConverter\r
- .toDas1Source((Das2Source) source);\r
- } catch (Exception e)\r
- {\r
- System.err.println("Ignoring DAS2 sequence source "\r
- + source.getNickname()\r
- + " - couldn't map to Das1Source.\n");\r
- e.printStackTrace();\r
- }\r
- }\r
- }\r
- else\r
- {\r
- if (source instanceof Das1Source)\r
- {\r
- d1s = (Das1Source) source;\r
- }\r
- }\r
- }\r
- if (d1s != null)\r
+ // TODO: define a context as a registry provider (either desktop,\r
+ // jalview.bin.cache, or something else).\r
+ for (jalviewSourceI source : jalview.bin.Cache.getDasSourceRegistry()\r
+ .getSources())\r
{\r
- DasCoordinateSystem[] css = d1s.getCoordinateSystem();\r
- if (css == null || css.length == 0)\r
+ if (source.isSequenceSource())\r
{\r
- // TODO: query das source directly to identify coordinate system... or\r
- // have to make up a coordinate system\r
- css = new DasCoordinateSystem[]\r
- { new DasCoordinateSystem() };\r
- css[0].setName(d1s.getNickname());\r
- css[0].setUniqueId(d1s.getNickname());\r
- }\r
- for (int c = 0; c < css.length; c++)\r
- {\r
- try\r
+ List<DbSourceProxy> dassources = source.getSequenceSourceProxies();\r
+ for (DbSourceProxy seqsrc : dassources)\r
{\r
- addDbRefSourceImpl(ds = new DasSequenceSource("das:"\r
- + d1s.getNickname() + " (" + css[c].getName() + ")",\r
- css[c].getName(), d1s, css[c]));\r
- } catch (Exception e)\r
- {\r
- System.err.println("Ignoring sequence coord system " + c + " ("\r
- + css[c].getName() + ") for source " + d1s.getNickname()\r
- + "- threw exception when constructing fetcher.\n");\r
- e.printStackTrace();\r
+ addDbRefSourceImpl(seqsrc);\r
}\r
}\r
}\r
- return ds;\r
}\r
+\r
}\r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
+++ /dev/null
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources;\r
-\r
-import java.util.Hashtable;\r
-\r
-import org.biojava.dasobert.das.SequenceThread;\r
-import org.biojava.dasobert.das2.Das2Source;\r
-import org.biojava.dasobert.dasregistry.Das1Source;\r
-import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
-import org.biojava.dasobert.dasregistry.DasSource;\r
-import org.biojava.dasobert.eventmodel.SequenceEvent;\r
-import org.biojava.dasobert.eventmodel.SequenceListener;\r
-\r
-import com.stevesoft.pat.Regex;\r
-\r
-import jalview.ws.dbsources.das.DasSequenceSourceListener;\r
-import jalview.ws.seqfetcher.*;\r
-import jalview.datamodel.AlignmentI;\r
-\r
-/**\r
- * an instance of this class is created for each unique DAS Sequence source (ie\r
- * one capable of handling the 'sequence' for a particular MapMaster)\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DasSequenceSource extends DbSourceProxyImpl implements\r
- DbSourceProxy\r
-{\r
- protected Das1Source source = null;\r
-\r
- protected String dbname = "DASCS";\r
-\r
- protected String dbrefname = "das:source";\r
-\r
- protected DasCoordinateSystem coordsys = null;\r
-\r
- /**\r
- * create a new DbSource proxy for a DAS 1 source\r
- * \r
- * @param dbnbame\r
- * Human Readable Name to use when fetching from this source\r
- * @param dbrefname\r
- * DbRefName for DbRefs attached to sequences retrieved from this\r
- * source\r
- * @param source\r
- * Das1Source\r
- * @param coordsys\r
- * specific coordinate system to use for this source\r
- * @throws Exception\r
- * if source is not capable of the 'sequence' command\r
- */\r
- public DasSequenceSource(String dbname, String dbrefname,\r
- Das1Source source, DasCoordinateSystem coordsys) throws Exception\r
- {\r
- if (!source.hasCapability("sequence"))\r
- {\r
- throw new Exception("Source " + source.getNickname()\r
- + " does not support the sequence command.");\r
- }\r
- this.source = source;\r
- this.dbname = dbname;\r
- this.dbrefname = dbrefname;\r
- this.coordsys = coordsys;\r
- }\r
-\r
- public String getAccessionSeparator()\r
- {\r
- // cope with single sequences only\r
- return null;\r
- }\r
-\r
- public Regex getAccessionValidator()\r
- {\r
- /** ? * */\r
- return Regex.perlCode("\\S+");\r
- }\r
-\r
- public String getDbName()\r
- {\r
- // TODO: map to\r
- return dbname + " (DAS)";\r
- }\r
-\r
- public String getDbSource()\r
- {\r
- return dbrefname;\r
- }\r
-\r
- public String getDbVersion()\r
- {\r
- return coordsys.getVersion();\r
- }\r
-\r
- public AlignmentI getSequenceRecords(String queries) throws Exception\r
- {\r
- SequenceThread seqfetcher = new org.biojava.dasobert.das.SequenceThread(\r
- queries, source);\r
- DasSequenceSourceListener ourlistener = new DasSequenceSourceListener(\r
- this, queries);\r
- seqfetcher.addSequenceListener(ourlistener);\r
- seqfetcher.start();\r
- try\r
- {\r
- Thread.sleep(5);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- while (ourlistener.isNotCalled() && seqfetcher.isAlive())\r
- {\r
- try\r
- {\r
- Thread.sleep(5);\r
- } catch (Exception e)\r
- {\r
- }\r
- ;\r
- }\r
- if (ourlistener.isNotCalled() || ourlistener.hasNoSequences())\r
- {\r
- System.err.println("Sequence Query to " + source.getNickname()\r
- + " with '" + queries + "' returned no sequences.");\r
- return null;\r
- }\r
- else\r
- {\r
- return ourlistener.getSequences();\r
- }\r
- }\r
-\r
- public String getTestQuery()\r
- {\r
- return coordsys.getTestCode();\r
- }\r
-\r
- public boolean isValidReference(String accession)\r
- {\r
- // TODO try to validate an accession against source\r
- // We don't really know how to do this without querying source\r
-\r
- return true;\r
- }\r
-\r
- /**\r
- * @return the source\r
- */\r
- public Das1Source getSource()\r
- {\r
- return source;\r
- }\r
-\r
- /**\r
- * @return the coordsys\r
- */\r
- public DasCoordinateSystem getCoordsys()\r
- {\r
- return coordsys;\r
- }\r
-}\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* @author JimP\r
* \r
*/\r
-abstract public class Pfam extends DbSourceProxyImpl implements\r
+abstract public class Pfam extends Xfam implements\r
DbSourceProxy\r
{\r
\r
* \r
* @see jalview.ws.DbSourceProxy#getDbVersion()\r
*/\r
- public String getDbVersion()\r
+ @Override\r
+public String getDbVersion()\r
{\r
// TODO Auto-generated method stub\r
return null;\r
}\r
\r
- /**\r
+ /**Returns base URL for selected Pfam alignment type\r
* \r
* @return PFAM URL stub for this DbSource\r
*/\r
- protected abstract String getPFAMURL();\r
+ @Override\r
+protected abstract String getXFAMURL();\r
\r
/*\r
* (non-Javadoc)\r
// individual references to each sequence in each family alignment that's\r
// retrieved.\r
startQuery();\r
- AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getPFAMURL()\r
+ AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()\r
+ queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,\r
"STH");\r
for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)\r
/*\r
* public String getDbName() { return "PFAM"; // getDbSource(); }\r
*/\r
+ \r
+ \r
+ public String getXfamSource() { return jalview.datamodel.DBRefSource.PFAM; }\r
+ \r
+ \r
}\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* \r
* @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
*/\r
- protected String getPFAMURL()\r
+ protected String getXFAMURL()\r
{\r
return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=full&format=stockholm&order=t&case=l&gaps=default&entry=";\r
}\r
return "PF03760";\r
}\r
\r
+public String getDbVersion() {\r
+ return null;\r
+}\r
+\r
}\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* \r
* @see jalview.ws.dbsources.Pfam#getPFAMURL()\r
*/\r
- protected String getPFAMURL()\r
+ protected String getXFAMURL()\r
{\r
return "http://pfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&format=stockholm&order=t&case=l&gaps=default&entry=";\r
}\r
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import com.stevesoft.pat.Regex;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * Contains methods for fetching sequences from Rfam database
+ *
+ * @author Lauren Michelle Lui
+ */
+abstract public class Rfam extends Xfam implements DbSourceProxy
+{
+
+ public Rfam()
+ {
+ super();
+ // all extensions of this RFAM source base class are DOMAINDB sources
+ addDbSourceProperty(jalview.datamodel.DBRefSource.DOMAINDB);
+ addDbSourceProperty(jalview.datamodel.DBRefSource.ALIGNMENTDB);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionSeparator() Left here for
+ * consistency with Pfam class
+ */
+ public String getAccessionSeparator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getAccessionValidator() * Left here for
+ */
+ public Regex getAccessionValidator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * Left here for consistency with Pfam class
+ *
+ * @see jalview.ws.DbSourceProxy#getDbSource() public String getDbSource() { *
+ * this doesn't work - DbSource is key for the hash of DbSourceProxy instances
+ * - 1:many mapping for DbSource to proxy will be lost. * suggest : RFAM is an
+ * 'alignment' source - means proxy is higher level than a sequence source.
+ * return jalview.datamodel.DBRefSource.RFAM; }
+ */
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#getDbVersion()
+ */
+ @Override
+ public String getDbVersion()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**Returns base URL for selected Rfam alignment type
+ *
+ * @return RFAM URL stub for this DbSource
+ */
+ @Override
+ protected abstract String getXFAMURL();
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.DbSourceProxy#isValidReference(java.lang.String)
+ */
+ public boolean isValidReference(String accession)
+ {
+ return accession.indexOf("RF") == 0;
+ }
+
+ /* (non-Javadoc)
+ * @see jalview.ws.dbsources.Xfam#getXfamSource()
+ */
+ public String getXfamSource()
+ {
+ return jalview.datamodel.DBRefSource.RFAM;
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * Flyweight class specifying retrieval of Full family alignments from RFAM
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RfamFull extends Rfam implements DbSourceProxy
+{
+ public RfamFull()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Rfam#getXFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=full&nseLabels=0&format=stockholm&acc=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "RFAM (Full)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ // Can be retrieved from http://rfam.janelia.org/cgi-bin/getdesc?acc=RF00014
+ // or
+ // http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=full&nseLabels=0&format=stockholm&acc=RF00014
+ return "RF00014";
+ }
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+}
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+/**
+ * Flyweight class specifying retrieval of Seed family alignments from RFAM
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public class RfamSeed extends Rfam implements DbSourceProxy
+{
+ public RfamSeed()
+ {
+ super();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.dbsources.Rfam#getRFAMURL()
+ */
+ protected String getXFAMURL()
+ {
+ return "http://rfam.sanger.ac.uk/family/alignment/download/format?alnType=seed&nseLabels=0&format=stockholm&acc=";
+ // Janelia Farms url
+ // "http://rfam.janelia.org/cgi-bin/getalignment?type=seed&fmt=stockholm&acc=";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.seqfetcher.DbSourceProxy#getDbName()
+ */
+ public String getDbName()
+ {
+ return "RFAM (Seed)";
+ }
+
+ public String getDbSource()
+ {
+ return getDbName(); // so we have unique DbSource string.
+ }
+
+ public String getTestQuery()
+ {
+ return "RF00014";
+ } // http://rfam.janelia.org/cgi-bin/getdesc?acc=RF00014
+
+ public String getDbVersion()
+ {
+ return null;
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ */
+package jalview.ws.dbsources;
+
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.DBRefEntry;
+import jalview.ws.seqfetcher.DbSourceProxyImpl;
+
+/**
+ * Acts as a superclass for the Rfam and Pfam classes
+ *
+ * @author Lauren Michelle Lui
+ *
+ */
+public abstract class Xfam extends DbSourceProxyImpl
+{
+
+ public Xfam()
+ {
+ super();
+ }
+
+ protected abstract String getXFAMURL();
+
+ public abstract String getDbVersion();
+
+ abstract String getXfamSource();
+
+ public AlignmentI getSequenceRecords(String queries) throws Exception
+ {
+ // TODO: this is not a perfect implementation. We need to be able to add
+ // individual references to each sequence in each family alignment that's
+ // retrieved.
+ startQuery();
+ // TODO: trap HTTP 404 exceptions and return null
+ AlignmentI rcds = new jalview.io.FormatAdapter().readFile(getXFAMURL()
+ + queries.trim().toUpperCase(), jalview.io.FormatAdapter.URL,
+ "STH");
+ for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
+ {
+ rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getXfamSource(),
+ // getDbSource(),
+ getDbVersion(), queries.trim().toUpperCase()));
+ if (!getDbSource().equals(getXfamSource()))
+ { // add the specific ref too
+ rcds.getSequenceAt(s).addDBRef(
+ new DBRefEntry(getDbSource(), getDbVersion(), queries
+ .trim().toUpperCase()));
+ }
+ }
+ stopQuery();
+ return rcds;
+ }
+
+}
\ No newline at end of file
+++ /dev/null
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
- * \r
- * This file is part of Jalview.\r
- * \r
- * Jalview is free software: you can redistribute it and/or\r
- * modify it under the terms of the GNU General Public License \r
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
- * \r
- * Jalview is distributed in the hope that it will be useful, but \r
- * WITHOUT ANY WARRANTY; without even the implied warranty \r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
- * PURPOSE. See the GNU General Public License for more details.\r
- * \r
- * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
- */\r
-package jalview.ws.dbsources.das;\r
-\r
-import jalview.datamodel.AlignmentI;\r
-import jalview.datamodel.Alignment;\r
-import jalview.datamodel.DBRefEntry;\r
-import jalview.datamodel.Sequence;\r
-import jalview.datamodel.SequenceI;\r
-import jalview.ws.dbsources.DasSequenceSource;\r
-\r
-import org.biojava.dasobert.eventmodel.SequenceEvent;\r
-import org.biojava.dasobert.eventmodel.SequenceListener;\r
-\r
-/**\r
- * Listen for sequence fetch events from a dasobert SequenceThread started with\r
- * a query string and collect sequences returned from the DAS sequence source.\r
- * \r
- * @author JimP\r
- * \r
- */\r
-public class DasSequenceSourceListener implements SequenceListener\r
-{\r
-\r
- String ourAccession = null;\r
-\r
- DasSequenceSource oursource = null;\r
-\r
- /**\r
- * \r
- * @param source\r
- * the DAS Sequence DbProxy object containing database details for\r
- * this source\r
- * @param query\r
- * the query string sent to the das source that we should be\r
- * listening for.\r
- */\r
- public DasSequenceSourceListener(DasSequenceSource source, String query)\r
- {\r
- oursource = source;\r
- ourAccession = query;\r
- }\r
-\r
- public void clearSelection()\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- java.util.Vector seqs = null;\r
-\r
- public void newSequence(SequenceEvent e)\r
- {\r
- if (!e.getAccessionCode().equals(ourAccession))\r
- {\r
- System.err\r
- .println("Warning - received sequence event for strange accession code ("\r
- + e.getAccessionCode()\r
- + ") - we expected "\r
- + ourAccession);\r
-\r
- return;\r
- }\r
- if (seqs == null)\r
- {\r
- if (e.getSequence().length() == 0)\r
- {\r
- System.err.println("Empty sequence returned for accession code ("\r
- + e.getAccessionCode() + ") from " + oursource.getDbName());\r
- called = true;\r
- noSequences = true;\r
- return;\r
- }\r
- seqs = new java.util.Vector();\r
- }\r
- Sequence sq = new Sequence(e.getAccessionCode(), e.getSequence());\r
- sq.addDBRef(new DBRefEntry(oursource.getDbSource(), oursource\r
- .getDbVersion() + ":" + e.getVersion(), e.getAccessionCode()));\r
- seqs.addElement(sq);\r
- called = true;\r
- }\r
-\r
- public void selectedSeqPosition(int position)\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void selectedSeqRange(int start, int end)\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void selectionLocked(boolean flag)\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- public void newObjectRequested(String accessionCode)\r
- {\r
- // TODO Auto-generated method stub\r
-\r
- }\r
-\r
- boolean noSequences = false;\r
-\r
- public void noObjectFound(String accessionCode)\r
- {\r
- if (accessionCode.equals(ourAccession))\r
- {\r
- noSequences = true;\r
- called = true;\r
- }\r
- }\r
-\r
- public boolean hasNoSequences()\r
- {\r
- return noSequences;\r
- }\r
-\r
- boolean called = false;\r
-\r
- public boolean isNotCalled()\r
- {\r
- return !called;\r
- }\r
-\r
- public AlignmentI getSequences()\r
- {\r
- if (noSequences || seqs != null && seqs.size() == 0)\r
- return null;\r
- SequenceI[] sqs = new SequenceI[seqs.size()];\r
- for (int i = 0, iSize = seqs.size(); i < iSize; i++)\r
- {\r
- sqs[i] = (SequenceI) seqs.elementAt(i);\r
- }\r
- Alignment al = new Alignment(sqs);\r
- if (oursource.getSource().hasCapability("features"))\r
- {\r
- java.util.Vector src = new java.util.Vector();\r
- src.addElement(oursource.getSource());\r
- new jalview.ws.DasSequenceFeatureFetcher(sqs, null, src, false, false);\r
- }\r
-\r
- return al;\r
- }\r
-\r
-}\r
--- /dev/null
+package jalview.ws.dbsources.das.api;
+
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.schema.sources.SOURCE;
+
+/**
+ * API for a registry that provides datasources that jalview can access
+ * @author jprocter
+ *
+ */
+public interface DasSourceRegistryI
+{
+
+ List<jalviewSourceI> getSources();
+
+ String getDasRegistryURL();
+
+ jalviewSourceI getSource(String nickname);
+
+ //TODO: re JAL-424 - introduce form where local source is queried for metadata, rather than have it all provided by caller.
+ jalviewSourceI createLocalSource(String uri, String name, boolean sequence,
+ boolean features);
+ boolean removeLocalSource(jalviewSourceI source);
+
+ void refreshSources();
+
+ String getLocalSourceString();
+
+ List<jalviewSourceI> resolveSourceNicknames(List<String> sources);
+ // TODO: refactor to jDAS specific interface
+ MultipleConnectionPropertyProviderI getSessionHandler();
+}
--- /dev/null
+package jalview.ws.dbsources.das.api;
+
+import java.util.List;
+
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+import org.biodas.jdas.schema.sources.MAINTAINER;
+import org.biodas.jdas.schema.sources.VERSION;
+
+public interface jalviewSourceI
+{
+
+ String getTitle();
+
+ VERSION getVersion();
+
+ String getDocHref();
+
+ String getDescription();
+
+ String getUri();
+
+ MAINTAINER getMAINTAINER();
+
+ String getEmail();
+
+ boolean isLocal();
+
+ boolean isSequenceSource();
+
+ String[] getCapabilityList(VERSION v);
+
+ String[] getLabelsFor(VERSION v);
+
+ /**
+ *
+ * @return null if not a sequence source, otherwise a series of database sources that can be used to retrieve sequence data for particular database coordinate systems
+ */
+ List<DbSourceProxy> getSequenceSourceProxies();
+
+ boolean isFeatureSource();
+
+ /**
+ * returns the base URL for the latest version of a source's DAS endpoint set
+ * @return
+ */
+ String getSourceURL();
+
+ /**
+ * test to see if this source's latest version is older than the given source
+ * @param jalviewSourceI
+ * @return true if newer than given source
+ */
+ boolean isNewerThan(jalviewSourceI jalviewSourceI);
+
+}
--- /dev/null
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * \r
+ * This file is part of Jalview.\r
+ * \r
+ * Jalview is free software: you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License \r
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\r
+ * \r
+ * Jalview is distributed in the hope that it will be useful, but \r
+ * WITHOUT ANY WARRANTY; without even the implied warranty \r
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR \r
+ * PURPOSE. See the GNU General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.\r
+ */\r
+package jalview.ws.dbsources.das.datamodel;\r
+\r
+import java.util.ArrayList;\r
+import java.util.Arrays;\r
+import java.util.HashMap;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.StringTokenizer;\r
+import java.util.Vector;\r
+\r
+import org.biodas.jdas.client.ConnectionPropertyProviderI;\r
+import org.biodas.jdas.client.SequenceClient;\r
+import org.biodas.jdas.client.adapters.sequence.DasSequenceAdapter;\r
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;\r
+import org.biodas.jdas.client.threads.SequenceClientMultipleSources;\r
+import org.biodas.jdas.schema.sequence.SEQUENCE;\r
+import org.biodas.jdas.schema.sources.COORDINATES;\r
+import org.biodas.jdas.schema.sources.SOURCE;\r
+import org.biodas.jdas.schema.sources.VERSION;\r
+\r
+import com.stevesoft.pat.Regex;\r
+\r
+import jalview.ws.dbsources.das.api.jalviewSourceI;\r
+import jalview.ws.seqfetcher.*;\r
+import jalview.bin.Cache;\r
+import jalview.datamodel.Alignment;\r
+import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.DBRefEntry;\r
+import jalview.datamodel.Sequence;\r
+import jalview.datamodel.SequenceI;\r
+\r
+/**\r
+ * an instance of this class is created for each unique DAS Sequence source (ie\r
+ * one capable of handling the 'sequence' for a particular MapMaster)\r
+ * \r
+ * @author JimP\r
+ * \r
+ */\r
+public class DasSequenceSource extends DbSourceProxyImpl implements\r
+ DbSourceProxy\r
+{\r
+ private jalviewSourceI jsrc;\r
+\r
+ protected SOURCE source = null;\r
+\r
+ protected VERSION version = null;\r
+\r
+ protected COORDINATES coordsys = null;\r
+\r
+ protected String dbname = "DASCS";\r
+\r
+ protected String dbrefname = "das:source";\r
+ protected MultipleConnectionPropertyProviderI connprops=null;\r
+ /**\r
+ * create a new DbSource proxy for a DAS 1 source\r
+ * \r
+ * @param dbnbame\r
+ * Human Readable Name to use when fetching from this source\r
+ * @param dbrefname\r
+ * DbRefName for DbRefs attached to sequences retrieved from this\r
+ * source\r
+ * @param source\r
+ * Das1Source\r
+ * @param coordsys\r
+ * specific coordinate system to use for this source\r
+ * @throws Exception\r
+ * if source is not capable of the 'sequence' command\r
+ */\r
+ public DasSequenceSource(String dbname, String dbrefname, SOURCE source,\r
+ VERSION version, COORDINATES coordsys, MultipleConnectionPropertyProviderI connprops) throws Exception\r
+ {\r
+ if (!(jsrc = new JalviewSource(source, connprops, false)).isSequenceSource())\r
+ {\r
+ throw new Exception("Source " + source.getTitle()\r
+ + " does not support the sequence command.");\r
+ }\r
+ this.source = source;\r
+ this.dbname = dbname;\r
+ this.dbrefname = dbrefname;\r
+ if (coordsys!=null ) {\r
+ this.coordsys = coordsys;\r
+ }\r
+ this.connprops=connprops;\r
+ }\r
+\r
+ public String getAccessionSeparator()\r
+ {\r
+ return "\t";\r
+ }\r
+\r
+ public Regex getAccessionValidator()\r
+ {\r
+ /** ? * */\r
+ return Regex.perlCode("\\S+");\r
+ }\r
+\r
+ public String getDbName()\r
+ {\r
+ // TODO: map to\r
+ return dbname + " (DAS)";\r
+ }\r
+\r
+ public String getDbSource()\r
+ {\r
+ return dbrefname;\r
+ }\r
+\r
+ public String getDbVersion()\r
+ {\r
+ return coordsys!=null ? coordsys.getVersion() : "";\r
+ }\r
+\r
+ public AlignmentI getSequenceRecords(String queries) throws Exception\r
+ {\r
+ StringTokenizer st = new StringTokenizer(queries, "\t");\r
+ List<String> toks = new ArrayList<String>(), src = new ArrayList<String>(), acIds = new ArrayList<String>();\r
+ while (st.hasMoreTokens())\r
+ {\r
+ String t;\r
+ toks.add(t = st.nextToken());\r
+ acIds.add(t.replaceAll(":[0-9,]+", ""));\r
+ }\r
+ src.add(jsrc.getSourceURL());\r
+ Map<String, Map<List<String>, DasSequenceAdapter>> resultset = new HashMap<String, Map<List<String>, DasSequenceAdapter>>();\r
+ Map<String, Map<List<String>, Exception>> errors = new HashMap<String, Map<List<String>, Exception>>();\r
+ \r
+ // First try multiple sources\r
+ boolean multiple = true, retry = false;\r
+ do\r
+ {\r
+ if (!multiple)\r
+ {\r
+ retry = false;\r
+ // slow, fetch one at a time.\r
+ for (String sr : src)\r
+ {\r
+ System.err\r
+ .println("Retrieving IDs individually from das source: "\r
+ + sr);\r
+ org.biodas.jdas.client.SequenceClient sq = new SequenceClient(connprops.getConnectionPropertyProviderFor(sr));\r
+ for (String q : toks)\r
+ {\r
+ List<String> qset = Arrays.asList(new String[]\r
+ { q });\r
+ try\r
+ {\r
+ DasSequenceAdapter s = sq.fetchData(sr, qset);\r
+ Map<List<String>, DasSequenceAdapter> dss = resultset.get(sr);\r
+ if (dss == null)\r
+ {\r
+ resultset\r
+ .put(sr,\r
+ dss = new HashMap<List<String>, DasSequenceAdapter>());\r
+ }\r
+ dss.put(qset, s);\r
+ } catch (Exception x)\r
+ {\r
+ Map<List<String>, Exception> ers = errors.get(sr);\r
+ if (ers == null)\r
+ {\r
+ errors.put(sr, ers = new HashMap<List<String>, Exception>());\r
+ }\r
+ ers.put(qset, x);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ else\r
+ {\r
+ SequenceClientMultipleSources sclient;\r
+ sclient = new SequenceClientMultipleSources();\r
+ sclient.fetchData(src, toks, resultset, errors);\r
+ sclient.shutDown();\r
+ while (!sclient.isTerminated())\r
+ {\r
+ try\r
+ {\r
+ Thread.sleep(200);\r
+\r
+ } catch (InterruptedException x)\r
+ {\r
+ }\r
+ }\r
+ if (resultset.isEmpty() && !errors.isEmpty())\r
+ {\r
+ retry = true;\r
+ multiple = false;\r
+ }\r
+ }\r
+ } while (retry);\r
+\r
+ if (resultset.isEmpty())\r
+ {\r
+ System.err.println("Sequence Query to " + jsrc.getTitle() + " with '"\r
+ + queries + "' returned no sequences.");\r
+ return null;\r
+ }\r
+ else\r
+ {\r
+ Vector<SequenceI> seqs = null;\r
+ for (Map.Entry<String, Map<List<String>, DasSequenceAdapter>> resset : resultset\r
+ .entrySet())\r
+ {\r
+ for (Map.Entry<List<String>, DasSequenceAdapter> result : resset\r
+ .getValue().entrySet())\r
+ {\r
+ DasSequenceAdapter dasseqresp = result.getValue();\r
+ List<String> accessions = result.getKey();\r
+ for (SEQUENCE e : dasseqresp.getSequence())\r
+ {\r
+ String lbl = e.getId();\r
+\r
+ if (acIds.indexOf(lbl) == -1)\r
+ {\r
+ System.err\r
+ .println("Warning - received sequence event for strange accession code ("\r
+ + lbl + ")");\r
+ }\r
+ else\r
+ {\r
+ if (seqs == null)\r
+ {\r
+ if (e.getContent().length() == 0)\r
+ {\r
+ System.err\r
+ .println("Empty sequence returned for accession code ("\r
+ + lbl\r
+ + ") from "\r
+ + resset.getKey()\r
+ + " (source is " + getDbName());\r
+ continue;\r
+ }\r
+ }\r
+ seqs = new java.util.Vector<SequenceI>();\r
+ // JDAS returns a sequence complete with any newlines and spaces\r
+ // in the XML\r
+ Sequence sq = new Sequence(lbl, e.getContent().replaceAll(\r
+ "\\s+", ""));\r
+ sq.addDBRef(new DBRefEntry(getDbSource(), getDbVersion()\r
+ + ":" + e.getVersion(), lbl));\r
+ seqs.addElement(sq);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (seqs == null || seqs.size() == 0)\r
+ return null;\r
+ SequenceI[] sqs = new SequenceI[seqs.size()];\r
+ for (int i = 0, iSize = seqs.size(); i < iSize; i++)\r
+ {\r
+ sqs[i] = (SequenceI) seqs.elementAt(i);\r
+ }\r
+ Alignment al = new Alignment(sqs);\r
+ if (jsrc.isFeatureSource())\r
+ {\r
+ java.util.Vector<jalviewSourceI> srcs = new java.util.Vector<jalviewSourceI>();\r
+ srcs.addElement(jsrc);\r
+ try\r
+ {\r
+ jalview.ws.DasSequenceFeatureFetcher dssf=new jalview.ws.DasSequenceFeatureFetcher(sqs, null, srcs, false,\r
+ false, multiple);\r
+ while (dssf.isRunning())\r
+ {\r
+ try {\r
+ Thread.sleep(200);\r
+ } catch (InterruptedException x)\r
+ {\r
+ \r
+ }\r
+ }\r
+ \r
+ } catch (Exception x)\r
+ {\r
+ Cache.log\r
+ .error("Couldn't retrieve features for sequence from its source.",\r
+ x);\r
+ }\r
+ }\r
+\r
+ return al;\r
+ }\r
+ }\r
+\r
+ public String getTestQuery()\r
+ {\r
+ return coordsys==null ? "" : coordsys.getTestRange();\r
+ }\r
+\r
+ public boolean isValidReference(String accession)\r
+ {\r
+ // TODO try to validate an accession against source\r
+ // We don't really know how to do this without querying source\r
+\r
+ return true;\r
+ }\r
+\r
+ /**\r
+ * @return the source\r
+ */\r
+ public SOURCE getSource()\r
+ {\r
+ return source;\r
+ }\r
+\r
+ /**\r
+ * @return the coordsys\r
+ */\r
+ public COORDINATES getCoordsys()\r
+ {\r
+ return coordsys;\r
+ }\r
+}\r
--- /dev/null
+/**
+ *
+ */
+package jalview.ws.dbsources.das.datamodel;
+
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.swing.JOptionPane;
+
+import org.apache.http.auth.InvalidCredentialsException;
+import org.biodas.jdas.client.ConnectionPropertyProviderI;
+import org.biodas.jdas.client.SourcesClient;
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.dassources.Capabilities;
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.SOURCES;
+import org.biodas.jdas.schema.sources.VERSION;
+
+import jalview.bin.Cache;
+import jalview.ws.dbsources.das.api.DasSourceRegistryI;
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+
+/**
+ *
+ */
+public class DasSourceRegistry implements DasSourceRegistryI,
+ MultipleConnectionPropertyProviderI
+{
+ // private org.biodas.jdas.schema.sources.SOURCE[] dasSources = null;
+ private List<jalviewSourceI> dasSources = null;
+
+ private Hashtable<String, jalviewSourceI> sourceNames = null;
+
+ private Hashtable<String, jalviewSourceI> localSources = null;
+
+ public static String DEFAULT_REGISTRY = "http://www.dasregistry.org/das/";
+
+ /**
+ * true if thread is running and we are talking to DAS registry service
+ */
+ private boolean loadingDasSources = false;
+
+ public boolean isLoadingDasSources()
+ {
+ return loadingDasSources;
+ }
+
+ public String getDasRegistryURL()
+ {
+ String registry = jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",
+ DEFAULT_REGISTRY);
+
+ if (registry.indexOf("/registry/das1/sources/") > -1)
+ {
+ jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ DEFAULT_REGISTRY);
+ registry = DEFAULT_REGISTRY;
+ }
+ if (registry.lastIndexOf("sources.xml") == registry.length() - 11)
+ {
+ // no trailing sources.xml document for registry in JDAS
+ jalview.bin.Cache.setProperty(jalview.bin.Cache.DAS_REGISTRY_URL,
+ registry=registry.substring(0, registry.lastIndexOf("sources.xml")));
+ }
+ return registry;
+ }
+
+ /**
+ * query the default DAS Source Registry for sources. Uses value of jalview
+ * property DAS_REGISTRY_URL and the DasSourceBrowser.DEFAULT_REGISTRY if that
+ * doesn't exist.
+ *
+ * @return list of sources
+ */
+ private List<jalviewSourceI> getDASSources()
+ {
+
+ return getDASSources(getDasRegistryURL(), this);
+ }
+
+ /**
+ * query the given URL for DasSources.
+ *
+ * @param registryURL
+ * return sources from registryURL
+ */
+ private static List<jalviewSourceI> getDASSources(String registryURL,
+ MultipleConnectionPropertyProviderI registry)
+ {
+ try
+ {
+ URL url = new URL(registryURL);
+ org.biodas.jdas.client.SourcesClientInterface client = new SourcesClient();
+
+ SOURCES sources = client.fetchDataRegistry(registryURL, null, null,
+ null, null, null, null);
+
+ List<SOURCE> dassources = sources.getSOURCE();
+ ArrayList<jalviewSourceI> dsrc = new ArrayList<jalviewSourceI>();
+ HashMap<String, Integer> latests = new HashMap<String, Integer>();
+ Integer latest;
+ for (SOURCE src : dassources)
+ {
+ JalviewSource jsrc = new JalviewSource(src, registry, false);
+ latest = latests.get(jsrc.getSourceURL());
+ if (latest != null)
+ {
+ if (jsrc.isNewerThan(dsrc.get(latest.intValue())))
+ {
+ dsrc.set(latest.intValue(), jsrc);
+ }
+ else
+ {
+ System.out.println("Debug: Ignored older source "
+ + jsrc.getTitle());
+ }
+ }
+ else
+ {
+ latests.put(jsrc.getSourceURL(), Integer.valueOf(dsrc.size()));
+ dsrc.add(jsrc);
+ }
+ }
+ return dsrc;
+ } catch (Exception ex)
+ {
+ System.err.println("Failed to contact DAS1 registry at "
+ + registryURL);
+ ex.printStackTrace();
+ return new ArrayList<jalviewSourceI>();
+ }
+ }
+
+ public void run()
+ {
+ getSources();
+ }
+
+ @Override
+ public List<jalviewSourceI> getSources()
+ {
+ if (dasSources == null)
+ {
+ dasSources = getDASSources();
+ }
+ return appendLocalSources();
+ }
+
+ /**
+ * generate Sources from the local das source list
+ *
+ */
+ private void addLocalDasSources()
+ {
+ if (localSources == null)
+ {
+ // get local sources from properties and initialise the local source list
+ String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");
+ if (local != null)
+ {
+ StringTokenizer st = new StringTokenizer(local, "\t");
+ while (st.hasMoreTokens())
+ {
+ String token = st.nextToken();
+ int bar = token.indexOf("|");
+ String url = token.substring(bar + 1);
+ boolean features = true, sequence = false;
+ if (url.startsWith("sequence:"))
+ {
+ url = url.substring(9);
+ // this source also serves sequences as well as features
+ sequence = true;
+ }
+ createLocalSource(url, token.substring(0, bar), sequence,
+ features);
+ }
+ }
+ }
+ }
+
+ private List<jalviewSourceI> appendLocalSources()
+ {
+ List<jalviewSourceI> srclist = new ArrayList<jalviewSourceI>();
+ addLocalDasSources();
+ sourceNames = new Hashtable<String, jalviewSourceI>();
+ if (dasSources != null)
+ {
+ for (jalviewSourceI src : dasSources)
+ {
+ sourceNames.put(src.getTitle(), src);
+ srclist.add(src);
+ }
+ }
+
+ if (localSources == null)
+ {
+ return srclist;
+ }
+ Enumeration en = localSources.keys();
+ while (en.hasMoreElements())
+ {
+ String key = en.nextElement().toString();
+ jalviewSourceI jvsrc = localSources.get(key);
+ sourceNames.put(key, jvsrc);
+ srclist.add(jvsrc);
+ }
+ return srclist;
+ }
+
+ /*
+ *
+ */
+
+ @Override
+ public jalviewSourceI createLocalSource(String url, String name,
+ boolean sequence, boolean features)
+ {
+ SOURCE local = _createLocalSource(url, name, sequence, features);
+
+ if (localSources == null)
+ {
+ localSources = new Hashtable<String, jalviewSourceI>();
+ }
+ jalviewSourceI src = new JalviewSource(local, this, true);
+ localSources.put(local.getTitle(), src);
+ return src;
+ }
+
+ private SOURCE _createLocalSource(String url, String name,
+ boolean sequence, boolean features)
+ {
+ SOURCE local = new SOURCE();
+
+ local.setUri(url);
+ local.setTitle(name);
+ local.setVERSION(new ArrayList<VERSION>());
+ VERSION v = new VERSION();
+ List<CAPABILITY> cp = new ArrayList<CAPABILITY>();
+ if (sequence)
+ {
+ /*
+ * Could try and synthesize a coordinate system for the source if needbe
+ * COORDINATES coord = new COORDINATES(); coord.setAuthority("NCBI");
+ * coord.setSource("Chromosome"); coord.setTaxid("9606");
+ * coord.setVersion("35"); version.getCOORDINATES().add(coord);
+ */
+ CAPABILITY cap = new CAPABILITY();
+ cap.setType("das1:" + Capabilities.SEQUENCE.getName());
+ cap.setQueryUri(url + "/sequence");
+ cp.add(cap);
+ }
+ if (features)
+ {
+ CAPABILITY cap = new CAPABILITY();
+ cap.setType("das1:" + Capabilities.FEATURES.getName());
+ cap.setQueryUri(url + "/features");
+ cp.add(cap);
+ }
+
+ v.getCAPABILITY().addAll(cp);
+ local.getVERSION().add(v);
+
+ return local;
+ }
+
+ @Override
+ public jalviewSourceI getSource(String nickname)
+ {
+ return sourceNames.get(nickname);
+ }
+
+ @Override
+ public boolean removeLocalSource(jalviewSourceI source)
+ {
+ if (localSources.containsValue(source))
+ {
+ localSources.remove(source.getTitle());
+ sourceNames.remove(source.getTitle());
+ dasSources.remove(source);
+ jalview.bin.Cache.setProperty("DAS_LOCAL_SOURCE",
+ getLocalSourceString());
+
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void refreshSources()
+ {
+ dasSources = null;
+ sourceNames = null;
+ run();
+ }
+
+ @Override
+ public List<jalviewSourceI> resolveSourceNicknames(List<String> sources)
+ {
+ ArrayList<jalviewSourceI> resolved = new ArrayList<jalviewSourceI>();
+ if (sourceNames != null)
+ {
+ for (String src : sources)
+ {
+ jalviewSourceI dsrc = sourceNames.get(src);
+ if (dsrc != null)
+ {
+ resolved.add(dsrc);
+ }
+ }
+ }
+ return resolved;
+ }
+
+ @Override
+ public String getLocalSourceString()
+ {
+ if (localSources != null)
+ {
+ StringBuffer sb = new StringBuffer();
+ Enumeration en = localSources.keys();
+ while (en.hasMoreElements())
+ {
+ String token = en.nextElement().toString();
+ jalviewSourceI srco = localSources.get(token);
+ sb.append(token + "|"
+ + (srco.isSequenceSource() ? "sequence:" : "")
+ + srco.getUri() + "\t");
+ }
+ return sb.toString();
+ }
+ return "";
+ }
+
+ private static final Hashtable<URL, String> authStash;
+ static
+ {
+ authStash = new Hashtable<URL, String>();
+
+ try
+ {
+ // TODO: allow same credentials for https and http
+ authStash.put(new URL(
+ "http://www.compbio.dundee.ac.uk/geneweb/das/myseq/"),
+ "Basic SmltOm1pSg==");
+ } catch (MalformedURLException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public MultipleConnectionPropertyProviderI getSessionHandler()
+ {
+ return this;
+ }
+
+ @Override
+ public ConnectionPropertyProviderI getConnectionPropertyProviderFor(
+ String arg0)
+ {
+
+ final ConnectionPropertyProviderI conprov = new ConnectionPropertyProviderI()
+ {
+ boolean authed = false;
+
+ @Override
+ public void setConnectionProperties(HttpURLConnection connection)
+ {
+ String auth = authStash.get(connection.getURL());
+ if (auth != null && auth.length() > 0)
+ {
+ connection.setRequestProperty("Authorisation", auth);
+ authed = true;
+ }
+ else
+ {
+ authed = false;
+ }
+ }
+
+ @Override
+ public boolean getResponseProperties(HttpURLConnection connection)
+ {
+ String auth = authStash.get(connection.getURL());
+ if (auth != null && auth.length() == 0)
+ {
+ // don't attempt to check if we authed or not - user entered empty
+ // password
+ return false;
+ }
+ if (!authed)
+ {
+ if (auth != null)
+ {
+ // try and pass credentials.
+ return true;
+ }
+ // see if we should try and create a new auth record.
+ String ameth = connection.getHeaderField("X-DAS-AuthMethods");
+ Cache.log.debug("Could authenticate to " + connection.getURL()
+ + " with : " + ameth);
+ // TODO: search auth string and raise login box - return if auth was
+ // provided
+ return false;
+ }
+ else
+ {
+ // check to see if auth was successful
+ String asuc = connection
+ .getHeaderField("X-DAS_AuthenticatedUser");
+ if (asuc != null && asuc.trim().length() > 0)
+ {
+ // authentication was successful
+ Cache.log.debug("Authenticated successfully to "
+ + connection.getURL().toString());
+ return false;
+ }
+ // it wasn't - so we should tell the user it failed and ask if they
+ // want to attempt authentication again.
+ authStash.remove(connection.getURL());
+ // open a new login/password dialog with cancel button
+ // set new authStash content with password and return true
+ return true; //
+ // User cancelled auth - so put empty string in stash to indicate we
+ // don't want to auth with this server.
+ // authStash.put(connection.getURL(), "");
+ // return false;
+ }
+ }
+ };
+ return conprov;
+ }
+
+}
--- /dev/null
+package jalview.ws.dbsources.das.datamodel;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.biodas.jdas.client.threads.MultipleConnectionPropertyProviderI;
+import org.biodas.jdas.dassources.Capabilities;
+import org.biodas.jdas.dassources.utils.DasTimeFormat;
+import org.biodas.jdas.dassources.utils.RegistrySourceAdapter;
+import org.biodas.jdas.schema.sources.CAPABILITY;
+import org.biodas.jdas.schema.sources.COORDINATES;
+import org.biodas.jdas.schema.sources.MAINTAINER;
+import org.biodas.jdas.schema.sources.PROP;
+import org.biodas.jdas.schema.sources.SOURCE;
+import org.biodas.jdas.schema.sources.VERSION;
+
+import jalview.ws.dbsources.das.api.jalviewSourceI;
+import jalview.ws.seqfetcher.DbSourceProxy;
+
+public class JalviewSource implements jalviewSourceI
+{
+ SOURCE source;
+ MultipleConnectionPropertyProviderI connprov;
+ public JalviewSource(SOURCE local2, MultipleConnectionPropertyProviderI connprov, boolean local)
+ {
+ this.connprov=connprov;
+ this.local = local;
+ source = local2;
+ }
+
+ @Override
+ public String getTitle()
+ {
+ return source.getTitle();
+ }
+
+ @Override
+ public VERSION getVersion()
+ {
+
+ return getVersionFor(source);
+ }
+
+ @Override
+ public String getDocHref()
+ {
+ return source.getDocHref();
+ }
+
+ @Override
+ public String getDescription()
+ {
+ return source.getDescription();
+ }
+
+ @Override
+ public String getUri()
+ {
+ return source.getUri();
+ }
+
+ @Override
+ public MAINTAINER getMAINTAINER()
+ {
+ return source.getMAINTAINER();
+ }
+
+ @Override
+ public String getEmail()
+ {
+ return (local) ? null : source.getMAINTAINER().getEmail();
+ }
+
+ boolean local = false;
+
+ @Override
+ public boolean isLocal()
+ {
+ return local;
+ }
+
+ @Override
+ public boolean isSequenceSource()
+ {
+ String seqcap = "das1:" + Capabilities.SEQUENCE.getName();
+ for (String cp : getCapabilityList(getVersionFor(source)))
+ {
+ if (cp.equals(seqcap))
+ {
+ return true;
+
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isFeatureSource()
+ {
+ String seqcap = "das1:" + Capabilities.FEATURES.getName();
+ for (String cp : getCapabilityList(getVersionFor(source)))
+ {
+ if (cp.equals(seqcap))
+ {
+ return true;
+
+ }
+ }
+ return false;
+ }
+
+ private VERSION getVersionFor(SOURCE ds)
+ {
+ VERSION latest = null;
+ for (VERSION v : ds.getVERSION())
+ {
+ if (latest == null
+ || isLaterThan(latest.getCreated(), v.getCreated()))
+ {
+ // TODO: das 1.6 - should just get the first version - ignore other
+ // versions since not specified how to construct URL from version's URI
+ // + source URI
+ latest = v;
+ }
+ }
+ return latest;
+ }
+
+ /**
+ * compare date strings. null or unparseable dates are assumed to be oldest
+ *
+ * @param ref
+ * @param newer
+ * @return true iff ref comes before newer
+ */
+ private boolean isLaterThan(String ref, String newer)
+ {
+ Date refdate = null, newdate = null;
+ if (ref != null && ref.trim().length() > 0)
+ {
+ try
+ {
+ refdate = DasTimeFormat.fromDASString(ref.trim());
+
+ } catch (ParseException x)
+ {
+ }
+ }
+ if (newer != null && newer.trim().length() > 0)
+ {
+ try
+ {
+ newdate = DasTimeFormat.fromDASString(newer);
+ } catch (ParseException e)
+ {
+ }
+ }
+ if (refdate != null)
+ {
+ if (newdate != null)
+ {
+ return refdate.before(newdate);
+ }
+ return false;
+ }
+ if (newdate != null)
+ {
+ return true;
+ }
+ // assume first instance of source is newest in list. - TODO: check if
+ // natural ordering of source versions is newest first or oldest first
+ return false;
+ }
+
+ public String[] getLabelsFor(VERSION v)
+ {
+ ArrayList<String> labels = new ArrayList<String>();
+ for (PROP p : v.getPROP())
+ {
+ if (p.getName().equalsIgnoreCase("LABEL"))
+ {
+ labels.add(p.getValue());
+ }
+ }
+ return labels.toArray(new String[0]);
+ }
+
+ private CAPABILITY getCapability(Capabilities capability)
+ {
+ for (CAPABILITY p : getVersion().getCAPABILITY())
+ {
+ if (p.getType().equalsIgnoreCase(capability.getName())
+ || p.getType().equalsIgnoreCase(
+ "das1:" + capability.getName()))
+ {
+ return p;
+ }
+ }
+ return null;
+ }
+
+ public String[] getCapabilityList(VERSION v)
+ {
+
+ ArrayList<String> labels = new ArrayList<String>();
+ for (CAPABILITY p : v.getCAPABILITY())
+ {
+ // TODO: work out what to do with namespace prefix
+ // does SEQUENCE == das1:SEQUENCE and das2:SEQUENCE ?
+ // for moment, just show all capabilities...
+ if (p.getType().startsWith("das1:"))
+ {
+ labels.add(p.getType());
+ }
+ }
+ return labels.toArray(new String[0]);
+ }
+
+ @Override
+ public List<DbSourceProxy> getSequenceSourceProxies()
+ {
+ if (!isSequenceSource())
+ {
+ return null;
+ }
+ ArrayList<DbSourceProxy> seqsources = new ArrayList<DbSourceProxy>();
+ if (!local)
+ {
+ VERSION v = getVersion();
+ Map<String, COORDINATES> latestc = new Hashtable<String, COORDINATES>();
+ for (COORDINATES cs : v.getCOORDINATES())
+ {
+ COORDINATES ltst = latestc.get(cs.getUri());
+ if (ltst == null
+ || ltst.getVersion() == null
+ || (ltst.getVersion() != null && cs.getVersion() != null && isLaterThan(
+ ltst.getVersion(), cs.getVersion())))
+ {
+ latestc.put(cs.getUri(), cs);
+ }
+ }
+ for (COORDINATES cs : latestc.values())
+ {
+ DasSequenceSource ds;
+ /*
+ * if (css == null || css.length == 0) { // TODO: query das source
+ * directly to identify coordinate system... or // have to make up a
+ * coordinate system css = new DasCoordinateSystem[] { new
+ * DasCoordinateSystem() }; css[0].setName(d1s.getNickname());
+ * css[0].setUniqueId(d1s.getNickname()); } for (int c = 0; c <
+ * css.length; c++) {
+ */
+ try
+ {
+ seqsources.add(ds = new DasSequenceSource(getTitle() + " ("
+ + cs.getAuthority() + " " + cs.getSource()
+ + (cs.getVersion() != null ? " " + cs.getVersion() : "")
+ + ")", cs.getAuthority(), source, v, cs, connprov));
+ if (seqsources.size() > 1)
+ {
+ System.err.println("Added another sequence DB source for "
+ + getTitle() + " (" + ds.getDbName() + ")");
+ }
+ } catch (Exception e)
+ {
+ System.err.println("Ignoring sequence coord system " + cs + " ("
+ + cs.getContent() + ") for source " + getTitle()
+ + "- threw exception when constructing fetcher.\n");
+ e.printStackTrace();
+ }
+ }
+ }
+ else
+ {
+ try
+ {
+ seqsources.add(new DasSequenceSource(getTitle(), getTitle(),
+ source, getVersion(), null, connprov));
+ } catch (Exception e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+ if (seqsources.size() > 1)
+ {
+ // sort by name
+ DbSourceProxy[] tsort = seqsources.toArray(new DasSequenceSource[0]);
+ String[] nm = new String[tsort.length];
+ for (int i = 0; i < nm.length; i++)
+ {
+ nm[i] = tsort[i].getDbName().toLowerCase();
+ }
+ jalview.util.QuickSort.sort(nm, tsort);
+ seqsources.clear();
+ for (DbSourceProxy ssrc : tsort)
+ {
+ seqsources.add(ssrc);
+ }
+ }
+ return seqsources;
+ }
+
+ @Override
+ public String getSourceURL()
+ {
+ try
+ {
+ // kind of dumb, since org.biodas.jdas.dassources.utils.VersionAdapter.getSourceUriFromQueryUri() does this,
+ // but this way, we can access non DAS 1.6 compliant sources (which have to have a URL like <sourcename>/das/ and cause a validation exception)
+
+ for (CAPABILITY cap : getVersion().getCAPABILITY())
+ {
+ String capname = cap.getType().substring(
+ cap.getType().indexOf(":") + 1);
+ int p=cap.getQueryUri().lastIndexOf(capname);
+ if (p<-1) {
+ throw new Exception("Invalid das source: "+source.getUri());
+ }
+ if (cap.getQueryUri().charAt(p)=='/')
+ {
+ p--;
+ }
+ return cap.getQueryUri().substring(0,p);
+ }
+ } catch (Exception x)
+ {
+ System.err.println("Serious: Couldn't get the URL for source "
+ + source.getTitle());
+ x.printStackTrace();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean isNewerThan(jalviewSourceI other)
+ {
+ return isLaterThan(getVersion().getCreated(), other.getVersion()
+ .getCreated());
+ }
+}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.ws.jws2;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Annotation;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeSet;
+
+import compbio.data.sequence.Score;
+import compbio.metadata.Argument;
+
+public class AAConsClient extends JabawsAlignCalcWorker
+{
+
+ public AAConsClient(Jws2Instance service, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(service, alignFrame, preset, paramset);
+ submitGaps=true;
+ alignedSeqs=true;
+ nucleotidesAllowed=false;
+ proteinAllowed=true;
+ }
+
+ public String getServiceActionText()
+ {
+ return "calculating Amino acid consensus using AACons service";
+ }
+
+ /**
+ * update the consensus annotation from the sequence profile data using
+ * current visualization settings.
+ */
+
+ public void updateResultAnnotation(boolean immediate)
+ {
+
+ if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+ {
+ AlignmentAnnotation annotation;
+ ;
+ Map<String, TreeSet<Score>> scoremap = scoremanager.asMap();
+ int alWidth = alignViewport.getAlignment().getWidth();
+ AlignmentI alignment;
+ int ann = (alignment = alignViewport.getAlignment())
+ .getAlignmentAnnotation().length;
+ ArrayList<AlignmentAnnotation> ourAnnot = new ArrayList<AlignmentAnnotation>();
+ for (String score : scoremap.keySet())
+ {
+ TreeSet<Score> scores = scoremap.get(score);
+ for (Score scr : scores)
+ {
+ if (scr.getRanges() != null && scr.getRanges().size() > 0)
+ {
+ /**
+ * annotation in range annotation = findOrCreate(scr.getMethod(),
+ * true, null, null); Annotation[] elm = new Annotation[alWidth];
+ * Iterator<Float> vals = scr.getScores().iterator(); for (Range rng
+ * : scr.getRanges()) { float val = vals.next().floatValue(); for
+ * (int i = rng.from; i <= rng.to; i++) { elm[i] = new
+ * Annotation("", "", ' ', val); } } annotation.annotations = elm;
+ * annotation.validateRangeAndDisplay();
+ */
+ }
+ else
+ {
+ // simple annotation row
+ annotation = alignViewport.getAlignment().findOrCreateAnnotation(scr.getMethod(), true, null, null);
+ Annotation[] elm = new Annotation[alWidth];
+ if (alWidth == scr.getScores().size())
+ {
+ Iterator<Float> vals = scr.getScores().iterator();
+ float m = 0f, x = 0f;
+ for (int i = 0; vals.hasNext(); i++)
+ {
+ float val = vals.next().floatValue();
+ if (i == 0)
+ {
+ m = val;
+ x = val;
+ }
+ else
+ {
+ if (m > val)
+ {
+ m = val;
+ }
+ ;
+ if (x < val)
+ {
+ x = val;
+ }
+ }
+ elm[i] = new Annotation("", "" + val, ' ', val);
+ }
+
+ annotation.annotations = elm;
+ annotation.belowAlignment = true;
+ if (x < 0)
+ {
+ x = 0;
+ }
+ x += (x - m) * 0.1;
+ annotation.graphMax = x;
+ annotation.graphMin = m;
+ annotation.validateRangeAndDisplay();
+ ourAnnot.add(annotation);
+ }
+ }
+ }
+ }
+ if (ourAnnot.size() > 0)
+ {
+ List<AlignmentAnnotation> our = ourAnnots;
+ ourAnnots = ourAnnot;
+ if (our != null)
+ {
+ if (our.size() > 0)
+ {
+ for (AlignmentAnnotation an : our)
+ {
+ if (!ourAnnots.contains(an))
+ {
+ // remove the old annotation
+ alignment.deleteAnnotation(an);
+ }
+ }
+ }
+ our.clear();
+ }
+ }
+ // if (ann !=
+ // alignViewport.getAlignment().getAlignmentAnnotation().length)
+ {
+ ap.adjustAnnotationHeight();
+ }
+ /*
+ * else { ap.paintAlignment(true); }
+ */
+ }
+ }
+
+}
--- /dev/null
+package jalview.ws.jws2;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.Iterator;
+import java.util.List;
+
+import compbio.data.sequence.Range;
+import compbio.data.sequence.Score;
+import compbio.data.sequence.ScoreManager.ScoreHolder;
+import compbio.metadata.Argument;
+
+public class AADisorderClient extends JabawsAlignCalcWorker implements
+ AlignCalcWorkerI
+{
+
+ String typeName;
+
+ String methodName;
+
+ String groupName;
+
+ AlignFrame af;
+
+ public AADisorderClient(Jws2Instance sh, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ super(sh, alignFrame, preset, paramset);
+ af = alignFrame;
+ typeName = sh.action;
+ methodName = sh.serviceType;
+
+ submitGaps = false;
+ alignedSeqs = false;
+ nucleotidesAllowed = false;
+ proteinAllowed = true;
+ bySequence = true;
+ }
+
+ @Override
+ public String getServiceActionText()
+ {
+ return "Submitting amino acid sequences for disorder prediction.";
+ }
+
+ @Override
+ public void updateResultAnnotation(boolean immediate)
+ {
+
+ if (immediate || !calcMan.isWorking(this) && scoremanager != null)
+ {
+ boolean dispFeatures = false;
+ for (String seqId : seqNames.keySet())
+ {
+ SequenceI dseq, seq = seqNames.get(seqId);
+ int base = seq.getStart() - 1;
+ while ((dseq = seq).getDatasetSequence() != null)
+ {
+ seq = seq.getDatasetSequence();
+ }
+ ;
+ ScoreHolder scores = scoremanager.getAnnotationForSequence(seqId);
+
+ for (Score scr : scores.scores)
+ {
+
+ if (scr.getRanges() != null && scr.getRanges().size() > 0)
+ {
+ Iterator<Float> vals = scr.getScores().iterator();
+ // make features on sequence
+ for (Range rn : scr.getRanges())
+ {
+
+ SequenceFeature sf;
+ if (vals.hasNext())
+ {
+ sf = new SequenceFeature(typeName + "(" + scr.getMethod()
+ + ")", "Disordered Region", base + rn.from, base
+ + rn.to, vals.next().floatValue(), methodName);
+ }
+ else
+ {
+ sf = new SequenceFeature(typeName + "(" + scr.getMethod()
+ + ")", "Disordered Region", null, base + rn.from,
+ base + rn.to, methodName);
+ }
+ dseq.addSequenceFeature(sf);
+ dispFeatures = true;
+ }
+ }
+ else
+ {
+ Iterator<Float> vals = scr.getScores().iterator();
+ for (int start = base + 1; vals.hasNext(); start++)
+ {
+ SequenceFeature sf = new SequenceFeature(typeName + "("
+ + scr.getMethod() + ")", "Disordered Region", start,
+ start, vals.next().floatValue(), methodName);
+ dseq.addSequenceFeature(sf);
+ dispFeatures = true;
+ }
+ }
+ }
+ }
+ {
+ if (dispFeatures)
+ {
+ // TODO: configure feature display settings for added types if they don't already exist
+
+ af.alignPanel.av.setShowSequenceFeatures(true);
+ ap.paintAlignment(true);
+ }
+ }
+ /*
+ * else { ap.paintAlignment(true); }
+ */
+ }
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import compbio.metadata.PresetManager;
import compbio.metadata.RunnerConfig;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
import jalview.ws.jws2.dm.JabaOption;
import jalview.ws.jws2.dm.JabaParameter;
import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.ParamManager;
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.ws.jws2;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.WsParamSetI;
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
package jalview.ws.jws2;
import jalview.bin.Cache;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
-import compbio.data.msa.MsaWS;
+import java.util.HashSet;
+import java.util.Set;
+
+import compbio.data.msa.Category;
+import compbio.data.msa.JABAService;
import compbio.ws.client.Jws2Client;
import compbio.ws.client.Services;
/**
* @author JimP
- *
+ *
*/
public class JabaWsServerQuery implements Runnable
{
- Jws2Discoverer jws2Discoverer=null;
- String jwsservers=null;
- boolean quit=false,
- running=false;
+ Jws2Discoverer jws2Discoverer = null;
+
+ String jwsservers = null;
+
+ boolean quit = false, running = false;
+
/**
* @return the running
*/
- public boolean isRunning()
+ public boolean isRunning()
{
return running;
}
/**
- * @param quit the quit to set
+ * @param quit
+ * the quit to set
*/
public void setQuit(boolean quit)
{
public JabaWsServerQuery(Jws2Discoverer jws2Discoverer, String jwsservers)
{
this.jws2Discoverer = jws2Discoverer;
- this.jwsservers=jwsservers;
+ this.jwsservers = jwsservers;
}
-
- /* (non-Javadoc)
+ Services[] JABAWS1SERVERS=new Services[]
+ { Services.ClustalWS, Services.MuscleWS, Services.MafftWS,
+ Services.ProbconsWS, Services.TcoffeeWS };
+ Services[] JABAWS2SERVERS=new Services[]
+ { Services.ClustalWS, Services.MuscleWS, Services.MafftWS,
+ Services.ProbconsWS, Services.TcoffeeWS, Services.AAConWS, Services.DisemblWS, Services.GlobPlotWS, Services.IUPredWS, Services.JronnWS };
+
+ /*
+ * (non-Javadoc)
+ *
* @see java.lang.Runnable#run()
*/
@Override
public void run()
{
- running=true;
- try
+ running = true;
+ try
{
if (Jws2Client.validURL(jwsservers))
{
- boolean noservices=true;
+ compbio.data.msa.RegistryWS registry = null;
+ Set svccategories = null;
+ boolean noservices = true;
// look for services
- for (Services srv : Services.values())
+ boolean jabasws2 = false;
+ // If we are dealing with a JABAWS2 service, then just go and ask the
+ // JABAWS 2 service registry
+ Set<Services> srv_set = new HashSet<Services>();
+
+ Set<Category> categories = Category.getCategories();
+ String svc_cat;
+
+ try
{
- if (quit)
+ // JBPNote: why is RegistryWS in compbio.data.msa ?
+ registry = Jws2Client.connectToRegistry(jwsservers);
+ if (registry != null)
{
- running=false;
- return;
+ // System.err.println("Test Services Output\n"
+ // + registry.testAllServices());
+ // TODO: enumerate services and test those that haven't been tested
+ // in the last n-days/hours/etc.
+
+ jabasws2 = true;
+ srv_set = registry.getSupportedServices();
+ svccategories = registry.getServiceCategories();
+
}
- MsaWS service = null;
- try
+ } catch (Exception ex)
+ {
+ System.err.println("Exception whilst trying to get at registry:");
+ ex.printStackTrace();
+ // if that failed, then we are probably working with a JABAWS1 server.
+ // in that case, look for each service endpoint
+ System.err.println("JWS2 Discoverer: " + jwsservers
+ + " is a JABAWS1 server. Using hardwired list.");
+ for (Services srv : JABAWS1SERVERS)
{
- service = Jws2Client.connect(jwsservers, srv);
- } catch (Exception e)
+ srv_set.add(srv);
+ }
+ }
+ for (Category cat : categories)
+ {
+ for (Services srv : cat.getServices())
{
- System.err.println("Jws2 Discoverer: Problem on "
- + jwsservers + " with service " + srv + ":\n"
- + e.getMessage());
- if (!(e instanceof javax.xml.ws.WebServiceException))
+ if (quit)
{
- e.printStackTrace();
+ running = false;
+ return;
}
- // For moment, report service as a problem.
- jws2Discoverer.addInvalidServiceUrl(jwsservers);
- }
- ;
- if (service != null)
- {
- noservices=false;
- jws2Discoverer.addService(jwsservers, srv, service);
+ if (!srv_set.contains(srv))
+ {
+ continue;
+ }
+ JABAService service = null;
+ try
+ {
+ service = Jws2Client.connect(jwsservers, srv);
+ } catch (Exception e)
+ {
+ System.err.println("Jws2 Discoverer: Problem on "
+ + jwsservers + " with service " + srv + ":\n"
+ + e.getMessage());
+ if (!(e instanceof javax.xml.ws.WebServiceException))
+ {
+ e.printStackTrace();
+ }
+ // For moment, report service as a problem.
+ jws2Discoverer.addInvalidServiceUrl(jwsservers);
+ }
+ ;
+ if (service != null)
+ {
+ noservices = false;
+ Jws2Instance svc = null;
+ if (registry != null)
+ {
+
+ String description = registry.getServiceDescription(srv);
+
+ svc = new Jws2Instance(jwsservers, srv.toString(),
+ cat.name, description, service);
+ }
+ if (svc == null)
+ {
+ svc = new Jws2Instance(jwsservers, srv.toString(), cat.name,
+ "JABAWS 1 Alignment Service", service);
+ }
+ jws2Discoverer.addService(jwsservers, svc);
+ }
+
}
}
+
if (noservices)
{
jws2Discoverer.addUrlwithnoservices(jwsservers);
Cache.log.error("Exception when discovering Jws2 services.", e);
jws2Discoverer.addInvalidServiceUrl(jwsservers);
}
- running=false;
+ running = false;
}
}
--- /dev/null
+package jalview.ws.jws2;
+
+import jalview.analysis.AlignSeq;
+import jalview.analysis.SeqsetUtils;
+import jalview.api.AlignViewportI;
+import jalview.api.AlignmentViewPanel;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
+import jalview.gui.AlignFrame;
+import jalview.gui.IProgressIndicator;
+import jalview.workers.AlignCalcWorker;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import compbio.data.msa.SequenceAnnotation;
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.ScoreManager;
+import compbio.metadata.Argument;
+import compbio.metadata.ChunkHolder;
+import compbio.metadata.JobStatus;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.Option;
+import compbio.metadata.ResultNotAvailableException;
+import compbio.metadata.WrongParameterException;
+
+public abstract class JabawsAlignCalcWorker extends AlignCalcWorker
+{
+
+ @SuppressWarnings("unchecked")
+ protected SequenceAnnotation aaservice;
+
+ protected ScoreManager scoremanager;
+
+ protected WsParamSetI preset;
+
+ protected List<Argument> arguments;
+
+ public JabawsAlignCalcWorker(AlignViewportI alignViewport,
+ AlignmentViewPanel alignPanel)
+ {
+ super(alignViewport, alignPanel);
+ }
+
+ IProgressIndicator guiProgress;
+
+ public JabawsAlignCalcWorker(Jws2Instance service, AlignFrame alignFrame,
+ WsParamSetI preset, List<Argument> paramset)
+ {
+ this(alignFrame.getCurrentView(), alignFrame.alignPanel);
+ this.guiProgress = alignFrame;
+ this.preset = preset;
+ this.arguments = paramset;
+ aaservice = (SequenceAnnotation) service.service;
+
+ }
+
+ public WsParamSetI getPreset()
+ {
+ return preset;
+ }
+
+ public List<Argument> getArguments()
+ {
+ return arguments;
+ }
+
+ /**
+ * reconfigure and restart the AAConsClient. This method will spawn a new
+ * thread that will wait until any current jobs are finished, modify the
+ * parameters and restart the conservation calculation with the new values.
+ *
+ * @param newpreset
+ * @param newarguments
+ */
+ public void updateParameters(final WsParamSetI newpreset,
+ final List<Argument> newarguments)
+ {
+ if (false) // || calcMan.isWorking(this))
+ {
+ new Thread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ updateParameters(newpreset, newarguments);
+ }
+ }).start();
+ }
+ else
+ {
+ preset = newpreset;
+ arguments = newarguments;
+ calcMan.startWorker(this);
+ }
+ }
+
+ public List<Option> getJabaArguments()
+ {
+ List<Option> newargs = new ArrayList<Option>();
+ if (preset != null && preset instanceof JabaWsParamSet)
+ {
+ newargs.addAll(((JabaWsParamSet) preset).getjabaArguments());
+ }
+ if (arguments != null && arguments.size() > 0)
+ {
+ for (Argument rg : arguments)
+ {
+ if (Option.class.isAssignableFrom(rg.getClass()))
+ {
+ newargs.add((Option) rg);
+ }
+ }
+ }
+ return newargs;
+ }
+
+ @Override
+ public void run()
+ {
+ if (aaservice == null)
+ {
+ return;
+ }
+ long progressId = -1;
+
+ String rslt = "JOB NOT DEFINED";
+
+ try
+ {
+ if (checkDone())
+ {
+ return;
+ }
+ List<compbio.data.sequence.FastaSequence> seqs = getInputSequences(alignViewport
+ .getAlignment());
+
+ if (seqs == null)
+ {
+ calcMan.workerComplete(this);
+ return;
+ }
+
+ AlignmentAnnotation[] aa = alignViewport.getAlignment()
+ .getAlignmentAnnotation();
+ if (guiProgress != null)
+ {
+ guiProgress.setProgressBar("JABA " + getServiceActionText(),
+ progressId = System.currentTimeMillis());
+ }
+ if (preset == null && arguments==null)
+ {
+ rslt = aaservice.analize(seqs);
+ }
+ else
+ {
+ try
+ {
+ rslt = aaservice.customAnalize(seqs, getJabaArguments());
+ } catch (WrongParameterException x)
+ {
+ throw new JobSubmissionException(
+ "Invalid paremeter set. Check Jalview implementation.", x);
+
+ }
+ }
+ boolean finished = false;
+ long rpos = 0;
+ do
+ {
+ JobStatus status = aaservice.getJobStatus(rslt);
+ if (status.equals(JobStatus.FINISHED))
+ {
+ finished = true;
+ }
+ if (calcMan.isPending(this) && this instanceof AAConsClient)
+ {
+ finished = true;
+ // cancel this job and yield to the new job
+ try
+ {
+ if (aaservice.cancelJob(rslt))
+ {
+ System.err.println("Cancelled AACon job: " + rslt);
+ }
+ else
+ {
+ System.err.println("FAILED TO CANCELL AACon job: " + rslt);
+ }
+
+ } catch (Exception x)
+ {
+
+ }
+
+ return;
+ }
+ long cpos;
+ ChunkHolder stats;
+ do
+ {
+ cpos = rpos;
+ try
+ {
+ stats = aaservice.pullExecStatistics(rslt, rpos);
+ } catch (Exception x)
+ {
+
+ if (x.getMessage().contains(
+ "Position in a file could not be negative!"))
+ {
+ // squash index out of bounds exception- seems to happen for
+ // disorder predictors which don't (apparently) produce any
+ // progress information and JABA server throws an exception
+ // because progress length is -1.
+ stats = null;
+ }
+ else
+ {
+ throw x;
+ }
+ }
+ if (stats != null)
+ {
+ System.out.print(stats.getChunk());
+ rpos = stats.getNextPosition();
+ }
+ } while (stats != null && rpos > cpos);
+
+ if (!finished && status.equals(JobStatus.FAILED))
+ {
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ }
+
+ } while (!finished);
+ try
+ {
+ Thread.sleep(200);
+ } catch (InterruptedException x)
+ {
+ }
+ ;
+ scoremanager = aaservice.getAnnotation(rslt);
+ if (scoremanager != null)
+ {
+ updateResultAnnotation(true);
+ }
+ } catch (JobSubmissionException x)
+ {
+
+ System.err.println("submission error:");
+ x.printStackTrace();
+ calcMan.workerCannotRun(this);
+ } catch (ResultNotAvailableException x)
+ {
+ System.err.println("collection error:\nJob ID: " + rslt);
+ x.printStackTrace();
+ calcMan.workerCannotRun(this);
+
+ } catch (OutOfMemoryError error)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ ap.raiseOOMWarning(getServiceActionText(), error);
+ } catch (Exception x)
+ {
+ calcMan.workerCannotRun(this);
+
+ // consensus = null;
+ // hconsensus = null;
+ System.err
+ .println("Blacklisting worker due to unexpected exception:");
+ x.printStackTrace();
+ } finally
+ {
+
+ calcMan.workerComplete(this);
+ if (ap != null)
+ {
+ calcMan.workerComplete(this);
+ if (guiProgress != null && progressId!=-1)
+ {
+ guiProgress.setProgressBar("", progressId);
+ }
+ ap.paintAlignment(true);
+ }
+ }
+
+ }
+
+ @Override
+ public void updateAnnotation()
+ {
+ updateResultAnnotation(false);
+ }
+
+ public abstract void updateResultAnnotation(boolean immediate);
+
+ public abstract String getServiceActionText();
+
+ boolean submitGaps = true;
+
+ boolean alignedSeqs = true;
+
+ boolean nucleotidesAllowed = false;
+
+ boolean proteinAllowed = false;
+
+ /**
+ * record sequences for mapping result back to afterwards
+ */
+ protected boolean bySequence = false;
+
+ Map<String, SequenceI> seqNames;
+
+ public List<FastaSequence> getInputSequences(AlignmentI alignment)
+ {
+
+ if (alignment == null || alignment.getWidth() <= 0
+ || alignment.getSequences() == null
+ // || (alignedSeqs && !alignment.isAligned() && !submitGaps)
+ || alignment.isNucleotide() ? !nucleotidesAllowed
+ : !proteinAllowed)
+ {
+ return null;
+ }
+ List<compbio.data.sequence.FastaSequence> seqs = new ArrayList<compbio.data.sequence.FastaSequence>();
+
+ int minlen = 10;
+ int ln = -1;
+ if (bySequence)
+ {
+ seqNames = new HashMap<String, SequenceI>();
+ }
+ for (SequenceI sq : ((List<SequenceI>) alignment.getSequences()))
+ {
+
+ if (sq.getEnd() - sq.getStart() > minlen - 1)
+ {
+ String newname = SeqsetUtils.unique_name(seqs.size() + 1);
+ // make new input sequence with or without gaps
+ if (seqNames != null)
+ {
+ seqNames.put(newname, sq);
+ }
+ FastaSequence seq;
+ seqs.add(seq = new compbio.data.sequence.FastaSequence(newname,
+ (submitGaps) ? sq.getSequenceAsString() : AlignSeq
+ .extractGaps(jalview.util.Comparison.GapChars,
+ sq.getSequenceAsString())));
+ if (seq.getSequence().length() > ln)
+ {
+ ln = seq.getSequence().length();
+ }
+ }
+ }
+ if (alignedSeqs && submitGaps)
+ {
+ // try real hard to return something submittable
+ // TODO: some of AAcons measures need a minimum of two or three amino
+ // acids at each position, and aacons doesn't gracefully degrade.
+ for (int p = 0; p < seqs.size(); p++)
+ {
+ FastaSequence sq = seqs.get(p);
+ int l = sq.getSequence().length();
+ if (l < ln)
+ {
+ char[] padded = new char[ln];
+ System.arraycopy(sq.getSequence().toCharArray(), 0, padded, 0, sq
+ .getSequence().length());
+ while (l < ln)
+ {
+ padded[l++] = '-';
+ }
+ seqs.set(p, new compbio.data.sequence.FastaSequence(sq.getId(),
+ new String(padded)));
+ }
+ }
+
+ }
+ return seqs;
+ }
+
+ /**
+ * notify manager that we have started, and wait for a free calculation slot
+ *
+ * @return true if slot is obtained and work still valid, false if another
+ * thread has done our work for us.
+ */
+ boolean checkDone()
+ {
+ calcMan.notifyStart(this);
+ ap.paintAlignment(false);
+ while (!calcMan.notifyWorking(this))
+ {
+ if (calcMan.isWorking(this))
+ {
+ return true;
+ }
+ try
+ {
+ if (ap != null)
+ {
+ ap.paintAlignment(false);
+ }
+
+ Thread.sleep(200);
+ } catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ if (alignViewport.isClosed())
+ {
+ abortAndDestroy();
+ return true;
+ }
+ return false;
+ }
+
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.ws.jws2;
+import java.util.List;
+
import javax.swing.JMenu;
+import compbio.metadata.Argument;
+
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.WebserviceInfo;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
+import jalview.gui.WsJobParameters;
+import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
/**
- * provides metadata for a jws2 service instance - resolves names, etc.
+ * provides metadata for a jabaws2 service instance - resolves names, etc.
*
* @author JimP
*
*/
public abstract class Jws2Client extends jalview.ws.WSClient
{
+ protected AlignFrame alignFrame;
+
+ protected WsParamSetI preset;
+
+ protected List<Argument> paramset;
+
+ public Jws2Client(AlignFrame _alignFrame,
+ WsParamSetI preset, List<Argument> arguments)
+ {
+ alignFrame = _alignFrame;
+ this.preset = preset;
+ if (preset != null)
+ {
+ if (!((preset instanceof JabaPreset) || preset instanceof JabaWsParamSet))
+ {
+ /*
+ * { this.preset = ((JabaPreset) preset).p; } else if (preset instanceof
+ * JabaWsParamSet) { List<Argument> newargs = new ArrayList<Argument>();
+ * JabaWsParamSet pset = ((JabaWsParamSet) preset); for (Option opt :
+ * pset.getjabaArguments()) { newargs.add(opt); } if (arguments != null
+ * && arguments.size() > 0) { // merge arguments with preset's own
+ * arguments. for (Argument opt : arguments) { newargs.add(opt); } }
+ * paramset = newargs; } else {
+ */
+ throw new Error(
+ "Implementation error: Can only instantiate Jaba parameter sets.");
+ }
+ }
+ else
+ {
+ // just provided with a bunch of arguments
+ this.paramset = arguments;
+ }
+ }
+
+ boolean processParams(Jws2Instance sh, boolean editParams)
+ {
+ return processParams(sh, editParams, false);
+ }
+ protected boolean processParams(Jws2Instance sh, boolean editParams,
+ boolean adjustingExisting)
+ {
+
+ if (editParams)
+ {
+ if (sh.paramStore == null)
+ {
+ sh.paramStore = new JabaParamStore(sh,
+ Desktop.getUserParameterStore());
+ }
+ WsJobParameters jobParams = new WsJobParameters(sh, preset);
+ if (adjustingExisting)
+ {
+ jobParams.setName("Adjusting parameters for existing Calculation");
+ }
+ if (!jobParams.showRunDialog())
+ {
+ return false;
+ }
+ WsParamSetI prset = jobParams.getPreset();
+ if (prset == null)
+ {
+ paramset = JabaParamStore.getJabafromJwsArgs(jobParams
+ .getJobParams());
+ }
+ else
+ {
+ this.preset = prset; // ((JabaPreset) prset).p;
+ paramset = null; // no user supplied parameters.
+ }
+ }
+ return true;
+
+ }
+
+ public Jws2Client()
+ {
+ // anonymous constructor - used for headless method calls only
+ }
+
protected WebserviceInfo setWebService(Jws2Instance serv, boolean b)
{
// serviceHandle = serv;
- String serviceInstance = serv.service.getClass().getName();
+ String serviceInstance = serv.action; // serv.service.getClass().getName();
WebServiceName = serv.serviceType;
WebServiceJobTitle = serv.getActionText();
WsURL = serv.hosturl;
if (!b)
{
return new WebserviceInfo(WebServiceJobTitle, WebServiceJobTitle
- + " using service hosted at " + serv.hosturl);
+ + " using service hosted at " + serv.hosturl + "\n"
+ + (serv.description != null ? serv.description : ""));
}
return null;
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
*/
package jalview.ws.jws2;
+import jalview.bin.Cache;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JvSwingUtils;
+import jalview.ws.WSMenuEntryProviderI;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import java.io.Closeable;
-import java.net.ConnectException;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashSet;
import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
-import javax.swing.event.MenuEvent;
-import javax.swing.event.MenuListener;
-import org.apache.log4j.Level;
-
-import jalview.bin.Cache;
-import jalview.datamodel.AlignmentView;
-import jalview.gui.AlignFrame;
-import jalview.gui.Desktop;
-import jalview.gui.JalviewChangeSupport;
-import jalview.gui.JvSwingUtils;
-import jalview.ws.WSMenuEntryProviderI;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
-import jalview.ws.params.ParamDatastoreI;
-import compbio.data.msa.MsaWS;
-import compbio.metadata.Option;
-import compbio.metadata.Preset;
-import compbio.metadata.PresetManager;
-import compbio.metadata.RunnerConfig;
-import compbio.ws.client.Jws2Client;
import compbio.ws.client.Services;
/**
Cache.log.debug("Old discovery thread has finished.");
}
running = true;
+ changeSupport.firePropertyChange("services", services, new Vector());
oldthread = Thread.currentThread();
try
{
{
invalidServiceUrls.removeAllElements();
}
+ if (validServiceUrls != null)
+ {
+ validServiceUrls.removeAllElements();
+ }
+ ArrayList<String> svctypes=new ArrayList<String>();
List<JabaWsServerQuery> qrys = new ArrayList<JabaWsServerQuery>();
for (final String jwsservers : getServiceUrls())
{
JabaWsServerQuery squery = new JabaWsServerQuery(this, jwsservers);
+ if (svctypes.size()==0)
+ {
+ // TODO: remove this ugly hack to get Canonical JABA service ordering for all possible services
+ for (Services sv:squery.JABAWS2SERVERS)
+ {
+ svctypes.add(sv.toString());
+ }
+
+ }
qrys.add(squery);
new Thread(squery).start();
}
- boolean finished = false;
+ boolean finished = true;
do
{
+ finished=true;
try
{
Thread.sleep(100);
;
for (JabaWsServerQuery squery : qrys)
{
- finished |= !squery.isRunning();
+ finished = finished && !squery.isRunning();
}
if (aborted)
{
}
}
} while (!aborted && !finished);
- oldthread = null;
- running = false;
if (!aborted)
{
- changeSupport.firePropertyChange("services", new Vector(), services);
+ // resort services according to order found in jabaws service list
+ // also ensure servics for each host are ordered in same way.
+
+ if (services!=null && services.size()>0)
+ {
+ Jws2Instance[] svcs=new Jws2Instance[services.size()];
+ int[] spos=new int[services.size()];
+ int ipos=0;
+ Vector svcUrls = getServiceUrls();
+ for (Jws2Instance svc:services)
+ {
+ svcs[ipos]=svc;
+ spos[ipos++]=1000*svcUrls.indexOf(svc.getHost()) + 1+svctypes.indexOf(svc.serviceType);
+ }
+ jalview.util.QuickSort.sort(spos, svcs);
+ services=new Vector<Jws2Instance>();
+ for (Jws2Instance svc:svcs) {
+ services.add(svc);
+ }
+ }
}
+ oldthread = null;
+ running = false;
+ changeSupport.firePropertyChange("services", new Vector(), services);
}
/**
* @param srv
* @param service2
*/
- synchronized void addService(String jwsservers, Services srv,
- MsaWS service2)
+ synchronized void addService(String jwsservers, Jws2Instance service)
{
if (services == null)
{
services = new Vector<Jws2Instance>();
}
System.out.println("Discovered service: " + jwsservers + " "
- + srv.toString());
- Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(),
- service2);
+ + service.toString());
+// Jws2Instance service = new Jws2Instance(jwsservers, srv.toString(),
+// service2);
services.add(service);
// retrieve the presets and parameter set and cache now
service.getParamStore().getPresets();
service.hasParameters();
- }
-
- public class Jws2Instance
- {
- public String hosturl;
-
- public String serviceType;
-
- public MsaWS service;
-
- public Jws2Instance(String hosturl, String serviceType, MsaWS service)
- {
- super();
- this.hosturl = hosturl;
- this.serviceType = serviceType;
- this.service = service;
- }
-
- PresetManager presets = null;
-
- public JabaParamStore paramStore = null;
-
- /**
- * non thread safe - gets the presets for this service (blocks whilst it
- * calls the service to get the preset set)
- *
- * @return service presets or null if exceptions were raised.
- */
- public PresetManager getPresets()
+ if (validServiceUrls==null)
{
- if (presets == null)
- {
- try
- {
- presets = service.getPresets();
- } catch (Exception ex)
- {
- System.err
- .println("Exception when retrieving presets for service "
- + serviceType + " at " + hosturl);
- }
- }
- return presets;
+ validServiceUrls=new Vector();
}
-
- public String getHost()
- {
- return hosturl;
- /*
- * try { URL serviceurl = new URL(hosturl); if (serviceurl.getPort()!=80)
- * { return serviceurl.getHost()+":"+serviceurl.getPort(); } return
- * serviceurl.getHost(); } catch (Exception e) {
- * System.err.println("Failed to parse service URL '" + hosturl +
- * "' as a valid URL!"); } return null;
- */
- }
-
- /**
- * @return short description of what the service will do
- */
- public String getActionText()
- {
- return "Align with " + serviceType;
- }
-
- /**
- * non-thread safe - blocks whilst accessing service to get complete set of
- * available options and parameters
- *
- * @return
- */
- public RunnerConfig getRunnerConfig()
- {
- return service.getRunnerOptions();
- }
-
- @Override
- protected void finalize() throws Throwable
- {
- if (service != null)
- {
- try
- {
- Closeable svc = (Closeable) service;
- service = null;
- svc.close();
- } catch (Exception e)
- {
- }
- ;
- }
- super.finalize();
- }
-
- public ParamDatastoreI getParamStore()
- {
- if (paramStore == null)
- {
- try
- {
- paramStore = new JabaParamStore(this,
- (Desktop.instance != null ? Desktop
- .getUserParameterStore() : null));
- } catch (Exception ex)
- {
- }
-
- }
- return paramStore;
- }
-
- public String getUri()
- {
- // this is only valid for Jaba 1.0 - this formula might have to change!
- return hosturl
- + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
- : "/") + serviceType;
- }
-
- private boolean hasParams = false, lookedForParams = false;
-
- public boolean hasParameters()
- {
- if (!lookedForParams)
- {
- lookedForParams = true;
- try
- {
- hasParams = (getRunnerConfig().getArguments().size() > 0);
- } catch (Exception e)
- {
-
- }
- }
- return hasParams;
- }
- };
+ validServiceUrls.add(jwsservers);
+ }
/**
* holds list of services.
*/
protected Vector<Jws2Instance> services;
-
+ /**
+ * attach all available web services to the appropriate submenu in the given JMenu
+ */
public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame)
{
// dynamically regenerate service list.
- final JMenu jws2al = wsmenu; // new JMenu("JABAWS Alignment");
- jws2al.addMenuListener(new MenuListener()
- {
- // TODO: future: add menu listener to parent menu - so submenus are
- // populated *before* they are selected.
- @Override
- public void menuSelected(MenuEvent e)
- {
- populateWSMenuEntry(jws2al, alignFrame);
- }
-
- @Override
- public void menuDeselected(MenuEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void menuCanceled(MenuEvent e)
- {
- // TODO Auto-generated method stub
-
- }
-
- });
- wsmenu.add(jws2al);
-
+ populateWSMenuEntry(wsmenu, alignFrame, null);
}
- private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame)
+ private void populateWSMenuEntry(JMenu jws2al, final AlignFrame alignFrame, String typeFilter)
{
if (running || services == null || services.size() == 0)
{
MsaWSClient msacl = new MsaWSClient();
Vector hostLabels = new Vector();
jws2al.removeAll();
- String lasthost = null;
+ Hashtable<String,String> lasthostFor = new Hashtable<String,String>();
Hashtable<String, ArrayList<Jws2Instance>> hosts = new Hashtable<String, ArrayList<Jws2Instance>>();
- String[] sorton;
+ ArrayList<String> hostlist=new ArrayList<String>();
for (Jws2Instance service : services)
{
ArrayList<Jws2Instance> hostservices = hosts.get(service.getHost());
{
hosts.put(service.getHost(),
hostservices = new ArrayList<Jws2Instance>());
+ hostlist.add(service.getHost());
}
hostservices.add(service);
}
- sorton = hosts.keySet().toArray(new String[1]);
- String hostlist[] = sorton.clone();
- jalview.util.QuickSort.sort(sorton, hostlist);
+ // now add hosts in order of the given array
for (String host : hostlist)
{
Jws2Instance orderedsvcs[] = hosts.get(host).toArray(
jalview.util.QuickSort.sort(sortbytype, orderedsvcs);
for (final Jws2Instance service : orderedsvcs)
{
- atpoint = jws2al;
+ atpoint = JvSwingUtils.findOrCreateMenu(jws2al,service.action);
String type = service.serviceType;
if (byhost)
{
// group
JMenuItem hitm;
atpoint.addSeparator();
- if (lasthost == null || !lasthost.equals(host))
+ if (lasthostFor.get(service.action) == null || !lasthostFor.get(service.action).equals(host))
{
atpoint.add(hitm = new JMenuItem(host));
hitm.setForeground(Color.blue);
});
hitm.setToolTipText(JvSwingUtils
.wrapTooltip("Opens the JABAWS server's homepage in web browser"));
- lasthost = host;
+ lasthostFor.put(service.action,host);
}
hostLabels.addElement(host + service.serviceType
+ service.getActionText());
// hostLabels.addElement(host + (bytype ?
// service.serviceType+service.getActionText() : ""));
}
- msacl.attachWSMenuEntry(atpoint, service, alignFrame);
+
+ service.attachWSMenuEntry(atpoint, alignFrame);
/*
* JMenuItem sitem = new JMenuItem(service.serviceType);
* sitem.setToolTipText("Hosted at " + service.hosturl);
public static void main(String[] args)
{
+ if (args.length>0)
+ {
+ testUrls = new Vector<String>();
+ for (String url:args)
+ {
+ testUrls.add(url);
+ };
+ }
Thread runner = getDiscoverer().startDiscoverer(
new PropertyChangeListener()
{
{
System.out.println("Changesupport: There are now "
+ getDiscoverer().services.size() + " services");
+ int i=1;
+ for (Jws2Instance instance:getDiscoverer().services)
+ {
+ System.out.println("Service "+i+++" "+instance.getClass()+"@"+instance.getHost()+": "+instance.getActionText());
+ }
}
}
}
;
}
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException x) {}
}
private static Jws2Discoverer discoverer;
}
}
+ private static Vector<String> testUrls=null;
public static Vector<String> getServiceUrls()
{
+ if (testUrls!=null)
+ {
+ // return test urls, if there are any, instead of touching cache
+ return testUrls;
+ }
String surls = Cache.getDefault(JWS2HOSTURLS,
"http://www.compbio.dundee.ac.uk/jabaws");
Vector<String> urls = new Vector<String>();
return thr;
}
- Vector<String> invalidServiceUrls = null, urlsWithoutServices = null;
+ Vector<String> invalidServiceUrls = null, urlsWithoutServices = null, validServiceUrls=null;
/**
* @return the invalidServiceUrls
return null;
}
+ public int getServerStatusFor(String url)
+ {
+ if (validServiceUrls!=null && validServiceUrls.contains(url))
+ {
+ return 1;
+ }
+ if (urlsWithoutServices!=null && urlsWithoutServices.contains(url))
+ return 0;
+ if (invalidServiceUrls!=null && invalidServiceUrls.contains(url))
+ {
+ return -1;
+ }
+ return -2;
+ }
}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import compbio.metadata.Option;
import compbio.metadata.Preset;
import compbio.metadata.PresetManager;
-import jalview.ws.jws2.Jws2Discoverer.Jws2Instance;
import jalview.ws.jws2.dm.JabaWsParamSet;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.ws.params.WsParamSetI;
/**
*/
MsaWS server;
- AlignFrame alignFrame;
-
- private WsParamSetI preset;
-
- private List<Argument> paramset;
-
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, String altitle,
+ public MsaWSClient(Jws2Instance sh, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
// TODO Auto-generated constructor stub
}
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, WsParamSetI preset,
+ public MsaWSClient(Jws2Instance sh, WsParamSetI preset,
String altitle, jalview.datamodel.AlignmentView msa,
boolean submitGaps, boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
* DOCUMENT ME!
*/
- public MsaWSClient(Jws2Discoverer.Jws2Instance sh, WsParamSetI preset,
+ public MsaWSClient(Jws2Instance sh, WsParamSetI preset,
List<Argument> arguments, boolean editParams, String altitle,
jalview.datamodel.AlignmentView msa, boolean submitGaps,
boolean preserveOrder, Alignment seqdataset,
AlignFrame _alignFrame)
{
- super();
- alignFrame = _alignFrame;
+ super(_alignFrame, preset, arguments);
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+
if (!(sh.service instanceof MsaWS))
{
// redundant at mo - but may change
return;
}
- server = sh.service;
- this.preset=preset;
- if (preset != null)
- {
- if (!((preset instanceof JabaPreset) || preset instanceof JabaWsParamSet)) {
- /*{
- this.preset = ((JabaPreset) preset).p;
- }
- else if (preset instanceof JabaWsParamSet)
- {
- List<Argument> newargs = new ArrayList<Argument>();
- JabaWsParamSet pset = ((JabaWsParamSet) preset);
- for (Option opt : pset.getjabaArguments())
- {
- newargs.add(opt);
- }
- if (arguments != null && arguments.size() > 0)
- {
- // merge arguments with preset's own arguments.
- for (Argument opt : arguments)
- {
- newargs.add(opt);
- }
- }
- paramset = newargs;
- }
- else
- {*/
- throw new Error(
- "Implementation error: Can only instantiate Jaba parameter sets.");
- }
- }
- else
- {
- // just provided with a bunch of arguments
- this.paramset = arguments;
- }
- if (editParams)
- {
- if (sh.paramStore == null)
- {
- sh.paramStore = new JabaParamStore(sh,
- Desktop.getUserParameterStore());
- }
- WsJobParameters jobParams = new WsJobParameters(sh, preset);
- if (!jobParams.showRunDialog())
- {
- return;
- }
- WsParamSetI prset = jobParams.getPreset();
- if (prset == null)
- {
- paramset = JabaParamStore.getJabafromJwsArgs(jobParams
- .getJobParams());
- }
- else
- {
- this.preset = prset; // ((JabaPreset) prset).p;
- paramset = null; // no user supplied parameters.
- }
- }
-
+ server = (MsaWS) sh.service;
if ((wsInfo = setWebService(sh, false)) == null)
{
JOptionPane.showMessageDialog(Desktop.desktop,
return (WebServiceName.indexOf("lustal") > -1); // cheat!
}
+
public void attachWSMenuEntry(JMenu rmsawsmenu,
final Jws2Instance service, final AlignFrame alignFrame)
{
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+/**
+ *
+ */
+package jalview.ws.jws2;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.List;
+
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+
+import compbio.metadata.Argument;
+
+import jalview.api.AlignCalcWorkerI;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.gui.JalviewDialog;
+import jalview.gui.JvSwingUtils;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.params.WsParamSetI;
+
+/**
+ * @author jimp
+ *
+ */
+public class SequenceAnnotationWSClient extends Jws2Client
+{
+
+ /**
+ * initialise a client so its attachWSMenuEntry method can be called.
+ */
+ public SequenceAnnotationWSClient()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ public SequenceAnnotationWSClient(final Jws2Instance sh,
+ AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
+ {
+ super(alignFrame, preset, null);
+ if (alignFrame.getViewport().getAlignment().isNucleotide())
+ {
+ JOptionPane.showMessageDialog(Desktop.desktop, sh.serviceType
+ + " can only be used\nfor amino acid alignments.",
+ "Wrong type of sequences!", JOptionPane.WARNING_MESSAGE);
+ return;
+
+ }
+ if (sh.action.toLowerCase().contains("conservation"))
+ {
+ // Build an AACons style client - take alignment, return annotation for
+ // columns
+
+ List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
+ .getCalcManager()
+ .getRegisteredWorkersOfClass(AAConsClient.class);
+ if (clnts == null || clnts.size() == 0)
+ {
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+ AAConsClient worker;
+ alignFrame
+ .getViewport()
+ .getCalcManager()
+ .registerWorker(
+ worker = new AAConsClient(sh, alignFrame, preset,
+ paramset));
+ alignFrame.getViewport().getCalcManager().startWorker(worker);
+
+ }
+ else
+ {
+ AAConsClient worker = (AAConsClient) clnts.get(0);
+ if (editParams)
+ {
+ paramset = worker.getArguments();
+ preset = worker.getPreset();
+ }
+
+ if (!processParams(sh, editParams, true))
+ return;
+ // reinstate worker if it was blacklisted (might have happened due to
+ // invalid parameters)
+ alignFrame.getViewport().getCalcManager().workerMayRun(worker);
+ worker.updateParameters(preset, paramset);
+
+ }
+ }
+ if (sh.action.toLowerCase().contains("disorder"))
+ {
+ // build IUPred style client. take sequences, returns annotation per
+ // sequence.
+ if (!processParams(sh, editParams))
+ {
+ return;
+ }
+
+ alignFrame
+ .getViewport()
+ .getCalcManager()
+ .startWorker(
+ new AADisorderClient(sh, alignFrame, preset, paramset));
+ }
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see jalview.ws.jws2.Jws2Client#attachWSMenuEntry(javax.swing.JMenu,
+ * jalview.ws.jws2.jabaws2.Jws2Instance, jalview.gui.AlignFrame)
+ */
+ public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
+ final AlignFrame alignFrame)
+ {
+ boolean hasparams = service.hasParameters();
+ // Assume name ends in WS
+ String calcName = service.serviceType.substring(0,
+ service.serviceType.length() - 2);
+
+ JMenuItem aacons = new JMenuItem(calcName + " Defaults");
+ aacons.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, null, false);
+ }
+ });
+ wsmenu.add(aacons);
+ if (hasparams)
+ {
+ // only add these menu options if the service has user-modifiable
+ // arguments
+ aacons = new JMenuItem("Edit settings and run ...");
+ aacons.setToolTipText("View and change parameters before running calculation");
+
+ aacons.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, null, true);
+ }
+ });
+ wsmenu.add(aacons);
+ List<WsParamSetI> presets = service.getParamStore().getPresets();
+ if (presets != null && presets.size() > 0)
+ {
+ JMenu presetlist = new JMenu("Run " + calcName + "with preset");
+
+ for (final WsParamSetI preset : presets)
+ {
+ final JMenuItem methodR = new JMenuItem(preset.getName());
+ methodR.setToolTipText("<html><p>"
+ + JvSwingUtils.wrapTooltip("<strong>"
+ + (preset.isModifiable() ? "User Preset"
+ : "Service Preset") + "</strong><br/>"
+ + preset.getDescription() + "</p>") + "</html>");
+ methodR.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ new SequenceAnnotationWSClient(service, alignFrame, preset,
+ false);
+ }
+
+ });
+ presetlist.add(methodR);
+ }
+ wsmenu.add(presetlist);
+ }
+
+ }
+ }
+}
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.ws.jws2.jabaws2;
+
+import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
+import jalview.ws.jws2.JabaParamStore;
+import jalview.ws.jws2.MsaWSClient;
+import jalview.ws.jws2.SequenceAnnotationWSClient;
+import jalview.ws.params.ParamDatastoreI;
+
+import java.io.Closeable;
+
+import javax.swing.JMenu;
+
+import compbio.data.msa.JABAService;
+import compbio.data.msa.MsaWS;
+import compbio.data.msa.SequenceAnnotation;
+import compbio.metadata.PresetManager;
+import compbio.metadata.RunnerConfig;
+
+public class Jws2Instance
+{
+ public String hosturl;
+
+ public String serviceType;
+ public String action;
+ public JABAService service;
+ public String description;
+
+ public Jws2Instance(String hosturl, String serviceType, String action, String description,
+ JABAService service)
+ {
+ super();
+ this.hosturl = hosturl;
+ this.serviceType = serviceType;
+ this.service = service;
+ this.action=action;
+ this.description = description;
+
+ }
+
+ PresetManager presets = null;
+
+ public JabaParamStore paramStore = null;
+
+ /**
+ * non thread safe - gets the presets for this service (blocks whilst it calls
+ * the service to get the preset set)
+ *
+ * @return service presets or null if exceptions were raised.
+ */
+ public PresetManager getPresets()
+ {
+ if (presets == null)
+ {
+ try
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ presets = ((MsaWS) service).getPresets();
+
+ }
+ if (service instanceof SequenceAnnotation<?>)
+ {
+ presets = ((SequenceAnnotation) service).getPresets();
+ }
+ } catch (Exception ex)
+ {
+ System.err.println("Exception when retrieving presets for service "
+ + serviceType + " at " + hosturl);
+ }
+ }
+ return presets;
+ }
+
+ public String getHost()
+ {
+ return hosturl;
+ /*
+ * try { URL serviceurl = new URL(hosturl); if (serviceurl.getPort()!=80) {
+ * return serviceurl.getHost()+":"+serviceurl.getPort(); } return
+ * serviceurl.getHost(); } catch (Exception e) {
+ * System.err.println("Failed to parse service URL '" + hosturl +
+ * "' as a valid URL!"); } return null;
+ */
+ }
+
+ /**
+ * @return short description of what the service will do
+ */
+ public String getActionText()
+ {
+ return action+" with " + serviceType;
+ }
+
+ /**
+ * non-thread safe - blocks whilst accessing service to get complete set of
+ * available options and parameters
+ *
+ * @return
+ */
+ public RunnerConfig getRunnerConfig()
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ return ((MsaWS) service).getRunnerOptions();
+ }
+ if (service instanceof SequenceAnnotation<?>)
+ {
+ return ((SequenceAnnotation) service).getRunnerOptions();
+ }
+ throw new Error("Implementation Error: Runner Config not available for a JABAWS service of type "+serviceType+" ("+service.getClass()+")");
+ }
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ if (service != null)
+ {
+ try
+ {
+ Closeable svc = (Closeable) service;
+ service = null;
+ svc.close();
+ } catch (Exception e)
+ {
+ }
+ ;
+ }
+ super.finalize();
+ }
+
+ public ParamDatastoreI getParamStore()
+ {
+ if (paramStore == null)
+ {
+ try
+ {
+ paramStore = new JabaParamStore(this,
+ (Desktop.instance != null ? Desktop.getUserParameterStore()
+ : null));
+ } catch (Exception ex)
+ {
+ }
+
+ }
+ return paramStore;
+ }
+
+ public String getUri()
+ {
+ // this is only valid for Jaba 1.0 - this formula might have to change!
+ return hosturl
+ + (hosturl.lastIndexOf("/") == (hosturl.length() - 1) ? ""
+ : "/") + serviceType;
+ }
+
+ private boolean hasParams = false, lookedForParams = false;
+
+ public boolean hasParameters()
+ {
+ if (!lookedForParams)
+ {
+ lookedForParams = true;
+ try
+ {
+ hasParams = (getRunnerConfig().getArguments().size() > 0);
+ } catch (Exception e)
+ {
+
+ }
+ }
+ return hasParams;
+ }
+
+ public void attachWSMenuEntry(JMenu atpoint, AlignFrame alignFrame)
+ {
+ if (service instanceof MsaWS<?>)
+ {
+ new MsaWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
+ } else
+ if (service instanceof SequenceAnnotation<?>){
+ new SequenceAnnotationWSClient().attachWSMenuEntry(atpoint, this, alignFrame);
+ }
+ }
+}
\ No newline at end of file
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
// TODO: cope with recovering hidden sequences from
// resultContext
{
- Vector sqs = sg.getSequences(null);
- for (int sqsi = 0, iSize = sqs.size(); sqsi < iSize; sqsi++)
+ for (SequenceI oseq:sg.getSequences(null))
{
- SequenceI oseq = (SequenceI) sqs.get(sqsi);
SequenceI nseq = getNewSeq(oseq, rseqs[nrj],
ordermap[nrj], destAl);
if (nseq != null)
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
import com.stevesoft.pat.Regex;
import com.sun.org.apache.xml.internal.serialize.OutputFormat.DTD;
-import com.sun.tools.doclets.internal.toolkit.util.DocFinder.Output;
public class RestServiceDescription
{
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
// blocks
ArrayList<int[]> gl = new ArrayList<int[]>();
int p = 0;
- for (SequenceGroup sg : (Vector<SequenceGroup>) al.getGroups())
+ List<SequenceGroup> sgs;
+ synchronized (sgs=al.getGroups())
+ {
+ for (SequenceGroup sg : sgs)
{
if (sg.getSize() < minsize)
{
gl.add(se);
}
}
+ }
// are there any more sequences ungrouped that should be added as a single
// remaining group ? - these might be at the start or the end
if (gl.size() > 0)
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*******************************************************************************
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
package jalview.ws.seqfetcher;\r
\r
import jalview.datamodel.AlignmentI;\r
+import jalview.datamodel.DBRefEntry;\r
import jalview.datamodel.SequenceI;\r
+import jalview.util.DBRefUtils;\r
\r
+import java.util.ArrayList;\r
+import java.util.Collection;\r
import java.util.Enumeration;\r
+import java.util.HashSet;\r
import java.util.Hashtable;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Stack;\r
import java.util.Vector;\r
\r
public class ASequenceFetcher\r
/**\r
* set of databases we can retrieve entries from\r
*/\r
- protected Hashtable FETCHABLEDBS;\r
+ protected Hashtable<String, Map<String, DbSourceProxy>> FETCHABLEDBS;\r
\r
public ASequenceFetcher()\r
{\r
public SequenceI[] getSequences(jalview.datamodel.DBRefEntry[] refs)\r
{\r
SequenceI[] ret = null;\r
- Vector rseqs = new Vector();\r
- Hashtable queries = new Hashtable();\r
+ Vector<SequenceI> rseqs = new Vector();\r
+ Hashtable<String, List<String>> queries = new Hashtable();\r
for (int r = 0; r < refs.length; r++)\r
{\r
if (!queries.containsKey(refs[r].getSource()))\r
{\r
- queries.put(refs[r].getSource(), new Vector());\r
+ queries.put(refs[r].getSource(), new ArrayList<String>());\r
}\r
- Vector qset = (Vector) queries.get(refs[r].getSource());\r
+ List<String> qset = queries.get(refs[r].getSource());\r
if (!qset.contains(refs[r].getAccessionId()))\r
{\r
- qset.addElement(refs[r].getAccessionId());\r
+ qset.add(refs[r].getAccessionId());\r
}\r
}\r
- Enumeration e = queries.keys();\r
+ Enumeration<String> e = queries.keys();\r
while (e.hasMoreElements())\r
{\r
- Vector query = null;\r
+ List<String> query = null;\r
String db = null;\r
- try\r
+ db = e.nextElement();\r
+ query = queries.get(db);\r
+ if (!isFetchable(db))\r
{\r
- db = (String) e.nextElement();\r
- query = (Vector) queries.get(db);\r
- if (!isFetchable(db))\r
- throw new Exception(\r
- "Don't know how to fetch from this database :" + db);\r
- DbSourceProxy fetcher = getSourceProxy(db);\r
- boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
- // separator\r
- // - no\r
- // Multiple\r
- // Queries\r
- Enumeration qs = query.elements();\r
- while (qs.hasMoreElements())\r
+ reportStdError(db, query, new Exception(\r
+ "Don't know how to fetch from this database :" + db));\r
+ continue;\r
+ }\r
+ Iterator<DbSourceProxy> fetchers = getSourceProxy(db).iterator();\r
+ Stack<String> queriesLeft = new Stack<String>();\r
+// List<String> queriesFailed = new ArrayList<String>();\r
+ queriesLeft.addAll(query);\r
+ while (fetchers.hasNext())\r
+ {\r
+ List<String> queriesMade = new ArrayList<String>();\r
+ HashSet queriesFound = new HashSet<String>();\r
+ try\r
{\r
- StringBuffer qsb = new StringBuffer();\r
- do\r
- {\r
- qsb.append((String) qs.nextElement());\r
- if (qs.hasMoreElements() && doMultiple) // and not reached limit for\r
- // multiple queries at one\r
- // time for this source\r
- {\r
- qsb.append(fetcher.getAccessionSeparator());\r
- }\r
- } while (doMultiple && qs.hasMoreElements());\r
-\r
- AlignmentI seqset = null;\r
- try\r
- {\r
- // create a fetcher and go to it\r
- seqset = fetcher.getSequenceRecords(qsb.toString());\r
- } catch (Exception ex)\r
+ DbSourceProxy fetcher = fetchers.next();\r
+ boolean doMultiple = fetcher.getAccessionSeparator() != null; // No\r
+ // separator\r
+ // - no\r
+ // Multiple\r
+ // Queries\r
+ while (!queriesLeft.isEmpty())\r
{\r
- System.err.println("Failed to retrieve the following from "\r
- + db);\r
- System.err.println(qsb);\r
- ex.printStackTrace(System.err);\r
- }\r
- // TODO: Merge alignment together - perhaps\r
- if (seqset != null)\r
- {\r
- SequenceI seqs[] = seqset.getSequencesArray();\r
- if (seqs != null)\r
+ StringBuffer qsb = new StringBuffer();\r
+ do\r
{\r
- for (int is = 0; is < seqs.length; is++)\r
+ if (qsb.length() > 0)\r
{\r
- rseqs.addElement(seqs[is]);\r
- seqs[is] = null;\r
+ qsb.append(fetcher.getAccessionSeparator());\r
}\r
+ String q = queriesLeft.pop();\r
+ queriesMade.add(q);\r
+ qsb.append(q);\r
+ } while (doMultiple && !queriesLeft.isEmpty());\r
+\r
+ AlignmentI seqset = null;\r
+ try\r
+ {\r
+ // create a fetcher and go to it\r
+ seqset = fetcher.getSequenceRecords(qsb.toString()); // ,\r
+ // queriesFailed);\r
+ } catch (Exception ex)\r
+ {\r
+ System.err.println("Failed to retrieve the following from "\r
+ + db);\r
+ System.err.println(qsb);\r
+ ex.printStackTrace(System.err);\r
}\r
- else\r
+ // TODO: Merge alignment together - perhaps\r
+ if (seqset != null)\r
{\r
- if (fetcher.getRawRecords() != null)\r
+ SequenceI seqs[] = seqset.getSequencesArray();\r
+ if (seqs != null)\r
{\r
- System.out.println("# Retrieved from " + db + ":"\r
- + qs.toString());\r
- StringBuffer rrb = fetcher.getRawRecords();\r
- /*\r
- * for (int rr = 0; rr<rrb.length; rr++) {\r
- */\r
- String hdr;\r
- // if (rr<qs.length)\r
- // {\r
- hdr = "# " + db + ":" + qsb.toString();\r
- /*\r
- * } else { hdr = "# part "+rr; }\r
- */\r
- System.out.println(hdr);\r
- if (rrb != null)\r
- System.out.println(rrb);\r
- System.out.println("# end of " + hdr);\r
+ for (int is = 0; is < seqs.length; is++)\r
+ {\r
+ rseqs.addElement(seqs[is]);\r
+ DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]\r
+ .getDBRef(), new DBRefEntry(db, null, null));\r
+ if (frefs != null)\r
+ {\r
+ for (DBRefEntry dbr : frefs)\r
+ {\r
+ queriesFound.add(dbr.getAccessionId());\r
+ queriesMade.remove(dbr.getAccessionId());\r
+ }\r
+ }\r
+ seqs[is] = null;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ if (fetcher.getRawRecords() != null)\r
+ {\r
+ System.out.println("# Retrieved from " + db + ":"\r
+ + qsb.toString());\r
+ StringBuffer rrb = fetcher.getRawRecords();\r
+ /*\r
+ * for (int rr = 0; rr<rrb.length; rr++) {\r
+ */\r
+ String hdr;\r
+ // if (rr<qs.length)\r
+ // {\r
+ hdr = "# " + db + ":" + qsb.toString();\r
+ /*\r
+ * } else { hdr = "# part "+rr; }\r
+ */\r
+ System.out.println(hdr);\r
+ if (rrb != null)\r
+ System.out.println(rrb);\r
+ System.out.println("# end of " + hdr);\r
+ }\r
+\r
}\r
}\r
+\r
}\r
+ } catch (Exception ex)\r
+ {\r
+ reportStdError(db, queriesMade, ex);\r
}\r
- } catch (Exception ex)\r
- {\r
- System.err\r
- .println("Failed to retrieve the following references from "\r
- + db);\r
- Enumeration qv = query.elements();\r
- int n = 0;\r
- while (qv.hasMoreElements())\r
+ if (queriesMade.size() > 0)\r
{\r
- System.err.print(" " + qv.nextElement() + ";");\r
- if (n++ > 10)\r
- {\r
- System.err.println();\r
- n = 0;\r
- }\r
+ System.out.println("# Adding " + queriesMade.size()\r
+ + " ids back to queries list for searching again (" + db\r
+ + ".");\r
+ queriesLeft.addAll(queriesMade);\r
}\r
- System.err.println();\r
- ex.printStackTrace();\r
}\r
}\r
if (rseqs.size() > 0)\r
return ret;\r
}\r
\r
+ public void reportStdError(String db, List<String> queriesMade,\r
+ Exception ex)\r
+ {\r
+\r
+ System.err.println("Failed to retrieve the following references from "\r
+ + db);\r
+ int n = 0;\r
+ for (String qv : queriesMade)\r
+ {\r
+ System.err.print(" " + qv + ";");\r
+ if (n++ > 10)\r
+ {\r
+ System.err.println();\r
+ n = 0;\r
+ }\r
+ }\r
+ System.err.println();\r
+ ex.printStackTrace();\r
+ }\r
+\r
/**\r
* Retrieve an instance of the proxy for the given source\r
* \r
* retrieval of specific DB source/version combinations.\r
* @return an instance of DbSourceProxy for that db.\r
*/\r
- public DbSourceProxy getSourceProxy(String db)\r
+ public List<DbSourceProxy> getSourceProxy(String db)\r
{\r
- DbSourceProxy dbs = (DbSourceProxy) FETCHABLEDBS.get(db);\r
+ List<DbSourceProxy> dbs;\r
+ Collection<DbSourceProxy> dblist = FETCHABLEDBS.get(db).values();\r
+ if (dblist.size()>1)\r
+ {\r
+ DbSourceProxy[] l=dblist.toArray(new DbSourceProxy[0]);\r
+ int i=0;\r
+ String[] nm=new String[l.length];\r
+ for (DbSourceProxy s:l)\r
+ {\r
+ nm[i++]=s.getDbName().toLowerCase();\r
+ }\r
+ jalview.util.QuickSort.sort(nm,l);\r
+ dbs = new ArrayList<DbSourceProxy>();\r
+ for (i=l.length-1;i>=0; i--)\r
+ {\r
+ dbs.add(l[i]);\r
+ }\r
+ } else {\r
+ dbs = new ArrayList<DbSourceProxy>(dblist);\r
+ }\r
return dbs;\r
}\r
\r
{\r
if (FETCHABLEDBS == null)\r
{\r
- FETCHABLEDBS = new Hashtable();\r
+ FETCHABLEDBS = new Hashtable<String, Map<String,DbSourceProxy>>();\r
+ }\r
+ Map<String,DbSourceProxy> slist = FETCHABLEDBS.get(proxy.getDbSource());\r
+ if (slist == null)\r
+ {\r
+ FETCHABLEDBS.put(proxy.getDbSource(),\r
+ slist = new Hashtable<String,DbSourceProxy>());\r
}\r
- FETCHABLEDBS.put(proxy.getDbSource(), proxy);\r
+ slist.put(proxy.getDbName(),proxy);\r
}\r
}\r
\r
/**\r
* test if the database handler for dbName contains the given dbProperty\r
- * \r
+ * when a dbName resolves to a set of proxies - this method will return the result of the test for the first instance.\r
+ * TODO implement additional method to query all sources for a db to find one with a particular property\r
* @param dbName\r
* @param dbProperty\r
* @return true if proxy has the given property\r
public boolean hasDbSourceProperty(String dbName, String dbProperty)\r
{\r
// TODO: decide if invalidDbName exception is thrown here.\r
- DbSourceProxy proxy = getSourceProxy(dbName);\r
- if (proxy != null)\r
+\r
+ List<DbSourceProxy> proxies = getSourceProxy(dbName);\r
+ if (proxies != null)\r
{\r
- if (proxy.getDbSourceProperties() != null)\r
+ for (DbSourceProxy proxy : proxies)\r
{\r
- return proxy.getDbSourceProperties().containsKey(dbProperty);\r
+ if (proxy.getDbSourceProperties() != null)\r
+ {\r
+ return proxy.getDbSourceProperties().containsKey(dbProperty);\r
+ }\r
}\r
}\r
return false;\r
while (dbs.hasMoreElements())\r
{\r
String dbn = (String) dbs.nextElement();\r
- DbSourceProxy dbp = (DbSourceProxy) FETCHABLEDBS.get(dbn);\r
- if (class1.isAssignableFrom(dbp.getClass()))\r
+ for (DbSourceProxy dbp : FETCHABLEDBS.get(dbn).values())\r
{\r
- src.addElement(dbn);\r
+ if (class1.isAssignableFrom(dbp.getClass()))\r
+ {\r
+ src.addElement(dbn);\r
+ }\r
}\r
}\r
if (src.size() > 0)\r
}\r
return sources;\r
}\r
+ public DbSourceProxy[] getDbSourceProxyInstances(\r
+ Class class1)\r
+ {\r
+ ArrayList<DbSourceProxy> prlist=new ArrayList<DbSourceProxy>();\r
+ for (String fetchable:getSupportedDb())\r
+ for (DbSourceProxy pr:getSourceProxy(fetchable))\r
+ {\r
+ if (class1.isInstance(pr)) {prlist.add(pr);}\r
+ }\r
+ if (prlist.size()==0)\r
+ {\r
+ return null;\r
+ }\r
+ return prlist.toArray(new DbSourceProxy[0]);\r
+ }\r
+\r
}\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
* database (unify with io)\r
* \r
* @author JimP\r
- * \r
+ * TODO: promote to API\r
*/\r
public interface DbSourceProxy\r
{\r
/**\r
* make one or more queries to the database and attempt to parse the response\r
* into an alignment\r
- * \r
- * @param queries\r
+ * @param queries - one or more queries for database in expected form\r
* @return null if queries were successful but result was not parsable\r
- * @throws Exception\r
- * TODO\r
+ * @throws Exception - propagated from underlying transport to database (note - exceptions are not raised if query not found in database)\r
+ * \r
*/\r
public AlignmentI getSequenceRecords(String queries) throws Exception;\r
\r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
+++ /dev/null
-/**
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import java.io.*;
-import java.lang.reflect.*;
-import java.net.*;
-import java.util.*;
-import java.util.logging.*;
-import javax.xml.parsers.*;
-
-import org.xml.sax.*;
-
-/**
- * A class to perform a DAS features request
- *
- * @author Andreas Prlic Adapted for jalview use.
- * @author Andrew Waterhouse Updated to Das 1.53e feature spec.
- * @author Jim Procter
- */
-public class DAS_FeatureRetrieve
-{
- String version;
-
- List features;
-
- Logger logger;
-
- int comeBackLater;
-
- URL url;
-
- /**
- * @param url
- * the URL the features should be downloaded from
- *
- */
- public DAS_FeatureRetrieve(URL url)
- {
- super();
-
- logger = Logger.getLogger("org.biojava.spice");
- features = new ArrayList();
- comeBackLater = -1;
- this.url = url;
- reload();
- }
-
- /**
- * contact the DAS-feature server again. Usually it is not necessary to call
- * this again, because the constructor already does, but if comeBackLater > -1
- * this should be called again.
- *
- */
- public void reload()
- {
-
- try
- {
-
- InputStream dasInStream = null;
- try
- {
- dasInStream = open(url);
- } catch (Exception e)
- {
- comeBackLater = -1;
- System.out.println("NO RESPONSE FROM " + url);
- logger.log(Level.FINE, "could not open connection to " + url, e);
- return;
- }
-
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- spfactory.setValidating(false);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- e.printStackTrace();
- }
-
- String vali = System.getProperty("XMLVALIDATION");
-
- boolean validation = false;
- if (vali != null)
- {
- if (vali.equals("true"))
- {
- validation = true;
- }
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- // XMLReader xmlreader = XMLReaderFactory.createXMLReader();
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validation);
- } catch (SAXException e)
- {
- logger.log(Level.FINE, "Cannot set validation " + validation);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validation);
- } catch (SAXNotRecognizedException e)
- {
- e.printStackTrace();
- logger
- .log(Level.FINE, "Cannot set load-external-dtd "
- + validation);
-
- }
-
- DAS_Feature_Handler cont_handle = new DAS_Feature_Handler();
- cont_handle.setDASCommand(url.toString());
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(dasInStream);
-
- try
- {
- xmlreader.parse(insource);
- features = cont_handle.get_features();
- version = cont_handle.getVersion();
-
- comeBackLater = cont_handle.getComBackLater();
- } catch (Exception e)
- {
- System.out
- .println("Error parsing response from: " + url + "\n" + e);
- logger.log(Level.FINE, "error while parsing response from " + url);
- comeBackLater = -1;
- features = new ArrayList();
- }
- } catch (Exception ex)
- {
- ex.printStackTrace();
- comeBackLater = -1;
- }
- }
-
- /**
- * open HttpURLConnection. Recommended way to open HttpURLConnections, since
- * this take care of setting timeouts properly for java 1.4 and 1.5
- */
- public static HttpURLConnection openHttpURLConnection(URL url)
- throws IOException, ConnectException
- {
- HttpURLConnection huc = null;
- huc = (HttpURLConnection) url.openConnection();
-
- String os_name = java.lang.System.getProperty("os.name");
- String os_version = java.lang.System.getProperty("os.version");
- String os_arch = java.lang.System.getProperty("os.arch");
- String VERSION = "1.0";
-
- String userAgent = "Jalview " + VERSION + "(" + os_name + "; "
- + os_arch + " ; " + os_version + ")";
- // e.g. "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.2) Gecko/20040803"
- huc.addRequestProperty("User-Agent", userAgent);
- // logger.finest("opening "+url);
-
- int timeout = 10000;
- System
- .setProperty("sun.net.client.defaultConnectTimeout", timeout
- + "");
- System.setProperty("sun.net.client.defaultReadTimeout", timeout + "");
-
- // use reflection to determine if get and set timeout methods for
- // urlconnection are available
- // seems java 1.5 does not watch the System properties any longer...
- // and java 1.4 did not provide these...
- // for 1.4 see setSystemProperties
-
- try
- {
- // try to use reflection to set timeout property
- Class urlconnectionClass = Class
- .forName("java.net.HttpURLConnection");
-
- Method setconnecttimeout = urlconnectionClass.getMethod(
- "setConnectTimeout", new Class[]
- { int.class });
- setconnecttimeout.invoke(huc, new Object[]
- { new Integer(timeout) });
-
- Method setreadtimeout = urlconnectionClass.getMethod(
- "setReadTimeout", new Class[]
- { int.class });
- setreadtimeout.invoke(huc, new Object[]
- { new Integer(timeout) });
- // System.out.println("successfully set java 1.5 timeout");
- } catch (Exception e)
- {
- // e.printStackTrace();
- // most likely it was a NoSuchMEthodException and we are running java 1.4.
- }
- return huc;
- }
-
- private InputStream open(URL url) throws java.io.IOException,
- java.net.ConnectException
- {
- InputStream inStream = null;
-
- HttpURLConnection huc = openHttpURLConnection(url);
-
- inStream = huc.getInputStream();
-
- return inStream;
-
- }
-
- /**
- * returns a List of Features
- *
- * @return a List of Maps containing the features
- */
- public List get_features()
- {
-
- return features;
- }
-
- /**
- * Get the version string of the reference object. If it does not match the
- * version string that is obtained from the reference server there is a
- * version problem!
- *
- * @return version string. (e.g. a MD5 digest of the reference sequence)
- */
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
- /**
- * returns the comeBackLater value - if a server returned suchh -
- *
- * @return comeBackLater in seconds, or -1 if not provided by server
- */
- public int getComeBackLater()
- {
-
- return comeBackLater;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import java.util.*;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * a class to parse the response of a DAS - Feature request
- *
- * @author Andreas Prlic Adapted for jalview use.
- * @author Andrew Waterhouse Updated to Das 1.53e feature spec.
- * @author Jim Procter
- *
- */
-public class DAS_Feature_Handler extends DefaultHandler
-{
-
- /**
- *
- */
- List features;
-
- boolean first_flag;
-
- HashMap feature;
-
- String featurefield;
-
- StringBuffer characterdata;
-
- String dasCommand;
-
- int comeBackLater;
-
- int maxFeatures;
-
- String segmentId;
-
- String version;
-
- String type_id;
-
- String type_category;
-
- public DAS_Feature_Handler()
- {
- super();
-
- features = new ArrayList();
- first_flag = true;
- featurefield = "";
- characterdata = new StringBuffer();
- dasCommand = "";
- comeBackLater = -1;
- maxFeatures = -1;
- segmentId = "";
- version = "";
- type_id = "";
- type_category = "";
- }
-
- /**
- * get the id information specified int the SEGMENT field of the DAS response
- *
- * @return the segmentId or an emtpy string if not available
- */
- public String getSegmentId()
- {
- return segmentId;
- }
-
- /**
- * get the version informationspecified in the SEGMENT field of the DAS
- * response
- *
- * @return the version information of an empty string if not available
- */
- public String getVersion()
- {
- return version;
- }
-
- public boolean isMD5Checksum()
- {
-
- if ((version != null) && (version.length() == 32))
- return true;
- return false;
- }
-
- /**
- * specifies a maximum number of features to be downloaded. if a server
- * returns more, they will be ignored. default is to load all features
- *
- * @param max
- * the maximium number of features to be downloaded
- */
-
- public void setMaxFeatures(int max)
- {
- maxFeatures = max;
- }
-
- public int getMaxFeatures()
- {
- return maxFeatures;
- }
-
- public void setDASCommand(String cmd)
- {
- dasCommand = cmd;
- }
-
- public String getDASCommand()
- {
- return dasCommand;
- }
-
- public List get_features()
- {
- return features;
- }
-
- public int getComBackLater()
- {
- return comeBackLater;
- }
-
- void start_feature(String uri, String name, String qName, Attributes atts)
- {
-
- if ((maxFeatures > 0) && (features.size() > maxFeatures))
- {
- characterdata = new StringBuffer();
- return;
- }
- feature = new HashMap();
- String id = atts.getValue("id");
- feature.put("id", id);
- feature.put("dassource", dasCommand);
- characterdata = new StringBuffer();
- }
-
- void add_featuredata(String uri, String name, String qName)
- {
- // System.out.println("featurefield "+featurefield+ " data "+characterdata);
- // NOTE can have multiple lines ..
-
- if ((maxFeatures > 0) && (features.size() > maxFeatures))
- {
- return;
- }
-
- String data = (String) feature.get(featurefield);
- String featureText = characterdata.toString();
- if (data != null)
- {
- featureText = data + " " + featureText;
- }
-
- if (qName.equals("TYPE"))
- {
- if (featureText.length() < 1)
- featureText = type_id;
-
- feature.put("TYPE_ID", type_id);
- feature.put("TYPE_CATEGORY", type_category);
- type_id = "";
- type_category = "";
- }
-
- feature.put(featurefield, featureText);
- featurefield = "";
- characterdata = new StringBuffer();
- }
-
- private void addLink(String uri, String name, String qName,
- Attributes atts)
- {
- String href = atts.getValue("href");
- feature.put("LINK", href);
- characterdata = new StringBuffer();
- featurefield = "LINK-TEXT";
-
- }
-
- private void addGroup(String uri, String name, String qName,
- Attributes atts)
- {
- String id = atts.getValue("id");
- feature.put("GROUP", id);
- characterdata = new StringBuffer();
- featurefield = "GROUP";
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
- // System.out.println("new element "+qName);
-
- if (qName.equals("FEATURE"))
- {
- start_feature(uri, name, qName, atts);
- }
- else if (qName.equals("LINK"))
- {
- addLink(uri, name, qName, atts);
- }
- else if (qName.equals("GROUP"))
- {
- addGroup(uri, name, qName, atts);
- }
- else if (qName.equals("METHOD") || qName.equals("TYPE")
- || qName.equals("START") || qName.equals("END")
- || qName.equals("NOTE") || qName.equals("SCORE")
- || qName.equals("ORIENTATION"))
- {
- characterdata = new StringBuffer();
- featurefield = qName;
- }
- else if (qName.equals("SEGMENT"))
- {
- String id = atts.getValue("id");
- if (id != null)
- segmentId = id;
- String v = atts.getValue("version");
- if (v != null)
- version = v;
-
- }
- if (qName.equals("TYPE"))
- {
- type_id = atts.getValue("id");
- type_category = atts.getValue("category");
- }
-
- }
-
- public void startDocument()
- {
- }
-
- public void endDocument()
- {
- }
-
- public void endElement(String uri, String name, String qName)
- {
-
- if (qName.equals("METHOD") || qName.equals("TYPE")
- || qName.equals("START") || qName.equals("END")
- || qName.equals("NOTE") || qName.equals("LINK")
- || qName.equals("SCORE") || qName.equals("ORIENTATION")
- || qName.equals("GROUP"))
- {
- add_featuredata(uri, name, qName);
- }
- else if (qName.equals("FEATURE"))
- {
-
- if (maxFeatures > 0)
- {
- if (features.size() < maxFeatures)
- {
- features.add(feature);
- }
- }
- else
- {
- // no restriction
- features.add(feature);
- }
- }
- }
-
- public void characters(char ch[], int start, int length)
- {
- if (maxFeatures > 0)
- if (features.size() > maxFeatures)
- return;
-
- for (int i = start; i < start + length; i++)
- {
-
- characterdata.append(ch[i]);
- }
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 19.03.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.das;
-
-import org.xml.sax.helpers.DefaultHandler;
-import org.xml.sax.Attributes;
-import java.util.logging.*;
-
-/**
- * a class that parses the XML response of a DAS - sequence command.
- *
- * @author Andreas Prlic
- *
- */
-public class DAS_Sequence_Handler extends DefaultHandler
-{
-
- StringBuffer sequence;
-
- int length;
-
- int maxLength;
-
- String version;
-
- boolean dna_flag;
-
- /**
- *
- */
- public DAS_Sequence_Handler()
- {
- super();
-
- sequence = new StringBuffer();
- length = 0;
- dna_flag = false;
- maxLength = -1;
- version = "";
- }
-
- /**
- * set a maximum length of sequence that should be loaded default: -1. if -1
- * no length restriction is being supplied
- *
- * @return the maximum length or -1 if no restriction
- */
- public int getMaxLength()
- {
- return maxLength;
- }
-
- /**
- * set a maximum length of sequence that should be loaded default: -1. if -1
- * no length restriction is being supplied
- *
- * @param maxLength
- * the maximum length or -1 if unrestricted
- */
- public void setMaxLength(int maxLength)
- {
- this.maxLength = maxLength;
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
-
- if (qName.equals("SEQUENCE"))
- {
- version = atts.getValue("version");
- String lenstr = atts.getValue("stop");
- length = Integer.parseInt(lenstr);
- dna_flag = true;
- }
-
- }
-
- public void characters(char ch[], int start, int length)
- {
-
- if (maxLength > 0)
- if (sequence.length() > maxLength)
- return;
-
- if (dna_flag)
- for (int i = start; i < start + length; i++)
- {
-
- // all sorts of characters can be found in "seqeunces" ... ignore
- // them...
- switch (ch[i])
- {
- case '\\':
- // System.out.print("\\\\");
- break;
- case '"':
- // System.out.print("\\\"");
- break;
- case '\n':
- // System.out.print("\\n");
- break;
- case '\r':
- // System.out.print("\\r");
- break;
- case '\t':
- // System.out.print("\\t");
- break;
- case ' ':
- break;
- default:
- sequence = sequence.append(ch[i]);
-
- break;
- }
- }
-
- }
-
- public String get_sequence()
- {
-
- if (maxLength < 0)
- {
- if (length != sequence.length())
- {
- Logger logger = Logger.getLogger("org.biojava.spice");
- logger.warning("Sequence does not match specified length!");
- }
- }
-
- return sequence.toString();
- }
-
- public String getVersion()
- {
- return version;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 21.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.das;
-
-import java.net.*;
-import java.util.*;
-import java.util.logging.*;
-
-import org.biojava.dasobert.dasregistry.*;
-import org.biojava.dasobert.eventmodel.*;
-
-/**
- * a thread that connects to a DAS - Feature service and gets the features
- *
- * @author Andreas Prlic
- */
-
-public class FeatureThread implements Runnable
-{
-
- /**
- * number of times the client tries to reconnect to the server if a "come back
- * later" is returned. the server should provide a reasonable estimation how
- * long it will take him to create results. if this number of requests is
- * still not successfull, give up.
- */
- public static int MAX_COME_BACK_ITERATIONS = 5;
-
- public static int MAX_NR_FEATURES = 300;
-
- static Logger logger = Logger.getLogger("org.biojava.spice");
-
- Das1Source dasSource;
-
- String ac;
-
- List featureListeners;
-
- Thread thread;
-
- public FeatureThread(String accessionCode, Das1Source dasSource)
- {
- this.dasSource = dasSource;
- this.ac = accessionCode;
- featureListeners = new ArrayList();
- }
-
- public void addFeatureListener(FeatureListener li)
- {
- featureListeners.add(li);
- }
-
- public void clearFeatureListeners()
- {
- featureListeners.clear();
- }
-
- public synchronized void stop()
- {
- thread = null;
- notify();
- }
-
- public void run()
- {
- Thread me = Thread.currentThread();
- while (thread == me)
- {
- String url = dasSource.getUrl();
- String queryString = url + "features?segment=" + ac;
- URL cmd = null;
- try
- {
- cmd = new URL(queryString);
- } catch (MalformedURLException e)
- {
- logger.warning("got MalformedURL from das source " + dasSource);
- e.printStackTrace();
-
- }
-
- logger.info("requesting features from " + cmd);
- DAS_FeatureRetrieve ftmp = new DAS_FeatureRetrieve(cmd);
-
- int comeBackLater = ftmp.getComeBackLater();
- int securityCounter = 0;
- while ((thread == me) && (comeBackLater > 0))
- {
- securityCounter++;
- if (securityCounter >= MAX_COME_BACK_ITERATIONS)
- {
- comeBackLater = -1;
- break;
-
- }
- notifyComeBackLater(comeBackLater);
- // server is still calculating - asks us to come back later
- try
- {
- wait(comeBackLater);
- } catch (InterruptedException e)
- {
- comeBackLater = -1;
- break;
- }
-
- ftmp.reload();
- comeBackLater = ftmp.getComeBackLater();
- }
-
- if (!(thread == me))
- {
- break;
- }
-
- List features = ftmp.get_features();
- String version = ftmp.getVersion();
-
- // a fallback mechanism to prevent DAS sources from bringing down spice
- if (features.size() > MAX_NR_FEATURES)
- {
- logger
- .warning("DAS source returned more than " + MAX_NR_FEATURES
- + "features. "
- + " throwing away excess features at " + cmd);
- features = features.subList(0, MAX_NR_FEATURES);
- }
-
- // notify FeatureListeners
- Map[] feats = (Map[]) features.toArray(new Map[features.size()]);
- notifyFeatureListeners(feats, version);
-
- break;
-
- }
- thread = null;
-
- }
-
- public void start()
- {
- thread = new Thread(this);
- thread.start();
- }
-
- private void notifyFeatureListeners(Map[] feats, String version)
- {
- logger.finest("FeatureThread found " + feats.length + " features");
- FeatureEvent fevent = new FeatureEvent(feats, dasSource, version);
- Iterator fiter = featureListeners.iterator();
- while (fiter.hasNext())
- {
- FeatureListener fi = (FeatureListener) fiter.next();
- fi.newFeatures(fevent);
- }
- }
-
- /**
- * the Annotation server requested to be queried again in a while
- *
- * @param comeBackLater
- */
- private void notifyComeBackLater(int comeBackLater)
- {
- FeatureEvent event = new FeatureEvent(new HashMap[0], dasSource, "");
- event.setComeBackLater(comeBackLater);
- Iterator fiter = featureListeners.iterator();
- while (fiter.hasNext())
- {
- FeatureListener fi = (FeatureListener) fiter.next();
- fi.comeBackLater(event);
- }
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 20, 2005
- *
- */
-package org.biojava.dasobert.das;
-
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Iterator;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.biojava.dasobert.dasregistry.Das1Source;
-import org.biojava.dasobert.eventmodel.SequenceEvent;
-import org.biojava.dasobert.eventmodel.SequenceListener;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.XMLReader;
-import java.util.*;
-
-/**
- * a thread that gets the sequence from a DAS server
- *
- * @author Andreas Prlic
- *
- */
-public class SequenceThread extends Thread
-{
-
- Das1Source[] sequenceServers;
-
- String sp_accession;
-
- List seqListeners;
-
- String version;
-
- static Logger logger = Logger.getLogger("org.biojava.spice");
-
- public SequenceThread(String sp_accession, Das1Source ds)
- {
- super();
- Das1Source[] dss = new Das1Source[1];
- dss[0] = ds;
- this.sp_accession = sp_accession;
- this.sequenceServers = dss;
- clearSequenceListeners();
- version = "";
- }
-
- public SequenceThread(String sp_accession, Das1Source[] ds)
- {
- super();
-
- this.sp_accession = sp_accession;
- this.sequenceServers = ds;
- clearSequenceListeners();
- }
-
- public void clearSequenceListeners()
- {
- seqListeners = new ArrayList();
- }
-
- public void addSequenceListener(SequenceListener lis)
- {
- seqListeners.add(lis);
- }
-
- public void run()
- {
- getSequence();
- }
-
- public void getSequence()
- {
-
- boolean gotSequence = false;
-
- for (int i = 0; i < sequenceServers.length; i++)
- {
-
- if (gotSequence)
- break;
-
- Das1Source ds = sequenceServers[i];
- String url = ds.getUrl();
- char lastChar = url.charAt(url.length() - 1);
- if (!(lastChar == '/'))
- url += "/";
- String dascmd = url + "sequence?segment=";
- String connstr = dascmd + sp_accession;
-
- try
- {
- version = "";
-
- String sequence = retrieveSequence(connstr);
- // TODO: discriminate exceptions caused by connection/server errors and ones caused by the sequence not being found in the reference source.
- if (sequence!=null)
- {
- // bug in aristotle das source?
- sequence.replaceAll(" ", "");
- gotSequence = true;
- // set the sequence ...
-
- triggerNewSequence(sp_accession, sequence, ds, version);
- }
- return;
- } catch (Exception ex)
- {
- ex.printStackTrace();
- logger.warning(ex.getMessage());
-
- // triggerException(ex);
-
- }
- }
-
- logger
- .log(
- Level.WARNING,
- "could not retreive UniProt sequence from any available DAS sequence server");
-
- triggerNoSequence(sp_accession);
-
- }
-
- // private void triggerException(Exception e){
- // Iterator iter = seqListeners.iterator();
- // while (iter.hasNext()){
- // SequenceListener li = (SequenceListener)iter.next();
- // li.exceptionOccured(e);
- // }
- // }
-
- private void triggerNewSequence(String sp_accession, String sequence,
- Das1Source source, String version)
- {
-
- Iterator iter = seqListeners.iterator();
- while (iter.hasNext())
- {
- SequenceListener li = (SequenceListener) iter.next();
- // SequenceEvent event = new SequenceEvent(sequence);
- SequenceEvent event = new SequenceEvent(sp_accession, sequence,
- version);
- event.setSource(source);
- li.newSequence(event);
- }
- }
-
- private void triggerNoSequence(String ac)
- {
-
- Iterator iter = seqListeners.iterator();
- while (iter.hasNext())
- {
- SequenceListener li = (SequenceListener) iter.next();
- li.noObjectFound(ac);
- }
-
- }
-
- /**
- * retrieve the Sequence from a DAS server.
- *
- * @param connstr -
- * the DAS - request string. e.g.
- * http://www.ebi.ac.uk/das-srv/uniprot/das/aristotle/sequence?segment=P00280
- * @return the requested Sequence
- * @throws Exception
- */
- public String retrieveSequence(String connstr) throws Exception
- {
-
- // logger.finest("trying: " + connstr) ;
- URL dasUrl = new URL(connstr);
- // DAS_httpConnector dhtp = new DAS_httpConnector() ;
- logger.info("requesting sequence from " + connstr);
- InputStream dasInStream = open(dasUrl);
-
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- // never do this
- // String vali = System.getProperty("XMLVALIDATION");
- String vali = "false";
- boolean validate = false;
- if ((vali != null) && (vali.equals("true")))
- validate = true;
- spfactory.setValidating(validate);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- // e.printStackTrace();
- logger.log(Level.FINER, "Uncaught exception", e);
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validate);
- } catch (SAXException e)
- {
- logger.finer("Cannot set validation to " + validate);
- logger.log(Level.FINER, "Uncaught exception", e);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validate);
- } catch (SAXNotRecognizedException e)
- {
- // e.printStackTrace();
- logger.finer("Cannot set load-external-dtd to" + validate);
- logger.log(Level.FINER, "Uncaught exception", e);
- // System.err.println("Cannot set load-external-dtd to" + validate);
- }
- if (dasInStream==null)
- {
- return null;
- }
- // DAS_DNA_Handler cont_handle = new DAS_DNA_Handler() ;
- DAS_Sequence_Handler cont_handle = new DAS_Sequence_Handler();
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(dasInStream);
-
- xmlreader.parse(insource);
- String sequence = cont_handle.get_sequence();
- version = cont_handle.getVersion();
- // logger.finest("Got sequence from DAS: " +sequence);
-
- logger.exiting(this.getClass().getName(), "retreiveSequence", sequence);
- return sequence;
- }
-
- private InputStream open(URL url)
- {
- {
-
- InputStream inStream = null;
- try
- {
-
- HttpURLConnection huc = null;
-
- huc = DAS_FeatureRetrieve.openHttpURLConnection(url);
-
- logger.finest(huc.getResponseMessage());
-
- inStream = huc.getInputStream();
-
- } catch (Exception ex)
- {
- ex.printStackTrace();
- logger.log(Level.WARNING, "exception occured", ex);
- }
-
- return inStream;
- }
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-public interface Das2Capability
-{
-
- public boolean equals(Das2Capability other);
-
- public int hashCode();
-
- public void setCapability(String type);
-
- public String getCapability();
-
- public void setQueryUri(String id);
-
- public String getQueryUri();
-
- public void setFormats(String[] formats);
-
- public String[] getFormats();
-
- /**
- * checks if this capability is actually of das1 style
- *
- * @return boolean true if the capability is in DAS1 style
- */
- public boolean isDas1Style();
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-public class Das2CapabilityImpl implements Das2Capability
-{
-
- String capability;
-
- String[] formats;
-
- String queryId;
-
- public static String DAS1_CAPABILITY_PREFIX = "das1:";
-
- public Das2CapabilityImpl()
- {
- super();
- capability = "undef";
- queryId = "";
- formats = new String[0];
-
- }
-
- public boolean isDas1Style()
- {
-
- if (capability == null)
- {
- return false;
- }
- if (capability.length() < DAS1_CAPABILITY_PREFIX.length())
- {
- return false;
- }
- if (capability.substring(0, DAS1_CAPABILITY_PREFIX.length()).equals(
- DAS1_CAPABILITY_PREFIX))
- {
- return true;
- }
- return false;
-
- }
-
- public boolean equals(Das2Capability other)
- {
-
- boolean status = true;
-
- if (!capability.equals(other.getCapability()))
- {
- status = false;
- }
- if (!queryId.equals(other.getQueryUri()))
- {
- status = false;
- }
-
- return status;
- }
-
- public int hashCode()
- {
- int h = 7;
- h = 31 * h + (null == capability ? 0 : capability.hashCode());
- h = 31 * h + (null == queryId ? 0 : queryId.hashCode());
-
- return h;
- }
-
- public String toString()
- {
- String txt = "capability " + capability + " queryId " + queryId;
- return txt;
- }
-
- public String getCapability()
- {
-
- return capability;
- }
-
- public String[] getFormats()
- {
- return formats;
- }
-
- public String getQueryUri()
- {
- return queryId;
- }
-
- public void setCapability(String type)
- {
- capability = type;
-
- }
-
- public void setFormats(String[] formats)
- {
-
- this.formats = formats;
- }
-
- public void setQueryUri(String id)
- {
- queryId = id;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public interface Das2Source extends DasSource
-{
-
- public Das2Capability[] getDas2Capabilities();
-
- public void setDas2Capabilities(Das2Capability[] capabilities);
-
- /**
- * test if this is a DAS1 source represented as a DAS2 source if true - this
- * source can be converted into a DAS1 source by using
- * DasSourceConverter.toDas1(Das2Source);
- *
- * @return true if the DasSource has DAS1 capabilties
- */
- public boolean hasDas1Capabilities();
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public class Das2SourceImpl extends Das1Source implements Das2Source
-
-{
-
- Das2Capability[] capabilities;
-
- public Das2SourceImpl()
- {
- super();
-
- capabilities = new Das2Capability[0];
- }
-
- /**
- * compare if two DasSources are identical
- *
- */
- public boolean equals(DasSource other)
- {
-
- if (this == other)
- {
- return true;
- }
-
- if ((other == null) || (other.getClass() != this.getClass()))
- {
- return false;
- }
-
- // to compare if two Das2Sources are identical we do the following:
- // we check the capabilities
-
- Das2SourceImpl d2o = (Das2SourceImpl) other;
-
- if (nickname.equals(d2o.getNickname()))
- {
- return true;
- }
-
- Das2Capability[] othercaps = d2o.getDas2Capabilities();
-
- if (!(capabilities.length == othercaps.length))
- {
- return false;
- }
-
- for (int x = 0; x < capabilities.length; x++)
- {
- Das2Capability tmpcap = capabilities[x];
- boolean foundCap = false;
- for (int y = 0; y < othercaps.length; y++)
- {
- Das2Capability tmpcapo = othercaps[y];
- if (tmpcap.equals(tmpcapo))
- {
- foundCap = true;
- }
- }
- if (!foundCap)
- {
- return false;
- }
- }
-
- // TODO?
- // should we add a check for coordinate systems?
- // but we already check for the endpoints, that should be enough...
-
- return true;
-
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
-
- for (int x = 0; x < capabilities.length; x++)
- {
- Das2Capability cap = capabilities[x];
- h = 31 * h + cap.hashCode();
- }
-
- return h;
- }
-
- public boolean hasDas1Capabilities()
- {
-
- // test if any of the capabilities is a das1 capabilitiy
-
- for (int i = 0; i < capabilities.length; i++)
- {
- Das2Capability cap = capabilities[i];
- if (cap.isDas1Style())
- {
- return true;
- }
- }
- return false;
-
- }
-
- public String[] getCapabilities()
- {
- // todo mark as not needed / not appropriate ...
- return super.getCapabilities();
- }
-
- public void setCapabilities(String[] u)
- {
- // TODO Auto-generated method stub
- super.setCapabilities(u);
- }
-
- public Das2Capability[] getDas2Capabilities()
- {
- // TODO Auto-generated method stub
- return capabilities;
- }
-
- public void setDas2Capabilities(Das2Capability[] capabilities)
- {
- // TODO Auto-generated method stub
- this.capabilities = capabilities;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 23, 2006
- *
- */
-package org.biojava.dasobert.das2;
-
-// import org.biojava.bio.program.das.dasalignment.DASException;
-import org.biojava.dasobert.dasregistry.*;
-
-public class DasSourceConverter
-{
-
- public DasSourceConverter()
- {
- super();
-
- }
-
- /**
- * convert a das2 source to a das 1 source. This only will work if is passes
- * the Das2Source.isDas1Source() test i.e. this is really a das1 server there
- *
- * @param das2source
- * a DAS2Source to be converted
- * @return a Das1Source
- * @throws DASException
- */
- public static Das1Source toDas1Source(Das2Source das2source)
- throws Exception
- {
- if (!das2source.hasDas1Capabilities())
- {
- throw new Exception(
- "this das source does not have das1 capabilitites");
- }
-
- Das1Source ds = new Das1Source();
- ds.setAdminemail(das2source.getAdminemail());
- ds.setDescription(das2source.getDescription());
- ds.setHelperurl(das2source.getHelperurl());
- ds.setRegisterDate(das2source.getRegisterDate());
- ds.setLeaseDate(das2source.getLeaseDate());
- ds.setLabels(das2source.getLabels());
- ds.setCoordinateSystem(das2source.getCoordinateSystem());
- ds.setNickname(das2source.getNickname());
- ds.setId(das2source.getId());
- ds.setLabels(das2source.getLabels());
-
- // convert the capabilitites to das1 capabiltities and get the url
- Das2Capability[] caps = das2source.getDas2Capabilities();
- String[] das1capabilitites = new String[caps.length];
- int DASPREFIXLENGTH = Das2CapabilityImpl.DAS1_CAPABILITY_PREFIX
- .length();
-
- for (int i = 0; i < caps.length; i++)
- {
- Das2Capability cap = caps[i];
-
- String c = cap.getCapability();
-
- das1capabilitites[i] = c.substring(DASPREFIXLENGTH, c.length());
-
- String query_uri = cap.getQueryUri();
-
- String url = query_uri.substring(0,
- (query_uri.length() - c.length() + DASPREFIXLENGTH));
- ds.setUrl(url);
- }
- ds.setCapabilities(das1capabilitites);
-
- return ds;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 15, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.util.*;
-
-import org.biojava.dasobert.das2.*;
-import org.biojava.dasobert.dasregistry.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * a parser for the DAS2 sources response
- *
- * @author Andreas Prlic
- * @since 6:53:45 PM
- * @version %I% %G%
- */
-public class DAS2SourceHandler extends DefaultHandler
-{
-
- List sources;
-
- Das2Source currentSource;
-
- List coordinates;
-
- List capabilities;
-
- List labels;
-
- public static final String LABELPROPERTY = "label";
-
- public DAS2SourceHandler()
- {
- super();
-
- sources = new ArrayList();
- currentSource = new Das2SourceImpl();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
- labels = new ArrayList();
- }
-
- private void startSource(String uri, String name, String qName,
- Attributes atts)
- {
-
- String id = atts.getValue("uri");
- String title = atts.getValue("title");
- String doc_ref = atts.getValue("doc_href");
- String description = atts.getValue("description");
-
- currentSource.setId(id);
- currentSource.setNickname(title);
- currentSource.setHelperurl(doc_ref);
- currentSource.setDescription(description);
-
- }
-
- private DasCoordinateSystem getCoordinateSystem(String uri, String name,
- String qname, Attributes atts)
- {
- // e.g. uri="http://das.sanger.ac.uk/dasregistry/coordsys/CS_LOCAL6"
- // source="Protein Sequence" authority="UniProt" test_range="P06213" />
- DasCoordinateSystem dcs = new DasCoordinateSystem();
- String id = atts.getValue("uri");
- dcs.setUniqueId(id);
-
- String source = atts.getValue("source");
- dcs.setCategory(source);
-
- String authority = atts.getValue("authority");
- dcs.setName(authority);
-
- String test_range = atts.getValue("test_range");
- dcs.setTestCode(test_range);
-
- try
- {
- String taxidstr = atts.getValue("taxid");
- int taxid = Integer.parseInt(taxidstr);
- dcs.setNCBITaxId(taxid);
- } catch (Exception e)
- {
- }
-
- String version = atts.getValue("version");
- if (version != null)
- {
- dcs.setVersion(version);
- }
-
- return dcs;
- }
-
- public void startElement(String uri, String name, String qName,
- Attributes atts)
- {
- // System.out.println("new element "+qName);
-
- if (qName.equals("SOURCE"))
- {
- // System.out.println("new Source " + atts.getValue(uri));
- currentSource = new Das2SourceImpl();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
-
- startSource(uri, name, qName, atts);
-
- }
- else if (qName.equals("MAINTAINER"))
- {
- String email = atts.getValue("email");
- currentSource.setAdminemail(email);
- }
- else if (qName.equals("COORDINATES"))
- {
- DasCoordinateSystem dcs = getCoordinateSystem(uri, name, qName, atts);
- coordinates.add(dcs);
-
- }
- else if (qName.equals("CAPABILITY"))
- {
- Das2Capability cap = getCapability(uri, name, qName, atts);
- capabilities.add(cap);
- }
- else if (qName.equals("PROPERTY"))
- {
- addProperty(uri, name, qName, atts);
- }
- }
-
- private Das2Capability getCapability(String uri, String name,
- String qName, Attributes atts)
- {
- // e.g <CAPABILITY type="features"
- // query_id="http://das.biopackages.net/das/genome/yeast/S228C/feature" />
- Das2Capability cap = new Das2CapabilityImpl();
-
- String type = atts.getValue("type");
- cap.setCapability(type);
- String query_uri = atts.getValue("query_uri");
- cap.setQueryUri(query_uri);
- return cap;
-
- }
-
- private void addProperty(String uri, String name, String qName,
- Attributes atts)
- {
- String pname = atts.getValue("name");
- String label = atts.getValue("value");
- if (pname.equals(LABELPROPERTY))
- {
- labels.add(label);
- }
- }
-
- public void startDocument()
- {
- sources = new ArrayList();
- coordinates = new ArrayList();
- capabilities = new ArrayList();
- }
-
- public void endElement(String uri, String name, String qName)
- {
- if (qName.equals("SOURCE"))
- {
- currentSource.setDas2Capabilities((Das2Capability[]) capabilities
- .toArray(new Das2Capability[capabilities.size()]));
- // System.out.println("got coordinates " + coordinates.size());
- currentSource.setCoordinateSystem((DasCoordinateSystem[]) coordinates
- .toArray(new DasCoordinateSystem[coordinates.size()]));
-
- currentSource.setLabels((String[]) labels.toArray(new String[labels
- .size()]));
- labels.clear();
-
- // System.out.println("Das2SourceHandler endElement name " + name + " uri
- // " + uri + " qName " + qName);
- // System.out.println("Das2SourceHandler adding to source: " +
- // currentSource.getId());
- sources.add(currentSource);
- currentSource = new Das2SourceImpl();
- }
- }
-
- public DasSource[] getSources()
- {
- // System.out.println("Das2SourceHandler: source size: " + sources.size());
- return (DasSource[]) sources.toArray(new DasSource[sources.size()]);
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 24, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.io.*;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public interface DasSourceReader
-{
-
- public DasSource[] readDasSource(InputStream stream);
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 24, 2006
- *
- */
-package org.biojava.dasobert.das2.io;
-
-import java.io.*;
-import java.net.*;
-import javax.xml.parsers.*;
-
-import org.biojava.dasobert.das.*;
-import org.biojava.dasobert.dasregistry.*;
-import org.xml.sax.*;
-
-public class DasSourceReaderImpl implements DasSourceReader
-{
-
- Exception loggedException;
-
- public DasSourceReaderImpl()
- {
- super();
- loggedException = null;
-
- // open the stream to a server and then parse the result ...
- }
-
- private InputStream open(URL url) throws java.io.IOException,
- java.net.ConnectException
- {
- InputStream inStream = null;
-
- HttpURLConnection huc = DAS_FeatureRetrieve.openHttpURLConnection(url);
-
- inStream = huc.getInputStream();
-
- return inStream;
-
- }
-
- public DasSource[] readDasSource(URL url)
- {
- DasSource[] sources = new DasSource[0];
-
- try
- {
- InputStream stream = open(url);
-
- sources = readDasSource(stream);
- } catch (Exception e)
- {
- System.err.println("Exception for url:"+url);
- e.printStackTrace();
- loggedException = e;
- }
- return sources;
- }
-
- /**
- * read a DAS2 sources response and return a list of DAS sources.
- *
- */
- public DasSource[] readDasSource(InputStream stream)
- {
-
- DasSource[] sources = new DasSource[0];
-
- try
- {
- SAXParserFactory spfactory = SAXParserFactory.newInstance();
-
- spfactory.setValidating(false);
-
- SAXParser saxParser = null;
-
- try
- {
- saxParser = spfactory.newSAXParser();
- } catch (ParserConfigurationException e)
- {
- e.printStackTrace();
- loggedException = e;
- }
-
- String vali = System.getProperty("XMLVALIDATION");
-
- boolean validation = false;
- if (vali != null)
- {
- if (vali.equals("true"))
- {
- validation = true;
- }
- }
-
- XMLReader xmlreader = saxParser.getXMLReader();
-
- // XMLReader xmlreader = XMLReaderFactory.createXMLReader();
- try
- {
- xmlreader.setFeature("http://xml.org/sax/features/validation",
- validation);
- } catch (SAXException e)
- {
- // logger.log(Level.FINE,"Cannot set validation " + validation);
- }
-
- try
- {
- xmlreader
- .setFeature(
- "http://apache.org/xml/features/nonvalidating/load-external-dtd",
- validation);
- } catch (SAXNotRecognizedException e)
- {
- e.printStackTrace();
- // logger.log(Level.FINE,"Cannot set load-external-dtd "+validation);
-
- }
-
- DAS2SourceHandler cont_handle = new DAS2SourceHandler();
-
- xmlreader.setContentHandler(cont_handle);
- xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
- InputSource insource = new InputSource();
- insource.setByteStream(stream);
-
- xmlreader.parse(insource);
- sources = cont_handle.getSources();
-
- } catch (Exception e)
- {
- e.printStackTrace();
- loggedException = e;
- }
- return sources;
- }
-
- public Exception getLoggedException()
- {
- return loggedException;
- }
-
- public static void main(String[] args)
- {
- String url = "http://www.spice-3d.org/dasregistry/das2/sources/";
- DasSourceReaderImpl reader = new DasSourceReaderImpl();
- try
- {
- URL u = new URL(url);
- DasSource[] sources = reader.readDasSource(u);
- for (int i = 0; i < sources.length; i++)
- {
- DasSource ds = sources[i];
- System.out.println(ds.toString());
- }
-
- } catch (Exception e)
- {
- e.printStackTrace();
- }
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-// import org.biojava.dasobert.das2.io.DasSourceWriter;
-// import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
-// import org.biojava.utils.xml.PrettyXMLWriter;
-
-/**
- * a simple Bean class to be returned via SOAP
- *
- * @author Andreas Prlic
- */
-
-public class Das1Source implements DasSource
-{
- String url;
-
- protected String nickname;
-
- String adminemail;
-
- String description;
-
- DasCoordinateSystem[] coordinateSystem;
-
- String[] capabilities;
-
- String[] labels;
-
- String helperurl;
-
- Date registerDate;
-
- Date leaseDate;
-
- String id;
-
- boolean local;
-
- Map properties;
-
- boolean alertAdmin;
-
- public static String EMPTY_ID = "UNK:-1";
-
- public Das1Source()
- {
- id = EMPTY_ID;
- url = "";
- adminemail = "";
- description = "";
- // String empty = "" ;
- nickname = "";
- coordinateSystem = new DasCoordinateSystem[0];
- // coordinateSystem[0] = new DasCoordinateSystem();
- capabilities = new String[0];
- labels = new String[0];
- // capabilities[0] = empty ;
- registerDate = new Date();
- leaseDate = new Date();
- helperurl = "";
- local = true;
- }
-
- public boolean equals(DasSource other)
- {
- System.out.println("Das1Source equals, comparing with other DasSource");
- if (!(other instanceof Das1Source))
- {
- return false;
- }
-
- Das1Source ods = (Das1Source) other;
-
- if (ods.getUrl().equals(url))
- {
- return true;
- }
- if (ods.getNickname().equals(nickname))
- {
- return true;
- }
- return false;
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == nickname ? 0 : nickname.hashCode());
- h = 31 * h + (null == url ? 0 : url.hashCode());
-
- return h;
- }
-
- /**
- * the DAS2 string representation of this DAS source
- *
- * public String toString() {
- *
- * StringWriter writer = new StringWriter();
- *
- * PrintWriter pw = new PrintWriter(writer); PrettyXMLWriter xw = new
- * PrettyXMLWriter(pw);
- *
- * DasSourceWriter dswriter = new DasSourceWriterImpl(); try {
- * dswriter.writeDasSource(xw,this); } catch (IOException e){
- * e.printStackTrace(); }
- *
- * return writer.toString();
- * }
- */
- public void setLocal(boolean flag)
- {
- local = flag;
- }
-
- public boolean isLocal()
- {
- return local;
- }
-
- public void setId(String i)
- {
- id = i;
- }
-
- /**
- * get a the Id of the DasSource. The Id is a unique db identifier. The public
- * DAS-Registry has Auto_Ids that look like DASSOURCE:12345; public look like
- * XYZ:12345, where the XYZ prefix can be configured in the config file.
- */
- public String getId()
- {
- return id;
- }
-
- public void setNickname(String name)
- {
- nickname = name;
- }
-
- public String getNickname()
- {
- return nickname;
- }
-
- public void setUrl(String u)
- {
- char lastChar = u.charAt(u.length() - 1);
- if (lastChar != '/')
- {
- u += "/";
- }
-
- url = u;
- }
-
- public void setAdminemail(String u)
- {
- adminemail = u;
- }
-
- public void setDescription(String u)
- {
- description = u;
- }
-
- public void setCoordinateSystem(DasCoordinateSystem[] u)
- {
- coordinateSystem = u;
- }
-
- public void setCapabilities(String[] u)
- {
- capabilities = u;
- }
-
- public String getUrl()
- {
- return url;
- }
-
- public String getAdminemail()
- {
- return adminemail;
- }
-
- public String getDescription()
- {
- return description;
- }
-
- public String[] getCapabilities()
- {
- return capabilities;
- }
-
- /**
- * test if a this source has a particular capability
- *
- * @param testCapability
- * @return <code>true</code> if the server has this capability.
- */
- public boolean hasCapability(String testCapability)
- {
- for (int i = 0; i < capabilities.length; i++)
- {
- String cap = capabilities[i];
- if (cap.equals(testCapability))
- return true;
- }
- return false;
- }
-
- public DasCoordinateSystem[] getCoordinateSystem()
- {
- return coordinateSystem;
- }
-
- public void setRegisterDate(Date d)
- {
- registerDate = d;
- }
-
- public Date getRegisterDate()
- {
- return registerDate;
- }
-
- public void setLeaseDate(Date d)
- {
- leaseDate = d;
- }
-
- public Date getLeaseDate()
- {
- return leaseDate;
- }
-
- public void setLabels(String[] ls)
- {
- labels = ls;
- }
-
- public String[] getLabels()
- {
- return labels;
- }
-
- public void setHelperurl(String url)
- {
- helperurl = url;
- }
-
- public String getHelperurl()
- {
- return helperurl;
- }
-
- public void setAlertAdmin(boolean flag)
- {
- alertAdmin = flag;
- }
-
- public boolean getAlertAdmin()
- {
- return alertAdmin;
- }
-
- public Map getProperties()
- {
- return properties;
- }
-
- public void setProperties(Map properties)
- {
- this.properties = properties;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Mar 20, 2006
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import org.biojava.dasobert.das2.*;
-
-public class Das2Validator
-{
-
- public Das2Validator()
- {
- super();
-
- }
-
- public boolean validate(Das2Source ds)
- {
-
- // TODO this bit still needs to be implemented!
-
- return true;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-/**
- * a comparator to sort DasSources
- *
- * @author Andreas Prlic
- */
-
-public abstract class DasCoordSysComparator implements Comparator
-{
-
- private final String name;
-
- private static final Map COMPS_BY_NAME;
-
- public DasCoordSysComparator(String str)
- {
- // System.out.println("new dasSourceComparator " + str);
- name = str;
- }
-
- public static final Comparator BY_NAME = new DasCoordSysComparator("name")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getName();
- }
- };
-
- public static final Comparator BY_ID = new DasCoordSysComparator("id")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getUniqueId();
- }
- };
-
- public static final Comparator BY_CATEGORY = new DasCoordSysComparator(
- "category")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getCategory();
- }
- };
-
- public static final Comparator BY_ORGANISM = new DasCoordSysComparator(
- "organism")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getOrganismName();
- }
- };
-
- public static final Comparator BY_TAXID = new DasCoordSysComparator(
- "taxid")
- {
- protected Comparable getField(DasCoordinateSystem ds)
- {
- return ds.getNCBITaxId() + "";
- }
- };
-
- static
- {
- COMPS_BY_NAME = new HashMap();
- COMPS_BY_NAME.put(BY_ID.toString(), BY_ID);
- COMPS_BY_NAME.put(BY_NAME.toString(), BY_NAME);
- COMPS_BY_NAME.put(BY_CATEGORY.toString(), BY_CATEGORY);
- COMPS_BY_NAME.put(BY_ORGANISM.toString(), BY_ORGANISM);
- COMPS_BY_NAME.put(BY_TAXID.toString(), BY_TAXID);
- }
-
- public static Comparator fromString(String name)
- {
- if (COMPS_BY_NAME.containsKey(name))
- {
- return (Comparator) COMPS_BY_NAME.get(name);
- }
- else
- {
- throw new IllegalArgumentException("Can't compare by key " + name);
- }
- }
-
- protected abstract Comparable getField(DasCoordinateSystem ds);
-
- /** compare two DasCoordSys objects */
- public int compare(Object a, Object b)
- {
- DasCoordinateSystem x = (DasCoordinateSystem) a;
- DasCoordinateSystem y = (DasCoordinateSystem) b;
- return getField(x).compareTo(getField(y));
- }
-
- public String toString()
- {
- return name;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-/**
- * a Bean to be returned via SOAP. It takes care of the DAS - coordinate Systems
- *
- * @author Andreas Prlic
- */
-public class DasCoordinateSystem
-{
-
- String name;
-
- String category;
-
- String organism_name;
-
- int ncbi_tax_id;
-
- String uniqueId;
-
- String version;
-
- String testCode;
-
- public DasCoordinateSystem()
- {
- uniqueId = "";
- name = "";
- category = "";
- organism_name = "";
- ncbi_tax_id = 0;
- version = "";
- testCode = "";
- }
-
- public boolean equals(DasCoordinateSystem other)
- {
- boolean match = true;
- System.out.println("comparing " + this.toString() + " to "
- + other.toString());
- // URI has piority
- if ((!uniqueId.equals("")) && (uniqueId.equals(other.getUniqueId())))
- {
- return true;
- }
-
- if (ncbi_tax_id != other.getNCBITaxId())
- {
- System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != "
- + other.getNCBITaxId());
- match = false;
- }
- if (!version.equals(other.getVersion()))
- {
- System.out.println("mismatch in version");
- match = false;
- }
- if (!category.equals(other.getCategory()))
- {
- System.out.println("mismatch in category");
- match = false;
- }
- if (!name.equals(other.getName()))
- {
- System.out.println("mismatch in name");
- match = false;
- }
- System.out.println(" match: " + match);
-
- return match;
- }
-
- public int hashCode()
- {
- int h = 7;
-
- h = 31 * h + (null == name ? 0 : name.hashCode());
- h = 31 * h + (null == category ? 0 : category.hashCode());
-
- return h;
- }
-
- public Object clone()
- {
- DasCoordinateSystem d = new DasCoordinateSystem();
- d.setTestCode(testCode);
- d.setCategory(category);
- d.setName(name);
- d.setNCBITaxId(ncbi_tax_id);
- d.setUniqueId(getUniqueId());
- d.setOrganismName(getOrganismName());
- d.setVersion(getVersion());
- return d;
- }
-
- public String getTestCode()
- {
- return testCode;
- }
-
- public void setTestCode(String testCode)
- {
- if (testCode == null)
- {
- testCode = "";
- }
- this.testCode = testCode;
- }
-
- public void setUniqueId(String id)
- {
- uniqueId = id;
- }
-
- public String getUniqueId()
- {
- return uniqueId;
- }
-
- public void setName(String n)
- {
- name = n;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setCategory(String c)
- {
- category = c;
- }
-
- public String getCategory()
- {
- return category;
- }
-
- public void setOrganismName(String t)
- {
- organism_name = t;
- }
-
- public String getOrganismName()
- {
- return organism_name;
- }
-
- public void setNCBITaxId(int id)
- {
- ncbi_tax_id = id;
- }
-
- public int getNCBITaxId()
- {
- return ncbi_tax_id;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- if (version == null)
- {
- version = "";
- }
- this.version = version;
- }
-
- public String toString()
- {
- String nam = name;
- if (!version.equals(""))
- {
- nam += "_" + version;
- }
-
- if (organism_name.equals(""))
- {
- return nam + "," + category;
- }
- else
- {
- return nam + "," + category + "," + organism_name;
- }
- }
-
- public static DasCoordinateSystem fromString(String rawString)
- {
- String[] spl = rawString.split(",");
- DasCoordinateSystem dcs = new DasCoordinateSystem();
- if (spl.length == 2)
- {
- dcs.setName(spl[0]);
- dcs.setCategory(spl[1]);
- }
- if (spl.length == 3)
- {
- dcs.setName(spl[0]);
- dcs.setCategory(spl[1]);
- dcs.setOrganismName(spl[2]);
- }
- return dcs;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 8, 2006
- *
- */
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-public interface DasSource
-{
-
- public void setLocal(boolean flag);
-
- public boolean isLocal();
-
- /**
- * compare if two das sources are equal
- *
- * @param ds
- * @return returns true if two DAS sources are equivalent
- */
- public boolean equals(DasSource ds);
-
- /**
- * classes that implement equals, should also implement hashKey
- *
- * @return the hash code of a das source
- */
- public int hashCode();
-
- public void setId(String i);
-
- /**
- * get a the Id of the DasSource. The Id is a unique db identifier. The public
- * DAS-Registry has Auto_Ids that look like DASSOURCE:12345; public look like
- * XYZ:12345, where the XYZ prefix can be configured in the config file.
- *
- * @return String the ID of a Das Source
- */
- public String getId();
-
- public void setNickname(String name);
-
- public String getNickname();
-
- public void setUrl(String u);
-
- public void setAdminemail(String u);
-
- public void setDescription(String u);
-
- public void setCoordinateSystem(DasCoordinateSystem[] u);
-
- public void setCapabilities(String[] u);
-
- /**
- * test if a this source has a particular capability
- *
- * @param testCapability
- * @return <code>true</code> if the server has this capability.
- */
- public boolean hasCapability(String testCapability);
-
- public String getUrl();
-
- public String getAdminemail();
-
- public String getDescription();
-
- public String[] getCapabilities();
-
- public DasCoordinateSystem[] getCoordinateSystem();
-
- public void setRegisterDate(Date d);
-
- public Date getRegisterDate();
-
- public void setLeaseDate(Date d);
-
- public Date getLeaseDate();
-
- public void setLabels(String[] ls);
-
- public String[] getLabels();
-
- public void setHelperurl(String url);
-
- public String getHelperurl();
-
- // TestCode is now part of the coordinate system!
- // public void setTestCode(String code);
- // public String getTestCode();
-
- public void setAlertAdmin(boolean flag);
-
- public boolean getAlertAdmin();
-
- /**
- * set Properties for this DAS source, e.g. project name
- *
- * @param properties
- */
- public void setProperties(Map properties);
-
- /**
- * get Properties for this DAS source
- *
- * @return Properties
- */
- public Map getProperties();
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 15.04.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.dasregistry;
-
-import java.util.*;
-
-/**
- * a comparator to sort DasSources
- *
- * @author Andreas Prlic, Thomas Down
- */
-
-public abstract class DasSourceComparator implements Comparator
-{
-
- private final String name;
-
- private static final Map COMPS_BY_NAME;
-
- private static final int TWODAYS = 1000 * 60 * 60 * 24 * 2;
-
- public DasSourceComparator(String str)
- {
- // System.out.println("new dasSourceComparator " + str);
- name = str;
- }
-
- public static final Comparator BY_ID = new DasSourceComparator("id")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getId();
- }
- };
-
- public static final Comparator BY_NICKNAME = new DasSourceComparator(
- "nickname")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getNickname();
- }
- };
-
- public static final Comparator BY_STATUS = new DasSourceComparator(
- "status")
- {
- protected Comparable getField(DasSource ds)
- {
-
- Date now = new Date();
-
- if (ds.getLeaseDate().getTime() < (now.getTime() - TWODAYS))
- return new Integer(0);
- return new Integer(1);
- }
- };
-
- public static final Comparator BY_REGISTER_DATE = new DasSourceComparator(
- "registerdate")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getRegisterDate();
- }
- };
-
- public static final Comparator BY_LEASE_DATE = new DasSourceComparator(
- "leasedate")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getLeaseDate();
- }
- };
-
- public static final Comparator BY_URL = new DasSourceComparator("url")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getUrl();
- }
- };
-
- public static final Comparator BY_ADMIN_EMAIL = new DasSourceComparator(
- "adminemail")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getAdminemail();
- }
- };
-
- public static final Comparator BY_DESCRIPTION = new DasSourceComparator(
- "description")
- {
- protected Comparable getField(DasSource ds)
- {
- return ds.getDescription();
- }
- };
-
- public static final Comparator BY_CAPABILITIES = new DasSourceComparator(
- "capabilities")
- {
- protected Comparable getField(DasSource ds)
- {
- String[] caps = ds.getCapabilities();
- return caps.length == 0 ? "" : caps[0];
- }
- };
-
- public static final Comparator BY_COORDINATE_SYSTEM = new DasSourceComparator(
- "coordinateSystem")
- {
- protected Comparable getField(DasSource ds)
- {
- DasCoordinateSystem[] dcss = ds.getCoordinateSystem();
- return dcss.length == 0 ? "" : dcss[0].toString();
- }
- };
-
- static
- {
- COMPS_BY_NAME = new HashMap();
- COMPS_BY_NAME.put(BY_ID.toString(), BY_ID);
- COMPS_BY_NAME.put(BY_NICKNAME.toString(), BY_NICKNAME);
- COMPS_BY_NAME.put(BY_REGISTER_DATE.toString(), BY_REGISTER_DATE);
- COMPS_BY_NAME.put(BY_LEASE_DATE.toString(), BY_LEASE_DATE);
- COMPS_BY_NAME.put(BY_URL.toString(), BY_URL);
- COMPS_BY_NAME.put(BY_ADMIN_EMAIL.toString(), BY_ADMIN_EMAIL);
- COMPS_BY_NAME.put(BY_DESCRIPTION.toString(), BY_DESCRIPTION);
- COMPS_BY_NAME.put(BY_CAPABILITIES.toString(), BY_CAPABILITIES);
- COMPS_BY_NAME
- .put(BY_COORDINATE_SYSTEM.toString(), BY_COORDINATE_SYSTEM);
- COMPS_BY_NAME.put(BY_STATUS.toString(), BY_STATUS);
-
- }
-
- public static Comparator fromString(String name)
- {
- if (COMPS_BY_NAME.containsKey(name))
- {
- return (Comparator) COMPS_BY_NAME.get(name);
- }
- else
- {
- throw new IllegalArgumentException("Can't compare by key " + name);
- }
- }
-
- protected abstract Comparable getField(DasSource ds);
-
- /** compare two DasSource objects */
- public int compare(Object a, Object b)
- {
-
- DasSource x = (DasSource) a;
- DasSource y = (DasSource) b;
- return getField(x).compareTo(getField(y));
- }
-
- public String toString()
- {
- return name;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 17, 2006
- *
- */
-
-package org.biojava.dasobert.eventmodel;
-
-import org.biojava.dasobert.dasregistry.Das1Source;
-
-public class AbstractDasEvent
-{
-
- Das1Source dasSource;
-
- public Das1Source getSource()
- {
- return dasSource;
- }
-
- public void setSource(Das1Source source)
- {
- this.dasSource = source;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Oct 28, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-import java.util.*;
-
-import org.biojava.dasobert.dasregistry.*;
-
-public class FeatureEvent extends AbstractDasEvent
-{
-
- Map[] features;
-
- int comeBackLater;
-
- String version;
-
- public FeatureEvent(Map[] features, Das1Source dasSource, String version)
- {
- super();
- this.features = features;
- this.dasSource = dasSource;
- comeBackLater = -1;
- this.version = version;
- }
-
- public int getComeBackLater()
- {
- return comeBackLater;
- }
-
- public void setComeBackLater(int comeBackLater)
- {
- this.comeBackLater = comeBackLater;
- }
-
- /**
- * get the features that have been found.
- *
- * do something like Map[] features = event.getFeatures();
- *
- * <pre>
- * for (int i = 0; i < features; i++)
- * {
- * Map f = features[i];
- * String type = (String) f.get("TYPE");
- * System.out.println(type);
- * }
- * </pre>
- *
- * @return a Map containng the features
- */
- public Map[] getFeatures()
- {
- return features;
- }
-
- /**
- * Get the version of the reference object that has been annotated. Compare
- * the version string with the version string obtained from the reference
- * server. If they don;t match there is a version problem between the
- * annotation and the reference!
- *
- * @return the version string (e.g. an MD5 digest of the reference sequence)
- */
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Oct 28, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-// import org.biojava.spice.multipanel.eventmodel.FeatureEvent;
-
-/**
- * a feature listener that returns the raw features as returned by a DAS source.
- *
- */
-public interface FeatureListener
-{
-
- /**
- * new features have been returned from the Annotation server
- *
- * @param e
- */
- public void newFeatures(FeatureEvent e);
-
- /**
- * the server says that he is busy and we should try again in x seconds
- *
- * @param e
- */
- public void comeBackLater(FeatureEvent e);
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 1, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-/**
- * an interface for the listeners of new PDB code requested / new Uniprot code
- * requested
- *
- * @author Andreas Prlic
- *
- */
-public interface ObjectListener
-{
-
- /**
- * a new object has been requested
- *
- * @param accessionCode
- */
- public void newObjectRequested(String accessionCode);
-
- /**
- * no object with that accessionCode has been found
- *
- * @param accessionCode
- */
- public void noObjectFound(String accessionCode);
-
- // public void exceptionOccured(Exception e);
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Nov 20, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-public class SequenceEvent extends AbstractDasEvent
-{
-
- String sequence;
-
- String accessionCode;
-
- String version;
-
- public SequenceEvent(String accessionCode, String seq, String version)
- {
- super();
- sequence = seq;
- this.accessionCode = accessionCode;
- this.version = version; // bugfix here ?
- }
-
- public String getAccessionCode()
- {
- return accessionCode;
- }
-
- public String getSequence()
- {
- return sequence;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public void setVersion(String version)
- {
- this.version = version;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Jun 10, 2005
- *
- */
-package org.biojava.dasobert.eventmodel;
-
-/**
- * An interface fore events related to selections of sequence position, sequence
- * range and locking of the selection.
- *
- * @author Andreas Prlic
- *
- */
-public interface SequenceListener extends ObjectListener
-{
-
- /* select a certain sequence position */
- public void selectedSeqPosition(int position);
-
- /**
- * select a certain range of a sequence
- *
- * @param start
- * the start
- * @param end
- * the end of the range
- */
- public void selectedSeqRange(int start, int end);
-
- /**
- * the current selecetion is locked and can not be changed
- *
- * @param flag
- * true if selection should be locked
- */
- public void selectionLocked(boolean flag);
-
- public void newSequence(SequenceEvent e);
-
- /**
- * clear what has been selected
- *
- *
- */
- public void clearSelection();
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2005
- *
- */
-package org.biojava.dasobert.feature;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * An Abstract class representing a Feature as being diplayed in the
- * SeqFeaturePanel A feature corresponds to everything that is visible in a
- * "line" and can contain one or multiple Segments.
- *
- *
- * @author Andreas Prlic
- *
- */
-public abstract class AbstractFeatureTrack implements FeatureTrack,
- Cloneable
-{
-
- String name;
-
- String method;
-
- String type;
-
- List segments;
-
- String note;
-
- String link;
-
- String source;
-
- String score;
-
- String orientation;
-
- String typeID;
-
- String typeCategory;
-
- public AbstractFeatureTrack()
- {
- source = "Unknown";
- method = "Unknown";
- type = "Unknown";
- note = "";
- link = "";
- score = "";
- orientation = null;
- segments = new ArrayList();
-
- }
-
- public abstract Object clone();
-
- public String toString()
- {
- String str = "Feature: method: " + method + " type: " + type;
- if (name != null)
- str += " name: " + name;
-
- if ((note != null) && (!note.equals("null")))
- {
- if (note.length() > 40)
- str += "note: " + note.substring(0, 39) + "...";
- else
- str += " note: " + note;
- }
- str += " # segments: " + segments.size();
- return str;
- }
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Feature
- *
- * @param seqPosition
- * the position to check
- * @return true if the position is within the ranges of the segments of this
- * feature
- */
- public boolean overlaps(int seqPosition)
- {
- List segments = getSegments();
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
-
- Segment seg = (Segment) iter.next();
- if (seg.overlaps(seqPosition))
- return true;
- }
-
- return false;
- }
-
- public void setSource(String s)
- {
- source = s;
- }
-
- public String getSource()
- {
- return source;
- };
-
- public void setName(String nam)
- {
- name = nam;
- }
-
- public String getName()
- {
- return name;
- }
-
- public void setMethod(String methd)
- {
- method = methd;
- }
-
- public String getMethod()
- {
- return method;
- }
-
- public void setType(String typ)
- {
- type = typ;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setNote(String nte)
- {
- if (nte != null)
- note = nte;
- }
-
- public String getNote()
- {
- return note;
- }
-
- public void setLink(String lnk)
- {
- link = lnk;
- }
-
- public String getLink()
- {
- return link;
- }
-
- public void setScore(String s)
- {
- score = s;
- }
-
- public String getScore()
- {
- return score;
- }
-
- /** add a segment to this feature */
- public void addSegment(int start, int end, String name)
- {
- Segment s = new SegmentImpl();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setParent(this);
- segments.add(s);
- }
-
- public void addSegment(Segment s)
- {
- s.setParent(this);
- segments.add(s);
- }
-
- public List getSegments()
- {
- return segments;
- }
-
- public String getOrientation()
- {
- return orientation;
- }
-
- public void setOrientation(String orientation)
- {
- this.orientation = orientation;
- }
-
- /**
- * test if two features are equivalent important: only comares type,method and
- * source. The individual segments are not compared!
- *
- */
- public boolean equals(FeatureTrack feat)
- {
- // if ( note == null) {
- // if (( feat.getNote() == null ) ||
- // ( feat.getNote().equals(""))) {
- // } else if ( this.note.equals(feat.getNote())){
- // return true;
- // }
- if (this.type.equals(feat.getType()))
- {
- if (this.method.equals(feat.getMethod()))
- {
- if (this.source.equals(feat.getSource()))
- {
- if (this.note.equals(feat.getNote()))
- {
- return true;
- }
- }
- }
- }
- return false;
-
- }
-
- public String getTypeCategory()
- {
- // TODO Auto-generated method stub
- return typeCategory;
- }
-
- public String getTypeID()
- {
- // TODO Auto-generated method stub
- return typeID;
- }
-
- public void setTypeCategory(String typeCategory)
- {
- this.typeCategory = typeCategory;
-
- }
-
- public void setTypeID(String typeID)
- {
- this.typeID = typeID;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-public abstract class AbstractSegment implements Segment, Cloneable
-{
- int start;
-
- int end;
-
- String name;
-
- Color color;
-
- FeatureTrack parent;
-
- String txtColor;
-
- String note;
-
- public abstract Object clone();
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#toString()
- */
- public String toString()
- {
- String str = "Segment: " + name + " " + start + " " + end;
- if ((note != null) && (!note.equals("null")))
- if (note.length() > 40)
- str += note.substring(0, 39) + "...";
- else
- str += note;
- return str;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getNote()
- */
- public String getNote()
- {
- return note;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setNote(java.lang.String)
- */
- public void setNote(String note)
- {
- this.note = note;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setStart(int)
- */
- public void setStart(int strt)
- {
- start = strt;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getStart()
- */
- public int getStart()
- {
- return start;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setEnd(int)
- */
- public void setEnd(int ed)
- {
- end = ed;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getEnd()
- */
- public int getEnd()
- {
- return end;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setName(java.lang.String)
- */
- public void setName(String nam)
- {
- name = nam;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getName()
- */
- public String getName()
- {
- return name;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setColor(java.awt.Color)
- */
- public void setColor(Color col)
- {
- color = col;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getColor()
- */
- public Color getColor()
- {
- return color;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setParent(org.biojava.spice.feature.Feature)
- */
- public void setParent(FeatureTrack f)
- {
- parent = f;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getParent()
- */
- public FeatureTrack getParent()
- {
- return parent;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#setTxtColor(java.lang.String)
- */
- public void setTxtColor(String str)
- {
- txtColor = str;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#getTxtColor()
- */
- public String getTxtColor()
- {
- return txtColor;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#overlaps(int)
- */
- public boolean overlaps(int seqPosition)
- {
- if ((getStart() <= seqPosition) && (getEnd() >= seqPosition))
- {
- return true;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.biojava.spice.feature.SegmentIF#overlaps(org.biojava.spice.feature.Segment)
- */
- public boolean overlaps(Segment segment)
- {
- if (!(this.start <= this.end))
- throw new IndexOutOfBoundsException("start > end for segment" + this);
-
- if (!(segment.getStart() <= segment.getEnd()))
- throw new IndexOutOfBoundsException("start > end for segment"
- + segment);
-
- // start must be in region of other
- if (this.start >= segment.getStart())
- {
- if (this.start <= segment.getEnd())
- {
- return true;
- }
- }
- // or end must be in region of other..
- if (this.end >= segment.getStart())
- {
- if (this.end <= segment.getEnd())
- {
- return true;
- }
- }
-
- if (this.start <= segment.getStart())
- {
- if (this.end >= segment.getEnd())
- {
- return true;
- }
- }
- return false;
- }
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 23.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * a comparator to sort Features byt type
- *
- * @author Andreas Prlic
- */
-
-public class FeatureComparator implements Comparator
-{
-
- public FeatureComparator()
- {
- }
-
- public int compare(Object a, Object b)
- {
- FeatureTrack x = (FeatureTrack) a;
- FeatureTrack y = (FeatureTrack) b;
-
- String typea = x.getType();
- String typeb = y.getType();
-
- if (!typea.equals(typeb))
- return typea.compareTo(typeb);
-
- List s1 = x.getSegments();
- List s2 = y.getSegments();
-
- Iterator iter1 = s1.iterator();
- Iterator iter2 = s2.iterator();
-
- while (iter1.hasNext())
- {
- Segment seg1 = (Segment) iter1.next();
- int start1 = seg1.getStart();
-
- while (iter2.hasNext())
- {
- Segment seg2 = (Segment) iter2.next();
- int start2 = seg2.getStart();
-
- if (start1 < start2)
- {
- return -1;
- }
- if (start1 > start2)
- {
- return 1;
- }
-
- }
- }
-
- return 0;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 23.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-import java.util.Map;
-
-/**
- * a comparator to sort Features if they are still in a Map ( sorts by type )
- *
- * @author Andreas Prlic
- */
-
-public class FeatureMapComparator implements Comparator
-{
-
- public FeatureMapComparator()
- {
- }
-
- public int compare(Object a, Object b)
- {
- Map x = (Map) a;
- Map y = (Map) b;
-
- String typea = (String) x.get("TYPE");
- String typeb = (String) y.get("TYPE");
-
- if (isSecstruc(typea) && isSecstruc(typeb))
- {
- return 0;
- }
- return typea.compareTo(typeb);
- }
-
- public boolean isSecstruc(String type)
- {
- if (type.equals("HELIX") || type.equals("STRAND")
- || type.equals("TURN"))
- {
- return true;
- }
- return false;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Feb 9, 2005
- *
- */
-package org.biojava.dasobert.feature;
-
-import java.util.List;
-
-/**
- * A feature corresponds to a track in Ensembl
- *
- * @author Andreas Prlic
- *
- */
-public interface FeatureTrack
-{
-
- public Object clone();
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Feature
- *
- * @param seqPosition
- * the position to check
- * @return true if the position is within the ranges of the segments of this
- * feature
- */
- public boolean overlaps(int seqPosition);
-
- public String toString();
-
- public void setSource(String s);
-
- public String getSource();
-
- public void setName(String nam);
-
- public String getName();
-
- public void setMethod(String methd);
-
- public String getMethod();
-
- public void setType(String typ);
-
- public String getType();
-
- public void setNote(String nte);
-
- public String getNote();
-
- public void setLink(String lnk);
-
- public String getLink();
-
- public void setScore(String score);
-
- public String getScore();
-
- public void setOrientation(String orientation);
-
- public String getOrientation();
-
- /**
- * test if two features are equivalent
- *
- * @param feat
- * feature to compare with
- * @return true if equivalend
- */
- public abstract boolean equals(FeatureTrack feat);
-
- /**
- * add a segment to this feature
- *
- * @param start
- * position
- * @param end
- * position
- * @param name
- * of feature
- */
- public abstract void addSegment(int start, int end, String name);
-
- public abstract void addSegment(Segment s);
-
- public abstract List getSegments();
-
- /**
- * set the data from the DAS - type - id field (used for Ontology support)
- *
- * @param typeID
- */
- public void setTypeID(String typeID);
-
- /**
- * set the data from the DAS - type - category field (used for Ontology
- * support)
- *
- * @param typeCategory
- */
- public void setTypeCategory(String typeCategory);
-
- public String getTypeID();
-
- public String getTypeCategory();
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on Dec 5, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-/**
- * converts the features from their "raw" representation as a Map into a Feature
- * class
- *
- * @author Andreas Prlic
- *
- */
-public class FeatureTrackConverter
-{
-
- public static final Color HELIX_COLOR = new Color(255, 51, 51);
-
- public static final Color STRAND_COLOR = new Color(255, 204, 51);
-
- public static final Color TURN_COLOR = new Color(204, 204, 204);
-
- // some annotation types, for which there is a special treatment
- public static final String DISULFID_TYPE = "DISULFID";
-
- public static final String SECSTRUC_TYPE = "SECSTRUC";
-
- public static final String METAL_TYPE = "METAL";
-
- public static final String MSD_SITE_TYPE = "MSD_SITE";
-
- String type;
-
- public static final String TYPE_HISTOGRAM = "histogram";
-
- public static final String TYPE_DEFAULT = "default";
-
- // rotate between these colors
- public static final Color[] entColors = new Color[]
- { new Color(51, 51, 255), // blue
- new Color(102, 255, 255), // cyan
- new Color(153, 255, 153), // green
- new Color(153, 255, 153), // green
- new Color(255, 153, 153), // pink
- new Color(255, 51, 51), // red
- new Color(255, 51, 255) // pink
- };
-
- public static final String[] txtColors = new String[]
- { "blue", "pink", "green", "yellow", "red", "cyan", "pink" };
-
- Map[] stylesheet;
-
- boolean isHistogram = false;
-
- public FeatureTrackConverter()
- {
- type = TYPE_DEFAULT;
- stylesheet = new Map[0];
- }
-
- public FeatureTrackConverter(Map[] stylesheet)
- {
-
- if (stylesheet == null)
- stylesheet = new Map[0];
-
- this.stylesheet = stylesheet;
-
- }
-
- public FeatureTrackConverter(Map[] stylesheet, boolean isHistogram)
- {
- this(stylesheet);
- this.isHistogram = isHistogram;
- if (isHistogram)
- type = TYPE_HISTOGRAM;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType(String type)
- {
- if (type.equals(TYPE_HISTOGRAM))
- isHistogram = true;
- this.type = type;
- }
-
- public boolean isHistogram()
- {
- return isHistogram;
- }
-
- public void setHistogram(boolean isHistogram)
- {
- this.isHistogram = isHistogram;
- }
-
- public FeatureTrack[] convertMap2Features(Map[] mapfeatures)
- {
- List features = new ArrayList();
-
- boolean first = true;
- boolean secstruc = false;
- boolean isGroup = false;
-
- FeatureTrack feat = null;
- Segment segment = null;
-
- int featuresCounter = 0;
- String prevGroup = null;
-
- for (int i = 0; i < mapfeatures.length; i++)
- {
-
- Map currentFeatureMap = mapfeatures[i];
- String type = (String) currentFeatureMap.get("TYPE");
-
- String group = (String) currentFeatureMap.get("GROUP");
- if (group != null)
- {
- if (prevGroup != null)
- {
- if (group.equals(prevGroup))
- {
- feat.setName(group);
- isGroup = true;
- }
- else
- {
- isGroup = false;
- }
- }
- else
- {
- isGroup = false;
- }
- }
- else
- {
- isGroup = false;
- }
-
- // we are skipping literature references for the moment
- // TODO: add a display to spice for non-positional features
- //
- if (type.equals("reference") || type.equals("GOA"))
- {
- continue;
- }
-
- if (!first)
- {
- // if not first feature
-
- if ((!secstruc) && (!isGroup))
- {
-
- // if not secondary structure and not in a group ...
- features = testAddFeatures(features, feat);
-
- }
- else if (!(type.equals("HELIX") || type.equals("STRAND") || type
- .equals("TURN")))
- {
- // end of secondary structure
- secstruc = false;
- if (feat != null && (!isGroup))
- {
- features = testAddFeatures(features, feat);
- }
-
- }
- } // end of not first
-
- first = false;
- if ((!secstruc) && (!isGroup))
- {
- featuresCounter += 1;
- feat = getNewFeat(currentFeatureMap);
- }
-
- if (type.equals("STRAND"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "yellow");
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
-
- else if (type.equals("HELIX"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "red");
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
-
- else if (type.equals("TURN"))
- {
- secstruc = true;
- currentFeatureMap.put("colorTxt", "white");
-
- feat.setName("SECSTRUC");
- feat.setType("SECSTRUC");
- }
- else
- {
- secstruc = false;
- currentFeatureMap.put("colorTxt", txtColors[featuresCounter
- % txtColors.length]);
- if (!isGroup)
- {
- try
- {
- feat.setName(type);
-
- } catch (NullPointerException e)
- {
- // e.printStackTrace();
- feat.setName("null");
- }
- }
- }
-
- segment = getNewSegment(currentFeatureMap);
-
- feat.addSegment(segment);
- prevGroup = group;
- }
-
- if (feat != null)
- features = testAddFeatures(features, feat);
-
- return (FeatureTrack[]) features.toArray(new FeatureTrack[features
- .size()]);
- }
-
- /**
- * test if this features is added as a new feature to the features list, or if
- * it is joint with an already existing one...
- *
- * @param features
- * @param newFeature
- * @return a List of FeatureTrack objects
- */
- protected List testAddFeatures(List features, FeatureTrack newFeature)
- {
-
- // System.out.println("testing " + newFeature + " " +
- // newFeature.getScore());
- Iterator iter = features.iterator();
-
- if (isHistogramFeatureType(newFeature))
- {
-
- // return histogram type features
- type = TYPE_HISTOGRAM;
-
- Segment seg = getHistogramSegmentFromFeature(newFeature);
-
- while (iter.hasNext())
- {
- FeatureTrack knownFeature = (FeatureTrack) iter.next();
- String knownType = knownFeature.getType();
-
- // System.out.println("found histogram style " + feat);
- // set type of this DAS source to being HISTOGRAM style
-
- if (knownType.equals(newFeature.getType()))
- {
- // convert the feature into a HistogramSegment and add to the already
- // known feature
-
- knownFeature.addSegment(seg);
- // we can return now
- return features;
- }
-
- }
- // we could not link this to any existing feature
- // convert it to a new HistogramFeature
- HistogramFeature hfeat = new HistogramFeature();
-
- hfeat.setLink(newFeature.getLink());
- hfeat.setMethod(newFeature.getMethod());
- hfeat.setName(newFeature.getName());
- hfeat.setNote(newFeature.getNote());
- hfeat.setScore("0");
- hfeat.setSource(newFeature.getSource());
- hfeat.addSegment(seg);
- hfeat.setType(newFeature.getType());
-
- newFeature = hfeat;
- features.add(newFeature);
- return features;
- }
-
- while (iter.hasNext())
- {
- FeatureTrack knownFeature = (FeatureTrack) iter.next();
- // this only compares method source and type ...
- boolean sameFeat = false;
- if (knownFeature.equals(newFeature))
- sameFeat = true;
-
- if ((knownFeature.getSource().equals(newFeature.getSource()))
- && (knownFeature.getMethod().equals(newFeature.getMethod()))
- && (knownFeature.getNote().equals(newFeature.getNote()))
- && isSecondaryStructureFeat(knownFeature)
- && isSecondaryStructureFeat(newFeature))
- sameFeat = true;
-
- if (sameFeat)
- {
-
- // seems to be of same type, method and source, so check if the segments
- // can be joined
-
- List tmpsegs = knownFeature.getSegments();
- Iterator segiter = tmpsegs.iterator();
- List newsegs = newFeature.getSegments();
- Iterator newsegsiter = newsegs.iterator();
- boolean overlap = false;
- while (newsegsiter.hasNext())
- {
- Segment newseg = (Segment) newsegsiter.next();
-
- while (segiter.hasNext())
- {
- Segment tmpseg = (Segment) segiter.next();
-
- if (tmpseg.overlaps(newseg))
- overlap = true;
- }
- }
-
- if (!overlap)
- {
- // add all new segments to old features...
- newsegsiter = newsegs.iterator();
- while (newsegsiter.hasNext())
- {
- Segment newseg = (Segment) newsegsiter.next();
- knownFeature.addSegment(newseg);
- }
-
- return features;
- }
- }
-
- }
-
- // if we get here, the features could not be joint with any other one, so
- // there is always some overlap
- // add to the list of known features
- features.add(newFeature);
- return features;
- }
-
- private FeatureTrack getNewFeat(Map currentFeatureMap)
- {
- FeatureTrack feat = new FeatureTrackImpl();
- // logger.finest(currentFeatureMap);
- // System.out.println("DrawableDasSource " + currentFeatureMap);
- feat.setSource((String) currentFeatureMap.get("dassource"));
- feat.setName((String) currentFeatureMap.get("NAME"));
- feat.setType((String) currentFeatureMap.get("TYPE"));
- feat.setLink((String) currentFeatureMap.get("LINK"));
- feat.setNote((String) currentFeatureMap.get("NOTE"));
-
- String typeID = (String) currentFeatureMap.get("TYPE_ID");
- String typeCategory = (String) currentFeatureMap.get("TYPE_CATEGORY");
- feat.setTypeID(typeID);
- feat.setTypeCategory(typeCategory);
-
- String method = (String) currentFeatureMap.get("METHOD");
- if (method == null)
- {
- method = "";
- }
- feat.setMethod(method);
- feat.setScore((String) currentFeatureMap.get("SCORE"));
- return feat;
- }
-
- private Segment getNewSegment(Map featureMap)
- {
- Segment s = new SegmentImpl();
- String sstart = (String) featureMap.get("START");
- String send = (String) featureMap.get("END");
- int start = Integer.parseInt(sstart);
- int end = Integer.parseInt(send);
- s.setStart(start);
- s.setEnd(end);
- s.setName((String) featureMap.get("TYPE"));
- s.setTxtColor((String) featureMap.get("colorTxt"));
- s.setColor((Color) featureMap.get("color"));
- s.setNote((String) featureMap.get("NOTE"));
- return s;
-
- }
-
- private boolean isSecondaryStructureFeat(FeatureTrack feat)
- {
- String type = feat.getType();
- if (type.equals("HELIX") || type.equals("STRAND")
- || type.equals("TURN"))
- return true;
- return false;
- }
-
- private boolean isHistogramFeatureType(FeatureTrack feat)
- {
- String ftype = feat.getType();
-
- Map[] style = stylesheet;
-
- // System.out.println("is HistogramFeature type " + ftype + " " + style );
-
- // todo : move this info into a config file...
-
- if (ftype.equals("hydrophobicity"))
- {
- return true;
- }
- if (getType().equals(TYPE_HISTOGRAM))
- return true;
-
- if (style != null)
- {
-
- for (int i = 0; i < style.length; i++)
- {
- Map m = style[i];
-
- // make sure the stylesheet is for this feature type
- String styleType = (String) m.get("type");
- if (styleType != null)
- {
- if (!styleType.equals(ftype))
- {
- continue;
- }
- }
- else
- {
- continue;
- }
-
- String type = (String) m.get("style");
- if (type != null)
- {
- // System.out.println("stylesheet type " + type);
- if (type.equals("gradient") || (type.equals("lineplot"))
- || (type.equals("histogram")))
- {
-
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- private HistogramSegment getHistogramSegmentFromFeature(FeatureTrack feat)
- {
- HistogramSegment s = new HistogramSegment();
-
- double score = 0.0;
-
- try
- {
- score = Double.parseDouble(feat.getScore());
-
- } catch (Exception e)
- {
- // e.printStackTrace();
- }
- s.setScore(score);
- List segments = feat.getSegments();
- if (segments.size() > 0)
- {
- Segment seg = (Segment) segments.get(0);
- s.setName(seg.getName());
- s.setStart(seg.getStart());
- s.setEnd(seg.getEnd());
- s.setNote(seg.getNote());
- s.setColor(seg.getColor());
- s.setTxtColor(seg.getTxtColor());
- }
-
- return s;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 22.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Iterator;
-
-/**
- * a class to store FeatureData and to visualize them coordinate system of
- * features is always UniProt ! PDBresnum features served by DAS need to be
- * converted into UniProt coord sys first.
- *
- * a feature consists of one or several segments. segmetns cotnains <start> and
- * <end> information.
- *
- * @author Andreas Prlic
- */
-public class FeatureTrackImpl extends AbstractFeatureTrack implements
- FeatureTrack
-
-{
-
- public Object clone()
- {
-
- FeatureTrack f = new FeatureTrackImpl();
- f.setName(name);
- f.setMethod(method);
- f.setType(type);
- f.setNote(note);
- f.setLink(link);
- f.setSource(source);
- f.setScore(score);
-
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
- Segment s = (Segment) iter.next();
- f.addSegment((Segment) s.clone());
- }
-
- return f;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Iterator;
-
-/**
- * a class that represents Histogram Style features in addition to normal
- * features they know about Max and Minimum scores for the whole line Histogram
- * feautes have only one (Histogram) Segment, which contains the scores for each
- * position
- *
- * @author Andreas Prlic
- *
- */
-public class HistogramFeature extends AbstractFeatureTrack
-{
-
- double max;
-
- double min;
-
- public HistogramFeature()
- {
- super();
- // TODO Auto-generated constructor stub
- }
-
- public double getMax()
- {
- return max;
- }
-
- public void setMax(double max)
- {
- this.max = max;
- }
-
- public double getMin()
- {
- return min;
- }
-
- public void setMin(double min)
- {
- this.min = min;
- }
-
- public Object clone()
- {
-
- HistogramFeature f = new HistogramFeature();
-
- f.setName(name);
- f.setMethod(method);
- f.setType(type);
- f.setNote(note);
- f.setLink(link);
- f.setSource(source);
- f.setScore(score);
-
- Iterator iter = segments.iterator();
-
- while (iter.hasNext())
- {
- Segment s = (Segment) iter.next();
- f.addSegment((Segment) s.clone());
- }
-
- return f;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-/**
- * a Histogram segment is an extension of the standard Segment with a score
- *
- * @author Andreas Prlic
- *
- */
-public class HistogramSegment extends AbstractSegment
-{
-
- double score;
-
- public HistogramSegment()
- {
- super();
-
- }
-
- public double getScore()
- {
- return score;
- }
-
- public void setScore(double score)
- {
- this.score = score;
- }
-
- public Object clone()
- {
-
- Segment s = new HistogramSegment();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setColor(color);
- s.setTxtColor(txtColor);
- s.setNote(note);
- return s;
-
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on 22.09.2004
- * @author Andreas Prlic
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-/** a class to keep track of location information for a feature */
-public interface Segment
-{
-
- public Object clone();
-
- public String toString();
-
- public String getNote();
-
- public void setNote(String note);
-
- public void setStart(int strt);
-
- public int getStart();
-
- public void setEnd(int ed);
-
- public int getEnd();
-
- public void setName(String nam);
-
- public String getName();
-
- public void setColor(Color col);
-
- public Color getColor();
-
- public void setParent(FeatureTrack f);
-
- public FeatureTrack getParent();
-
- public void setTxtColor(String str);
-
- public String getTxtColor();
-
- /**
- * returns true if the specified sequence position is within the range of this
- * Segment
- *
- * @param seqPosition
- * the position to check
- * @return true if seqPos >= start && seqPos <= end
- */
- public boolean overlaps(int seqPosition);
-
- /**
- * tests if two segments are overlapping
- *
- * @param segment
- * to compare with
- * @return true if segments overlap
- */
- public boolean overlaps(Segment segment);
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.util.Comparator;
-
-public class SegmentComparator implements Comparator
-{
-
- public int compare(Object arg0, Object arg1)
- {
-
- Segment s1 = (Segment) arg0;
- Segment s2 = (Segment) arg1;
-
- if (s1.getStart() < s2.getStart())
- return -1;
- if (s1.getStart() > s2.getStart())
- return 1;
-
- return 0;
- }
-
-}
+++ /dev/null
-/*
- * BioJava development code
- *
- * This code may be freely distributed and modified under the
- * terms of the GNU Lesser General Public Licence. This should
- * be distributed with the code. If you do not have a copy,
- * see:
- *
- * http://www.gnu.org/copyleft/lesser.html
- *
- * Copyright for this code is held jointly by the individual
- * authors. These should be listed in @author doc comments.
- *
- * For more information on the BioJava project and its aims,
- * or to join the biojava-l mailing list, visit the home page
- * at:
- *
- * http://www.biojava.org/
- *
- * Created on May 22, 2007
- *
- */
-
-package org.biojava.dasobert.feature;
-
-import java.awt.Color;
-
-public class SegmentImpl extends AbstractSegment
-{
-
- public SegmentImpl()
- {
- super();
- start = 0;
- end = 0;
- name = "Unknown";
- color = Color.white;
- txtColor = "white";
- parent = null;
- note = "";
- }
-
- public boolean equals(Segment s)
- {
- if (s == null)
- return false;
-
- if ((start == s.getStart()) && (end == s.getEnd())
- && (name.equals(s.getName())))
- {
- if (note == null)
- {
- if (s.getNote() == null)
- return true;
- }
- else
- {
- if (s.getNote() != null)
- {
- if (s.getNote().equals(note))
- return true;
- }
- }
-
- }
-
- return false;
- }
-
- public Object clone()
- {
-
- Segment s = new SegmentImpl();
- s.setStart(start);
- s.setEnd(end);
- s.setName(name);
- s.setColor(color);
- s.setTxtColor(txtColor);
- s.setNote(note);
- return s;
-
- }
-}
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*\r
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)\r
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle\r
* \r
* This file is part of Jalview.\r
* \r
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
--- /dev/null
+package jalview.io;
+
+import static org.junit.Assert.*;
+import jalview.io.TCoffeeScoreFile.Block;
+import jalview.io.TCoffeeScoreFile.Header;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.List;
+
+import org.junit.Test;
+
+public class TCoffeeScoreFileTest {
+
+ final static File SCORE_FILE = new File("test/jalview/io/tcoffee.score_ascii");
+ final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln");
+
+ @Test
+ public void testReadHeader() throws IOException, FileNotFoundException {
+
+ TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE);
+ assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid());
+ Header header = scoreFile.header;
+ assertNotNull(header);
+ assertEquals( "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", header.head );
+ assertEquals( 90, header.score );
+ assertEquals( 89, header.getScoreFor("1PHT") );
+ assertEquals( 90, header.getScoreFor("1BB9") );
+ assertEquals( 94, header.getScoreFor("1UHC") );
+ assertEquals( 94, header.getScoreFor("1YCS") );
+ assertEquals( 93, header.getScoreFor("1OOT") );
+ assertEquals( 94, header.getScoreFor("1ABO") );
+ assertEquals( 94, header.getScoreFor("1FYN") );
+ assertEquals( 94, header.getScoreFor("1QCF") );
+ assertEquals( 90, header.getScoreFor("cons") );
+ }
+
+
+ @Test
+ public void testWrongFile() {
+ try {
+ TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE);
+ assertFalse(result.isValid());
+ } catch (IOException x)
+ {
+ assertTrue("File not found exception thrown",x instanceof FileNotFoundException);
+ }
+ }
+
+ @Test
+ public void testHeightAndWidth() throws IOException {
+ TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
+ assertTrue(result.isValid());
+ assertEquals( 8, result.getHeight() );
+ assertEquals( 83, result.getWidth() );
+ }
+
+ @Test
+ public void testReadBlock( ) throws IOException {
+
+ String BLOCK = "\n" +
+ "\n" +
+ "\n" +
+ "1PHT 999999999999999999999999998762112222543211112134\n" +
+ "1BB9 99999999999999999999999999987-------4322----2234 \n" +
+ "1UHC 99999999999999999999999999987-------5321----2246\n" +
+ "1YCS 99999999999999999999999999986-------4321----1-35\n" +
+ "1OOT 999999999999999999999999999861-------3------1135 \n" +
+ "1ABO 99999999999999999999999999986-------422-------34\n" +
+ "1FYN 99999999999999999999999999985-------32--------35\n" +
+ "1QCF 99999999999999999999999999974-------2---------24\n" +
+ "cons 999999999999999999999999999851000110321100001134\n" +
+ "\n" +
+ "\n";
+ FileParse source=new FileParse(BLOCK, FormatAdapter.PASTE);
+ Block block = TCoffeeScoreFile.readBlock(source, 0);
+
+ assertNotNull(block);
+ assertEquals( "999999999999999999999999998762112222543211112134", block.getScoresFor("1PHT") );
+ assertEquals( "99999999999999999999999999987-------4322----2234", block.getScoresFor("1BB9") );
+ assertEquals( "99999999999999999999999999987-------5321----2246", block.getScoresFor("1UHC") );
+ assertEquals( "99999999999999999999999999986-------4321----1-35", block.getScoresFor("1YCS") );
+ assertEquals( "999999999999999999999999999861-------3------1135", block.getScoresFor("1OOT") );
+ assertEquals( "99999999999999999999999999986-------422-------34", block.getScoresFor("1ABO") );
+ assertEquals( "99999999999999999999999999985-------32--------35", block.getScoresFor("1FYN") );
+ assertEquals( "99999999999999999999999999974-------2---------24", block.getScoresFor("1QCF") );
+ assertEquals( "999999999999999999999999999851000110321100001134", block.getConsensus() );
+ }
+
+ @Test
+ public void testParse() throws IOException {
+
+ TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE);
+
+ assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", parser.getScoresFor("1PHT") );
+ assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", parser.getScoresFor("1BB9") );
+ assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", parser.getScoresFor("1UHC") );
+ assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", parser.getScoresFor("1YCS") );
+ assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", parser.getScoresFor("1OOT") );
+ assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", parser.getScoresFor("1ABO") );
+ assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", parser.getScoresFor("1FYN") );
+ assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", parser.getScoresFor("1QCF") );
+ assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", parser.getScoresFor("cons") );
+ }
+
+
+ @Test
+ public void testGetAsList() throws IOException {
+
+ TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
+ assertTrue(parser.getWarningMessage(),parser.isValid());
+ List<String> scores = parser.getScoresList();
+ assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", scores.get(0) );
+ assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", scores.get(1) );
+ assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", scores.get(2) );
+ assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", scores.get(3) );
+ assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", scores.get(4) );
+ assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", scores.get(5) );
+ assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", scores.get(6) );
+ assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", scores.get(7) );
+ assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", scores.get(8) );
+
+ }
+
+
+ @Test
+ public void testGetAsArray() throws IOException {
+
+ TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE);
+ assertTrue(parser.getWarningMessage(),parser.isValid());
+ byte[][] scores = parser.getScoresArray();
+
+ assertEquals( 9, scores[0][0] );
+ assertEquals( 9, scores[1][0] );
+ assertEquals( 9, scores[2][0] );
+ assertEquals( 9, scores[3][0] );
+ assertEquals( 9, scores[4][0] );
+ assertEquals( 9, scores[5][0] );
+ assertEquals( 9, scores[6][0] );
+ assertEquals( 9, scores[7][0] );
+ assertEquals( 9, scores[8][0] );
+
+ assertEquals( 5, scores[0][36] );
+ assertEquals( 4, scores[1][36] );
+ assertEquals( 5, scores[2][36] );
+ assertEquals( 4, scores[3][36] );
+ assertEquals( -1, scores[4][36] );
+ assertEquals( 4, scores[5][36] );
+ assertEquals( 3, scores[6][36] );
+ assertEquals( 2, scores[7][36] );
+ assertEquals( 3, scores[8][36] );
+
+ }
+
+
+
+}
--- /dev/null
+>1PHT
+YQYRALYDYKKEREEDIDLHLGDILTVNKGSLVALGFSDGQEARPEEI--
+--------GWLNGYNETTGERGDFPGTYVEYIG
+>1BB9
+FKVQAQHDYTATDTDELQLKAGDVVLVIP-------FQNP----EEQDEG
+WLMGVKESDWNQHK-ELEKCRGVFPENFTERVQ
+>1UHC
+QVYFAVYTFKARNPNELSVSANQKLKILE-------FKDV----TGNT--
+--------EWWLAE--VNGKKGYVPSNYIRKTE
+>1YCS
+GVIYALWDYEPQNDDELPMKEGDCMTIIH-------REDE----D-EI--
+--------EWWWA--RLNDKEGYVPRNLLGLYP
+>1OOT
+PKAVALYSFAGEESGDLPFRKGDVITILKK-------S------DSQN--
+--------DWWTG--RVNGREGIFPANYVE-LV
+>1ABO
+NLFVALYDFVASGDNTLSITKGEKLRVLG-------YNH-------NG--
+--------EWCEAQ--TKNGQGWVPSNYITPVN
+>1FYN
+TLFVALYDYEARTEDDLSFHKGEKFQILN-------SS--------EG--
+--------DWWEARSLTTGETGYIPSNYVAPVD
+>1QCF
+IIVVALYDYEAIHHEDLSFQKGDQMVVLE-------E---------SG--
+--------EWWKARSLATRKEGYIPSNYVARVD
\ No newline at end of file
--- /dev/null
+T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)
+Cedric Notredame
+CPU TIME:0 sec.
+SCORE=90
+*
+ BAD AVG GOOD
+*
+1PHT : 89
+1BB9 : 90
+1UHC : 94
+1YCS : 94
+1OOT : 93
+1ABO : 94
+1FYN : 94
+1QCF : 94
+cons : 90
+
+1PHT 999999999999999999999999998762112222543211112134
+1BB9 99999999999999999999999999987-------4322----2234
+1UHC 99999999999999999999999999987-------5321----2246
+1YCS 99999999999999999999999999986-------4321----1-35
+1OOT 999999999999999999999999999861-------3------1135
+1ABO 99999999999999999999999999986-------422-------34
+1FYN 99999999999999999999999999985-------32--------35
+1QCF 99999999999999999999999999974-------2---------24
+cons 999999999999999999999999999851000110321100001134
+
+
+1PHT ----------5666642367889999999999889
+1BB9 1111111111676653-355679999999999889
+1UHC ----------788774--66789999999999889
+1YCS ----------78777--356789999999999889
+1OOT ----------78877--356789999999997-67
+1ABO ----------687774--56779999999999889
+1FYN ----------6888842356789999999999889
+1QCF ----------6878742356789999999999889
+cons 00100000006877641356789999999999889
<string><![CDATA[664]]></string>
</property>
<property name="sourceName">
- <string><![CDATA[min-jaba-client.jar]]></string>
+ <string><![CDATA[min-jaba-client-2.0.jar]]></string>
</property>
<property name="overrideUnixPermissions">
<boolean>false</boolean>
<boolean>true</boolean>
</property>
<property name="destinationName">
- <string><![CDATA[min-jaba-client.jar]]></string>
+ <string><![CDATA[min-jaba-client-2.0.jar]]></string>
</property>
<property name="fileSize">
<long>81728</long>
</property>
</object>
</method>
+
+ <method name="addElement">
+ <object class="com.zerog.ia.installer.actions.InstallZipfile" objectID="df3a5220b6bc">
+ <property name="belongsToUninstallPhase">
+ <boolean>false</boolean>
+ </property>
+ <property name="rollbackEnabledCancel">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledError">
+ <boolean>true</boolean>
+ </property>
+ <property name="unixPermissions">
+ <string><![CDATA[664]]></string>
+ </property>
+ <property name="sourceName">
+ <string><![CDATA[VARNAv3-9-dev.jar]]></string>
+ </property>
+ <property name="overrideUnixPermissions">
+ <boolean>false</boolean>
+ </property>
+ <property name="sourcePath">
+ <string><![CDATA[/homes/ws-dev1/jalview/lib/]]></string>
+ </property>
+ <property name="shouldUninstall">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledCancel">
+ <boolean>true</boolean>
+ </property>
+ <property name="rollbackEnabledError">
+ <boolean>true</boolean>
+ </property>
+ <property name="destinationName">
+ <string><![CDATA[VARNAv3-9-dev.jar]]></string>
+ </property>
+ <property name="fileSize">
+ <long>663408</long>
+ </property>
+ <property name="macBinary">
+ <boolean>false</boolean>
+ </property>
+ <property name="targetCheckKind">
+ <int>0</int>
+ </property>
+ </object>
+ </method>
</object>
</property>
<property name="rulesFailedMessage">
<object refID="8fbb17529b9d"/>
<object refID="aa3a521fb6bc"/>
<object refID="aa3a5220b6bc"/>
+ <object refID="df3a5220b6bc"/>
<object refID="aa3a5220b6bc1"/>
<object class="com.zerog.ia.installer.actions.InstallDirectory" objectID="24485f85a670">
<property name="belongsToUninstallPhase">
<object refID="8fbb17529b9d"/>
<object refID="aa3a521fb6bc"/>
<object refID="aa3a5220b6bc"/>
+ <object refID="df3a5220b6bc"/>
<object refID="aa3a5220b6bc1"/>
</visualChildren>
</object>
<?xml version="1.0"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
/*
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*
<html><head>
<!--
* Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
- * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
+ * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
*
* This file is part of Jalview.
*