From: Charles Ofoegbu Date: Mon, 2 Feb 2015 15:49:53 +0000 (+0000) Subject: Merge commit X-Git-Tag: Jalview_2_9~100 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b28bddf12e2791a019fba9c233d46407deb65976;hp=50bc9bfda9c71e968f53e6a77ba3ea9cdfd6d3ee;p=jalview.git Merge commit --- diff --git a/.classpath b/.classpath index f87dd26..59772ae 100644 --- a/.classpath +++ b/.classpath @@ -45,15 +45,14 @@ + - - - - + + diff --git a/.gitignore b/.gitignore index c47ff62..0c12fb0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ /.DS_Store .DS_Store /.com.apple.timemachine.supported +.gitattributes + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 884491a..f72955b 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,15 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 diff --git a/examples/example_biojs.html b/examples/example_biojs.html new file mode 100644 index 0000000..b6f7bec --- /dev/null +++ b/examples/example_biojs.html @@ -0,0 +1,9031 @@ + +
BioJS viewer
+ + + + + + + + Jalview Logo + +
+
+ + + + +
+
+ +
press "Run with JS"
+ + + + + + + + diff --git a/examples/testdata/uniref50_seqref.jva b/examples/testdata/uniref50_seqref.jva new file mode 100644 index 0000000..5e7d2da --- /dev/null +++ b/examples/testdata/uniref50_seqref.jva @@ -0,0 +1,176 @@ +JALVIEW_ANNOTATION +# Created: Fri Jun 21 13:44:50 BST 2013 + +BAR_GRAPH Conservation Conservation of total alignment less than 25% gaps 1.0,1,1.0,[5d1500]|3.0,3,3.0,[7d3f00]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|1.0,1,1.0,[5d1500]|2.0,2,2.0,[6d2a00]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|2.0,2,2.0,[6d2a00]|1.0,1,1.0,[5d1500]|1.0,1,1.0,[5d1500]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,-,0.0,[4d0000]|2.0,2,2.0,[6d2a00]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|11.0,*,11.0,[ffe600]|7.0,7,7.0,[be9200]|11.0,*,11.0,[ffe600]|6.0,6,6.0,[ae7d00]|11.0,*,11.0,[ffe600]|6.0,6,6.0,[ae7d00]|8.0,8,8.0,[cea700]|9.0,9,9.0,[dfbc00]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|7.0,7,7.0,[be9200]|11.0,*,11.0,[ffe600]|3.0,3,3.0,[7d3f00]|6.0,6,6.0,[ae7d00]|11.0,*,11.0,[ffe600]|7.0,7,7.0,[be9200]|7.0,7,7.0,[be9200]|9.0,9,9.0,[dfbc00]|5.0,5,5.0,[9e6800]|6.0,6,6.0,[ae7d00]|8.0,8,8.0,[cea700]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|9.0,9,9.0,[dfbc00]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|3.0,3,3.0,[7d3f00]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|3.0,3,3.0,[7d3f00]|11.0,*,11.0,[ffe600]|5.0,5,5.0,[9e6800]|9.0,9,9.0,[dfbc00]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|9.0,9,9.0,[dfbc00]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|11.0,*,11.0,[ffe600]|9.0,9,9.0,[dfbc00]|3.0,3,3.0,[7d3f00]|7.0,7,7.0,[be9200]|11.0,*,11.0,[ffe600]|3.0,3,3.0,[7d3f00]|9.0,9,9.0,[dfbc00]|8.0,8,8.0,[cea700]|11.0,*,11.0,[ffe600]|6.0,6,6.0,[ae7d00]|11.0,*,11.0,[ffe600]|4.0,4,4.0,[8d5300]|5.0,5,5.0,[9e6800]|9.0,9,9.0,[dfbc00]|11.0,*,11.0,[ffe600]|8.0,8,8.0,[cea700]|9.0,9,9.0,[dfbc00]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|3.0,3,3.0,[7d3f00]|2.0,2,2.0,[6d2a00]|3.0,3,3.0,[7d3f00]|2.0,2,2.0,[6d2a00]|2.0,2,2.0,[6d2a00]|2.0,2,2.0,[6d2a00]|1.0,1,1.0,[5d1500]|3.0,3,3.0,[7d3f00]|2.0,2,2.0,[6d2a00]|2.0,2,2.0,[6d2a00]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|4.0,4,4.0,[8d5300]|3.0,3,3.0,[7d3f00]|1.0,1,1.0,[5d1500]|2.0,2,2.0,[6d2a00]|3.0,3,3.0,[7d3f00]|2.0,2,2.0,[6d2a00]|5.0,5,5.0,[9e6800]|3.0,3,3.0,[7d3f00]|3.0,3,3.0,[7d3f00]|0.0,0,0.0,[4d0000]|0.0,0,0.0,[4d0000]|1.0,1,1.0,[5d1500]|0.0,0,0.0,[4d0000]|0.0,-,0.0,[4d0000]|0.0,-,0.0,[4d0000]| +BAR_GRAPH Quality Alignment Quality based on Blosum62 scores 29.151815,29.151815,[cba200]|30.574812,30.574812,[d1aa00]|14.400199,14.400199,[8b5000]|16.93248,16.93248,[965e00]|2.1220763,2.1220763,[560c00]|2.2049963,2.2049963,[560c00]|3.647952,3.647952,[5c1400]|4.814642,4.814642,[611b00]|18.351393,18.351393,[9c6600]|17.532412,17.532412,[996200]|7.5054855,7.5054855,[6d2a00]|15.490477,15.490477,[905600]|14.241707,14.241707,[8a4f00]|9.905579,9.905579,[773700]|20.354017,20.354017,[a57100]|26.870352,26.870352,[c19600]|24.969187,24.969187,[b98b00]|27.419409,27.419409,[c39900]|15.350427,15.350427,[8f5600]|21.116522,21.116522,[a87600]|9.34032,9.34032,[753400]|14.1895275,14.1895275,[8a4f00]|10.104505,10.104505,[783800]|8.587312,8.587312,[723000]|18.694708,18.694708,[9e6800]|11.420612,11.420612,[7e4000]|6.8467255,6.8467255,[6a2600]|17.449827,17.449827,[986100]|16.825909,16.825909,[955e00]|2.4334474,2.4334474,[570e00]|15.685622,15.685622,[915700]|9.836516,9.836516,[773700]|3.4712791,3.4712791,[5c1300]|4.531816,4.531816,[601900]|7.8744216,7.8744216,[6f2c00]|0.0,0.0,[4d0000]|9.01113,9.01113,[743200]|3.174218,3.174218,[5a1200]|2.0395048,2.0395048,[550b00]|2.1654668,2.1654668,[560c00]|21.517344,21.517344,[aa7800]|15.738462,15.738462,[915800]|14.844854,14.844854,[8d5300]|22.159096,22.159096,[ad7c00]|13.956608,13.956608,[894e00]|20.147892,20.147892,[a47000]|25.067545,25.067545,[b98c00]|2.0943506,2.0943506,[560c00]|20.30842,20.30842,[a57100]|10.254437,10.254437,[793900]|6.5836596,6.5836596,[692500]|19.446732,19.446732,[a16c00]|6.2202287,6.2202287,[672300]|9.796006,9.796006,[773700]|6.0385494,6.0385494,[672200]|13.963727,13.963727,[894e00]|13.838549,13.838549,[884d00]|18.48424,18.48424,[9d6700]|18.302633,18.302633,[9c6600]|41.172745,41.172745,[ffe600]|32.59908,32.59908,[dab600]|41.172745,41.172745,[ffe600]|34.495945,34.495945,[e2c000]|41.172745,41.172745,[ffe600]|33.501804,33.501804,[debb00]|27.034466,27.034466,[c29700]|40.020737,40.020737,[fadf00]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|29.252739,29.252739,[cba300]|41.172745,41.172745,[ffe600]|14.935498,14.935498,[8d5300]|0.88449144,0.88449144,[500500]|41.172745,41.172745,[ffe600]|20.81991,20.81991,[a77400]|31.73346,31.73346,[d6b100]|29.757969,29.757969,[cea600]|16.279755,16.279755,[935b00]|32.647984,32.647984,[dab600]|38.352337,38.352337,[f3d600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|39.6125,39.6125,[f8dd00]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|9.671661,9.671661,[763600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|11.17141,11.17141,[7d3e00]|41.172745,41.172745,[ffe600]|3.2054348,3.2054348,[5a1200]|38.569283,38.569283,[f4d700]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|39.707684,39.707684,[f9dd00]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|41.172745,41.172745,[ffe600]|39.447525,39.447525,[f8dc00]|21.229778,21.229778,[a97600]|27.779364,27.779364,[c59b00]|41.172745,41.172745,[ffe600]|24.149143,24.149143,[b58700]|39.447525,39.447525,[f8dc00]|33.857655,33.857655,[dfbd00]|41.172745,41.172745,[ffe600]|28.69976,28.69976,[c9a000]|41.172745,41.172745,[ffe600]|14.611241,14.611241,[8c5100]|32.346375,32.346375,[d9b400]|39.24055,39.24055,[f7db00]|41.172745,41.172745,[ffe600]|38.352337,38.352337,[f3d600]|38.569283,38.569283,[f4d700]|22.374107,22.374107,[ae7d00]|36.98438,36.98438,[edce00]|12.34415,12.34415,[824500]|11.811655,11.811655,[804200]|14.798897,14.798897,[8d5200]|36.60138,36.60138,[ebcc00]|14.0762415,14.0762415,[8a4e00]|36.817875,36.817875,[eccd00]|36.53897,36.53897,[ebcc00]|37.583706,37.583706,[efd100]|35.536423,35.536423,[e7c600]|18.004925,18.004925,[9b6400]|37.633095,37.633095,[f0d200]|34.738743,34.738743,[e3c200]|36.451622,36.451622,[ebcb00]|19.948801,19.948801,[a36f00]|28.285,28.285,[c79e00]|35.93151,35.93151,[e8c800]|36.817875,36.817875,[eccd00]|26.762383,26.762383,[c19500]|36.37101,36.37101,[eacb00]|36.413998,36.413998,[eacb00]|37.583706,37.583706,[efd100]|36.282784,36.282784,[eaca00]|34.729824,34.729824,[e3c200]|36.413998,36.413998,[eacb00]|24.348654,24.348654,[b68800]|24.349539,24.349539,[b68800]|34.091675,34.091675,[e0be00]|21.114677,21.114677,[a87600]|13.676696,13.676696,[884c00]|2.1107035,2.1107035,[560c00]| +BAR_GRAPH Consensus PID 80.0,M,M 80%|80.0,A,A 80%|20.0,+,[AST] 20%|53.333332,T,T 53%|0.0,-,- 0%|0.0,-,- 0%|13.333333,T,T 13%|20.0,P,P 20%|40.0,A,A 40%|40.0,L,L 40%|46.666668,S,S 46%|40.0,G,G 40%|33.333332,T,T 33%|20.0,+,[AIM] 20%|33.333332,V,V 33%|66.666664,S,S 66%|66.666664,T,T 66%|66.666664,S,S 66%|66.666664,F,F 66%|46.666668,L,L 46%|46.666668,R,R 46%|46.666668,R,R 46%|26.666666,Q,Q 26%|46.666668,P,P 46%|40.0,A,A 40%|60.0,P,P 60%|26.666666,T,T 26%|53.333332,S,S 53%|40.0,L,L 40%|20.0,R,R 20%|26.666666,S,S 26%|33.333332,L,L 33%|40.0,P,P 40%|26.666666,S,S 26%|33.333332,+,[AN] 33%|26.666666,V,V 26%|33.333332,G,G 33%|20.0,+,[EQ] 20%|0.0,-,- 0%|0.0,-,- 0%|33.333332,+,[AS] 33%|53.333332,L,L 53%|60.0,F,F 60%|73.333336,G,G 73%|66.666664,L,L 66%|66.666664,K,K 66%|53.333332,S,S 53%|0.0,-,- 0%|40.0,S,S 40%|26.666666,T,T 26%|20.0,A,A 20%|66.666664,R,R 66%|40.0,G,G 40%|53.333332,G,G 53%|46.666668,R,R 46%|33.333332,V,V 33%|46.666668,T,T 46%|53.333332,A,A 53%|66.666664,M,M 66%|100.0,A,A 100%|53.333332,T,T 53%|100.0,Y,Y 100%|86.666664,K,K 86%|100.0,V,V 100%|86.666664,K,K 86%|66.666664,L,L 66%|80.0,I,I 80%|100.0,T,T 100%|100.0,P,P 100%|66.666664,E,E 66%|100.0,G,G 100%|46.666668,E,E 46%|46.666668,Q,Q 46%|100.0,E,E 100%|46.666668,F,F 46%|60.0,E,E 60%|86.666664,C,C 86%|66.666664,P,P 66%|80.0,D,D 80%|93.333336,D,D 93%|100.0,V,V 100%|100.0,Y,Y 100%|66.666664,I,I 66%|100.0,L,L 100%|100.0,D,D 100%|46.666668,A,A 46%|100.0,A,A 100%|100.0,E,E 100%|100.0,E,E 100%|53.333332,A,A 53%|100.0,G,G 100%|60.0,I,I 60%|93.333336,D,D 93%|100.0,L,L 100%|100.0,P,P 100%|93.333336,Y,Y 93%|100.0,S,S 100%|100.0,C,C 100%|100.0,R,R 100%|100.0,A,A 100%|100.0,G,G 100%|100.0,S,S 100%|100.0,C,C 100%|100.0,S,S 100%|100.0,S,S 100%|100.0,C,C 100%|100.0,A,A 100%|100.0,G,G 100%|100.0,K,K 100%|80.0,V,V 80%|60.0,V,V 60%|53.333332,S,S 53%|100.0,G,G 100%|60.0,S,S 60%|80.0,V,V 80%|80.0,D,D 80%|100.0,Q,Q 100%|66.666664,S,S 66%|100.0,D,D 100%|46.666668,+,[GQ] 46%|73.333336,S,S 73%|93.333336,F,F 93%|100.0,L,L 100%|93.333336,D,D 93%|93.333336,D,D 93%|53.333332,D,D 53%|93.333336,Q,Q 93%|53.333332,I,I 53%|40.0,A,A 40%|53.333332,E,E 53%|93.333336,G,G 93%|46.666668,W,W 46%|93.333336,V,V 93%|93.333336,L,L 93%|93.333336,T,T 93%|93.333336,C,C 93%|53.333332,V,V 53%|93.333336,A,A 93%|86.666664,Y,Y 86%|93.333336,P,P 93%|60.0,T,T 60%|73.333336,S,S 73%|93.333336,D,D 93%|93.333336,V,V 93%|66.666664,T,T 66%|93.333336,I,I 93%|93.333336,E,E 93%|93.333336,T,T 93%|93.333336,H,H 93%|86.666664,K,K 86%|93.333336,E,E 93%|73.333336,E,E 73%|60.0,E,E 60%|73.333336,L,L 73%|46.666668,T,T 46%|40.0,A,A 40%|0.0,-,- 0%| + +SEQUENCE_REF FER2_ARATH +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1671,0.1671,[72144e]|0.2129,0.2129,[72144e]|0.247,0.247,[72144e]|0.1554,0.1554,[72144e]|0.1162,0.1162,[72144e]|0.1449,0.1449,[72144e]|0.1731,0.1731,[72144e]|0.2064,0.2064,[72144e]|0.2436,0.2436,[72144e]|0.2715,0.2715,[72144e]|0.3249,0.3249,[72144e]|0.2783,0.2783,[72144e]|0.3019,0.3019,[72144e]|0.2399,0.2399,[72144e]|0.2364,0.2364,[72144e]|0.2645,0.2645,[72144e]|0.2609,0.2609,[72144e]|0.2988,0.2988,[72144e]|0.2064,0.2064,[72144e]|0.2094,0.2094,[72144e]|0.2849,0.2849,[72144e]|0.3426,0.3426,[72144e]|0.3529,0.3529,[72144e]|0.3426,0.3426,[72144e]|0.2817,0.2817,[72144e]|0.2783,0.2783,[72144e]|0.3426,0.3426,[72144e]|0.2715,0.2715,[72144e]|0.2609,0.2609,[72144e]|0.2503,0.2503,[72144e]|0.2364,0.2364,[72144e]|0.2364,0.2364,[72144e]|0.1791,0.1791,[72144e]|0.247,0.247,[72144e]|0.2503,0.2503,[72144e]|0.3149,0.3149,[72144e]|0.3149,0.3149,[72144e]|0.2645,0.2645,[72144e]|0.3356,0.3356,[72144e]|0.2752,0.2752,[72144e]|0.346,0.346,[72144e]|0.346,0.346,[72144e]|0.3426,0.3426,[72144e]|0.2645,0.2645,[72144e]|0.247,0.247,[72144e]|0.1969,0.1969,[72144e]|0.2503,0.2503,[72144e]|0.2503,0.2503,[72144e]|0.1852,0.1852,[72144e]|0.2541,0.2541,[72144e]|0.2951,0.2951,[72144e]|0.3182,0.3182,[72144e]|0.3215,0.3215,[72144e]|0.3392,0.3392,[72144e]|0.374,0.374,[72144e]|0.3948,0.3948,[72144e]|0.3392,0.3392,[72144e]|0.3599,0.3599,[72144e]|0.268,0.268,[72144e]|0.3426,0.3426,[72144e]|0.3599,0.3599,[72144e]|0.4051,0.4051,[72144e]|0.374,0.374,[72144e]|0.3249,0.3249,[72144e]|0.268,0.268,[72144e]|0.2783,0.2783,[72144e]|0.3019,0.3019,[72144e]|0.3286,0.3286,[72144e]|0.3117,0.3117,[72144e]|0.4292,0.4292,[72144e]|0.5296,0.5296,[72144e]|0.4901,0.4901,[72144e]|0.4582,0.4582,[72144e]|0.3667,0.3667,[72144e]|0.384,0.384,[72144e]|0.2918,0.2918,[72144e]|0.3182,0.3182,[72144e]|0.2193,0.2193,[72144e]|0.2752,0.2752,[72144e]|0.1643,0.1643,[72144e]|0.2541,0.2541,[72144e]|0.2034,0.2034,[72144e]|0.1852,0.1852,[72144e]|0.1702,0.1702,[72144e]|0.1399,0.1399,[72144e]|0.2034,0.2034,[72144e]|0.2541,0.2541,[72144e]|0.2292,0.2292,[72144e]|0.1881,0.1881,[72144e]|0.2129,0.2129,[72144e]|0.2292,0.2292,[72144e]|0.1643,0.1643,[72144e]|0.107,0.107,[72144e]|0.1251,0.1251,[72144e]|0.1251,0.1251,[72144e]|0.1759,0.1759,[72144e]|0.1115,0.1115,[72144e]|0.1731,0.1731,[72144e]|0.1501,0.1501,[72144e]|0.2164,0.2164,[72144e]|0.2328,0.2328,[72144e]|0.3286,0.3286,[72144e]|0.3286,0.3286,[72144e]|0.2645,0.2645,[72144e]|0.2034,0.2034,[72144e]|0.2193,0.2193,[72144e]|0.3286,0.3286,[72144e]|0.3529,0.3529,[72144e]|0.3631,0.3631,[72144e]|0.4292,0.4292,[72144e]|0.4541,0.4541,[72144e]|0.4766,0.4766,[72144e]|0.4864,0.4864,[72144e]|0.4652,0.4652,[72144e]|0.4685,0.4685,[72144e]|0.4051,0.4051,[72144e]|0.4087,0.4087,[72144e]|0.3117,0.3117,[72144e]|0.3321,0.3321,[72144e]|0.2918,0.2918,[72144e]|0.2164,0.2164,[72144e]|0.2503,0.2503,[72144e]|0.2364,0.2364,[72144e]|0.2292,0.2292,[72144e]|0.2503,0.2503,[72144e]|0.2918,0.2918,[72144e]|0.3053,0.3053,[72144e]|0.2258,0.2258,[72144e]|0.2292,0.2292,[72144e]|0.2129,0.2129,[72144e]|0.2064,0.2064,[72144e]|0.2164,0.2164,[72144e]|0.2436,0.2436,[72144e]|0.2436,0.2436,[72144e]|0.2193,0.2193,[72144e]|0.2258,0.2258,[72144e]|0.2503,0.2503,[72144e]|0.3117,0.3117,[72144e]|0.2884,0.2884,[72144e]|0.374,0.374,[72144e]|0.4149,0.4149,[72144e]|0.4292,0.4292,[72144e]|0.5098,0.5098,[72144e]|0.4476,0.4476,[72144e]|0.422,0.422,[72144e]|0.4017,0.4017,[72144e]|0.3494,0.3494,[72144e]|0.4087,0.4087,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.82,0.82,[329440]|0.7147,0.7147,[329440]|0.6715,0.6715,[329440]|0.6334,0.6334,[329440]|0.59,0.59,[329440]|0.4513,0.4513,[329440]|0.3263,0.3263,[329440]|0.2963,0.2963,[329440]|0.2657,0.2657,[329440]|0.2292,0.2292,[329440]|0.1998,0.1998,[329440]|0.2209,0.2209,[329440]|0.2865,0.2865,[329440]|0.2122,0.2122,[329440]|0.2041,0.2041,[329440]|0.1667,0.1667,[329440]|0.2602,0.2602,[329440]|0.2558,0.2558,[329440]|0.1844,0.1844,[329440]|0.2483,0.2483,[329440]|0.2292,0.2292,[329440]|0.2657,0.2657,[329440]|0.2748,0.2748,[329440]|0.2748,0.2748,[329440]|0.2865,0.2865,[329440]|0.3762,0.3762,[329440]|0.3847,0.3847,[329440]|0.2786,0.2786,[329440]|0.27,0.27,[329440]|0.1878,0.1878,[329440]|0.1805,0.1805,[329440]|0.1805,0.1805,[329440]|0.1532,0.1532,[329440]|0.2255,0.2255,[329440]|0.1958,0.1958,[329440]|0.2786,0.2786,[329440]|0.2657,0.2657,[329440]|0.2748,0.2748,[329440]|0.3491,0.3491,[329440]|0.2531,0.2531,[329440]|0.3456,0.3456,[329440]|0.3491,0.3491,[329440]|0.3146,0.3146,[329440]|0.282,0.282,[329440]|0.27,0.27,[329440]|0.1998,0.1998,[329440]|0.2558,0.2558,[329440]|0.282,0.282,[329440]|0.2602,0.2602,[329440]|0.2602,0.2602,[329440]|0.1878,0.1878,[329440]|0.1844,0.1844,[329440]|0.2122,0.2122,[329440]|0.2292,0.2292,[329440]|0.2602,0.2602,[329440]|0.2786,0.2786,[329440]|0.282,0.282,[329440]|0.3005,0.3005,[329440]|0.2385,0.2385,[329440]|0.3184,0.3184,[329440]|0.2255,0.2255,[329440]|0.2748,0.2748,[329440]|0.3225,0.3225,[329440]|0.3762,0.3762,[329440]|0.3225,0.3225,[329440]|0.3225,0.3225,[329440]|0.2865,0.2865,[329440]|0.2865,0.2865,[329440]|0.3263,0.3263,[329440]|0.3717,0.3717,[329440]|0.4037,0.4037,[329440]|0.4245,0.4245,[329440]|0.4116,0.4116,[329440]|0.3578,0.3578,[329440]|0.3535,0.3535,[329440]|0.2748,0.2748,[329440]|0.2963,0.2963,[329440]|0.2167,0.2167,[329440]|0.3096,0.3096,[329440]|0.2255,0.2255,[329440]|0.3225,0.3225,[329440]|0.1732,0.1732,[329440]|0.1495,0.1495,[329440]|0.1088,0.1088,[329440]|0.1456,0.1456,[329440]|0.2041,0.2041,[329440]|0.1532,0.1532,[329440]|0.2041,0.2041,[329440]|0.1878,0.1878,[329440]|0.1322,0.1322,[329440]|0.1349,0.1349,[329440]|0.1205,0.1205,[329440]|0.0965,0.0965,[329440]|0.0884,0.0884,[329440]|0.0643,0.0643,[329440]|0.0935,0.0935,[329440]|0.0771,0.0771,[329440]|0.1088,0.1088,[329440]|0.0587,0.0587,[329440]|0.0991,0.0991,[329440]|0.0991,0.0991,[329440]|0.1958,0.1958,[329440]|0.2255,0.2255,[329440]|0.2602,0.2602,[329440]|0.2657,0.2657,[329440]|0.1844,0.1844,[329440]|0.2292,0.2292,[329440]|0.2483,0.2483,[329440]|0.2657,0.2657,[329440]|0.3939,0.3939,[329440]|0.4245,0.4245,[329440]|0.4037,0.4037,[329440]|0.4203,0.4203,[329440]|0.4967,0.4967,[329440]|0.5473,0.5473,[329440]|0.4781,0.4781,[329440]|0.4282,0.4282,[329440]|0.3578,0.3578,[329440]|0.4203,0.4203,[329440]|0.3491,0.3491,[329440]|0.2913,0.2913,[329440]|0.2657,0.2657,[329440]|0.1805,0.1805,[329440]|0.2167,0.2167,[329440]|0.208,0.208,[329440]|0.2963,0.2963,[329440]|0.3806,0.3806,[329440]|0.2963,0.2963,[329440]|0.2255,0.2255,[329440]|0.1456,0.1456,[329440]|0.1635,0.1635,[329440]|0.1766,0.1766,[329440]|0.1698,0.1698,[329440]|0.1349,0.1349,[329440]|0.1532,0.1532,[329440]|0.2292,0.2292,[329440]|0.2483,0.2483,[329440]|0.2432,0.2432,[329440]|0.2041,0.2041,[329440]|0.3005,0.3005,[329440]|0.4037,0.4037,[329440]|0.4749,0.4749,[329440]|0.59,0.59,[329440]|0.5941,0.5941,[329440]|0.6442,0.6442,[329440]|0.6827,0.6827,[329440]|0.7034,0.7034,[329440]|0.8001,0.8001,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF Q93Z60_ARATH +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1671,0.1671,[72144e]|0.2129,0.2129,[72144e]|0.247,0.247,[72144e]|0.1554,0.1554,[72144e]|0.1162,0.1162,[72144e]|0.1449,0.1449,[72144e]|0.1731,0.1731,[72144e]|0.2064,0.2064,[72144e]|0.2436,0.2436,[72144e]|0.2715,0.2715,[72144e]|0.3215,0.3215,[72144e]|0.2752,0.2752,[72144e]|0.2988,0.2988,[72144e]|0.2364,0.2364,[72144e]|0.2328,0.2328,[72144e]|0.2575,0.2575,[72144e]|0.2575,0.2575,[72144e]|0.2918,0.2918,[72144e]|0.2034,0.2034,[72144e]|0.2034,0.2034,[72144e]|0.2817,0.2817,[72144e]|0.3392,0.3392,[72144e]|0.3494,0.3494,[72144e]|0.3426,0.3426,[72144e]|0.2783,0.2783,[72144e]|0.2752,0.2752,[72144e]|0.3426,0.3426,[72144e]|0.2715,0.2715,[72144e]|0.2609,0.2609,[72144e]|0.247,0.247,[72144e]|0.2364,0.2364,[72144e]|0.2364,0.2364,[72144e]|0.1791,0.1791,[72144e]|0.247,0.247,[72144e]|0.2503,0.2503,[72144e]|0.3215,0.3215,[72144e]|0.3215,0.3215,[72144e]|0.2715,0.2715,[72144e]|0.3426,0.3426,[72144e]|0.2817,0.2817,[72144e]|0.3566,0.3566,[72144e]|0.3566,0.3566,[72144e]|0.3529,0.3529,[72144e]|0.2715,0.2715,[72144e]|0.2575,0.2575,[72144e]|0.2064,0.2064,[72144e]|0.2645,0.2645,[72144e]|0.2645,0.2645,[72144e]|0.1942,0.1942,[72144e]|0.2645,0.2645,[72144e]|0.3053,0.3053,[72144e]|0.3286,0.3286,[72144e]|0.3321,0.3321,[72144e]|0.3494,0.3494,[72144e]|0.384,0.384,[72144e]|0.4051,0.4051,[72144e]|0.3494,0.3494,[72144e]|0.3667,0.3667,[72144e]|0.2752,0.2752,[72144e]|0.346,0.346,[72144e]|0.3631,0.3631,[72144e]|0.4051,0.4051,[72144e]|0.3704,0.3704,[72144e]|0.3215,0.3215,[72144e]|0.268,0.268,[72144e]|0.2783,0.2783,[72144e]|0.2988,0.2988,[72144e]|0.3249,0.3249,[72144e]|0.3053,0.3053,[72144e]|0.422,0.422,[72144e]|0.5139,0.5139,[72144e]|0.4801,0.4801,[72144e]|0.4476,0.4476,[72144e]|0.3566,0.3566,[72144e]|0.374,0.374,[72144e]|0.2849,0.2849,[72144e]|0.3087,0.3087,[72144e]|0.2129,0.2129,[72144e]|0.2645,0.2645,[72144e]|0.1583,0.1583,[72144e]|0.247,0.247,[72144e]|0.2002,0.2002,[72144e]|0.1852,0.1852,[72144e]|0.1702,0.1702,[72144e]|0.1399,0.1399,[72144e]|0.2002,0.2002,[72144e]|0.247,0.247,[72144e]|0.2224,0.2224,[72144e]|0.1852,0.1852,[72144e]|0.2094,0.2094,[72144e]|0.2258,0.2258,[72144e]|0.1611,0.1611,[72144e]|0.1092,0.1092,[72144e]|0.1251,0.1251,[72144e]|0.1251,0.1251,[72144e]|0.1759,0.1759,[72144e]|0.1115,0.1115,[72144e]|0.1731,0.1731,[72144e]|0.1501,0.1501,[72144e]|0.2129,0.2129,[72144e]|0.2292,0.2292,[72144e]|0.3249,0.3249,[72144e]|0.3215,0.3215,[72144e]|0.2645,0.2645,[72144e]|0.2002,0.2002,[72144e]|0.2193,0.2193,[72144e]|0.3286,0.3286,[72144e]|0.3249,0.3249,[72144e]|0.3117,0.3117,[72144e]|0.391,0.391,[72144e]|0.4051,0.4051,[72144e]|0.384,0.384,[72144e]|0.3774,0.3774,[72144e]|0.4292,0.4292,[72144e]|0.4901,0.4901,[72144e]|0.4801,0.4801,[72144e]|0.4582,0.4582,[72144e]|0.4409,0.4409,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.82,0.82,[329440]|0.7147,0.7147,[329440]|0.6715,0.6715,[329440]|0.6334,0.6334,[329440]|0.59,0.59,[329440]|0.4513,0.4513,[329440]|0.3263,0.3263,[329440]|0.2963,0.2963,[329440]|0.2657,0.2657,[329440]|0.2292,0.2292,[329440]|0.1998,0.1998,[329440]|0.2209,0.2209,[329440]|0.2865,0.2865,[329440]|0.2122,0.2122,[329440]|0.2041,0.2041,[329440]|0.1667,0.1667,[329440]|0.2602,0.2602,[329440]|0.2558,0.2558,[329440]|0.1844,0.1844,[329440]|0.2483,0.2483,[329440]|0.2292,0.2292,[329440]|0.2657,0.2657,[329440]|0.2748,0.2748,[329440]|0.2748,0.2748,[329440]|0.2865,0.2865,[329440]|0.3762,0.3762,[329440]|0.3847,0.3847,[329440]|0.2786,0.2786,[329440]|0.27,0.27,[329440]|0.1878,0.1878,[329440]|0.1805,0.1805,[329440]|0.1805,0.1805,[329440]|0.1532,0.1532,[329440]|0.2255,0.2255,[329440]|0.1958,0.1958,[329440]|0.2786,0.2786,[329440]|0.2657,0.2657,[329440]|0.2748,0.2748,[329440]|0.3491,0.3491,[329440]|0.2531,0.2531,[329440]|0.3456,0.3456,[329440]|0.3491,0.3491,[329440]|0.3146,0.3146,[329440]|0.282,0.282,[329440]|0.27,0.27,[329440]|0.1998,0.1998,[329440]|0.2558,0.2558,[329440]|0.282,0.282,[329440]|0.2602,0.2602,[329440]|0.2602,0.2602,[329440]|0.1878,0.1878,[329440]|0.1844,0.1844,[329440]|0.2122,0.2122,[329440]|0.2292,0.2292,[329440]|0.2602,0.2602,[329440]|0.2786,0.2786,[329440]|0.282,0.282,[329440]|0.3005,0.3005,[329440]|0.2385,0.2385,[329440]|0.3184,0.3184,[329440]|0.2255,0.2255,[329440]|0.2748,0.2748,[329440]|0.3225,0.3225,[329440]|0.3762,0.3762,[329440]|0.3225,0.3225,[329440]|0.3225,0.3225,[329440]|0.2865,0.2865,[329440]|0.2865,0.2865,[329440]|0.3263,0.3263,[329440]|0.3717,0.3717,[329440]|0.4037,0.4037,[329440]|0.4245,0.4245,[329440]|0.4116,0.4116,[329440]|0.3578,0.3578,[329440]|0.3535,0.3535,[329440]|0.2748,0.2748,[329440]|0.2963,0.2963,[329440]|0.2167,0.2167,[329440]|0.3096,0.3096,[329440]|0.2255,0.2255,[329440]|0.3225,0.3225,[329440]|0.1732,0.1732,[329440]|0.1495,0.1495,[329440]|0.1088,0.1088,[329440]|0.1456,0.1456,[329440]|0.2041,0.2041,[329440]|0.1532,0.1532,[329440]|0.1998,0.1998,[329440]|0.1844,0.1844,[329440]|0.1205,0.1205,[329440]|0.124,0.124,[329440]|0.1088,0.1088,[329440]|0.0858,0.0858,[329440]|0.0789,0.0789,[329440]|0.0607,0.0607,[329440]|0.0858,0.0858,[329440]|0.0701,0.0701,[329440]|0.1018,0.1018,[329440]|0.0567,0.0567,[329440]|0.0935,0.0935,[329440]|0.0965,0.0965,[329440]|0.1921,0.1921,[329440]|0.2167,0.2167,[329440]|0.2558,0.2558,[329440]|0.2602,0.2602,[329440]|0.1921,0.1921,[329440]|0.2602,0.2602,[329440]|0.2786,0.2786,[329440]|0.2913,0.2913,[329440]|0.4556,0.4556,[329440]|0.5331,0.5331,[329440]|0.5802,0.5802,[329440]|0.6412,0.6412,[329440]|0.7232,0.7232,[329440]|0.8074,0.8074,[329440]|0.8457,0.8457,[329440]|0.8823,0.8823,[329440]|0.9141,0.9141,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_ARATH +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1583,0.1583,[72144e]|0.2034,0.2034,[72144e]|0.2364,0.2364,[72144e]|0.1476,0.1476,[72144e]|0.1048,0.1048,[72144e]|0.1349,0.1349,[72144e]|0.1643,0.1643,[72144e]|0.1881,0.1881,[72144e]|0.247,0.247,[72144e]|0.2399,0.2399,[72144e]|0.2951,0.2951,[72144e]|0.2503,0.2503,[72144e]|0.2783,0.2783,[72144e]|0.2129,0.2129,[72144e]|0.2094,0.2094,[72144e]|0.2364,0.2364,[72144e]|0.2328,0.2328,[72144e]|0.2715,0.2715,[72144e]|0.2715,0.2715,[72144e]|0.2715,0.2715,[72144e]|0.346,0.346,[72144e]|0.4051,0.4051,[72144e]|0.4149,0.4149,[72144e]|0.4087,0.4087,[72144e]|0.3392,0.3392,[72144e]|0.3392,0.3392,[72144e]|0.4087,0.4087,[72144e]|0.3321,0.3321,[72144e]|0.3215,0.3215,[72144e]|0.3215,0.3215,[72144e]|0.2884,0.2884,[72144e]|0.3215,0.3215,[72144e]|0.2609,0.2609,[72144e]|0.3321,0.3321,[72144e]|0.3356,0.3356,[72144e]|0.4051,0.4051,[72144e]|0.4017,0.4017,[72144e]|0.3494,0.3494,[72144e]|0.4292,0.4292,[72144e]|0.3667,0.3667,[72144e]|0.346,0.346,[72144e]|0.3494,0.3494,[72144e]|0.346,0.346,[72144e]|0.268,0.268,[72144e]|0.247,0.247,[72144e]|0.1969,0.1969,[72144e]|0.2541,0.2541,[72144e]|0.2541,0.2541,[72144e]|0.1881,0.1881,[72144e]|0.2609,0.2609,[72144e]|0.3019,0.3019,[72144e]|0.3249,0.3249,[72144e]|0.3249,0.3249,[72144e]|0.346,0.346,[72144e]|0.3053,0.3053,[72144e]|0.3249,0.3249,[72144e]|0.2715,0.2715,[72144e]|0.2951,0.2951,[72144e]|0.2034,0.2034,[72144e]|0.2715,0.2715,[72144e]|0.2817,0.2817,[72144e]|0.3249,0.3249,[72144e]|0.2951,0.2951,[72144e]|0.247,0.247,[72144e]|0.1942,0.1942,[72144e]|0.2002,0.2002,[72144e]|0.2224,0.2224,[72144e]|0.2503,0.2503,[72144e]|0.2328,0.2328,[72144e]|0.346,0.346,[72144e]|0.4409,0.4409,[72144e]|0.4087,0.4087,[72144e]|0.3774,0.3774,[72144e]|0.2849,0.2849,[72144e]|0.2988,0.2988,[72144e]|0.2064,0.2064,[72144e]|0.3087,0.3087,[72144e]|0.2094,0.2094,[72144e]|0.2645,0.2645,[72144e]|0.1554,0.1554,[72144e]|0.2399,0.2399,[72144e]|0.1969,0.1969,[72144e]|0.1852,0.1852,[72144e]|0.1702,0.1702,[72144e]|0.1399,0.1399,[72144e]|0.2002,0.2002,[72144e]|0.2503,0.2503,[72144e]|0.2258,0.2258,[72144e]|0.1881,0.1881,[72144e]|0.2129,0.2129,[72144e]|0.2292,0.2292,[72144e]|0.1611,0.1611,[72144e]|0.107,0.107,[72144e]|0.1251,0.1251,[72144e]|0.1229,0.1229,[72144e]|0.1759,0.1759,[72144e]|0.1229,0.1229,[72144e]|0.1914,0.1914,[72144e]|0.1702,0.1702,[72144e]|0.2364,0.2364,[72144e]|0.2503,0.2503,[72144e]|0.3529,0.3529,[72144e]|0.3494,0.3494,[72144e]|0.2884,0.2884,[72144e]|0.2258,0.2258,[72144e]|0.2436,0.2436,[72144e]|0.3529,0.3529,[72144e]|0.3774,0.3774,[72144e]|0.3872,0.3872,[72144e]|0.4119,0.4119,[72144e]|0.4369,0.4369,[72144e]|0.4619,0.4619,[72144e]|0.4725,0.4725,[72144e]|0.433,0.433,[72144e]|0.4369,0.4369,[72144e]|0.374,0.374,[72144e]|0.3774,0.3774,[72144e]|0.2817,0.2817,[72144e]|0.3087,0.3087,[72144e]|0.2715,0.2715,[72144e]|0.1942,0.1942,[72144e]|0.2292,0.2292,[72144e]|0.2164,0.2164,[72144e]|0.2064,0.2064,[72144e]|0.2224,0.2224,[72144e]|0.2609,0.2609,[72144e]|0.3249,0.3249,[72144e]|0.2436,0.2436,[72144e]|0.2503,0.2503,[72144e]|0.2328,0.2328,[72144e]|0.2193,0.2193,[72144e]|0.2715,0.2715,[72144e]|0.2951,0.2951,[72144e]|0.2988,0.2988,[72144e]|0.3149,0.3149,[72144e]|0.3392,0.3392,[72144e]|0.3356,0.3356,[72144e]|0.3948,0.3948,[72144e]|0.3774,0.3774,[72144e]|0.4725,0.4725,[72144e]|0.4864,0.4864,[72144e]|0.5055,0.5055,[72144e]|0.6043,0.6043,[72144e]|0.5296,0.5296,[72144e]|0.5098,0.5098,[72144e]|0.4979,0.4979,[72144e]|0.4507,0.4507,[72144e]|0.5296,0.5296,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8242,0.8242,[329440]|0.7275,0.7275,[329440]|0.6906,0.6906,[329440]|0.6516,0.6516,[329440]|0.6124,0.6124,[329440]|0.4781,0.4781,[329440]|0.3535,0.3535,[329440]|0.3225,0.3225,[329440]|0.2913,0.2913,[329440]|0.2432,0.2432,[329440]|0.2292,0.2292,[329440]|0.2209,0.2209,[329440]|0.2913,0.2913,[329440]|0.2167,0.2167,[329440]|0.208,0.208,[329440]|0.1766,0.1766,[329440]|0.2657,0.2657,[329440]|0.2657,0.2657,[329440]|0.1958,0.1958,[329440]|0.2558,0.2558,[329440]|0.3184,0.3184,[329440]|0.3456,0.3456,[329440]|0.3456,0.3456,[329440]|0.3399,0.3399,[329440]|0.3578,0.3578,[329440]|0.4458,0.4458,[329440]|0.46,0.46,[329440]|0.3578,0.3578,[329440]|0.3456,0.3456,[329440]|0.2786,0.2786,[329440]|0.2558,0.2558,[329440]|0.2913,0.2913,[329440]|0.2602,0.2602,[329440]|0.3399,0.3399,[329440]|0.3096,0.3096,[329440]|0.3885,0.3885,[329440]|0.3717,0.3717,[329440]|0.3762,0.3762,[329440]|0.4556,0.4556,[329440]|0.363,0.363,[329440]|0.3668,0.3668,[329440]|0.3668,0.3668,[329440]|0.3359,0.3359,[329440]|0.3005,0.3005,[329440]|0.282,0.282,[329440]|0.208,0.208,[329440]|0.2602,0.2602,[329440]|0.282,0.282,[329440]|0.2602,0.2602,[329440]|0.2483,0.2483,[329440]|0.1732,0.1732,[329440]|0.1698,0.1698,[329440]|0.1998,0.1998,[329440]|0.2122,0.2122,[329440]|0.2432,0.2432,[329440]|0.2602,0.2602,[329440]|0.1878,0.1878,[329440]|0.208,0.208,[329440]|0.1532,0.1532,[329440]|0.2209,0.2209,[329440]|0.1456,0.1456,[329440]|0.1844,0.1844,[329440]|0.2255,0.2255,[329440]|0.2748,0.2748,[329440]|0.2209,0.2209,[329440]|0.2255,0.2255,[329440]|0.1878,0.1878,[329440]|0.1844,0.1844,[329440]|0.2167,0.2167,[329440]|0.2657,0.2657,[329440]|0.3005,0.3005,[329440]|0.3225,0.3225,[329440]|0.3096,0.3096,[329440]|0.2483,0.2483,[329440]|0.2483,0.2483,[329440]|0.1698,0.1698,[329440]|0.2602,0.2602,[329440]|0.1805,0.1805,[329440]|0.27,0.27,[329440]|0.1878,0.1878,[329440]|0.2786,0.2786,[329440]|0.138,0.138,[329440]|0.1205,0.1205,[329440]|0.0884,0.0884,[329440]|0.1178,0.1178,[329440]|0.1732,0.1732,[329440]|0.1292,0.1292,[329440]|0.1805,0.1805,[329440]|0.1698,0.1698,[329440]|0.1178,0.1178,[329440]|0.124,0.124,[329440]|0.1088,0.1088,[329440]|0.0858,0.0858,[329440]|0.0771,0.0771,[329440]|0.0554,0.0554,[329440]|0.0832,0.0832,[329440]|0.0677,0.0677,[329440]|0.1018,0.1018,[329440]|0.0554,0.0554,[329440]|0.0965,0.0965,[329440]|0.0965,0.0965,[329440]|0.1921,0.1921,[329440]|0.2167,0.2167,[329440]|0.2558,0.2558,[329440]|0.2602,0.2602,[329440]|0.1844,0.1844,[329440]|0.2333,0.2333,[329440]|0.2531,0.2531,[329440]|0.2657,0.2657,[329440]|0.3992,0.3992,[329440]|0.4333,0.4333,[329440]|0.3762,0.3762,[329440]|0.3992,0.3992,[329440]|0.4781,0.4781,[329440]|0.5374,0.5374,[329440]|0.4651,0.4651,[329440]|0.4203,0.4203,[329440]|0.3535,0.3535,[329440]|0.4078,0.4078,[329440]|0.3311,0.3311,[329440]|0.3096,0.3096,[329440]|0.2865,0.2865,[329440]|0.208,0.208,[329440]|0.2531,0.2531,[329440]|0.2483,0.2483,[329440]|0.3263,0.3263,[329440]|0.4078,0.4078,[329440]|0.3225,0.3225,[329440]|0.3005,0.3005,[329440]|0.2041,0.2041,[329440]|0.2255,0.2255,[329440]|0.2748,0.2748,[329440]|0.2602,0.2602,[329440]|0.208,0.208,[329440]|0.2292,0.2292,[329440]|0.3263,0.3263,[329440]|0.3885,0.3885,[329440]|0.3939,0.3939,[329440]|0.3456,0.3456,[329440]|0.4458,0.4458,[329440]|0.5173,0.5173,[329440]|0.5802,0.5802,[329440]|0.6789,0.6789,[329440]|0.6789,0.6789,[329440]|0.7275,0.7275,[329440]|0.7644,0.7644,[329440]|0.7912,0.7912,[329440]|0.8823,0.8823,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER_BRANA +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1969,0.1969,[72144e]|0.2783,0.2783,[72144e]|0.3182,0.3182,[72144e]|0.384,0.384,[72144e]|0.3321,0.3321,[72144e]|0.3872,0.3872,[72144e]|0.2752,0.2752,[72144e]|0.3182,0.3182,[72144e]|0.3599,0.3599,[72144e]|0.3948,0.3948,[72144e]|0.3566,0.3566,[72144e]|0.3149,0.3149,[72144e]|0.2609,0.2609,[72144e]|0.268,0.268,[72144e]|0.3053,0.3053,[72144e]|0.3321,0.3321,[72144e]|0.3249,0.3249,[72144e]|0.4476,0.4476,[72144e]|0.5456,0.5456,[72144e]|0.5098,0.5098,[72144e]|0.4766,0.4766,[72144e]|0.384,0.384,[72144e]|0.4017,0.4017,[72144e]|0.3087,0.3087,[72144e]|0.3321,0.3321,[72144e]|0.2399,0.2399,[72144e]|0.2918,0.2918,[72144e]|0.1643,0.1643,[72144e]|0.2541,0.2541,[72144e]|0.2094,0.2094,[72144e]|0.1942,0.1942,[72144e]|0.1759,0.1759,[72144e]|0.1323,0.1323,[72144e]|0.1852,0.1852,[72144e]|0.2292,0.2292,[72144e]|0.1914,0.1914,[72144e]|0.1528,0.1528,[72144e]|0.1759,0.1759,[72144e]|0.1791,0.1791,[72144e]|0.1206,0.1206,[72144e]|0.0765,0.0765,[72144e]|0.0888,0.0888,[72144e]|0.0888,0.0888,[72144e]|0.0749,0.0749,[72144e]|0.0473,0.0473,[72144e]|0.0817,0.0817,[72144e]|0.0704,0.0704,[72144e]|0.1048,0.1048,[72144e]|0.1162,0.1162,[72144e]|0.2258,0.2258,[72144e]|0.2364,0.2364,[72144e]|0.1731,0.1731,[72144e]|0.1251,0.1251,[72144e]|0.1399,0.1399,[72144e]|0.2503,0.2503,[72144e]|0.2715,0.2715,[72144e]|0.2783,0.2783,[72144e]|0.3215,0.3215,[72144e]|0.3215,0.3215,[72144e]|0.346,0.346,[72144e]|0.3667,0.3667,[72144e]|0.3249,0.3249,[72144e]|0.3249,0.3249,[72144e]|0.2645,0.2645,[72144e]|0.268,0.268,[72144e]|0.2541,0.2541,[72144e]|0.2817,0.2817,[72144e]|0.2399,0.2399,[72144e]|0.1702,0.1702,[72144e]|0.2034,0.2034,[72144e]|0.1914,0.1914,[72144e]|0.1643,0.1643,[72144e]|0.1823,0.1823,[72144e]|0.2164,0.2164,[72144e]|0.2849,0.2849,[72144e]|0.2002,0.2002,[72144e]|0.2064,0.2064,[72144e]|0.1942,0.1942,[72144e]|0.1823,0.1823,[72144e]|0.2224,0.2224,[72144e]|0.2752,0.2752,[72144e]|0.2752,0.2752,[72144e]|0.2988,0.2988,[72144e]|0.3249,0.3249,[72144e]|0.3249,0.3249,[72144e]|0.3872,0.3872,[72144e]|0.3667,0.3667,[72144e]|0.4685,0.4685,[72144e]|0.4864,0.4864,[72144e]|0.5017,0.5017,[72144e]|0.5951,0.5951,[72144e]|0.5296,0.5296,[72144e]|0.5055,0.5055,[72144e]|0.494,0.494,[72144e]|0.4441,0.4441,[72144e]|0.5254,0.5254,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.7605,0.7605,[329440]|0.7458,0.7458,[329440]|0.7079,0.7079,[329440]|0.6906,0.6906,[329440]|0.6557,0.6557,[329440]|0.6412,0.6412,[329440]|0.5374,0.5374,[329440]|0.5173,0.5173,[329440]|0.3806,0.3806,[329440]|0.3578,0.3578,[329440]|0.3311,0.3311,[329440]|0.3885,0.3885,[329440]|0.3456,0.3456,[329440]|0.3456,0.3456,[329440]|0.3225,0.3225,[329440]|0.3225,0.3225,[329440]|0.3806,0.3806,[329440]|0.4116,0.4116,[329440]|0.4379,0.4379,[329440]|0.4651,0.4651,[329440]|0.4458,0.4458,[329440]|0.3806,0.3806,[329440]|0.3762,0.3762,[329440]|0.2913,0.2913,[329440]|0.3096,0.3096,[329440]|0.2167,0.2167,[329440]|0.3146,0.3146,[329440]|0.2255,0.2255,[329440]|0.3184,0.3184,[329440]|0.1698,0.1698,[329440]|0.138,0.138,[329440]|0.1018,0.1018,[329440]|0.1322,0.1322,[329440]|0.1805,0.1805,[329440]|0.1322,0.1322,[329440]|0.1805,0.1805,[329440]|0.1667,0.1667,[329440]|0.1117,0.1117,[329440]|0.115,0.115,[329440]|0.1018,0.1018,[329440]|0.0771,0.0771,[329440]|0.066,0.066,[329440]|0.0478,0.0478,[329440]|0.0677,0.0677,[329440]|0.0554,0.0554,[329440]|0.0478,0.0478,[329440]|0.0268,0.0268,[329440]|0.0441,0.0441,[329440]|0.0455,0.0455,[329440]|0.1018,0.1018,[329440]|0.124,0.124,[329440]|0.1667,0.1667,[329440]|0.1698,0.1698,[329440]|0.1088,0.1088,[329440]|0.138,0.138,[329440]|0.1532,0.1532,[329440]|0.1667,0.1667,[329440]|0.2786,0.2786,[329440]|0.3184,0.3184,[329440]|0.2602,0.2602,[329440]|0.2558,0.2558,[329440]|0.3399,0.3399,[329440]|0.4078,0.4078,[329440]|0.3263,0.3263,[329440]|0.2786,0.2786,[329440]|0.2913,0.2913,[329440]|0.3491,0.3491,[329440]|0.27,0.27,[329440]|0.2432,0.2432,[329440]|0.2209,0.2209,[329440]|0.1532,0.1532,[329440]|0.1732,0.1732,[329440]|0.1698,0.1698,[329440]|0.2483,0.2483,[329440]|0.3311,0.3311,[329440]|0.2483,0.2483,[329440]|0.2292,0.2292,[329440]|0.1495,0.1495,[329440]|0.1698,0.1698,[329440]|0.2122,0.2122,[329440]|0.2292,0.2292,[329440]|0.1805,0.1805,[329440]|0.1998,0.1998,[329440]|0.3053,0.3053,[329440]|0.3806,0.3806,[329440]|0.3939,0.3939,[329440]|0.3399,0.3399,[329440]|0.4513,0.4513,[329440]|0.5173,0.5173,[329440]|0.5846,0.5846,[329440]|0.6827,0.6827,[329440]|0.6827,0.6827,[329440]|0.7317,0.7317,[329440]|0.7688,0.7688,[329440]|0.7951,0.7951,[329440]|0.8857,0.8857,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER3_RAPSA +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.2224,0.2224,[72144e]|0.3053,0.3053,[72144e]|0.346,0.346,[72144e]|0.4087,0.4087,[72144e]|0.3599,0.3599,[72144e]|0.4149,0.4149,[72144e]|0.2988,0.2988,[72144e]|0.3426,0.3426,[72144e]|0.384,0.384,[72144e]|0.4186,0.4186,[72144e]|0.384,0.384,[72144e]|0.3426,0.3426,[72144e]|0.2918,0.2918,[72144e]|0.2988,0.2988,[72144e]|0.3356,0.3356,[72144e]|0.3599,0.3599,[72144e]|0.3529,0.3529,[72144e]|0.4685,0.4685,[72144e]|0.5665,0.5665,[72144e]|0.5342,0.5342,[72144e]|0.4979,0.4979,[72144e]|0.4087,0.4087,[72144e]|0.4256,0.4256,[72144e]|0.3356,0.3356,[72144e]|0.3599,0.3599,[72144e]|0.268,0.268,[72144e]|0.3182,0.3182,[72144e]|0.1881,0.1881,[72144e]|0.2849,0.2849,[72144e]|0.2399,0.2399,[72144e]|0.2224,0.2224,[72144e]|0.2034,0.2034,[72144e]|0.1528,0.1528,[72144e]|0.2094,0.2094,[72144e]|0.2575,0.2575,[72144e]|0.2129,0.2129,[72144e]|0.1759,0.1759,[72144e]|0.1969,0.1969,[72144e]|0.2034,0.2034,[72144e]|0.1424,0.1424,[72144e]|0.0929,0.0929,[72144e]|0.107,0.107,[72144e]|0.107,0.107,[72144e]|0.1501,0.1501,[72144e]|0.1028,0.1028,[72144e]|0.1611,0.1611,[72144e]|0.1399,0.1399,[72144e]|0.1942,0.1942,[72144e]|0.2129,0.2129,[72144e]|0.3249,0.3249,[72144e]|0.3321,0.3321,[72144e]|0.2715,0.2715,[72144e]|0.2094,0.2094,[72144e]|0.2258,0.2258,[72144e]|0.3529,0.3529,[72144e]|0.374,0.374,[72144e]|0.3807,0.3807,[72144e]|0.4256,0.4256,[72144e]|0.4256,0.4256,[72144e]|0.4507,0.4507,[72144e]|0.4685,0.4685,[72144e]|0.4256,0.4256,[72144e]|0.4292,0.4292,[72144e]|0.3667,0.3667,[72144e]|0.3704,0.3704,[72144e]|0.2645,0.2645,[72144e]|0.2918,0.2918,[72144e]|0.2503,0.2503,[72144e]|0.1823,0.1823,[72144e]|0.2129,0.2129,[72144e]|0.2002,0.2002,[72144e]|0.1914,0.1914,[72144e]|0.2094,0.2094,[72144e]|0.247,0.247,[72144e]|0.3117,0.3117,[72144e]|0.2292,0.2292,[72144e]|0.2328,0.2328,[72144e]|0.2193,0.2193,[72144e]|0.2064,0.2064,[72144e]|0.2609,0.2609,[72144e]|0.3087,0.3087,[72144e]|0.3087,0.3087,[72144e]|0.3286,0.3286,[72144e]|0.3983,0.3983,[72144e]|0.3948,0.3948,[72144e]|0.4541,0.4541,[72144e]|0.4369,0.4369,[72144e]|0.5533,0.5533,[72144e]|0.5758,0.5758,[72144e]|0.5992,0.5992,[72144e]|0.708,0.708,[72144e]|0.6375,0.6375,[72144e]|0.6227,0.6227,[72144e]|0.6136,0.6136,[72144e]|0.5577,0.5577,[72144e]|0.6661,0.6661,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.7605,0.7605,[329440]|0.7458,0.7458,[329440]|0.7079,0.7079,[329440]|0.6906,0.6906,[329440]|0.6557,0.6557,[329440]|0.6412,0.6412,[329440]|0.5374,0.5374,[329440]|0.5173,0.5173,[329440]|0.3806,0.3806,[329440]|0.3578,0.3578,[329440]|0.3311,0.3311,[329440]|0.3885,0.3885,[329440]|0.3456,0.3456,[329440]|0.3456,0.3456,[329440]|0.3225,0.3225,[329440]|0.3225,0.3225,[329440]|0.3806,0.3806,[329440]|0.4116,0.4116,[329440]|0.4379,0.4379,[329440]|0.4651,0.4651,[329440]|0.4458,0.4458,[329440]|0.3806,0.3806,[329440]|0.3806,0.3806,[329440]|0.2963,0.2963,[329440]|0.3184,0.3184,[329440]|0.2292,0.2292,[329440]|0.3225,0.3225,[329440]|0.2385,0.2385,[329440]|0.3359,0.3359,[329440]|0.1844,0.1844,[329440]|0.1566,0.1566,[329440]|0.115,0.115,[329440]|0.1495,0.1495,[329440]|0.2041,0.2041,[329440]|0.1532,0.1532,[329440]|0.2041,0.2041,[329440]|0.1878,0.1878,[329440]|0.1322,0.1322,[329440]|0.1349,0.1349,[329440]|0.1205,0.1205,[329440]|0.0965,0.0965,[329440]|0.0832,0.0832,[329440]|0.0607,0.0607,[329440]|0.0858,0.0858,[329440]|0.0701,0.0701,[329440]|0.1018,0.1018,[329440]|0.0554,0.0554,[329440]|0.0909,0.0909,[329440]|0.0909,0.0909,[329440]|0.1844,0.1844,[329440]|0.208,0.208,[329440]|0.2483,0.2483,[329440]|0.2531,0.2531,[329440]|0.1732,0.1732,[329440]|0.2167,0.2167,[329440]|0.2333,0.2333,[329440]|0.2483,0.2483,[329440]|0.3717,0.3717,[329440]|0.4078,0.4078,[329440]|0.3535,0.3535,[329440]|0.3456,0.3456,[329440]|0.4282,0.4282,[329440]|0.4879,0.4879,[329440]|0.4116,0.4116,[329440]|0.3668,0.3668,[329440]|0.3005,0.3005,[329440]|0.3578,0.3578,[329440]|0.282,0.282,[329440]|0.2558,0.2558,[329440]|0.2385,0.2385,[329440]|0.1667,0.1667,[329440]|0.2041,0.2041,[329440]|0.1998,0.1998,[329440]|0.282,0.282,[329440]|0.363,0.363,[329440]|0.282,0.282,[329440]|0.2602,0.2602,[329440]|0.1766,0.1766,[329440]|0.1998,0.1998,[329440]|0.2483,0.2483,[329440]|0.2657,0.2657,[329440]|0.2255,0.2255,[329440]|0.2531,0.2531,[329440]|0.3491,0.3491,[329440]|0.4116,0.4116,[329440]|0.4458,0.4458,[329440]|0.3992,0.3992,[329440]|0.5008,0.5008,[329440]|0.5623,0.5623,[329440]|0.6293,0.6293,[329440]|0.7275,0.7275,[329440]|0.7275,0.7275,[329440]|0.7724,0.7724,[329440]|0.8118,0.8118,[329440]|0.8391,0.8391,[329440]|0.9141,0.9141,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_MAIZE +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.422,0.422,[72144e]|0.2918,0.2918,[72144e]|0.1852,0.1852,[72144e]|0.1115,0.1115,[72144e]|0.1373,0.1373,[72144e]|0.1643,0.1643,[72144e]|0.1914,0.1914,[72144e]|0.2193,0.2193,[72144e]|0.1731,0.1731,[72144e]|0.2002,0.2002,[72144e]|0.1969,0.1969,[72144e]|0.1969,0.1969,[72144e]|0.2575,0.2575,[72144e]|0.2193,0.2193,[72144e]|0.3087,0.3087,[72144e]|0.384,0.384,[72144e]|0.3566,0.3566,[72144e]|0.3019,0.3019,[72144e]|0.2436,0.2436,[72144e]|0.1731,0.1731,[72144e]|0.2292,0.2292,[72144e]|0.1759,0.1759,[72144e]|0.1759,0.1759,[72144e]|0.2575,0.2575,[72144e]|0.2918,0.2918,[72144e]|0.384,0.384,[72144e]|0.3117,0.3117,[72144e]|0.2817,0.2817,[72144e]|0.2849,0.2849,[72144e]|0.2849,0.2849,[72144e]|0.3529,0.3529,[72144e]|0.3215,0.3215,[72144e]|0.3494,0.3494,[72144e]|0.374,0.374,[72144e]|0.3426,0.3426,[72144e]|0.374,0.374,[72144e]|0.3426,0.3426,[72144e]|0.268,0.268,[72144e]|0.2951,0.2951,[72144e]|0.3249,0.3249,[72144e]|0.3631,0.3631,[72144e]|0.4087,0.4087,[72144e]|0.384,0.384,[72144e]|0.3321,0.3321,[72144e]|0.3704,0.3704,[72144e]|0.3215,0.3215,[72144e]|0.3704,0.3704,[72144e]|0.3019,0.3019,[72144e]|0.3053,0.3053,[72144e]|0.3392,0.3392,[72144e]|0.3704,0.3704,[72144e]|0.3872,0.3872,[72144e]|0.391,0.391,[72144e]|0.4409,0.4409,[72144e]|0.3872,0.3872,[72144e]|0.4087,0.4087,[72144e]|0.3392,0.3392,[72144e]|0.3494,0.3494,[72144e]|0.2951,0.2951,[72144e]|0.3948,0.3948,[72144e]|0.4119,0.4119,[72144e]|0.4582,0.4582,[72144e]|0.391,0.391,[72144e]|0.3426,0.3426,[72144e]|0.2645,0.2645,[72144e]|0.2783,0.2783,[72144e]|0.2849,0.2849,[72144e]|0.3494,0.3494,[72144e]|0.3286,0.3286,[72144e]|0.4149,0.4149,[72144e]|0.5139,0.5139,[72144e]|0.5296,0.5296,[72144e]|0.494,0.494,[72144e]|0.3983,0.3983,[72144e]|0.4119,0.4119,[72144e]|0.3215,0.3215,[72144e]|0.4087,0.4087,[72144e]|0.3087,0.3087,[72144e]|0.3774,0.3774,[72144e]|0.2817,0.2817,[72144e]|0.3356,0.3356,[72144e]|0.2817,0.2817,[72144e]|0.2645,0.2645,[72144e]|0.247,0.247,[72144e]|0.2164,0.2164,[72144e]|0.2918,0.2918,[72144e]|0.3631,0.3631,[72144e]|0.346,0.346,[72144e]|0.3019,0.3019,[72144e]|0.2951,0.2951,[72144e]|0.3117,0.3117,[72144e]|0.2399,0.2399,[72144e]|0.1702,0.1702,[72144e]|0.1554,0.1554,[72144e]|0.1554,0.1554,[72144e]|0.2193,0.2193,[72144e]|0.1554,0.1554,[72144e]|0.2364,0.2364,[72144e]|0.2129,0.2129,[72144e]|0.2918,0.2918,[72144e]|0.3087,0.3087,[72144e]|0.4017,0.4017,[72144e]|0.4017,0.4017,[72144e]|0.3566,0.3566,[72144e]|0.2884,0.2884,[72144e]|0.3087,0.3087,[72144e]|0.4119,0.4119,[72144e]|0.4119,0.4119,[72144e]|0.422,0.422,[72144e]|0.4369,0.4369,[72144e]|0.4409,0.4409,[72144e]|0.4541,0.4541,[72144e]|0.4619,0.4619,[72144e]|0.4409,0.4409,[72144e]|0.4441,0.4441,[72144e]|0.374,0.374,[72144e]|0.3774,0.3774,[72144e]|0.2918,0.2918,[72144e]|0.3494,0.3494,[72144e]|0.3087,0.3087,[72144e]|0.2328,0.2328,[72144e]|0.268,0.268,[72144e]|0.2541,0.2541,[72144e]|0.247,0.247,[72144e]|0.2645,0.2645,[72144e]|0.2849,0.2849,[72144e]|0.3053,0.3053,[72144e]|0.2193,0.2193,[72144e]|0.2224,0.2224,[72144e]|0.2224,0.2224,[72144e]|0.2164,0.2164,[72144e]|0.2752,0.2752,[72144e]|0.3149,0.3149,[72144e]|0.3149,0.3149,[72144e]|0.3356,0.3356,[72144e]|0.346,0.346,[72144e]|0.4017,0.4017,[72144e]|0.4685,0.4685,[72144e]|0.4409,0.4409,[72144e]|0.5296,0.5296,[72144e]|0.5139,0.5139,[72144e]|0.5296,0.5296,[72144e]|0.6136,0.6136,[72144e]|0.5493,0.5493,[72144e]|0.5296,0.5296,[72144e]|0.5139,0.5139,[72144e]|0.4685,0.4685,[72144e]|0.5342,0.5342,[72144e]|0.6136,0.6136,[72144e]|0.7547,0.7547,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.865,0.865,[329440]|0.8488,0.8488,[329440]|0.7724,0.7724,[329440]|0.6557,0.6557,[329440]|0.5253,0.5253,[329440]|0.3847,0.3847,[329440]|0.3399,0.3399,[329440]|0.2913,0.2913,[329440]|0.2432,0.2432,[329440]|0.1958,0.1958,[329440]|0.106,0.106,[329440]|0.1456,0.1456,[329440]|0.1456,0.1456,[329440]|0.115,0.115,[329440]|0.1844,0.1844,[329440]|0.2122,0.2122,[329440]|0.2333,0.2333,[329440]|0.2531,0.2531,[329440]|0.1998,0.1998,[329440]|0.1322,0.1322,[329440]|0.1456,0.1456,[329440]|0.0858,0.0858,[329440]|0.1266,0.1266,[329440]|0.1667,0.1667,[329440]|0.2122,0.2122,[329440]|0.3225,0.3225,[329440]|0.2483,0.2483,[329440]|0.2483,0.2483,[329440]|0.1766,0.1766,[329440]|0.1602,0.1602,[329440]|0.2255,0.2255,[329440]|0.2209,0.2209,[329440]|0.2558,0.2558,[329440]|0.2657,0.2657,[329440]|0.2432,0.2432,[329440]|0.2865,0.2865,[329440]|0.27,0.27,[329440]|0.2748,0.2748,[329440]|0.3146,0.3146,[329440]|0.3184,0.3184,[329440]|0.3491,0.3491,[329440]|0.3847,0.3847,[329440]|0.3668,0.3668,[329440]|0.363,0.363,[329440]|0.4037,0.4037,[329440]|0.3184,0.3184,[329440]|0.4037,0.4037,[329440]|0.3359,0.3359,[329440]|0.4116,0.4116,[329440]|0.3717,0.3717,[329440]|0.3005,0.3005,[329440]|0.2865,0.2865,[329440]|0.3263,0.3263,[329440]|0.3668,0.3668,[329440]|0.3717,0.3717,[329440]|0.3806,0.3806,[329440]|0.3053,0.3053,[329440]|0.3146,0.3146,[329440]|0.2292,0.2292,[329440]|0.3096,0.3096,[329440]|0.2432,0.2432,[329440]|0.3146,0.3146,[329440]|0.3225,0.3225,[329440]|0.3806,0.3806,[329440]|0.3184,0.3184,[329440]|0.3311,0.3311,[329440]|0.2657,0.2657,[329440]|0.2657,0.2657,[329440]|0.2913,0.2913,[329440]|0.3578,0.3578,[329440]|0.3939,0.3939,[329440]|0.4116,0.4116,[329440]|0.3885,0.3885,[329440]|0.4037,0.4037,[329440]|0.3939,0.3939,[329440]|0.3184,0.3184,[329440]|0.4116,0.4116,[329440]|0.3263,0.3263,[329440]|0.4379,0.4379,[329440]|0.363,0.363,[329440]|0.4282,0.4282,[329440]|0.2865,0.2865,[329440]|0.2602,0.2602,[329440]|0.2041,0.2041,[329440]|0.2558,0.2558,[329440]|0.3225,0.3225,[329440]|0.2748,0.2748,[329440]|0.3399,0.3399,[329440]|0.3225,0.3225,[329440]|0.2122,0.2122,[329440]|0.2209,0.2209,[329440]|0.1998,0.1998,[329440]|0.1698,0.1698,[329440]|0.1178,0.1178,[329440]|0.0909,0.0909,[329440]|0.1292,0.1292,[329440]|0.106,0.106,[329440]|0.1532,0.1532,[329440]|0.0935,0.0935,[329440]|0.138,0.138,[329440]|0.138,0.138,[329440]|0.2292,0.2292,[329440]|0.2531,0.2531,[329440]|0.2865,0.2865,[329440]|0.2865,0.2865,[329440]|0.2122,0.2122,[329440]|0.2558,0.2558,[329440]|0.27,0.27,[329440]|0.2786,0.2786,[329440]|0.3847,0.3847,[329440]|0.4203,0.4203,[329440]|0.363,0.363,[329440]|0.3535,0.3535,[329440]|0.4149,0.4149,[329440]|0.4703,0.4703,[329440]|0.3939,0.3939,[329440]|0.3535,0.3535,[329440]|0.2865,0.2865,[329440]|0.3359,0.3359,[329440]|0.2602,0.2602,[329440]|0.2558,0.2558,[329440]|0.2333,0.2333,[329440]|0.1635,0.1635,[329440]|0.1958,0.1958,[329440]|0.1878,0.1878,[329440]|0.2657,0.2657,[329440]|0.3456,0.3456,[329440]|0.2748,0.2748,[329440]|0.2167,0.2167,[329440]|0.1602,0.1602,[329440]|0.1766,0.1766,[329440]|0.2255,0.2255,[329440]|0.2333,0.2333,[329440]|0.1998,0.1998,[329440]|0.2209,0.2209,[329440]|0.3184,0.3184,[329440]|0.3847,0.3847,[329440]|0.3847,0.3847,[329440]|0.3847,0.3847,[329440]|0.4513,0.4513,[329440]|0.4282,0.4282,[329440]|0.4967,0.4967,[329440]|0.6079,0.6079,[329440]|0.6124,0.6124,[329440]|0.6604,0.6604,[329440]|0.6944,0.6944,[329440]|0.7232,0.7232,[329440]|0.8118,0.8118,[329440]|0.8857,0.8857,[329440]|0.9491,0.9491,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF O80429_MAIZE +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1007,0.1007,[72144e]|0.1028,0.1028,[72144e]|0.1731,0.1731,[72144e]|0.2503,0.2503,[72144e]|0.3249,0.3249,[72144e]|0.2292,0.2292,[72144e]|0.1476,0.1476,[72144e]|0.1731,0.1731,[72144e]|0.1942,0.1942,[72144e]|0.2503,0.2503,[72144e]|0.1969,0.1969,[72144e]|0.2258,0.2258,[72144e]|0.1823,0.1823,[72144e]|0.2094,0.2094,[72144e]|0.1501,0.1501,[72144e]|0.1501,0.1501,[72144e]|0.1611,0.1611,[72144e]|0.1399,0.1399,[72144e]|0.1554,0.1554,[72144e]|0.1823,0.1823,[72144e]|0.1881,0.1881,[72144e]|0.2258,0.2258,[72144e]|0.1969,0.1969,[72144e]|0.2541,0.2541,[72144e]|0.1942,0.1942,[72144e]|0.1671,0.1671,[72144e]|0.1399,0.1399,[72144e]|0.2292,0.2292,[72144e]|0.2575,0.2575,[72144e]|0.1881,0.1881,[72144e]|0.1881,0.1881,[72144e]|0.1399,0.1399,[72144e]|0.2129,0.2129,[72144e]|0.1852,0.1852,[72144e]|0.2645,0.2645,[72144e]|0.1852,0.1852,[72144e]|0.2503,0.2503,[72144e]|0.2193,0.2193,[72144e]|0.2752,0.2752,[72144e]|0.2292,0.2292,[72144e]|0.1611,0.1611,[72144e]|0.1424,0.1424,[72144e]|0.2364,0.2364,[72144e]|0.2884,0.2884,[72144e]|0.3182,0.3182,[72144e]|0.3087,0.3087,[72144e]|0.2783,0.2783,[72144e]|0.2988,0.2988,[72144e]|0.2224,0.2224,[72144e]|0.2224,0.2224,[72144e]|0.2364,0.2364,[72144e]|0.3392,0.3392,[72144e]|0.3566,0.3566,[72144e]|0.4051,0.4051,[72144e]|0.3356,0.3356,[72144e]|0.2817,0.2817,[72144e]|0.1969,0.1969,[72144e]|0.2094,0.2094,[72144e]|0.2164,0.2164,[72144e]|0.1791,0.1791,[72144e]|0.1583,0.1583,[72144e]|0.2436,0.2436,[72144e]|0.3426,0.3426,[72144e]|0.3566,0.3566,[72144e]|0.3286,0.3286,[72144e]|0.2258,0.2258,[72144e]|0.2436,0.2436,[72144e]|0.1554,0.1554,[72144e]|0.2364,0.2364,[72144e]|0.1298,0.1298,[72144e]|0.1914,0.1914,[72144e]|0.1115,0.1115,[72144e]|0.1528,0.1528,[72144e]|0.1115,0.1115,[72144e]|0.1007,0.1007,[72144e]|0.0909,0.0909,[72144e]|0.0734,0.0734,[72144e]|0.1206,0.1206,[72144e]|0.1823,0.1823,[72144e]|0.1643,0.1643,[72144e]|0.1298,0.1298,[72144e]|0.2164,0.2164,[72144e]|0.2399,0.2399,[72144e]|0.1671,0.1671,[72144e]|0.1092,0.1092,[72144e]|0.0948,0.0948,[72144e]|0.0948,0.0948,[72144e]|0.1501,0.1501,[72144e]|0.0967,0.0967,[72144e]|0.1611,0.1611,[72144e]|0.1424,0.1424,[72144e]|0.2328,0.2328,[72144e]|0.2503,0.2503,[72144e]|0.3529,0.3529,[72144e]|0.3494,0.3494,[72144e]|0.2817,0.2817,[72144e]|0.2064,0.2064,[72144e]|0.2193,0.2193,[72144e]|0.3286,0.3286,[72144e]|0.3392,0.3392,[72144e]|0.3494,0.3494,[72144e]|0.384,0.384,[72144e]|0.3872,0.3872,[72144e]|0.4017,0.4017,[72144e]|0.4087,0.4087,[72144e]|0.3807,0.3807,[72144e]|0.384,0.384,[72144e]|0.3117,0.3117,[72144e]|0.3182,0.3182,[72144e]|0.2328,0.2328,[72144e]|0.268,0.268,[72144e]|0.2258,0.2258,[72144e]|0.1501,0.1501,[72144e]|0.1791,0.1791,[72144e]|0.1702,0.1702,[72144e]|0.1611,0.1611,[72144e]|0.1791,0.1791,[72144e]|0.2164,0.2164,[72144e]|0.2328,0.2328,[72144e]|0.1554,0.1554,[72144e]|0.1583,0.1583,[72144e]|0.1528,0.1528,[72144e]|0.1424,0.1424,[72144e]|0.1823,0.1823,[72144e]|0.2224,0.2224,[72144e]|0.2224,0.2224,[72144e]|0.2436,0.2436,[72144e]|0.2541,0.2541,[72144e]|0.2399,0.2399,[72144e]|0.3087,0.3087,[72144e]|0.2817,0.2817,[72144e]|0.3566,0.3566,[72144e]|0.3667,0.3667,[72144e]|0.3774,0.3774,[72144e]|0.4541,0.4541,[72144e]|0.391,0.391,[72144e]|0.3599,0.3599,[72144e]|0.3356,0.3356,[72144e]|0.2783,0.2783,[72144e]|0.3426,0.3426,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.7573,0.7573,[329440]|0.6516,0.6516,[329440]|0.6293,0.6293,[329440]|0.5412,0.5412,[329440]|0.5229,0.5229,[329440]|0.5008,0.5008,[329440]|0.4825,0.4825,[329440]|0.3806,0.3806,[329440]|0.2292,0.2292,[329440]|0.1921,0.1921,[329440]|0.1602,0.1602,[329440]|0.208,0.208,[329440]|0.1667,0.1667,[329440]|0.2167,0.2167,[329440]|0.1416,0.1416,[329440]|0.1878,0.1878,[329440]|0.1921,0.1921,[329440]|0.1635,0.1635,[329440]|0.1322,0.1322,[329440]|0.1088,0.1088,[329440]|0.1805,0.1805,[329440]|0.2748,0.2748,[329440]|0.1805,0.1805,[329440]|0.1921,0.1921,[329440]|0.1495,0.1495,[329440]|0.1495,0.1495,[329440]|0.1088,0.1088,[329440]|0.1532,0.1532,[329440]|0.2531,0.2531,[329440]|0.2531,0.2531,[329440]|0.1805,0.1805,[329440]|0.106,0.106,[329440]|0.1667,0.1667,[329440]|0.1292,0.1292,[329440]|0.1998,0.1998,[329440]|0.1566,0.1566,[329440]|0.2292,0.2292,[329440]|0.1844,0.1844,[329440]|0.27,0.27,[329440]|0.2255,0.2255,[329440]|0.2041,0.2041,[329440]|0.124,0.124,[329440]|0.1205,0.1205,[329440]|0.1416,0.1416,[329440]|0.1998,0.1998,[329440]|0.1958,0.1958,[329440]|0.2292,0.2292,[329440]|0.2483,0.2483,[329440]|0.1732,0.1732,[329440]|0.1805,0.1805,[329440]|0.1667,0.1667,[329440]|0.2432,0.2432,[329440]|0.1732,0.1732,[329440]|0.2385,0.2385,[329440]|0.2531,0.2531,[329440]|0.3096,0.3096,[329440]|0.2385,0.2385,[329440]|0.2531,0.2531,[329440]|0.1844,0.1844,[329440]|0.1921,0.1921,[329440]|0.2167,0.2167,[329440]|0.208,0.208,[329440]|0.2558,0.2558,[329440]|0.27,0.27,[329440]|0.2558,0.2558,[329440]|0.2558,0.2558,[329440]|0.2531,0.2531,[329440]|0.1732,0.1732,[329440]|0.27,0.27,[329440]|0.1844,0.1844,[329440]|0.3005,0.3005,[329440]|0.208,0.208,[329440]|0.282,0.282,[329440]|0.1456,0.1456,[329440]|0.124,0.124,[329440]|0.0884,0.0884,[329440]|0.1292,0.1292,[329440]|0.1805,0.1805,[329440]|0.1416,0.1416,[329440]|0.1998,0.1998,[329440]|0.1844,0.1844,[329440]|0.1635,0.1635,[329440]|0.1667,0.1667,[329440]|0.1532,0.1532,[329440]|0.124,0.124,[329440]|0.0789,0.0789,[329440]|0.0554,0.0554,[329440]|0.0858,0.0858,[329440]|0.0701,0.0701,[329440]|0.106,0.106,[329440]|0.0587,0.0587,[329440]|0.1088,0.1088,[329440]|0.1088,0.1088,[329440]|0.1878,0.1878,[329440]|0.2122,0.2122,[329440]|0.2483,0.2483,[329440]|0.2432,0.2432,[329440]|0.1667,0.1667,[329440]|0.208,0.208,[329440]|0.2041,0.2041,[329440]|0.2209,0.2209,[329440]|0.3311,0.3311,[329440]|0.3668,0.3668,[329440]|0.3184,0.3184,[329440]|0.3096,0.3096,[329440]|0.3762,0.3762,[329440]|0.4282,0.4282,[329440]|0.3578,0.3578,[329440]|0.3096,0.3096,[329440]|0.2385,0.2385,[329440]|0.2865,0.2865,[329440]|0.2167,0.2167,[329440]|0.1878,0.1878,[329440]|0.1732,0.1732,[329440]|0.115,0.115,[329440]|0.1416,0.1416,[329440]|0.1349,0.1349,[329440]|0.208,0.208,[329440]|0.2865,0.2865,[329440]|0.2255,0.2255,[329440]|0.1667,0.1667,[329440]|0.106,0.106,[329440]|0.1205,0.1205,[329440]|0.1456,0.1456,[329440]|0.1495,0.1495,[329440]|0.1266,0.1266,[329440]|0.1416,0.1416,[329440]|0.208,0.208,[329440]|0.27,0.27,[329440]|0.27,0.27,[329440]|0.208,0.208,[329440]|0.3146,0.3146,[329440]|0.3806,0.3806,[329440]|0.4513,0.4513,[329440]|0.5623,0.5623,[329440]|0.5623,0.5623,[329440]|0.6219,0.6219,[329440]|0.6604,0.6604,[329440]|0.6906,0.6906,[329440]|0.7817,0.7817,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF Q7XA98_TRIPR +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.2292,0.2292,[72144e]|0.2645,0.2645,[72144e]|0.3019,0.3019,[72144e]|0.3286,0.3286,[72144e]|0.2328,0.2328,[72144e]|0.2258,0.2258,[72144e]|0.2645,0.2645,[72144e]|0.2988,0.2988,[72144e]|0.3286,0.3286,[72144e]|0.3774,0.3774,[72144e]|0.346,0.346,[72144e]|0.4051,0.4051,[72144e]|0.4051,0.4051,[72144e]|0.4017,0.4017,[72144e]|0.3494,0.3494,[72144e]|0.2988,0.2988,[72144e]|0.3286,0.3286,[72144e]|0.3948,0.3948,[72144e]|0.4864,0.4864,[72144e]|0.494,0.494,[72144e]|0.494,0.494,[72144e]|0.5139,0.5139,[72144e]|0.5419,0.5419,[72144e]|0.4441,0.4441,[72144e]|0.4685,0.4685,[72144e]|0.4685,0.4685,[72144e]|0.5707,0.5707,[72144e]|0.4901,0.4901,[72144e]|0.4831,0.4831,[72144e]|0.4087,0.4087,[72144e]|0.3872,0.3872,[72144e]|0.3566,0.3566,[72144e]|0.3566,0.3566,[72144e]|0.3215,0.3215,[72144e]|0.3566,0.3566,[72144e]|0.346,0.346,[72144e]|0.3983,0.3983,[72144e]|0.4256,0.4256,[72144e]|0.4369,0.4369,[72144e]|0.3667,0.3667,[72144e]|0.3392,0.3392,[72144e]|0.2884,0.2884,[72144e]|0.2609,0.2609,[72144e]|0.2436,0.2436,[72144e]|0.2436,0.2436,[72144e]|0.3392,0.3392,[72144e]|0.2328,0.2328,[72144e]|0.2258,0.2258,[72144e]|0.1791,0.1791,[72144e]|0.2575,0.2575,[72144e]|0.1969,0.1969,[72144e]|0.1969,0.1969,[72144e]|0.2094,0.2094,[72144e]|0.2399,0.2399,[72144e]|0.3149,0.3149,[72144e]|0.3182,0.3182,[72144e]|0.3426,0.3426,[72144e]|0.3599,0.3599,[72144e]|0.3807,0.3807,[72144e]|0.2884,0.2884,[72144e]|0.2884,0.2884,[72144e]|0.2609,0.2609,[72144e]|0.3149,0.3149,[72144e]|0.3774,0.3774,[72144e]|0.4119,0.4119,[72144e]|0.391,0.391,[72144e]|0.3356,0.3356,[72144e]|0.268,0.268,[72144e]|0.2849,0.2849,[72144e]|0.3117,0.3117,[72144e]|0.3599,0.3599,[72144e]|0.346,0.346,[72144e]|0.4292,0.4292,[72144e]|0.5254,0.5254,[72144e]|0.4652,0.4652,[72144e]|0.4369,0.4369,[72144e]|0.346,0.346,[72144e]|0.3704,0.3704,[72144e]|0.2783,0.2783,[72144e]|0.2988,0.2988,[72144e]|0.1969,0.1969,[72144e]|0.2849,0.2849,[72144e]|0.1852,0.1852,[72144e]|0.2752,0.2752,[72144e]|0.2193,0.2193,[72144e]|0.2064,0.2064,[72144e]|0.1942,0.1942,[72144e]|0.1583,0.1583,[72144e]|0.2258,0.2258,[72144e]|0.2918,0.2918,[72144e]|0.2609,0.2609,[72144e]|0.2224,0.2224,[72144e]|0.2258,0.2258,[72144e]|0.2399,0.2399,[72144e]|0.1731,0.1731,[72144e]|0.1184,0.1184,[72144e]|0.1611,0.1611,[72144e]|0.1611,0.1611,[72144e]|0.2292,0.2292,[72144e]|0.1643,0.1643,[72144e]|0.2292,0.2292,[72144e]|0.2064,0.2064,[72144e]|0.3053,0.3053,[72144e]|0.3215,0.3215,[72144e]|0.4149,0.4149,[72144e]|0.4119,0.4119,[72144e]|0.3494,0.3494,[72144e]|0.2884,0.2884,[72144e]|0.3053,0.3053,[72144e]|0.4087,0.4087,[72144e]|0.433,0.433,[72144e]|0.4409,0.4409,[72144e]|0.4685,0.4685,[72144e]|0.5176,0.5176,[72144e]|0.5139,0.5139,[72144e]|0.5296,0.5296,[72144e]|0.5098,0.5098,[72144e]|0.5098,0.5098,[72144e]|0.433,0.433,[72144e]|0.4369,0.4369,[72144e]|0.3249,0.3249,[72144e]|0.3249,0.3249,[72144e]|0.2951,0.2951,[72144e]|0.1969,0.1969,[72144e]|0.2064,0.2064,[72144e]|0.2002,0.2002,[72144e]|0.1942,0.1942,[72144e]|0.2094,0.2094,[72144e]|0.2436,0.2436,[72144e]|0.3087,0.3087,[72144e]|0.2258,0.2258,[72144e]|0.2328,0.2328,[72144e]|0.2164,0.2164,[72144e]|0.2034,0.2034,[72144e]|0.2541,0.2541,[72144e]|0.2575,0.2575,[72144e]|0.2783,0.2783,[72144e]|0.3019,0.3019,[72144e]|0.3019,0.3019,[72144e]|0.3529,0.3529,[72144e]|0.3948,0.3948,[72144e]|0.384,0.384,[72144e]|0.4766,0.4766,[72144e]|0.5254,0.5254,[72144e]|0.5419,0.5419,[72144e]|0.6755,0.6755,[72144e]|0.6136,0.6136,[72144e]|0.5901,0.5901,[72144e]|0.5807,0.5807,[72144e]|0.5382,0.5382,[72144e]|0.6322,0.6322,[72144e]|0.6089,0.6089,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.892,0.892,[329440]|0.835,0.835,[329440]|0.7388,0.7388,[329440]|0.6944,0.6944,[329440]|0.6557,0.6557,[329440]|0.6124,0.6124,[329440]|0.4967,0.4967,[329440]|0.4149,0.4149,[329440]|0.3939,0.3939,[329440]|0.3717,0.3717,[329440]|0.3359,0.3359,[329440]|0.3939,0.3939,[329440]|0.363,0.363,[329440]|0.3847,0.3847,[329440]|0.3535,0.3535,[329440]|0.3311,0.3311,[329440]|0.3053,0.3053,[329440]|0.3225,0.3225,[329440]|0.3992,0.3992,[329440]|0.3939,0.3939,[329440]|0.3939,0.3939,[329440]|0.4203,0.4203,[329440]|0.4781,0.4781,[329440]|0.4825,0.4825,[329440]|0.4513,0.4513,[329440]|0.363,0.363,[329440]|0.4651,0.4651,[329440]|0.4967,0.4967,[329440]|0.4749,0.4749,[329440]|0.3535,0.3535,[329440]|0.3456,0.3456,[329440]|0.2558,0.2558,[329440]|0.3225,0.3225,[329440]|0.2963,0.2963,[329440]|0.2602,0.2602,[329440]|0.2657,0.2657,[329440]|0.3184,0.3184,[329440]|0.3359,0.3359,[329440]|0.3491,0.3491,[329440]|0.3491,0.3491,[329440]|0.3578,0.3578,[329440]|0.3096,0.3096,[329440]|0.2865,0.2865,[329440]|0.2292,0.2292,[329440]|0.2292,0.2292,[329440]|0.2865,0.2865,[329440]|0.2292,0.2292,[329440]|0.2255,0.2255,[329440]|0.1566,0.1566,[329440]|0.2333,0.2333,[329440]|0.1766,0.1766,[329440]|0.2209,0.2209,[329440]|0.1602,0.1602,[329440]|0.1088,0.1088,[329440]|0.1495,0.1495,[329440]|0.1766,0.1766,[329440]|0.1921,0.1921,[329440]|0.1998,0.1998,[329440]|0.2122,0.2122,[329440]|0.2255,0.2255,[329440]|0.2385,0.2385,[329440]|0.2041,0.2041,[329440]|0.2483,0.2483,[329440]|0.2122,0.2122,[329440]|0.27,0.27,[329440]|0.3225,0.3225,[329440]|0.3762,0.3762,[329440]|0.3225,0.3225,[329440]|0.3311,0.3311,[329440]|0.2865,0.2865,[329440]|0.282,0.282,[329440]|0.3184,0.3184,[329440]|0.3668,0.3668,[329440]|0.4037,0.4037,[329440]|0.4245,0.4245,[329440]|0.4116,0.4116,[329440]|0.3359,0.3359,[329440]|0.3311,0.3311,[329440]|0.2483,0.2483,[329440]|0.2558,0.2558,[329440]|0.1766,0.1766,[329440]|0.2913,0.2913,[329440]|0.2041,0.2041,[329440]|0.3005,0.3005,[329440]|0.1416,0.1416,[329440]|0.1205,0.1205,[329440]|0.0884,0.0884,[329440]|0.1205,0.1205,[329440]|0.1766,0.1766,[329440]|0.1266,0.1266,[329440]|0.1766,0.1766,[329440]|0.1667,0.1667,[329440]|0.0991,0.0991,[329440]|0.1041,0.1041,[329440]|0.0935,0.0935,[329440]|0.0723,0.0723,[329440]|0.0771,0.0771,[329440]|0.0554,0.0554,[329440]|0.0771,0.0771,[329440]|0.066,0.066,[329440]|0.0935,0.0935,[329440]|0.0526,0.0526,[329440]|0.0771,0.0771,[329440]|0.0744,0.0744,[329440]|0.1805,0.1805,[329440]|0.2041,0.2041,[329440]|0.2333,0.2333,[329440]|0.2385,0.2385,[329440]|0.1667,0.1667,[329440]|0.2167,0.2167,[329440]|0.2255,0.2255,[329440]|0.2333,0.2333,[329440]|0.3717,0.3717,[329440]|0.4037,0.4037,[329440]|0.3399,0.3399,[329440]|0.3806,0.3806,[329440]|0.4333,0.4333,[329440]|0.4918,0.4918,[329440]|0.442,0.442,[329440]|0.3992,0.3992,[329440]|0.3399,0.3399,[329440]|0.4037,0.4037,[329440]|0.3456,0.3456,[329440]|0.2963,0.2963,[329440]|0.2602,0.2602,[329440]|0.1805,0.1805,[329440]|0.2209,0.2209,[329440]|0.2167,0.2167,[329440]|0.2963,0.2963,[329440]|0.3717,0.3717,[329440]|0.2913,0.2913,[329440]|0.2786,0.2786,[329440]|0.1921,0.1921,[329440]|0.2122,0.2122,[329440]|0.27,0.27,[329440]|0.2292,0.2292,[329440]|0.1998,0.1998,[329440]|0.2209,0.2209,[329440]|0.2963,0.2963,[329440]|0.3717,0.3717,[329440]|0.363,0.363,[329440]|0.3578,0.3578,[329440]|0.3992,0.3992,[329440]|0.4967,0.4967,[329440]|0.5549,0.5549,[329440]|0.665,0.665,[329440]|0.6681,0.6681,[329440]|0.7111,0.7111,[329440]|0.7501,0.7501,[329440]|0.7772,0.7772,[329440]|0.8677,0.8677,[329440]|0.904,0.904,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_PEA +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.1914,0.1914,[72144e]|0.2258,0.2258,[72144e]|0.268,0.268,[72144e]|0.2951,0.2951,[72144e]|0.1914,0.1914,[72144e]|0.1476,0.1476,[72144e]|0.1823,0.1823,[72144e]|0.2094,0.2094,[72144e]|0.247,0.247,[72144e]|0.3019,0.3019,[72144e]|0.2918,0.2918,[72144e]|0.3566,0.3566,[72144e]|0.3566,0.3566,[72144e]|0.3529,0.3529,[72144e]|0.2988,0.2988,[72144e]|0.2752,0.2752,[72144e]|0.3087,0.3087,[72144e]|0.3774,0.3774,[72144e]|0.4541,0.4541,[72144e]|0.4256,0.4256,[72144e]|0.3215,0.3215,[72144e]|0.346,0.346,[72144e]|0.4087,0.4087,[72144e]|0.4087,0.4087,[72144e]|0.3087,0.3087,[72144e]|0.2436,0.2436,[72144e]|0.3392,0.3392,[72144e]|0.3321,0.3321,[72144e]|0.3182,0.3182,[72144e]|0.3182,0.3182,[72144e]|0.3053,0.3053,[72144e]|0.2064,0.2064,[72144e]|0.2258,0.2258,[72144e]|0.1969,0.1969,[72144e]|0.2258,0.2258,[72144e]|0.2399,0.2399,[72144e]|0.2292,0.2292,[72144e]|0.2002,0.2002,[72144e]|0.1501,0.1501,[72144e]|0.1275,0.1275,[72144e]|0.1162,0.1162,[72144e]|0.1162,0.1162,[72144e]|0.1942,0.1942,[72144e]|0.1298,0.1298,[72144e]|0.1162,0.1162,[72144e]|0.0851,0.0851,[72144e]|0.1424,0.1424,[72144e]|0.1424,0.1424,[72144e]|0.1048,0.1048,[72144e]|0.1554,0.1554,[72144e]|0.1914,0.1914,[72144e]|0.2002,0.2002,[72144e]|0.2034,0.2034,[72144e]|0.2752,0.2752,[72144e]|0.2918,0.2918,[72144e]|0.3117,0.3117,[72144e]|0.2164,0.2164,[72144e]|0.2258,0.2258,[72144e]|0.2002,0.2002,[72144e]|0.2575,0.2575,[72144e]|0.3087,0.3087,[72144e]|0.3494,0.3494,[72144e]|0.3249,0.3249,[72144e]|0.2752,0.2752,[72144e]|0.2064,0.2064,[72144e]|0.2193,0.2193,[72144e]|0.247,0.247,[72144e]|0.2988,0.2988,[72144e]|0.2817,0.2817,[72144e]|0.3704,0.3704,[72144e]|0.4476,0.4476,[72144e]|0.391,0.391,[72144e]|0.3599,0.3599,[72144e]|0.2752,0.2752,[72144e]|0.2884,0.2884,[72144e]|0.2164,0.2164,[72144e]|0.2399,0.2399,[72144e]|0.1476,0.1476,[72144e]|0.2328,0.2328,[72144e]|0.1323,0.1323,[72144e]|0.2129,0.2129,[72144e]|0.1583,0.1583,[72144e]|0.1611,0.1611,[72144e]|0.1476,0.1476,[72144e]|0.1206,0.1206,[72144e]|0.1791,0.1791,[72144e]|0.2436,0.2436,[72144e]|0.2164,0.2164,[72144e]|0.1791,0.1791,[72144e]|0.1823,0.1823,[72144e]|0.1969,0.1969,[72144e]|0.1349,0.1349,[72144e]|0.0851,0.0851,[72144e]|0.1184,0.1184,[72144e]|0.1162,0.1162,[72144e]|0.1914,0.1914,[72144e]|0.1373,0.1373,[72144e]|0.2034,0.2034,[72144e]|0.1823,0.1823,[72144e]|0.2575,0.2575,[72144e]|0.2715,0.2715,[72144e]|0.3631,0.3631,[72144e]|0.3599,0.3599,[72144e]|0.2918,0.2918,[72144e]|0.2258,0.2258,[72144e]|0.2436,0.2436,[72144e]|0.3494,0.3494,[72144e]|0.374,0.374,[72144e]|0.384,0.384,[72144e]|0.4051,0.4051,[72144e]|0.4541,0.4541,[72144e]|0.4256,0.4256,[72144e]|0.4369,0.4369,[72144e]|0.391,0.391,[72144e]|0.3948,0.3948,[72144e]|0.3249,0.3249,[72144e]|0.3286,0.3286,[72144e]|0.2064,0.2064,[72144e]|0.2034,0.2034,[72144e]|0.1702,0.1702,[72144e]|0.1092,0.1092,[72144e]|0.1323,0.1323,[72144e]|0.1251,0.1251,[72144e]|0.1251,0.1251,[72144e]|0.1373,0.1373,[72144e]|0.1702,0.1702,[72144e]|0.1852,0.1852,[72144e]|0.1184,0.1184,[72144e]|0.1251,0.1251,[72144e]|0.1115,0.1115,[72144e]|0.1028,0.1028,[72144e]|0.1424,0.1424,[72144e]|0.1449,0.1449,[72144e]|0.1881,0.1881,[72144e]|0.2064,0.2064,[72144e]|0.2328,0.2328,[72144e]|0.2849,0.2849,[72144e]|0.3249,0.3249,[72144e]|0.3182,0.3182,[72144e]|0.4051,0.4051,[72144e]|0.4541,0.4541,[72144e]|0.4725,0.4725,[72144e]|0.5577,0.5577,[72144e]|0.494,0.494,[72144e]|0.4766,0.4766,[72144e]|0.4619,0.4619,[72144e]|0.4149,0.4149,[72144e]|0.4831,0.4831,[72144e]|0.5665,0.5665,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8781,0.8781,[329440]|0.82,0.82,[329440]|0.7192,0.7192,[329440]|0.6756,0.6756,[329440]|0.6374,0.6374,[329440]|0.59,0.59,[329440]|0.4651,0.4651,[329440]|0.3578,0.3578,[329440]|0.3359,0.3359,[329440]|0.2913,0.2913,[329440]|0.2531,0.2531,[329440]|0.3184,0.3184,[329440]|0.3184,0.3184,[329440]|0.3491,0.3491,[329440]|0.3184,0.3184,[329440]|0.2913,0.2913,[329440]|0.2531,0.2531,[329440]|0.2963,0.2963,[329440]|0.3806,0.3806,[329440]|0.3762,0.3762,[329440]|0.3806,0.3806,[329440]|0.3717,0.3717,[329440]|0.3399,0.3399,[329440]|0.3456,0.3456,[329440]|0.3535,0.3535,[329440]|0.3535,0.3535,[329440]|0.3359,0.3359,[329440]|0.3263,0.3263,[329440]|0.3053,0.3053,[329440]|0.2333,0.2333,[329440]|0.2255,0.2255,[329440]|0.1958,0.1958,[329440]|0.2292,0.2292,[329440]|0.1456,0.1456,[329440]|0.1698,0.1698,[329440]|0.1805,0.1805,[329440]|0.2385,0.2385,[329440]|0.2483,0.2483,[329440]|0.1878,0.1878,[329440]|0.1635,0.1635,[329440]|0.1178,0.1178,[329440]|0.1205,0.1205,[329440]|0.1667,0.1667,[329440]|0.138,0.138,[329440]|0.1322,0.1322,[329440]|0.0813,0.0813,[329440]|0.1416,0.1416,[329440]|0.1456,0.1456,[329440]|0.1349,0.1349,[329440]|0.1322,0.1322,[329440]|0.0909,0.0909,[329440]|0.0884,0.0884,[329440]|0.1088,0.1088,[329440]|0.1602,0.1602,[329440]|0.1635,0.1635,[329440]|0.1495,0.1495,[329440]|0.1635,0.1635,[329440]|0.1698,0.1698,[329440]|0.1456,0.1456,[329440]|0.1844,0.1844,[329440]|0.1602,0.1602,[329440]|0.2167,0.2167,[329440]|0.2483,0.2483,[329440]|0.3053,0.3053,[329440]|0.2483,0.2483,[329440]|0.2602,0.2602,[329440]|0.2122,0.2122,[329440]|0.2167,0.2167,[329440]|0.2432,0.2432,[329440]|0.3053,0.3053,[329440]|0.3263,0.3263,[329440]|0.3491,0.3491,[329440]|0.3359,0.3359,[329440]|0.2748,0.2748,[329440]|0.27,0.27,[329440]|0.2209,0.2209,[329440]|0.2292,0.2292,[329440]|0.1602,0.1602,[329440]|0.2748,0.2748,[329440]|0.1921,0.1921,[329440]|0.282,0.282,[329440]|0.1322,0.1322,[329440]|0.124,0.124,[329440]|0.0909,0.0909,[329440]|0.124,0.124,[329440]|0.1805,0.1805,[329440]|0.1322,0.1322,[329440]|0.1844,0.1844,[329440]|0.1732,0.1732,[329440]|0.1041,0.1041,[329440]|0.1088,0.1088,[329440]|0.0991,0.0991,[329440]|0.0771,0.0771,[329440]|0.0771,0.0771,[329440]|0.0554,0.0554,[329440]|0.0771,0.0771,[329440]|0.0643,0.0643,[329440]|0.1088,0.1088,[329440]|0.0607,0.0607,[329440]|0.1041,0.1041,[329440]|0.1041,0.1041,[329440]|0.208,0.208,[329440]|0.2385,0.2385,[329440]|0.2657,0.2657,[329440]|0.2748,0.2748,[329440]|0.1878,0.1878,[329440]|0.2292,0.2292,[329440]|0.2483,0.2483,[329440]|0.2602,0.2602,[329440]|0.3992,0.3992,[329440]|0.4282,0.4282,[329440]|0.363,0.363,[329440]|0.4116,0.4116,[329440]|0.4333,0.4333,[329440]|0.4967,0.4967,[329440]|0.4203,0.4203,[329440]|0.3762,0.3762,[329440]|0.282,0.282,[329440]|0.3399,0.3399,[329440]|0.2558,0.2558,[329440]|0.1998,0.1998,[329440]|0.1844,0.1844,[329440]|0.1178,0.1178,[329440]|0.1566,0.1566,[329440]|0.1495,0.1495,[329440]|0.2209,0.2209,[329440]|0.3053,0.3053,[329440]|0.2209,0.2209,[329440]|0.1566,0.1566,[329440]|0.0884,0.0884,[329440]|0.1041,0.1041,[329440]|0.1416,0.1416,[329440]|0.1178,0.1178,[329440]|0.1205,0.1205,[329440]|0.1349,0.1349,[329440]|0.2209,0.2209,[329440]|0.282,0.282,[329440]|0.2748,0.2748,[329440]|0.27,0.27,[329440]|0.3005,0.3005,[329440]|0.3992,0.3992,[329440]|0.4703,0.4703,[329440]|0.5762,0.5762,[329440]|0.5762,0.5762,[329440]|0.6293,0.6293,[329440]|0.6715,0.6715,[329440]|0.6944,0.6944,[329440]|0.7951,0.7951,[329440]|0.8781,0.8781,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_SPIOL +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.3704,0.3704,[72144e]|0.4017,0.4017,[72144e]|0.4292,0.4292,[72144e]|0.3215,0.3215,[72144e]|0.2884,0.2884,[72144e]|0.3566,0.3566,[72144e]|0.3704,0.3704,[72144e]|0.4292,0.4292,[72144e]|0.4619,0.4619,[72144e]|0.4476,0.4476,[72144e]|0.4979,0.4979,[72144e]|0.5807,0.5807,[72144e]|0.5758,0.5758,[72144e]|0.5758,0.5758,[72144e]|0.5382,0.5382,[72144e]|0.5055,0.5055,[72144e]|0.4409,0.4409,[72144e]|0.4685,0.4685,[72144e]|0.5055,0.5055,[72144e]|0.5493,0.5493,[72144e]|0.5533,0.5533,[72144e]|0.5951,0.5951,[72144e]|0.6375,0.6375,[72144e]|0.6322,0.6322,[72144e]|0.5493,0.5493,[72144e]|0.5456,0.5456,[72144e]|0.6043,0.6043,[72144e]|0.4864,0.4864,[72144e]|0.4864,0.4864,[72144e]|0.4507,0.4507,[72144e]|0.4369,0.4369,[72144e]|0.4652,0.4652,[72144e]|0.433,0.433,[72144e]|0.3983,0.3983,[72144e]|0.4292,0.4292,[72144e]|0.4619,0.4619,[72144e]|0.4541,0.4541,[72144e]|0.4831,0.4831,[72144e]|0.5176,0.5176,[72144e]|0.4541,0.4541,[72144e]|0.433,0.433,[72144e]|0.3392,0.3392,[72144e]|0.3286,0.3286,[72144e]|0.2849,0.2849,[72144e]|0.2817,0.2817,[72144e]|0.2224,0.2224,[72144e]|0.2364,0.2364,[72144e]|0.3249,0.3249,[72144e]|0.3599,0.3599,[72144e]|0.422,0.422,[72144e]|0.433,0.433,[72144e]|0.4409,0.4409,[72144e]|0.391,0.391,[72144e]|0.4186,0.4186,[72144e]|0.3249,0.3249,[72144e]|0.3392,0.3392,[72144e]|0.247,0.247,[72144e]|0.2783,0.2783,[72144e]|0.3215,0.3215,[72144e]|0.3321,0.3321,[72144e]|0.3182,0.3182,[72144e]|0.2609,0.2609,[72144e]|0.2193,0.2193,[72144e]|0.247,0.247,[72144e]|0.268,0.268,[72144e]|0.2918,0.2918,[72144e]|0.2645,0.2645,[72144e]|0.3494,0.3494,[72144e]|0.422,0.422,[72144e]|0.4476,0.4476,[72144e]|0.4119,0.4119,[72144e]|0.346,0.346,[72144e]|0.3599,0.3599,[72144e]|0.2918,0.2918,[72144e]|0.3704,0.3704,[72144e]|0.2609,0.2609,[72144e]|0.3494,0.3494,[72144e]|0.2436,0.2436,[72144e]|0.3392,0.3392,[72144e]|0.2817,0.2817,[72144e]|0.268,0.268,[72144e]|0.2541,0.2541,[72144e]|0.2094,0.2094,[72144e]|0.2951,0.2951,[72144e]|0.3566,0.3566,[72144e]|0.3215,0.3215,[72144e]|0.2849,0.2849,[72144e]|0.3117,0.3117,[72144e]|0.3249,0.3249,[72144e]|0.2399,0.2399,[72144e]|0.2064,0.2064,[72144e]|0.1852,0.1852,[72144e]|0.1852,0.1852,[72144e]|0.247,0.247,[72144e]|0.1759,0.1759,[72144e]|0.2399,0.2399,[72144e]|0.2193,0.2193,[72144e]|0.3182,0.3182,[72144e]|0.3321,0.3321,[72144e]|0.4369,0.4369,[72144e]|0.433,0.433,[72144e]|0.3704,0.3704,[72144e]|0.3087,0.3087,[72144e]|0.3249,0.3249,[72144e]|0.433,0.433,[72144e]|0.4476,0.4476,[72144e]|0.4582,0.4582,[72144e]|0.4864,0.4864,[72144e]|0.5296,0.5296,[72144e]|0.5533,0.5533,[72144e]|0.5665,0.5665,[72144e]|0.5456,0.5456,[72144e]|0.5017,0.5017,[72144e]|0.4369,0.4369,[72144e]|0.4369,0.4369,[72144e]|0.3356,0.3356,[72144e]|0.374,0.374,[72144e]|0.3426,0.3426,[72144e]|0.2609,0.2609,[72144e]|0.2817,0.2817,[72144e]|0.2164,0.2164,[72144e]|0.2034,0.2034,[72144e]|0.2164,0.2164,[72144e]|0.2541,0.2541,[72144e]|0.3117,0.3117,[72144e]|0.2328,0.2328,[72144e]|0.2399,0.2399,[72144e]|0.2224,0.2224,[72144e]|0.2064,0.2064,[72144e]|0.2575,0.2575,[72144e]|0.268,0.268,[72144e]|0.268,0.268,[72144e]|0.2918,0.2918,[72144e]|0.3019,0.3019,[72144e]|0.3494,0.3494,[72144e]|0.3872,0.3872,[72144e]|0.3807,0.3807,[72144e]|0.4685,0.4685,[72144e]|0.4831,0.4831,[72144e]|0.494,0.494,[72144e]|0.5854,0.5854,[72144e]|0.5176,0.5176,[72144e]|0.5807,0.5807,[72144e]|0.5707,0.5707,[72144e]|0.5296,0.5296,[72144e]|0.6183,0.6183,[72144e]|0.5992,0.5992,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.928,0.928,[329440]|0.8823,0.8823,[329440]|0.8283,0.8283,[329440]|0.7912,0.7912,[329440]|0.754,0.754,[329440]|0.6474,0.6474,[329440]|0.5473,0.5473,[329440]|0.5296,0.5296,[329440]|0.4918,0.4918,[329440]|0.4703,0.4703,[329440]|0.4379,0.4379,[329440]|0.442,0.442,[329440]|0.4967,0.4967,[329440]|0.5514,0.5514,[329440]|0.5229,0.5229,[329440]|0.4879,0.4879,[329440]|0.4556,0.4556,[329440]|0.4245,0.4245,[329440]|0.4116,0.4116,[329440]|0.4651,0.4651,[329440]|0.4703,0.4703,[329440]|0.5008,0.5008,[329440]|0.5296,0.5296,[329440]|0.5229,0.5229,[329440]|0.5374,0.5374,[329440]|0.6174,0.6174,[329440]|0.6255,0.6255,[329440]|0.5253,0.5253,[329440]|0.5229,0.5229,[329440]|0.4458,0.4458,[329440]|0.442,0.442,[329440]|0.4781,0.4781,[329440]|0.4513,0.4513,[329440]|0.4282,0.4282,[329440]|0.4749,0.4749,[329440]|0.4967,0.4967,[329440]|0.5173,0.5173,[329440]|0.5549,0.5549,[329440]|0.5667,0.5667,[329440]|0.5412,0.5412,[329440]|0.5043,0.5043,[329440]|0.4703,0.4703,[329440]|0.4333,0.4333,[329440]|0.3578,0.3578,[329440]|0.3311,0.3311,[329440]|0.2657,0.2657,[329440]|0.3146,0.3146,[329440]|0.3263,0.3263,[329440]|0.27,0.27,[329440]|0.3184,0.3184,[329440]|0.3456,0.3456,[329440]|0.3311,0.3311,[329440]|0.3311,0.3311,[329440]|0.3311,0.3311,[329440]|0.2531,0.2531,[329440]|0.2748,0.2748,[329440]|0.1921,0.1921,[329440]|0.1921,0.1921,[329440]|0.1456,0.1456,[329440]|0.1698,0.1698,[329440]|0.2122,0.2122,[329440]|0.2657,0.2657,[329440]|0.2333,0.2333,[329440]|0.2385,0.2385,[329440]|0.1844,0.1844,[329440]|0.1844,0.1844,[329440]|0.1998,0.1998,[329440]|0.2209,0.2209,[329440]|0.2432,0.2432,[329440]|0.2657,0.2657,[329440]|0.2483,0.2483,[329440]|0.27,0.27,[329440]|0.2657,0.2657,[329440]|0.208,0.208,[329440]|0.282,0.282,[329440]|0.1998,0.1998,[329440]|0.3184,0.3184,[329440]|0.2432,0.2432,[329440]|0.3359,0.3359,[329440]|0.1732,0.1732,[329440]|0.1566,0.1566,[329440]|0.1205,0.1205,[329440]|0.1602,0.1602,[329440]|0.2255,0.2255,[329440]|0.1766,0.1766,[329440]|0.2385,0.2385,[329440]|0.2255,0.2255,[329440]|0.1635,0.1635,[329440]|0.1732,0.1732,[329440]|0.1602,0.1602,[329440]|0.1292,0.1292,[329440]|0.0771,0.0771,[329440]|0.0701,0.0701,[329440]|0.0965,0.0965,[329440]|0.0858,0.0858,[329440]|0.124,0.124,[329440]|0.0643,0.0643,[329440]|0.0935,0.0935,[329440]|0.0935,0.0935,[329440]|0.2041,0.2041,[329440]|0.2209,0.2209,[329440]|0.2602,0.2602,[329440]|0.2657,0.2657,[329440]|0.1878,0.1878,[329440]|0.2333,0.2333,[329440]|0.2432,0.2432,[329440]|0.2531,0.2531,[329440]|0.3668,0.3668,[329440]|0.3992,0.3992,[329440]|0.3359,0.3359,[329440]|0.3717,0.3717,[329440]|0.4556,0.4556,[329440]|0.4825,0.4825,[329440]|0.4245,0.4245,[329440]|0.3806,0.3806,[329440]|0.3146,0.3146,[329440]|0.3762,0.3762,[329440]|0.3263,0.3263,[329440]|0.3005,0.3005,[329440]|0.2748,0.2748,[329440]|0.1998,0.1998,[329440]|0.2432,0.2432,[329440]|0.1878,0.1878,[329440]|0.2657,0.2657,[329440]|0.3456,0.3456,[329440]|0.2748,0.2748,[329440]|0.2558,0.2558,[329440]|0.1766,0.1766,[329440]|0.1998,0.1998,[329440]|0.2483,0.2483,[329440]|0.2209,0.2209,[329440]|0.1732,0.1732,[329440]|0.1921,0.1921,[329440]|0.282,0.282,[329440]|0.3535,0.3535,[329440]|0.3456,0.3456,[329440]|0.3491,0.3491,[329440]|0.3806,0.3806,[329440]|0.4458,0.4458,[329440]|0.5084,0.5084,[329440]|0.6174,0.6174,[329440]|0.6174,0.6174,[329440]|0.7034,0.7034,[329440]|0.7418,0.7418,[329440]|0.7644,0.7644,[329440]|0.8595,0.8595,[329440]|0.8945,0.8945,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_MESCR +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.3117,0.3117,[72144e]|0.2951,0.2951,[72144e]|0.3249,0.3249,[72144e]|0.3566,0.3566,[72144e]|0.3426,0.3426,[72144e]|0.2503,0.2503,[72144e]|0.2436,0.2436,[72144e]|0.3053,0.3053,[72144e]|0.3182,0.3182,[72144e]|0.3426,0.3426,[72144e]|0.3948,0.3948,[72144e]|0.4619,0.4619,[72144e]|0.4619,0.4619,[72144e]|0.4979,0.4979,[72144e]|0.4652,0.4652,[72144e]|0.433,0.433,[72144e]|0.3983,0.3983,[72144e]|0.4619,0.4619,[72144e]|0.5296,0.5296,[72144e]|0.5419,0.5419,[72144e]|0.4864,0.4864,[72144e]|0.5176,0.5176,[72144e]|0.5176,0.5176,[72144e]|0.5176,0.5176,[72144e]|0.4541,0.4541,[72144e]|0.3599,0.3599,[72144e]|0.3872,0.3872,[72144e]|0.4119,0.4119,[72144e]|0.4292,0.4292,[72144e]|0.3948,0.3948,[72144e]|0.4017,0.4017,[72144e]|0.3704,0.3704,[72144e]|0.3356,0.3356,[72144e]|0.3053,0.3053,[72144e]|0.3286,0.3286,[72144e]|0.3286,0.3286,[72144e]|0.3087,0.3087,[72144e]|0.3392,0.3392,[72144e]|0.3774,0.3774,[72144e]|0.3182,0.3182,[72144e]|0.2918,0.2918,[72144e]|0.2609,0.2609,[72144e]|0.2292,0.2292,[72144e]|0.2224,0.2224,[72144e]|0.1731,0.1731,[72144e]|0.2002,0.2002,[72144e]|0.2002,0.2002,[72144e]|0.2436,0.2436,[72144e]|0.247,0.247,[72144e]|0.3426,0.3426,[72144e]|0.3774,0.3774,[72144e]|0.3774,0.3774,[72144e]|0.3704,0.3704,[72144e]|0.4087,0.4087,[72144e]|0.4369,0.4369,[72144e]|0.3704,0.3704,[72144e]|0.3948,0.3948,[72144e]|0.2988,0.2988,[72144e]|0.3807,0.3807,[72144e]|0.391,0.391,[72144e]|0.4292,0.4292,[72144e]|0.4087,0.4087,[72144e]|0.3529,0.3529,[72144e]|0.3149,0.3149,[72144e]|0.3356,0.3356,[72144e]|0.3566,0.3566,[72144e]|0.3807,0.3807,[72144e]|0.3529,0.3529,[72144e]|0.4369,0.4369,[72144e]|0.5139,0.5139,[72144e]|0.4831,0.4831,[72144e]|0.4507,0.4507,[72144e]|0.3566,0.3566,[72144e]|0.3704,0.3704,[72144e]|0.3182,0.3182,[72144e]|0.3392,0.3392,[72144e]|0.2328,0.2328,[72144e]|0.2951,0.2951,[72144e]|0.1791,0.1791,[72144e]|0.2715,0.2715,[72144e]|0.2164,0.2164,[72144e]|0.2002,0.2002,[72144e]|0.1881,0.1881,[72144e]|0.1501,0.1501,[72144e]|0.2164,0.2164,[72144e]|0.2817,0.2817,[72144e]|0.247,0.247,[72144e]|0.2094,0.2094,[72144e]|0.2328,0.2328,[72144e]|0.2503,0.2503,[72144e]|0.1823,0.1823,[72144e]|0.1643,0.1643,[72144e]|0.1852,0.1852,[72144e]|0.1852,0.1852,[72144e]|0.247,0.247,[72144e]|0.1881,0.1881,[72144e]|0.2541,0.2541,[72144e]|0.2328,0.2328,[72144e]|0.3249,0.3249,[72144e]|0.3426,0.3426,[72144e]|0.4369,0.4369,[72144e]|0.4292,0.4292,[72144e]|0.3704,0.3704,[72144e]|0.3117,0.3117,[72144e]|0.3249,0.3249,[72144e]|0.4369,0.4369,[72144e]|0.4507,0.4507,[72144e]|0.4619,0.4619,[72144e]|0.4901,0.4901,[72144e]|0.5055,0.5055,[72144e]|0.5342,0.5342,[72144e]|0.5419,0.5419,[72144e]|0.5176,0.5176,[72144e]|0.4619,0.4619,[72144e]|0.4017,0.4017,[72144e]|0.4051,0.4051,[72144e]|0.3053,0.3053,[72144e]|0.3053,0.3053,[72144e]|0.2783,0.2783,[72144e]|0.1942,0.1942,[72144e]|0.2129,0.2129,[72144e]|0.2002,0.2002,[72144e]|0.2002,0.2002,[72144e]|0.2129,0.2129,[72144e]|0.2503,0.2503,[72144e]|0.3117,0.3117,[72144e]|0.2328,0.2328,[72144e]|0.2399,0.2399,[72144e]|0.2258,0.2258,[72144e]|0.2129,0.2129,[72144e]|0.268,0.268,[72144e]|0.2988,0.2988,[72144e]|0.2988,0.2988,[72144e]|0.3215,0.3215,[72144e]|0.3249,0.3249,[72144e]|0.3774,0.3774,[72144e]|0.4149,0.4149,[72144e]|0.4051,0.4051,[72144e]|0.4979,0.4979,[72144e]|0.5456,0.5456,[72144e]|0.5665,0.5665,[72144e]|0.6755,0.6755,[72144e]|0.6089,0.6089,[72144e]|0.5901,0.5901,[72144e]|0.5807,0.5807,[72144e]|0.5382,0.5382,[72144e]|0.6227,0.6227,[72144e]|0.6043,0.6043,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8857,0.8857,[329440]|0.8283,0.8283,[329440]|0.7912,0.7912,[329440]|0.7111,0.7111,[329440]|0.6681,0.6681,[329440]|0.6334,0.6334,[329440]|0.5549,0.5549,[329440]|0.4282,0.4282,[329440]|0.3491,0.3491,[329440]|0.3311,0.3311,[329440]|0.2913,0.2913,[329440]|0.3225,0.3225,[329440]|0.3806,0.3806,[329440]|0.442,0.442,[329440]|0.4078,0.4078,[329440]|0.4078,0.4078,[329440]|0.4078,0.4078,[329440]|0.4037,0.4037,[329440]|0.3939,0.3939,[329440]|0.4203,0.4203,[329440]|0.4245,0.4245,[329440]|0.46,0.46,[329440]|0.3885,0.3885,[329440]|0.4282,0.4282,[329440]|0.4556,0.4556,[329440]|0.4149,0.4149,[329440]|0.3885,0.3885,[329440]|0.3847,0.3847,[329440]|0.4203,0.4203,[329440]|0.3263,0.3263,[329440]|0.3311,0.3311,[329440]|0.3263,0.3263,[329440]|0.3005,0.3005,[329440]|0.2432,0.2432,[329440]|0.2786,0.2786,[329440]|0.2865,0.2865,[329440]|0.3146,0.3146,[329440]|0.3578,0.3578,[329440]|0.3535,0.3535,[329440]|0.3263,0.3263,[329440]|0.2913,0.2913,[329440]|0.2558,0.2558,[329440]|0.2913,0.2913,[329440]|0.2657,0.2657,[329440]|0.1698,0.1698,[329440]|0.1958,0.1958,[329440]|0.1878,0.1878,[329440]|0.2748,0.2748,[329440]|0.2041,0.2041,[329440]|0.208,0.208,[329440]|0.1998,0.1998,[329440]|0.2333,0.2333,[329440]|0.2483,0.2483,[329440]|0.2748,0.2748,[329440]|0.2602,0.2602,[329440]|0.2602,0.2602,[329440]|0.2786,0.2786,[329440]|0.1998,0.1998,[329440]|0.2748,0.2748,[329440]|0.1844,0.1844,[329440]|0.2483,0.2483,[329440]|0.2913,0.2913,[329440]|0.3456,0.3456,[329440]|0.3184,0.3184,[329440]|0.3225,0.3225,[329440]|0.27,0.27,[329440]|0.2748,0.2748,[329440]|0.2913,0.2913,[329440]|0.3225,0.3225,[329440]|0.3491,0.3491,[329440]|0.3717,0.3717,[329440]|0.3578,0.3578,[329440]|0.3053,0.3053,[329440]|0.3005,0.3005,[329440]|0.2602,0.2602,[329440]|0.2748,0.2748,[329440]|0.1958,0.1958,[329440]|0.3005,0.3005,[329440]|0.2209,0.2209,[329440]|0.3146,0.3146,[329440]|0.1602,0.1602,[329440]|0.138,0.138,[329440]|0.1041,0.1041,[329440]|0.1349,0.1349,[329440]|0.1958,0.1958,[329440]|0.1532,0.1532,[329440]|0.2041,0.2041,[329440]|0.1878,0.1878,[329440]|0.1322,0.1322,[329440]|0.1349,0.1349,[329440]|0.124,0.124,[329440]|0.0991,0.0991,[329440]|0.0884,0.0884,[329440]|0.0858,0.0858,[329440]|0.1205,0.1205,[329440]|0.1018,0.1018,[329440]|0.138,0.138,[329440]|0.0832,0.0832,[329440]|0.1178,0.1178,[329440]|0.1178,0.1178,[329440]|0.2385,0.2385,[329440]|0.2602,0.2602,[329440]|0.2865,0.2865,[329440]|0.2963,0.2963,[329440]|0.2209,0.2209,[329440]|0.2748,0.2748,[329440]|0.2865,0.2865,[329440]|0.2963,0.2963,[329440]|0.4116,0.4116,[329440]|0.442,0.442,[329440]|0.3885,0.3885,[329440]|0.3885,0.3885,[329440]|0.4651,0.4651,[329440]|0.4749,0.4749,[329440]|0.4149,0.4149,[329440]|0.3762,0.3762,[329440]|0.3184,0.3184,[329440]|0.3668,0.3668,[329440]|0.3146,0.3146,[329440]|0.2657,0.2657,[329440]|0.2333,0.2333,[329440]|0.1667,0.1667,[329440]|0.208,0.208,[329440]|0.1998,0.1998,[329440]|0.2786,0.2786,[329440]|0.3456,0.3456,[329440]|0.2786,0.2786,[329440]|0.2602,0.2602,[329440]|0.1844,0.1844,[329440]|0.1998,0.1998,[329440]|0.2483,0.2483,[329440]|0.2531,0.2531,[329440]|0.2041,0.2041,[329440]|0.2209,0.2209,[329440]|0.2963,0.2963,[329440]|0.3578,0.3578,[329440]|0.3491,0.3491,[329440]|0.3491,0.3491,[329440]|0.3847,0.3847,[329440]|0.4781,0.4781,[329440]|0.5374,0.5374,[329440]|0.6442,0.6442,[329440]|0.6474,0.6474,[329440]|0.6944,0.6944,[329440]|0.7317,0.7317,[329440]|0.7605,0.7605,[329440]|0.8521,0.8521,[329440]|0.892,0.892,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER_CAPAN +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.2817,0.2817,[72144e]|0.1671,0.1671,[72144e]|0.1611,0.1611,[72144e]|0.2364,0.2364,[72144e]|0.2783,0.2783,[72144e]|0.2951,0.2951,[72144e]|0.3566,0.3566,[72144e]|0.3426,0.3426,[72144e]|0.3053,0.3053,[72144e]|0.3286,0.3286,[72144e]|0.346,0.346,[72144e]|0.3087,0.3087,[72144e]|0.3321,0.3321,[72144e]|0.3631,0.3631,[72144e]|0.346,0.346,[72144e]|0.3774,0.3774,[72144e]|0.4119,0.4119,[72144e]|0.3566,0.3566,[72144e]|0.384,0.384,[72144e]|0.4766,0.4766,[72144e]|0.4507,0.4507,[72144e]|0.3807,0.3807,[72144e]|0.2884,0.2884,[72144e]|0.3774,0.3774,[72144e]|0.3392,0.3392,[72144e]|0.3019,0.3019,[72144e]|0.2918,0.2918,[72144e]|0.2752,0.2752,[72144e]|0.2503,0.2503,[72144e]|0.2752,0.2752,[72144e]|0.3249,0.3249,[72144e]|0.3149,0.3149,[72144e]|0.2645,0.2645,[72144e]|0.3356,0.3356,[72144e]|0.2399,0.2399,[72144e]|0.1852,0.1852,[72144e]|0.2258,0.2258,[72144e]|0.1969,0.1969,[72144e]|0.1251,0.1251,[72144e]|0.1583,0.1583,[72144e]|0.1229,0.1229,[72144e]|0.1028,0.1028,[72144e]|0.0817,0.0817,[72144e]|0.0799,0.0799,[72144e]|0.1399,0.1399,[72144e]|0.1611,0.1611,[72144e]|0.2399,0.2399,[72144e]|0.247,0.247,[72144e]|0.2783,0.2783,[72144e]|0.2328,0.2328,[72144e]|0.2503,0.2503,[72144e]|0.1643,0.1643,[72144e]|0.1791,0.1791,[72144e]|0.1092,0.1092,[72144e]|0.1702,0.1702,[72144e]|0.1791,0.1791,[72144e]|0.2849,0.2849,[72144e]|0.2645,0.2645,[72144e]|0.2094,0.2094,[72144e]|0.1501,0.1501,[72144e]|0.1643,0.1643,[72144e]|0.1852,0.1852,[72144e]|0.247,0.247,[72144e]|0.2258,0.2258,[72144e]|0.3149,0.3149,[72144e]|0.4087,0.4087,[72144e]|0.3774,0.3774,[72144e]|0.346,0.346,[72144e]|0.3286,0.3286,[72144e]|0.3494,0.3494,[72144e]|0.2541,0.2541,[72144e]|0.3529,0.3529,[72144e]|0.247,0.247,[72144e]|0.3392,0.3392,[72144e]|0.2224,0.2224,[72144e]|0.3249,0.3249,[72144e]|0.268,0.268,[72144e]|0.2541,0.2541,[72144e]|0.2436,0.2436,[72144e]|0.1969,0.1969,[72144e]|0.2752,0.2752,[72144e]|0.3426,0.3426,[72144e]|0.3053,0.3053,[72144e]|0.2645,0.2645,[72144e]|0.2503,0.2503,[72144e]|0.2715,0.2715,[72144e]|0.1823,0.1823,[72144e]|0.1424,0.1424,[72144e]|0.1611,0.1611,[72144e]|0.1611,0.1611,[72144e]|0.1424,0.1424,[72144e]|0.0967,0.0967,[72144e]|0.1528,0.1528,[72144e]|0.1399,0.1399,[72144e]|0.2129,0.2129,[72144e]|0.2292,0.2292,[72144e]|0.3286,0.3286,[72144e]|0.3356,0.3356,[72144e]|0.2752,0.2752,[72144e]|0.2094,0.2094,[72144e]|0.2292,0.2292,[72144e]|0.346,0.346,[72144e]|0.3631,0.3631,[72144e]|0.374,0.374,[72144e]|0.4119,0.4119,[72144e]|0.4619,0.4619,[72144e]|0.4864,0.4864,[72144e]|0.4901,0.4901,[72144e]|0.4979,0.4979,[72144e]|0.4725,0.4725,[72144e]|0.4051,0.4051,[72144e]|0.4087,0.4087,[72144e]|0.3182,0.3182,[72144e]|0.3215,0.3215,[72144e]|0.2817,0.2817,[72144e]|0.1969,0.1969,[72144e]|0.2224,0.2224,[72144e]|0.2164,0.2164,[72144e]|0.2129,0.2129,[72144e]|0.2193,0.2193,[72144e]|0.2575,0.2575,[72144e]|0.3215,0.3215,[72144e]|0.2399,0.2399,[72144e]|0.2436,0.2436,[72144e]|0.2292,0.2292,[72144e]|0.2164,0.2164,[72144e]|0.268,0.268,[72144e]|0.268,0.268,[72144e]|0.2193,0.2193,[72144e]|0.2436,0.2436,[72144e]|0.2436,0.2436,[72144e]|0.247,0.247,[72144e]|0.3087,0.3087,[72144e]|0.3019,0.3019,[72144e]|0.4017,0.4017,[72144e]|0.4441,0.4441,[72144e]|0.4541,0.4541,[72144e]|0.5419,0.5419,[72144e]|0.4831,0.4831,[72144e]|0.4507,0.4507,[72144e]|0.4369,0.4369,[72144e]|0.391,0.391,[72144e]|0.4541,0.4541,[72144e]|0.4292,0.4292,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8424,0.8424,[329440]|0.8074,0.8074,[329440]|0.7644,0.7644,[329440]|0.6442,0.6442,[329440]|0.5762,0.5762,[329440]|0.5549,0.5549,[329440]|0.5253,0.5253,[329440]|0.4879,0.4879,[329440]|0.4651,0.4651,[329440]|0.3847,0.3847,[329440]|0.2748,0.2748,[329440]|0.2963,0.2963,[329440]|0.3311,0.3311,[329440]|0.2657,0.2657,[329440]|0.3311,0.3311,[329440]|0.3535,0.3535,[329440]|0.3146,0.3146,[329440]|0.3311,0.3311,[329440]|0.3578,0.3578,[329440]|0.363,0.363,[329440]|0.3578,0.3578,[329440]|0.363,0.363,[329440]|0.3225,0.3225,[329440]|0.3491,0.3491,[329440]|0.2913,0.2913,[329440]|0.2657,0.2657,[329440]|0.1878,0.1878,[329440]|0.1878,0.1878,[329440]|0.1732,0.1732,[329440]|0.1732,0.1732,[329440]|0.2292,0.2292,[329440]|0.2255,0.2255,[329440]|0.2255,0.2255,[329440]|0.282,0.282,[329440]|0.2209,0.2209,[329440]|0.1958,0.1958,[329440]|0.1844,0.1844,[329440]|0.138,0.138,[329440]|0.1088,0.1088,[329440]|0.1602,0.1602,[329440]|0.1041,0.1041,[329440]|0.0965,0.0965,[329440]|0.0813,0.0813,[329440]|0.1088,0.1088,[329440]|0.1205,0.1205,[329440]|0.0789,0.0789,[329440]|0.1117,0.1117,[329440]|0.1322,0.1322,[329440]|0.1349,0.1349,[329440]|0.1602,0.1602,[329440]|0.1805,0.1805,[329440]|0.1322,0.1322,[329440]|0.1495,0.1495,[329440]|0.0965,0.0965,[329440]|0.1495,0.1495,[329440]|0.0771,0.0771,[329440]|0.1495,0.1495,[329440]|0.1921,0.1921,[329440]|0.2209,0.2209,[329440]|0.1698,0.1698,[329440]|0.1805,0.1805,[329440]|0.1456,0.1456,[329440]|0.1495,0.1495,[329440]|0.1732,0.1732,[329440]|0.2432,0.2432,[329440]|0.2786,0.2786,[329440]|0.3053,0.3053,[329440]|0.2913,0.2913,[329440]|0.2432,0.2432,[329440]|0.2432,0.2432,[329440]|0.1958,0.1958,[329440]|0.2865,0.2865,[329440]|0.2041,0.2041,[329440]|0.3225,0.3225,[329440]|0.2385,0.2385,[329440]|0.3578,0.3578,[329440]|0.1844,0.1844,[329440]|0.1698,0.1698,[329440]|0.1495,0.1495,[329440]|0.1844,0.1844,[329440]|0.2558,0.2558,[329440]|0.1844,0.1844,[329440]|0.2483,0.2483,[329440]|0.2385,0.2385,[329440]|0.1266,0.1266,[329440]|0.1322,0.1322,[329440]|0.1205,0.1205,[329440]|0.0965,0.0965,[329440]|0.0832,0.0832,[329440]|0.0744,0.0744,[329440]|0.0813,0.0813,[329440]|0.0677,0.0677,[329440]|0.0832,0.0832,[329440]|0.0478,0.0478,[329440]|0.0813,0.0813,[329440]|0.0813,0.0813,[329440]|0.1766,0.1766,[329440]|0.1958,0.1958,[329440]|0.2209,0.2209,[329440]|0.2255,0.2255,[329440]|0.1566,0.1566,[329440]|0.208,0.208,[329440]|0.2209,0.2209,[329440]|0.2292,0.2292,[329440]|0.3668,0.3668,[329440]|0.3939,0.3939,[329440]|0.3263,0.3263,[329440]|0.3717,0.3717,[329440]|0.4513,0.4513,[329440]|0.4825,0.4825,[329440]|0.4245,0.4245,[329440]|0.3762,0.3762,[329440]|0.3399,0.3399,[329440]|0.3885,0.3885,[329440]|0.3053,0.3053,[329440]|0.2531,0.2531,[329440]|0.2385,0.2385,[329440]|0.1635,0.1635,[329440]|0.2041,0.2041,[329440]|0.208,0.208,[329440]|0.2865,0.2865,[329440]|0.3668,0.3668,[329440]|0.2865,0.2865,[329440]|0.27,0.27,[329440]|0.1805,0.1805,[329440]|0.1998,0.1998,[329440]|0.2602,0.2602,[329440]|0.2209,0.2209,[329440]|0.1766,0.1766,[329440]|0.1958,0.1958,[329440]|0.2209,0.2209,[329440]|0.2913,0.2913,[329440]|0.2913,0.2913,[329440]|0.2385,0.2385,[329440]|0.3096,0.3096,[329440]|0.4078,0.4078,[329440]|0.4749,0.4749,[329440]|0.5846,0.5846,[329440]|0.59,0.59,[329440]|0.6334,0.6334,[329440]|0.6681,0.6681,[329440]|0.6906,0.6906,[329440]|0.7869,0.7869,[329440]|0.835,0.835,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER_CAPAA +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.247,0.247,[72144e]|0.3392,0.3392,[72144e]|0.2609,0.2609,[72144e]|0.3249,0.3249,[72144e]|0.2258,0.2258,[72144e]|0.2817,0.2817,[72144e]|0.1759,0.1759,[72144e]|0.2364,0.2364,[72144e]|0.2817,0.2817,[72144e]|0.3215,0.3215,[72144e]|0.2918,0.2918,[72144e]|0.2436,0.2436,[72144e]|0.1852,0.1852,[72144e]|0.1942,0.1942,[72144e]|0.2258,0.2258,[72144e]|0.2884,0.2884,[72144e]|0.2783,0.2783,[72144e]|0.3667,0.3667,[72144e]|0.4541,0.4541,[72144e]|0.4292,0.4292,[72144e]|0.3948,0.3948,[72144e]|0.3704,0.3704,[72144e]|0.391,0.391,[72144e]|0.2918,0.2918,[72144e]|0.3948,0.3948,[72144e]|0.2951,0.2951,[72144e]|0.3872,0.3872,[72144e]|0.2575,0.2575,[72144e]|0.3599,0.3599,[72144e]|0.3019,0.3019,[72144e]|0.2849,0.2849,[72144e]|0.2645,0.2645,[72144e]|0.2034,0.2034,[72144e]|0.2752,0.2752,[72144e]|0.3356,0.3356,[72144e]|0.2918,0.2918,[72144e]|0.247,0.247,[72144e]|0.2364,0.2364,[72144e]|0.247,0.247,[72144e]|0.1643,0.1643,[72144e]|0.1275,0.1275,[72144e]|0.1449,0.1449,[72144e]|0.1449,0.1449,[72144e]|0.1323,0.1323,[72144e]|0.0888,0.0888,[72144e]|0.1449,0.1449,[72144e]|0.1275,0.1275,[72144e]|0.1881,0.1881,[72144e]|0.2064,0.2064,[72144e]|0.3149,0.3149,[72144e]|0.3286,0.3286,[72144e]|0.268,0.268,[72144e]|0.2034,0.2034,[72144e]|0.2224,0.2224,[72144e]|0.3494,0.3494,[72144e]|0.3704,0.3704,[72144e]|0.3807,0.3807,[72144e]|0.422,0.422,[72144e]|0.4725,0.4725,[72144e]|0.5017,0.5017,[72144e]|0.5176,0.5176,[72144e]|0.5176,0.5176,[72144e]|0.4901,0.4901,[72144e]|0.422,0.422,[72144e]|0.422,0.422,[72144e]|0.3356,0.3356,[72144e]|0.3356,0.3356,[72144e]|0.2951,0.2951,[72144e]|0.2129,0.2129,[72144e]|0.2436,0.2436,[72144e]|0.2328,0.2328,[72144e]|0.2328,0.2328,[72144e]|0.247,0.247,[72144e]|0.2849,0.2849,[72144e]|0.3494,0.3494,[72144e]|0.2609,0.2609,[72144e]|0.268,0.268,[72144e]|0.2541,0.2541,[72144e]|0.2328,0.2328,[72144e]|0.2849,0.2849,[72144e]|0.2884,0.2884,[72144e]|0.2364,0.2364,[72144e]|0.2609,0.2609,[72144e]|0.2645,0.2645,[72144e]|0.2645,0.2645,[72144e]|0.3286,0.3286,[72144e]|0.3215,0.3215,[72144e]|0.4186,0.4186,[72144e]|0.4582,0.4582,[72144e]|0.4725,0.4725,[72144e]|0.5533,0.5533,[72144e]|0.494,0.494,[72144e]|0.4652,0.4652,[72144e]|0.4476,0.4476,[72144e]|0.3983,0.3983,[72144e]|0.4619,0.4619,[72144e]|0.433,0.433,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.7724,0.7724,[329440]|0.7501,0.7501,[329440]|0.7111,0.7111,[329440]|0.6984,0.6984,[329440]|0.59,0.59,[329440]|0.5711,0.5711,[329440]|0.442,0.442,[329440]|0.4203,0.4203,[329440]|0.2786,0.2786,[329440]|0.27,0.27,[329440]|0.2385,0.2385,[329440]|0.3005,0.3005,[329440]|0.2385,0.2385,[329440]|0.2483,0.2483,[329440]|0.2167,0.2167,[329440]|0.2255,0.2255,[329440]|0.2657,0.2657,[329440]|0.3456,0.3456,[329440]|0.3717,0.3717,[329440]|0.3992,0.3992,[329440]|0.3847,0.3847,[329440]|0.3311,0.3311,[329440]|0.3225,0.3225,[329440]|0.27,0.27,[329440]|0.3668,0.3668,[329440]|0.2786,0.2786,[329440]|0.4037,0.4037,[329440]|0.3096,0.3096,[329440]|0.4116,0.4116,[329440]|0.2255,0.2255,[329440]|0.2041,0.2041,[329440]|0.1602,0.1602,[329440]|0.1998,0.1998,[329440]|0.2657,0.2657,[329440]|0.1921,0.1921,[329440]|0.2558,0.2558,[329440]|0.2483,0.2483,[329440]|0.1322,0.1322,[329440]|0.138,0.138,[329440]|0.124,0.124,[329440]|0.0991,0.0991,[329440]|0.0884,0.0884,[329440]|0.0771,0.0771,[329440]|0.0858,0.0858,[329440]|0.0701,0.0701,[329440]|0.0858,0.0858,[329440]|0.049,0.049,[329440]|0.0813,0.0813,[329440]|0.0813,0.0813,[329440]|0.1766,0.1766,[329440]|0.1998,0.1998,[329440]|0.2255,0.2255,[329440]|0.2255,0.2255,[329440]|0.1566,0.1566,[329440]|0.208,0.208,[329440]|0.2209,0.2209,[329440]|0.2292,0.2292,[329440]|0.3668,0.3668,[329440]|0.3939,0.3939,[329440]|0.3263,0.3263,[329440]|0.3717,0.3717,[329440]|0.4513,0.4513,[329440]|0.4825,0.4825,[329440]|0.4245,0.4245,[329440]|0.3762,0.3762,[329440]|0.3399,0.3399,[329440]|0.3885,0.3885,[329440]|0.3053,0.3053,[329440]|0.2531,0.2531,[329440]|0.2385,0.2385,[329440]|0.1635,0.1635,[329440]|0.2041,0.2041,[329440]|0.208,0.208,[329440]|0.2865,0.2865,[329440]|0.3668,0.3668,[329440]|0.2865,0.2865,[329440]|0.27,0.27,[329440]|0.1805,0.1805,[329440]|0.1998,0.1998,[329440]|0.2602,0.2602,[329440]|0.2209,0.2209,[329440]|0.1766,0.1766,[329440]|0.1958,0.1958,[329440]|0.2209,0.2209,[329440]|0.2913,0.2913,[329440]|0.2913,0.2913,[329440]|0.2385,0.2385,[329440]|0.3096,0.3096,[329440]|0.4078,0.4078,[329440]|0.4749,0.4749,[329440]|0.5846,0.5846,[329440]|0.59,0.59,[329440]|0.6334,0.6334,[329440]|0.6681,0.6681,[329440]|0.6906,0.6906,[329440]|0.7869,0.7869,[329440]|0.835,0.835,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF Q93XJ9_SOLTU +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.3182,0.3182,[72144e]|0.2002,0.2002,[72144e]|0.1449,0.1449,[72144e]|0.2164,0.2164,[72144e]|0.2503,0.2503,[72144e]|0.268,0.268,[72144e]|0.3286,0.3286,[72144e]|0.2951,0.2951,[72144e]|0.2609,0.2609,[72144e]|0.2849,0.2849,[72144e]|0.3053,0.3053,[72144e]|0.2609,0.2609,[72144e]|0.2817,0.2817,[72144e]|0.2541,0.2541,[72144e]|0.2575,0.2575,[72144e]|0.2575,0.2575,[72144e]|0.2645,0.2645,[72144e]|0.2064,0.2064,[72144e]|0.2292,0.2292,[72144e]|0.3149,0.3149,[72144e]|0.2884,0.2884,[72144e]|0.2164,0.2164,[72144e]|0.1399,0.1399,[72144e]|0.2129,0.2129,[72144e]|0.2094,0.2094,[72144e]|0.1731,0.1731,[72144e]|0.1702,0.1702,[72144e]|0.1759,0.1759,[72144e]|0.1501,0.1501,[72144e]|0.2002,0.2002,[72144e]|0.247,0.247,[72144e]|0.2436,0.2436,[72144e]|0.1823,0.1823,[72144e]|0.2503,0.2503,[72144e]|0.1583,0.1583,[72144e]|0.1611,0.1611,[72144e]|0.2002,0.2002,[72144e]|0.2002,0.2002,[72144e]|0.1298,0.1298,[72144e]|0.1643,0.1643,[72144e]|0.1275,0.1275,[72144e]|0.107,0.107,[72144e]|0.087,0.087,[72144e]|0.087,0.087,[72144e]|0.1501,0.1501,[72144e]|0.1759,0.1759,[72144e]|0.2503,0.2503,[72144e]|0.2609,0.2609,[72144e]|0.2918,0.2918,[72144e]|0.2258,0.2258,[72144e]|0.2436,0.2436,[72144e]|0.1554,0.1554,[72144e]|0.1731,0.1731,[72144e]|0.0948,0.0948,[72144e]|0.1611,0.1611,[72144e]|0.1702,0.1702,[72144e]|0.2849,0.2849,[72144e]|0.2609,0.2609,[72144e]|0.2094,0.2094,[72144e]|0.1554,0.1554,[72144e]|0.1671,0.1671,[72144e]|0.1852,0.1852,[72144e]|0.2436,0.2436,[72144e]|0.2258,0.2258,[72144e]|0.3117,0.3117,[72144e]|0.3983,0.3983,[72144e]|0.4186,0.4186,[72144e]|0.3872,0.3872,[72144e]|0.374,0.374,[72144e]|0.3872,0.3872,[72144e]|0.2918,0.2918,[72144e]|0.391,0.391,[72144e]|0.2918,0.2918,[72144e]|0.384,0.384,[72144e]|0.2541,0.2541,[72144e]|0.3631,0.3631,[72144e]|0.3053,0.3053,[72144e]|0.2918,0.2918,[72144e]|0.2783,0.2783,[72144e]|0.2193,0.2193,[72144e]|0.2951,0.2951,[72144e]|0.3599,0.3599,[72144e]|0.3149,0.3149,[72144e]|0.2752,0.2752,[72144e]|0.2645,0.2645,[72144e]|0.2817,0.2817,[72144e]|0.2094,0.2094,[72144e]|0.1942,0.1942,[72144e]|0.1528,0.1528,[72144e]|0.1528,0.1528,[72144e]|0.1554,0.1554,[72144e]|0.1092,0.1092,[72144e]|0.1671,0.1671,[72144e]|0.1501,0.1501,[72144e]|0.2164,0.2164,[72144e]|0.2292,0.2292,[72144e]|0.3392,0.3392,[72144e]|0.3249,0.3249,[72144e]|0.2645,0.2645,[72144e]|0.2034,0.2034,[72144e]|0.2164,0.2164,[72144e]|0.3356,0.3356,[72144e]|0.3494,0.3494,[72144e]|0.3599,0.3599,[72144e]|0.494,0.494,[72144e]|0.494,0.494,[72144e]|0.4652,0.4652,[72144e]|0.4766,0.4766,[72144e]|0.4369,0.4369,[72144e]|0.3872,0.3872,[72144e]|0.3494,0.3494,[72144e]|0.3529,0.3529,[72144e]|0.2292,0.2292,[72144e]|0.2328,0.2328,[72144e]|0.2002,0.2002,[72144e]|0.1349,0.1349,[72144e]|0.1611,0.1611,[72144e]|0.1399,0.1399,[72144e]|0.0676,0.0676,[72144e]|0.078,0.078,[72144e]|0.1007,0.1007,[72144e]|0.1424,0.1424,[72144e]|0.0948,0.0948,[72144e]|0.0985,0.0985,[72144e]|0.0929,0.0929,[72144e]|0.0851,0.0851,[72144e]|0.0676,0.0676,[72144e]|0.0909,0.0909,[72144e]|0.1229,0.1229,[72144e]|0.1399,0.1399,[72144e]|0.1583,0.1583,[72144e]|0.1969,0.1969,[72144e]|0.2364,0.2364,[72144e]|0.2292,0.2292,[72144e]|0.3321,0.3321,[72144e]|0.3667,0.3667,[72144e]|0.3774,0.3774,[72144e]|0.4441,0.4441,[72144e]|0.3872,0.3872,[72144e]|0.384,0.384,[72144e]|0.5577,0.5577,[72144e]|0.5176,0.5176,[72144e]|0.6043,0.6043,[72144e]|0.5854,0.5854,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8311,0.8311,[329440]|0.7912,0.7912,[329440]|0.7501,0.7501,[329440]|0.6255,0.6255,[329440]|0.5008,0.5008,[329440]|0.4825,0.4825,[329440]|0.4513,0.4513,[329440]|0.4078,0.4078,[329440]|0.3885,0.3885,[329440]|0.2786,0.2786,[329440]|0.1732,0.1732,[329440]|0.1921,0.1921,[329440]|0.2292,0.2292,[329440]|0.1635,0.1635,[329440]|0.2385,0.2385,[329440]|0.2041,0.2041,[329440]|0.138,0.138,[329440]|0.138,0.138,[329440]|0.1566,0.1566,[329440]|0.1698,0.1698,[329440]|0.1698,0.1698,[329440]|0.1698,0.1698,[329440]|0.138,0.138,[329440]|0.1566,0.1566,[329440]|0.1456,0.1456,[329440]|0.1266,0.1266,[329440]|0.0744,0.0744,[329440]|0.0744,0.0744,[329440]|0.0621,0.0621,[329440]|0.0965,0.0965,[329440]|0.1416,0.1416,[329440]|0.138,0.138,[329440]|0.1349,0.1349,[329440]|0.2041,0.2041,[329440]|0.138,0.138,[329440]|0.1667,0.1667,[329440]|0.1635,0.1635,[329440]|0.138,0.138,[329440]|0.1117,0.1117,[329440]|0.1635,0.1635,[329440]|0.1088,0.1088,[329440]|0.1041,0.1041,[329440]|0.0884,0.0884,[329440]|0.1266,0.1266,[329440]|0.1416,0.1416,[329440]|0.1018,0.1018,[329440]|0.1495,0.1495,[329440]|0.1732,0.1732,[329440]|0.1805,0.1805,[329440]|0.1805,0.1805,[329440]|0.2041,0.2041,[329440]|0.1566,0.1566,[329440]|0.1732,0.1732,[329440]|0.1117,0.1117,[329440]|0.1766,0.1766,[329440]|0.0991,0.0991,[329440]|0.1805,0.1805,[329440]|0.2292,0.2292,[329440]|0.2865,0.2865,[329440]|0.2292,0.2292,[329440]|0.2432,0.2432,[329440]|0.2041,0.2041,[329440]|0.2122,0.2122,[329440]|0.2432,0.2432,[329440]|0.3184,0.3184,[329440]|0.3535,0.3535,[329440]|0.3762,0.3762,[329440]|0.363,0.363,[329440]|0.3762,0.3762,[329440]|0.3717,0.3717,[329440]|0.3225,0.3225,[329440]|0.4078,0.4078,[329440]|0.3359,0.3359,[329440]|0.4458,0.4458,[329440]|0.3668,0.3668,[329440]|0.4879,0.4879,[329440]|0.3096,0.3096,[329440]|0.2865,0.2865,[329440]|0.2385,0.2385,[329440]|0.2865,0.2865,[329440]|0.3578,0.3578,[329440]|0.2865,0.2865,[329440]|0.3491,0.3491,[329440]|0.3359,0.3359,[329440]|0.208,0.208,[329440]|0.2167,0.2167,[329440]|0.1958,0.1958,[329440]|0.1635,0.1635,[329440]|0.1117,0.1117,[329440]|0.1088,0.1088,[329440]|0.1041,0.1041,[329440]|0.0858,0.0858,[329440]|0.1117,0.1117,[329440]|0.0643,0.0643,[329440]|0.1041,0.1041,[329440]|0.1041,0.1041,[329440]|0.2122,0.2122,[329440]|0.2292,0.2292,[329440]|0.2483,0.2483,[329440]|0.2333,0.2333,[329440]|0.1602,0.1602,[329440]|0.208,0.208,[329440]|0.2167,0.2167,[329440]|0.2209,0.2209,[329440]|0.3491,0.3491,[329440]|0.3717,0.3717,[329440]|0.3885,0.3885,[329440]|0.3806,0.3806,[329440]|0.3992,0.3992,[329440]|0.4116,0.4116,[329440]|0.3668,0.3668,[329440]|0.3263,0.3263,[329440]|0.2748,0.2748,[329440]|0.3225,0.3225,[329440]|0.2122,0.2122,[329440]|0.1635,0.1635,[329440]|0.1495,0.1495,[329440]|0.0991,0.0991,[329440]|0.1322,0.1322,[329440]|0.1292,0.1292,[329440]|0.1117,0.1117,[329440]|0.1667,0.1667,[329440]|0.1117,0.1117,[329440]|0.1018,0.1018,[329440]|0.0607,0.0607,[329440]|0.0723,0.0723,[329440]|0.0587,0.0587,[329440]|0.0643,0.0643,[329440]|0.0643,0.0643,[329440]|0.0771,0.0771,[329440]|0.1292,0.1292,[329440]|0.1766,0.1766,[329440]|0.1667,0.1667,[329440]|0.1667,0.1667,[329440]|0.2255,0.2255,[329440]|0.3225,0.3225,[329440]|0.3885,0.3885,[329440]|0.5008,0.5008,[329440]|0.5008,0.5008,[329440]|0.5667,0.5667,[329440]|0.7079,0.7079,[329440]|0.7342,0.7342,[329440]|0.835,0.835,[329440]|0.8746,0.8746,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +SEQUENCE_REF FER1_SOLLC +LINE_GRAPH IUPredWS (Long) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.3286,0.3286,[72144e]|0.2094,0.2094,[72144e]|0.1528,0.1528,[72144e]|0.2258,0.2258,[72144e]|0.2609,0.2609,[72144e]|0.2752,0.2752,[72144e]|0.3356,0.3356,[72144e]|0.3249,0.3249,[72144e]|0.2918,0.2918,[72144e]|0.3149,0.3149,[72144e]|0.3321,0.3321,[72144e]|0.2884,0.2884,[72144e]|0.3087,0.3087,[72144e]|0.2849,0.2849,[72144e]|0.2849,0.2849,[72144e]|0.2849,0.2849,[72144e]|0.2951,0.2951,[72144e]|0.2364,0.2364,[72144e]|0.2575,0.2575,[72144e]|0.3426,0.3426,[72144e]|0.3149,0.3149,[72144e]|0.247,0.247,[72144e]|0.1643,0.1643,[72144e]|0.2436,0.2436,[72144e]|0.2399,0.2399,[72144e]|0.2034,0.2034,[72144e]|0.2002,0.2002,[72144e]|0.2064,0.2064,[72144e]|0.1823,0.1823,[72144e]|0.2094,0.2094,[72144e]|0.2609,0.2609,[72144e]|0.2575,0.2575,[72144e]|0.1942,0.1942,[72144e]|0.2645,0.2645,[72144e]|0.1759,0.1759,[72144e]|0.1791,0.1791,[72144e]|0.2193,0.2193,[72144e]|0.2193,0.2193,[72144e]|0.1476,0.1476,[72144e]|0.1852,0.1852,[72144e]|0.1424,0.1424,[72144e]|0.1206,0.1206,[72144e]|0.0985,0.0985,[72144e]|0.0985,0.0985,[72144e]|0.1671,0.1671,[72144e]|0.1942,0.1942,[72144e]|0.2817,0.2817,[72144e]|0.2918,0.2918,[72144e]|0.3215,0.3215,[72144e]|0.2575,0.2575,[72144e]|0.2752,0.2752,[72144e]|0.1823,0.1823,[72144e]|0.2034,0.2034,[72144e]|0.1206,0.1206,[72144e]|0.1969,0.1969,[72144e]|0.2034,0.2034,[72144e]|0.3182,0.3182,[72144e]|0.2951,0.2951,[72144e]|0.2436,0.2436,[72144e]|0.1852,0.1852,[72144e]|0.1969,0.1969,[72144e]|0.2193,0.2193,[72144e]|0.2817,0.2817,[72144e]|0.2645,0.2645,[72144e]|0.3494,0.3494,[72144e]|0.4369,0.4369,[72144e]|0.4541,0.4541,[72144e]|0.422,0.422,[72144e]|0.4017,0.4017,[72144e]|0.4186,0.4186,[72144e]|0.3215,0.3215,[72144e]|0.422,0.422,[72144e]|0.3215,0.3215,[72144e]|0.4119,0.4119,[72144e]|0.2884,0.2884,[72144e]|0.391,0.391,[72144e]|0.3321,0.3321,[72144e]|0.3182,0.3182,[72144e]|0.3053,0.3053,[72144e]|0.2541,0.2541,[72144e]|0.3286,0.3286,[72144e]|0.391,0.391,[72144e]|0.3529,0.3529,[72144e]|0.3117,0.3117,[72144e]|0.3019,0.3019,[72144e]|0.3182,0.3182,[72144e]|0.247,0.247,[72144e]|0.2292,0.2292,[72144e]|0.1852,0.1852,[72144e]|0.1852,0.1852,[72144e]|0.1823,0.1823,[72144e]|0.1298,0.1298,[72144e]|0.1942,0.1942,[72144e]|0.1759,0.1759,[72144e]|0.2436,0.2436,[72144e]|0.2609,0.2609,[72144e]|0.3631,0.3631,[72144e]|0.3667,0.3667,[72144e]|0.3087,0.3087,[72144e]|0.247,0.247,[72144e]|0.2609,0.2609,[72144e]|0.384,0.384,[72144e]|0.3983,0.3983,[72144e]|0.4087,0.4087,[72144e]|0.5419,0.5419,[72144e]|0.5419,0.5419,[72144e]|0.5139,0.5139,[72144e]|0.5211,0.5211,[72144e]|0.4831,0.4831,[72144e]|0.4292,0.4292,[72144e]|0.3948,0.3948,[72144e]|0.3983,0.3983,[72144e]|0.2884,0.2884,[72144e]|0.2884,0.2884,[72144e]|0.2541,0.2541,[72144e]|0.1791,0.1791,[72144e]|0.2094,0.2094,[72144e]|0.1823,0.1823,[72144e]|0.1823,0.1823,[72144e]|0.1881,0.1881,[72144e]|0.2224,0.2224,[72144e]|0.2884,0.2884,[72144e]|0.2164,0.2164,[72144e]|0.2164,0.2164,[72144e]|0.2064,0.2064,[72144e]|0.1942,0.1942,[72144e]|0.1643,0.1643,[72144e]|0.2064,0.2064,[72144e]|0.2541,0.2541,[72144e]|0.2783,0.2783,[72144e]|0.3019,0.3019,[72144e]|0.3494,0.3494,[72144e]|0.391,0.391,[72144e]|0.3807,0.3807,[72144e]|0.4864,0.4864,[72144e]|0.5342,0.5342,[72144e]|0.5533,0.5533,[72144e]|0.6576,0.6576,[72144e]|0.5901,0.5901,[72144e]|0.6043,0.6043,[72144e]|0.5951,0.5951,[72144e]|0.5493,0.5493,[72144e]|0.6427,0.6427,[72144e]|0.6227,0.6227,[72144e]| +GRAPHLINE IUPredWS (Long) 0.5 Above 0.5 indicates disorder ff0000 +LINE_GRAPH IUPredWS (Short) Protein Disorder with IUPredWS - raw scores
Above 0.5 indicates disorder 0.8391,0.8391,[329440]|0.8001,0.8001,[329440]|0.7573,0.7573,[329440]|0.6334,0.6334,[329440]|0.5173,0.5173,[329440]|0.5008,0.5008,[329440]|0.4703,0.4703,[329440]|0.4245,0.4245,[329440]|0.4116,0.4116,[329440]|0.3263,0.3263,[329440]|0.2167,0.2167,[329440]|0.2385,0.2385,[329440]|0.2786,0.2786,[329440]|0.2041,0.2041,[329440]|0.2865,0.2865,[329440]|0.2531,0.2531,[329440]|0.1805,0.1805,[329440]|0.1766,0.1766,[329440]|0.1958,0.1958,[329440]|0.2122,0.2122,[329440]|0.208,0.208,[329440]|0.2122,0.2122,[329440]|0.1766,0.1766,[329440]|0.1921,0.1921,[329440]|0.1844,0.1844,[329440]|0.1602,0.1602,[329440]|0.0991,0.0991,[329440]|0.1018,0.1018,[329440]|0.0858,0.0858,[329440]|0.1041,0.1041,[329440]|0.1566,0.1566,[329440]|0.1495,0.1495,[329440]|0.1495,0.1495,[329440]|0.2167,0.2167,[329440]|0.1495,0.1495,[329440]|0.1766,0.1766,[329440]|0.1732,0.1732,[329440]|0.1456,0.1456,[329440]|0.1205,0.1205,[329440]|0.1732,0.1732,[329440]|0.115,0.115,[329440]|0.1088,0.1088,[329440]|0.0935,0.0935,[329440]|0.1292,0.1292,[329440]|0.1456,0.1456,[329440]|0.1018,0.1018,[329440]|0.1532,0.1532,[329440]|0.1732,0.1732,[329440]|0.1878,0.1878,[329440]|0.1878,0.1878,[329440]|0.2122,0.2122,[329440]|0.1602,0.1602,[329440]|0.1766,0.1766,[329440]|0.1178,0.1178,[329440]|0.1844,0.1844,[329440]|0.1018,0.1018,[329440]|0.1844,0.1844,[329440]|0.2333,0.2333,[329440]|0.2913,0.2913,[329440]|0.2333,0.2333,[329440]|0.2483,0.2483,[329440]|0.208,0.208,[329440]|0.2167,0.2167,[329440]|0.2531,0.2531,[329440]|0.3263,0.3263,[329440]|0.3578,0.3578,[329440]|0.3806,0.3806,[329440]|0.3668,0.3668,[329440]|0.3762,0.3762,[329440]|0.3717,0.3717,[329440]|0.3225,0.3225,[329440]|0.4116,0.4116,[329440]|0.3399,0.3399,[329440]|0.4513,0.4513,[329440]|0.3717,0.3717,[329440]|0.4879,0.4879,[329440]|0.3146,0.3146,[329440]|0.2865,0.2865,[329440]|0.2385,0.2385,[329440]|0.2865,0.2865,[329440]|0.363,0.363,[329440]|0.2913,0.2913,[329440]|0.3535,0.3535,[329440]|0.3359,0.3359,[329440]|0.2122,0.2122,[329440]|0.2209,0.2209,[329440]|0.1998,0.1998,[329440]|0.1667,0.1667,[329440]|0.115,0.115,[329440]|0.115,0.115,[329440]|0.106,0.106,[329440]|0.0884,0.0884,[329440]|0.1205,0.1205,[329440]|0.0723,0.0723,[329440]|0.115,0.115,[329440]|0.115,0.115,[329440]|0.2292,0.2292,[329440]|0.2558,0.2558,[329440]|0.2786,0.2786,[329440]|0.2786,0.2786,[329440]|0.1958,0.1958,[329440]|0.2558,0.2558,[329440]|0.27,0.27,[329440]|0.2865,0.2865,[329440]|0.4149,0.4149,[329440]|0.442,0.442,[329440]|0.4651,0.4651,[329440]|0.46,0.46,[329440]|0.4781,0.4781,[329440]|0.4879,0.4879,[329440]|0.4513,0.4513,[329440]|0.4078,0.4078,[329440]|0.3491,0.3491,[329440]|0.3992,0.3992,[329440]|0.3146,0.3146,[329440]|0.2602,0.2602,[329440]|0.2385,0.2385,[329440]|0.1698,0.1698,[329440]|0.2167,0.2167,[329440]|0.1921,0.1921,[329440]|0.2748,0.2748,[329440]|0.3456,0.3456,[329440]|0.27,0.27,[329440]|0.2432,0.2432,[329440]|0.1667,0.1667,[329440]|0.1844,0.1844,[329440]|0.1635,0.1635,[329440]|0.1805,0.1805,[329440]|0.1844,0.1844,[329440]|0.2041,0.2041,[329440]|0.2913,0.2913,[329440]|0.3535,0.3535,[329440]|0.3399,0.3399,[329440]|0.3399,0.3399,[329440]|0.3806,0.3806,[329440]|0.4781,0.4781,[329440]|0.5374,0.5374,[329440]|0.6442,0.6442,[329440]|0.6442,0.6442,[329440]|0.7111,0.7111,[329440]|0.7458,0.7458,[329440]|0.7724,0.7724,[329440]|0.865,0.865,[329440]|0.9009,0.9009,[329440]| +GRAPHLINE IUPredWS (Short) 0.5 Above 0.5 indicates disorder ff0000 + +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COLOUR IUPredWS (Long) 72144e +COLOUR IUPredWS (Short) 329440 +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF Q93XJ9_SOLTU +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER_CAPAA +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER_CAPAN +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_MESCR +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_SPIOL +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_PEA +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF Q7XA98_TRIPR +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF O80429_MAIZE +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_MAIZE +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER3_RAPSA +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER_BRANA +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_ARATH +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF Q93Z60_ARATH +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER2_ARATH +COMBINE IUPredWS (Long) IUPredWS (Short) + +SEQUENCE_REF FER1_SOLLC +# takes the current reference sequence and makes it the reference for the view +VIEW_SETREF +# nominal name for new hide columns command +HIDE_INSERTIONS diff --git a/help/help.jhm b/help/help.jhm index af010a4..eafcc68 100755 --- a/help/help.jhm +++ b/help/help.jhm @@ -105,7 +105,8 @@ - + + diff --git a/help/helpTOC.xml b/help/helpTOC.xml index b67eb6f..9cfd17e 100755 --- a/help/helpTOC.xml +++ b/help/helpTOC.xml @@ -90,6 +90,7 @@ + diff --git a/help/html/calculations/AnnotationColumnSelectionWithSM.gif b/help/html/calculations/AnnotationColumnSelectionWithSM.gif new file mode 100644 index 0000000..4373493 Binary files /dev/null and b/help/html/calculations/AnnotationColumnSelectionWithSM.gif differ diff --git a/help/html/calculations/AnnotationColumnSelectionWithoutSM.gif b/help/html/calculations/AnnotationColumnSelectionWithoutSM.gif new file mode 100644 index 0000000..921f028 Binary files /dev/null and b/help/html/calculations/AnnotationColumnSelectionWithoutSM.gif differ diff --git a/help/html/calculations/columnFilterByAnnotation.html b/help/html/calculations/columnFilterByAnnotation.html new file mode 100644 index 0000000..62bfcf1 --- /dev/null +++ b/help/html/calculations/columnFilterByAnnotation.html @@ -0,0 +1,95 @@ + + + +Filter Columns by Annotation + + + +

+ Filter Columns by Annotation +

+

Jalview allows the columns of an alignment to be filtered using + any annotation rows added to that alignment.

+ From "Select" menu + "Select by Annotation..." to bring + up the Select by Annotation window. The filter options vary depending + on the type of annotation selected. If an annotation that has a numeric + values is selected, the threshold filter option is activated as seen in the + figure on the right below. +
+
+ +
+ +
+
+ +
+
 
+ +
    +
  • Select which annotation to base the filtering on using the + top-most selection box.
  • + +
  • Search Filter +
      +
    • When a text is entered in the textfield on the search + filter section, the "Display Label" and "Description" + checkboxes becomes selectable.
    • +
    • On selecting any of the checkboxes, a regular expresion + search (RegEx) is executed on the specified field of the current + annotation row selected, and the matching columns will be highlighted + in the alignment.
    • +
    +
  • Structure Filter +
      +
    • Alignment columns can also be filtered by the type of + secondary structure present in a choosen annotation row.
    • +
    • This can be achieved by ticking the type of structure you + wish to filter by under the structures filter section.
    • +
    +
  • Threshold Filter +
      +
    • This filter is only activated for annotation which contain + numeric values
    • +
    • Select whether to Filter the alignment above or below an + adjustable threshold with the selection box within the threshold + filter section.
    • +
    • Change the threshold value with the slider, or enter the + exact value in the text box.
    • +
    +
  • Actions +
      +
    • The "Select" and "Hide" radio buttons + determines the action that will be carried out on the matching + columns in the alignment during the filtering process.
    • +
    • The default option is "Select" and this simply + enables column selection on the matching alignment column.
    • +
    • While the "Hide" option enables the matching columns to + be hidden automatically during the filtering process.
    • +
    • The "Ok" button applies the filter when clicked.
    • +
    • And finally, The "Cancel" button restores the alignment to its previous state before the filtering when clicked. +
  • +
+ + + diff --git a/help/html/features/annotationsFormat.html b/help/html/features/annotationsFormat.html index 141379f..72691ce 100755 --- a/help/html/features/annotationsFormat.html +++ b/help/html/features/annotationsFormat.html @@ -30,8 +30,10 @@ version 2.08 of Jalview, via an annotations file. It is a simple ASCII text file consisting of tab delimited records similar to the Sequence Features File, and introduced primarily for use with the Jalview applet.

-

Alignment annotations files are imported into Jalview in the -following ways:
+ +

Importing annotation files
+Alignment annotations files are imported into Jalview in the +following ways:

  • from the command line
      -annotations <Annotations filename>
  • @@ -40,53 +42,142 @@ following ways:
    menu of an alignment window.

-

Format of an Annotations File

-

The file consists of lines containing an instruction followed by -tab delimited fields, and any lines starting with "#" are -ignored. The first non-commented out line of a valid Annotations file +

+ Exporting annotation files
An annotation file + can be created for any alignment view from the "Export + Annotations ..." entry in the File menu of an + alignment window. +

+

THE ANNOTATION FILE FORMAT +
An annotation file consists of lines containing an instruction followed by +tab delimited fields. Any lines starting with "#" are considered comments, and +ignored. The sections below describe the structure of an annotation file. +

+

+ At the end of this document, you can also find notes on compatibility of annotation files across + different versions of Jalview. An example + annotation file is also provided along with instructions on how to + import it to Jalview. +

+
+

Header line
The first non-commented out line of a valid Annotations file must begin with :

JALVIEW_ANNOTATION

-

A row of annotation is added with a line like

GRAPH_TYPE	Label	Description (optional)	Values

+
+

LINE_GRAPH, BAR_GRAPH and NO_GRAPH
+Labels, secondary structure, histograms and line graphs are added with a line like

GRAPH_TYPE	Label	Description (optional)	Values

- The GRAPH_TYPE field, which appears first, defines the + Here, the GRAPH_TYPE field in the first column defines the appearance of the annotation row when rendered by Jalview. The next field is the row label for the annotation. This may be followed by a description for the row, which is shown in a tooltip when the user mouses over the annotation row's label. Since - Jalview 2.7, the description field may also contain html in the same - way as a sequence feature's label, - providing the html is enclosed in an <html/> tag. + Jalview 2.7, the description field may also contain HTML tags (in the same + way as a sequence feature's label), + providing the text is enclosed in an <html/> tag. -

    Please note: URL links embedded in HTML descriptions will - be supported in a future release of Jalview +
      Please note: URL links embedded in HTML descriptions are not yet supported.

    The final Values field contains a series of "|" separated value fields. Each value field is itself a comma separated list of fields of a particular - type defined by the annotation row's GRAPH_TYPE. The allowed values of - GRAPH_TYPE and the format of their respective value fields (with the - trailing "|" symbol) are shown below: + type defined by the annotation row's GRAPH_TYPE. The allowed values of + GRAPH_TYPE and corresponding interpretation of each Value are shown below:

      -
    • BAR_GRAPH
      Plots a histogram with labels below each +
    • BAR_GRAPH
      Plots a histogram with labels below each bar.
      number,text character,Tooltip text
    • -
    • LINE_GRAPH
      Draws a line between values on the +
    • LINE_GRAPH
      Draws a line between values on the annotation row.
      number
    • -
    • NO_GRAPH
      For a row consisting of text labels and/or - secondary structure symbols.
      {Secondary Structure - Symbol},text label,Tooltip text
      Currently - supported secondary structure structure symbols are H (for - helix) and E (for strand)
    • +
    • NO_GRAPH
      For a row consisting of text labels and/or + secondary structure symbols.
      {Secondary Structure + Symbol},text label,Tooltip text

      The type of secondary structure symbol depends on the alignment being annotated being either Protein or RNA.
      For proteins, structure symbols are H (for + helix) and E (for strand)

      For RNA, VIENNA, WUSS or extended notation can be used to specify positions that are paired (e.g. "(|(||)|)" or "|A|A|A|(|a|a|a|)")
    Any or all value fields may be left empty, as well as the BAR_GRAPH's text character field, and either or both of the text-label and secondary structure symbol fields of the NO_GRAPH type annotation rows.

    Color strings can be embedded in a value field by enclosing an RGB triplet in square brackets to colour that position in an annotation row.

    -

    SEQUENCE_REF and GROUP_REF

    +
    +

    COMBINE, COLOUR and GRAPHLINE for line graphs
    +LINE_GRAPH type annotations can be given a colour +(specified as 24 bit RGB triplet in hexadecimal or comma separated +values), combined onto the same vertical axis, and have ordinate lines +(horizontal lines at a particular vertical axis value) using the +following commands (respectively): +

    COLOUR	graph_name	colour
    +COMBINE	graph_1_name	graph_2_name
    +GRAPHLINE	graph_name	value	label	colour
    +
    +

    +
    +

    ROWPROPERTIES
    +The visual display properties for a set of annotation rows can be modified using the following tab-delimited line:

    +
    ROWPROPERTIES	Row label	centrelabs=true( or false)	showalllabs=true(default is false)	scaletofit=true (default is false)
    +

    This sets the visual display properties according to the given values for all the annotation rows with labels matching Row label. The properties mostly affect the display of multi-character column labels, and are as follows: +

    • centrelabs Centre each label on its column.
    • +
    • showalllabs Show every column label rather than only the first of a run of identical labels (setting this to true can have a drastic effect on secondary structure rows).
    • +
    • scaletofit Shrink each label's font size so that the label fits within the column. Useful when annotating an alignment with a specific column numbering system. (Not available in Jalview applet due to AWT 1.1 limitations)
    • +

    +

    SEQUENCE_GROUP
    +Groups of sequences and column ranges can be defined using a tab delimited statement like:

    +
    SEQUENCE_GROUP	Group_Name	Group_Start	Group_End	Sequences
    +

    The sequences can be defined by alignment index and a range of sequences can + be defined in a comma delimited field such as

    +

    2-5,8-15,20,22

    +

    Enter * to select all groups.

    +

    Note: If the alignment indices are not known, enter -1, followed by a tab and then a tab delimited list +of sequence IDs.

    +

    If a SEQUENCE_REF has been defined, then group_start and group_end will be + relative to the sequence residue numbering, otherwise the group_start and group_end + will be alignment column indices.

    +
    +

    PROPERTIES
    This statement allows various visualisation properties to be assigned to a named group. This takes a series of tab-delimited key=value pairs:

    +
    PROPERTIES	Group_name	tab_delimited_key_value_pairs
    +
    +

    The currently supported set of sequence group key-value pairs that can be provided here are :

    + + + + + + + + + + + + + + + + + +
    KeyValue
    descriptionText - may include simple HTML tags
    colourA string resolving to a valid Jalview colourscheme (e.g. Helix Propensity)
    pidThresholdA number from 0-100 specifying the Percent Identity Threshold for colouring columns in the group or alignment
    consThresholdA number from 0-100 specifying the degree of bleaching applied for conservation colouring
    outlineColourLine colour used for outlining the group (default is red)
    displayBoxesBoolean (default true) controlling display of shaded box for each alignment position
    displayTextBoolean (default true) controlling display of text for each alignment position
    colourTextBoolean (default false) specifying whether text should be shaded by applied colourscheme
    textCol1Colour for text when shown on a light background
    textCol2Colour for text when shown on a dark background
    textColThresholdNumber from 0-100 specifying switching threshold between light and dark background
    idColourColour for highlighting the Sequence ID labels for this group
    If idColour is given but colour is not, then idColor will also be used for the group background colour.
    showunconservedBoolean (default false) indicating whether residues should only be shown that are different from current reference or consensus sequence
    hideBoolean (default false) indicating whether the rows in this group should be marked as hidden.
    Note: if the group is sequence associated (specified by SEQUENCE_REF), then all members will be hidden and marked as represented by the reference sequence.
    + +

    Specifying colours in PROPERTIES key-value pairs
    +The colour property can take either a colour scheme name, + or a single colour specification (either a colour name like 'red' or an RGB + triplet like 'ff0066'). If a single colour is specified, then the group + will be coloured with that colour.

    +
    +

    SEQUENCE_REF and GROUP_REF
    By default, annotation is associated with the alignment as a whole. However, it is also possible to have an annotation row associated with @@ -114,79 +205,42 @@ definitions by: Group association is turned off for subsequent annotation rows by:

    GROUP_REF	ALIGNMENT

    -

    LINE_GRAPH Grouping

    -

    LINE_GRAPH type annotations can be given a colour -(specified as 24 bit RGB triplet in hexadecimal or comma separated -values), combined onto the same vertical axis, and have ordinate lines -(horizontal lines at a particular vertical axis value) using the -following commands (respectively): -

    COLOUR	graph_name	colour
    -COMBINE	graph_1_name	graph_2_name
    -GRAPHLINE	graph_name	value	label	colour
    -
    -

    -

    (Since Jalview 2.5) ROWPROPERTIES

    -

    The visual display properties for a set of annotation rows can be modified using the following tab-delimited line:

    -
    ROWPROPERTIES	Row label	centrelabs=true( or false)	showalllabs=true(default is false)	scaletofit=true (default is false)
    -

    This sets the visual display properties according to the given values for all the annotation rows with labels matching Row label. The properties mostly affect the display of multi-character column labels, and are as follows: -

    • centrelabs Centre each label on its column.
    • -
    • showalllabs Show every column label rather than only the first of a run of identical labels (setting this to true can have a drastic effect on secondary structure rows).
    • -
    • scaletofit Shrink each label's font size so that the label fits within the column. Useful when annotating an alignment with a specific column numbering system. (Not available in Jalview applet due to AWT 1.1 limitations)
    • -

    -

    (Since Jalview 2.2.1) SEQUENCE_GROUP

    -

    Groups of sequences can be defined using the tab delimited line

    -
    SEQUENCE_GROUP	Group_Name	Group_Start	Group_End	Sequences
    -

    The sequences can be defined by alignment index and a range of sequences can - be defined in a comma delimited field such as

    -

    2-5,8-15,20,22

    -

    Enter * to select all groups.

    -

    Note: If the alignment indices are not known, enter -1, followed by a tab and then a tab delimited list -specifying the sequence ids.

    -

    If the SEQUENCE_REF has been defined, the group_start and group_end will be - relative to the sequence residue numbering, otherwise the group_start and group_end - will be the alignment column indices.

    -

    The group can (optionally) be assigned various visualisation properties via - another tab delimited line thus:

    -
    PROPERTIES	Group_name	tab_delimited_key_value_pairs
    -
    -

    The key_value_pairs allow you to define a description and to colour the group - in various ways. All, none or some of the following values could be used for - a group:

    -

    description=Text
    - colour=Helix Propensity
    - pidThreshold=0
    - consThreshold=0
    - outlineColour=red
    - displayBoxes=true
    - displayText=false
    - colourText=false
    - textCol1=black
    - textCol2=black
    - textColThreshold=0
    - idColour=ff3322
    - - showunconserved=false

    -
    • New Features in 2.4:
      if the idColour property -is given without specifying a colour scheme with the colour -property, then the idColour will also be used to colour the sequence.
    • -
    • the colour property can take either a colour scheme name, - or a single colour specification (either a colour name like 'red' or an RGB - triplet like 'ff0066'). If a single colour is specified, then the group - will be coloured with that colour.
    • - -
    • Sequence associated Groups
      If a group is defined after a valid - SEQUENCE_REF sequence reference statement, the sequence representative - for the group will be set to the referenced sequence.
    • -
    • The interpretation of the COMBINE statement in Version 2.8.1 was refined +
      +

      VIEW_SETREF, VIEW_HIDECOL and HIDE_INSERTIONS
      +Since Jalview 2.9, the Annotations file has also supported the definition of views on the alignment, and definition of hidden regions.

      + +

      + VIEW_SETREF takes either a single sequence ID string, or a + numeric index (second argument), and attempts to assign a + corresponding sequence as the reference + sequence for the alignment. +

      + VIEW_HIDECOLS takes either a single argument consisting of a + comma separated series of integer pairs like + 3-4. These integer pairs define columns (starting from the + left-hand column 0) that should be marked as hidden in the alignment + view. +

      +

      + HIDE_INSERTIONS takes a either a single sequence ID or a + numeric index, or no arguments. This command marks all gapped + positions in a specified sequence (either the one located by the + arguments, the current SEQUENCE_REF, or the reference sequence for the + view). +


      +

      COMPATIBILITY NOTES
      + The interpretation of the COMBINE statement in Version 2.8.1 was refined so that only annotation line graphs with the given names ands the same - SEQUENCE_REF and GROUP_REF scope are grouped.

    • -
    -

    -

    An example Annotation file is given below: + SEQUENCE_REF and GROUP_REF scope are grouped.

    +
    + +

    EXAMPLES
    +An example Annotation file is given below. Copy and paste the contents into a text file and load it onto the Jalview example protein alignment.

    #Comment lines follow the hash symbol
     JALVIEW_ANNOTATION
     SEQUENCE_REF	FER1_MESCR	5
    @@ -211,6 +265,5 @@ PROPERTIES	Group_B	outlineColour=red
     PROPERTIES	Group_C	colour=Clustal
     

    -

    Last updated for version 2.8.1

    diff --git a/lib/jsoup-1.8.1.jar b/lib/jsoup-1.8.1.jar new file mode 100644 index 0000000..ae717d4 Binary files /dev/null and b/lib/jsoup-1.8.1.jar differ diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 12de0df..2e37e06 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -57,8 +57,10 @@ action.by_pairwise_id = by Pairwise Identity action.by_id = by Id action.by_length = by Length action.by_group = by Group +action.unmark_as_reference = Unmark as Reference +action.set_as_reference = Set as Reference action.remove = Remove -action.remove_redundancy = Remove Redundancy +action.remove_redundancy = Remove Redundancy... action.pairwise_alignment = Pairwise Alignments... action.by_rna_helixes = by RNA Helices action.user_defined = User Defined... @@ -476,8 +478,8 @@ label.settings_for_type = Settings for {0} label.view_full_application = View in Full Application label.load_associated_tree = Load Associated Tree ... label.load_features_annotations = Load Features/Annotations ... -label.export_features = Export Features -label.export_annotations = Export Annotations +label.export_features = Export Features ... +label.export_annotations = Export Annotations ... label.jalview_copy = Copy (Jalview Only) label.jalview_cut = Cut (Jalview Only) label.to_upper_case = To Upper Case @@ -595,7 +597,7 @@ label.figure_id_column_width = Figure ID column width label.use_modeller_output = Use Modeller Output label.wrap_alignment = Wrap Alignment label.right_align_ids = Right Align Ids -label.sequence_name_italics = Seq Name Italics +label.sequence_name_italics = Sequence Name Italics label.open_overview = Open Overview label.default_colour_scheme_for_alignment = Default Colour Scheme for alignment label.annotation_shading_default = Annotation Shading Default @@ -1176,4 +1178,17 @@ label.show_logo = Show Logo label.normalise_logo = Normalise Logo label.no_colour_selection_in_scheme = Please, make a colour selection before to apply colour scheme label.no_colour_selection_warn = Error saving colour scheme +label.select_by_annotation = Select By Annotation +action.select_by_annotation = Select by Annotation... +label.threshold_filter = Threshold Filter +action.hide = Hide +action.select = Select +label.alpha_helix = Alpha Helix +label.beta_strand = Beta Strand +label.turn = Turn +label.select_all = Select All +label.structures_filter = Structures Filter +label.search_filter = Search Filter +label.display_name = Display Label +label.description = Description label.include_description= Include Description diff --git a/resources/templates/BioJSTemplate.txt b/resources/templates/BioJSTemplate.txt new file mode 100644 index 0000000..bf780bb --- /dev/null +++ b/resources/templates/BioJSTemplate.txt @@ -0,0 +1,9032 @@ + +
    BioJS viewer
    + + + + + + + + Jalview Logo + +
    +
    + + + + +
    +
    + +
    press "Run with JS"
    + + + + + + + + \ No newline at end of file diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index a1bb272..9b0412a 100644 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -550,7 +550,7 @@ public class AppletPDBCanvas extends Panel implements MouseListener, StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile()); boolean showFeatures = false; - if (ap.av.getShowSequenceFeatures()) + if (ap.av.isShowSequenceFeatures()) { if (fr == null) { diff --git a/src/MCview/PDBCanvas.java b/src/MCview/PDBCanvas.java index dc0f718..4fd7a35 100644 --- a/src/MCview/PDBCanvas.java +++ b/src/MCview/PDBCanvas.java @@ -110,7 +110,7 @@ public class PDBCanvas extends JPanel implements MouseListener, boolean seqColoursReady = false; - jalview.gui.FeatureRenderer fr; + jalview.renderer.seqfeatures.FeatureRenderer fr; Color backgroundColour = Color.black; @@ -520,7 +520,7 @@ public class PDBCanvas extends JPanel implements MouseListener, StructureMapping[] mapping = ssm.getMapping(pdbentry.getFile()); boolean showFeatures = false; - if (ap.av.getShowSequenceFeatures()) + if (ap.av.isShowSequenceFeatures()) { if (fr == null) { diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java index a7440e7..2c40e1c 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/ChimeraManager.java @@ -1,14 +1,21 @@ package ext.edu.ucsf.rbvi.strucviz2; +import jalview.ws.HttpClientUtils; + import java.awt.Color; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.http.NameValuePair; +import org.apache.http.message.BasicNameValuePair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,10 +27,13 @@ import ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads; */ public class ChimeraManager { + private static final boolean debug = false; + + private int chimeraRestPort; private Process chimera; - private ListenerThreads chimeraListenerThreads; + private ListenerThreads chimeraListenerThread; private Map currentModelsMap; @@ -36,7 +46,7 @@ public class ChimeraManager { this.structureManager = structureManager; chimera = null; - chimeraListenerThreads = null; + chimeraListenerThread = null; currentModelsMap = new HashMap(); } @@ -208,10 +218,14 @@ public class ChimeraManager modelNumbers[0], modelNumbers[1]); currentModelsMap.put(modelNumber, newModel); models.add(newModel); + + // // patch for Jalview - set model name in Chimera + // sendChimeraCommand("setattr M name " + modelName + " #" + modelNumbers[0], false); // end patch for Jalview + modelNumbers = null; } } @@ -354,7 +368,7 @@ public class ChimeraManager { chimera = null; currentModelsMap.clear(); - chimeraListenerThreads = null; + this.chimeraRestPort = 0; structureManager.clearOnChimeraExit(); } @@ -525,12 +539,11 @@ public class ChimeraManager List args = new ArrayList(); args.add(chimeraPath); args.add("--start"); - args.add("ReadStdin"); + args.add("RESTServer"); ProcessBuilder pb = new ProcessBuilder(args); chimera = pb.start(); error = ""; workingPath = chimeraPath; - logger.info("Strarting " + chimeraPath); break; } catch (Exception e) { @@ -541,10 +554,9 @@ public class ChimeraManager // If no error, then Chimera was launched successfully if (error.length() == 0) { - // Initialize the listener threads - chimeraListenerThreads = new ListenerThreads(chimera, - structureManager); - chimeraListenerThreads.start(); + this.chimeraRestPort = getPortNumber(); + System.out.println("Chimera REST API started on port " + + chimeraRestPort); // structureManager.initChimTable(); structureManager.setChimeraPathProperty(workingPath); // TODO: [Optional] Check Chimera version and show a warning if below 1.8 @@ -559,6 +571,42 @@ public class ChimeraManager } /** + * Read and return the port number returned in the reply to --start RESTServer + */ + private int getPortNumber() + { + int port = 0; + InputStream readChan = chimera.getInputStream(); + BufferedReader lineReader = new BufferedReader(new InputStreamReader( + readChan)); + String response = null; + try + { + // expect: REST server on host 127.0.0.1 port port_number + response = lineReader.readLine(); + String [] tokens = response.split(" "); + if (tokens.length == 7 && "port".equals(tokens[5])) { + port = Integer.parseInt(tokens[6]); + logger.info("Chimera REST service listening on port " + + chimeraRestPort); + } + } catch (Exception e) + { + logger.error("Failed to get REST port number from " + response + ": " + + e.getMessage()); + } finally + { + try + { + lineReader.close(); + } catch (IOException e2) + { + } + } + return port; + } + + /** * Determine the color that Chimera is using for this model. * * @param model @@ -683,7 +731,8 @@ public class ChimeraManager */ public List sendChimeraCommand(String command, boolean reply) { - if (!isChimeraLaunched()) + if (!isChimeraLaunched() || command == null + || "".equals(command.trim())) { return null; } @@ -696,41 +745,100 @@ public class ChimeraManager } catch (InterruptedException q) { } - ; } busy = true; + long startTime = System.currentTimeMillis(); try { - chimeraListenerThreads.clearResponse(command); - String text = command.concat("\n"); - // System.out.println("send command to chimera: " + text); - try - { - // send the command - chimera.getOutputStream().write(text.getBytes()); - chimera.getOutputStream().flush(); - } catch (IOException e) + return sendRestCommand(command); + } finally + { + /* + * Make sure busy flag is reset come what may! + */ + busy = false; + if (debug) { - // logger.info("Unable to execute command: " + text); - // logger.info("Exiting..."); - logger.warn("Unable to execute command: " + text); - logger.warn("Exiting..."); - clearOnChimeraExit(); - // busy = false; - return null; + System.out.println("Chimera command took " + + (System.currentTimeMillis() - startTime) + "ms: " + + command); } - if (!reply) - { - // busy = false; - return null; + + } + } + + /** + * Sends the command to Chimera's REST API, and returns any response lines. + * + * @param command + * @return + */ + protected List sendRestCommand(String command) + { + // TODO start a separate thread to do this so we don't block? + String restUrl = "http://127.0.0.1:" + this.chimeraRestPort + "/run"; + List commands = new ArrayList(1); + commands.add(new BasicNameValuePair("command", command)); + + List reply = new ArrayList(); + BufferedReader response = null; + try { + response = HttpClientUtils.doHttpUrlPost(restUrl, + commands); + String line = ""; + while ((line = response.readLine()) != null) { + reply.add(line); } - List rsp = chimeraListenerThreads.getResponse(command); - // busy = false; - return rsp; + } catch (Exception e) + { + logger.error("REST call " + command + " failed: " + e.getMessage()); } finally { - busy = false; + if (response != null) + { + try + { + response.close(); + } catch (IOException e) + { + } + } + } + return reply; + } + + /** + * Send a command to stdin of Chimera process, and optionally read any + * responses. + * + * @param command + * @param readReply + * @return + */ + protected List sendStdinCommand(String command, boolean readReply) + { + chimeraListenerThread.clearResponse(command); + String text = command.concat("\n"); + try + { + // send the command + chimera.getOutputStream().write(text.getBytes()); + chimera.getOutputStream().flush(); + } catch (IOException e) + { + // logger.info("Unable to execute command: " + text); + // logger.info("Exiting..."); + logger.warn("Unable to execute command: " + text); + logger.warn("Exiting..."); + clearOnChimeraExit(); + return null; + } + if (!readReply) + { + return null; } + List rsp = chimeraListenerThread.getResponse(command); + return rsp; } public StructureManager getStructureManager() diff --git a/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java b/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java index 883d536..2b2ce48 100644 --- a/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java +++ b/src/ext/edu/ucsf/rbvi/strucviz2/port/ListenerThreads.java @@ -21,207 +21,282 @@ import ext.edu.ucsf.rbvi.strucviz2.StructureManager; /** * Reply listener thread */ -public class ListenerThreads extends Thread { - private InputStream readChan = null; - private BufferedReader lineReader = null; - private Process chimera = null; - private Map> replyLog = null; - private Logger logger; - private StructureManager structureManager = null; - - /** - * Create a new listener thread to read the responses from Chimera - * - * @param chimera - * a handle to the Chimera Process - * @param log - * a handle to a List to post the responses to - * @param chimeraObject - * a handle to the Chimera Object - */ - public ListenerThreads(Process chimera, StructureManager structureManager) { - this.chimera = chimera; - this.structureManager = structureManager; - replyLog = new HashMap>(); - // Get a line-oriented reader - readChan = chimera.getInputStream(); - lineReader = new BufferedReader(new InputStreamReader(readChan)); - logger = LoggerFactory.getLogger(ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads.class); - } - - /** - * Start the thread running - */ - public void run() { - // System.out.println("ReplyLogListener running"); - while (true) { - try { - chimeraRead(); - } catch (IOException e) { - logger.warn("UCSF Chimera has exited: " + e.getMessage()); - return; - } - } - } - - public List getResponse(String command) { - List reply; - // System.out.println("getResponse: "+command); +public class ListenerThreads extends Thread +{ + private BufferedReader lineReader = null; + + private Process chimera = null; + + private Map> replyLog = null; + + private Logger logger; + + private StructureManager structureManager = null; + + private boolean stopMe = false; + + /** + * Create a new listener thread to read the responses from Chimera + * + * @param chimera + * a handle to the Chimera Process + * @param structureManager + * a handle to the Chimera structure manager + */ + public ListenerThreads(Process chimera, StructureManager structureManager) + { + this.chimera = chimera; + this.structureManager = structureManager; + replyLog = new HashMap>(); + // Get a line-oriented reader + InputStream readChan = chimera.getInputStream(); + lineReader = new BufferedReader(new InputStreamReader(readChan)); + logger = LoggerFactory + .getLogger(ext.edu.ucsf.rbvi.strucviz2.port.ListenerThreads.class); + } + + /** + * Start the thread running + */ + public void run() + { + // System.out.println("ReplyLogListener running"); + while (!stopMe) + { + try + { + chimeraRead(); + } catch (IOException e) + { + logger.warn("UCSF Chimera has exited: " + e.getMessage()); + return; + } finally + { + if (lineReader != null) + { + try + { + lineReader.close(); + } catch (IOException e) + { + } + } + } + } + } + + public List getResponse(String command) + { + List reply; + // System.out.println("getResponse: "+command); // TODO do we need a maximum wait time before aborting? - while (!replyLog.containsKey(command)) { - try { - Thread.currentThread().sleep(100); - } catch (InterruptedException e) { - } - } - - synchronized (replyLog) { - reply = replyLog.get(command); - // System.out.println("getResponse ("+command+") = "+reply); - replyLog.remove(command); - } - return reply; - } - - public void clearResponse(String command) { - try { - Thread.currentThread().sleep(100); - } catch (InterruptedException e) { - } - if (replyLog.containsKey(command)) + while (!replyLog.containsKey(command)) + { + try + { + Thread.currentThread().sleep(100); + } catch (InterruptedException e) + { + } + } + + synchronized (replyLog) { + reply = replyLog.get(command); + // System.out.println("getResponse ("+command+") = "+reply); replyLog.remove(command); } - return; - } + return reply; + } - /** - * Read input from Chimera - * - * @return a List containing the replies from Chimera - */ - private void chimeraRead() throws IOException { - if (chimera == null) + public void clearResponse(String command) + { + try + { + Thread.currentThread().sleep(100); + } catch (InterruptedException e) + { + } + if (replyLog.containsKey(command)) + { + replyLog.remove(command); + } + return; + } + + /** + * Read input from Chimera + * + * @return a List containing the replies from Chimera + */ + private void chimeraRead() throws IOException + { + if (chimera == null) { return; } - String line = null; - while ((line = lineReader.readLine()) != null) { - // System.out.println("From Chimera-->" + line); - if (line.startsWith("CMD")) { - chimeraCommandRead(line.substring(4)); - } else if (line.startsWith("ModelChanged: ")) { - (new ModelUpdater()).start(); - } else if (line.startsWith("SelectionChanged: ")) { - (new SelectionUpdater()).start(); - } else if (line.startsWith("Trajectory residue network info:")) { - (new NetworkUpdater(line)).start(); - } - } - return; - } - - private void chimeraCommandRead(String command) throws IOException { - // Generally -- looking for: - // CMD command - // ........ - // END - // We return the text in between - List reply = new ArrayList(); - boolean updateModels = false; - boolean updateSelection = false; - boolean importNetwork = false; - String line = null; - - synchronized (replyLog) { - while ((line = lineReader.readLine()) != null) { - // System.out.println("From Chimera (" + command + ") -->" + line); - if (line.startsWith("CMD")) { - logger.warn("Got unexpected command from Chimera: " + line); - - } else if (line.startsWith("END")) { - break; - } - if (line.startsWith("ModelChanged: ")) { - updateModels = true; - } else if (line.startsWith("SelectionChanged: ")) { - updateSelection = true; - } else if (line.length() == 0) { - continue; - } else if (!line.startsWith("CMD")) { - reply.add(line); - } else if (line.startsWith("Trajectory residue network info:")) { - importNetwork = true; - } - } - replyLog.put(command, reply); - } - if (updateModels) + String line = null; + while ((line = lineReader.readLine()) != null) + { + // System.out.println("From Chimera-->" + line); + if (line.startsWith("CMD")) + { + chimeraCommandRead(line.substring(4)); + } + else if (line.startsWith("ModelChanged: ")) + { + (new ModelUpdater()).start(); + } + else if (line.startsWith("SelectionChanged: ")) + { + (new SelectionUpdater()).start(); + } + else if (line.startsWith("Trajectory residue network info:")) + { + (new NetworkUpdater(line)).start(); + } + } + return; + } + + private void chimeraCommandRead(String command) throws IOException + { + // Generally -- looking for: + // CMD command + // ........ + // END + // We return the text in between + List reply = new ArrayList(); + boolean updateModels = false; + boolean updateSelection = false; + boolean importNetwork = false; + String line = null; + + synchronized (replyLog) + { + while ((line = lineReader.readLine()) != null) + { + // System.out.println("From Chimera (" + command + ") -->" + line); + if (line.startsWith("CMD")) + { + logger.warn("Got unexpected command from Chimera: " + line); + + } + else if (line.startsWith("END")) + { + break; + } + if (line.startsWith("ModelChanged: ")) + { + updateModels = true; + } + else if (line.startsWith("SelectionChanged: ")) + { + updateSelection = true; + } + else if (line.length() == 0) + { + continue; + } + else if (!line.startsWith("CMD")) + { + reply.add(line); + } + else if (line.startsWith("Trajectory residue network info:")) + { + importNetwork = true; + } + } + replyLog.put(command, reply); + } + if (updateModels) { (new ModelUpdater()).start(); } - if (updateSelection) + if (updateSelection) { (new SelectionUpdater()).start(); } - if (importNetwork) { - (new NetworkUpdater(line)).start(); - } - return; - } - - /** - * Model updater thread - */ - class ModelUpdater extends Thread { - - public ModelUpdater() { - } - - public void run() { - structureManager.updateModels(); - structureManager.modelChanged(); - } - } - - /** - * Selection updater thread - */ - class SelectionUpdater extends Thread { - - public SelectionUpdater() { - } - - public void run() { - try { - logger.info("Responding to chimera selection"); - structureManager.chimeraSelectionChanged(); - } catch (Exception e) { - logger.warn("Could not update selection", e); - } - } - } - - /** - * Selection updater thread - */ - class NetworkUpdater extends Thread { - - private String line; - - public NetworkUpdater(String line) { - this.line = line; - } - - public void run() { - try { -// ((TaskManager) structureManager.getService(TaskManager.class)) -// .execute(new ImportTrajectoryRINTaskFactory(structureManager, line) -// .createTaskIterator()); - } catch (Exception e) { - logger.warn("Could not import trajectory network", e); - } - } - } + if (importNetwork) + { + (new NetworkUpdater(line)).start(); + } + return; + } + + /** + * Model updater thread + */ + class ModelUpdater extends Thread + { + + public ModelUpdater() + { + } + + public void run() + { + structureManager.updateModels(); + structureManager.modelChanged(); + } + } + + /** + * Selection updater thread + */ + class SelectionUpdater extends Thread + { + + public SelectionUpdater() + { + } + + public void run() + { + try + { + logger.info("Responding to chimera selection"); + structureManager.chimeraSelectionChanged(); + } catch (Exception e) + { + logger.warn("Could not update selection", e); + } + } + } + + /** + * Selection updater thread + */ + class NetworkUpdater extends Thread + { + + private String line; + + public NetworkUpdater(String line) + { + this.line = line; + } + + public void run() + { + try + { + // ((TaskManager) structureManager.getService(TaskManager.class)) + // .execute(new ImportTrajectoryRINTaskFactory(structureManager, line) + // .createTaskIterator()); + } catch (Exception e) + { + logger.warn("Could not import trajectory network", e); + } + } + } + + /** + * Set a flag that this thread should clean up and exit. + */ + public void requestStop() + { + this.stopMe = true; + } } diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index ba7e520..2ef1c76 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -1155,7 +1155,8 @@ public class AlignSeq } if (sq.getAnnotation() != null && sq.getAnnotation().length > 0) { - annotations.addAll(inspos, Arrays.asList(sq.getAnnotation())); + annotations.addAll(inspos == -1 ? annotations.size() : inspos, + Arrays.asList(sq.getAnnotation())); } } } diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 4d64685..66a6d78 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -71,6 +71,8 @@ public class Conservation int[][] cons2; + private String[] consSymbs; + /** * Creates a new Conservation object. * @@ -366,17 +368,17 @@ public class Conservation { consString.append('-'); } - + consSymbs = new String[end-start+1]; for (int i = start; i <= end; i++) { gapcons = countConsNGaps(i); totGaps = gapcons[1]; pgaps = ((float) totGaps * 100) / (float) sequences.length; - + consSymbs[i-start]=new String(); + if (percentageGaps > pgaps) { resultHash = total[i - start]; - // Now find the verdict count = 0; enumeration = resultHash.keys(); @@ -385,12 +387,12 @@ public class Conservation { type = (String) enumeration.nextElement(); result = (Integer) resultHash.get(type); - // Do we want to count +ve conservation or +ve and -ve cons.? if (consflag) { if (result.intValue() == 1) { + consSymbs[i-start] = type+" "+consSymbs[i-start]; count++; } } @@ -398,6 +400,14 @@ public class Conservation { if (result.intValue() != -1) { + { + if (result.intValue()==0) { + consSymbs[i-start] = consSymbs[i-start]+ " !"+type; + } else { + consSymbs[i-start] = type+" "+consSymbs[i-start]; + } + } + count++; } } @@ -683,7 +693,7 @@ public class Conservation float vprop = value - min; vprop /= max; conservation.annotations[i] = new Annotation(String.valueOf(c), - String.valueOf(value), ' ', value, new Color(minR + consSymbs[i-start], ' ', value, new Color(minR + (maxR * vprop), minG + (maxG * vprop), minB + (maxB * vprop))); diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 224c60a..fe3abe4 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -205,7 +205,7 @@ public class Finder { continue; } - +// if invalid string used, then regex has no matched to/from int sres = seq .findPosition(resIndex + Integer.parseInt(spaces.elementAt(resIndex) diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index a8ca3f7..099400e 100644 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -20,13 +20,21 @@ */ package jalview.analysis; -import java.util.*; - import jalview.api.analysis.ScoreModelI; -import jalview.datamodel.*; -import jalview.io.*; -import jalview.schemes.*; -import jalview.util.*; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.BinaryNode; +import jalview.datamodel.CigarArray; +import jalview.datamodel.NodeTransformI; +import jalview.datamodel.SeqCigar; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.datamodel.SequenceNode; +import jalview.io.NewickFile; +import jalview.schemes.ResidueProperties; + +import java.util.Enumeration; +import java.util.List; +import java.util.Vector; /** * DOCUMENT ME! @@ -210,7 +218,7 @@ public class NJTree * DOCUMENT ME! */ public NJTree(SequenceI[] sequence, AlignmentView seqData, String type, - String pwtype, int start, int end) + String pwtype, ScoreModelI sm, int start, int end) { this.sequence = sequence; this.node = new Vector(); @@ -237,7 +245,7 @@ public class NJTree type = "AV"; } - if (!(pwtype.equals("PID"))) + if (sm == null && !(pwtype.equals("PID"))) { if (ResidueProperties.getScoreMatrix(pwtype) == null) { @@ -257,7 +265,7 @@ public class NJTree noseqs = i++; - distance = findDistances(); + distance = findDistances(sm); // System.err.println("Made distances");// dbg makeLeaves(); // System.err.println("Made leaves");// dbg @@ -315,7 +323,7 @@ public class NJTree for (int j = 0; j < seqs.length; j++) { - seqs[j] = (SequenceI) list.get(j); + seqs[j] = list.get(j); } seqmatcher = new SequenceIdMatcher(seqs); @@ -722,16 +730,18 @@ public class NJTree * * @return similarity matrix used to compute tree */ - public float[][] findDistances() + public float[][] findDistances(ScoreModelI _pwmatrix) { float[][] distance = new float[noseqs][noseqs]; - - // Pairwise substitution score (with no gap penalties) - ScoreModelI _pwmatrix = ResidueProperties.getScoreModel(pwtype); if (_pwmatrix == null) { - _pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62"); + // Resolve substitution model + _pwmatrix = ResidueProperties.getScoreModel(pwtype); + if (_pwmatrix == null) + { + _pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62"); + } } distance = _pwmatrix.findDistances(seqData); return distance; @@ -857,12 +867,12 @@ public class NJTree { System.out .println("Leaf = " + ((SequenceI) node.element()).getName()); - System.out.println("Dist " + ((SequenceNode) node).dist); + System.out.println("Dist " + node.dist); System.out.println("Boot " + node.getBootstrap()); } else { - System.out.println("Dist " + ((SequenceNode) node).dist); + System.out.println("Dist " + node.dist); printNode((SequenceNode) node.left()); printNode((SequenceNode) node.right()); } @@ -883,11 +893,11 @@ public class NJTree if ((node.left() == null) && (node.right() == null)) { - float dist = ((SequenceNode) node).dist; + float dist = node.dist; if (dist > maxDistValue) { - maxdist = (SequenceNode) node; + maxdist = node; maxDistValue = dist; } } @@ -1089,9 +1099,9 @@ public class NJTree + ((SequenceI) node.element()).getName()); } - System.out.println(" dist = " + ((SequenceNode) node).dist + " " - + ((SequenceNode) node).count + " " - + ((SequenceNode) node).height); + System.out.println(" dist = " + node.dist + " " + + node.count + " " + + node.height); } /** @@ -1137,13 +1147,13 @@ public class NJTree SequenceNode l = (SequenceNode) node.left(); SequenceNode r = (SequenceNode) node.right(); - ((SequenceNode) node).count = l.count + r.count; - ((SequenceNode) node).ycount = (l.ycount + r.ycount) / 2; + node.count = l.count + r.count; + node.ycount = (l.ycount + r.ycount) / 2; } else { - ((SequenceNode) node).count = 1; - ((SequenceNode) node).ycount = ycount++; + node.count = 1; + node.ycount = ycount++; } _lycount--; } @@ -1282,7 +1292,9 @@ public class NJTree { for (Enumeration nodes = node.elements(); nodes.hasMoreElements(); nodeTransformI .transform((BinaryNode) nodes.nextElement())) + { ; + } } } diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index aec7faf..bedce3f 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -42,10 +42,15 @@ public class SequenceIdMatcher // TODO: deal with ID collisions - SequenceI should be appended to list // associated with this key. names.put(new SeqIdName(seqs[i].getDisplayId(true)), seqs[i]); + SequenceI dbseq = seqs[i]; + while (dbseq.getDatasetSequence()!=null) + { + dbseq = dbseq.getDatasetSequence(); + } // add in any interesting identifiers - if (seqs[i].getDBRef() != null) + if (dbseq.getDBRef() != null) { - DBRefEntry dbr[] = seqs[i].getDBRef(); + DBRefEntry dbr[] = dbseq.getDBRef(); SeqIdName sid = null; for (int r = 0; r < dbr.length; r++) { diff --git a/src/jalview/analysis/scoremodels/FeatureScoreModel.java b/src/jalview/analysis/scoremodels/FeatureScoreModel.java new file mode 100644 index 0000000..e2a8b9a --- /dev/null +++ b/src/jalview/analysis/scoremodels/FeatureScoreModel.java @@ -0,0 +1,138 @@ +package jalview.analysis.scoremodels; + +import jalview.api.analysis.ScoreModelI; +import jalview.api.analysis.ViewBasedAnalysisI; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.util.Comparison; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +public class FeatureScoreModel implements ScoreModelI, ViewBasedAnalysisI +{ + jalview.api.FeatureRenderer fr; + + @Override + public boolean configureFromAlignmentView( + jalview.api.AlignmentViewPanel view) + { + fr = view.cloneFeatureRenderer(); + return true; + } + + @Override + public float[][] findDistances(AlignmentView seqData) + { + int nofeats = 0; + List dft = Arrays.asList(fr.getDisplayedFeatureTypes()); + + if (dft != null) + { + nofeats = dft.size(); + } + + SequenceI[] sequenceString = seqData.getVisibleAlignment( + Comparison.GapChars.charAt(0)).getSequencesArray(); + int noseqs = sequenceString.length; + int cpwidth = seqData.getWidth(); + float[][] distance = new float[noseqs][noseqs]; + if (nofeats == 0) + { + for (float[] d : distance) + { + for (int i = 0; i < d.length; d[i++] = 0f) + { + ; + } + } + return distance; + } + float max = 0; + for (int cpos = 0; cpos < cpwidth; cpos++) + { + // get visible features at cpos under view's display settings and compare + // them + List> sfap = new ArrayList>(); + for (int i = 0; i < noseqs; i++) + { + Hashtable types = new Hashtable(); + List sfs = fr.findFeaturesAtRes(sequenceString[i], + sequenceString[i].findPosition(cpos)); + for (SequenceFeature sf : sfs) + { + types.put(sf.getType(), sf); + } + sfap.add(types); + } + for (int i = 0; i < (noseqs - 1); i++) + { + if (cpos == 0) + { + distance[i][i] = 0f; + } + for (int j = i + 1; j < noseqs; j++) + { + int sfcommon = 0; + // compare the two lists of features... + Hashtable fi = sfap.get(i), fk, fj = sfap + .get(j); + if (fi.size() > fj.size()) + { + fk = fj; + } + else + { + fk = fi; + fi = fj; + } + for (String k : fi.keySet()) + { + SequenceFeature sfj = fk.get(k); + if (sfj != null) + { + sfcommon++; + } + } + distance[i][j] += (fi.size() + fk.size() - 2f * sfcommon); + distance[j][i] += distance[i][j]; + } + } + } + for (int i = 0; i < noseqs; i++) + { + for (int j = i + 1; j < noseqs; j++) + { + distance[i][j] /= cpwidth; + distance[j][i] = distance[i][j]; + } + } + return distance; + } + + @Override + public String getName() + { + return "Sequence Feature Similarity"; + } + + @Override + public boolean isDNA() + { + return true; + } + + @Override + public boolean isProtein() + { + return true; + } + + public String toString() + { + return "Score between sequences based on hamming distance between binary vectors marking features displayed at each column"; + } +} diff --git a/src/jalview/api/AlignViewControllerGuiI.java b/src/jalview/api/AlignViewControllerGuiI.java index b9638e5..4010e8b 100644 --- a/src/jalview/api/AlignViewControllerGuiI.java +++ b/src/jalview/api/AlignViewControllerGuiI.java @@ -20,6 +20,8 @@ */ package jalview.api; +import jalview.commands.CommandI; + /** * Interface implemented by gui implementations managing a Jalview Alignment * View @@ -37,4 +39,6 @@ public interface AlignViewControllerGuiI */ void setStatus(String string); + void addHistoryItem(CommandI command); + } diff --git a/src/jalview/api/AlignViewControllerI.java b/src/jalview/api/AlignViewControllerI.java index 35f084f..9bd3f45 100644 --- a/src/jalview/api/AlignViewControllerI.java +++ b/src/jalview/api/AlignViewControllerI.java @@ -64,4 +64,16 @@ public interface AlignViewControllerI boolean markColumnsContainingFeatures(boolean invert, boolean extendCurrent, boolean clearColumns, String featureType); + /** + * sort the alignment or current selection by average score over the given set of features + * @param typ list of feature names or null to use currently displayed features + */ + void sortAlignmentByFeatureScore(String[] typ); + + /** + * sort the alignment or current selection by distribution of the given set of features + * @param typ list of feature names or null to use currently displayed features + */ + void sortAlignmentByFeatureDensity(String[] typ); + } diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index d8ba30d..2dea15e 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -20,11 +20,6 @@ */ package jalview.api; -import java.awt.Color; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; - import jalview.analysis.Conservation; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -36,6 +31,11 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.schemes.ColourSchemeI; +import java.awt.Color; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + /** * @author jimp * @@ -163,6 +163,29 @@ public interface AlignViewportI */ void updateGroupAnnotationSettings(boolean applyGlobalSettings, boolean preserveNewGroupSettings); + + /** + * @return true if a reference sequence is set and should be displayed + */ + public boolean isDisplayReferenceSeq(); + + /** + * @return set the flag for displaying reference sequences when they are + * available + */ + public void setDisplayReferenceSeq(boolean displayReferenceSeq); + + /** + * @return true if colourschemes should render according to reference sequence + * rather than consensus if available + */ + public boolean isColourByReferenceSeq(); + + /** + * @return true set flag for deciding if colourschemes should render according + * to reference sequence rather than consensus if available + */ + public void setColourByReferenceSeq(boolean colourByReferenceSeq); void setSequenceColour(SequenceI seq, Color col); @@ -172,16 +195,58 @@ public interface AlignViewportI SequenceGroup getSelectionGroup(); + /** + * get the currently selected sequence objects or all the sequences in the + * alignment. TODO: change to List<> + * + * @return array of references to sequence objects + */ SequenceI[] getSequenceSelection(); void clearSequenceColours(); + /** + * 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[] + */ CigarArray getViewAsCigars(boolean selectedRegionOnly); + /** + * 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 + */ AlignmentView getAlignmentView(boolean selectedOnly); + /** + * 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 + */ AlignmentView getAlignmentView(boolean selectedOnly, boolean 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[] + */ String[] getViewAsString(boolean selectedRegionOnly); void setSelectionGroup(SequenceGroup sg); @@ -200,4 +265,93 @@ public interface AlignViewportI List getVisibleAlignmentAnnotation( boolean selectedOnly); + FeaturesDisplayedI getFeaturesDisplayed(); + + String getSequenceSetId(); + + boolean isShowSequenceFeatures(); + + void setShowSequenceFeatures(boolean b); + + /** + * + * @param flag + * indicating if annotation panel shown below alignment + * + */ + void setShowAnnotation(boolean b); + + /** + * flag indicating if annotation panel shown below alignment + * + * @return + */ + boolean isShowAnnotation(); + + boolean isRightAlignIds(); + + void setRightAlignIds(boolean rightAlignIds); + + boolean areFeaturesDisplayed(); + + void setShowSequenceFeaturesHeight(boolean selected); + + boolean isShowSequenceFeaturesHeight(); + + void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI); + + void alignmentChanged(AlignmentViewPanel ap); + + /** + * @return the padGaps + */ + boolean isPadGaps(); + + /** + * @param padGaps + * the padGaps to set + */ + void setPadGaps(boolean padGaps); + + /** + * 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 TODO: change to list + * of int ranges + */ + int[][] getVisibleRegionBoundaries(int min, int max); + + /** + * 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 + */ + SequenceI[] getSelectionAsNewSequence(); + + void invertColumnSelection(); + + /** + * broadcast selection to any interested parties + */ + void sendSelection(); + + /** + * calculate the row position for alignmentIndex if all hidden sequences were + * shown + * + * @param alignmentIndex + * @return adjusted row position + */ + int adjustForHiddenSeqs(int alignmentIndex); + + boolean hasHiddenRows(); + } diff --git a/src/jalview/api/AlignmentViewPanel.java b/src/jalview/api/AlignmentViewPanel.java index 0955cb4..a68c1f6 100644 --- a/src/jalview/api/AlignmentViewPanel.java +++ b/src/jalview/api/AlignmentViewPanel.java @@ -51,6 +51,10 @@ public interface AlignmentViewPanel extends OOMHandlerI */ void adjustAnnotationHeight(); + FeatureRenderer getFeatureRenderer(); + + FeatureRenderer cloneFeatureRenderer(); + /** * * @return displayed name for the view diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index 679cded..4fd89c1 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -20,9 +20,13 @@ */ package jalview.api; +import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import java.awt.Color; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; /** * Abstract feature renderer interface @@ -37,4 +41,38 @@ public interface FeatureRenderer void featuresAdded(); + Object getFeatureStyle(String ft); + + void setColour(String ft, Object ggc); + + AlignViewportI getViewport(); + + FeaturesDisplayedI getFeaturesDisplayed(); + + Map getFeatureColours(); + + void findAllFeatures(boolean newMadeVisible); + + Map getDisplayedFeatureCols(); + + List getFeatureGroups(); + + List getGroups(boolean visible); + + void setGroupVisibility(List toset, boolean visible); + + void setGroupVisibility(String group, boolean visible); + + List findFeaturesAtRes(SequenceI sequence, int res); + + boolean isTransparencyAvailable(); + + String[] getDisplayedFeatureTypes(); + + String[] getDisplayedFeatureGroups(); + + void setAllVisible(List featureTypes); + + void setVisible(String featureType); + } diff --git a/src/jalview/api/FeatureSettingsControllerI.java b/src/jalview/api/FeatureSettingsControllerI.java new file mode 100644 index 0000000..c718e36 --- /dev/null +++ b/src/jalview/api/FeatureSettingsControllerI.java @@ -0,0 +1,6 @@ +package jalview.api; + +public interface FeatureSettingsControllerI +{ + +} diff --git a/src/jalview/api/FeatureSettingsModelI.java b/src/jalview/api/FeatureSettingsModelI.java new file mode 100644 index 0000000..c148f3f --- /dev/null +++ b/src/jalview/api/FeatureSettingsModelI.java @@ -0,0 +1,6 @@ +package jalview.api; + +public interface FeatureSettingsModelI +{ + +} diff --git a/src/jalview/api/FeaturesDisplayedI.java b/src/jalview/api/FeaturesDisplayedI.java new file mode 100644 index 0000000..9ed5ae5 --- /dev/null +++ b/src/jalview/api/FeaturesDisplayedI.java @@ -0,0 +1,29 @@ +package jalview.api; + +import java.util.Collection; +import java.util.Iterator; + +public interface FeaturesDisplayedI +{ + + Iterator getVisibleFeatures(); + + boolean isVisible(String featureType); + + boolean areVisible(Collection featureTypes); + + void clear(); + + void setVisible(String featureType); + + void setAllVisible(Collection featureTypes); + + boolean isRegistered(String type); + + void setAllRegisteredVisible(); + + int getVisibleFeatureCount(); + + int getRegisterdFeaturesCount(); + +} diff --git a/src/jalview/api/SequenceRenderer.java b/src/jalview/api/SequenceRenderer.java index fbd5e4a..0ca1758 100644 --- a/src/jalview/api/SequenceRenderer.java +++ b/src/jalview/api/SequenceRenderer.java @@ -29,4 +29,6 @@ public interface SequenceRenderer Color getResidueBoxColour(SequenceI sequenceI, int r); + Color getResidueColour(SequenceI seq, int position, FeatureRenderer fr); + } diff --git a/src/jalview/api/SequenceStructureBinding.java b/src/jalview/api/SequenceStructureBinding.java index 32c5bca..d620401 100644 --- a/src/jalview/api/SequenceStructureBinding.java +++ b/src/jalview/api/SequenceStructureBinding.java @@ -32,7 +32,7 @@ public interface SequenceStructureBinding /** * * @return true if Jalview or the Viewer is still restoring state or loading - * is still going on (see setFinsihedLoadingFromArchive) + * is still going on (see setFinishedLoadingFromArchive) */ void setLoadingFromArchive(boolean loadingFromArchive); diff --git a/src/jalview/api/analysis/ViewBasedAnalysisI.java b/src/jalview/api/analysis/ViewBasedAnalysisI.java new file mode 100644 index 0000000..3404afc --- /dev/null +++ b/src/jalview/api/analysis/ViewBasedAnalysisI.java @@ -0,0 +1,17 @@ +package jalview.api.analysis; + +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; + +public interface ViewBasedAnalysisI +{ + + /** + * Parameterise the analysis model using the current view + * @param view + * @return true if model is applicable and calculation should proceed + */ + + boolean configureFromAlignmentView(AlignmentViewPanel view); + +} diff --git a/src/jalview/api/structures/JalviewStructureDisplayI.java b/src/jalview/api/structures/JalviewStructureDisplayI.java index efb60dd..45b074b 100644 --- a/src/jalview/api/structures/JalviewStructureDisplayI.java +++ b/src/jalview/api/structures/JalviewStructureDisplayI.java @@ -20,21 +20,13 @@ */ package jalview.api.structures; -import jalview.api.FeatureRenderer; -import jalview.api.SequenceRenderer; -import jalview.api.SequenceStructureBinding; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.SequenceI; -import jalview.ext.jmol.JalviewJmolBinding; import jalview.schemes.ColourSchemeI; -import jalview.schemes.UserColourScheme; -import jalview.structure.StructureMappingcommandSet; -import jalview.structure.StructureSelectionManager; +import jalview.structures.models.AAStructureBindingModel; public interface JalviewStructureDisplayI { - SequenceStructureBinding getBinding(); + AAStructureBindingModel getBinding(); /** * @return true if there is an active GUI handling a structure display diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 98a4a1c..c58fc5b 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -152,6 +152,8 @@ public class APopupMenu extends java.awt.PopupMenu implements MenuItem selSeqDetails = new MenuItem( MessageManager.getString("label.sequence_details") + "..."); + MenuItem makeReferenceSeq = new MenuItem(); + Sequence seq; MenuItem revealAll = new MenuItem(); @@ -347,6 +349,17 @@ public class APopupMenu extends java.awt.PopupMenu implements if (seq != null) { seqMenu.setLabel(seq.getName()); + if (seq == ap.av.getAlignment().getSeqrep()) + { + makeReferenceSeq.setLabel(MessageManager + .getString("action.unmark_as_reference"));// Unmark + // representative"); + } + else + { + makeReferenceSeq.setLabel(MessageManager + .getString("action.set_as_reference")); // ); + } repGroup.setLabel(MessageManager.formatMessage( "label.represent_group_with", new String[] { seq.getName() })); @@ -515,6 +528,10 @@ public class APopupMenu extends java.awt.PopupMenu implements { editName(); } + else if (source == makeReferenceSeq) + { + makeReferenceSeq_actionPerformed(); + } else if (source == sequenceDetails) { showSequenceDetails(); @@ -673,7 +690,7 @@ public class APopupMenu extends java.awt.PopupMenu implements features, true, ap)) { ap.alignFrame.sequenceFeatures.setState(true); - ap.av.showSequenceFeatures(true); + ap.av.setShowSequenceFeatures(true);; ap.highlightSearchResults(null); } } @@ -732,7 +749,7 @@ public class APopupMenu extends java.awt.PopupMenu implements true, true, false, - (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax + (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.getMinMax() : null); contents.append("

    "); } @@ -909,6 +926,7 @@ public class APopupMenu extends java.awt.PopupMenu implements toLower.addActionListener(this); editMenu.add(toggleCase); seqMenu.add(sequenceName); + seqMenu.add(makeReferenceSeq); // seqMenu.add(sequenceDetails); if (!ap.av.applet.useXtrnalSviewer) @@ -928,6 +946,7 @@ public class APopupMenu extends java.awt.PopupMenu implements repGroup.addActionListener(this); revealAll.addActionListener(this); revealSeq.addActionListener(this); + makeReferenceSeq.addActionListener(this); } void refresh() @@ -1117,6 +1136,28 @@ public class APopupMenu extends java.awt.PopupMenu implements getGroup().setDisplayText(showText.getState()); refresh(); } + public void makeReferenceSeq_actionPerformed() + { + if (!ap.av.getAlignment().hasSeqrep()) + { + // initialise the display flags so the user sees something happen + ap.av.setDisplayReferenceSeq(true); + ap.av.setColourByReferenceSeq(true); + ap.av.getAlignment().setSeqrep(seq); + } + else + { + if (ap.av.getAlignment().getSeqrep() == seq) + { + ap.av.getAlignment().setSeqrep(null); + } + else + { + ap.av.getAlignment().setSeqrep(seq); + } + } + refresh(); + } public void showNonconserved_itemStateChanged() { diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index ed64215..1f32da0 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -23,6 +23,7 @@ package jalview.appletgui; import jalview.analysis.AlignmentSorter; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; +import jalview.api.FeatureRenderer; import jalview.api.SequenceStructureBinding; import jalview.bin.JalviewLite; import jalview.commands.CommandI; @@ -62,6 +63,7 @@ import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; import jalview.structure.StructureSelectionManager; +import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -89,9 +91,10 @@ import java.awt.event.WindowEvent; import java.io.IOException; import java.net.URL; import java.net.URLEncoder; -import java.util.Enumeration; +import java.util.Arrays; import java.util.Hashtable; import java.util.List; +import java.util.Map; import java.util.StringTokenizer; import java.util.Vector; @@ -285,7 +288,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { featuresFile = new jalview.io.FeaturesFile(file, type) .parse(viewport.getAlignment(), alignPanel.seqPanel.seqCanvas - .getFeatureRenderer().featureColours, featureLinks, + .getFeatureRenderer().getFeatureColours(), featureLinks, true, viewport.applet.getDefaultParameter( "relaxedidmatch", false)); } catch (Exception ex) @@ -301,9 +304,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if (autoenabledisplay) { - viewport.showSequenceFeatures = true; + viewport.setShowSequenceFeatures(true); sequenceFeatures.setState(true); } + if (alignPanel.seqPanel.seqCanvas.fr != null) + { + // update the min/max ranges where necessary + alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true); + } if (viewport.featureSettings != null) { viewport.featureSettings.refreshTable(); @@ -729,7 +737,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else if (evt.getSource() == sequenceFeatures) { - viewport.showSequenceFeatures(sequenceFeatures.getState()); + viewport.setShowSequenceFeatures(sequenceFeatures.getState()); alignPanel.seqPanel.seqCanvas.repaint(); } else if (evt.getSource() == conservationMenuItem) @@ -1099,6 +1107,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { new AnnotationColourChooser(viewport, alignPanel); } + else if (source == annotationColumnSelection) + { + new AnnotationColumnChooser(viewport, alignPanel); + } else if (source == sortPairwiseMenuItem) { sortPairwiseMenuItem_actionPerformed(); @@ -1191,11 +1203,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public String outputAnnotations(boolean displayTextbox) { - String annotation = new AnnotationFile().printAnnotations( - viewport.showAnnotation ? viewport.getAlignment() - .getAlignmentAnnotation() : null, viewport - .getAlignment().getGroups(), ((Alignment) viewport - .getAlignment()).alignmentProperties); + String annotation = new AnnotationFile() + .printAnnotationsForView(viewport); if (displayTextbox) { @@ -1210,20 +1219,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return annotation; } - private Hashtable getDisplayedFeatureCols() + private Map getDisplayedFeatureCols() { if (alignPanel.getFeatureRenderer() != null - && viewport.featuresDisplayed != null) + && viewport.getFeaturesDisplayed()!= null) { - FeatureRenderer fr = alignPanel.getFeatureRenderer(); - Hashtable fcols = new Hashtable(); - Enumeration en = viewport.featuresDisplayed.keys(); - while (en.hasMoreElements()) - { - Object col = en.nextElement(); - fcols.put(col, fr.featureColours.get(col)); - } - return fcols; + return alignPanel.getFeatureRenderer().getDisplayedFeatureCols(); + } return null; } @@ -1429,6 +1431,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, /** * TODO: JAL-1104 */ + @Override public void addHistoryItem(CommandI command) { if (command.getSize() > 0) @@ -1687,11 +1690,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { copiedHiddenColumns = new Vector(); int hiddenOffset = viewport.getSelectionGroup().getStartRes(); - for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns() - .size(); i++) + for (int[] region : viewport.getColumnSelection().getHiddenColumns()) { - int[] region = (int[]) viewport.getColumnSelection() - .getHiddenColumns().elementAt(i); copiedHiddenColumns.addElement(new int[] { region[0] - hiddenOffset, region[1] - hiddenOffset }); @@ -2271,7 +2271,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (alignPanel != null && (fr = alignPanel.getFeatureRenderer()) != null) { - return fr.getGroups(); + List gps = fr.getFeatureGroups(); + int p=0; + String[] _gps = new String[gps.size()]; + for (Object gp:gps) + { + _gps[p++] = gp.toString(); + } + return _gps; } return null; } @@ -2289,7 +2296,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (alignPanel != null && (fr = alignPanel.getFeatureRenderer()) != null) { - return fr.getGroups(visible); + List gps = fr.getGroups(visible); + int p=0; + String[] _gps = new String[gps.size()]; + for (Object gp:gps) + { + _gps[p++] = gp.toString(); + } + return _gps; } return null; } @@ -2306,11 +2320,12 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { FeatureRenderer fr = null; this.sequenceFeatures.setState(true); - viewport.showSequenceFeatures(true); + viewport.setShowSequenceFeatures(true); if (alignPanel != null && (fr = alignPanel.getFeatureRenderer()) != null) { - fr.setGroupState(groups, state); + + fr.setGroupVisibility(Arrays.asList(groups), state); alignPanel.seqPanel.seqCanvas.repaint(); if (alignPanel.overviewPanel != null) { @@ -3257,6 +3272,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, annotationColour.setLabel(MessageManager .getString("action.by_annotation")); annotationColour.addActionListener(this); + + annotationColumnSelection.setLabel("Select by Annotation"); + annotationColumnSelection.addActionListener(this); + invertSequenceMenuItem.setLabel(MessageManager .getString("action.invert_sequence_selection")); invertColSel.setLabel(MessageManager @@ -3445,6 +3464,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, selectMenu.add(unGroup); selectMenu.add(grpsFromSelection); selectMenu.add(deleteGroups); + selectMenu.add(annotationColumnSelection); } @@ -3459,6 +3479,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, MenuItem annotationColour = new MenuItem(); + MenuItem annotationColumnSelection = new MenuItem(); + MenuItem invertColSel = new MenuItem(); Menu menu1 = new Menu(); @@ -3615,7 +3637,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return null; } } - ExtJmol jmv = null; + AAStructureBindingModel jmv = null; // TODO: search for a jmv that involves viewer if (jmv == null) { // create a new viewer/jalview binding. diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 7400122..84a62ae 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -20,19 +20,23 @@ */ package jalview.appletgui; -import java.util.*; - -import java.awt.*; - -import jalview.analysis.*; +import jalview.analysis.NJTree; import jalview.api.AlignViewportI; -import jalview.bin.*; -import jalview.datamodel.*; -import jalview.schemes.*; +import jalview.bin.JalviewLite; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.UserColourScheme; import jalview.structure.SelectionSource; import jalview.structure.VamsasSource; import jalview.viewmodel.AlignmentViewport; +import java.awt.Font; +import java.util.Stack; + public class AlignViewport extends AlignmentViewport implements AlignViewportI, SelectionSource, VamsasSource { @@ -58,8 +62,6 @@ public class AlignViewport extends AlignmentViewport implements boolean renderGaps = true; - boolean showSequenceFeatures = false; - boolean showAnnotation = true; boolean upperCasebold = false; @@ -86,10 +88,6 @@ public class AlignViewport extends AlignmentViewport implements boolean scaleRightWrapped = true; - // The following vector holds the features which are - // currently visible, in the correct order or rendering - public Hashtable featuresDisplayed; - boolean showHiddenMarkers = true; public jalview.bin.JalviewLite applet; @@ -100,6 +98,8 @@ public class AlignViewport extends AlignmentViewport implements Stack redoList = new Stack(); + private AnnotationColumnChooser annotationColumnSelectionState; + public void finalize() { applet = null; @@ -256,16 +256,6 @@ public class AlignViewport extends AlignmentViewport implements } - public void showSequenceFeatures(boolean b) - { - showSequenceFeatures = b; - } - - public boolean getShowSequenceFeatures() - { - return showSequenceFeatures; - } - /** * get the consensus sequence as displayed under the PID consensus annotation * row. @@ -639,12 +629,6 @@ public class AlignViewport extends AlignmentViewport implements } } - @Override - public boolean hasHiddenColumns() - { - return hasHiddenColumns; - } - public boolean isNormaliseSequenceLogo() { return normaliseSequenceLogo; @@ -664,4 +648,15 @@ public class AlignViewport extends AlignmentViewport implements return validCharWidth; } + public AnnotationColumnChooser getAnnotationColumnSelectionState() + { + return annotationColumnSelectionState; + } + + public void setAnnotationColumnSelectionState( + AnnotationColumnChooser annotationColumnSelectionState) + { + this.annotationColumnSelectionState = annotationColumnSelectionState; + } + } diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index a90425f..5308a42 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -157,12 +157,18 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { return seqPanel.seqCanvas.sr; } - - public FeatureRenderer getFeatureRenderer() + @Override + public jalview.api.FeatureRenderer getFeatureRenderer() { return seqPanel.seqCanvas.fr; } - + @Override + public jalview.api.FeatureRenderer cloneFeatureRenderer() + { + FeatureRenderer nfr = new FeatureRenderer(av); + nfr.transferSettings(seqPanel.seqCanvas.fr); + return nfr; + } public void alignmentChanged() { av.alignmentChanged(this); diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index c7b7c6c..cc2e530 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -20,15 +20,34 @@ */ 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.AnnotationColourGradient; +import jalview.schemes.ColourSchemeI; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Panel; +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.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Hashtable; +import java.util.Vector; + public class AnnotationColourChooser extends Panel implements ActionListener, AdjustmentListener, ItemListener, MouseListener { @@ -104,9 +123,13 @@ public class AnnotationColourChooser extends Panel implements { String label = av.getAlignment().getAlignmentAnnotation()[i].label; if (!list.contains(label)) + { list.addElement(label); + } else + { list.addElement(label + "_" + (index++)); + } } for (int i = 0; i < list.size(); i++) @@ -137,7 +160,9 @@ public class AnnotationColourChooser extends Panel implements threshold.select(1); break; default: - throw new Error(MessageManager.getString("error.implementation_error_dont_know_thereshold_annotationcolourgradient")); + throw new Error( + MessageManager + .getString("error.implementation_error_dont_know_thereshold_annotationcolourgradient")); } thresholdIsMin.setState(acg.thresholdIsMinMax); thresholdValue.setText("" + acg.getAnnotationThreshold()); @@ -348,14 +373,14 @@ public class AnnotationColourChooser extends Panel implements { if (!adjusting) { - thresholdValue.setText(((float) slider.getValue() / 1000f) + ""); + thresholdValue.setText((slider.getValue() / 1000f) + ""); if (currentColours.getState() && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) { changeColour(); } - currentAnnotation.threshold.value = (float) slider.getValue() / 1000f; + currentAnnotation.threshold.value = slider.getValue() / 1000f; ap.paintAlignment(false); } } diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java new file mode 100644 index 0000000..e25ff8f --- /dev/null +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -0,0 +1,927 @@ +package jalview.appletgui; + +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.ColumnSelection; +import jalview.gui.JvSwingUtils; +import jalview.schemes.AnnotationColourGradient; +import jalview.util.MessageManager; +import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Panel; +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.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.TextEvent; +import java.awt.event.TextListener; +import java.util.Iterator; +import java.util.Vector; + +import javax.swing.JPanel; + +//import net.miginfocom.swing.MigLayout; + +public class AnnotationColumnChooser extends AnnotationRowFilter implements + ActionListener, AdjustmentListener, ItemListener, MouseListener +{ + + private Choice annotations = new Choice(); + + private Panel actionPanel = new Panel(); + + private TitledPanel thresholdPanel = new TitledPanel(); + + private Panel switchableViewsPanel = new Panel(new CardLayout()); + + private CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel + .getLayout()); + + private Panel noGraphFilterView = new Panel(); + + private Panel graphFilterView = new Panel(); + + private Panel annotationComboBoxPanel = new Panel(); + + private BorderLayout borderLayout1 = new BorderLayout(); + + private BorderLayout gBorderLayout = new BorderLayout(); + + private BorderLayout ngBorderLayout = new BorderLayout(); + + private Choice threshold = new Choice(); + + private StructureFilterPanel gStructureFilterPanel; + + private StructureFilterPanel ngStructureFilterPanel; + + private StructureFilterPanel currentStructureFilterPanel; + + private SearchPanel currentSearchPanel; + + private SearchPanel gSearchPanel; + + private SearchPanel ngSearchPanel; + + private FurtherActionPanel currentFurtherActionPanel; + + private FurtherActionPanel gFurtherActionPanel; + + private FurtherActionPanel ngFurtherActionPanel; + + public static final int ACTION_OPTION_SELECT = 1; + + public static int ACTION_OPTION_HIDE = 2; + + public static String NO_GRAPH_VIEW = "0"; + + public static String GRAPH_VIEW = "1"; + + private int actionOption = ACTION_OPTION_SELECT; + + private ColumnSelection oldColumnSelection; + + public AnnotationColumnChooser() + { + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) + { + super(av, ap); + frame = new Frame(); + frame.add(this); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.select_by_annotation"), 520, + 215); + + slider.addAdjustmentListener(this); + slider.addMouseListener(this); + + if (av.getAlignment().getAlignmentAnnotation() == null) + { + return; + } + setOldColumnSelection(av.getColumnSelection()); + 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++)); + } + } + + for (int i = 0; i < list.size(); i++) + { + annotations.addItem(list.elementAt(i).toString()); + } + + populateThresholdComboBox(threshold); + + // restore Object state from the previous session if one exists + if (av.getAnnotationColumnSelectionState() != null) + { + currentSearchPanel = av.getAnnotationColumnSelectionState() + .getCurrentSearchPanel(); + currentStructureFilterPanel = av.getAnnotationColumnSelectionState() + .getCurrentStructureFilterPanel(); + annotations.select(av.getAnnotationColumnSelectionState() + .getAnnotations().getSelectedIndex()); + threshold.select(av.getAnnotationColumnSelectionState() + .getThreshold().getSelectedIndex()); + actionOption = av.getAnnotationColumnSelectionState() + .getActionOption(); + } + + try + { + jbInit(); + } catch (Exception ex) + { + } + adjusting = false; + + updateView(); + frame.invalidate(); + frame.pack(); + } + + private void jbInit() throws Exception + { + ok.setLabel(MessageManager.getString("action.ok")); + + cancel.setLabel(MessageManager.getString("action.cancel")); + + thresholdValue.setEnabled(false); + thresholdValue.setColumns(7); + + ok.addActionListener(this); + cancel.addActionListener(this); + annotations.addItemListener(this); + thresholdValue.addActionListener(this); + threshold.addItemListener(this); + + slider.setBackground(Color.white); + slider.setEnabled(false); + slider.setPreferredSize(new Dimension(100, 32)); + + thresholdPanel.setBackground(Color.white); + thresholdPanel.setFont(JvSwingUtils.getLabelFont()); + // thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); + + actionPanel.setBackground(Color.white); + actionPanel.setFont(JvSwingUtils.getLabelFont()); + + graphFilterView.setLayout(gBorderLayout); + graphFilterView.setBackground(Color.white); + + noGraphFilterView.setLayout(ngBorderLayout); + noGraphFilterView.setBackground(Color.white); + + annotationComboBoxPanel.setBackground(Color.white); + annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont()); + + gSearchPanel = new SearchPanel(this); + ngSearchPanel = new SearchPanel(this); + gFurtherActionPanel = new FurtherActionPanel(this); + ngFurtherActionPanel = new FurtherActionPanel(this); + gStructureFilterPanel = new StructureFilterPanel(this); + ngStructureFilterPanel = new StructureFilterPanel(this); + + thresholdPanel.setTitle("Threshold Filter"); + thresholdPanel.add(getThreshold()); + thresholdPanel.add(slider); + thresholdPanel.add(thresholdValue); + + actionPanel.add(ok); + actionPanel.add(cancel); + + JPanel staticPanel = new JPanel(); + staticPanel.setLayout(new BorderLayout()); + staticPanel.setBackground(Color.white); + + staticPanel.add(gSearchPanel, java.awt.BorderLayout.NORTH); + staticPanel.add(gStructureFilterPanel, java.awt.BorderLayout.SOUTH); + + graphFilterView.add(staticPanel, java.awt.BorderLayout.NORTH); + graphFilterView.add(thresholdPanel, java.awt.BorderLayout.CENTER); + graphFilterView.add(gFurtherActionPanel, java.awt.BorderLayout.SOUTH); + + noGraphFilterView.add(ngSearchPanel, java.awt.BorderLayout.PAGE_START); + noGraphFilterView.add(ngStructureFilterPanel, + java.awt.BorderLayout.CENTER); + noGraphFilterView.add(ngFurtherActionPanel, + java.awt.BorderLayout.CENTER); + + annotationComboBoxPanel.add(getAnnotations()); + switchableViewsPanel.add(noGraphFilterView, + AnnotationColumnChooser.NO_GRAPH_VIEW); + switchableViewsPanel.add(graphFilterView, + AnnotationColumnChooser.GRAPH_VIEW); + + this.setLayout(borderLayout1); + this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START); + this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER); + this.add(actionPanel, java.awt.BorderLayout.SOUTH); + + selectedAnnotationChanged(); + this.validate(); + } + + @SuppressWarnings("unchecked") + public void reset() + { + if (this.getOldColumnSelection() != null) + { + av.getColumnSelection().clear(); + + if (av.getAnnotationColumnSelectionState() != null) + { + ColumnSelection oldSelection = av + .getAnnotationColumnSelectionState() + .getOldColumnSelection(); + if (oldSelection != null && oldSelection.getHiddenColumns() != null + && !oldSelection.getHiddenColumns().isEmpty()) + { + for (Iterator itr = oldSelection.getHiddenColumns() + .iterator(); itr.hasNext();) + { + int positions[] = itr.next(); + av.hideColumns(positions[0], positions[1]); + } + } + av.setColumnSelection(oldSelection); + } + ap.paintAlignment(true); + } + + } + + public void adjustmentValueChanged(AdjustmentEvent evt) + { + if (!adjusting) + { + thresholdValue.setText((slider.getValue() / 1000f) + ""); + valueChanged(!sliderDragging); + } + } + + protected void addSliderMouseListeners() + { + + slider.addMouseListener(new MouseAdapter() + { + @Override + public void mousePressed(MouseEvent e) + { + sliderDragging = true; + super.mousePressed(e); + } + + @Override + public void mouseDragged(MouseEvent e) + { + sliderDragging = true; + super.mouseDragged(e); + } + + @Override + public void mouseReleased(MouseEvent evt) + { + if (sliderDragging) + { + sliderDragging = false; + valueChanged(true); + } + ap.paintAlignment(true); + } + }); + } + + public void valueChanged(boolean updateAllAnnotation) + { + if (slider.isEnabled()) + { + getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; + updateView(); + ap.paintAlignment(false); + } + } + + public Choice getThreshold() + { + return threshold; + } + + public void setThreshold(Choice threshold) + { + this.threshold = threshold; + } + + public Choice getAnnotations() + { + return annotations; + } + + public void setAnnotations(Choice annotations) + { + this.annotations = annotations; + } + + @Override + public void updateView() + { + // Check if combobox is still adjusting + if (adjusting) + { + return; + } + + AnnotationFilterParameter filterParams = new AnnotationFilterParameter(); + setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[getAnnotations() + .getSelectedIndex()]); + + int selectedThresholdItem = getSelectedThresholdItem(getThreshold() + .getSelectedIndex()); + + slider.setEnabled(true); + thresholdValue.setEnabled(true); + + if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) + { + slider.setEnabled(false); + thresholdValue.setEnabled(false); + thresholdValue.setText(""); + // build filter params + } + else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) + { + if (getCurrentAnnotation().threshold == null) + { + getCurrentAnnotation() + .setThreshold( + new jalview.datamodel.GraphLine( + (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); + } + + adjusting = true; + float range = getCurrentAnnotation().graphMax * 1000 + - getCurrentAnnotation().graphMin * 1000; + + slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); + slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); + slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); + thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); + // slider.setMajorTickSpacing((int) (range / 10f)); + slider.setEnabled(true); + thresholdValue.setEnabled(true); + adjusting = false; + + // build filter params + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); + if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH) + { + filterParams + .setThresholdValue(getCurrentAnnotation().threshold.value); + + if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD) + { + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); + } + else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD) + { + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); + } + } + } + + if (currentStructureFilterPanel != null) + { + if (currentStructureFilterPanel.alphaHelix.getState()) + { + filterParams.setFilterAlphaHelix(true); + } + if (currentStructureFilterPanel.betaStrand.getState()) + { + filterParams.setFilterBetaSheet(true); + } + if (currentStructureFilterPanel.turn.getState()) + { + filterParams.setFilterTurn(true); + } + } + + if (currentSearchPanel != null) + { + + if (!currentSearchPanel.searchBox.getText().isEmpty()) + { + currentSearchPanel.description.setEnabled(true); + currentSearchPanel.displayName.setEnabled(true); + filterParams.setRegexString(currentSearchPanel.searchBox.getText()); + if (currentSearchPanel.displayName.getState()) + { + filterParams + .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); + } + if (currentSearchPanel.description.getState()) + { + filterParams + .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); + } + } + else + { + currentSearchPanel.description.setEnabled(false); + currentSearchPanel.displayName.setEnabled(false); + } + } + + av.getColumnSelection().filterAnnotations( + getCurrentAnnotation().annotations, filterParams); + + av.showAllHiddenColumns(); + if (getActionOption() == ACTION_OPTION_HIDE) + { + av.hideSelectedColumns(); + } + + filterParams = null; + av.setAnnotationColumnSelectionState(this); + ap.paintAlignment(true); + } + + public ColumnSelection getOldColumnSelection() + { + return oldColumnSelection; + } + + public void setOldColumnSelection(ColumnSelection currentColumnSelection) + { + if (currentColumnSelection != null) + { + this.oldColumnSelection = new ColumnSelection(currentColumnSelection); + } + } + + public FurtherActionPanel getCurrentFutherActionPanel() + { + return currentFurtherActionPanel; + } + + public void setCurrentFutherActionPanel( + FurtherActionPanel currentFutherActionPanel) + { + this.currentFurtherActionPanel = currentFutherActionPanel; + } + + public SearchPanel getCurrentSearchPanel() + { + return currentSearchPanel; + } + + public void setCurrentSearchPanel(SearchPanel currentSearchPanel) + { + this.currentSearchPanel = currentSearchPanel; + } + + public int getActionOption() + { + return actionOption; + } + + public void setActionOption(int actionOption) + { + this.actionOption = actionOption; + } + + public StructureFilterPanel getCurrentStructureFilterPanel() + { + return currentStructureFilterPanel; + } + + public void setCurrentStructureFilterPanel( + StructureFilterPanel currentStructureFilterPanel) + { + this.currentStructureFilterPanel = currentStructureFilterPanel; + } + + @Override + public void itemStateChanged(ItemEvent e) + { + if (e.getSource() == annotations) + { + selectedAnnotationChanged(); + } + else if (e.getSource() == threshold) + { + threshold_actionPerformed(null); + } + } + + public void selectedAnnotationChanged() + { + String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW; + if (av.getAlignment().getAlignmentAnnotation()[getAnnotations() + .getSelectedIndex()].graph != AlignmentAnnotation.NO_GRAPH) + { + currentView = AnnotationColumnChooser.GRAPH_VIEW; + } + + gSearchPanel.syncState(); + gFurtherActionPanel.syncState(); + gStructureFilterPanel.syncState(); + + ngSearchPanel.syncState(); + ngFurtherActionPanel.syncState(); + ngStructureFilterPanel.syncState(); + + switchableViewsLayout.show(switchableViewsPanel, currentView); + updateView(); + } + + public class FurtherActionPanel extends Panel implements + ItemListener + { + private AnnotationColumnChooser aColChooser; + + private Choice furtherAction = new Choice(); + + public FurtherActionPanel(AnnotationColumnChooser aColChooser) + { + this.aColChooser = aColChooser; + furtherAction.addItem("Select"); + furtherAction.addItem("Hide"); + furtherAction.addItemListener(this); + syncState(); + + // this.setTitle("Filter Actions"); + // this.setFont(JvSwingUtils.getLabelFont()); + + this.add(furtherAction); + } + + public void syncState() + { + if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) + { + furtherAction.select("Hide"); + } + else + { + furtherAction.select("Select"); + } + } + + @Override + public void itemStateChanged(ItemEvent e) + { + aColChooser.setCurrentFutherActionPanel(this); + if (furtherAction.getSelectedItem().equalsIgnoreCase("Select")) + { + setActionOption(ACTION_OPTION_SELECT); + updateView(); + } + else + { + setActionOption(ACTION_OPTION_HIDE); + updateView(); + } + + } + } + + public class StructureFilterPanel extends TitledPanel implements + ItemListener + { + private AnnotationColumnChooser aColChooser; + + private Checkbox alphaHelix = new Checkbox(); + + private Checkbox betaStrand = new Checkbox(); + + private Checkbox turn = new Checkbox(); + + private Checkbox all = new Checkbox(); + + public StructureFilterPanel(AnnotationColumnChooser aColChooser) + { + this.aColChooser = aColChooser; + + alphaHelix.setLabel(MessageManager.getString("label.alpha_helix")); + alphaHelix.setBackground(Color.white); + + alphaHelix.addItemListener(this); + + betaStrand.setLabel(MessageManager.getString("label.beta_strand")); + betaStrand.setBackground(Color.white); + betaStrand.addItemListener(this); + + turn.setLabel(MessageManager.getString("label.turn")); + turn.setBackground(Color.white); + turn.addItemListener(this); + + all.setLabel(MessageManager.getString("label.select_all")); + all.setBackground(Color.white); + all.addItemListener(this); + + this.setBackground(Color.white); + this.setTitle("Structure Filter"); + this.setFont(JvSwingUtils.getLabelFont()); + + this.add(all); + this.add(alphaHelix); + this.add(betaStrand); + this.add(turn); + } + + public void alphaHelix_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void betaStrand_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void turn_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void all_actionPerformed() + { + if (all.getState()) + { + alphaHelix.setState(true); + betaStrand.setState(true); + turn.setState(true); + } + else + { + alphaHelix.setState(false); + betaStrand.setState(false); + turn.setState(false); + } + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void updateSelectAllState() + { + if (alphaHelix.getState() && betaStrand.getState() && turn.getState()) + { + all.setState(true); + } + else + { + all.setState(false); + } + } + + public void syncState() + { + StructureFilterPanel sfp = aColChooser + .getCurrentStructureFilterPanel(); + if (sfp != null) + { + alphaHelix.setState(sfp.alphaHelix.getState()); + betaStrand.setState(sfp.betaStrand.getState()); + turn.setState(sfp.turn.getState()); + if (sfp.all.getState()) + { + all.setState(true); + alphaHelix.setState(true); + betaStrand.setState(true); + turn.setState(true); + } + } + + } + + @Override + public void itemStateChanged(ItemEvent e) + { + if (e.getSource() == alphaHelix) + { + alphaHelix_actionPerformed(); + } + else if (e.getSource() == betaStrand) + { + betaStrand_actionPerformed(); + } + else if (e.getSource() == turn) + { + turn_actionPerformed(); + } + else if (e.getSource() == all) + { + all_actionPerformed(); + } + } + } + + public class SearchPanel extends TitledPanel implements ItemListener + { + private AnnotationColumnChooser aColChooser; + + private Checkbox displayName = new Checkbox(); + + private Checkbox description = new Checkbox(); + + private TextField searchBox = new TextField(10); + + public SearchPanel(AnnotationColumnChooser aColChooser) + { + + this.aColChooser = aColChooser; + searchBox.addTextListener(new TextListener() + { + + @Override + public void textValueChanged(TextEvent e) + { + searchStringAction(); + + } + + }); + + displayName.setLabel(MessageManager.getString("label.display_name")); + displayName.setEnabled(false); + displayName.addItemListener(this); + + description.setLabel(MessageManager.getString("label.description")); + description.setEnabled(false); + description.addItemListener(this); + this.setTitle("Search Filter"); + this.setFont(JvSwingUtils.getLabelFont()); + + syncState(); + this.add(searchBox); + this.add(displayName); + this.add(description); + } + + public void displayNameCheckboxAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void discriptionCheckboxAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void searchStringAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void syncState() + { + SearchPanel sp = aColChooser.getCurrentSearchPanel(); + if (sp != null) + { + description.setEnabled(sp.description.isEnabled()); + description.setState(sp.description.getState()); + + displayName.setEnabled(sp.displayName.isEnabled()); + displayName.setState(sp.displayName.getState()); + + searchBox.setText(sp.searchBox.getText()); + } + } + + @Override + public void itemStateChanged(ItemEvent e) + { + if (e.getSource() == displayName) + { + displayNameCheckboxAction(); + } + else if (e.getSource() == description) + { + discriptionCheckboxAction(); + } + + } + } + + public void actionPerformed(ActionEvent evt) + { + if (evt.getSource() == thresholdValue) + { + try + { + float f = new Float(thresholdValue.getText()).floatValue(); + slider.setValue((int) (f * 1000)); + adjustmentValueChanged(null); + } catch (NumberFormatException ex) + { + } + } + + else if (evt.getSource() == ok) + { + ok_actionPerformed(null); + } + else if (evt.getSource() == cancel) + { + cancel_actionPerformed(null); + } + else if (evt.getSource() == thresholdValue) + { + thresholdValue_actionPerformed(null); + } + else + { + updateView(); + } + } + + @Override + public void mouseClicked(MouseEvent e) + { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent e) + { + if (e.getSource() == slider) + { + updateView(); + } + + } + + @Override + public void mouseReleased(MouseEvent e) + { + if (e.getSource() == slider) + { + updateView(); + } + } + + @Override + public void mouseEntered(MouseEvent e) + { + if (e.getSource() == slider) + { + updateView(); + } + } + + @Override + public void mouseExited(MouseEvent e) + { + if (e.getSource() == slider) + { + updateView(); + } + } + +} diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 3e81664..6aaa033 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -20,14 +20,36 @@ */ package jalview.appletgui; -import java.util.*; -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; import jalview.util.MessageManager; import jalview.util.ParseHtmlBodyAndLinks; +import java.awt.Checkbox; +import java.awt.CheckboxMenuItem; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.util.Arrays; +import java.util.Vector; + public class AnnotationLabels extends Panel implements ActionListener, MouseListener, MouseMotionListener { @@ -221,7 +243,9 @@ public class AnnotationLabels extends Panel implements ActionListener, return true; } else + { return false; + } } @@ -713,11 +737,8 @@ public class AnnotationLabels extends Panel implements ActionListener, if (av.hasHiddenColumns()) { jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector(); - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - int[] region = (int[]) av.getColumnSelection().getHiddenColumns() - .elementAt(i); - jalview.appletgui.AlignFrame.copiedHiddenColumns .addElement(new int[] { region[0], region[1] }); diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java new file mode 100644 index 0000000..8a0a44a --- /dev/null +++ b/src/jalview/appletgui/AnnotationRowFilter.java @@ -0,0 +1,198 @@ +package jalview.appletgui; + +import jalview.schemes.AnnotationColourGradient; +import jalview.util.MessageManager; + +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Scrollbar; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.util.Vector; + + + +@SuppressWarnings("serial") +public abstract class AnnotationRowFilter extends Panel +{ + protected AlignViewport av; + + protected AlignmentPanel ap; + + protected int[] annmap; + + protected boolean enableSeqAss = false; + + private jalview.datamodel.AlignmentAnnotation currentAnnotation; + + protected boolean adjusting = false; + + protected Checkbox currentColours = new Checkbox(); + + protected Panel minColour = new Panel(); + + protected Panel maxColour = new Panel(); + + protected Checkbox seqAssociated = new Checkbox(); + + protected Checkbox thresholdIsMin = new Checkbox(); + + protected Scrollbar slider = new Scrollbar(Scrollbar.HORIZONTAL); + + protected TextField thresholdValue = new TextField(20); + + protected Frame frame; + + protected Button ok = new Button(); + + protected Button cancel = new Button(); + + /** + * enabled if the user is dragging the slider - try to keep updates to a + * minimun + */ + protected boolean sliderDragging = false; + + + public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap) + { + this.av = av; + this.ap = ap; + } + + public AnnotationRowFilter() + { + + } + + + public Vector getAnnotationItems(boolean isSeqAssociated) + { + Vector list = new Vector(); + int index = 1; + int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; + for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + { + if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null) + { + if (isSeqAssociated) + { + continue; + } + } + else + { + enableSeqAss = true; + } + String label = av.getAlignment().getAlignmentAnnotation()[i].label; + if (!list.contains(label)) + { + anmap[list.size()] = i; + list.add(label); + + } + else + { + if (!isSeqAssociated) + { + anmap[list.size()] = i; + list.add(label + "_" + (index++)); + } + } + } + this.annmap = new int[list.size()]; + System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length); + return list; + } + + protected int getSelectedThresholdItem(int indexValue) + { + int selectedThresholdItem = -1; + if (indexValue == 1) + { + selectedThresholdItem = AnnotationColourGradient.ABOVE_THRESHOLD; + } + else if (indexValue == 2) + { + selectedThresholdItem = AnnotationColourGradient.BELOW_THRESHOLD; + } + return selectedThresholdItem; + } + + public void modelChanged() + { + seqAssociated.setEnabled(enableSeqAss); + } + + public void ok_actionPerformed(ActionEvent e) + { + updateView(); + frame.setVisible(false); + } + + public void cancel_actionPerformed(ActionEvent e) + { + reset(); + ap.paintAlignment(true); + frame.setVisible(false); + } + + public void thresholdCheck_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void annotations_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void threshold_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void thresholdValue_actionPerformed(ActionEvent e) + { + try + { + float f = Float.parseFloat(thresholdValue.getText()); + slider.setValue((int) (f * 1000)); + updateView(); + } catch (NumberFormatException ex) + { + } + } + + + protected void populateThresholdComboBox(Choice threshold) + { + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); + } + + + public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation() + { + return currentAnnotation; + } + + public void setCurrentAnnotation( + jalview.datamodel.AlignmentAnnotation currentAnnotation) + { + this.currentAnnotation = currentAnnotation; + } + + public abstract void valueChanged(boolean updateAllAnnotation); + + public abstract void updateView(); + + public abstract void reset(); +} \ No newline at end of file diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 42fbd70..4dcb5d7 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -20,18 +20,49 @@ */ package jalview.appletgui; -import java.util.*; -import java.awt.*; -import java.awt.event.*; - -import jalview.api.SequenceStructureBinding; -import jalview.datamodel.*; -import jalview.structure.*; -import jalview.io.*; - -import jalview.schemes.*; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.io.AppletFormatAdapter; +import jalview.io.FileParse; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.UserColourScheme; +import jalview.schemes.ZappoColourScheme; +import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.CheckboxMenuItem; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Vector; + public class AppletJmol extends EmbmenuFrame implements // StructureListener, KeyListener, ActionListener, ItemListener @@ -398,9 +429,9 @@ public class AppletJmol extends EmbmenuFrame implements StringBuffer sb = new StringBuffer(); try { - for (int s = 0; s < jmb.pdbentry.length; s++) + for (int s = 0; s < jmb.getPdbCount(); s++) { - sb.append(jmb.printMapping(jmb.pdbentry[s].getFile())); + sb.append(jmb.printMapping(jmb.getPdbEntry(s).getFile())); sb.append("\n"); } cap.setText(sb.toString()); @@ -488,7 +519,9 @@ public class AppletJmol extends EmbmenuFrame implements for (int i = 0; i < chainMenu.getItemCount(); i++) { if (chainMenu.getItem(i) instanceof CheckboxMenuItem) + { ((CheckboxMenuItem) chainMenu.getItem(i)).setState(true); + } } centerViewer(); @@ -519,10 +552,12 @@ public class AppletJmol extends EmbmenuFrame implements else if (evt.getSource() == seqColour) { setEnabled(seqColour); - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); + jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); } else if (!allChainsSelected) + { centerViewer(); + } } public void keyPressed(KeyEvent evt) @@ -547,7 +582,7 @@ public class AppletJmol extends EmbmenuFrame implements public void updateColours(Object source) { AlignmentPanel ap = (AlignmentPanel) source; - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); + jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); } public void updateTitleAndMenus() @@ -558,7 +593,7 @@ public class AppletJmol extends EmbmenuFrame implements return; } setChainMenuItems(jmb.chainNames); - jmb.colourBySequence(ap.av.getShowSequenceFeatures(), ap); + jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); setTitle(jmb.getViewerTitle()); } diff --git a/src/jalview/appletgui/AppletJmolBinding.java b/src/jalview/appletgui/AppletJmolBinding.java index 650693d..ff1f5b2 100644 --- a/src/jalview/appletgui/AppletJmolBinding.java +++ b/src/jalview/appletgui/AppletJmolBinding.java @@ -52,7 +52,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding AlignmentViewPanel alignment) { AlignmentPanel ap = (AlignmentPanel) alignment; - if (appletJmolBinding.ap.av.showSequenceFeatures) + if (appletJmolBinding.ap.av.isShowSequenceFeatures()) { if (appletJmolBinding.fr == null) { @@ -77,7 +77,9 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void sendConsoleEcho(String strEcho) { if (appletJmolBinding.scriptWindow == null) + { appletJmolBinding.showConsole(true); + } appletJmolBinding.history.append("\n" + strEcho); } @@ -105,7 +107,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void updateColours(Object source) { AlignmentPanel ap = (AlignmentPanel) source; - colourBySequence(ap.av.getShowSequenceFeatures(), ap); + colourBySequence(ap.av.isShowSequenceFeatures(), ap); } public void showUrl(String url) @@ -138,10 +140,10 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } + @Override public void refreshPdbEntries() { - // TODO Auto-generated method stub - + // noop } @Override @@ -164,20 +166,7 @@ class AppletJmolBinding extends jalview.ext.jmol.JalviewJmolBinding protected void releaseUIResources() { appletJmolBinding = null; - if (console != null) - { - try - { - console.setVisible(false); - } catch (Error e) - { - } catch (Exception x) - { - } - ; - console = null; - } - + closeConsole(); } @Override diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index 636dd7f..0a9ca56 100644 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -20,14 +20,28 @@ */ package jalview.appletgui; -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; -import jalview.io.*; +import jalview.datamodel.Alignment; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.Sequence; +import jalview.io.AnnotationFile; +import jalview.io.AppletFormatAdapter; +import jalview.io.IdentifyFile; +import jalview.io.TCoffeeScoreFile; import jalview.schemes.TCoffeeColourScheme; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + public class CutAndPasteTransfer extends Panel implements ActionListener, MouseListener { @@ -132,12 +146,15 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, pdb.setFile(text); if (alignFrame.alignPanel.av.applet.jmolAvailable) + { new jalview.appletgui.AppletJmol(pdb, new Sequence[] { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE); + } else - + { new MCview.AppletPDBViewer(pdb, new Sequence[] { seq }, null, alignFrame.alignPanel, AppletFormatAdapter.PASTE); + } } else if (treeImport) @@ -203,8 +220,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, } if (tcf == null) { - if (new AnnotationFile().readAnnotationFile( - alignFrame.viewport.getAlignment(), textarea.getText(), + if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport, + textarea.getText(), jalview.io.AppletFormatAdapter.PASTE)) { alignFrame.alignPanel.fontChanged(); diff --git a/src/jalview/appletgui/ExtJmol.java b/src/jalview/appletgui/ExtJmol.java index 6389250..cb99f87 100644 --- a/src/jalview/appletgui/ExtJmol.java +++ b/src/jalview/appletgui/ExtJmol.java @@ -20,14 +20,6 @@ */ package jalview.appletgui; -import java.awt.Container; -import java.util.BitSet; -import java.util.Hashtable; -import java.util.Vector; - -import org.jmol.api.JmolAppConsoleInterface; -import org.jmol.api.JmolViewer; - import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; @@ -35,6 +27,15 @@ import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.ext.jmol.JalviewJmolBinding; +import java.awt.Container; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; +import java.util.Vector; + +import org.jmol.api.JmolAppConsoleInterface; +import org.jmol.api.JmolViewer; + /** * bind an alignment view to an external Jmol instance. * @@ -57,9 +58,8 @@ public class ExtJmol extends JalviewJmolBinding public ExtJmol(JmolViewer viewer, AlignmentPanel alignPanel, SequenceI[][] seqs) { - super(alignPanel.getStructureSelectionManager(), viewer); + super(alignPanel.getStructureSelectionManager(), seqs, viewer); ap = alignPanel; - this.sequence = seqs; notifyFileLoaded(null, null, null, null, 0); } @@ -78,7 +78,7 @@ public class ExtJmol extends JalviewJmolBinding public FeatureRenderer getFeatureRenderer(AlignmentViewPanel alignment) { AlignmentPanel ap = (AlignmentPanel) alignment; - if (ap.av.showSequenceFeatures) + if (ap.av.isShowSequenceFeatures()) { return ap.getFeatureRenderer(); } @@ -125,8 +125,8 @@ public class ExtJmol extends JalviewJmolBinding public void refreshPdbEntries() { - Vector pdbe = new Vector(); - Hashtable fileids = new Hashtable(); + List pdbe = new ArrayList(); + List fileids = new ArrayList(); SequenceI[] sq = ap.av.getAlignment().getSequencesArray(); for (int s = 0; s < sq.length; s++) { @@ -136,18 +136,23 @@ public class ExtJmol extends JalviewJmolBinding for (int pe = 0, peSize = pdbids.size(); pe < peSize; pe++) { PDBEntry pentry = (PDBEntry) pdbids.elementAt(pe); - if (!fileids.containsKey(pentry.getId())) + if (!fileids.contains(pentry.getId())) { - pdbe.addElement(pentry); + pdbe.add(pentry); + } + else + { + fileids.add(pentry.getId()); } } } } - pdbentry = new PDBEntry[pdbe.size()]; + PDBEntry[] newEntries = new PDBEntry[pdbe.size()]; for (int pe = 0; pe < pdbe.size(); pe++) { - pdbentry[pe] = (PDBEntry) pdbe.elementAt(pe); + newEntries[pe] = pdbe.get(pe); } + setPdbentry(newEntries); } @Override @@ -172,19 +177,7 @@ public class ExtJmol extends JalviewJmolBinding protected void releaseUIResources() { ap = null; - if (console != null) - { - try - { - console.setVisible(false); - } catch (Error e) - { - } catch (Exception x) - { - } - ; - console = null; - } + closeConsole(); } diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index 32ffdbf..c87803c 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -73,10 +73,10 @@ public class FeatureColourChooser extends Panel implements ActionListener, { this.type = type; fr = frenderer; - float mm[] = ((float[][]) fr.minmax.get(type))[0]; + float mm[] = ((float[][]) fr.getMinMax().get(type))[0]; min = mm[0]; max = mm[1]; - oldcs = fr.featureColours.get(type); + oldcs = fr.getFeatureColours().get(type); if (oldcs instanceof GraduatedColor) { cs = new GraduatedColor((GraduatedColor) oldcs, min, max); @@ -130,7 +130,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, { // cancel reset(); - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId()); frame.setVisible(false); } } @@ -289,7 +289,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, threshline.value = (float) slider.getValue() / 1000f; cs.setThresh(threshline.value); changeColour(); - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId()); // ap.paintAlignment(false); } @@ -402,16 +402,16 @@ public class FeatureColourChooser extends Panel implements ActionListener, } } - fr.featureColours.put(type, acg); + fr.setColour(type, acg); cs = acg; - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId()); // ap.paintAlignment(false); } void reset() { - fr.featureColours.put(type, oldcs); - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + fr.setColour(type, oldcs); + PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId()); // ap.paintAlignment(true); } @@ -433,7 +433,7 @@ public class FeatureColourChooser extends Panel implements ActionListener, } else { - PaintRefresher.Refresh(this, fr.av.getSequenceSetId()); + PaintRefresher.Refresh(this, fr.getViewport().getSequenceSetId()); } // ap.paintAlignment(true); } diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 29c3ac5..dd2b873 100644 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -21,15 +21,14 @@ package jalview.appletgui; import java.util.*; - import java.awt.*; - import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; import jalview.util.MessageManager; +import jalview.viewmodel.seqfeatures.FeaturesDisplayed; /** * DOCUMENT ME! @@ -37,34 +36,13 @@ import jalview.util.MessageManager; * @author $author$ * @version $Revision$ */ -public class FeatureRenderer implements jalview.api.FeatureRenderer +public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRenderer { - AlignViewport av; - - Hashtable featureColours = new Hashtable(); - - // A higher level for grouping features of a - // particular type - Hashtable featureGroups = null; // Holds web links for feature groups and feature types // in the form label|link Hashtable featureLinks = null; - // This is actually an Integer held in the hashtable, - // Retrieved using the key feature type - Object currentColour; - - String[] renderOrder; - - FontMetrics fm; - - int charOffset; - - float transparency = 1f; - - TransparencySetter transparencySetter = null; - /** * Creates a new FeatureRenderer object. * @@ -73,39 +51,10 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer */ public FeatureRenderer(AlignViewport av) { + super(); this.av = av; - if (!System.getProperty("java.version").startsWith("1.1")) - { - transparencySetter = new TransparencySetter(); - } - } - - public void transferSettings(FeatureRenderer fr) - { - renderOrder = fr.renderOrder; - featureGroups = fr.featureGroups; - featureColours = fr.featureColours; - transparency = fr.transparency; - if (av != null && fr.av != null && fr.av != av) - { - if (fr.av.featuresDisplayed != null) - { - if (av.featuresDisplayed == null) - { - av.featuresDisplayed = new Hashtable(); - } - else - { - av.featuresDisplayed.clear(); - } - Enumeration en = fr.av.featuresDisplayed.keys(); - while (en.hasMoreElements()) - { - av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE); - } - } - } + setTransparencyAvailable(!System.getProperty("java.version").startsWith("1.1")); } static String lastFeatureAdded; @@ -452,6 +401,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer } ffile.parseDescriptionHTML(sf, false); + setVisible(lastFeatureAdded); // if user edited name then make sure new type is visible } if (deleteFeature) { @@ -472,36 +422,17 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer ffile.parseDescriptionHTML(features[i], false); } - if (av.featuresDisplayed == null) - { - av.featuresDisplayed = new Hashtable(); - } - - if (featureGroups == null) - { - featureGroups = new Hashtable(); - } - col = colourPanel.getBackground(); // setColour(lastFeatureAdded, fcol); if (lastFeatureGroupAdded != null) { - featureGroups.put(lastFeatureGroupAdded, new Boolean(true)); - } - if (fcol instanceof Color) - { - setColour(lastFeatureAdded, fcol); + setGroupVisibility(lastFeatureGroupAdded, true); } - av.featuresDisplayed.put(lastFeatureAdded, - getFeatureStyle(lastFeatureAdded)); - - findAllFeatures(); - - String[] tro = new String[renderOrder.length]; - tro[0] = renderOrder[renderOrder.length - 1]; - System.arraycopy(renderOrder, 0, tro, 1, renderOrder.length - 1); - renderOrder = tro; + setColour(lastFeatureAdded, fcol); + setVisible(lastFeatureAdded); + findAllFeatures(false); // different to original applet behaviour ? + // findAllFeatures(); } else { @@ -510,9 +441,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer } } // refresh the alignment and the feature settings dialog - if (av.featureSettings != null) + if (((jalview.appletgui.AlignViewport) av).featureSettings != null) { - av.featureSettings.refreshTable(); + ((jalview.appletgui.AlignViewport) av).featureSettings.refreshTable(); } // findAllFeatures(); @@ -520,759 +451,4 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer return true; } - - public Color findFeatureColour(Color initialCol, SequenceI seq, int i) - { - overview = true; - if (!av.showSequenceFeatures) - { - return initialCol; - } - - lastSeq = seq; - sequenceFeatures = lastSeq.getSequenceFeatures(); - if (sequenceFeatures == null) - { - return initialCol; - } - - sfSize = sequenceFeatures.length; - - if (jalview.util.Comparison.isGap(lastSeq.getCharAt(i))) - { - return Color.white; - } - - currentColour = null; - - drawSequence(null, lastSeq, lastSeq.findPosition(i), -1, -1); - - if (currentColour == null) - { - return initialCol; - } - - return new Color(((Integer) currentColour).intValue()); - } - - /** - * This is used by the Molecule Viewer to get the accurate colour of the - * rendered sequence - */ - boolean overview = false; - - /** - * DOCUMENT ME! - * - * @param g - * DOCUMENT ME! - * @param seq - * DOCUMENT ME! - * @param sg - * DOCUMENT ME! - * @param start - * DOCUMENT ME! - * @param end - * DOCUMENT ME! - * @param x1 - * DOCUMENT ME! - * @param y1 - * DOCUMENT ME! - * @param width - * DOCUMENT ME! - * @param height - * DOCUMENT ME! - */ - // String type; - // SequenceFeature sf; - SequenceI lastSeq; - - SequenceFeature[] sequenceFeatures; - - int sfSize, sfindex, spos, epos; - - synchronized public void drawSequence(Graphics g, SequenceI seq, - int start, int end, int y1) - { - if (seq.getSequenceFeatures() == null - || seq.getSequenceFeatures().length == 0) - { - return; - } - - if (transparencySetter != null && g != null) - { - transparencySetter.setTransparency(g, transparency); - } - - if (lastSeq == null || seq != lastSeq - || sequenceFeatures != seq.getSequenceFeatures()) - { - lastSeq = seq; - sequenceFeatures = seq.getSequenceFeatures(); - sfSize = sequenceFeatures.length; - } - - if (av.featuresDisplayed == null || renderOrder == null) - { - findAllFeatures(); - if (av.featuresDisplayed.size() < 1) - { - return; - } - - sequenceFeatures = seq.getSequenceFeatures(); - sfSize = sequenceFeatures.length; - } - if (!overview) - { - spos = lastSeq.findPosition(start); - epos = lastSeq.findPosition(end); - if (g != null) - { - fm = g.getFontMetrics(); - } - } - String type; - for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++) - { - type = renderOrder[renderIndex]; - if (!av.featuresDisplayed.containsKey(type)) - { - continue; - } - - // loop through all features in sequence to find - // current feature to render - for (sfindex = 0; sfindex < sfSize; sfindex++) - { - if (!sequenceFeatures[sfindex].type.equals(type)) - { - continue; - } - - if (featureGroups != null - && sequenceFeatures[sfindex].featureGroup != null - && featureGroups - .containsKey(sequenceFeatures[sfindex].featureGroup) - && !((Boolean) featureGroups - .get(sequenceFeatures[sfindex].featureGroup)) - .booleanValue()) - { - continue; - } - - if (!overview - && (sequenceFeatures[sfindex].getBegin() > epos || sequenceFeatures[sfindex] - .getEnd() < spos)) - { - continue; - } - - if (overview) - { - if (sequenceFeatures[sfindex].begin <= start - && sequenceFeatures[sfindex].end >= start) - { - currentColour = new Integer( - getColour(sequenceFeatures[sfindex]).getRGB());// av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type); - } - - } - else if (sequenceFeatures[sfindex].type.equals("disulfide bond")) - { - - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - getColour(sequenceFeatures[sfindex]) - // new Color(((Integer) av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type)).intValue()) - , start, end, y1); - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - getColour(sequenceFeatures[sfindex]) - // new Color(((Integer) av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type)).intValue()) - , start, end, y1); - - } - else - { - if (showFeature(sequenceFeatures[sfindex])) - { - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - getColour(sequenceFeatures[sfindex]), start, end, y1); - } - } - - } - } - - if (transparencySetter != null && g != null) - { - transparencySetter.setTransparency(g, 1.0f); - } - } - - char s; - - int i; - - void renderFeature(Graphics g, SequenceI seq, int fstart, int fend, - Color featureColour, int start, int end, int y1) - { - - if (((fstart <= end) && (fend >= start))) - { - if (fstart < start) - { // fix for if the feature we have starts before the sequence start, - fstart = start; // but the feature end is still valid!! - } - - if (fend >= end) - { - fend = end; - } - - for (i = fstart; i <= fend; i++) - { - s = seq.getCharAt(i); - - if (jalview.util.Comparison.isGap(s)) - { - continue; - } - - g.setColor(featureColour); - - g.fillRect((i - start) * av.charWidth, y1, av.charWidth, - av.charHeight); - - if (!av.validCharWidth) - { - continue; - } - - g.setColor(Color.white); - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - g.drawString(String.valueOf(s), charOffset - + (av.charWidth * (i - start)), (y1 + av.charHeight) - - av.charHeight / 5); // pady = height / 5; - - } - } - } - - Hashtable minmax = null; - - /** - * Called when alignment in associated view has new/modified features to - * discover and display. - * - */ - public void featuresAdded() - { - lastSeq = null; - findAllFeatures(); - } - - /** - * find all features on the alignment - */ - void findAllFeatures() - { - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); - - av.featuresDisplayed = new Hashtable(); - Vector allfeatures = new Vector(); - minmax = new Hashtable(); - AlignmentI alignment = av.getAlignment(); - for (int i = 0; i < alignment.getHeight(); i++) - { - SequenceFeature[] features = alignment.getSequenceAt(i) - .getSequenceFeatures(); - - if (features == null) - { - continue; - } - - int index = 0; - while (index < features.length) - { - if (features[index].begin == 0 && features[index].end == 0) - { - index++; - continue; - } - if (!av.featuresDisplayed.containsKey(features[index].getType())) - { - if (getColour(features[index].getType()) == null) - { - featureColours.put(features[index].getType(), - ucs.createColourFromName(features[index].getType())); - } - - av.featuresDisplayed.put(features[index].getType(), new Integer( - getColour(features[index].getType()).getRGB())); - allfeatures.addElement(features[index].getType()); - } - if (features[index].score != Float.NaN) - { - int nonpos = features[index].getBegin() >= 1 ? 0 : 1; - float[][] mm = (float[][]) minmax.get(features[index].getType()); - if (mm == null) - { - mm = new float[][] - { null, null }; - minmax.put(features[index].getType(), mm); - } - if (mm[nonpos] == null) - { - mm[nonpos] = new float[] - { features[index].score, features[index].score }; - - } - else - { - if (mm[nonpos][0] > features[index].score) - { - mm[nonpos][0] = features[index].score; - } - if (mm[nonpos][1] < features[index].score) - { - mm[nonpos][1] = features[index].score; - } - } - } - - index++; - } - } - - renderOrder = new String[allfeatures.size()]; - Enumeration en = allfeatures.elements(); - int i = allfeatures.size() - 1; - while (en.hasMoreElements()) - { - renderOrder[i] = en.nextElement().toString(); - i--; - } - } - - /** - * get a feature style object for the given type string. Creates a - * java.awt.Color for a featureType with no existing colourscheme. TODO: - * replace return type with object implementing standard abstract colour/style - * interface - * - * @param featureType - * @return java.awt.Color or GraduatedColor - */ - public Object getFeatureStyle(String featureType) - { - Object fc = featureColours.get(featureType); - if (fc == null) - { - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); - Color col = ucs.createColourFromName(featureType); - featureColours.put(featureType, fc = col); - } - return fc; - } - - public Color getColour(String featureType) - { - Object fc = getFeatureStyle(featureType); - - if (fc instanceof Color) - { - return (Color) fc; - } - else - { - if (fc instanceof GraduatedColor) - { - return ((GraduatedColor) fc).getMaxColor(); - } - } - throw new Error(MessageManager.formatMessage("error.implementation_error_unrecognised_render_object_for_features_type", new String[]{fc.getClass().getCanonicalName(),featureType})); - } - - /** - * - * @param sequenceFeature - * @return true if feature is visible. - */ - private boolean showFeature(SequenceFeature sequenceFeature) - { - Object fc = getFeatureStyle(sequenceFeature.type); - if (fc instanceof GraduatedColor) - { - return ((GraduatedColor) fc).isColored(sequenceFeature); - } - else - { - return true; - } - } - - /** - * implement graduated colouring for features with scores - * - * @param feature - * @return render colour for the given feature - */ - public Color getColour(SequenceFeature feature) - { - Object fc = getFeatureStyle(feature.getType()); - if (fc instanceof Color) - { - return (Color) fc; - } - else - { - if (fc instanceof GraduatedColor) - { - return ((GraduatedColor) fc).findColor(feature); - } - } - throw new Error("Implementation Error: Unrecognised render object " - + fc.getClass() + " for features of type " + feature.getType()); - } - - public void setColour(String featureType, Object col) - { - // overwrite - // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof - // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null; - // Object c = featureColours.get(featureType); - // if (c == null || c instanceof Color || (c instanceof GraduatedColor && - // !((GraduatedColor)c).getMaxColor().equals(_col))) - { - featureColours.put(featureType, col); - } - } - - public void setFeaturePriority(Object[][] data) - { - // The feature table will display high priority - // features at the top, but theses are the ones - // we need to render last, so invert the data - if (av.featuresDisplayed != null) - { - av.featuresDisplayed.clear(); - } - - /* - * if (visibleNew) { if (av.featuresDisplayed != null) { - * av.featuresDisplayed.clear(); } else { av.featuresDisplayed = new - * Hashtable(); } } if (data == null) { return; } - */ - - renderOrder = new String[data.length]; - - if (data.length > 0) - { - for (int i = 0; i < data.length; i++) - { - String type = data[i][0].toString(); - setColour(type, data[i][1]); - if (((Boolean) data[i][2]).booleanValue()) - { - av.featuresDisplayed.put(type, new Integer(getColour(type) - .getRGB())); - } - - renderOrder[data.length - i - 1] = type; - } - } - } - - /** - * @return a simple list of feature group names or null - */ - public String[] getGroups() - { - buildGroupHash(); - if (featureGroups != null) - { - String[] gps = new String[featureGroups.size()]; - Enumeration gn = featureGroups.keys(); - int i = 0; - while (gn.hasMoreElements()) - { - gps[i++] = (String) gn.nextElement(); - } - return gps; - } - return null; - } - - /** - * get visible or invisible groups - * - * @param visible - * true to return visible groups, false to return hidden ones. - * @return list of groups - */ - public String[] getGroups(boolean visible) - { - buildGroupHash(); - if (featureGroups != null) - { - Vector gp = new Vector(); - - Enumeration gn = featureGroups.keys(); - while (gn.hasMoreElements()) - { - String nm = (String) gn.nextElement(); - Boolean state = (Boolean) featureGroups.get(nm); - if (state.booleanValue() == visible) - { - gp.addElement(nm); - } - } - String[] gps = new String[gp.size()]; - gp.copyInto(gps); - - int i = 0; - while (gn.hasMoreElements()) - { - gps[i++] = (String) gn.nextElement(); - } - return gps; - } - return null; - } - - /** - * set all feature groups in toset to be visible or invisible - * - * @param toset - * group names - * @param visible - * the state of the named groups to set - */ - public void setGroupState(String[] toset, boolean visible) - { - buildGroupHash(); - if (toset != null && toset.length > 0 && featureGroups != null) - { - boolean rdrw = false; - for (int i = 0; i < toset.length; i++) - { - Object st = featureGroups.get(toset[i]); - featureGroups.put(toset[i], new Boolean(visible)); - if (st != null) - { - rdrw = rdrw || (visible != ((Boolean) st).booleanValue()); - } - } - if (rdrw) - { - if (this.av != null) - if (this.av.featureSettings != null) - { - av.featureSettings.rebuildGroups(); - this.av.featureSettings.resetTable(true); - } - else - { - buildFeatureHash(); - } - if (av != null) - { - av.alignmentChanged(null); - } - } - } - } - - ArrayList hiddenGroups = new ArrayList(); - - /** - * analyse alignment for groups and hash tables (used to be embedded in - * FeatureSettings.setTableData) - * - * @return true if features are on the alignment - */ - public boolean buildGroupHash() - { - boolean alignmentHasFeatures = false; - if (featureGroups == null) - { - featureGroups = new Hashtable(); - } - hiddenGroups = new ArrayList(); - hiddenGroups.addAll(featureGroups.keySet()); - ArrayList allFeatures = new ArrayList(); - ArrayList allGroups = new ArrayList(); - SequenceFeature[] tmpfeatures; - String group; - AlignmentI alignment = av.getAlignment(); - for (int i = 0; i < alignment.getHeight(); i++) - { - if (alignment.getSequenceAt(i).getSequenceFeatures() == null) - { - continue; - } - - alignmentHasFeatures = true; - - tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures(); - int index = 0; - while (index < tmpfeatures.length) - { - if (tmpfeatures[index].getFeatureGroup() != null) - { - group = tmpfeatures[index].featureGroup; - // Remove group from the hiddenGroup list - hiddenGroups.remove(group); - if (!allGroups.contains(group)) - { - allGroups.add(group); - - boolean visible = true; - if (featureGroups.containsKey(group)) - { - visible = ((Boolean) featureGroups.get(group)).booleanValue(); - } - else - { - featureGroups.put(group, new Boolean(visible)); - } - } - } - - if (!allFeatures.contains(tmpfeatures[index].getType())) - { - allFeatures.add(tmpfeatures[index].getType()); - } - index++; - } - } - - return alignmentHasFeatures; - } - - /** - * rebuild the featuresDisplayed and renderorder list based on the - * featureGroups hash and any existing display state and force a repaint if - * necessary - * - * @return true if alignment has visible features - */ - public boolean buildFeatureHash() - { - boolean alignmentHasFeatures = false; - if (featureGroups == null) - { - alignmentHasFeatures = buildGroupHash(); - } - if (!alignmentHasFeatures) - return false; - Hashtable fdisp = av.featuresDisplayed; - Vector allFeatures = new Vector(); - SequenceFeature[] tmpfeatures; - String group; - AlignmentI alignment = av.getAlignment(); - for (int i = 0; i < alignment.getHeight(); i++) - { - if (alignment.getSequenceAt(i).getSequenceFeatures() == null) - { - continue; - } - - alignmentHasFeatures = true; - - tmpfeatures = alignment.getSequenceAt(i).getSequenceFeatures(); - int index = 0; - while (index < tmpfeatures.length) - { - boolean visible = true; - if (tmpfeatures[index].getFeatureGroup() != null) - { - group = tmpfeatures[index].featureGroup; - if (featureGroups.containsKey(group)) - { - visible = ((Boolean) featureGroups.get(group)).booleanValue(); - } - } - - if (visible && !allFeatures.contains(tmpfeatures[index].getType())) - { - allFeatures.addElement(tmpfeatures[index].getType()); - } - index++; - } - } - if (allFeatures.size() > 0) - { - String[] neworder = new String[allFeatures.size()]; - int p = neworder.length - 1; - for (int i = renderOrder.length - 1; i >= 0; i--) - { - if (allFeatures.contains(renderOrder[i])) - { - neworder[p--] = renderOrder[i]; - allFeatures.removeElement(renderOrder[i]); - } - else - { - av.featuresDisplayed.remove(renderOrder[i]); - } - } - for (int i = allFeatures.size() - 1; i > 0; i++) - { - Object e = allFeatures.elementAt(i); - if (e != null) - { - neworder[p--] = (String) e; - av.featuresDisplayed.put(e, getColour((String) e)); - } - } - renderOrder = neworder; - return true; - } - - return alignmentHasFeatures; - } - - /** - * - * @return the displayed feature type as an array of strings - */ - protected String[] getDisplayedFeatureTypes() - { - String[] typ = null; - synchronized (renderOrder) - { - typ = new String[renderOrder.length]; - System.arraycopy(renderOrder, 0, typ, 0, typ.length); - for (int i = 0; i < typ.length; i++) - { - if (av.featuresDisplayed.get(typ[i]) == null) - { - typ[i] = null; - } - } - } - return typ; - } -} - -class TransparencySetter -{ - void setTransparency(Graphics g, float value) - { - Graphics2D g2 = (Graphics2D) g; - g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, - value)); - } } diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index cd11a35..4b29f53 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -21,7 +21,7 @@ package jalview.appletgui; import java.util.*; - +import java.util.List; import java.awt.*; import java.awt.event.*; @@ -50,8 +50,6 @@ public class FeatureSettings extends Panel implements ItemListener, ScrollPane scrollPane; - boolean alignmentHasFeatures = false; - Image linkImage; Scrollbar transparency; @@ -64,9 +62,9 @@ public class FeatureSettings extends Panel implements ItemListener, fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); transparency = new Scrollbar(Scrollbar.HORIZONTAL, - 100 - (int) (fr.transparency * 100), 1, 1, 100); + 100 - (int) (fr.getTransparency() * 100), 1, 1, 100); - if (fr.transparencySetter != null) + if (fr.isTransparencyAvailable()) { transparency.addAdjustmentListener(this); } @@ -81,9 +79,9 @@ public class FeatureSettings extends Panel implements ItemListener, linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url); } - if (av.featuresDisplayed == null) + if (av.isShowSequenceFeatures() || !fr.hasRenderOrder()) { - fr.findAllFeatures(); + fr.findAllFeatures(true); // was default - now true to make all visible } setTableData(); @@ -91,7 +89,7 @@ public class FeatureSettings extends Panel implements ItemListener, this.setLayout(new BorderLayout()); scrollPane = new ScrollPane(); scrollPane.add(featurePanel); - if (alignmentHasFeatures) + if (fr.getAllFeatureColours()!=null && fr.getAllFeatureColours().size()>0) { add(scrollPane, BorderLayout.CENTER); } @@ -104,7 +102,7 @@ public class FeatureSettings extends Panel implements ItemListener, Panel tPanel = new Panel(new BorderLayout()); - if (fr.transparencySetter != null) + if (fr.isTransparencyAvailable()) { tPanel.add(transparency, BorderLayout.CENTER); tPanel.add(new Label("Transparency"), BorderLayout.EAST); @@ -124,8 +122,8 @@ public class FeatureSettings extends Panel implements ItemListener, { groupPanel .setLayout(new GridLayout( - (fr.featureGroups.size() - fr.hiddenGroups.size()) / 4 + 1, - 4)); + (fr.getFeatureGroupsSize()) / 4 + 1, + 4)); // JBPNote - this was scaled on number of visible groups. seems broken groupPanel.validate(); add(groupPanel, BorderLayout.NORTH); @@ -185,7 +183,7 @@ public class FeatureSettings extends Panel implements ItemListener, public void actionPerformed(ActionEvent e) { - me.sortByScore(new String[] + me.ap.alignFrame.avc.sortAlignmentByFeatureScore(new String[] { type }); } @@ -197,7 +195,7 @@ public class FeatureSettings extends Panel implements ItemListener, public void actionPerformed(ActionEvent e) { - me.sortByDens(new String[] + me.ap.alignFrame.avc.sortAlignmentByFeatureDensity(new String[] { type }); } @@ -253,8 +251,7 @@ public class FeatureSettings extends Panel implements ItemListener, public void setTableData() { - alignmentHasFeatures = fr.buildGroupHash(); - if (alignmentHasFeatures) + if (fr.getAllFeatureColours()!=null && fr.getAllFeatureColours().size()>0) { rebuildGroups(); @@ -279,18 +276,17 @@ public class FeatureSettings extends Panel implements ItemListener, } // TODO: JAL-964 - smoothly incorporate new group entries if panel already // displayed and new groups present - Enumeration gps = fr.featureGroups.keys(); - while (gps.hasMoreElements()) + for (String group:(List)fr.getFeatureGroups()) { - String group = (String) gps.nextElement(); - Boolean vis = (Boolean) fr.featureGroups.get(group); - Checkbox check = new MyCheckbox(group, vis.booleanValue(), + boolean vis = fr.checkGroupVisibility(group, false); + Checkbox check = new MyCheckbox(group, vis, (fr.featureLinks != null && fr.featureLinks .containsKey(group))); check.addMouseListener(this); check.setFont(new Font("Serif", Font.BOLD, 12)); - check.addItemListener(this); - check.setVisible(fr.hiddenGroups.contains(group)); + check.addItemListener(groupItemListener); + // note - visibility seems to correlate with displayed. ???wtf ?? + check.setVisible(vis); groupPanel.add(check); } if (rdrw) @@ -298,7 +294,6 @@ public class FeatureSettings extends Panel implements ItemListener, groupPanel.validate(); } } - // This routine adds and removes checkboxes depending on // Group selection states void resetTable(boolean groupsChanged) @@ -320,8 +315,7 @@ public class FeatureSettings extends Panel implements ItemListener, { group = tmpfeatures[index].featureGroup; - if (group == null || fr.featureGroups.get(group) == null - || ((Boolean) fr.featureGroups.get(group)).booleanValue()) + if (group == null || fr.checkGroupVisibility(group, true)) { type = tmpfeatures[index].getType(); if (!visibleChecks.contains(type)) @@ -350,13 +344,14 @@ public class FeatureSettings extends Panel implements ItemListener, } } - if (fr.renderOrder != null) + if (fr.getRenderOrder() != null) { // First add the checks in the previous render order, // in case the window has been closed and reopened - for (int ro = fr.renderOrder.length - 1; ro > -1; ro--) + List rol = fr.getRenderOrder(); + for (int ro = rol.size() - 1; ro > -1; ro--) { - String item = fr.renderOrder[ro]; + String item = rol.get(ro); if (!visibleChecks.contains(item)) { @@ -418,7 +413,7 @@ public class FeatureSettings extends Panel implements ItemListener, if (addCheck) { boolean selected = false; - if (groupsChanged || av.featuresDisplayed.containsKey(type)) + if (groupsChanged || av.getFeaturesDisplayed().isVisible(type)) { selected = true; } @@ -455,26 +450,22 @@ public class FeatureSettings extends Panel implements ItemListener, selectionChanged(); } - public void itemStateChanged(ItemEvent evt) - { - if (evt != null) - { - // Is the source a top level featureGroup? + private ItemListener groupItemListener = new ItemListener() { + public void itemStateChanged(ItemEvent evt) { Checkbox source = (Checkbox) evt.getSource(); - if (fr.featureGroups.containsKey(source.getLabel())) + fr.setGroupVisibility(source.getLabel(), + source.getState()); + ap.seqPanel.seqCanvas.repaint(); + if (ap.overviewPanel != null) { - fr.featureGroups.put(source.getLabel(), - new Boolean(source.getState())); - ap.seqPanel.seqCanvas.repaint(); - if (ap.overviewPanel != null) - { - ap.overviewPanel.updateOverviewImage(); - } - - resetTable(true); - return; + ap.overviewPanel.updateOverviewImage(); } - } + resetTable(true); + return; + }; + }; + public void itemStateChanged(ItemEvent evt) + { selectionChanged(); } @@ -617,7 +608,7 @@ public class FeatureSettings extends Panel implements ItemListener, MyCheckbox check = (MyCheckbox) evt.getSource(); if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { - this.popupSort(check, fr.minmax, evt.getX(), evt.getY()); + this.popupSort(check, fr.getMinMax(), evt.getX(), evt.getY()); } if (fr.featureLinks != null && fr.featureLinks.containsKey(check.type)) { @@ -657,7 +648,7 @@ public class FeatureSettings extends Panel implements ItemListener, public void adjustmentValueChanged(AdjustmentEvent evt) { - fr.transparency = ((float) (100 - transparency.getValue()) / 100f); + fr.setTransparency((float) (100 - transparency.getValue()) / 100f); ap.seqPanel.seqCanvas.repaint(); } @@ -771,81 +762,4 @@ public class FeatureSettings extends Panel implements ItemListener, } } - protected void sortByDens(String[] typ) - { - sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY); - } - - private String[] getDisplayedFeatureTypes() - { - String[] typ = null; - if (fr != null) - { - synchronized (fr.renderOrder) - { - typ = new String[fr.renderOrder.length]; - System.arraycopy(fr.renderOrder, 0, typ, 0, typ.length); - for (int i = 0; i < typ.length; i++) - { - if (av.featuresDisplayed.get(typ[i]) == null) - { - typ[i] = null; - } - } - } - } - return typ; - } - - protected void sortBy(String[] typ, String methodText, final String method) - { - if (typ == null) - { - typ = getDisplayedFeatureTypes(); - } - String gps[] = null; - gps = fr.getGroups(true); - if (typ != null) - { - for (int i = 0; i < typ.length; i++) - { - System.err.println("Sorting on Types:" + typ[i]); - } - } - if (gps != null) - { - - for (int i = 0; i < gps.length; i++) - { - System.err.println("Sorting on groups:" + gps[i]); - } - } - AlignmentPanel alignPanel = ap; - AlignmentI al = alignPanel.av.getAlignment(); - - int start, stop; - SequenceGroup sg = alignPanel.av.getSelectionGroup(); - if (sg != null) - { - start = sg.getStartRes(); - stop = sg.getEndRes(); - } - else - { - start = 0; - stop = al.getWidth(); - } - SequenceI[] oldOrder = al.getSequencesArray(); - AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method); - this.ap.alignFrame.addHistoryItem(new OrderCommand(methodText, - oldOrder, alignPanel.av.getAlignment())); - alignPanel.paintAlignment(true); - - } - - protected void sortByScore(String[] typ) - { - sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE); - } - } diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index 529b0b3..e168644 100644 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -126,7 +126,7 @@ public class Finder extends Panel implements ActionListener features, true, ap)) { ap.alignFrame.sequenceFeatures.setState(true); - av.showSequenceFeatures(true); + av.setShowSequenceFeatures(true); ap.highlightSearchResults(null); } } diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 25aa315..0ac4e55 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -227,7 +227,7 @@ public class IdCanvas extends Panel SequenceI s = av.getAlignment().getSequenceAt(i); gg.setFont(italic); - if (av.hasHiddenRows()) + if (av.isDisplayReferenceSeq() || av.hasHiddenRows()) { setHiddenFont(s); } @@ -257,7 +257,7 @@ public class IdCanvas extends Panel } gg.setFont(italic); // boolean isrep=false; - if (av.hasHiddenRows()) + if (av.isDisplayReferenceSeq() || av.hasHiddenRows()) { // isrep = setHiddenFont(seq); @@ -366,8 +366,7 @@ public class IdCanvas extends Panel Font bold = new Font(av.getFont().getName(), Font.BOLD, av.getFont() .getSize()); - if (av.getHiddenRepSequences() != null - && av.getHiddenRepSequences().containsKey(seq)) + if (av.isHiddenRepSequence(seq)) { gg.setFont(bold); return true; diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 2c2c41a..8486fe0 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -69,7 +69,6 @@ public class OverviewPanel extends Panel implements Runnable, sr.renderGaps = false; sr.forOverview = true; fr = new FeatureRenderer(av); - fr.overview = true; // scale the initial size of overviewpanel to shape of alignment float initialScale = (float) av.getAlignment().getWidth() @@ -229,10 +228,9 @@ public class OverviewPanel extends Panel implements Runnable, return; } - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { - fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups; - fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours; + fr.transferSettings(ap.seqPanel.seqCanvas.fr); } resizing = true; @@ -260,7 +258,7 @@ public class OverviewPanel extends Panel implements Runnable, int alwidth = av.getAlignment().getWidth(); int alheight = av.getAlignment().getHeight(); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); } @@ -337,7 +335,7 @@ public class OverviewPanel extends Panel implements Runnable, { color = sr.getResidueBoxColour(seq, lastcol); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { color = fr.findFeatureColour(color, seq, lastcol); } diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index 60d89aa..2b6f37a 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -20,12 +20,23 @@ */ package jalview.appletgui; -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceGroup; import jalview.util.MessageManager; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + public class ScalePanel extends Panel implements MouseMotionListener, MouseListener { @@ -97,7 +108,7 @@ public class ScalePanel extends Panel implements MouseMotionListener, }); pop.add(item); - if (av.getColumnSelection().getHiddenColumns().size() > 1) + if (av.getColumnSelection().hasManyHiddenColumns()) { item = new MenuItem(MessageManager.getString("action.reveal_all")); item.addActionListener(new ActionListener() @@ -323,10 +334,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, res = av.getColumnSelection().adjustForHiddenColumns(res); reveal = null; - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - int[] region = (int[]) av.getColumnSelection().getHiddenColumns() - .elementAt(i); if (res + 1 == region[0] || res - 1 == region[1]) { reveal = region; @@ -407,18 +416,18 @@ public class ScalePanel extends Panel implements MouseMotionListener, } gg.drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + 2, - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + (fm.getDescent() * 2)); } else { gg.drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + fm.getDescent(), - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + (fm.getDescent() * 2)); } } diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 33caf53..3d1f7e2 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -20,9 +20,16 @@ */ package jalview.appletgui; -import java.awt.*; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; -import jalview.datamodel.*; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Panel; public class SeqCanvas extends Panel { @@ -510,49 +517,52 @@ public class SeqCanvas extends Panel void drawPanel(Graphics g1, int startRes, int endRes, int startSeq, int endSeq, int offset) { + + if (!av.hasHiddenColumns()) { draw(g1, startRes, endRes, startSeq, endSeq, offset); } else { - java.util.Vector regions = av.getColumnSelection().getHiddenColumns(); int screenY = 0; int blockStart = startRes; int blockEnd = endRes; - for (int i = 0; i < regions.size(); i++) + if (av.hasHiddenColumns()) { - int[] region = (int[]) regions.elementAt(i); - int hideStart = region[0]; - int hideEnd = region[1]; - - if (hideStart <= blockStart) + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - blockStart += (hideEnd - hideStart) + 1; - continue; - } + int hideStart = region[0]; + int hideEnd = region[1]; - blockEnd = hideStart - 1; + if (hideStart <= blockStart) + { + blockStart += (hideEnd - hideStart) + 1; + continue; + } - g1.translate(screenY * av.charWidth, 0); + blockEnd = hideStart - 1; - draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); + g1.translate(screenY * av.charWidth, 0); - if (av.getShowHiddenMarkers()) - { - g1.setColor(Color.blue); - g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1, - 0 + offset, (blockEnd - blockStart + 1) * av.charWidth - - 1, (endSeq - startSeq) * av.charHeight + offset); - } + draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); - g1.translate(-screenY * av.charWidth, 0); - screenY += blockEnd - blockStart + 1; - blockStart = hideEnd + 1; - } + if (av.getShowHiddenMarkers()) + { + g1.setColor(Color.blue); + g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1, + 0 + offset, (blockEnd - blockStart + 1) * av.charWidth + - 1, (endSeq - startSeq) * av.charHeight + + offset); + } + g1.translate(-screenY * av.charWidth, 0); + screenY += blockEnd - blockStart + 1; + blockStart = hideEnd + 1; + } + } if (screenY <= (endRes - startRes)) { blockEnd = blockStart + (endRes - startRes) - screenY; @@ -589,7 +599,7 @@ public class SeqCanvas extends Panel sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq), startRes, endRes, offset + ((i - startSeq) * av.charHeight)); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { fr.drawSequence(g, nextSeq, startRes, endRes, offset + ((i - startSeq) * av.charHeight)); @@ -646,7 +656,7 @@ public class SeqCanvas extends Panel if ((group == null) && (av.getAlignment().getGroups().size() > 0)) { - group = (SequenceGroup) av.getAlignment().getGroups().get(0); + group = av.getAlignment().getGroups().get(0); groupIndex = 0; } @@ -803,7 +813,7 @@ public class SeqCanvas extends Panel break; } - group = (SequenceGroup) av.getAlignment().getGroups() + group = av.getAlignment().getGroups() .get(groupIndex); } while (groupIndex < av.getAlignment().getGroups().size()); diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 592fd4f..a95dd27 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -817,18 +817,14 @@ public class SeqPanel extends Panel implements MouseMotionListener, { for (int i = 0; i < features.length; i++) { - if (av.featuresDisplayed == null - || !av.featuresDisplayed.containsKey(features[i].getType())) + if (av.getFeaturesDisplayed() == null + || !av.getFeaturesDisplayed().isVisible(features[i].getType())) { continue; } if (features[i].featureGroup != null - && seqCanvas.fr.featureGroups != null - && seqCanvas.fr.featureGroups - .containsKey(features[i].featureGroup) - && !((Boolean) seqCanvas.fr.featureGroups - .get(features[i].featureGroup)).booleanValue()) + && !seqCanvas.fr.checkGroupVisibility(features[i].featureGroup,false)) { continue; } diff --git a/src/jalview/appletgui/SequenceRenderer.java b/src/jalview/appletgui/SequenceRenderer.java index 697c0d1..9badf43 100755 --- a/src/jalview/appletgui/SequenceRenderer.java +++ b/src/jalview/appletgui/SequenceRenderer.java @@ -20,6 +20,7 @@ */ package jalview.appletgui; +import jalview.api.FeatureRenderer; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -86,6 +87,31 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer return resBoxColour; } + /** + * Get the residue colour at the given sequence position - as determined by + * the sequence group colour (if any), else the colour scheme, possibly + * overridden by a feature colour. + * + * @param seq + * @param position + * @param fr + * @return + */ + @Override + public Color getResidueColour(final SequenceI seq, int position, + FeatureRenderer fr) + { + // TODO replace 8 or so code duplications with calls to this method + // (refactored as needed) + Color col = getResidueBoxColour(seq, position); + + if (fr != null) + { + col = fr.findFeatureColour(col, seq, position); + } + return col; + } + void getBoxColour(ColourSchemeI cs, SequenceI seq, int i) { if (cs != null) @@ -204,7 +230,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } char s = ' '; - + boolean srep = av.isDisplayReferenceSeq(); for (int i = start; i <= end; i++) { graphics.setColor(Color.black); @@ -229,9 +255,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } if (currentSequenceGroup.getShowNonconserved()) { - // cheat - use this if we have a consensus for each group: s = - // getDisplayChar(currentSequenceGroup.getConsensus(), i, s, '.'); - s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, + s = getDisplayChar(srep, i, s, '.'); } } @@ -256,7 +280,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } if (av.getShowUnconserved()) { - s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, + s = getDisplayChar(srep, i, s, '.'); } @@ -289,10 +313,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } - private char getDisplayChar(AlignmentAnnotation consensus, int position, + private char getDisplayChar(final boolean usesrep, int position, char s, char c) { - char conschar = consensus.annotations[position].displayCharacter + // TODO - use currentSequenceGroup rather than alignemnt + // currentSequenceGroup.getConsensus() + char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter .charAt(0); if (conschar != '-' && s == conschar) { diff --git a/src/jalview/appletgui/TitledPanel.java b/src/jalview/appletgui/TitledPanel.java new file mode 100644 index 0000000..1ae36f4 --- /dev/null +++ b/src/jalview/appletgui/TitledPanel.java @@ -0,0 +1,75 @@ +package jalview.appletgui; + +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Label; +import java.awt.Panel; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class TitledPanel extends Panel +{ + + private String title; + + private Insets insets = new Insets(10, 10, 10, 10); + + public TitledPanel() + { + this(""); + } + + public TitledPanel(String title) + { + this.setTitle(title); + } + + public Insets getInsets() + { + return insets; + } + + public void paint(Graphics g) + { + super.paint(g); + g.setColor(getForeground()); + g.drawRect(5, 5, getWidth() - 10, getHeight() - 10); + int width = g.getFontMetrics().stringWidth(getTitle()); + g.setColor(getBackground()); + g.fillRect(10, 0, width, 10); + g.setColor(getForeground()); + g.drawString(getTitle(), 10, 10); + } + + public static void main(String[] args) + { + Frame f = new Frame("TitledPanel Tester"); + + TitledPanel p = new TitledPanel("Title of Panel"); + p.add(new Label("Label 1")); + p.add(new Label("Label 2")); + p.add(new Label("Label 3")); + f.add(p); + + f.addWindowListener(new WindowAdapter() + { + public void windowClosing(WindowEvent e) + { + System.exit(0); + } + }); + f.setBounds(300, 300, 300, 300); + f.setVisible(true); + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } +} \ No newline at end of file diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index b7c766a..655e182 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -20,14 +20,29 @@ */ package jalview.appletgui; -import java.awt.*; -import java.awt.event.*; - -import jalview.analysis.*; -import jalview.datamodel.*; -import jalview.io.*; +import jalview.analysis.NJTree; +import jalview.api.analysis.ScoreModelI; +import jalview.api.analysis.ViewBasedAnalysisI; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceI; +import jalview.io.NewickFile; +import jalview.schemes.ResidueProperties; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.CheckboxMenuItem; +import java.awt.Color; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.ScrollPane; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + public class TreePanel extends EmbmenuFrame implements ActionListener, ItemListener { @@ -204,8 +219,8 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, { int start, end; SequenceI[] seqs; - boolean selview = (av.getSelectionGroup() != null) - && (av.getSelectionGroup().getSize() > 1); + boolean selview = av.getSelectionGroup() != null + && av.getSelectionGroup().getSize() > 1; AlignmentView seqStrings = av.getAlignmentView(selview); if (!selview) { @@ -220,8 +235,27 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, seqs = av.getSelectionGroup().getSequencesInOrder( av.getAlignment()); } - - tree = new NJTree(seqs, seqStrings, type, pwtype, start, end); + ScoreModelI sm = ResidueProperties.getScoreModel(pwtype); + if (sm instanceof ViewBasedAnalysisI) + { + try + { + sm = sm.getClass().newInstance(); + ((ViewBasedAnalysisI) sm) + .configureFromAlignmentView(treeCanvas.ap); + } catch (Exception q) + { + System.err.println("Couldn't create a scoremodel instance for " + + sm.getName()); + q.printStackTrace(); + } + tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end); + } + else + { + tree = new NJTree(seqs, seqStrings, type, pwtype, null, start, + end); + } } tree.reCount(tree.getTopNode()); diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index ff1b180..50e3559 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -22,6 +22,7 @@ package jalview.bin; import jalview.gui.AlignFrame; import jalview.gui.Desktop; +import jalview.io.HtmlSvgOutput; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -397,6 +398,10 @@ public class Jalview { af.getViewport().setSortByTree(true); } + if (aparser.contains("no-annotation")) + { + af.getViewport().setShowAnnotation(false); + } if (aparser.contains("nosortbytree")) { af.getViewport().setSortByTree(false); @@ -484,6 +489,14 @@ public class Jalview System.out.println("Creating SVG image: " + file); continue; } + else if (format.equalsIgnoreCase("html")) + { + File imageFile = new java.io.File(file); + imageName = imageFile.getName(); + new HtmlSvgOutput(new java.io.File(file), af.alignPanel); + System.out.println("Creating HTML image: " + file); + continue; + } else if (format.equalsIgnoreCase("imgMap")) { af.createImageMap(new java.io.File(file), imageName); @@ -615,6 +628,8 @@ public class Jalview + "-blc FILE\tCreate alignment file FILE in BLC format.\n" + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" + "-png FILE\tCreate PNG image FILE from alignment.\n" + + "-svg FILE\tCreate SVG image FILE from alignment.\n" + + "-html FILE\tCreate HTML file from alignment.\n" + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n" + "-eps FILE\tCreate EPS file FILE from alignment.\n" + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n" diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index ae8bc98..e022c73 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -709,8 +709,8 @@ public class JalviewLite extends Applet implements */ public void loadAnnotationFrom(AlignFrame alf, String annotation) { - if (new AnnotationFile().readAnnotationFile(alf.getAlignViewport() - .getAlignment(), annotation, AppletFormatAdapter.PASTE)) + if (new AnnotationFile().annotateAlignmentView(alf.getAlignViewport(), + annotation, AppletFormatAdapter.PASTE)) { alf.alignPanel.fontChanged(); alf.alignPanel.setScrollValues(0, 0); @@ -1990,7 +1990,7 @@ public class JalviewLite extends Applet implements param = applet.getParameter("showFeatureSettings"); if (param != null && param.equalsIgnoreCase("true")) { - newAlignFrame.viewport.showSequenceFeatures(true); + newAlignFrame.viewport.setShowSequenceFeatures(true); new FeatureSettings(newAlignFrame.alignPanel); } @@ -1999,8 +1999,8 @@ public class JalviewLite extends Applet implements { param = setProtocolState(param); - if (new AnnotationFile().readAnnotationFile( - newAlignFrame.viewport.getAlignment(), param, protocol)) + if (new AnnotationFile().annotateAlignmentView( + newAlignFrame.viewport, param, protocol)) { newAlignFrame.alignPanel.fontChanged(); newAlignFrame.alignPanel.setScrollValues(0, 0); @@ -2024,6 +2024,12 @@ public class JalviewLite extends Applet implements param, protocol); JnetAnnotationMaker.add_annotation(predictions, newAlignFrame.viewport.getAlignment(), 0, false); // false==do + SequenceI repseq = newAlignFrame.viewport.getAlignment() + .getSequenceAt(0); + newAlignFrame.viewport.getAlignment().setSeqrep(repseq); + ColumnSelection cs = new ColumnSelection(); + cs.hideInsertionsFor(repseq); + newAlignFrame.viewport.setColumnSelection(cs); // not // add // sequence diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index dbc3524..4d734c7 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -20,16 +20,14 @@ */ package jalview.controller; -import java.awt.Color; -import java.util.BitSet; -import java.util.List; - +import jalview.analysis.AlignmentSorter; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; +import jalview.commands.OrderCommand; import jalview.datamodel.AlignmentI; -import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceFeature; @@ -37,6 +35,11 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; +import java.awt.Color; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; + public class AlignViewController implements AlignViewControllerI { AlignViewportI viewport = null; @@ -97,7 +100,9 @@ public class AlignViewController implements AlignViewControllerI (int) (Math.random() * 255), (int) (Math.random() * 255)); col = col.brighter(); for (SequenceI sq : gps[g].getSequences(null)) + { viewport.setSequenceColour(sq, col); + } } return true; } @@ -296,4 +301,76 @@ public class AlignViewController implements AlignViewControllerI return false; } } + + + + @Override + public void sortAlignmentByFeatureDensity(String[] typ) + { + sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY); + } + + protected void sortBy(String[] typ, String methodText, final String method) + { + FeatureRenderer fr = alignPanel.getFeatureRenderer(); + if (typ == null) + { + typ = fr==null ? null : fr.getDisplayedFeatureTypes(); + } + String gps[] = null; + gps = fr==null ? null : fr.getDisplayedFeatureGroups(); + if (typ != null) + { + ArrayList types = new ArrayList(); + for (int i = 0; i < typ.length; i++) + { + if (typ[i] != null) + { + types.add(typ[i]); + } + typ = new String[types.size()]; + types.toArray(typ); + } + } + if (gps != null) + { + ArrayList grps = new ArrayList(); + + for (int i = 0; i < gps.length; i++) + { + if (gps[i] != null) + { + grps.add(gps[i]); + } + } + gps = new String[grps.size()]; + grps.toArray(gps); + } + AlignmentI al = viewport.getAlignment(); + + int start, stop; + SequenceGroup sg = viewport.getSelectionGroup(); + if (sg != null) + { + start = sg.getStartRes(); + stop = sg.getEndRes(); + } + else + { + start = 0; + stop = al.getWidth(); + } + SequenceI[] oldOrder = al.getSequencesArray(); + AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method); + avcg.addHistoryItem(new OrderCommand(methodText, oldOrder, viewport + .getAlignment())); + alignPanel.paintAlignment(true); + + } + + @Override + public void sortAlignmentByFeatureScore(String[] typ) + { + sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE); + } } diff --git a/src/jalview/controller/FeatureSettingsController.java b/src/jalview/controller/FeatureSettingsController.java new file mode 100644 index 0000000..ebf4958 --- /dev/null +++ b/src/jalview/controller/FeatureSettingsController.java @@ -0,0 +1,12 @@ +package jalview.controller; + +import jalview.api.FeatureRenderer; +import jalview.api.FeatureSettingsModelI; + +public class FeatureSettingsController implements jalview.api.FeatureSettingsControllerI +{ + FeatureSettingsControllerGuiI settingUI; + FeatureRenderer fr; + FeatureSettingsModelI fsettings; + +} diff --git a/src/jalview/controller/FeatureSettingsControllerGuiI.java b/src/jalview/controller/FeatureSettingsControllerGuiI.java new file mode 100644 index 0000000..781759e --- /dev/null +++ b/src/jalview/controller/FeatureSettingsControllerGuiI.java @@ -0,0 +1,6 @@ +package jalview.controller; + +public interface FeatureSettingsControllerGuiI +{ + +} diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 9c5914f..01d3d8d 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1571,6 +1571,39 @@ public class Alignment implements AlignmentI } } + + private SequenceI seqrep=null; + + /** + * + * @return the representative sequence for this group + */ + public SequenceI getSeqrep() + { + return seqrep; + } + + /** + * set the representative sequence for this group. Note - this affects the + * interpretation of the Hidereps attribute. + * + * @param seqrep + * the seqrep to set (null means no sequence representative) + */ + public void setSeqrep(SequenceI seqrep) + { + this.seqrep = seqrep; + } + + /** + * + * @return true if group has a sequence representative + */ + public boolean hasSeqrep() + { + return seqrep != null; + } + @Override public int getEndRes() { diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index 529891f..a55f676 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -20,7 +20,7 @@ */ package jalview.datamodel; -import java.util.Vector; +import java.util.List; public class CigarArray extends CigarBase { @@ -148,25 +148,25 @@ public class CigarArray extends CigarBase * internal constructor function - called by CigarArray(AlignmentI, ...); * * @param alignment - * @param columnSelection + * @param list * - vector of visible regions as returned from * columnSelection.getHiddenColumns() * @param selectionGroup */ private void constructFromAlignment(AlignmentI alignment, - Vector columnSelection, SequenceGroup selectionGroup) + List list, SequenceGroup selectionGroup) { int[] _startend = _calcStartEndBounds(alignment, selectionGroup); int start = _startend[1], end = _startend[2]; // now construct the CigarArray operations - if (columnSelection != null) + if (list != null) { int[] region; int hideStart, hideEnd; int last = start; - for (int j = 0; last < end & j < columnSelection.size(); j++) + for (int j = 0; last < end & j < list.size(); j++) { - region = (int[]) columnSelection.elementAt(j); + region = list.get(j); hideStart = region[0]; hideEnd = region[1]; // edit hidden regions to selection range diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index f414d13..6acca32 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -21,8 +21,11 @@ package jalview.datamodel; import jalview.util.ShiftList; +import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; +import jalview.viewmodel.annotationfilter.AnnotationFilterParameter.SearchableAnnotationField; import java.util.ArrayList; +import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.Vector; @@ -35,7 +38,7 @@ public class ColumnSelection Vector selected = new Vector(); // Vector of int [] {startCol, endCol} - Vector hiddenColumns; + Vector hiddenColumns; /** * Add a column to the selection @@ -208,7 +211,7 @@ public class ColumnSelection int hSize = hiddenColumns.size(); for (int i = 0; i < hSize; i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (region[0] > start && start + change > region[1]) { deletedHiddenColumns.add(region); @@ -263,7 +266,7 @@ public class ColumnSelection { for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (region[0] >= start) { region[0] -= change; @@ -477,16 +480,13 @@ public class ColumnSelection } /** - * This Method is used to return all the HiddenColumn regions less than the - * given index. - * - * @param end - * int - * @return Vector + * This Method is used to return all the HiddenColumn regions + * @return empty list or List of hidden column intervals */ - public Vector getHiddenColumns() + public List getHiddenColumns() { - return hiddenColumns; + return hiddenColumns == null ? Arrays.asList(new int[] + {}) : hiddenColumns; } /** @@ -503,7 +503,7 @@ public class ColumnSelection { for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (result >= region[0]) { result += region[1] - region[0] + 1; @@ -531,7 +531,7 @@ public class ColumnSelection int[] region; do { - region = (int[]) hiddenColumns.elementAt(index++); + region = hiddenColumns.elementAt(index++); if (hiddenColumn > region[1]) { result -= region[1] + 1 - region[0]; @@ -557,7 +557,7 @@ public class ColumnSelection int gaps = 0; do { - int[] region = (int[]) hiddenColumns.elementAt(index); + int[] region = hiddenColumns.elementAt(index); if (hiddenRegion == 0) { return region[0]; @@ -588,7 +588,7 @@ public class ColumnSelection int index = 0; do { - int[] region = (int[]) hiddenColumns.elementAt(index); + int[] region = hiddenColumns.elementAt(index); if (alPos < region[0]) { return region[0]; @@ -616,7 +616,7 @@ public class ColumnSelection int index = hiddenColumns.size() - 1; do { - int[] region = (int[]) hiddenColumns.elementAt(index); + int[] region = hiddenColumns.elementAt(index); if (alPos > region[1]) { return region[1]; @@ -652,7 +652,7 @@ public class ColumnSelection for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (start <= region[1] && end >= region[0]) { hiddenColumns.removeElementAt(i); @@ -719,7 +719,7 @@ public class ColumnSelection { for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); for (int j = region[0]; j < region[1] + 1; j++) { addElement(j); @@ -734,7 +734,7 @@ public class ColumnSelection { for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (res == region[0]) { for (int j = region[0]; j < region[1] + 1; j++) @@ -758,7 +758,7 @@ public class ColumnSelection { for (int i = 0; i < hiddenColumns.size(); i++) { - int[] region = (int[]) hiddenColumns.elementAt(i); + int[] region = hiddenColumns.elementAt(i); if (column >= region[0] && column <= region[1]) { return false; @@ -792,7 +792,7 @@ public class ColumnSelection for (int i = 0, j = copy.hiddenColumns.size(); i < j; i++) { int[] rh, cp; - rh = (int[]) copy.hiddenColumns.elementAt(i); + rh = copy.hiddenColumns.elementAt(i); if (rh != null) { cp = new int[rh.length]; @@ -821,7 +821,7 @@ public class ColumnSelection for (i = 0; i < iSize; i++) { StringBuffer visibleSeq = new StringBuffer(); - Vector regions = getHiddenColumns(); + List regions = getHiddenColumns(); int blockStart = start, blockEnd = end; int[] region; @@ -829,7 +829,7 @@ public class ColumnSelection for (int j = 0; j < regions.size(); j++) { - region = (int[]) regions.elementAt(j); + region = regions.get(j); hideStart = region[0]; hideEnd = region[1]; @@ -886,7 +886,7 @@ public class ColumnSelection if (hiddenColumns != null && hiddenColumns.size() > 0) { Vector visiblecontigs = new Vector(); - Vector regions = getHiddenColumns(); + List regions = getHiddenColumns(); int vstart = start; int[] region; @@ -894,7 +894,7 @@ public class ColumnSelection for (int j = 0; vstart < end && j < regions.size(); j++) { - region = (int[]) regions.elementAt(j); + region = regions.get(j); hideStart = region[0]; hideEnd = region[1]; @@ -972,14 +972,14 @@ public class ColumnSelection // then mangle the alignmentAnnotation annotation array Vector annels = new Vector(); Annotation[] els = null; - Vector regions = getHiddenColumns(); + List regions = getHiddenColumns(); int blockStart = start, blockEnd = end; int[] region; int hideStart, hideEnd, w = 0; for (int j = 0; j < regions.size(); j++) { - region = (int[]) regions.elementAt(j); + region = regions.get(j); hideStart = region[0]; hideEnd = region[1]; @@ -1265,4 +1265,131 @@ public class ColumnSelection } } } + + /** + * + * @return true if there are columns marked + */ + public boolean hasSelectedColumns() + { + return (selected != null && selected.size() > 0); + } + + /** + * + * @return true if there are columns hidden + */ + public boolean hasHiddenColumns() + { + return hiddenColumns != null && hiddenColumns.size() > 0; + } + + /** + * + * @return true if there are more than one set of columns hidden + */ + public boolean hasManyHiddenColumns() + { + return hiddenColumns != null && hiddenColumns.size() > 1; + } + + /** + * mark the columns corresponding to gap characters as hidden in the column + * selection + * + * @param sr + */ + public void hideInsertionsFor(SequenceI sr) + { + List inserts = sr.getInsertions(); + for (int[] r : inserts) + { + hideColumns(r[0], r[1]); + } + } + + public boolean filterAnnotations(Annotation[] annotations, + AnnotationFilterParameter filterParams) + { + this.revealAllHiddenColumns(); + this.clear(); + int count = 0; + do + { + if (annotations[count] != null) + { + + boolean itemMatched = false; + + if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD + && annotations[count].value >= filterParams + .getThresholdValue()) + { + itemMatched = true; + } + if (filterParams.getThresholdType() == AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD + && annotations[count].value <= filterParams + .getThresholdValue()) + { + itemMatched = true; + } + + if (filterParams.isFilterAlphaHelix() + && annotations[count].secondaryStructure == 'H') + { + itemMatched = true; + } + + if (filterParams.isFilterBetaSheet() + && annotations[count].secondaryStructure == 'E') + { + itemMatched = true; + } + + if (filterParams.isFilterTurn() + && annotations[count].secondaryStructure == 'S') + { + itemMatched = true; + } + + String regexSearchString = filterParams.getRegexString(); + if (regexSearchString != null + && !filterParams.getRegexSearchFields().isEmpty()) + { + List fields = filterParams + .getRegexSearchFields(); + try + { + if (fields.contains(SearchableAnnotationField.DISPLAY_STRING) + && annotations[count].displayCharacter + .matches(regexSearchString)) + { + itemMatched = true; + } + } catch (java.util.regex.PatternSyntaxException pse) + { + if (annotations[count].displayCharacter + .equals(regexSearchString)) + { + itemMatched = true; + } + } + if (fields.contains(SearchableAnnotationField.DESCRIPTION) + && annotations[count].description != null + && annotations[count].description + .matches(regexSearchString)) + { + itemMatched = true; + } + } + + if (itemMatched) + { + this.addElement(count); + } + } + count++; + } while (count < annotations.length); + return false; + } } diff --git a/src/jalview/datamodel/PDBEntry.java b/src/jalview/datamodel/PDBEntry.java index ee2b549..1cf9cd7 100755 --- a/src/jalview/datamodel/PDBEntry.java +++ b/src/jalview/datamodel/PDBEntry.java @@ -20,7 +20,7 @@ */ package jalview.datamodel; -import java.util.*; +import java.util.Hashtable; public class PDBEntry { @@ -37,6 +37,7 @@ public class PDBEntry * * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof PDBEntry)) @@ -44,7 +45,9 @@ public class PDBEntry return false; } if (obj == this) + { return true; + } PDBEntry o = (PDBEntry) obj; return (file == o.file || (file != null && o.file != null && o.file .equals(file))) @@ -57,10 +60,29 @@ public class PDBEntry .equals(o.properties))); } + /** + * Default constructor + */ public PDBEntry() { } + /** + * Constructor given file path and PDB id. + * + * @param filePath + */ + public PDBEntry(String filePath, String pdbId) + { + this.file = filePath; + this.id = pdbId; + } + + /** + * Copy constructor. + * + * @param entry + */ public PDBEntry(PDBEntry entry) { file = entry.file; diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 0652fb5..96e469a 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -661,11 +661,7 @@ public class Sequence implements SequenceI return map; } - /* - * (non-Javadoc) - * - * @see jalview.datamodel.SequenceI#findPositionMap() - */ + @Override public int[] findPositionMap() { int map[] = new int[sequence.length]; @@ -685,11 +681,43 @@ public class Sequence implements SequenceI return map; } - /* - * (non-Javadoc) - * - * @see jalview.datamodel.SequenceI#deleteChars(int, int) - */ + @Override + public List getInsertions() + { + ArrayList map = new ArrayList(); + int lastj = -1, j = 0; + int pos = start; + int seqlen = sequence.length; + while ((j < seqlen)) + { + if (jalview.util.Comparison.isGap(sequence[j])) + { + if (lastj == -1) + { + lastj = j; + } + } + else + { + if (lastj != -1) + { + map.add(new int[] + { lastj, j - 1 }); + lastj = -1; + } + } + j++; + } + if (lastj != -1) + { + map.add(new int[] + { lastj, j - 1 }); + lastj = -1; + } + return map; + } + + @Override public void deleteChars(int i, int j) { int newstart = start, newend = end; @@ -768,16 +796,7 @@ public class Sequence implements SequenceI sequence = tmp; } - /** - * DOCUMENT ME! - * - * @param i - * DOCUMENT ME! - * @param c - * DOCUMENT ME! - * @param chop - * DOCUMENT ME! - */ + @Override public void insertCharAt(int i, int length, char c) { char[] tmp = new char[sequence.length + length]; @@ -807,26 +826,31 @@ public class Sequence implements SequenceI sequence = tmp; } + @Override public void insertCharAt(int i, char c) { insertCharAt(i, 1, c); } + @Override public String getVamsasId() { return vamsasId; } + @Override public void setVamsasId(String id) { vamsasId = id; } + @Override public void setDBRef(DBRefEntry[] dbref) { dbrefs = dbref; } + @Override public DBRefEntry[] getDBRef() { if (dbrefs == null && datasetSequence != null @@ -837,6 +861,7 @@ public class Sequence implements SequenceI return dbrefs; } + @Override public void addDBRef(DBRefEntry entry) { if (dbrefs == null) @@ -869,40 +894,33 @@ public class Sequence implements SequenceI dbrefs = temp; } + @Override public void setDatasetSequence(SequenceI seq) { datasetSequence = seq; } + @Override public SequenceI getDatasetSequence() { return datasetSequence; } - /** - * Returns a new array containing this sequence's annotations, or null. - */ + @Override public AlignmentAnnotation[] getAnnotation() { return annotation == null ? null : annotation .toArray(new AlignmentAnnotation[annotation.size()]); } - /** - * Returns true if this sequence has the given annotation (by object - * identity). - */ + @Override public boolean hasAnnotation(AlignmentAnnotation ann) { return annotation == null ? false : annotation.contains(ann); } - /** - * Add the given annotation, if not already added, and set its sequence ref to - * be this sequence. Does nothing if this sequence's annotations already - * include this annotation (by identical object reference). - */ + @Override public void addAlignmentAnnotation(AlignmentAnnotation annotation) { if (this.annotation == null) @@ -948,11 +966,7 @@ public class Sequence implements SequenceI return true; } - /* - * (non-Javadoc) - * - * @see jalview.datamodel.SequenceI#deriveSequence() - */ + @Override public SequenceI deriveSequence() { SequenceI seq = new Sequence(this); @@ -1043,11 +1057,7 @@ public class Sequence implements SequenceI } } - /* - * (non-Javadoc) - * - * @see jalview.datamodel.SequenceI#getAnnotation(java.lang.String) - */ + @Override public AlignmentAnnotation[] getAnnotation(String label) { if (annotation == null || annotation.size() == 0) @@ -1080,6 +1090,7 @@ public class Sequence implements SequenceI return anns; } + @Override public boolean updatePDBIds() { if (datasetSequence != null) @@ -1133,13 +1144,7 @@ public class Sequence implements SequenceI return false; } - /* - * (non-Javadoc) - * - * @see - * jalview.datamodel.SequenceI#transferAnnotation(jalview.datamodel.SequenceI, - * jalview.datamodel.Mapping) - */ + @Override public void transferAnnotation(SequenceI entry, Mapping mp) { if (datasetSequence != null) @@ -1235,13 +1240,6 @@ public class Sequence implements SequenceI return rna; } - /** - * Returns a (possibly empty) list of any annotations that match on given - * calcId (source) and label (type). Null values do not match. - * - * @param calcId - * @param label - */ @Override public List getAlignmentAnnotations(String calcId, String label) diff --git a/src/jalview/datamodel/SequenceCollectionI.java b/src/jalview/datamodel/SequenceCollectionI.java index 3af441b..ee216a4 100644 --- a/src/jalview/datamodel/SequenceCollectionI.java +++ b/src/jalview/datamodel/SequenceCollectionI.java @@ -29,8 +29,23 @@ public interface SequenceCollectionI List getSequences( Map hiddenReps); - int getWidth(); + /** + * + * @return true if getSeqrep doesn't return null + */ + boolean hasSeqrep(); + /** + * get the reference or representative sequence within this collection + * @return null or the current reference sequence + */ + SequenceI getSeqrep(); + /** + * set the reference or representative sequence for this collection. + * Reference is assumed to be present within the collection. + * @return + */ + void setSeqrep(SequenceI refseq); /** * @return the first column included in this collection. Runs from 0<=i getAlignmentAnnotations(String calcId, String label); @@ -403,4 +414,10 @@ public interface SequenceI */ public void setRNA(RNA rna); + /** + * + * @return list of insertions (gap characters) in sequence + */ + public List getInsertions(); + } diff --git a/src/jalview/datamodel/StructureViewerModel.java b/src/jalview/datamodel/StructureViewerModel.java new file mode 100644 index 0000000..098372b --- /dev/null +++ b/src/jalview/datamodel/StructureViewerModel.java @@ -0,0 +1,189 @@ +package jalview.datamodel; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A data bean to hold stored data about a structure viewer. + */ +public class StructureViewerModel +{ + private int x; + + private int y; + + private int width; + + private int height; + + private boolean alignWithPanel; + + private boolean colourWithAlignPanel; + + private boolean colourByViewer; + + private String stateData = ""; + + private Map fileData = new HashMap(); + + public class StructureData + { + private String filePath; + + private String pdbId; + + private List seqList; + + // TODO and possibly a list of chains? + + /** + * Constructor given structure file path and id. + * + * @param pdbFile + * @param id + */ + public StructureData(String pdbFile, String id) + { + this.filePath = pdbFile; + this.pdbId = id; + this.seqList = new ArrayList(); + } + + public String getFilePath() + { + return filePath; + } + + protected void setFilePath(String filePath) + { + this.filePath = filePath; + } + + public String getPdbId() + { + return pdbId; + } + + protected void setPdbId(String pdbId) + { + this.pdbId = pdbId; + } + + public List getSeqList() + { + return seqList; + } + + protected void setSeqList(List seqList) + { + this.seqList = seqList; + } + } + + public StructureViewerModel(int x, int y, int width, int height, + boolean alignWithPanel, boolean colourWithAlignPanel, + boolean colourByViewer) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + this.alignWithPanel = alignWithPanel; + this.colourWithAlignPanel = colourWithAlignPanel; + this.colourByViewer = colourByViewer; + } + + public int getX() + { + return x; + } + + protected void setX(int x) + { + this.x = x; + } + + public int getY() + { + return y; + } + + protected void setY(int y) + { + this.y = y; + } + + public int getWidth() + { + return width; + } + + protected void setWidth(int width) + { + this.width = width; + } + + public int getHeight() + { + return height; + } + + public void setHeight(int height) + { + this.height = height; + } + + public boolean isAlignWithPanel() + { + return alignWithPanel; + } + + public void setAlignWithPanel(boolean alignWithPanel) + { + this.alignWithPanel = alignWithPanel; + } + + public boolean isColourWithAlignPanel() + { + return colourWithAlignPanel; + } + + public void setColourWithAlignPanel(boolean colourWithAlignPanel) + { + this.colourWithAlignPanel = colourWithAlignPanel; + } + + public boolean isColourByViewer() + { + return colourByViewer; + } + + public void setColourByViewer(boolean colourByViewer) + { + this.colourByViewer = colourByViewer; + } + + public String getStateData() + { + return stateData; + } + + public void setStateData(String stateData) + { + this.stateData = stateData; + } + + public Map getFileData() + { + return fileData; + } + + protected void setFileData(Map fileData) + { + this.fileData = fileData; + } + +} diff --git a/src/jalview/exceptions/JalviewException.java b/src/jalview/exceptions/JalviewException.java new file mode 100644 index 0000000..80e0b08 --- /dev/null +++ b/src/jalview/exceptions/JalviewException.java @@ -0,0 +1,25 @@ +package jalview.exceptions; + +@SuppressWarnings("serial") +public class JalviewException extends Exception +{ + public JalviewException(String exceptionMessage) + { + super(exceptionMessage); + } + + public JalviewException() + { + super(); + } + + public JalviewException(String exceptionMessage, Throwable cause) + { + super(exceptionMessage, cause); + } + + public JalviewException(Throwable cause) + { + super(cause); + } +} diff --git a/src/jalview/exceptions/NoFileSelectedException.java b/src/jalview/exceptions/NoFileSelectedException.java new file mode 100644 index 0000000..5c56f47 --- /dev/null +++ b/src/jalview/exceptions/NoFileSelectedException.java @@ -0,0 +1,10 @@ +package jalview.exceptions; + +@SuppressWarnings("serial") +public class NoFileSelectedException extends JalviewException +{ + public NoFileSelectedException(String msg) + { + super(msg); + } +} diff --git a/src/jalview/ext/jmol/JalviewJmolBinding.java b/src/jalview/ext/jmol/JalviewJmolBinding.java index 9187912..619144e 100644 --- a/src/jalview/ext/jmol/JalviewJmolBinding.java +++ b/src/jalview/ext/jmol/JalviewJmolBinding.java @@ -23,8 +23,6 @@ package jalview.ext.jmol; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; -import jalview.api.SequenceStructureBinding; -import jalview.api.StructureSelectionManagerProvider; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; @@ -32,10 +30,10 @@ import jalview.datamodel.SequenceI; import jalview.io.AppletFormatAdapter; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; -import jalview.structure.StructureListener; import jalview.structure.StructureMapping; +import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; -import jalview.structures.models.SequenceStructureBindingModel; +import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; import java.awt.Color; @@ -58,30 +56,18 @@ import org.jmol.api.JmolViewer; import org.jmol.constant.EnumCallback; import org.jmol.popup.JmolPopup; -public abstract class JalviewJmolBinding extends SequenceStructureBindingModel implements StructureListener, - JmolStatusListener, SequenceStructureBinding, - JmolSelectionListener, ComponentListener, - StructureSelectionManagerProvider - +public abstract class JalviewJmolBinding extends AAStructureBindingModel + implements JmolStatusListener, JmolSelectionListener, + ComponentListener { - /** + /* * state flag used to check if the Jmol viewer's paint method can be called */ private boolean finishedInit = false; - public boolean isFinishedInit() - { - return finishedInit; - } - - public void setFinishedInit(boolean finishedInit) - { - this.finishedInit = finishedInit; - } - boolean allChainsSelected = false; - /** + /* * when true, try to search the associated datamodel for sequences that are * associated with any unknown structures in the Jmol view. */ @@ -93,18 +79,11 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i Hashtable chainFile; - /** - * array of target chains for seuqences - tied to pdbentry and sequence[] - */ - protected String[][] chains; - - boolean colourBySequence = true; - StringBuffer eval = new StringBuffer(); public String fileLoadingError; - /** + /* * the default or current model displayed if the model cannot be identified * from the selection message */ @@ -123,37 +102,15 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i */ String[] modelFileNames = null; - public PDBEntry[] pdbentry; - - /** - * datasource protocol for access to PDBEntrylatest - */ - String protocol = null; - StringBuffer resetLastRes = new StringBuffer(); - /** - * sequences mapped to each pdbentry - */ - public SequenceI[][] sequence; - - public StructureSelectionManager ssm; - public JmolViewer viewer; public JalviewJmolBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, String protocol) { - this.ssm = ssm; - this.sequence = sequenceIs; - this.chains = chains; - this.pdbentry = pdbentry; - this.protocol = protocol; - if (chains == null) - { - this.chains = new String[pdbentry.length][]; - } + super(ssm, pdbentry, sequenceIs, chains, protocol); /* * viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter(), * "jalviewJmol", ap.av.applet .getDocumentBase(), @@ -164,10 +121,11 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i } public JalviewJmolBinding(StructureSelectionManager ssm, - JmolViewer viewer2) + SequenceI[][] seqs, JmolViewer theViewer) { - this.ssm = ssm; - viewer = viewer2; + super(ssm, seqs); + + viewer = theViewer; viewer.setJmolStatusListener(this); viewer.addSelectionListener(this); } @@ -180,30 +138,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i */ public String getViewerTitle() { - if (sequence == null || pdbentry == null || sequence.length < 1 - || pdbentry.length < 1 || sequence[0].length < 1) - { - return ("Jalview Jmol Window"); - } - // TODO: give a more informative title when multiple structures are - // displayed. - StringBuffer title = new StringBuffer(sequence[0][0].getName() + ":" - + pdbentry[0].getId()); - - if (pdbentry[0].getProperty() != null) - { - if (pdbentry[0].getProperty().get("method") != null) - { - title.append(" Method: "); - title.append(pdbentry[0].getProperty().get("method")); - } - if (pdbentry[0].getProperty().get("chains") != null) - { - title.append(" Chain:"); - title.append(pdbentry[0].getProperty().get("chains")); - } - } - return title.toString(); + return getViewerTitle("JMol", true); } /** @@ -232,7 +167,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i + (1 + getModelNum((String) chainFile.get(lbl))) + " or "); } if (cmd.length() > 0) + { cmd.setLength(cmd.length() - 4); + } evalStateCommand("select *;restrict " + cmd + ";cartoon;center " + cmd); } @@ -240,7 +177,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i { viewer.setModeMouse(org.jmol.viewer.JmolConstants.MOUSE_NONE); // remove listeners for all structures in viewer - ssm.removeStructureViewerListener(this, this.getPdbFile()); + getSsm().removeStructureViewerListener(this, this.getPdbFile()); // and shut down jmol viewer.evalStringQuiet("zap"); viewer.setJmolStatusListener(null); @@ -249,12 +186,6 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i releaseUIResources(); } - /** - * called by JalviewJmolbinding after closeViewer is called - release any - * resources and references so they can be garbage collected. - */ - protected abstract void releaseUIResources(); - public void colourByChain() { colourBySequence = false; @@ -330,7 +261,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i { // HACK - in Jalview 2.8 this call may not be threadsafe so we catch // every possible exception - StructureMapping[] sm = ssm.getMapping(file); + StructureMapping[] sm = getSsm().getMapping(file); if (sm == null || sm.length == 0) { waiting = true; @@ -408,7 +339,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i String[] chainNames = new String[files.length]; for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { - StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + StructureMapping[] mapping = getSsm().getMapping(files[pdbfnum]); // RACE CONDITION - getMapping only returns Jmol loaded filenames once // Jmol callback has completed. if (mapping == null || mapping.length < 1) @@ -416,12 +347,13 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i throw new Error(MessageManager.getString("error.implementation_error_jmol_getting_data")); } int lastPos = -1; - for (int s = 0; s < sequence[pdbfnum].length; s++) + final int sequenceCountForPdbFile = getSequence()[pdbfnum].length; + for (int s = 0; s < sequenceCountForPdbFile; s++) { for (int sp, m = 0; m < mapping.length; m++) { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + if (mapping[m].getSequence() == getSequence()[pdbfnum][s] + && (sp = alignment.findIndex(getSequence()[pdbfnum][s])) > -1) { if (refStructure == -1) { @@ -473,7 +405,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i chainNames[pdbfnum] = mapping[m].getPdbId() + targetC[pdbfnum]; // move on to next pdb file - s = sequence[pdbfnum].length; + s = getSequence()[pdbfnum].length; break; } } @@ -630,8 +562,10 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i jalview.api.AlignmentViewPanel alignmentv) { if (!colourBySequence || !isLoadingFinished()) + { return; - if (ssm == null) + } + if (getSsm() == null) { return; } @@ -646,23 +580,38 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i } AlignmentI alignment = alignmentv.getAlignment(); - for (jalview.structure.StructureMappingcommandSet cpdbbyseq : JmolCommands - .getColourBySequenceCommand(ssm, files, sequence, sr, fr, - alignment)) + for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(files, sr, fr, alignment)) + { for (String cbyseq : cpdbbyseq.commands) { - evalStateCommand(cbyseq); + executeWhenReady(cbyseq); } + } } - public boolean isColourBySequence() + /** + * @param files + * @param sr + * @param fr + * @param alignment + * @return + */ + protected StructureMappingcommandSet[] getColourBySequenceCommands( + String[] files, SequenceRenderer sr, FeatureRenderer fr, + AlignmentI alignment) { - return colourBySequence; + return JmolCommands + .getColourBySequenceCommand(getSsm(), files, getSequence(), sr, + fr, + alignment); } - public void setColourBySequence(boolean colourBySequence) + /** + * @param command + */ + protected void executeWhenReady(String command) { - this.colourBySequence = colourBySequence; + evalStateCommand(command); } public void createImage(String file, String type, int quality) @@ -702,7 +651,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i String pdbfile) { if (getModelNum(pdbfile) < 0) + { return null; + } // TODO: verify atomIndex is selecting correct model. return new Color(viewer.getAtomArgb(atomIndex)); } @@ -735,7 +686,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i for (int i = 0; i < mfn.length; i++) { if (mfn[i].equalsIgnoreCase(modelFileName)) + { return i; + } } return -1; } @@ -806,7 +759,8 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i /** * map from string to applet */ - public Map getRegistryInfo() + @Override + public Map getRegistryInfo() { // TODO Auto-generated method stub return null; @@ -944,8 +898,10 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i String chainId; if (strInfo.indexOf(":") > -1) + { chainId = strInfo.substring(strInfo.indexOf(":") + 1, strInfo.indexOf(".")); + } else { chainId = " "; @@ -983,7 +939,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i ; } if (lastMessage == null || !lastMessage.equals(strInfo)) - ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename); + { + getSsm().mouseOverStructure(pdbResNum, chainId, pdbfilename); + } lastMessage = strInfo; } @@ -1017,13 +975,17 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i int chainSeparator = strInfo.indexOf(":"); int p = 0; if (chainSeparator == -1) + { chainSeparator = strInfo.indexOf("."); + } String picked = strInfo.substring(strInfo.indexOf("]") + 1, chainSeparator); String mdlString = ""; if ((p = strInfo.indexOf(":")) > -1) + { picked += strInfo.substring(p + 1, strInfo.indexOf(".")); + } if ((p = strInfo.indexOf("/")) > -1) { @@ -1195,7 +1157,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i } // deregister the Jmol instance for these structures - we'll add // ourselves again at the end for the current structure set. - ssm.removeStructureViewerListener(this, oldmfn); + getSsm().removeStructureViewerListener(this, oldmfn); } } refreshPdbEntries(); @@ -1215,70 +1177,68 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i + ".0", "PDB"); pdbfhash = "" + pdbfile.hashCode(); } - if (pdbentry != null) - { // search pdbentries and sequences to find correct pdbentry for this // model - for (int pe = 0; pe < pdbentry.length; pe++) + for (int pe = 0; pe < getPdbCount(); pe++) + { + boolean matches = false; + if (fileName == null) { - boolean matches = false; - if (fileName == null) + if (false) + // see JAL-623 - need method of matching pasted data up { - if (false) - // see JAL-623 - need method of matching pasted data up - { - pdb = ssm.setMapping(sequence[pe], chains[pe], pdbfile, - AppletFormatAdapter.PASTE); - pdbentry[modelnum].setFile("INLINE" + pdb.id); - matches = true; - foundEntry = true; - } + pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe], + pdbfile, AppletFormatAdapter.PASTE); + getPdbEntry(modelnum).setFile("INLINE" + pdb.id); + matches = true; + foundEntry = true; } - else + } + else + { + File fl; + if (matches = (fl = new File(getPdbEntry(pe).getFile())) + .equals(new File(fileName))) { - File fl; - if (matches = (fl = new File(pdbentry[pe].getFile())) - .equals(new File(fileName))) + foundEntry = true; + // TODO: Jmol can in principle retrieve from CLASSLOADER but + // this + // needs + // to be tested. See mantis bug + // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 + String protocol = AppletFormatAdapter.URL; + try { - foundEntry = true; - // TODO: Jmol can in principle retrieve from CLASSLOADER but - // this - // needs - // to be tested. See mantis bug - // https://mantis.lifesci.dundee.ac.uk/view.php?id=36605 - String protocol = AppletFormatAdapter.URL; - try - { - if (fl.exists()) - { - protocol = AppletFormatAdapter.FILE; - } - } catch (Exception e) - { - } catch (Error e) + if (fl.exists()) { + protocol = AppletFormatAdapter.FILE; } - // Explicitly map to the filename used by Jmol ; - pdb = ssm.setMapping(sequence[pe], chains[pe], fileName, - protocol); - // pdbentry[pe].getFile(), protocol); - + } catch (Exception e) + { + } catch (Error e) + { } + // Explicitly map to the filename used by Jmol ; + pdb = getSsm().setMapping(getSequence()[pe], getChains()[pe], + fileName, protocol); + // pdbentry[pe].getFile(), protocol); + } - if (matches) + } + if (matches) + { + // add an entry for every chain in the model + for (int i = 0; i < pdb.chains.size(); i++) { - // add an entry for every chain in the model - for (int i = 0; i < pdb.chains.size(); i++) - { - String chid = new String(pdb.id + ":" - + ((MCview.PDBChain) pdb.chains.elementAt(i)).id); - chainFile.put(chid, fileName); - chainNames.addElement(chid); - } - notifyLoaded = true; + String chid = new String(pdb.id + ":" + + pdb.chains.elementAt(i).id); + chainFile.put(chid, fileName); + chainNames.addElement(chid); } + notifyLoaded = true; } } + if (!foundEntry && associateNewStructs) { // this is a foreign pdb file that jalview doesn't know about - add @@ -1307,7 +1267,7 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i } // register ourselves as a listener and notify the gui that it needs to // update itself. - ssm.addStructureViewerListener(this); + getSsm().addStructureViewerListener(this); if (notifyLoaded) { FeatureRenderer fr = getFeatureRenderer(null); @@ -1364,7 +1324,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i colourBySequence = false; if (cs == null) + { return; + } String res; int index; @@ -1378,7 +1340,9 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i res = en.nextElement().toString(); index = ((Integer) ResidueProperties.aa3Hash.get(res)).intValue(); if (index > 20) + { continue; + } col = cs.findColour(ResidueProperties.aa[index].charAt(0)); @@ -1477,185 +1441,93 @@ public abstract class JalviewJmolBinding extends SequenceStructureBindingModel i protected org.jmol.api.JmolAppConsoleInterface console = null; - public void componentResized(ComponentEvent e) + public void setBackgroundColour(java.awt.Color col) { - + jmolHistory(false); + viewer.evalStringQuiet("background [" + col.getRed() + "," + + col.getGreen() + "," + col.getBlue() + "];"); + jmolHistory(true); } - public void componentMoved(ComponentEvent e) + /** + * + * @param pdbfile + * @return text report of alignment between pdbfile and any associated + * alignment sequences + */ + public String printMapping(String pdbfile) { - + return getSsm().printMapping(pdbfile); } - public void componentShown(ComponentEvent e) + @Override + public void resizeInnerPanel(String data) { - showConsole(true); + // Jalview doesn't honour resize panel requests + } - public void componentHidden(ComponentEvent e) + public boolean isFinishedInit() { - showConsole(false); + return finishedInit; } - public void setBackgroundColour(java.awt.Color col) + public void setFinishedInit(boolean finishedInit) { - jmolHistory(false); - viewer.evalStringQuiet("background [" + col.getRed() + "," - + col.getGreen() + "," + col.getBlue() + "];"); - jmolHistory(true); + this.finishedInit = finishedInit; } /** - * add structures and any known sequence associations * - * @returns the pdb entries added to the current set. */ - public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe, - SequenceI[][] seq, String[][] chns) + protected void closeConsole() { - int pe = -1; - Vector v = new Vector(); - Vector rtn = new Vector(); - for (int i = 0; i < pdbentry.length; i++) - { - v.addElement(pdbentry[i]); - } - for (int i = 0; i < pdbe.length; i++) + if (console != null) { - int r = v.indexOf(pdbe[i]); - if (r == -1 || r >= pdbentry.length) + try { - rtn.addElement(new int[] - { v.size(), i }); - v.addElement(pdbe[i]); - } - else + console.setVisible(false); + } catch (Error e) { - // just make sure the sequence/chain entries are all up to date - addSequenceAndChain(r, seq[i], chns[i]); - } - } - pdbe = new PDBEntry[v.size()]; - v.copyInto(pdbe); - pdbentry = pdbe; - if (rtn.size() > 0) - { - // expand the tied seuqence[] and string[] arrays - SequenceI[][] sqs = new SequenceI[pdbentry.length][]; - String[][] sch = new String[pdbentry.length][]; - System.arraycopy(sequence, 0, sqs, 0, sequence.length); - System.arraycopy(chains, 0, sch, 0, this.chains.length); - sequence = sqs; - chains = sch; - pdbe = new PDBEntry[rtn.size()]; - for (int r = 0; r < pdbe.length; r++) + } catch (Exception x) { - int[] stri = ((int[]) rtn.elementAt(r)); - // record the pdb file as a new addition - pdbe[r] = pdbentry[stri[0]]; - // and add the new sequence/chain entries - addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); } + ; + console = null; } - else - { - pdbe = null; - } - return pdbe; } - public void addSequence(int pe, SequenceI[] seq) + /** + * ComponentListener method + */ + @Override + public void componentMoved(ComponentEvent e) { - // add sequences to the pe'th pdbentry's seuqence set. - addSequenceAndChain(pe, seq, null); } - private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain) + /** + * ComponentListener method + */ + @Override + public void componentResized(ComponentEvent e) { - if (pe < 0 || pe >= pdbentry.length) - { - throw new Error(MessageManager.formatMessage("error.implementation_error_no_pdbentry_from_index", new String[]{Integer.valueOf(pe).toString()})); - } - final String nullChain = "TheNullChain"; - Vector s = new Vector(); - Vector c = new Vector(); - if (chains == null) - { - chains = new String[pdbentry.length][]; - } - if (sequence[pe] != null) - { - for (int i = 0; i < sequence[pe].length; i++) - { - s.addElement(sequence[pe][i]); - if (chains[pe] != null) - { - if (i < chains[pe].length) - { - c.addElement(chains[pe][i]); - } - else - { - c.addElement(nullChain); - } - } - else - { - if (tchain != null && tchain.length > 0) - { - c.addElement(nullChain); - } - } - } - } - for (int i = 0; i < seq.length; i++) - { - if (!s.contains(seq[i])) - { - s.addElement(seq[i]); - if (tchain != null && i < tchain.length) - { - c.addElement(tchain[i] == null ? nullChain : tchain[i]); - } - } - } - SequenceI[] tmp = new SequenceI[s.size()]; - s.copyInto(tmp); - sequence[pe] = tmp; - if (c.size() > 0) - { - String[] tch = new String[c.size()]; - c.copyInto(tch); - for (int i = 0; i < tch.length; i++) - { - if (tch[i] == nullChain) - { - tch[i] = null; - } - } - chains[pe] = tch; - } - else - { - chains[pe] = null; - } } /** - * - * @param pdbfile - * @return text report of alignment between pdbfile and any associated - * alignment sequences + * ComponentListener method */ - public String printMapping(String pdbfile) + @Override + public void componentShown(ComponentEvent e) { - return ssm.printMapping(pdbfile); + showConsole(true); } + /** + * ComponentListener method + */ @Override - public void resizeInnerPanel(String data) + public void componentHidden(ComponentEvent e) { - // Jalview doesn't honour resize panel requests - + showConsole(false); } } diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java index d3c8c09..4afc526 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java @@ -22,17 +22,20 @@ package jalview.ext.rbvi.chimera; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; -import jalview.api.structures.JalviewStructureDisplayI; import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; import jalview.structure.StructureMapping; import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; -import jalview.util.Format; +import jalview.util.ColorUtils; +import jalview.util.Comparison; import java.awt.Color; import java.util.ArrayList; -import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; /** * Routines for generating Chimera commands for Jalview/Chimera binding @@ -55,104 +58,233 @@ public class ChimeraCommands SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, AlignmentI alignment) { + Map>>> colourMap = buildColoursMap( + ssm, files, sequence, sr, fr, alignment); - ArrayList cset = new ArrayList(); - Hashtable colranges=new Hashtable(); + List colourCommands = buildColourCommands(colourMap); + + StructureMappingcommandSet cs = new StructureMappingcommandSet( + ChimeraCommands.class, null, + colourCommands.toArray(new String[0])); + + return new StructureMappingcommandSet[] + { cs }; + } + + /** + * Traverse the map of colours/models/chains/positions to construct a list of + * 'color' commands (one per distinct colour used). The format of each command + * is + * + *
    color colorname #modelnumber:range.chain e.g. color #00ff00 + * #0:2.B,4.B,9-12.B|#1:1.A,2-6.A,... + * + * @see http + * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/frameatom_spec + * .html + * + * @param colourMap + * @return + */ + protected static List buildColourCommands( + Map>>> colourMap) + { + /* + * This version concatenates all commands into a single String (semi-colon + * delimited). If length limit issues arise, refactor to return one color + * command per colour. + */ + List commands = new ArrayList(); + StringBuilder sb = new StringBuilder(256); + boolean firstColour = true; + for (Color colour : colourMap.keySet()) + { + String colourCode = ColorUtils.toTkCode(colour); + if (!firstColour) + { + sb.append("; "); + } + sb.append("color ").append(colourCode).append(" "); + firstColour = false; + boolean firstModelForColour = true; + final Map>> colourData = colourMap.get(colour); + for (Integer model : colourData.keySet()) + { + boolean firstPositionForModel = true; + if (!firstModelForColour) + { + sb.append("|"); + } + firstModelForColour = false; + sb.append("#").append(model).append(":"); + + final Map> modelData = colourData.get(model); + for (String chain : modelData.keySet()) + { + for (int[] range : modelData.get(chain)) + { + if (!firstPositionForModel) + { + sb.append(","); + } + if (range[0] == range[1]) + { + sb.append(range[0]); + } + else + { + sb.append(range[0]).append("-").append(range[1]); + } + sb.append(".").append(chain); + firstPositionForModel = false; + } + } + } + } + commands.add(sb.toString()); + return commands; + } + + /** + *
    +   * Build a data structure which maps contiguous subsequences for each colour. 
    +   * This generates a data structure from which we can easily generate the 
    +   * Chimera command for colour by sequence.
    +   * Color
    +   *     Model number
    +   *         Chain
    +   *             list of start/end ranges
    +   * Ordering is by order of addition (for colours and positions), natural ordering (for models and chains)
    +   * 
    + */ + protected static Map>>> buildColoursMap( + StructureSelectionManager ssm, String[] files, + SequenceI[][] sequence, SequenceRenderer sr, FeatureRenderer fr, + AlignmentI alignment) + { + Map>>> colourMap = new LinkedHashMap>>>(); + Color lastColour = null; for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { - float cols[] = new float[4]; StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); - StringBuffer command = new StringBuffer(); - StructureMappingcommandSet smc; - ArrayList str = new ArrayList(); if (mapping == null || mapping.length < 1) + { continue; + } - int startPos = -1, lastPos = -1, startModel = -1, lastModel = -1; - String startChain = "", lastChain = ""; - Color lastCol = null; + int startPos = -1, lastPos = -1; + String lastChain = ""; for (int s = 0; s < sequence[pdbfnum].length; s++) { for (int sp, m = 0; m < mapping.length; m++) { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + final SequenceI seq = sequence[pdbfnum][s]; + if (mapping[m].getSequence() == seq + && (sp = alignment.findIndex(seq)) > -1) { SequenceI asp = alignment.getSequenceAt(sp); for (int r = 0; r < asp.getLength(); r++) { // no mapping to gaps in sequence - if (jalview.util.Comparison.isGap(asp.getCharAt(r))) + if (Comparison.isGap(asp.getCharAt(r))) { continue; } int pos = mapping[m].getPDBResNum(asp.findPosition(r)); if (pos < 1 || pos == lastPos) + { continue; + } - Color col = sr.getResidueBoxColour(sequence[pdbfnum][s], r); + Color colour = sr.getResidueColour(seq, r, fr); + final String chain = mapping[m].getChain(); - if (fr != null) - col = fr.findFeatureColour(col, sequence[pdbfnum][s], r); - if (lastCol != col || lastPos + 1 != pos - || pdbfnum != lastModel - || !mapping[m].getChain().equals(lastChain)) + /* + * Just keep incrementing the end position for this colour range + * _unless_ colour, PDB model or chain has changed, or there is a + * gap in the mapped residue sequence + */ + final boolean newColour = !colour.equals(lastColour); + final boolean nonContig = lastPos + 1 != pos; + final boolean newChain = !chain.equals(lastChain); + if (newColour || nonContig || newChain) { - if (lastCol != null) + if (startPos != -1) { - addColourRange(colranges, lastCol,startModel,startPos,lastPos,lastChain); + addColourRange(colourMap, lastColour, pdbfnum, startPos, + lastPos, lastChain); } - lastCol = null; startPos = pos; - startModel = pdbfnum; - startChain = mapping[m].getChain(); } - lastCol = col; + lastColour = colour; lastPos = pos; - lastModel = pdbfnum; - lastChain = mapping[m].getChain(); + lastChain = chain; } // final colour range - if (lastCol != null) + if (lastColour != null) { - addColourRange(colranges, lastCol,startModel,startPos,lastPos,lastChain); + addColourRange(colourMap, lastColour, pdbfnum, startPos, + lastPos, lastChain); } break; } } } - // Finally, add the command set ready to be returned. - StringBuffer coms=new StringBuffer(); - for (String cr:colranges.keySet()) - { - coms.append("color #"+cr+" "+colranges.get(cr)+";"); - } - cset.add(new StructureMappingcommandSet(ChimeraCommands.class, - files[pdbfnum], new String[] { coms.toString() })); } - return cset.toArray(new StructureMappingcommandSet[cset.size()]); + return colourMap; } - private static void addColourRange(Hashtable colranges, Color lastCol, int startModel, - int startPos, int lastPos, String lastChain) + /** + * Helper method to add one contiguous colour range to the colour map. + * + * @param colourMap + * @param colour + * @param model + * @param startPos + * @param endPos + * @param chain + */ + protected static void addColourRange( + Map>>> colourMap, + Color colour, int model, int startPos, int endPos, String chain) { - - String colstring = ((lastCol.getRed()< 16) ? "0":"")+Integer.toHexString(lastCol.getRed()) - + ((lastCol.getGreen()< 16) ? "0":"")+Integer.toHexString(lastCol.getGreen()) - + ((lastCol.getBlue()< 16) ? "0":"")+Integer.toHexString(lastCol.getBlue()); - StringBuffer currange = colranges.get(colstring); - if (currange==null) + /* + * Get/initialize map of data for the colour + */ + Map>> colourData = colourMap + .get(colour); + if (colourData == null) + { + colourMap + .put(colour, + colourData = new TreeMap>>()); + } + + /* + * Get/initialize map of data for the colour and model + */ + Map> modelData = colourData.get(model); + if (modelData == null) { - colranges.put(colstring,currange = new StringBuffer()); + colourData.put(model, modelData = new TreeMap>()); } - if (currange.length()>0) + + /* + * Get/initialize map of data for colour, model and chain + */ + List chainData = modelData.get(chain); + if (chainData == null) { - currange.append("|"); + modelData.put(chain, chainData = new ArrayList()); } - currange.append("#" + startModel + ":" + ((startPos==lastPos) ? startPos : startPos + "-" - + lastPos) + "." + lastChain); + + /* + * Add the start/end positions + */ + chainData.add(new int[] + { startPos, endPos }); } } diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 82f5e5c..b345c5e 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -23,24 +23,21 @@ package jalview.ext.rbvi.chimera; import jalview.api.AlignmentViewPanel; import jalview.api.FeatureRenderer; import jalview.api.SequenceRenderer; -import jalview.api.SequenceStructureBinding; -import jalview.api.StructureSelectionManagerProvider; +import jalview.bin.Cache; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; -import jalview.io.AppletFormatAdapter; import jalview.schemes.ColourSchemeI; import jalview.schemes.ResidueProperties; -import jalview.structure.StructureListener; import jalview.structure.StructureMapping; +import jalview.structure.StructureMappingcommandSet; import jalview.structure.StructureSelectionManager; -import jalview.structures.models.SequenceStructureBindingModel; +import jalview.structures.models.AAStructureBindingModel; +import jalview.util.Comparison; import jalview.util.MessageManager; import java.awt.Color; -import java.awt.event.ComponentEvent; -import java.io.File; import java.util.ArrayList; import java.util.Enumeration; import java.util.HashMap; @@ -53,11 +50,11 @@ import ext.edu.ucsf.rbvi.strucviz2.ChimeraModel; import ext.edu.ucsf.rbvi.strucviz2.StructureManager; import ext.edu.ucsf.rbvi.strucviz2.StructureManager.ModelType; -public abstract class JalviewChimeraBinding extends - SequenceStructureBindingModel implements StructureListener, - SequenceStructureBinding, StructureSelectionManagerProvider - +public abstract class JalviewChimeraBinding extends AAStructureBindingModel { + + private static final boolean debug = false; + private static final String PHOSPHORUS = "P"; private static final String ALPHACARBON = "CA"; @@ -66,130 +63,106 @@ public abstract class JalviewChimeraBinding extends private ChimeraManager viewer; - /** + /* * set if chimera state is being restored from some source - instructs binding * not to apply default display style when structure set is updated for first * time. */ private boolean loadingFromArchive = false; - /** - * second flag to indicate if the Chimera viewer should ignore sequence - * colouring events from the structure manager because the GUI is still - * setting up + /* + * flag to indicate if the Chimera viewer should ignore sequence colouring + * events from the structure manager because the GUI is still setting up */ private boolean loadingFinished = true; - /** + /* * state flag used to check if the Chimera viewer's paint method can be called */ private boolean finishedInit = false; - public boolean isFinishedInit() - { - return finishedInit; - } - - public void setFinishedInit(boolean finishedInit) - { - this.finishedInit = finishedInit; - } - - boolean allChainsSelected = false; - - /** - * when true, try to search the associated datamodel for sequences that are - * associated with any unknown structures in the Chimera view. - */ - private boolean associateNewStructs = false; - - List atomsPicked = new ArrayList(); + private List atomsPicked = new ArrayList(); - public List chainNames; + private List chainNames; private Map chainFile; - /** - * array of target chains for sequences - tied to pdbentry and sequence[] - */ - protected String[][] chains; - - boolean colourBySequence = true; - - StringBuffer eval = new StringBuffer(); + private StringBuffer eval = new StringBuffer(); public String fileLoadingError; - private Map> chimmaps = new LinkedHashMap>(); - - private List mdlToFile = new ArrayList(); + /* + * Map of ChimeraModel objects keyed by PDB full local file name + */ + private Map> chimeraMaps = new LinkedHashMap>(); - /** + /* * the default or current model displayed if the model cannot be identified * from the selection message */ - int frameNo = 0; + private int frameNo = 0; - String lastCommand; + private String lastCommand; - String lastMessage; + private String lastMessage; - boolean loadedInline; + private boolean loadedInline; + /** + * Open a PDB structure file in Chimera and set up mappings from Jalview. + * + * We check if the PDB model id is already loaded in Chimera, if so don't + * reopen it. This is the case if Chimera has opened a saved session file. + * + * @param pe + * @return + */ public boolean openFile(PDBEntry pe) { String file = pe.getFile(); try { + List modelsToMap = new ArrayList(); List oldList = viewer.getModelList(); - viewer.openModel(file, pe.getId(), ModelType.PDB_MODEL); - List newList = viewer.getModelList(); - if (oldList.size() < newList.size()) + boolean alreadyOpen = false; + + /* + * If Chimera already has this model, don't reopen it, but do remap it. + */ + for (ChimeraModel open : oldList) { - while (oldList.size() > 0) - { - oldList.remove(0); - newList.remove(0); - } - chimmaps.put(file, newList); - for (ChimeraModel cm : newList) + if (open.getModelName().equals(pe.getId())) { - while (mdlToFile.size() < 1 + cm.getModelNumber()) - { - mdlToFile.add(new String("")); - } - mdlToFile.set(cm.getModelNumber(), file); + alreadyOpen = true; + modelsToMap.add(open); } + } - File fl = new File(file); - String protocol = AppletFormatAdapter.URL; - try - { - if (fl.exists()) - { - protocol = AppletFormatAdapter.FILE; - } - } catch (Exception e) - { - } catch (Error e) - { - } - // Explicitly map to the filename used by Chimera ; - // pdbentry[pe].getFile(), protocol); + /* + * If Chimera doesn't yet have this model, ask it to open it, and retrieve + * the model names added by Chimera. + */ + if (!alreadyOpen) + { + viewer.openModel(file, pe.getId(), ModelType.PDB_MODEL); + modelsToMap = viewer.getModelList(); + modelsToMap.removeAll(oldList); + } + + chimeraMaps.put(file, modelsToMap); - if (ssm != null) + if (getSsm() != null) + { + getSsm().addStructureViewerListener(this); + // ssm.addSelectionListener(this); + FeatureRenderer fr = getFeatureRenderer(null); + if (fr != null) { - ssm.addStructureViewerListener(this); - // ssm.addSelectionListener(this); - FeatureRenderer fr = getFeatureRenderer(null); - if (fr != null) - { - fr.featuresAdded(); - } - refreshGUI(); + fr.featuresAdded(); } - return true; + refreshGUI(); } + return true; } catch (Exception q) { log("Exception when trying to open model " + file + "\n" @@ -204,46 +177,40 @@ public abstract class JalviewChimeraBinding extends */ String[] modelFileNames = null; - public PDBEntry[] pdbentry; - - /** - * datasource protocol for access to PDBEntrylatest - */ - String protocol = null; StringBuffer resetLastRes = new StringBuffer(); - /** - * sequences mapped to each pdbentry - */ - public SequenceI[][] sequence; - - public StructureSelectionManager ssm; - private List lastReply; + /** + * Constructor + * + * @param ssm + * @param pdbentry + * @param sequenceIs + * @param chains + * @param protocol + */ public JalviewChimeraBinding(StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, String protocol) { - this.ssm = ssm; - this.sequence = sequenceIs; - this.chains = chains; - this.pdbentry = pdbentry; - this.protocol = protocol; - if (chains == null) - { - this.chains = new String[pdbentry.length][]; - } + super(ssm, pdbentry, sequenceIs, chains, protocol); viewer = new ChimeraManager( csm = new ext.edu.ucsf.rbvi.strucviz2.StructureManager(true)); } + /** + * Constructor + * + * @param ssm + * @param theViewer + */ public JalviewChimeraBinding(StructureSelectionManager ssm, - ChimeraManager viewer2) + ChimeraManager theViewer) { - this.ssm = ssm; - viewer = viewer2; + super(ssm, null); + viewer = theViewer; csm = viewer.getStructureManager(); } @@ -256,34 +223,7 @@ public abstract class JalviewChimeraBinding extends */ public String getViewerTitle(boolean verbose) { - if (sequence == null || pdbentry == null || sequence.length < 1 - || pdbentry.length < 1 || sequence[0].length < 1) - { - return ("Jalview Chimera Window"); - } - // TODO: give a more informative title when multiple structures are - // displayed. - StringBuilder title = new StringBuilder(64); - title.append("Chimera view for " + sequence[0][0].getName() + ":" - + pdbentry[0].getId()); - - if (verbose) - { - if (pdbentry[0].getProperty() != null) - { - if (pdbentry[0].getProperty().get("method") != null) - { - title.append(" Method: "); - title.append(pdbentry[0].getProperty().get("method")); - } - if (pdbentry[0].getProperty().get("chains") != null) - { - title.append(" Chain:"); - title.append(pdbentry[0].getProperty().get("chains")); - } - } - } - return title.toString(); + return getViewerTitle("Chimera", verbose); } /** @@ -319,12 +259,12 @@ public abstract class JalviewChimeraBinding extends } /** - * Close down the Jalview viewer, and (optionally) the associate Chimera + * Close down the Jalview viewer, and (optionally) the associated Chimera * window. */ public void closeViewer(boolean closeChimera) { - ssm.removeStructureViewerListener(this, this.getPdbFile()); + getSsm().removeStructureViewerListener(this, this.getPdbFile()); if (closeChimera) { viewer.exitChimera(); @@ -334,12 +274,6 @@ public abstract class JalviewChimeraBinding extends releaseUIResources(); } - /** - * called by JalviewChimerabinding after closeViewer is called - release any - * resources and references so they can be garbage collected. - */ - protected abstract void releaseUIResources(); - public void colourByChain() { colourBySequence = false; @@ -413,7 +347,7 @@ public abstract class JalviewChimeraBinding extends { // HACK - in Jalview 2.8 this call may not be threadsafe so we catch // every possible exception - StructureMapping[] sm = ssm.getMapping(file); + StructureMapping[] sm = getSsm().getMapping(file); if (sm == null || sm.length == 0) { waiting = true; @@ -475,7 +409,7 @@ public abstract class JalviewChimeraBinding extends String[] atomSpec = new String[files.length]; for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++) { - StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]); + StructureMapping[] mapping = getSsm().getMapping(files[pdbfnum]); // RACE CONDITION - getMapping only returns Jmol loaded filenames once // Jmol callback has completed. if (mapping == null || mapping.length < 1) @@ -483,12 +417,14 @@ public abstract class JalviewChimeraBinding extends throw new Error(MessageManager.getString("error.implementation_error_chimera_getting_data")); } int lastPos = -1; - for (int s = 0; s < sequence[pdbfnum].length; s++) + final int seqCountForPdbFile = getSequence()[pdbfnum].length; + for (int s = 0; s < seqCountForPdbFile; s++) { for (int sp, m = 0; m < mapping.length; m++) { - if (mapping[m].getSequence() == sequence[pdbfnum][s] - && (sp = alignment.findIndex(sequence[pdbfnum][s])) > -1) + final SequenceI theSequence = getSequence()[pdbfnum][s]; + if (mapping[m].getSequence() == theSequence + && (sp = alignment.findIndex(theSequence)) > -1) { if (refStructure == -1) { @@ -507,7 +443,7 @@ public abstract class JalviewChimeraBinding extends continue; } - if (jalview.util.Comparison.isGap(asp.getCharAt(r))) + if (Comparison.isGap(asp.getCharAt(r))) { // no mapping to gaps in sequence continue; @@ -541,7 +477,7 @@ public abstract class JalviewChimeraBinding extends + targetC[pdbfnum]; atomSpec[pdbfnum] = asp.getRNA() != null ? PHOSPHORUS : ALPHACARBON; // move on to next pdb file - s = sequence[pdbfnum].length; + s = seqCountForPdbFile; break; } } @@ -654,10 +590,12 @@ public abstract class JalviewChimeraBinding extends } if (selectioncom.length() > 0) { - // TODO remove debug output - System.out.println("Select regions:\n" + selectioncom.toString()); - System.out - .println("Superimpose command(s):\n" + command.toString()); + if (debug) + { + System.out.println("Select regions:\n" + selectioncom.toString()); + System.out.println("Superimpose command(s):\n" + + command.toString()); + } allComs.append("~display all; chain @CA|P; ribbon " + selectioncom.toString() + ";"+command.toString()); // selcom.append("; ribbons; "); @@ -669,7 +607,10 @@ public abstract class JalviewChimeraBinding extends { selectioncom.setLength(selectioncom.length() - 1); } - System.out.println("Select regions:\n" + selectioncom.toString()); + if (debug) + { + System.out.println("Select regions:\n" + selectioncom.toString()); + } allComs.append("; ~display all; chain @CA|P; ribbon " + selectioncom.toString() + "; focus"); // evalStateCommand("select *; backbone; select "+selcom.toString()+"; cartoons; center "+selcom.toString()); @@ -682,7 +623,7 @@ public abstract class JalviewChimeraBinding extends { if (!viewer.isChimeraLaunched()) { - viewer.launchChimera(csm.getChimeraPaths()); + viewer.launchChimera(StructureManager.getChimeraPaths()); } if (!viewer.isChimeraLaunched()) { @@ -702,7 +643,8 @@ public abstract class JalviewChimeraBinding extends } /** - * Send a command to Chimera, and optionally log any responses. + * Send a command to Chimera, launching it first if necessary, and optionally + * log any responses. * * @param command * @param logResponse @@ -713,28 +655,12 @@ public abstract class JalviewChimeraBinding extends checkLaunched(); if (lastCommand == null || !lastCommand.equals(command)) { -// Thread t = new Thread(new Runnable() -// { -// @Override -// public void run() -// { // trim command or it may never find a match in the replyLog!! lastReply = viewer.sendChimeraCommand(command.trim(), logResponse); if (debug && logResponse) - { - log("Response from command ('" + command + "') was:\n" - + lastReply); - } -// } -// }); - // TODO - use j7/8 thread management -// try -// { -// t.join(); -// } catch (InterruptedException foo) -// { -// } -// ; + { + log("Response from command ('" + command + "') was:\n" + lastReply); + } } viewerCommandHistory(true); lastCommand = command; @@ -752,7 +678,7 @@ public abstract class JalviewChimeraBinding extends { return; } - if (ssm == null) + if (getSsm() == null) { return; } @@ -767,19 +693,42 @@ public abstract class JalviewChimeraBinding extends } AlignmentI alignment = alignmentv.getAlignment(); - for (jalview.structure.StructureMappingcommandSet cpdbbyseq : ChimeraCommands - .getColourBySequenceCommand(ssm, files, sequence, sr, fr, - alignment)) + for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(files, sr, fr, alignment)) { - for (String cbyseq : cpdbbyseq.commands) + for (String command : cpdbbyseq.commands) { - waitForChimera(); - evalStateCommand(cbyseq, false); - waitForChimera(); + executeWhenReady(command); } } } + /** + * @param files + * @param sr + * @param fr + * @param alignment + * @return + */ + protected StructureMappingcommandSet[] getColourBySequenceCommands( + String[] files, SequenceRenderer sr, FeatureRenderer fr, + AlignmentI alignment) + { + return ChimeraCommands + .getColourBySequenceCommand(getSsm(), files, getSequence(), sr, + fr, + alignment); + } + + /** + * @param command + */ + protected void executeWhenReady(String command) + { + waitForChimera(); + evalStateCommand(command, false); + waitForChimera(); + } + private void waitForChimera() { while (viewer != null && viewer.isBusy()) @@ -791,30 +740,11 @@ public abstract class JalviewChimeraBinding extends } } - public boolean isColourBySequence() - { - return colourBySequence; - } - - public void setColourBySequence(boolean colourBySequence) - { - this.colourBySequence = colourBySequence; - } + // End StructureListener // ////////////////////////// - public float[][] functionXY(String functionName, int x, int y) - { - return null; - } - - public float[][][] functionXYZ(String functionName, int nx, int ny, int nz) - { - // TODO Auto-generated method stub - return null; - } - public Color getColour(int atomIndex, int pdbResNum, String chain, String pdbfile) { @@ -889,8 +819,8 @@ public abstract class JalviewChimeraBinding extends // // System.arraycopy(mset, 0, modelFileNames, 0, j); // } - return chimmaps.keySet().toArray( - modelFileNames = new String[chimmaps.size()]); + return chimeraMaps.keySet().toArray( + modelFileNames = new String[chimeraMaps.size()]); } /** @@ -917,7 +847,7 @@ public abstract class JalviewChimeraBinding extends public void highlightAtom(int atomIndex, int pdbResNum, String chain, String pdbfile) { - List cms = chimmaps.get(pdbfile); + List cms = chimeraMaps.get(pdbfile); if (cms != null) { int mdlNum = cms.get(0).getModelNumber(); @@ -954,8 +884,6 @@ public abstract class JalviewChimeraBinding extends } } - boolean debug = false; - private void log(String message) { System.err.println("## Chimera log: " + message); @@ -1057,7 +985,7 @@ public abstract class JalviewChimeraBinding extends } if (lastMessage == null || !lastMessage.equals(strInfo)) { - ssm.mouseOverStructure(pdbResNum, chainId, pdbfilename); + getSsm().mouseOverStructure(pdbResNum, chainId, pdbfilename); } lastMessage = strInfo; @@ -1182,13 +1110,13 @@ public abstract class JalviewChimeraBinding extends } // deregister the Jmol instance for these structures - we'll add // ourselves again at the end for the current structure set. - ssm.removeStructureViewerListener(this, oldmfn); + getSsm().removeStructureViewerListener(this, oldmfn); } } // register ourselves as a listener and notify the gui that it needs to // update itself. - ssm.addStructureViewerListener(this); + getSsm().addStructureViewerListener(this); if (notifyLoaded) { @@ -1248,24 +1176,6 @@ public abstract class JalviewChimeraBinding extends */ public abstract void refreshGUI(); - public void componentResized(ComponentEvent e) - { - - } - - public void componentMoved(ComponentEvent e) - { - - } - - public void componentShown(ComponentEvent e) - { - } - - public void componentHidden(ComponentEvent e) - { - } - public void setLoadingFromArchive(boolean loadingFromArchive) { this.loadingFromArchive = loadingFromArchive; @@ -1312,154 +1222,69 @@ public abstract class JalviewChimeraBinding extends } /** - * add structures and any known sequence associations * - * @returns the pdb entries added to the current set. + * @param pdbfile + * @return text report of alignment between pdbfile and any associated + * alignment sequences */ - public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe, - SequenceI[][] seq, String[][] chns) + public String printMapping(String pdbfile) { - List v = new ArrayList(); - List rtn = new ArrayList(); - for (int i = 0; i < pdbentry.length; i++) - { - v.add(pdbentry[i]); - } - for (int i = 0; i < pdbe.length; i++) + return getSsm().printMapping(pdbfile); + } + + /** + * Ask Chimera to save its session to the given file. Returns true if + * successful, else false. + * + * @param filepath + * @return + */ + public boolean saveSession(String filepath) + { + if (isChimeraRunning()) { - int r = v.indexOf(pdbe[i]); - if (r == -1 || r >= pdbentry.length) + List reply = viewer.sendChimeraCommand("save " + filepath, + true); + if (reply.contains("Session written")) { - rtn.add(new int[] - { v.size(), i }); - v.add(pdbe[i]); + return true; } else { - // just make sure the sequence/chain entries are all up to date - addSequenceAndChain(r, seq[i], chns[i]); + Cache.log + .error("Error saving Chimera session: " + reply.toString()); } } - pdbe = v.toArray(new PDBEntry[v.size()]); - pdbentry = pdbe; - if (rtn.size() > 0) - { - // expand the tied sequence[] and string[] arrays - SequenceI[][] sqs = new SequenceI[pdbentry.length][]; - String[][] sch = new String[pdbentry.length][]; - System.arraycopy(sequence, 0, sqs, 0, sequence.length); - System.arraycopy(chains, 0, sch, 0, this.chains.length); - sequence = sqs; - chains = sch; - pdbe = new PDBEntry[rtn.size()]; - for (int r = 0; r < pdbe.length; r++) - { - int[] stri = (rtn.get(r)); - // record the pdb file as a new addition - pdbe[r] = pdbentry[stri[0]]; - // and add the new sequence/chain entries - addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); - } - } - else - { - pdbe = null; - } - return pdbe; + return false; } /** - * Adds sequences to the pe'th pdbentry's sequence set. + * Ask Chimera to open a session file. Returns true if successful, else false. + * The filename must have a .py extension for this command to work. * - * @param pe - * @param seq + * @param filepath + * @return */ - public void addSequence(int pe, SequenceI[] seq) + public boolean openSession(String filepath) { - addSequenceAndChain(pe, seq, null); + evalStateCommand("open " + filepath, true); + // todo: test for failure - how? + return true; } - private void addSequenceAndChain(int pe, SequenceI[] seq, String[] tchain) + public boolean isFinishedInit() { - if (pe < 0 || pe >= pdbentry.length) - { - throw new Error(MessageManager.formatMessage( - "error.implementation_error_no_pdbentry_from_index", - new Object[] - { Integer.valueOf(pe).toString() })); - } - final String nullChain = "TheNullChain"; - List s = new ArrayList(); - List c = new ArrayList(); - if (chains == null) - { - chains = new String[pdbentry.length][]; - } - if (sequence[pe] != null) - { - for (int i = 0; i < sequence[pe].length; i++) - { - s.add(sequence[pe][i]); - if (chains[pe] != null) - { - if (i < chains[pe].length) - { - c.add(chains[pe][i]); - } - else - { - c.add(nullChain); - } - } - else - { - if (tchain != null && tchain.length > 0) - { - c.add(nullChain); - } - } - } - } - for (int i = 0; i < seq.length; i++) - { - if (!s.contains(seq[i])) - { - s.add(seq[i]); - if (tchain != null && i < tchain.length) - { - c.add(tchain[i] == null ? nullChain : tchain[i]); - } - } - } - SequenceI[] tmp = s.toArray(new SequenceI[s.size()]); - sequence[pe] = tmp; - if (c.size() > 0) - { - String[] tch = c.toArray(new String[c.size()]); - for (int i = 0; i < tch.length; i++) - { - if (tch[i] == nullChain) - { - tch[i] = null; - } - } - chains[pe] = tch; - } - else - { - chains[pe] = null; - } + return finishedInit; } - /** - * - * @param pdbfile - * @return text report of alignment between pdbfile and any associated - * alignment sequences - */ - public String printMapping(String pdbfile) + public void setFinishedInit(boolean finishedInit) + { + this.finishedInit = finishedInit; + } + + public List getChainNames() { - return ssm.printMapping(pdbfile); + return chainNames; } } diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java index 6a32f30..0df55b1 100644 --- a/src/jalview/ext/varna/JalviewVarnaBinding.java +++ b/src/jalview/ext/varna/JalviewVarnaBinding.java @@ -20,16 +20,15 @@ */ package jalview.ext.varna; -import java.awt.event.*; - -import jalview.api.SequenceStructureBinding; import jalview.api.StructureSelectionManagerProvider; -import jalview.structure.*; +import jalview.structure.StructureListener; import jalview.structures.models.SequenceStructureBindingModel; -public abstract class JalviewVarnaBinding extends SequenceStructureBindingModel implements StructureListener, - SequenceStructureBinding, ComponentListener, - StructureSelectionManagerProvider +import java.awt.event.ComponentListener; + +public abstract class JalviewVarnaBinding extends + SequenceStructureBindingModel implements StructureListener, + ComponentListener, StructureSelectionManagerProvider { diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 50043e6..6e3024d 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -55,10 +55,11 @@ import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.io.AlignmentProperties; import jalview.io.AnnotationFile; +import jalview.io.BioJsHTMLOutput; import jalview.io.FeaturesFile; import jalview.io.FileLoader; import jalview.io.FormatAdapter; -import jalview.io.HTMLOutput; +import jalview.io.HtmlSvgOutput; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; @@ -381,7 +382,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .getKeyCode() <= KeyEvent.VK_NUMPAD9)) && Character.isDigit(evt.getKeyChar())) { - alignPanel.seqPanel.numberPressed(evt.getKeyChar()); + alignPanel.getSeqPanel().numberPressed(evt.getKeyChar()); } switch (evt.getKeyCode()) @@ -399,7 +400,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (viewport.cursorMode) { - alignPanel.seqPanel.moveCursor(0, 1); + alignPanel.getSeqPanel().moveCursor(0, 1); } break; @@ -410,7 +411,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } if (viewport.cursorMode) { - alignPanel.seqPanel.moveCursor(0, -1); + alignPanel.getSeqPanel().moveCursor(0, -1); } break; @@ -418,11 +419,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_LEFT: if (evt.isAltDown() || !viewport.cursorMode) { - slideSequences(false, alignPanel.seqPanel.getKeyboardNo1()); + slideSequences(false, alignPanel.getSeqPanel().getKeyboardNo1()); } else { - alignPanel.seqPanel.moveCursor(-1, 0); + alignPanel.getSeqPanel().moveCursor(-1, 0); } break; @@ -430,18 +431,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_RIGHT: if (evt.isAltDown() || !viewport.cursorMode) { - slideSequences(true, alignPanel.seqPanel.getKeyboardNo1()); + slideSequences(true, alignPanel.getSeqPanel().getKeyboardNo1()); } else { - alignPanel.seqPanel.moveCursor(1, 0); + alignPanel.getSeqPanel().moveCursor(1, 0); } break; case KeyEvent.VK_SPACE: if (viewport.cursorMode) { - alignPanel.seqPanel.insertGapAtCursor(evt.isControlDown() + alignPanel.getSeqPanel().insertGapAtCursor(evt.isControlDown() || evt.isShiftDown() || evt.isAltDown()); } break; @@ -465,7 +466,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - alignPanel.seqPanel.deleteGapAtCursor(evt.isControlDown() + alignPanel.getSeqPanel().deleteGapAtCursor(evt.isControlDown() || evt.isShiftDown() || evt.isAltDown()); } @@ -474,19 +475,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_S: if (viewport.cursorMode) { - alignPanel.seqPanel.setCursorRow(); + alignPanel.getSeqPanel().setCursorRow(); } break; case KeyEvent.VK_C: if (viewport.cursorMode && !evt.isControlDown()) { - alignPanel.seqPanel.setCursorColumn(); + alignPanel.getSeqPanel().setCursorColumn(); } break; case KeyEvent.VK_P: if (viewport.cursorMode) { - alignPanel.seqPanel.setCursorPosition(); + alignPanel.getSeqPanel().setCursorPosition(); } break; @@ -494,20 +495,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_COMMA: if (viewport.cursorMode) { - alignPanel.seqPanel.setCursorRowAndColumn(); + alignPanel.getSeqPanel().setCursorRowAndColumn(); } break; case KeyEvent.VK_Q: if (viewport.cursorMode) { - alignPanel.seqPanel.setSelectionAreaAtCursor(true); + alignPanel.getSeqPanel().setSelectionAreaAtCursor(true); } break; case KeyEvent.VK_M: if (viewport.cursorMode) { - alignPanel.seqPanel.setSelectionAreaAtCursor(false); + alignPanel.getSeqPanel().setSelectionAreaAtCursor(false); } break; @@ -518,10 +519,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { - alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; - alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq; + alignPanel.getSeqPanel().seqCanvas.cursorX = viewport.startRes; + alignPanel.getSeqPanel().seqCanvas.cursorY = viewport.startSeq; } - alignPanel.seqPanel.seqCanvas.repaint(); + alignPanel.getSeqPanel().seqCanvas.repaint(); break; case KeyEvent.VK_F1: @@ -740,14 +741,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, abovePIDThreshold.setSelected(av.getAbovePIDThreshold()); conservationMenuItem.setSelected(av.getConservationSelected()); seqLimits.setSelected(av.getShowJVSuffix()); - idRightAlign.setSelected(av.rightAlignIds); + idRightAlign.setSelected(av.isRightAlignIds()); centreColumnLabelsMenuItem.setState(av.centreColumnLabels); renderGapsMenuItem.setSelected(av.renderGaps); wrapMenuItem.setSelected(av.wrapAlignment); scaleAbove.setVisible(av.wrapAlignment); scaleLeft.setVisible(av.wrapAlignment); scaleRight.setVisible(av.wrapAlignment); - annotationPanelMenuItem.setState(av.showAnnotation); + annotationPanelMenuItem.setState(av.isShowAnnotation()); /* * Show/hide annotations only enabled if annotation panel is shown */ @@ -767,7 +768,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, setColourSelected(ColourSchemeProperty.getColourName(av .getGlobalColourScheme())); - showSeqFeatures.setSelected(av.showSequenceFeatures); + showSeqFeatures.setSelected(av.isShowSequenceFeatures()); hiddenMarkers.setState(av.showHiddenMarkers); applyToAllGroups.setState(av.getColourAppliesToAllGroups()); showNpFeatsMenuitem.setSelected(av.isShowNpFeats()); @@ -898,7 +899,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public FeatureRenderer getFeatureRenderer() { - return alignPanel.seqPanel.seqCanvas.getFeatureRenderer(); + return alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer(); } @Override @@ -1075,10 +1076,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .lastIndexOf(java.io.File.separatorChar) + 1); } - success = new Jalview2XML().SaveAlignment(this, file, shortName); + /* + * First save any linked Chimera session. + */ + Desktop.instance.saveChimeraSessions(file); + + success = new Jalview2XML().saveAlignment(this, file, shortName); statusBar.setText(MessageManager.formatMessage( - "label.successfully_saved_to_file_in_format", new String[] + "label.successfully_saved_to_file_in_format", new Object[] { fileName, format })); } @@ -1229,11 +1235,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void htmlMenuItem_actionPerformed(ActionEvent e) { - new HTMLOutput(alignPanel, - alignPanel.seqPanel.seqCanvas.getSequenceRenderer(), - alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); + // new HTMLOutput(alignPanel, + // alignPanel.getSeqPanel().seqCanvas.getSequenceRenderer(), + // alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()); + new HtmlSvgOutput(null, alignPanel); } + @Override + public void bioJSMenuItem_actionPerformed(ActionEvent e) + { + new BioJsHTMLOutput(alignPanel, + alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()); + } public void createImageMap(File file, String image) { alignPanel.makePNGImageMap(file, image); @@ -1297,11 +1310,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void exportAnnotations_actionPerformed(ActionEvent e) { - new AnnotationExporter().exportAnnotations(alignPanel, - viewport.showAnnotation ? viewport.getAlignment() - .getAlignmentAnnotation() : null, viewport - .getAlignment().getGroups(), ((Alignment) viewport - .getAlignment()).alignmentProperties); + new AnnotationExporter().exportAnnotations(alignPanel); } @Override @@ -1624,7 +1633,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (viewport.cursorMode) { sg.add(viewport.getAlignment().getSequenceAt( - alignPanel.seqPanel.seqCanvas.cursorY)); + alignPanel.getSeqPanel().seqCanvas.cursorY)); } else if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize() != viewport @@ -1674,7 +1683,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (viewport.cursorMode) { - alignPanel.seqPanel.moveCursor(size, 0); + alignPanel.getSeqPanel().moveCursor(size, 0); } else { @@ -1685,7 +1694,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (viewport.cursorMode) { - alignPanel.seqPanel.moveCursor(-size, 0); + alignPanel.getSeqPanel().moveCursor(-size, 0); } else { @@ -1763,20 +1772,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, return; } - Vector hiddenColumns = null; + ArrayList hiddenColumns = null; if (viewport.hasHiddenColumns()) { - hiddenColumns = new Vector(); + hiddenColumns = new ArrayList(); int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport .getSelectionGroup().getEndRes(); - for (int i = 0; i < viewport.getColumnSelection().getHiddenColumns() - .size(); i++) + for (int[] region : viewport.getColumnSelection().getHiddenColumns()) { - int[] region = (int[]) viewport.getColumnSelection() - .getHiddenColumns().elementAt(i); if (region[0] >= hiddenOffset && region[1] <= hiddenCutoff) { - hiddenColumns.addElement(new int[] + hiddenColumns.add(new int[] { region[0] - hiddenOffset, region[1] - hiddenOffset }); } } @@ -2103,19 +2109,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (Desktop.jalviewClipboard != null && Desktop.jalviewClipboard[2] != null) { - Vector hc = (Vector) Desktop.jalviewClipboard[2]; - for (int i = 0; i < hc.size(); i++) + List hc = (List) Desktop.jalviewClipboard[2]; + for (int[] region : hc) { - int[] region = (int[]) hc.elementAt(i); af.viewport.hideColumns(region[0], region[1]); } } // >>>This is a fix for the moment, until a better solution is // found!!<<< - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer() + af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() .transferSettings( - alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); + alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()); // TODO: maintain provenance of an alignment, rather than just make the // title a concatenation of operations. @@ -2163,19 +2168,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (Desktop.jalviewClipboard != null && Desktop.jalviewClipboard[2] != null) { - Vector hc = (Vector) Desktop.jalviewClipboard[2]; - for (int i = 0; i < hc.size(); i++) + List hc = (List) Desktop.jalviewClipboard[2]; + for (int region[] : hc) { - int[] region = (int[]) hc.elementAt(i); af.viewport.hideColumns(region[0], region[1]); } } // >>>This is a fix for the moment, until a better solution is // found!!<<< - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer() + af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() .transferSettings( - alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); + alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()); // TODO: maintain provenance of an alignment, rather than just make the // title a concatenation of operations. @@ -2339,14 +2343,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (viewport.cursorMode) { - alignPanel.seqPanel.keyboardNo1 = null; - alignPanel.seqPanel.keyboardNo2 = null; + alignPanel.getSeqPanel().keyboardNo1 = null; + alignPanel.getSeqPanel().keyboardNo2 = null; } viewport.setSelectionGroup(null); viewport.getColumnSelection().clear(); viewport.setSelectionGroup(null); - alignPanel.seqPanel.seqCanvas.highlightSearchResults(null); - alignPanel.idPanel.idCanvas.searchResults = null; + alignPanel.getSeqPanel().seqCanvas.highlightSearchResults(null); + alignPanel.getIdPanel().getIdCanvas().searchResults = null; alignPanel.paintAlignment(true); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); @@ -2747,7 +2751,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.setShowJVSuffix(seqLimits.isSelected()); - alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel + alignPanel.getIdPanel().getIdCanvas().setPreferredSize(alignPanel .calculateIdWidth()); alignPanel.paintAlignment(true); } @@ -2755,7 +2759,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void idRightAlign_actionPerformed(ActionEvent e) { - viewport.rightAlignIds = idRightAlign.isSelected(); + viewport.setRightAlignIds(idRightAlign.isSelected()); alignPanel.paintAlignment(true); } @@ -2777,7 +2781,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (viewport.followHighlight = this.followHighlightMenuItem.getState()) { alignPanel.scrollToPosition( - alignPanel.seqPanel.seqCanvas.searchResults, false); + alignPanel.getSeqPanel().seqCanvas.searchResults, false); } } @@ -3084,7 +3088,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { viewport.setShowSequenceFeaturesHeight(showSeqFeaturesHeight .isSelected()); - if (viewport.getShowSequenceFeaturesHeight()) + if (viewport.isShowSequenceFeaturesHeight()) { // ensure we're actually displaying features viewport.setShowSequenceFeatures(true); @@ -3317,6 +3321,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } @Override + public void annotationColumn_actionPerformed(ActionEvent e) + { + new AnnotationColumnChooser(viewport, alignPanel); + } + + @Override public void rnahelicesColour_actionPerformed(ActionEvent e) { new RNAHelicesColourChooser(viewport, alignPanel); @@ -4873,8 +4883,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, try { featuresFile = new FeaturesFile(file, type).parse(viewport - .getAlignment().getDataset(), alignPanel.seqPanel.seqCanvas - .getFeatureRenderer().featureColours, false, + .getAlignment().getDataset(), alignPanel.getSeqPanel().seqCanvas + .getFeatureRenderer().getFeatureColours(), false, jalview.bin.Cache.getDefault("RELAXEDSEQIDMATCHING", false)); } catch (Exception ex) { @@ -4883,12 +4893,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (featuresFile) { - viewport.showSequenceFeatures = true; + viewport.setShowSequenceFeatures(true); showSeqFeatures.setSelected(true); - if (alignPanel.seqPanel.seqCanvas.fr != null) + if (alignPanel.getSeqPanel().seqCanvas.fr != null) { // update the min/max ranges where necessary - alignPanel.seqPanel.seqCanvas.fr.findAllFeatures(true); + alignPanel.getSeqPanel().seqCanvas.fr.findAllFeatures(true); } if (featureSettings != null) { @@ -5140,7 +5150,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // try to parse as annotation. boolean isAnnotation = (format == null || format .equalsIgnoreCase("PFAM")) ? new AnnotationFile() - .readAnnotationFile(viewport.getAlignment(), file, protocol) + .annotateAlignmentView(viewport, file, protocol) : false; if (!isAnnotation) @@ -5745,6 +5755,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, alignPanel.paintAlignment(true); } } + public void clearAlignmentSeqRep() + { + // TODO refactor alignmentseqrep to controller + if (viewport.getAlignment().hasSeqrep()) { + viewport.getAlignment().setSeqrep(null); + PaintRefresher.Refresh(this, viewport.getSequenceSetId()); + alignPanel.updateAnnotation(); + alignPanel.paintAlignment(true); + } + } @Override protected void createGroup_actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index d24f6c4..1c105d0 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -95,10 +95,6 @@ public class AlignViewport extends AlignmentViewport implements boolean renderGaps = true; - boolean showSequenceFeatures = false; - - boolean showAnnotation = true; - SequenceAnnotationOrder sortAnnotationsBy = null; int charHeight; @@ -125,12 +121,6 @@ public class AlignViewport extends AlignmentViewport implements boolean cursorMode = false; - /** - * Keys are the feature types which are currently visible. Note: Values are - * not used! - */ - Hashtable featuresDisplayed = null; - boolean antiAlias = false; Rectangle explodedPosition; @@ -149,8 +139,7 @@ public class AlignViewport extends AlignmentViewport implements Color textColour2 = Color.white; - boolean rightAlignIds = false; - + private AnnotationColumnChooser annotationColumnSelectionState; /** * Creates a new AlignViewport object. * @@ -206,16 +195,7 @@ public class AlignViewport extends AlignmentViewport implements setAlignment(al); if (hiddenColumns != null) { - this.colSel = hiddenColumns; - if (hiddenColumns.getHiddenColumns() != null - && hiddenColumns.getHiddenColumns().size() > 0) - { - hasHiddenColumns = true; - } - else - { - hasHiddenColumns = false; - } + colSel = hiddenColumns; } init(); } @@ -262,16 +242,7 @@ public class AlignViewport extends AlignmentViewport implements setAlignment(al); if (hiddenColumns != null) { - this.colSel = hiddenColumns; - if (hiddenColumns.getHiddenColumns() != null - && hiddenColumns.getHiddenColumns().size() > 0) - { - hasHiddenColumns = true; - } - else - { - hasHiddenColumns = false; - } + colSel = hiddenColumns; } init(); } @@ -286,9 +257,9 @@ public class AlignViewport extends AlignmentViewport implements antiAlias = Cache.getDefault("ANTI_ALIAS", false); showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true); - showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true); + setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true)); - rightAlignIds = Cache.getDefault("RIGHT_ALIGN_IDS", false); + setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false)); centreColumnLabels = Cache.getDefault("CENTRE_COLUMN_LABELS", false); autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true); @@ -368,22 +339,6 @@ public class AlignViewport extends AlignmentViewport implements } /** - * set the flag - * - * @param b - * features are displayed if true - */ - public void setShowSequenceFeatures(boolean b) - { - showSequenceFeatures = b; - } - - public boolean getShowSequenceFeatures() - { - return showSequenceFeatures; - } - - /** * centre columnar annotation labels in displayed alignment annotation TODO: * add to jalviewXML and annotation display settings */ @@ -837,27 +792,6 @@ public class AlignViewport extends AlignmentViewport implements * * @return DOCUMENT ME! */ - public boolean getShowAnnotation() - { - return showAnnotation; - } - - /** - * DOCUMENT ME! - * - * @param b - * DOCUMENT ME! - */ - public void setShowAnnotation(boolean b) - { - showAnnotation = b; - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ public boolean getScaleAboveWrapped() { return scaleAboveWrapped; @@ -1057,23 +991,6 @@ public class AlignViewport extends AlignmentViewport implements shownpfeats = show; } - /** - * - * @return true if view has hidden rows - */ - public boolean hasHiddenRows() - { - return hasHiddenRows; - } - - /** - * - * @return true if view has hidden columns - */ - public boolean hasHiddenColumns() - { - return hasHiddenColumns; - } /** * when set, view will scroll to show the highlighted position @@ -1101,8 +1018,6 @@ public class AlignViewport extends AlignmentViewport implements return followSelection; } - boolean showSeqFeaturesHeight; - public void sendSelection() { jalview.structure.StructureSelectionManager @@ -1111,16 +1026,6 @@ public class AlignViewport extends AlignmentViewport implements new ColumnSelection(getColumnSelection()), this); } - public void setShowSequenceFeaturesHeight(boolean selected) - { - showSeqFeaturesHeight = selected; - } - - public boolean getShowSequenceFeaturesHeight() - { - return showSeqFeaturesHeight; - } - /** * return the alignPanel containing the given viewport. Use this to get the * components currently handling the given viewport. @@ -1293,4 +1198,15 @@ public class AlignViewport extends AlignmentViewport implements { this.showAutocalculatedAbove = showAutocalculatedAbove; } + + public AnnotationColumnChooser getAnnotationColumnSelectionState() + { + return annotationColumnSelectionState; + } + + public void setAnnotationColumnSelectionState( + AnnotationColumnChooser currentAnnotationColumnSelectionState) + { + this.annotationColumnSelectionState = currentAnnotationColumnSelectionState; + } } diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 2398bda..6517e70 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -29,6 +29,7 @@ import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.jbgui.GAlignmentPanel; +import jalview.math.AlignmentDimension; import jalview.schemes.ResidueProperties; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; @@ -66,20 +67,21 @@ public class AlignmentPanel extends GAlignmentPanel implements OverviewPanel overviewPanel; - SeqPanel seqPanel; + private SeqPanel seqPanel; - IdPanel idPanel; + private IdPanel idPanel; + private boolean headless; IdwidthAdjuster idwidthAdjuster; /** DOCUMENT ME!! */ public AlignFrame alignFrame; - ScalePanel scalePanel; + private ScalePanel scalePanel; - AnnotationPanel annotationPanel; + private AnnotationPanel annotationPanel; - AnnotationLabels alabels; + private AnnotationLabels alabels; // this value is set false when selection area being dragged boolean fastPaint = true; @@ -100,27 +102,27 @@ public class AlignmentPanel extends GAlignmentPanel implements { alignFrame = af; this.av = av; - seqPanel = new SeqPanel(av, this); - idPanel = new IdPanel(av, this); + setSeqPanel(new SeqPanel(av, this)); + setIdPanel(new IdPanel(av, this)); - scalePanel = new ScalePanel(av, this); + setScalePanel(new ScalePanel(av, this)); - idPanelHolder.add(idPanel, BorderLayout.CENTER); + idPanelHolder.add(getIdPanel(), BorderLayout.CENTER); idwidthAdjuster = new IdwidthAdjuster(this); idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER); - annotationPanel = new AnnotationPanel(this); - alabels = new AnnotationLabels(this); + setAnnotationPanel(new AnnotationPanel(this)); + setAlabels(new AnnotationLabels(this)); - annotationScroller.setViewportView(annotationPanel); - annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER); + annotationScroller.setViewportView(getAnnotationPanel()); + annotationSpaceFillerHolder.add(getAlabels(), BorderLayout.CENTER); - scalePanelHolder.add(scalePanel, BorderLayout.CENTER); - seqPanelHolder.add(seqPanel, BorderLayout.CENTER); + scalePanelHolder.add(getScalePanel(), BorderLayout.CENTER); + seqPanelHolder.add(getSeqPanel(), BorderLayout.CENTER); setScrollValues(0, 0); - setAnnotationVisible(av.getShowAnnotation()); + setAnnotationVisible(av.isShowAnnotation()); hscroll.addAdjustmentListener(this); vscroll.addAdjustmentListener(this); @@ -166,13 +168,13 @@ public class AlignmentPanel extends GAlignmentPanel implements idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight + fm.getDescent())); - idPanel.idCanvas.gg = null; - seqPanel.seqCanvas.img = null; - annotationPanel.adjustPanelHeight(); + getIdPanel().getIdCanvas().gg = null; + getSeqPanel().seqCanvas.img = null; + getAnnotationPanel().adjustPanelHeight(); Dimension d = calculateIdWidth(); d.setSize(d.width + 4, d.height); - idPanel.idCanvas.setPreferredSize(d); + getIdPanel().getIdCanvas().setPreferredSize(d); hscrollFillerPanel.setPreferredSize(d); if (overviewPanel != null) @@ -240,7 +242,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (al.getAlignmentAnnotation() != null) { - fm = c.getFontMetrics(alabels.getFont()); + fm = c.getFontMetrics(getAlabels().getFont()); while (i < al.getAlignmentAnnotation().length) { @@ -266,7 +268,7 @@ public class AlignmentPanel extends GAlignmentPanel implements public void highlightSearchResults(SearchResults results) { scrollToPosition(results); - seqPanel.seqCanvas.highlightSearchResults(results); + getSeqPanel().seqCanvas.highlightSearchResults(results); } /** @@ -371,8 +373,8 @@ public class AlignmentPanel extends GAlignmentPanel implements void scrollToWrappedVisible(int res) { - int cwidth = seqPanel.seqCanvas - .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); + int cwidth = getSeqPanel().seqCanvas + .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); if (res < av.getStartRes() || res >= (av.getStartRes() + cwidth)) { vscroll.setValue((res / cwidth)); @@ -441,7 +443,7 @@ public class AlignmentPanel extends GAlignmentPanel implements */ protected void validateAnnotationDimensions(boolean adjustPanelHeight) { - int height = annotationPanel.adjustPanelHeight(); + int height = getAnnotationPanel().adjustPanelHeight(); int theight = av.getCharHeight() * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 @@ -503,7 +505,7 @@ public class AlignmentPanel extends GAlignmentPanel implements annotationScroller.setVisible(false); annotationSpaceFillerHolder.setVisible(false); } - else if (av.showAnnotation) + else if (av.isShowAnnotation()) { annotationScroller.setVisible(true); annotationSpaceFillerHolder.setVisible(true); @@ -603,10 +605,10 @@ public class AlignmentPanel extends GAlignmentPanel implements width = av.getColumnSelection().findColumnPosition(width); } - av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1); + av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av.charWidth)) - 1); - hextent = seqPanel.seqCanvas.getWidth() / av.charWidth; - vextent = seqPanel.seqCanvas.getHeight() / av.charHeight; + hextent = getSeqPanel().seqCanvas.getWidth() / av.charWidth; + vextent = getSeqPanel().seqCanvas.getHeight() / av.charHeight; if (hextent > width) { @@ -658,7 +660,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { int x = hscroll.getValue(); av.setStartRes(x); - av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1); + av.setEndRes((x + (getSeqPanel().seqCanvas.getWidth() / av.getCharWidth())) - 1); } if (evt.getSource() == vscroll) @@ -669,8 +671,8 @@ public class AlignmentPanel extends GAlignmentPanel implements { if (offy > -1) { - int rowSize = seqPanel.seqCanvas - .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); + int rowSize = getSeqPanel().seqCanvas + .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); av.setStartRes(offy * rowSize); av.setEndRes((offy + 1) * rowSize); } @@ -692,7 +694,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { av.setStartSeq(offy); av.setEndSeq(offy - + (seqPanel.seqCanvas.getHeight() / av.getCharHeight())); + + (getSeqPanel().seqCanvas.getHeight() / av.getCharHeight())); } } @@ -723,13 +725,13 @@ public class AlignmentPanel extends GAlignmentPanel implements if (scrollX != 0 || scrollY != 0) { - idPanel.idCanvas.fastPaint(scrollY); - seqPanel.seqCanvas.fastPaint(scrollX, scrollY); - scalePanel.repaint(); + getIdPanel().getIdCanvas().fastPaint(scrollY); + getSeqPanel().seqCanvas.fastPaint(scrollX, scrollY); + getScalePanel().repaint(); - if (av.getShowAnnotation() && scrollX != 0) + if (av.isShowAnnotation() && scrollX != 0) { - annotationPanel.fastPaint(scrollX); + getAnnotationPanel().fastPaint(scrollX); } } } @@ -769,7 +771,7 @@ public class AlignmentPanel extends GAlignmentPanel implements { invalidate(); - Dimension d = idPanel.idCanvas.getPreferredSize(); + Dimension d = getIdPanel().getIdCanvas().getPreferredSize(); idPanelHolder.setPreferredSize(d); hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12)); validate(); @@ -783,13 +785,13 @@ public class AlignmentPanel extends GAlignmentPanel implements maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; } - int canvasWidth = seqPanel.seqCanvas - .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth()); + int canvasWidth = getSeqPanel().seqCanvas + .getWrappedCanvasWidth(getSeqPanel().seqCanvas.getWidth()); if (canvasWidth > 0) { int max = maxwidth - / seqPanel.seqCanvas - .getWrappedCanvasWidth(seqPanel.seqCanvas + / getSeqPanel().seqCanvas + .getWrappedCanvasWidth(getSeqPanel().seqCanvas .getWidth()) + 1; vscroll.setMaximum(max); vscroll.setUnitIncrement(1); @@ -905,9 +907,9 @@ public class AlignmentPanel extends GAlignmentPanel implements int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1) * pheight; - if (av.showAnnotation) + if (av.isShowAnnotation()) { - pagesHigh += annotationPanel.adjustPanelHeight() + 3; + pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3; } pagesHigh /= pheight; @@ -919,7 +921,7 @@ public class AlignmentPanel extends GAlignmentPanel implements // draw Scale pg.translate(idWidth, 0); - scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, + getScalePanel().drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight); pg.translate(-idWidth, scaleHeight); @@ -928,7 +930,7 @@ public class AlignmentPanel extends GAlignmentPanel implements Color currentColor = null; Color currentTextColor = null; - pg.setFont(idPanel.idCanvas.idfont); + pg.setFont(getIdPanel().getIdCanvas().getIdfont()); SequenceI seq; for (int i = startSeq; i < endSeq; i++) @@ -953,7 +955,7 @@ public class AlignmentPanel extends GAlignmentPanel implements pg.setColor(currentTextColor); int xPos = 0; - if (av.rightAlignIds) + if (av.isRightAlignIds()) { fm = pg.getFontMetrics(); xPos = idWidth @@ -972,17 +974,17 @@ public class AlignmentPanel extends GAlignmentPanel implements // draw main sequence panel pg.translate(idWidth, 0); - seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0); + getSeqPanel().seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0); - if (av.showAnnotation && (endSeq == av.getAlignment().getHeight())) + if (av.isShowAnnotation() && (endSeq == av.getAlignment().getHeight())) { // draw annotation - need to offset for current scroll position - int offset = -alabels.scrollOffset; + int offset = -getAlabels().getScrollOffset(); pg.translate(0, offset); pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3); - alabels.drawComponent(pg, idWidth); + getAlabels().drawComponent(pg, idWidth); pg.translate(idWidth + 3, 0); - annotationPanel.renderer.drawComponent(annotationPanel, av, + getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, pg, -1, startRes, endRes + 1); pg.translate(0, -offset); } @@ -1013,9 +1015,9 @@ public class AlignmentPanel extends GAlignmentPanel implements int annotationHeight = 0; AnnotationLabels labels = null; - if (av.showAnnotation) + if (av.isShowAnnotation()) { - annotationHeight = annotationPanel.adjustPanelHeight(); + annotationHeight = getAnnotationPanel().adjustPanelHeight(); labels = new AnnotationLabels(av); } @@ -1036,7 +1038,7 @@ public class AlignmentPanel extends GAlignmentPanel implements maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1; } - int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth + int resWidth = getSeqPanel().seqCanvas.getWrappedCanvasWidth(pwidth - idWidth); int totalHeight = cHeight * (maxwidth / resWidth + 1); @@ -1059,11 +1061,11 @@ public class AlignmentPanel extends GAlignmentPanel implements { for (int i = 0; i < av.getAlignment().getHeight(); i++) { - pg.setFont(idPanel.idCanvas.idfont); + pg.setFont(getIdPanel().getIdCanvas().getIdfont()); SequenceI s = av.getAlignment().getSequenceAt(i); String string = s.getDisplayId(av.getShowJVSuffix()); int xPos = 0; - if (av.rightAlignIds) + if (av.isRightAlignIds()) { FontMetrics fm = pg.getFontMetrics(); xPos = idWidth - fm.stringWidth(string) - 4; @@ -1088,7 +1090,7 @@ public class AlignmentPanel extends GAlignmentPanel implements pg.translate(idWidth, 0); - seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, + getSeqPanel().seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0); if ((pi * pheight) < totalHeight) @@ -1108,7 +1110,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * * @return */ - int getVisibleIdWidth() + public int getVisibleIdWidth() { return getVisibleIdWidth(true); } @@ -1122,7 +1124,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * be returned * @return */ - int getVisibleIdWidth(boolean onscreen) + public int getVisibleIdWidth(boolean onscreen) { // see if rendering offscreen - check preferences and calc width accordingly if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false)) @@ -1133,7 +1135,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (onscreen || (idwidth = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null) { - return (idPanel.getWidth() > 0 ? idPanel.getWidth() + return (getIdPanel().getWidth() > 0 ? getIdPanel().getWidth() : calculateIdWidth().width + 4); } return idwidth.intValue() + 4; @@ -1142,7 +1144,7 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file) { long progress = System.currentTimeMillis(); - boolean headless = (System.getProperty("java.awt.headless") != null && System + headless = (System.getProperty("java.awt.headless") != null && System .getProperty("java.awt.headless").equals("true")); if (alignFrame != null && !headless) { @@ -1153,44 +1155,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } try { - int maxwidth = av.getAlignment().getWidth(); - if (av.hasHiddenColumns()) - { - maxwidth = av.getColumnSelection().findColumnPosition(maxwidth); - } - - int height = ((av.getAlignment().getHeight() + 1) * av.charHeight) - + scalePanel.getHeight(); - int width = getVisibleIdWidth(false) + (maxwidth * av.charWidth); - - if (av.getWrapAlignment()) - { - height = getWrappedHeight(); - if (headless) - { - // need to obtain default alignment width and then add in any - // additional allowance for id margin - // this duplicates the calculation in getWrappedHeight but adjusts for - // offscreen idWith - width = alignFrame.getWidth() - vscroll.getPreferredSize().width - - alignFrame.getInsets().left - - alignFrame.getInsets().right - getVisibleIdWidth() - + getVisibleIdWidth(false); - } - else - { - width = seqPanel.getWidth() + getVisibleIdWidth(false); - } - - } - else if (av.getShowAnnotation()) - { - height += annotationPanel.adjustPanelHeight() + 3; - } - + AlignmentDimension aDimension = getAlignmentDimension(); try { - jalview.util.ImageMaker im; final String imageAction, imageTitle; if (type == jalview.util.ImageMaker.TYPE.PNG) @@ -1209,13 +1176,15 @@ public class AlignmentPanel extends GAlignmentPanel implements imageTitle = alignFrame.getTitle(); } - im = new jalview.util.ImageMaker(this, type, imageAction, width, - height, file, imageTitle); + im = new jalview.util.ImageMaker(this, type, imageAction, + aDimension.getWidth(), aDimension.getHeight(), file, + imageTitle); if (av.getWrapAlignment()) { if (im.getGraphics() != null) { - printWrappedAlignment(im.getGraphics(), width, height, 0); + printWrappedAlignment(im.getGraphics(), aDimension.getWidth(), + aDimension.getHeight(), 0); im.writeImage(); } } @@ -1223,7 +1192,8 @@ public class AlignmentPanel extends GAlignmentPanel implements { if (im.getGraphics() != null) { - printUnwrapped(im.getGraphics(), width, height, 0); + printUnwrapped(im.getGraphics(), aDimension.getWidth(), + aDimension.getHeight(), 0); im.writeImage(); } } @@ -1247,6 +1217,46 @@ public class AlignmentPanel extends GAlignmentPanel implements } } + public AlignmentDimension getAlignmentDimension() + { + int maxwidth = av.getAlignment().getWidth(); + if (av.hasHiddenColumns()) + { + maxwidth = av.getColumnSelection().findColumnPosition(maxwidth); + } + + int height = ((av.getAlignment().getHeight() + 1) * av.charHeight) + + getScalePanel().getHeight(); + int width = getVisibleIdWidth(false) + (maxwidth * av.charWidth); + + if (av.getWrapAlignment()) + { + height = getWrappedHeight(); + if (headless) + { + // need to obtain default alignment width and then add in any + // additional allowance for id margin + // this duplicates the calculation in getWrappedHeight but adjusts for + // offscreen idWith + width = alignFrame.getWidth() - vscroll.getPreferredSize().width + - alignFrame.getInsets().left + - alignFrame.getInsets().right - getVisibleIdWidth() + + getVisibleIdWidth(false); + } + else + { + width = getSeqPanel().getWidth() + getVisibleIdWidth(false); + } + + } + else if (av.isShowAnnotation()) + { + height += getAnnotationPanel().adjustPanelHeight() + 3; + } + return new AlignmentDimension(width, height); + + } + /** * DOCUMENT ME! */ @@ -1410,7 +1420,7 @@ public class AlignmentPanel extends GAlignmentPanel implements int getWrappedHeight() { - int seqPanelWidth = seqPanel.seqCanvas.getWidth(); + int seqPanelWidth = getSeqPanel().seqCanvas.getWidth(); if (System.getProperty("java.awt.headless") != null && System.getProperty("java.awt.headless").equals("true")) @@ -1420,7 +1430,7 @@ public class AlignmentPanel extends GAlignmentPanel implements - alignFrame.getInsets().left - alignFrame.getInsets().right; } - int chunkWidth = seqPanel.seqCanvas + int chunkWidth = getSeqPanel().seqCanvas .getWrappedCanvasWidth(seqPanelWidth); int hgap = av.charHeight; @@ -1430,9 +1440,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } int annotationHeight = 0; - if (av.showAnnotation) + if (av.isShowAnnotation()) { - annotationHeight = annotationPanel.adjustPanelHeight(); + annotationHeight = getAnnotationPanel().adjustPanelHeight(); } int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap @@ -1455,15 +1465,15 @@ public class AlignmentPanel extends GAlignmentPanel implements */ public void closePanel() { - PaintRefresher.RemoveComponent(seqPanel.seqCanvas); - PaintRefresher.RemoveComponent(idPanel.idCanvas); + PaintRefresher.RemoveComponent(getSeqPanel().seqCanvas); + PaintRefresher.RemoveComponent(getIdPanel().getIdCanvas()); PaintRefresher.RemoveComponent(this); if (av != null) { jalview.structure.StructureSelectionManager ssm = av .getStructureSelectionManager(); - ssm.removeStructureViewerListener(seqPanel, null); - ssm.removeSelectionListener(seqPanel); + ssm.removeStructureViewerListener(getSeqPanel(), null); + ssm.removeSelectionListener(getSeqPanel()); av.setAlignment(null); av = null; } @@ -1543,22 +1553,77 @@ public class AlignmentPanel extends GAlignmentPanel implements new OOMWarning(string, error, this); } - public FeatureRenderer cloneFeatureRenderer() + @Override + public jalview.api.FeatureRenderer cloneFeatureRenderer() { return new FeatureRenderer(this); } - - public void updateFeatureRenderer(FeatureRenderer fr) + @Override + public jalview.api.FeatureRenderer getFeatureRenderer() { - fr.transferSettings(seqPanel.seqCanvas.getFeatureRenderer()); + return seqPanel.seqCanvas.getFeatureRenderer(); + } + public void updateFeatureRenderer(jalview.renderer.seqfeatures.FeatureRenderer fr) + { + fr.transferSettings(getSeqPanel().seqCanvas.getFeatureRenderer()); } - public void updateFeatureRendererFrom(FeatureRenderer fr) + public void updateFeatureRendererFrom(jalview.api.FeatureRenderer fr) { - if (seqPanel.seqCanvas.getFeatureRenderer() != null) + if (getSeqPanel().seqCanvas.getFeatureRenderer() != null) { - seqPanel.seqCanvas.getFeatureRenderer().transferSettings(fr); + getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(fr); } } + + public ScalePanel getScalePanel() + { + return scalePanel; + } + + public void setScalePanel(ScalePanel scalePanel) + { + this.scalePanel = scalePanel; + } + + public SeqPanel getSeqPanel() + { + return seqPanel; + } + + public void setSeqPanel(SeqPanel seqPanel) + { + this.seqPanel = seqPanel; + } + + public AnnotationPanel getAnnotationPanel() + { + return annotationPanel; + } + + public void setAnnotationPanel(AnnotationPanel annotationPanel) + { + this.annotationPanel = annotationPanel; + } + + public AnnotationLabels getAlabels() + { + return alabels; + } + + public void setAlabels(AnnotationLabels alabels) + { + this.alabels = alabels; + } + + public IdPanel getIdPanel() + { + return idPanel; + } + + public void setIdPanel(IdPanel idPanel) + { + this.idPanel = idPanel; + } } diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index b8996b6..2ad0bd2 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -21,8 +21,6 @@ package jalview.gui; import jalview.bin.Cache; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.GraphLine; import jalview.datamodel.SequenceGroup; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; @@ -37,51 +35,50 @@ import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.Hashtable; -import java.util.Vector; import javax.swing.BorderFactory; import javax.swing.JButton; -import javax.swing.JCheckBox; import javax.swing.JColorChooser; import javax.swing.JComboBox; import javax.swing.JInternalFrame; import javax.swing.JLayeredPane; import javax.swing.JPanel; -import javax.swing.JSlider; -import javax.swing.JTextField; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import net.miginfocom.swing.MigLayout; -public class AnnotationColourChooser extends JPanel +@SuppressWarnings("serial") +public class AnnotationColourChooser extends AnnotationRowFilter { - JInternalFrame frame; - - AlignViewport av; - - AlignmentPanel ap; ColourSchemeI oldcs; - Hashtable oldgroupColours; - - jalview.datamodel.AlignmentAnnotation currentAnnotation; - - boolean adjusting = false; + Hashtable oldgroupColours; /** * enabled if the user is dragging the slider - try to keep updates to a * minimun */ - boolean sliderDragging = false; + + JComboBox annotations; + + JButton defColours = new JButton(); + + + JPanel jPanel1 = new JPanel(); + + JPanel jPanel2 = new JPanel(); + + BorderLayout borderLayout1 = new BorderLayout(); + + private JComboBox threshold = new JComboBox(); public AnnotationColourChooser(AlignViewport av, final AlignmentPanel ap) { + super(av, ap); oldcs = av.getGlobalColourScheme(); if (av.getAlignment().getGroups() != null) { - oldgroupColours = new Hashtable(); + oldgroupColours = new Hashtable(); for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { if (sg.cs != null) @@ -90,8 +87,6 @@ public class AnnotationColourChooser extends JPanel } } } - this.av = av; - this.ap = ap; frame = new JInternalFrame(); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); @@ -99,45 +94,8 @@ public class AnnotationColourChooser extends JPanel MessageManager.getString("label.colour_by_annotation"), 520, 215); - slider.addChangeListener(new ChangeListener() - { - @Override - public void stateChanged(ChangeEvent evt) - { - if (!adjusting) - { - thresholdValue.setText((slider.getValue() / 1000f) + ""); - valueChanged(!sliderDragging); - } - } - }); - slider.addMouseListener(new MouseAdapter() - { - @Override - public void mousePressed(MouseEvent e) - { - sliderDragging = true; - super.mousePressed(e); - } - - @Override - public void mouseDragged(MouseEvent e) - { - sliderDragging = true; - super.mouseDragged(e); - } - - @Override - public void mouseReleased(MouseEvent evt) - { - if (sliderDragging) - { - sliderDragging = false; - valueChanged(true); - } - ap.paintAlignment(true); - } - }); + addSliderChangeListener(); + addSliderMouseListeners(); if (av.getAlignment().getAlignmentAnnotation() == null) { @@ -161,15 +119,10 @@ public class AnnotationColourChooser extends JPanel seqAssociated.setSelected(acg.isSeqAssociated()); } - annotations = new JComboBox( + annotations = new JComboBox( getAnnotationItems(seqAssociated.isSelected())); - threshold.addItem(MessageManager - .getString("label.threshold_feature_no_thereshold")); - threshold.addItem(MessageManager - .getString("label.threshold_feature_above_thereshold")); - threshold.addItem(MessageManager - .getString("label.threshold_feature_below_thereshold")); + populateThresholdComboBox(threshold); if (oldcs instanceof AnnotationColourGradient) { @@ -178,13 +131,13 @@ public class AnnotationColourChooser extends JPanel switch (acg.getAboveThreshold()) { case AnnotationColourGradient.NO_THRESHOLD: - threshold.setSelectedIndex(0); + getThreshold().setSelectedIndex(0); break; case AnnotationColourGradient.ABOVE_THRESHOLD: - threshold.setSelectedIndex(1); + getThreshold().setSelectedIndex(1); break; case AnnotationColourGradient.BELOW_THRESHOLD: - threshold.setSelectedIndex(2); + getThreshold().setSelectedIndex(2); break; default: throw new Error(MessageManager.getString("error.implementation_error_dont_know_about_thereshold_setting")); @@ -199,62 +152,11 @@ public class AnnotationColourChooser extends JPanel } catch (Exception ex) { } - adjusting = false; - changeColour(); + updateView(); frame.invalidate(); frame.pack(); - - } - - private Vector getAnnotationItems(boolean isSeqAssociated) - { - Vector list = new Vector(); - int index = 1; - int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; - boolean enableSeqAss = false; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) - { - if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null) - { - if (isSeqAssociated) - { - continue; - } - } - else - { - enableSeqAss = true; - } - String label = av.getAlignment().getAlignmentAnnotation()[i].label; - if (!list.contains(label)) - { - anmap[list.size()] = i; - list.add(label); - - } - else - { - if (!isSeqAssociated) - { - anmap[list.size()] = i; - list.add(label + "_" + (index++)); - } - } - } - seqAssociated.setEnabled(enableSeqAss); - this.annmap = new int[list.size()]; - System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length); - return list; - } - - private void setDefaultMinMax() - { - minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", - Color.orange)); - maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", - Color.red)); } public AnnotationColourChooser() @@ -342,7 +244,7 @@ public class AnnotationColourChooser extends JPanel annotations_actionPerformed(e); } }); - threshold.addActionListener(new ActionListener() + getThreshold().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) @@ -400,7 +302,7 @@ public class AnnotationColourChooser extends JPanel @Override public void actionPerformed(ActionEvent arg0) { - seqAssociated_actionPerformed(arg0); + seqAssociated_actionPerformed(arg0, annotations, seqAssociated); } }); @@ -419,7 +321,7 @@ public class AnnotationColourChooser extends JPanel colpanel.add(minColour); colpanel.add(maxColour); jPanel2.add(colpanel, "wrap"); - jPanel2.add(threshold); + jPanel2.add(getThreshold()); jPanel2.add(defColours, "skip 1, wrap"); jPanel2.add(thresholdIsMin); jPanel2.add(slider, "grow"); @@ -429,72 +331,19 @@ public class AnnotationColourChooser extends JPanel this.validate(); } - protected void seqAssociated_actionPerformed(ActionEvent arg0) - { - adjusting = true; - String cursel = (String) annotations.getSelectedItem(); - boolean isvalid = false, isseqs = seqAssociated.isSelected(); - this.annotations.removeAllItems(); - for (String anitem : getAnnotationItems(seqAssociated.isSelected())) - { - if (anitem.equals(cursel) || (isseqs && cursel.startsWith(anitem))) - { - isvalid = true; - cursel = anitem; - } - this.annotations.addItem(anitem); - } - adjusting = false; - if (isvalid) - { - this.annotations.setSelectedItem(cursel); - } - else - { - if (annotations.getItemCount() > 0) - { - annotations.setSelectedIndex(0); - } - } - } - protected void resetColours_actionPerformed(ActionEvent arg0) { setDefaultMinMax(); - changeColour(); + updateView(); } - JComboBox annotations; - - int[] annmap; - - JPanel minColour = new JPanel(); - - JPanel maxColour = new JPanel(); - - JButton defColours = new JButton(); - - JButton ok = new JButton(); - - JButton cancel = new JButton(); - - JPanel jPanel1 = new JPanel(); - - JPanel jPanel2 = new JPanel(); - - BorderLayout borderLayout1 = new BorderLayout(); - - JComboBox threshold = new JComboBox(); - - JSlider slider = new JSlider(); - - JTextField thresholdValue = new JTextField(20); - - JCheckBox currentColours = new JCheckBox(); - - JCheckBox thresholdIsMin = new JCheckBox(); - - JCheckBox seqAssociated = new JCheckBox(); + private void setDefaultMinMax() + { + minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", + Color.orange)); + maxColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", + Color.red)); + } public void minColour_actionPerformed() { @@ -505,7 +354,7 @@ public class AnnotationColourChooser extends JPanel minColour.setBackground(col); } minColour.repaint(); - changeColour(); + updateView(); } public void maxColour_actionPerformed() @@ -517,247 +366,115 @@ public class AnnotationColourChooser extends JPanel maxColour.setBackground(col); } maxColour.repaint(); - changeColour(); + updateView(); } - void changeColour() + public void reset() { - // Check if combobox is still adjusting - if (adjusting) - { - return; - } - - currentAnnotation = av.getAlignment().getAlignmentAnnotation()[annmap[annotations - .getSelectedIndex()]]; - - int aboveThreshold = -1; - if (threshold.getSelectedIndex() == 1) - { - aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; - } - else if (threshold.getSelectedIndex() == 2) - { - aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; - } - - slider.setEnabled(true); - thresholdValue.setEnabled(true); - thresholdIsMin.setEnabled(true); - - if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD) - { - slider.setEnabled(false); - thresholdValue.setEnabled(false); - thresholdValue.setText(""); - thresholdIsMin.setEnabled(false); - } - else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD - && currentAnnotation.threshold == null) - { - currentAnnotation - .setThreshold(new jalview.datamodel.GraphLine( - (currentAnnotation.graphMax - currentAnnotation.graphMin) / 2f, - "Threshold", Color.black)); - } - - if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) - { - adjusting = true; - float range = currentAnnotation.graphMax * 1000 - - currentAnnotation.graphMin * 1000; - - slider.setMinimum((int) (currentAnnotation.graphMin * 1000)); - slider.setMaximum((int) (currentAnnotation.graphMax * 1000)); - slider.setValue((int) (currentAnnotation.threshold.value * 1000)); - thresholdValue.setText(currentAnnotation.threshold.value + ""); - slider.setMajorTickSpacing((int) (range / 10f)); - slider.setEnabled(true); - thresholdValue.setEnabled(true); - adjusting = false; - } - - AnnotationColourGradient acg = null; - if (currentColours.isSelected()) - { - acg = new AnnotationColourGradient(currentAnnotation, - av.getGlobalColourScheme(), aboveThreshold); - } - else - { - acg = new AnnotationColourGradient(currentAnnotation, - minColour.getBackground(), maxColour.getBackground(), - aboveThreshold); - } - acg.setSeqAssociated(seqAssociated.isSelected()); - - if (currentAnnotation.graphMin == 0f - && currentAnnotation.graphMax == 0f) - { - acg.setPredefinedColours(true); - } - - acg.thresholdIsMinMax = thresholdIsMin.isSelected(); - - av.setGlobalColourScheme(acg); - + av.setGlobalColourScheme(oldcs); if (av.getAlignment().getGroups() != null) { for (SequenceGroup sg : ap.av.getAlignment().getGroups()) { - if (sg.cs == null) - { - continue; - } - - if (currentColours.isSelected()) - { - sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs, - aboveThreshold); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); - - } - else - { - sg.cs = new AnnotationColourGradient(currentAnnotation, - minColour.getBackground(), maxColour.getBackground(), - aboveThreshold); - ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated - .isSelected()); - } - + sg.cs = oldgroupColours.get(sg); } } - ap.alignmentChanged(); - // ensure all associated views (overviews, structures, etc) are notified of - // updated colours. - ap.paintAlignment(true); } - public void ok_actionPerformed(ActionEvent e) - { - changeColour(); - try - { - frame.setClosed(true); - } catch (Exception ex) - { - } - } - - public void cancel_actionPerformed(ActionEvent e) + public void valueChanged(boolean updateAllAnnotation) { - reset(); - // ensure all original colouring is propagated to listeners. - ap.paintAlignment(true); - try + if (slider.isEnabled()) { - frame.setClosed(true); - } catch (Exception ex) - { - } - } - - void reset() - { - av.setGlobalColourScheme(oldcs); - if (av.getAlignment().getGroups() != null) - { - - for (SequenceGroup sg : ap.av.getAlignment().getGroups()) + if (currentColours.isSelected() + && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) { - sg.cs = (ColourSchemeI) oldgroupColours.get(sg); + updateView(); } + getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; + propagateSeqAssociatedThreshold(updateAllAnnotation, + getCurrentAnnotation()); + ap.paintAlignment(false); } } - public void thresholdCheck_actionPerformed(ActionEvent e) - { - changeColour(); - } - - public void annotations_actionPerformed(ActionEvent e) - { - changeColour(); - } - - public void threshold_actionPerformed(ActionEvent e) + public JComboBox getThreshold() { - changeColour(); + return threshold; } - public void thresholdValue_actionPerformed(ActionEvent e) + public void setThreshold(JComboBox threshold) { - try - { - float f = Float.parseFloat(thresholdValue.getText()); - slider.setValue((int) (f * 1000)); - } catch (NumberFormatException ex) - { - } + this.threshold = threshold; } - public void valueChanged(boolean updateAllAnnotation) + public void currentColours_actionPerformed(ActionEvent e) { - if (currentColours.isSelected() - && !(av.getGlobalColourScheme() instanceof AnnotationColourGradient)) + if (currentColours.isSelected()) { - changeColour(); + reset(); } - currentAnnotation.threshold.value = slider.getValue() / 1000f; - propagateSeqAssociatedThreshold(updateAllAnnotation); - ap.paintAlignment(false); + maxColour.setEnabled(!currentColours.isSelected()); + minColour.setEnabled(!currentColours.isSelected()); + updateView(); } - private void propagateSeqAssociatedThreshold(boolean allAnnotation) + @Override + public void updateView() { - if (currentAnnotation.sequenceRef == null - || currentAnnotation.threshold == null) + // Check if combobox is still adjusting + if (adjusting) { return; } - // TODO: JAL-1327 only update visible annotation thresholds if allAnnotation - // is false, since we only need to provide a quick visual indicator - float thr = currentAnnotation.threshold.value; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[annotations + .getSelectedIndex()]]); + + int selectedThresholdItem = getSelectedThresholdItem(getThreshold() + .getSelectedIndex()); + + slider.setEnabled(true); + thresholdValue.setEnabled(true); + thresholdIsMin.setEnabled(true); + + if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) { - AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i]; - if (aa.label.equals(currentAnnotation.label) - && (currentAnnotation.getCalcId() == null ? aa.getCalcId() == null - : currentAnnotation.getCalcId() - .equals(aa.getCalcId()))) - { - if (aa.threshold == null) - { - aa.threshold = new GraphLine(currentAnnotation.threshold); - } - else - { - aa.threshold.value = thr; - } - } + slider.setEnabled(false); + thresholdValue.setEnabled(false); + thresholdValue.setText(""); + thresholdIsMin.setEnabled(false); } - } - - public void currentColours_actionPerformed(ActionEvent e) - { - if (currentColours.isSelected()) + else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD + && getCurrentAnnotation().threshold == null) { - reset(); + getCurrentAnnotation() + .setThreshold(new jalview.datamodel.GraphLine( + (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); } - maxColour.setEnabled(!currentColours.isSelected()); - minColour.setEnabled(!currentColours.isSelected()); + if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) + { + adjusting = true; + float range = getCurrentAnnotation().graphMax * 1000 + - getCurrentAnnotation().graphMin * 1000; - changeColour(); - } + slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); + slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); + slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); + thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); + slider.setMajorTickSpacing((int) (range / 10f)); + slider.setEnabled(true); + thresholdValue.setEnabled(true); + adjusting = false; + } + colorAlignmContaining(getCurrentAnnotation(), selectedThresholdItem); - public void thresholdIsMin_actionPerformed(ActionEvent actionEvent) - { - changeColour(); + ap.alignmentChanged(); + // ensure all associated views (overviews, structures, etc) are notified of + // updated colours. + ap.paintAlignment(true); } } diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java new file mode 100644 index 0000000..00c4217 --- /dev/null +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -0,0 +1,866 @@ +package jalview.gui; + +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.ColumnSelection; +import jalview.schemes.AnnotationColourGradient; +import jalview.util.MessageManager; +import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Iterator; + +import javax.swing.ButtonGroup; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JInternalFrame; +import javax.swing.JLayeredPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JTextField; +import javax.swing.border.TitledBorder; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import net.miginfocom.swing.MigLayout; + +@SuppressWarnings("serial") +public class AnnotationColumnChooser extends AnnotationRowFilter implements + ItemListener +{ + + private JComboBox annotations; + + // private JButton ok = new JButton(); + // + // private JButton cancel = new JButton(); + + private JPanel actionPanel = new JPanel(); + + private JPanel thresholdPanel = new JPanel(); + + private JPanel switchableViewsPanel = new JPanel(new CardLayout()); + + private CardLayout switchableViewsLayout = (CardLayout) (switchableViewsPanel + .getLayout()); + private JPanel noGraphFilterView = new JPanel(); + + private JPanel graphFilterView = new JPanel(); + + private JPanel annotationComboBoxPanel = new JPanel(); + + private BorderLayout borderLayout1 = new BorderLayout(); + + private JComboBox threshold = new JComboBox(); + + private StructureFilterPanel gStructureFilterPanel; + + private StructureFilterPanel ngStructureFilterPanel; + + private StructureFilterPanel currentStructureFilterPanel; + + private SearchPanel currentSearchPanel; + + private SearchPanel gSearchPanel; + + private SearchPanel ngSearchPanel; + + private FurtherActionPanel currentFurtherActionPanel; + + private FurtherActionPanel gFurtherActionPanel; + + private FurtherActionPanel ngFurtherActionPanel; + + public static final int ACTION_OPTION_SELECT = 1; + + public static int ACTION_OPTION_HIDE = 2; + + public static String NO_GRAPH_VIEW = "0"; + + public static String GRAPH_VIEW = "1"; + + private int actionOption = ACTION_OPTION_SELECT; + + private ColumnSelection oldColumnSelection; + + public AnnotationColumnChooser() + { + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + } + + public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) + { + super(av, ap); + frame = new JInternalFrame(); + frame.setContentPane(this); + frame.setLayer(JLayeredPane.PALETTE_LAYER); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.select_by_annotation"), 520, + 215); + + addSliderChangeListener(); + addSliderMouseListeners(); + + if (av.getAlignment().getAlignmentAnnotation() == null) + { + return; + } + setOldColumnSelection(av.getColumnSelection()); + adjusting = true; + + setAnnotations(new JComboBox(getAnnotationItems(false))); + populateThresholdComboBox(threshold); + + // restore Object state from the previous session if one exists + if (av.getAnnotationColumnSelectionState() != null) + { + currentSearchPanel = av.getAnnotationColumnSelectionState() + .getCurrentSearchPanel(); + currentStructureFilterPanel = av.getAnnotationColumnSelectionState() + .getCurrentStructureFilterPanel(); + annotations.setSelectedIndex(av.getAnnotationColumnSelectionState() + .getAnnotations().getSelectedIndex()); + threshold.setSelectedIndex(av.getAnnotationColumnSelectionState() + .getThreshold().getSelectedIndex()); + actionOption = av.getAnnotationColumnSelectionState() + .getActionOption(); + } + + try + { + jbInit(); + } catch (Exception ex) + { + } + adjusting = false; + + updateView(); + frame.invalidate(); + frame.pack(); + } + + private void jbInit() throws Exception + { + ok.setOpaque(false); + ok.setText(MessageManager.getString("action.ok")); + ok.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + + cancel.setOpaque(false); + cancel.setText(MessageManager.getString("action.cancel")); + cancel.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + + annotations.addItemListener(this); + threshold.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + threshold_actionPerformed(e); + } + }); + + thresholdValue.setEnabled(false); + thresholdValue.setColumns(7); + thresholdValue.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + thresholdValue_actionPerformed(e); + } + }); + + slider.setPaintLabels(false); + slider.setPaintTicks(true); + slider.setBackground(Color.white); + slider.setEnabled(false); + slider.setOpaque(false); + slider.setPreferredSize(new Dimension(100, 32)); + + thresholdPanel.setBorder(new TitledBorder(MessageManager + .getString("label.threshold_filter"))); + thresholdPanel.setBackground(Color.white); + thresholdPanel.setFont(JvSwingUtils.getLabelFont()); + thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); + + actionPanel.setBackground(Color.white); + actionPanel.setFont(JvSwingUtils.getLabelFont()); + + graphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); + graphFilterView.setBackground(Color.white); + + noGraphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); + noGraphFilterView.setBackground(Color.white); + + annotationComboBoxPanel.setBackground(Color.white); + annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont()); + + gSearchPanel = new SearchPanel(this); + ngSearchPanel = new SearchPanel(this); + gFurtherActionPanel = new FurtherActionPanel(this); + ngFurtherActionPanel = new FurtherActionPanel(this); + gStructureFilterPanel = new StructureFilterPanel(this); + ngStructureFilterPanel = new StructureFilterPanel(this); + + thresholdPanel.add(getThreshold()); + thresholdPanel.add(thresholdValue, "wrap"); + thresholdPanel.add(slider, "grow, span, wrap"); + + actionPanel.add(ok); + actionPanel.add(cancel); + + graphFilterView.add(gSearchPanel, "grow, span, wrap"); + graphFilterView.add(gStructureFilterPanel, "grow, span, wrap"); + graphFilterView.add(thresholdPanel, "grow, span, wrap"); + graphFilterView.add(gFurtherActionPanel); + + noGraphFilterView.add(ngSearchPanel, "grow, span, wrap"); + noGraphFilterView.add(ngStructureFilterPanel, "grow, span, wrap"); + noGraphFilterView.add(ngFurtherActionPanel); + + annotationComboBoxPanel.add(getAnnotations()); + switchableViewsPanel.add(noGraphFilterView, + AnnotationColumnChooser.NO_GRAPH_VIEW); + switchableViewsPanel.add(graphFilterView, + AnnotationColumnChooser.GRAPH_VIEW); + + this.setLayout(borderLayout1); + this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START); + this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER); + this.add(actionPanel, java.awt.BorderLayout.SOUTH); + + selectedAnnotationChanged(); + this.validate(); + } + + @SuppressWarnings("unchecked") + public void reset() + { + if (this.getOldColumnSelection() != null) + { + av.getColumnSelection().clear(); + + if (av.getAnnotationColumnSelectionState() != null) + { + ColumnSelection oldSelection = av + .getAnnotationColumnSelectionState() + .getOldColumnSelection(); + if (oldSelection != null && oldSelection.getHiddenColumns() != null + && !oldSelection.getHiddenColumns().isEmpty()) + { + for (Iterator itr = oldSelection.getHiddenColumns() + .iterator(); itr.hasNext();) + { + int positions[] = itr.next(); + av.hideColumns(positions[0], positions[1]); + } + } + av.setColumnSelection(oldSelection); + } + ap.paintAlignment(true); + } + + } + + public void valueChanged(boolean updateAllAnnotation) + { + if (slider.isEnabled()) + { + getCurrentAnnotation().threshold.value = slider.getValue() / 1000f; + updateView(); + propagateSeqAssociatedThreshold(updateAllAnnotation, + getCurrentAnnotation()); + ap.paintAlignment(false); + } + } + + public JComboBox getThreshold() + { + return threshold; + } + + public void setThreshold(JComboBox threshold) + { + this.threshold = threshold; + } + + public JComboBox getAnnotations() + { + return annotations; + } + + public void setAnnotations(JComboBox annotations) + { + this.annotations = annotations; + } + + @Override + public void updateView() + { + // Check if combobox is still adjusting + if (adjusting) + { + return; + } + + AnnotationFilterParameter filterParams = new AnnotationFilterParameter(); + + setCurrentAnnotation(av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() + .getSelectedIndex()]]); + + int selectedThresholdItem = getSelectedThresholdItem(getThreshold() + .getSelectedIndex()); + + slider.setEnabled(true); + thresholdValue.setEnabled(true); + + if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) + { + slider.setEnabled(false); + thresholdValue.setEnabled(false); + thresholdValue.setText(""); + // build filter params + } + else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) + { + if (getCurrentAnnotation().threshold == null) + { + getCurrentAnnotation() + .setThreshold( + new jalview.datamodel.GraphLine( + (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin) / 2f, + "Threshold", Color.black)); + } + + adjusting = true; + float range = getCurrentAnnotation().graphMax * 1000 + - getCurrentAnnotation().graphMin * 1000; + + slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); + slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); + slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); + thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); + slider.setMajorTickSpacing((int) (range / 10f)); + slider.setEnabled(true); + thresholdValue.setEnabled(true); + adjusting = false; + + // build filter params + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); + if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH) + { + filterParams + .setThresholdValue(getCurrentAnnotation().threshold.value); + + if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD) + { + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); + } + else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD) + { + filterParams + .setThresholdType(AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); + } + } + } + + if (currentStructureFilterPanel != null) + { + if (currentStructureFilterPanel.alphaHelix.isSelected()) + { + filterParams.setFilterAlphaHelix(true); + } + if (currentStructureFilterPanel.betaStrand.isSelected()) + { + filterParams.setFilterBetaSheet(true); + } + if (currentStructureFilterPanel.turn.isSelected()) + { + filterParams.setFilterTurn(true); + } + } + + if (currentSearchPanel != null) + { + + if (!currentSearchPanel.searchBox.getText().isEmpty()) + { + currentSearchPanel.description.setEnabled(true); + currentSearchPanel.displayName.setEnabled(true); + filterParams.setRegexString(currentSearchPanel.searchBox.getText()); + if (currentSearchPanel.displayName.isSelected()) + { + filterParams + .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); + } + if (currentSearchPanel.description.isSelected()) + { + filterParams + .addRegexSearchField(AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); + } + } + else + { + currentSearchPanel.description.setEnabled(false); + currentSearchPanel.displayName.setEnabled(false); + } + } + + av.getColumnSelection().filterAnnotations( + getCurrentAnnotation().annotations, filterParams); + + av.showAllHiddenColumns(); + if (getActionOption() == ACTION_OPTION_HIDE) + { + av.hideSelectedColumns(); + } + + filterParams = null; + av.setAnnotationColumnSelectionState(this); + ap.paintAlignment(true); + } + + public ColumnSelection getOldColumnSelection() + { + return oldColumnSelection; + } + + public void setOldColumnSelection(ColumnSelection currentColumnSelection) + { + if (currentColumnSelection != null) + { + this.oldColumnSelection = new ColumnSelection(currentColumnSelection); + } + } + + public FurtherActionPanel getCurrentFutherActionPanel() + { + return currentFurtherActionPanel; + } + + public void setCurrentFutherActionPanel( + FurtherActionPanel currentFutherActionPanel) + { + this.currentFurtherActionPanel = currentFutherActionPanel; + } + + public SearchPanel getCurrentSearchPanel() + { + return currentSearchPanel; + } + + public void setCurrentSearchPanel(SearchPanel currentSearchPanel) + { + this.currentSearchPanel = currentSearchPanel; + } + + public int getActionOption() + { + return actionOption; + } + + public void setActionOption(int actionOption) + { + this.actionOption = actionOption; + } + + public StructureFilterPanel getCurrentStructureFilterPanel() + { + return currentStructureFilterPanel; + } + + public void setCurrentStructureFilterPanel( + StructureFilterPanel currentStructureFilterPanel) + { + this.currentStructureFilterPanel = currentStructureFilterPanel; + } + + public void select_action(ActionEvent actionEvent) + { + JRadioButton radioButton = (JRadioButton) actionEvent.getSource(); + if (radioButton.isSelected()) + { + setActionOption(ACTION_OPTION_SELECT); + updateView(); + } + } + + public void hide_action(ActionEvent actionEvent) + { + JRadioButton radioButton = (JRadioButton) actionEvent.getSource(); + if (radioButton.isSelected()) + { + setActionOption(ACTION_OPTION_HIDE); + updateView(); + } + } + + @Override + public void itemStateChanged(ItemEvent e) + { + selectedAnnotationChanged(); + } + + public void selectedAnnotationChanged() + { + String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW; + if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() + .getSelectedIndex()]].graph != AlignmentAnnotation.NO_GRAPH) + { + currentView = AnnotationColumnChooser.GRAPH_VIEW; + } + + gSearchPanel.syncState(); + gFurtherActionPanel.syncState(); + gStructureFilterPanel.syncState(); + + ngSearchPanel.syncState(); + ngFurtherActionPanel.syncState(); + ngStructureFilterPanel.syncState(); + + switchableViewsLayout.show(switchableViewsPanel, currentView); + updateView(); + } + + + public class FurtherActionPanel extends JPanel + { + private AnnotationColumnChooser aColChooser; + + private JRadioButton hideOption = new JRadioButton(); + + private JRadioButton selectOption = new JRadioButton(); + + private ButtonGroup optionsGroup = new ButtonGroup(); + + public FurtherActionPanel(AnnotationColumnChooser aColChooser) + { + this.aColChooser = aColChooser; + JvSwingUtils.jvInitComponent(selectOption, "action.select"); + selectOption.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + selectRadioAction(actionEvent); + } + }); + + JvSwingUtils.jvInitComponent(hideOption, "action.hide"); + hideOption.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + hideRadioAction(actionEvent); + } + }); + + optionsGroup.add(selectOption); + optionsGroup.add(hideOption); + optionsGroup.setSelected(selectOption.getModel(), true); + + JvSwingUtils.jvInitComponent(this); + syncState(); + + this.add(selectOption); + this.add(hideOption); + } + + public void selectRadioAction(ActionEvent actionEvent) + { + aColChooser.setCurrentFutherActionPanel(this); + aColChooser.select_action(actionEvent); + } + + public void hideRadioAction(ActionEvent actionEvent) + { + aColChooser.setCurrentFutherActionPanel(this); + aColChooser.hide_action(actionEvent); + } + + public void syncState() + { + if (aColChooser.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) + { + this.optionsGroup.setSelected(this.hideOption.getModel(), + true); + } + else + { + this.optionsGroup.setSelected(this.selectOption.getModel(), true); + } + } + } + + public class StructureFilterPanel extends JPanel + { + private AnnotationColumnChooser aColChooser; + + private JCheckBox alphaHelix = new JCheckBox(); + + private JCheckBox betaStrand = new JCheckBox(); + + private JCheckBox turn = new JCheckBox(); + + private JCheckBox all = new JCheckBox(); + + public StructureFilterPanel(AnnotationColumnChooser aColChooser) + { + this.aColChooser = aColChooser; + + JvSwingUtils.jvInitComponent(alphaHelix, "label.alpha_helix"); + alphaHelix.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + alphaHelix_actionPerformed(); + } + }); + + JvSwingUtils.jvInitComponent(betaStrand, "label.beta_strand"); + betaStrand.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + betaStrand_actionPerformed(); + } + }); + + JvSwingUtils.jvInitComponent(turn, "label.turn"); + turn.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + turn_actionPerformed(); + } + }); + + JvSwingUtils.jvInitComponent(all, "label.select_all"); + all.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + all_actionPerformed(); + } + }); + + this.setBorder(new TitledBorder(MessageManager + .getString("label.structures_filter"))); + JvSwingUtils.jvInitComponent(this); + + this.add(all); + this.add(alphaHelix); + this.add(betaStrand); + this.add(turn); + } + + public void alphaHelix_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void betaStrand_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void turn_actionPerformed() + { + updateSelectAllState(); + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void all_actionPerformed() + { + if (all.isSelected()) + { + alphaHelix.setSelected(true); + betaStrand.setSelected(true); + turn.setSelected(true); + } + else + { + alphaHelix.setSelected(false); + betaStrand.setSelected(false); + turn.setSelected(false); + } + aColChooser.setCurrentStructureFilterPanel(this); + aColChooser.updateView(); + } + + public void updateSelectAllState() + { + if (alphaHelix.isSelected() && betaStrand.isSelected() + && turn.isSelected()) + { + all.setSelected(true); + } + else + { + all.setSelected(false); + } + } + + public void syncState() + { + StructureFilterPanel sfp = aColChooser + .getCurrentStructureFilterPanel(); + if (sfp != null) + { + alphaHelix.setSelected(sfp.alphaHelix.isSelected()); + betaStrand.setSelected(sfp.betaStrand.isSelected()); + turn.setSelected(sfp.turn.isSelected()); + if (sfp.all.isSelected()) + { + all.setSelected(true); + alphaHelix.setSelected(true); + betaStrand.setSelected(true); + turn.setSelected(true); + } + } + + } + } + + public class SearchPanel extends JPanel + { + private AnnotationColumnChooser aColChooser; + + private JCheckBox displayName = new JCheckBox(); + + private JCheckBox description = new JCheckBox(); + + private JTextField searchBox = new JTextField(10); + + public SearchPanel(AnnotationColumnChooser aColChooser) + { + + this.aColChooser = aColChooser; + JvSwingUtils.jvInitComponent(this); + this.setBorder(new TitledBorder(MessageManager + .getString("label.search_filter"))); + + JvSwingUtils.jvInitComponent(searchBox); + searchBox.getDocument().addDocumentListener( + new DocumentListener() + { + @Override + public void insertUpdate(DocumentEvent e) + { + searchStringAction(); + } + + @Override + public void removeUpdate(DocumentEvent e) + { + searchStringAction(); + } + + @Override + public void changedUpdate(DocumentEvent e) + { + searchStringAction(); + } + }); + + JvSwingUtils.jvInitComponent(displayName, "label.display_name"); + displayName.setEnabled(false); + displayName.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + displayNameCheckboxAction(); + } + }); + + JvSwingUtils.jvInitComponent(description, "label.description"); + description.setEnabled(false); + description.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent actionEvent) + { + discriptionCheckboxAction(); + } + }); + + syncState(); + this.add(searchBox); + this.add(displayName); + this.add(description); + } + + public void displayNameCheckboxAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void discriptionCheckboxAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void searchStringAction() + { + aColChooser.setCurrentSearchPanel(this); + aColChooser.updateView(); + } + + public void syncState() + { + SearchPanel sp = aColChooser.getCurrentSearchPanel(); + if (sp != null) + { + description.setEnabled(sp.description.isEnabled()); + description.setSelected(sp.description.isSelected()); + + displayName.setEnabled(sp.displayName.isEnabled()); + displayName.setSelected(sp.displayName.isSelected()); + + searchBox.setText(sp.searchBox.getText()); + } + } + } + +} diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 315c3e2..df6f9eb 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -20,17 +20,29 @@ */ package jalview.gui; -import java.util.*; -import java.util.List; - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -import jalview.datamodel.*; -import jalview.io.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.io.AnnotationFile; +import jalview.io.FeaturesFile; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JInternalFrame; +import javax.swing.JLabel; +import javax.swing.JLayeredPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.SwingConstants; + /** * * GUI dialog for exporting features or alignment annotations depending upon @@ -47,11 +59,9 @@ public class AnnotationExporter extends JPanel boolean features = true; - AlignmentAnnotation[] annotations; + private AlignmentAnnotation[] annotations; - List sequenceGroups; - - Hashtable alignmentProperties; + private boolean wholeView; public AnnotationExporter() { @@ -78,17 +88,29 @@ public class AnnotationExporter extends JPanel frame.setTitle(MessageManager.getString("label.export_features")); } - public void exportAnnotations(AlignmentPanel ap, - AlignmentAnnotation[] annotations, List list, - Hashtable alProperties) + public void exportAnnotations(AlignmentPanel ap) { this.ap = ap; + annotations = ap.av.isShowAnnotation() ? null : ap.av.getAlignment() + .getAlignmentAnnotation(); + wholeView = true; + startExportAnnotation(); + } + + public void exportAnnotations(AlignmentPanel alp, + AlignmentAnnotation[] toExport) + { + ap = alp; + annotations = toExport; + wholeView = false; + startExportAnnotation(); + } + + private void startExportAnnotation() + { features = false; GFFFormat.setVisible(false); CSVFormat.setVisible(true); - this.annotations = annotations; - this.sequenceGroups = list; - this.alignmentProperties = alProperties; frame.setTitle(MessageManager.getString("label.export_annotations")); } @@ -106,34 +128,7 @@ public class AnnotationExporter extends JPanel if (value == JalviewFileChooser.APPROVE_OPTION) { - String text = MessageManager.getString("label.no_features_on_alignment"); - if (features) - { - if (GFFFormat.isSelected()) - { - text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//); - } - else - { - text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed); - } - } - else - { - if (CSVFormat.isSelected()) - { - text = new AnnotationFile().printCSVAnnotations(annotations); - } - else - { - text = new AnnotationFile().printAnnotations(annotations, - sequenceGroups, alignmentProperties); - } - } + String text = getFileContents(); try { @@ -151,25 +146,26 @@ public class AnnotationExporter extends JPanel close_actionPerformed(null); } - public void toTextbox_actionPerformed(ActionEvent e) + private String getFileContents() { - String text = MessageManager.getString("label.no_features_on_alignment"); + String text = MessageManager + .getString("label.no_features_on_alignment"); if (features) { if (GFFFormat.isSelected()) { text = new FeaturesFile().printGFFFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); + .getDataset().getSequencesArray(), ap.getFeatureRenderer() + .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats());// ap.av.featuresDisplayed//); } else { text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment() - .getDataset().getSequencesArray(), - getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); + .getDataset().getSequencesArray(), ap.getFeatureRenderer() + .getDisplayedFeatureCols(), true, ap.av.isShowNpFeats()); // ap.av.featuresDisplayed); } } - else if (!features) + else { if (CSVFormat.isSelected()) { @@ -177,14 +173,26 @@ public class AnnotationExporter extends JPanel } else { - text = new AnnotationFile().printAnnotations(annotations, - sequenceGroups, alignmentProperties); + if (wholeView) + { + text = new AnnotationFile().printAnnotationsForView(ap.av); + } + else + { + text = new AnnotationFile().printAnnotations(annotations, null, + null); + } } } - + return text; + } + public void toTextbox_actionPerformed(ActionEvent e) + { CutAndPasteTransfer cap = new CutAndPasteTransfer(); + try { + String text = getFileContents(); cap.setText(text); Desktop.addInternalFrame( cap, @@ -206,27 +214,6 @@ public class AnnotationExporter extends JPanel close_actionPerformed(null); } - - private Hashtable getDisplayedFeatureCols() - { - Hashtable fcols = new Hashtable(); - if (ap.av.featuresDisplayed == null) - { - return fcols; - } - Enumeration en = ap.av.featuresDisplayed.keys(); - FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider - // higher - // level - // method ? - while (en.hasMoreElements()) - { - Object col = en.nextElement(); - fcols.put(col, fr.featureColours.get(col)); - } - return fcols; - } - public void close_actionPerformed(ActionEvent e) { try @@ -313,5 +300,4 @@ public class AnnotationExporter extends JPanel JPanel jPanel3 = new JPanel(); FlowLayout flowLayout1 = new FlowLayout(); - } diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 6e8417f..f732a36 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -47,8 +47,8 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; +import java.util.ArrayList; import java.util.Arrays; -import java.util.Vector; import java.util.regex.Pattern; import javax.swing.JCheckBoxMenuItem; @@ -99,7 +99,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, int selectedRow; - int scrollOffset = 0; + private int scrollOffset = 0; Font font = new Font("Arial", Font.PLAIN, 11); @@ -143,7 +143,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, addMouseListener(this); addMouseMotionListener(this); - addMouseWheelListener(ap.annotationPanel); + addMouseWheelListener(ap.getAnnotationPanel()); } public AnnotationLabels(AlignViewport av) @@ -249,7 +249,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { new AnnotationExporter().exportAnnotations(ap, new AlignmentAnnotation[] - { aa[selectedRow] }, null, null); + { aa[selectedRow] }); } else if (evt.getActionCommand().equals(COPYCONS_SEQ)) { @@ -325,7 +325,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ public void mousePressed(MouseEvent evt) { - getSelectedRow(evt.getY() - scrollOffset); + getSelectedRow(evt.getY() - getScrollOffset()); oldY = evt.getY(); } @@ -338,7 +338,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, public void mouseReleased(MouseEvent evt) { int start = selectedRow; - getSelectedRow(evt.getY() - scrollOffset); + getSelectedRow(evt.getY() - getScrollOffset()); int end = selectedRow; if (start != end) @@ -360,7 +360,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, resizePanel = false; dragEvent = null; repaint(); - ap.annotationPanel.repaint(); + ap.getAnnotationPanel().repaint(); } /** @@ -439,7 +439,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { resizePanel = evt.getY() < 10; - getSelectedRow(evt.getY() - scrollOffset); + getSelectedRow(evt.getY() - getScrollOffset()); if (selectedRow > -1 && ap.av.getAlignment().getAlignmentAnnotation().length > selectedRow) @@ -533,7 +533,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { // todo: make the ap scroll to the selection - not necessary, first // click highlights/scrolls, second selects - ap.seqPanel.ap.idPanel.highlightSearchResults(null); + ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null); ap.av.setSelectionGroup(// new SequenceGroup( aa[selectedRow].groupRef); // ); ap.paintAlignment(false); @@ -542,7 +542,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, } else { - ap.seqPanel.ap.idPanel + ap.getSeqPanel().ap.getIdPanel() .highlightSearchResults(aa[selectedRow].groupRef .getSequences(null)); } @@ -552,13 +552,13 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (evt.getClickCount() == 1) { - ap.seqPanel.ap.idPanel.highlightSearchResults(Arrays + ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(Arrays .asList(new SequenceI[] { aa[selectedRow].sequenceRef })); } else if (evt.getClickCount() >= 2) { - ap.seqPanel.ap.idPanel.highlightSearchResults(null); + ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null); SequenceGroup sg = ap.av.getSelectionGroup(); if (sg!=null) { @@ -696,7 +696,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, { // TODO: pass on reference to ap so the view can be updated. aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState()); - ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + ap.getAnnotationPanel().paint(ap.getAnnotationPanel().getGraphics()); } else { @@ -872,16 +872,13 @@ public class AnnotationLabels extends JPanel implements MouseListener, Toolkit.getDefaultToolkit().getSystemClipboard() .setContents(new StringSelection(output), Desktop.instance); - Vector hiddenColumns = null; + ArrayList hiddenColumns = null; if (av.hasHiddenColumns()) { - hiddenColumns = new Vector(); - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) + hiddenColumns = new ArrayList(); + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - int[] region = (int[]) av.getColumnSelection().getHiddenColumns() - .elementAt(i); - - hiddenColumns.addElement(new int[] + hiddenColumns.add(new int[] { region[0], region[1] }); } } @@ -962,7 +959,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, g.setColor(Color.white); g.fillRect(0, 0, getWidth(), getHeight()); - g.translate(0, scrollOffset); + g.translate(0, getScrollOffset()); g.setColor(Color.black); AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); @@ -976,7 +973,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, int ofontH = fontHeight; int sOffset = 0; int visHeight = 0; - int[] visr = (ap != null && ap.annotationPanel != null) ? ap.annotationPanel + int[] visr = (ap != null && ap.getAnnotationPanel() != null) ? ap.getAnnotationPanel() .getVisibleVRange() : null; if (clip && visr != null) { @@ -1116,13 +1113,13 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (resizePanel) { - g.drawImage(image, 2, 0 - scrollOffset, this); + g.drawImage(image, 2, 0 - getScrollOffset(), this); } else if (dragEvent != null && aa != null) { g.setColor(Color.lightGray); g.drawString(aa[selectedRow].label, dragEvent.getX(), - dragEvent.getY() - scrollOffset); + dragEvent.getY() - getScrollOffset()); } if (!av.wrapAlignment && ((aa == null) || (aa.length < 1))) @@ -1132,4 +1129,9 @@ public class AnnotationLabels extends JPanel implements MouseListener, 18); } } + + public int getScrollOffset() + { + return scrollOffset; + } } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 9f56206..3a97f96 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -241,7 +241,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, public void adjustmentValueChanged(AdjustmentEvent evt) { // update annotation label display - ap.alabels.setScrollOffset(-evt.getValue()); + ap.getAlabels().setScrollOffset(-evt.getValue()); } /** @@ -566,7 +566,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return; } - ap.scalePanel.mousePressed(evt); + ap.getScalePanel().mousePressed(evt); } @@ -582,7 +582,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, graphStretch = -1; graphStretchY = -1; mouseDragging = false; - ap.scalePanel.mouseReleased(evt); + ap.getScalePanel().mouseReleased(evt); } /** @@ -594,7 +594,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void mouseEntered(MouseEvent evt) { - ap.scalePanel.mouseEntered(evt); + ap.getScalePanel().mouseEntered(evt); } /** @@ -606,7 +606,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void mouseExited(MouseEvent evt) { - ap.scalePanel.mouseExited(evt); + ap.getScalePanel().mouseExited(evt); } /** @@ -632,7 +632,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } else { - ap.scalePanel.mouseDragged(evt); + ap.getScalePanel().mouseDragged(evt); } } @@ -809,7 +809,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { try { - image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(), + image = new BufferedImage(imgWidth, ap.getAnnotationPanel().getHeight(), BufferedImage.TYPE_INT_RGB); } catch (OutOfMemoryError oom) { @@ -1013,9 +1013,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public int[] getVisibleVRange() { - if (ap != null && ap.alabels != null) + if (ap != null && ap.getAlabels() != null) { - int sOffset = -ap.alabels.scrollOffset; + int sOffset = -ap.getAlabels().getScrollOffset(); int visHeight = sOffset + ap.annotationSpaceFillerHolder.getHeight(); bounds[0] = sOffset; bounds[1] = visHeight; diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java new file mode 100644 index 0000000..21c91d8 --- /dev/null +++ b/src/jalview/gui/AnnotationRowFilter.java @@ -0,0 +1,384 @@ +package jalview.gui; + +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.GraphLine; +import jalview.datamodel.SequenceGroup; +import jalview.schemes.AnnotationColourGradient; +import jalview.util.MessageManager; + +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JInternalFrame; +import javax.swing.JPanel; +import javax.swing.JSlider; +import javax.swing.JTextField; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +@SuppressWarnings("serial") +public abstract class AnnotationRowFilter extends JPanel +{ + protected AlignViewport av; + + protected AlignmentPanel ap; + + protected int[] annmap; + + protected boolean enableSeqAss = false; + + private jalview.datamodel.AlignmentAnnotation currentAnnotation; + + protected boolean adjusting = false; + + protected JCheckBox currentColours = new JCheckBox(); + + protected JPanel minColour = new JPanel(); + + protected JPanel maxColour = new JPanel(); + + protected JCheckBox seqAssociated = new JCheckBox(); + + protected JCheckBox thresholdIsMin = new JCheckBox(); + + protected JSlider slider = new JSlider(); + + protected JTextField thresholdValue = new JTextField(20); + + protected JInternalFrame frame; + + protected JButton ok = new JButton(); + + protected JButton cancel = new JButton(); + + /** + * enabled if the user is dragging the slider - try to keep updates to a + * minimun + */ + protected boolean sliderDragging = false; + + protected void addSliderChangeListener() + { + + slider.addChangeListener(new ChangeListener() + { + @Override + public void stateChanged(ChangeEvent evt) + { + if (!adjusting) + { + thresholdValue.setText((slider.getValue() / 1000f) + ""); + valueChanged(!sliderDragging); + } + } + }); + } + + protected void addSliderMouseListeners() + { + + slider.addMouseListener(new MouseAdapter() + { + @Override + public void mousePressed(MouseEvent e) + { + sliderDragging = true; + super.mousePressed(e); + } + + @Override + public void mouseDragged(MouseEvent e) + { + sliderDragging = true; + super.mouseDragged(e); + } + + @Override + public void mouseReleased(MouseEvent evt) + { + if (sliderDragging) + { + sliderDragging = false; + valueChanged(true); + } + ap.paintAlignment(true); + } + }); + } + + + public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap) + { + this.av = av; + this.ap = ap; + } + + public AnnotationRowFilter() + { + + } + + public Vector getAnnotationItems(boolean isSeqAssociated) + { + Vector list = new Vector(); + int index = 1; + int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; + for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + { + if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null) + { + if (isSeqAssociated) + { + continue; + } + } + else + { + enableSeqAss = true; + } + String label = av.getAlignment().getAlignmentAnnotation()[i].label; + if (!list.contains(label)) + { + anmap[list.size()] = i; + list.add(label); + + } + else + { + if (!isSeqAssociated) + { + anmap[list.size()] = i; + list.add(label + "_" + (index++)); + } + } + } + this.annmap = new int[list.size()]; + System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length); + return list; + } + + protected int getSelectedThresholdItem(int indexValue) + { + int selectedThresholdItem = -1; + if (indexValue == 1) + { + selectedThresholdItem = AnnotationColourGradient.ABOVE_THRESHOLD; + } + else if (indexValue == 2) + { + selectedThresholdItem = AnnotationColourGradient.BELOW_THRESHOLD; + } + return selectedThresholdItem; + } + + public void modelChanged() + { + seqAssociated.setEnabled(enableSeqAss); + } + + public void ok_actionPerformed(ActionEvent e) + { + updateView(); + try + { + frame.setClosed(true); + } catch (Exception ex) + { + } + } + + public void cancel_actionPerformed(ActionEvent e) + { + reset(); + ap.paintAlignment(true); + try + { + frame.setClosed(true); + } catch (Exception ex) + { + } + } + + public void thresholdCheck_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void annotations_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void threshold_actionPerformed(ActionEvent e) + { + updateView(); + } + + public void thresholdValue_actionPerformed(ActionEvent e) + { + try + { + float f = Float.parseFloat(thresholdValue.getText()); + slider.setValue((int) (f * 1000)); + updateView(); + } catch (NumberFormatException ex) + { + } + } + + public void thresholdIsMin_actionPerformed(ActionEvent actionEvent) + { + updateView(); + } + + protected void populateThresholdComboBox(JComboBox threshold) + { + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); + } + + protected void seqAssociated_actionPerformed(ActionEvent arg0, + JComboBox annotations, JCheckBox seqAssociated) + { + adjusting = true; + String cursel = (String) annotations.getSelectedItem(); + boolean isvalid = false, isseqs = seqAssociated.isSelected(); + annotations.removeAllItems(); + for (String anitem : getAnnotationItems(seqAssociated.isSelected())) + { + if (anitem.equals(cursel) || (isseqs && cursel.startsWith(anitem))) + { + isvalid = true; + cursel = anitem; + } + annotations.addItem(anitem); + } + adjusting = false; + if (isvalid) + { + annotations.setSelectedItem(cursel); + } + else + { + if (annotations.getItemCount() > 0) + { + annotations.setSelectedIndex(0); + } + } + } + + protected void propagateSeqAssociatedThreshold(boolean allAnnotation, + AlignmentAnnotation annotation) + { + if (annotation.sequenceRef == null || annotation.threshold == null) + { + return; + } + + float thr = annotation.threshold.value; + for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + { + AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[i]; + if (aa.label.equals(annotation.label) + && (annotation.getCalcId() == null ? aa.getCalcId() == null + : annotation.getCalcId().equals(aa.getCalcId()))) + { + if (aa.threshold == null) + { + aa.threshold = new GraphLine(annotation.threshold); + } + else + { + aa.threshold.value = thr; + } + } + } + } + + protected boolean colorAlignmContaining( + AlignmentAnnotation currentAnnotation, int selectedThresholdItem) + { + + AnnotationColourGradient acg = null; + if (currentColours.isSelected()) + { + acg = new AnnotationColourGradient(currentAnnotation, + av.getGlobalColourScheme(), selectedThresholdItem); + } + else + { + acg = new AnnotationColourGradient(currentAnnotation, + minColour.getBackground(), maxColour.getBackground(), + selectedThresholdItem); + } + acg.setSeqAssociated(seqAssociated.isSelected()); + + if (currentAnnotation.graphMin == 0f + && currentAnnotation.graphMax == 0f) + { + acg.setPredefinedColours(true); + } + + acg.thresholdIsMinMax = thresholdIsMin.isSelected(); + + av.setGlobalColourScheme(acg); + + if (av.getAlignment().getGroups() != null) + { + + for (SequenceGroup sg : ap.av.getAlignment().getGroups()) + { + if (sg.cs == null) + { + continue; + } + + if (currentColours.isSelected()) + { + sg.cs = new AnnotationColourGradient(currentAnnotation, sg.cs, + selectedThresholdItem); + ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated + .isSelected()); + + } + else + { + sg.cs = new AnnotationColourGradient(currentAnnotation, + minColour.getBackground(), maxColour.getBackground(), + selectedThresholdItem); + ((AnnotationColourGradient) sg.cs).setSeqAssociated(seqAssociated + .isSelected()); + } + + } + } + return false; + } + + + public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation() + { + return currentAnnotation; + } + + public void setCurrentAnnotation( + jalview.datamodel.AlignmentAnnotation currentAnnotation) + { + this.currentAnnotation = currentAnnotation; + } + + public abstract void valueChanged(boolean updateAllAnnotation); + + public abstract void updateView(); + + public abstract void reset(); +} diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index fcb31eb..df7f43c 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -20,19 +20,15 @@ */ package jalview.gui; -import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; -import jalview.ext.jmol.JalviewJmolBinding; -import jalview.gui.ViewSelectionMenu.ViewSetProvider; import jalview.io.AppletFormatAdapter; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; -import jalview.jbgui.GStructureViewer; import jalview.schemes.BuriedColourScheme; import jalview.schemes.ColourSchemeI; import jalview.schemes.HelixColourScheme; @@ -42,12 +38,12 @@ import jalview.schemes.StrandColourScheme; import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; +import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; import jalview.util.Platform; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; @@ -61,7 +57,6 @@ import java.io.File; import java.io.FileOutputStream; import java.io.FileReader; import java.io.PrintWriter; -import java.util.ArrayList; import java.util.Enumeration; import java.util.Vector; @@ -78,9 +73,7 @@ import javax.swing.event.InternalFrameEvent; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -public class AppJmol extends GStructureViewer implements Runnable, - ViewSetProvider, JalviewStructureDisplayI - +public class AppJmol extends StructureViewerBase { AppJmolBinding jmb; @@ -90,8 +83,6 @@ public class AppJmol extends GStructureViewer implements Runnable, RenderPanel renderPanel; - AlignmentPanel ap; - Vector atomsPicked = new Vector(); private boolean addingStructures = false; @@ -156,9 +147,7 @@ public class AppJmol extends GStructureViewer implements Runnable, PDBEntry[] pdbentrys = new PDBEntry[files.length]; for (int i = 0; i < pdbentrys.length; i++) { - PDBEntry pdbentry = new PDBEntry(); - pdbentry.setFile(files[i]); - pdbentry.setId(ids[i]); + PDBEntry pdbentry = new PDBEntry(files[i], ids[i]); pdbentrys[i] = pdbentry; } // / TODO: check if protocol is needed to be set, and if chains are @@ -178,7 +167,7 @@ public class AppJmol extends GStructureViewer implements Runnable, seqColour.setSelected(false); viewerColour.setSelected(true); } - if (usetoColour) + else if (usetoColour) { useAlignmentPanelForColourbyseq(ap); jmb.setColourBySequence(true); @@ -187,7 +176,7 @@ public class AppJmol extends GStructureViewer implements Runnable, } this.setBounds(bounds); initMenus(); - viewId = viewid; + setViewId(viewid); // jalview.gui.Desktop.addInternalFrame(this, "Loading File", // bounds.width,bounds.height); @@ -315,9 +304,9 @@ public class AppJmol extends GStructureViewer implements Runnable, // TODO : Fix multiple seq to one chain issue here. ap.getStructureSelectionManager().setMapping(seq, chains, alreadyMapped, AppletFormatAdapter.FILE); - if (ap.seqPanel.seqCanvas.fr != null) + if (ap.getSeqPanel().seqCanvas.fr != null) { - ap.seqPanel.seqCanvas.fr.featuresAdded(); + ap.getSeqPanel().seqCanvas.fr.featuresAdded(); ap.paintAlignment(true); } @@ -332,15 +321,16 @@ public class AppJmol extends GStructureViewer implements Runnable, final AppJmol topJmol = ((AppJmol) frames[i]); // JBPNOTE: this looks like a binding routine, rather than a gui // routine - for (int pe = 0; pe < topJmol.jmb.pdbentry.length; pe++) + for (int pe = 0; pe < topJmol.jmb.getPdbCount(); pe++) { - if (topJmol.jmb.pdbentry[pe].getFile().equals(alreadyMapped)) + if (topJmol.jmb.getPdbEntry(pe).getFile() + .equals(alreadyMapped)) { topJmol.jmb.addSequence(pe, seq); topJmol.addAlignmentPanel(ap); // add it to the set used for colouring topJmol.useAlignmentPanelForColourbyseq(ap); - topJmol.buildJmolActionMenu(); + topJmol.buildActionMenu(); ap.getStructureSelectionManager() .sequenceColoursChanged(ap); break; @@ -436,133 +426,6 @@ public class AppJmol extends GStructureViewer implements Runnable, } /** - * list of sequenceSet ids associated with the view - */ - ArrayList _aps = new ArrayList(); - - public AlignmentPanel[] getAllAlignmentPanels() - { - AlignmentPanel[] t, list = new AlignmentPanel[0]; - for (String setid : _aps) - { - AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid); - if (panels != null) - { - t = new AlignmentPanel[list.length + panels.length]; - System.arraycopy(list, 0, t, 0, list.length); - System.arraycopy(panels, 0, t, list.length, panels.length); - list = t; - } - } - - return list; - } - - /** - * list of alignment panels to use for superposition - */ - Vector _alignwith = new Vector(); - - /** - * list of alignment panels that are used for colouring structures by aligned - * sequences - */ - Vector _colourwith = new Vector(); - - /** - * set the primary alignmentPanel reference and add another alignPanel to the - * list of ones to use for colouring and aligning - * - * @param nap - */ - public void addAlignmentPanel(AlignmentPanel nap) - { - if (ap == null) - { - ap = nap; - } - if (!_aps.contains(nap.av.getSequenceSetId())) - { - _aps.add(nap.av.getSequenceSetId()); - } - } - - /** - * remove any references held to the given alignment panel - * - * @param nap - */ - public void removeAlignmentPanel(AlignmentPanel nap) - { - try - { - _alignwith.remove(nap); - _colourwith.remove(nap); - if (ap == nap) - { - ap = null; - for (AlignmentPanel aps : getAllAlignmentPanels()) - { - if (aps != nap) - { - ap = aps; - break; - } - } - } - } catch (Exception ex) - { - } - if (ap != null) - { - buildJmolActionMenu(); - } - } - - public void useAlignmentPanelForSuperposition(AlignmentPanel nap) - { - addAlignmentPanel(nap); - if (!_alignwith.contains(nap)) - { - _alignwith.add(nap); - } - } - - public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap) - { - if (_alignwith.contains(nap)) - { - _alignwith.remove(nap); - } - } - - public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, - boolean enableColourBySeq) - { - useAlignmentPanelForColourbyseq(nap); - jmb.setColourBySequence(enableColourBySeq); - seqColour.setSelected(enableColourBySeq); - viewerColour.setSelected(!enableColourBySeq); - } - - public void useAlignmentPanelForColourbyseq(AlignmentPanel nap) - { - addAlignmentPanel(nap); - if (!_colourwith.contains(nap)) - { - _colourwith.add(nap); - } - } - - public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap) - { - if (_colourwith.contains(nap)) - { - _colourwith.remove(nap); - } - } - - /** * pdb retrieval thread. */ private Thread worker = null; @@ -632,7 +495,7 @@ public class AppJmol extends GStructureViewer implements Runnable, { if (frame instanceof AppJmol) { - if (((AppJmol) frame).isLinkedWith(apanel)) + if (((StructureViewerBase) frame).isLinkedWith(apanel)) { result.addElement(frame); } @@ -742,7 +605,7 @@ public class AppJmol extends GStructureViewer implements Runnable, public void closeViewer() { jmb.closeViewer(); - ap = null; + setAlignmentPanel(null); _aps.clear(); _alignwith.clear(); _colourwith.clear(); @@ -768,14 +631,14 @@ public class AppJmol extends GStructureViewer implements Runnable, // TODO: replace with reference fetching/transfer code (validate PDBentry // as a DBRef?) jalview.ws.dbsources.Pdb pdbclient = new jalview.ws.dbsources.Pdb(); - for (int pi = 0; pi < jmb.pdbentry.length; pi++) + for (int pi = 0; pi < jmb.getPdbCount(); pi++) { - String file = jmb.pdbentry[pi].getFile(); + String file = jmb.getPdbEntry(pi).getFile(); if (file == null) { // retrieve the pdb and store it locally AlignmentI pdbseq = null; - pdbid = jmb.pdbentry[pi].getId(); + pdbid = jmb.getPdbEntry(pi).getId(); long hdl = pdbid.hashCode() - System.currentTimeMillis(); if (progressBar != null) { @@ -783,7 +646,8 @@ public class AppJmol extends GStructureViewer implements Runnable, } try { - pdbseq = pdbclient.getSequenceRecords(pdbid = jmb.pdbentry[pi] + pdbseq = pdbclient.getSequenceRecords(pdbid = jmb.getPdbEntry( + pi) .getId()); } catch (OutOfMemoryError oomerror) { @@ -803,7 +667,7 @@ public class AppJmol extends GStructureViewer implements Runnable, // PDBEntry file = new File(((PDBEntry) pdbseq.getSequenceAt(0).getPDBId() .elementAt(0)).getFile()).getAbsolutePath(); - jmb.pdbentry[pi].setFile(file); + jmb.getPdbEntry(pi).setFile(file); files.append(" \"" + Platform.escapeString(file) + "\""); } @@ -898,7 +762,7 @@ public class AppJmol extends GStructureViewer implements Runnable, // need to wait around until script has finished while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() : (jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb - .getPdbFile().length != jmb.pdbentry.length)) + .getPdbFile().length != jmb.getPdbCount())) { try { @@ -977,9 +841,9 @@ public class AppJmol extends GStructureViewer implements Runnable, jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer(); try { - for (int pdbe = 0; pdbe < jmb.pdbentry.length; pdbe++) + for (int pdbe = 0; pdbe < jmb.getPdbCount(); pdbe++) { - cap.appendText(jmb.printMapping(jmb.pdbentry[pdbe].getFile())); + cap.appendText(jmb.printMapping(jmb.getPdbEntry(pdbe).getFile())); cap.appendText("\n"); } } catch (OutOfMemoryError e) @@ -1065,16 +929,16 @@ public class AppJmol extends GStructureViewer implements Runnable, { if (!jmb.isLoadingFromArchive()) { - if (_colourwith.size() == 0 && ap != null) + if (_colourwith.size() == 0 && getAlignmentPanel() != null) { // Make the currently displayed alignment panel the associated view - _colourwith.add(ap.alignFrame.alignPanel); + _colourwith.add(getAlignmentPanel().alignFrame.alignPanel); } } // Set the colour using the current view for the associated alignframe for (AlignmentPanel ap : _colourwith) { - jmb.colourBySequence(ap.av.showSequenceFeatures, ap); + jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); } } } @@ -1232,15 +1096,15 @@ public class AppJmol extends GStructureViewer implements Runnable, + "...", 20, currentSize.height / 2); StringBuffer sb = new StringBuffer(); int lines = 0; - for (int e = 0; e < jmb.pdbentry.length; e++) + for (int e = 0; e < jmb.getPdbCount(); e++) { - sb.append(jmb.pdbentry[e].getId()); - if (e < jmb.pdbentry.length - 1) + sb.append(jmb.getPdbEntry(e).getId()); + if (e < jmb.getPdbCount() - 1) { sb.append(","); } - if (e == jmb.pdbentry.length - 1 || sb.length() > 20) + if (e == jmb.getPdbCount() - 1 || sb.length() > 20) { lines++; g.drawString(sb.toString(), 20, currentSize.height / 2 - lines @@ -1264,17 +1128,6 @@ public class AppJmol extends GStructureViewer implements Runnable, } } - String viewId = null; - - public String getViewId() - { - if (viewId == null) - { - viewId = System.currentTimeMillis() + "." + this.hashCode(); - } - return viewId; - } - public void updateTitleAndMenus() { if (jmb.fileLoadingError != null && jmb.fileLoadingError.length() > 0) @@ -1285,7 +1138,7 @@ public class AppJmol extends GStructureViewer implements Runnable, setChainMenuItems(jmb.chainNames); this.setTitle(jmb.getViewerTitle()); - if (jmb.getPdbFile().length > 1 && jmb.sequence.length > 1) + if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1) { viewerActionMenu.setVisible(true); } @@ -1295,27 +1148,6 @@ public class AppJmol extends GStructureViewer implements Runnable, } } - protected void buildJmolActionMenu() - { - if (_alignwith == null) - { - _alignwith = new Vector(); - } - if (_alignwith.size() == 0 && ap != null) - { - _alignwith.add(ap); - } - ; - for (Component c : viewerActionMenu.getMenuComponents()) - { - if (c != alignStructs) - { - viewerActionMenu.remove((JMenuItem) c); - } - } - final ItemListener handler; - } - /* * (non-Javadoc) * @@ -1331,14 +1163,14 @@ public class AppJmol extends GStructureViewer implements Runnable, private void alignStructs_withAllAlignPanels() { - if (ap == null) + if (getAlignmentPanel() == null) { return; } ; if (_alignwith.size() == 0) { - _alignwith.add(ap); + _alignwith.add(getAlignmentPanel()); } ; try @@ -1390,42 +1222,19 @@ public class AppJmol extends GStructureViewer implements Runnable, return ap; } } - return ap; + return getAlignmentPanel(); } - /** - * - * @param ap2 - * @return true if this Jmol instance is linked with the given alignPanel - */ - public boolean isLinkedWith(AlignmentPanel ap2) - { - return _aps.contains(ap2.av.getSequenceSetId()); - } - - public boolean isUsedforaligment(AlignmentPanel ap2) - { - - return (_alignwith != null) && _alignwith.contains(ap2); - } - - public boolean isUsedforcolourby(AlignmentPanel ap2) - { - return (_colourwith != null) && _colourwith.contains(ap2); - } - - /** - * - * @return TRUE if the view is NOT being coloured by sequence associations. - */ - public boolean isColouredByJmol() + @Override + public AAStructureBindingModel getBinding() { - return !jmb.isColourBySequence(); + return this.jmb; } - public JalviewJmolBinding getBinding() + @Override + public String getStateInfo() { - return jmb; + return jmb == null ? null : jmb.viewer.getStateInfo(); } } diff --git a/src/jalview/gui/AppJmolBinding.java b/src/jalview/gui/AppJmolBinding.java index 7fa300e..b7617ce 100644 --- a/src/jalview/gui/AppJmolBinding.java +++ b/src/jalview/gui/AppJmolBinding.java @@ -20,28 +20,27 @@ */ package jalview.gui; -import java.awt.Container; -import java.util.BitSet; - import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.ext.jmol.JalviewJmolBinding; import jalview.structure.StructureSelectionManager; +import java.awt.Container; +import java.util.BitSet; + import org.jmol.api.JmolAppConsoleInterface; import org.jmol.api.JmolViewer; import org.jmol.popup.JmolPopup; import org.openscience.jmol.app.jmolpanel.AppConsole; -public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding +public class AppJmolBinding extends JalviewJmolBinding { - - /** - * - */ private AppJmol appJmolWindow; + private FeatureRenderer fr = null; + public AppJmolBinding(AppJmol appJmol, StructureSelectionManager sSm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, String protocol) @@ -50,19 +49,17 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding appJmolWindow = appJmol; } - FeatureRenderer fr = null; - @Override - public jalview.api.FeatureRenderer getFeatureRenderer( + public FeatureRenderer getFeatureRenderer( AlignmentViewPanel alignment) { - AlignmentPanel ap = (alignment == null) ? appJmolWindow.ap + AlignmentPanel ap = (alignment == null) ? appJmolWindow.getAlignmentPanel() : (AlignmentPanel) alignment; - if (ap.av.showSequenceFeatures) + if (ap.av.isShowSequenceFeatures()) { if (fr == null) { - fr = ap.cloneFeatureRenderer(); + fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer(); } else { @@ -74,7 +71,7 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding } @Override - public jalview.api.SequenceRenderer getSequenceRenderer( + public SequenceRenderer getSequenceRenderer( AlignmentViewPanel alignment) { return new SequenceRenderer(((AlignmentPanel) alignment).av); @@ -130,10 +127,12 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding AlignmentPanel ap = (AlignmentPanel) source, topap; // ignore events from panels not used to colour this view if (!appJmolWindow.isUsedforcolourby(ap)) + { return; + } if (!isLoadingFromArchive()) { - colourBySequence(ap.av.getShowSequenceFeatures(), ap); + colourBySequence(ap.av.isShowSequenceFeatures(), ap); } } @@ -153,7 +152,6 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding public void newJmolPopup(boolean translateLocale, String menuName, boolean asPopup) { - jmolpopup = new JmolPopup(); jmolpopup.initialize(viewer, translateLocale, menuName, asPopup); } @@ -175,25 +173,6 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding appJmolWindow.showConsole(b); } - /** - * add the given sequences to the mapping scope for the given pdb file handle - * - * @param pdbFile - * - pdbFile identifier - * @param seq - * - set of sequences it can be mapped to - */ - public void addSequenceForStructFile(String pdbFile, SequenceI[] seq) - { - for (int pe = 0; pe < pdbentry.length; pe++) - { - if (pdbentry[pe].getFile().equals(pdbFile)) - { - addSequence(pe, seq); - } - } - } - @Override protected JmolAppConsoleInterface createJmolConsole(JmolViewer viewer2, Container consolePanel, String buttonsToShow) @@ -205,20 +184,7 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding protected void releaseUIResources() { appJmolWindow = null; - if (console != null) - { - try - { - console.setVisible(false); - } catch (Error e) - { - } catch (Exception x) - { - } - ; - console = null; - } - + closeConsole(); } @Override @@ -227,8 +193,6 @@ public class AppJmolBinding extends jalview.ext.jmol.JalviewJmolBinding if (svl instanceof SeqPanel) { appJmolWindow.removeAlignmentPanel(((SeqPanel) svl).ap); - } - ; } } diff --git a/src/jalview/gui/ChimeraViewFrame.java b/src/jalview/gui/ChimeraViewFrame.java index 513659f..384e1cc 100644 --- a/src/jalview/gui/ChimeraViewFrame.java +++ b/src/jalview/gui/ChimeraViewFrame.java @@ -20,19 +20,16 @@ */ package jalview.gui; -import jalview.api.SequenceStructureBinding; -import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.ColumnSelection; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; -import jalview.gui.ViewSelectionMenu.ViewSetProvider; +import jalview.ext.rbvi.chimera.JalviewChimeraBinding; import jalview.io.AppletFormatAdapter; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; -import jalview.jbgui.GStructureViewer; import jalview.schemes.BuriedColourScheme; import jalview.schemes.ColourSchemeI; import jalview.schemes.HelixColourScheme; @@ -42,11 +39,11 @@ import jalview.schemes.StrandColourScheme; import jalview.schemes.TaylorColourScheme; import jalview.schemes.TurnColourScheme; import jalview.schemes.ZappoColourScheme; +import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.dbsources.Pdb; -import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -78,34 +75,14 @@ import javax.swing.event.MenuListener; * @author jprocter * */ -public class ChimeraViewFrame extends GStructureViewer implements Runnable, - ViewSetProvider, JalviewStructureDisplayI - +public class ChimeraViewFrame extends StructureViewerBase { - private JalviewChimeraBindingModel jmb; - - /* - * list of sequenceSet ids associated with the view - */ - private ArrayList _aps = new ArrayList(); - - /* - * list of alignment panels to use for superposition - */ - private Vector _alignwith = new Vector(); - - /* - * list of alignment panels that are used for colouring structures by aligned - * sequences - */ - private Vector _colourwith = new Vector(); + private JalviewChimeraBinding jmb; private boolean allChainsSelected = false; private boolean alignAddedStructures = false; - AlignmentPanel ap; - /* * state flag for PDB retrieval thread */ @@ -115,13 +92,18 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, private IProgressIndicator progressBar = null; - private String viewId = null; - /* * pdb retrieval thread. */ private Thread worker = null; + /* + * Path to Chimera session file. This is set when an open Jalview/Chimera + * session is saved, or on restore from a Jalview project (if it holds the + * filename of any saved Chimera sessions). + */ + private String chimeraSessionFile = null; + /** * Initialise menu options. */ @@ -244,9 +226,9 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, // TODO : Fix multiple seq to one chain issue here. ap.getStructureSelectionManager().setMapping(seq, chains, alreadyMapped, AppletFormatAdapter.FILE); - if (ap.seqPanel.seqCanvas.fr != null) + if (ap.getSeqPanel().seqCanvas.fr != null) { - ap.seqPanel.seqCanvas.fr.featuresAdded(); + ap.getSeqPanel().seqCanvas.fr.featuresAdded(); ap.paintAlignment(true); } @@ -261,15 +243,17 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, final ChimeraViewFrame topView = ((ChimeraViewFrame) frame); // JBPNOTE: this looks like a binding routine, rather than a gui // routine - for (int pe = 0; pe < topView.jmb.pdbentry.length; pe++) + for (int pe = 0; pe < topView.jmb.getPdbCount(); pe++) { - if (topView.jmb.pdbentry[pe].getFile().equals(alreadyMapped)) + if (topView.jmb.getPdbEntry(pe).getFile() + .equals( + alreadyMapped)) { topView.jmb.addSequence(pe, seq); topView.addAlignmentPanel(ap); // add it to the set used for colouring topView.useAlignmentPanelForColourbyseq(ap); - topView.buildChimeraActionMenu(); + topView.buildActionMenu(); ap.getStructureSelectionManager() .sequenceColoursChanged(ap); break; @@ -328,12 +312,11 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, jmb.setColourBySequence(true); setSize(400, 400); // probably should be a configurable/dynamic default here initMenus(); - worker = null; - { - addingStructures = false; - worker = new Thread(this); - worker.start(); - } + + addingStructures = false; + worker = new Thread(this); + worker.start(); + this.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent internalFrameEvent) @@ -359,114 +342,37 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, openNewChimera(ap, pe, seqs); } - public AlignmentPanel[] getAllAlignmentPanels() - { - AlignmentPanel[] t, list = new AlignmentPanel[0]; - for (String setid : _aps) - { - AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid); - if (panels != null) - { - t = new AlignmentPanel[list.length + panels.length]; - System.arraycopy(list, 0, t, 0, list.length); - System.arraycopy(panels, 0, t, list.length, panels.length); - list = t; - } - } - - return list; - } - /** - * set the primary alignmentPanel reference and add another alignPanel to the - * list of ones to use for colouring and aligning + * Create a new viewer from saved session state data including Chimera session + * file. * - * @param nap - */ - public void addAlignmentPanel(AlignmentPanel nap) - { - if (ap == null) - { - ap = nap; - } - if (!_aps.contains(nap.av.getSequenceSetId())) - { - _aps.add(nap.av.getSequenceSetId()); - } - } - - /** - * remove any references held to the given alignment panel + * @param chimeraSession * - * @param nap + * @param alignPanel + * @param pdbArray + * @param seqsArray + * @param colourByChimera + * @param colourBySequence */ - public void removeAlignmentPanel(AlignmentPanel nap) - { - try - { - _alignwith.remove(nap); - _colourwith.remove(nap); - if (ap == nap) - { - ap = null; - for (AlignmentPanel aps : getAllAlignmentPanels()) - { - if (aps != nap) - { - ap = aps; - break; - } - } - } - } catch (Exception ex) - { - } - if (ap != null) - { - buildChimeraActionMenu(); - } - } - - public void useAlignmentPanelForSuperposition(AlignmentPanel nap) + public ChimeraViewFrame(String chimeraSession, AlignmentPanel alignPanel, + PDBEntry[] pdbArray, + SequenceI[][] seqsArray, boolean colourByChimera, + boolean colourBySequence) { - addAlignmentPanel(nap); - if (!_alignwith.contains(nap)) - { - _alignwith.add(nap); - } - } - - public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap) - { - if (_alignwith.contains(nap)) - { - _alignwith.remove(nap); - } - } - - public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, - boolean enableColourBySeq) - { - useAlignmentPanelForColourbyseq(nap); - jmb.setColourBySequence(enableColourBySeq); - seqColour.setSelected(enableColourBySeq); - viewerColour.setSelected(!enableColourBySeq); - } - - public void useAlignmentPanelForColourbyseq(AlignmentPanel nap) - { - addAlignmentPanel(nap); - if (!_colourwith.contains(nap)) + super(); + this.chimeraSessionFile = chimeraSession; + openNewChimera(alignPanel, pdbArray, seqsArray); + if (colourByChimera) { - _colourwith.add(nap); + jmb.setColourBySequence(false); + seqColour.setSelected(false); + viewerColour.setSelected(true); } - } - - public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap) - { - if (_colourwith.contains(nap)) + else if (colourBySequence) { - _colourwith.remove(nap); + jmb.setColourBySequence(true); + seqColour.setSelected(true); + viewerColour.setSelected(false); } } @@ -535,7 +441,7 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { if (frame instanceof ChimeraViewFrame) { - if (((ChimeraViewFrame) frame).isLinkedWith(apanel)) + if (((StructureViewerBase) frame).isLinkedWith(apanel)) { result.add((ChimeraViewFrame) frame); } @@ -544,18 +450,31 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, return result; } - void initChimera(String command) + /** + * Launch Chimera. If we have a chimera session file name, send Chimera the + * command to open its saved session file. + */ + void initChimera() { jmb.setFinishedInit(false); - // TODO: consider waiting until the structure/view is fully loaded before - // displaying - jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle(true), + jalview.gui.Desktop.addInternalFrame(this, jmb.getViewerTitle("Chimera", true), getBounds().width, getBounds().height); - if (command == null) + + /* + * Pass an empty 'command' to launch Chimera + */ + jmb.evalStateCommand("", false); + + if (this.chimeraSessionFile != null) { - command = ""; + boolean opened = jmb.openSession(chimeraSessionFile); + if (!opened) + { + System.err + .println("An error occurred opening Chimera session file " + + chimeraSessionFile); + } } - jmb.evalStateCommand(command, false); jmb.setFinishedInit(true); } @@ -633,14 +552,14 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { String prompt = MessageManager .formatMessage("label.confirm_close_chimera", new Object[] - { jmb.getViewerTitle(false) }); + { jmb.getViewerTitle("Chimera", false) }); prompt = JvSwingUtils.wrapTooltip(true, prompt); int confirm = JOptionPane.showConfirmDialog(this, prompt, MessageManager.getString("label.close_viewer"), JOptionPane.YES_NO_OPTION); jmb.closeViewer(confirm == JOptionPane.YES_OPTION); } - ap = null; + setAlignmentPanel(null); _aps.clear(); _alignwith.clear(); _colourwith.clear(); @@ -667,10 +586,10 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, String[] curfiles = jmb.getPdbFile(); // files currently in viewer // TODO: replace with reference fetching/transfer code (validate PDBentry // as a DBRef?) - for (int pi = 0; pi < jmb.pdbentry.length; pi++) + for (int pi = 0; pi < jmb.getPdbCount(); pi++) { String file = null; - thePdbEntry = jmb.pdbentry[pi]; + thePdbEntry = jmb.getPdbEntry(pi); if (thePdbEntry.getFile() == null) { /* @@ -736,7 +655,7 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { try { - initChimera(""); + initChimera(); } catch (Exception ex) { Cache.log.error("Couldn't open Chimera viewer!", ex); @@ -752,7 +671,7 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { int pos = filePDBpos.get(num).intValue(); jmb.openFile(pe); - jmb.addSequence(pos, jmb.sequence[pos]); + jmb.addSequence(pos, jmb.getSequence()[pos]); File fl = new File(pe.getFile()); String protocol = AppletFormatAdapter.URL; try @@ -766,7 +685,8 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, } // Explicitly map to the filename used by Chimera ; // TODO: use pe.getId() instead of pe.getFile() ? - jmb.ssm.setMapping(jmb.sequence[pos], null, pe.getFile(), + jmb.getSsm().setMapping(jmb.getSequence()[pos], null, + pe.getFile(), protocol); } catch (OutOfMemoryError oomerror) { @@ -919,9 +839,9 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, jalview.gui.CutAndPasteTransfer cap = new jalview.gui.CutAndPasteTransfer(); try { - for (int pdbe = 0; pdbe < jmb.pdbentry.length; pdbe++) + for (int pdbe = 0; pdbe < jmb.getPdbCount(); pdbe++) { - cap.appendText(jmb.printMapping(jmb.pdbentry[pdbe].getFile())); + cap.appendText(jmb.printMapping(jmb.getPdbEntry(pdbe).getFile())); cap.appendText("\n"); } } catch (OutOfMemoryError e) @@ -975,16 +895,16 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, { if (!jmb.isLoadingFromArchive()) { - if (_colourwith.size() == 0 && ap != null) + if (_colourwith.size() == 0 && getAlignmentPanel() != null) { // Make the currently displayed alignment panel the associated view - _colourwith.add(ap.alignFrame.alignPanel); + _colourwith.add(getAlignmentPanel().alignFrame.alignPanel); } } // Set the colour using the current view for the associated alignframe for (AlignmentPanel ap : _colourwith) { - jmb.colourBySequence(ap.av.showSequenceFeatures, ap); + jmb.colourBySequence(ap.av.isShowSequenceFeatures(), ap); } } } @@ -1089,15 +1009,6 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, } } - public String getViewId() - { - if (viewId == null) - { - viewId = System.currentTimeMillis() + "." + this.hashCode(); - } - return viewId; - } - public void updateTitleAndMenus() { if (jmb.fileLoadingError != null && jmb.fileLoadingError.length() > 0) @@ -1105,10 +1016,10 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, repaint(); return; } - setChainMenuItems(jmb.chainNames); + setChainMenuItems(jmb.getChainNames()); - this.setTitle(jmb.getViewerTitle(true)); - if (jmb.getPdbFile().length > 1 && jmb.sequence.length > 1) + this.setTitle(jmb.getViewerTitle("Chimera", true)); + if (jmb.getPdbFile().length > 1 && jmb.getSequence().length > 1) { viewerActionMenu.setVisible(true); } @@ -1118,26 +1029,6 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, } } - protected void buildChimeraActionMenu() - { - if (_alignwith == null) - { - _alignwith = new Vector(); - } - if (_alignwith.size() == 0 && ap != null) - { - _alignwith.add(ap); - } - ; - for (Component c : viewerActionMenu.getMenuComponents()) - { - if (c != alignStructs) - { - viewerActionMenu.remove((JMenuItem) c); - } - } - } - /* * (non-Javadoc) * @@ -1153,14 +1044,14 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, private void alignStructs_withAllAlignPanels() { - if (ap == null) + if (getAlignmentPanel() == null) { return; } ; if (_alignwith.size() == 0) { - _alignwith.add(ap); + _alignwith.add(getAlignmentPanel()); } ; try @@ -1212,42 +1103,40 @@ public class ChimeraViewFrame extends GStructureViewer implements Runnable, return ap; } } - return ap; - } - - /** - * - * @param ap2 - * @return true if this Chimera instance is linked with the given alignPanel - */ - public boolean isLinkedWith(AlignmentPanel ap2) - { - return _aps.contains(ap2.av.getSequenceSetId()); + return getAlignmentPanel(); } - public boolean isUsedforaligment(AlignmentPanel ap2) - { - - return (_alignwith != null) && _alignwith.contains(ap2); - } - - public boolean isUsedforcolourby(AlignmentPanel ap2) + @Override + public AAStructureBindingModel getBinding() { - return (_colourwith != null) && _colourwith.contains(ap2); + return jmb; } /** + * Ask Chimera to save its session to the designated file path. Returns true + * if successful, else false. * - * @return TRUE if the view is NOT being coloured by sequence associations. + * @param filepath + * @see getStateInfo */ - public boolean isColouredByChimera() + public boolean saveSession(String filepath) { - return !jmb.isColourBySequence(); + boolean result = jmb.saveSession(filepath); + if (result) + { + this.chimeraSessionFile = filepath; + } + return result; } - public SequenceStructureBinding getBinding() + /** + * Returns the file path of the Chimera session file the last time it was + * saved. If it was never saved, returns an empty string. There is no + * guarantee that the Chimera session has not changed since it was saved. + */ + @Override + public String getStateInfo() { - return jmb; + return this.chimeraSessionFile; } - } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index b8f629a..70c8355 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -26,6 +26,7 @@ import jalview.io.FormatAdapter; import jalview.io.IdentifyFile; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; +import jalview.jbgui.GStructureViewer; import jalview.structure.StructureSelectionManager; import jalview.util.ImageMaker; import jalview.util.MessageManager; @@ -113,6 +114,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ private BlogReader jvnews = null; + private File projectFile; + /** * @param listener * @see jalview.gui.JalviewChangeSupport#addJalviewPropertyChangeListener(java.beans.PropertyChangeListener) @@ -1462,6 +1465,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements { final Desktop me = this; final java.io.File choice = chooser.getSelectedFile(); + setProjectFile(choice); + + // TODO or move inside the new Thread? + saveChimeraSessions(choice.getAbsolutePath()); + new Thread(new Runnable() { public void run() @@ -1475,7 +1483,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements // TODO prevent user from messing with the Desktop whilst we're saving try { - new Jalview2XML().SaveState(choice); + new Jalview2XML().saveState(choice); } catch (OutOfMemoryError oom) { new OOMWarning("Whilst saving current state to " @@ -1498,6 +1506,42 @@ public class Desktop extends jalview.jbgui.GDesktop implements } /** + * Request any open, linked Chimera sessions to save their state. + * + * @param jalviewProjectFilename + * the filename of the Jalview project; Chimera session files should + * be given distinct, but obviously related, names. + */ + public void saveChimeraSessions(String jalviewProjectFilename) + { + int i = 0; + for (JInternalFrame frame : getAllFrames()) + { + if (frame instanceof ChimeraViewFrame) + { + /* + * Construct a filename for the Chimera session by append _chimera.py + * to the Jalview project file name. + */ + String chimeraPath = jalviewProjectFilename + "_chimera_" + i + + ".py"; + ((ChimeraViewFrame) frame).saveSession(chimeraPath); + i++; + } + } + } + + private void setProjectFile(File choice) + { + this.projectFile = choice; + } + + public File getProjectFile() + { + return this.projectFile; + } + + /** * DOCUMENT ME! * * @param e @@ -1517,9 +1561,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements if (value == JalviewFileChooser.APPROVE_OPTION) { - final String choice = chooser.getSelectedFile().getAbsolutePath(); - jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser - .getSelectedFile().getParent()); + final File selectedFile = chooser.getSelectedFile(); + setProjectFile(selectedFile); + final String choice = selectedFile.getAbsolutePath(); + jalview.bin.Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent()); new Thread(new Runnable() { public void run() @@ -1528,7 +1573,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements choice.hashCode()); try { - new Jalview2XML().LoadJalviewAlign(choice); + new Jalview2XML().loadJalviewAlign(choice); } catch (OutOfMemoryError oom) { new OOMWarning("Whilst loading project from " + choice, oom); @@ -2312,7 +2357,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements return afs; } - public AppJmol[] getJmols() + public GStructureViewer[] getJmols() { JInternalFrame[] frames = Desktop.desktop.getAllFrames(); @@ -2328,7 +2373,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (frames[i] instanceof AppJmol) { - AppJmol af = (AppJmol) frames[i]; + GStructureViewer af = (GStructureViewer) frames[i]; avp.addElement(af); } } @@ -2340,10 +2385,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements { return null; } - AppJmol afs[] = new AppJmol[avp.size()]; + GStructureViewer afs[] = new GStructureViewer[avp.size()]; for (int i = 0, j = avp.size(); i < j; i++) { - afs[i] = (AppJmol) avp.elementAt(i); + afs[i] = (GStructureViewer) avp.elementAt(i); } avp.clear(); return afs; diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 8ab7c85..d1d1b6d 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -109,10 +109,10 @@ public class FeatureColourChooser extends JalviewDialog } }); - float mm[] = ((float[][]) fr.minmax.get(type))[0]; + float mm[] = ((float[][]) fr.getMinMax().get(type))[0]; min = mm[0]; max = mm[1]; - oldcs = fr.featureColours.get(type); + oldcs = fr.getFeatureColours().get(type); if (oldcs instanceof GraduatedColor) { if (((GraduatedColor) oldcs).isAutoScale()) @@ -470,7 +470,7 @@ public class FeatureColourChooser extends JalviewDialog maxColour.setForeground(oldmaxColour); minColour.setForeground(oldminColour); } - fr.featureColours.put(type, acg); + fr.setColour(type, acg); cs = acg; ap.paintAlignment(false); } @@ -495,7 +495,7 @@ public class FeatureColourChooser extends JalviewDialog void reset() { - fr.featureColours.put(type, oldcs); + fr.setColour(type, oldcs); ap.paintAlignment(false); cs = null; } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index d2d9c9c..3ce831e 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -20,59 +20,46 @@ */ package jalview.gui; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; - -import javax.swing.*; - -import jalview.datamodel.*; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; import jalview.schemes.GraduatedColor; import jalview.util.MessageManager; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JColorChooser; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSpinner; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.SwingConstants; + /** * DOCUMENT ME! * * @author $author$ * @version $Revision$ */ -public class FeatureRenderer implements jalview.api.FeatureRenderer +public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRenderer implements jalview.api.FeatureRenderer { - AlignmentPanel ap; - - AlignViewport av; - Color resBoxColour; - /** - * global transparency for feature - */ - float transparency = 1.0f; - - FontMetrics fm; - - int charOffset; - - Map featureColours = new ConcurrentHashMap(); - - // A higher level for grouping features of a - // particular type - Map featureGroups = new ConcurrentHashMap(); - - // This is actually an Integer held in the hashtable, - // Retrieved using the key feature type - Object currentColour; - - String[] renderOrder; - - PropertyChangeSupport changeSupport = new PropertyChangeSupport(this); - - Vector allfeatures; + AlignmentPanel ap; /** * Creates a new FeatureRenderer object. @@ -82,901 +69,13 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer */ public FeatureRenderer(AlignmentPanel ap) { + super(); this.ap = ap; this.av = ap.av; - if (ap != null && ap.seqPanel != null && ap.seqPanel.seqCanvas != null - && ap.seqPanel.seqCanvas.fr != null) - { - transferSettings(ap.seqPanel.seqCanvas.fr); - } - } - - public class FeatureRendererSettings implements Cloneable - { - String[] renderOrder; - - Map featureGroups; - - Map featureColours; - - float transparency; - - Map featureOrder; - - public FeatureRendererSettings(String[] renderOrder, - Hashtable featureGroups, Hashtable featureColours, - float transparency, Hashtable featureOrder) - { - super(); - this.renderOrder = renderOrder; - this.featureGroups = featureGroups; - this.featureColours = featureColours; - this.transparency = transparency; - this.featureOrder = featureOrder; - } - - /** - * create an independent instance of the feature renderer settings - * - * @param fr - */ - public FeatureRendererSettings(FeatureRenderer fr) - { - renderOrder = null; - featureGroups = new ConcurrentHashMap(); - featureColours = new ConcurrentHashMap(); - featureOrder = new ConcurrentHashMap(); - if (fr.renderOrder != null) - { - this.renderOrder = new String[fr.renderOrder.length]; - System.arraycopy(fr.renderOrder, 0, renderOrder, 0, - fr.renderOrder.length); - } - if (fr.featureGroups != null) - { - this.featureGroups = new ConcurrentHashMap(fr.featureGroups); - } - if (fr.featureColours != null) - { - this.featureColours = new ConcurrentHashMap(fr.featureColours); - } - Iterator en = fr.featureColours.keySet().iterator(); - while (en.hasNext()) - { - Object next = en.next(); - Object val = featureColours.get(next); - if (val instanceof GraduatedColor) - { - featureColours - .put(next, new GraduatedColor((GraduatedColor) val)); - } - } - this.transparency = fr.transparency; - if (fr.featureOrder != null) - { - this.featureOrder = new ConcurrentHashMap(fr.featureOrder); - } - } - } - - public FeatureRendererSettings getSettings() - { - return new FeatureRendererSettings(this); - } - - public void transferSettings(FeatureRendererSettings fr) - { - this.renderOrder = fr.renderOrder; - this.featureGroups = fr.featureGroups; - this.featureColours = fr.featureColours; - this.transparency = fr.transparency; - this.featureOrder = fr.featureOrder; - } - - /** - * update from another feature renderer - * - * @param fr - * settings to copy - */ - public void transferSettings(FeatureRenderer fr) - { - FeatureRendererSettings frs = new FeatureRendererSettings(fr); - this.renderOrder = frs.renderOrder; - this.featureGroups = frs.featureGroups; - this.featureColours = frs.featureColours; - this.transparency = frs.transparency; - this.featureOrder = frs.featureOrder; - if (av != null && av != fr.av) - { - // copy over the displayed feature settings - if (fr.av != null) - { - if (fr.av.featuresDisplayed != null) - { - // update display settings - if (av.featuresDisplayed == null) - { - av.featuresDisplayed = new Hashtable(fr.av.featuresDisplayed); - } - else - { - av.featuresDisplayed.clear(); - Enumeration en = fr.av.featuresDisplayed.keys(); - while (en.hasMoreElements()) - { - av.featuresDisplayed.put(en.nextElement(), Boolean.TRUE); - } - - } - } - } - } - } - - BufferedImage offscreenImage; - - boolean offscreenRender = false; - - public Color findFeatureColour(Color initialCol, SequenceI seq, int res) - { - return new Color(findFeatureColour(initialCol.getRGB(), seq, res)); - } - - /** - * This is used by the Molecule Viewer and Overview to get the accurate - * colourof the rendered sequence - */ - public synchronized int findFeatureColour(int initialCol, SequenceI seq, - int column) - { - if (!av.showSequenceFeatures) - { - return initialCol; - } - - if (seq != lastSeq) - { - lastSeq = seq; - sequenceFeatures = lastSeq.getDatasetSequence().getSequenceFeatures(); - if (sequenceFeatures != null) - { - sfSize = sequenceFeatures.length; - } - } - - if (sequenceFeatures != lastSeq.getDatasetSequence() - .getSequenceFeatures()) - { - sequenceFeatures = lastSeq.getDatasetSequence().getSequenceFeatures(); - if (sequenceFeatures != null) - { - sfSize = sequenceFeatures.length; - } - } - - if (sequenceFeatures == null || sfSize == 0) - { - return initialCol; - } - - if (jalview.util.Comparison.isGap(lastSeq.getCharAt(column))) - { - return Color.white.getRGB(); - } - - // Only bother making an offscreen image if transparency is applied - if (transparency != 1.0f && offscreenImage == null) - { - offscreenImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); - } - - currentColour = null; - // TODO: non-threadsafe - each rendering thread needs its own instance of - // the feature renderer - or this should be synchronized. - offscreenRender = true; - - if (offscreenImage != null) - { - offscreenImage.setRGB(0, 0, initialCol); - drawSequence(offscreenImage.getGraphics(), lastSeq, column, column, 0); - - return offscreenImage.getRGB(0, 0); - } - else - { - drawSequence(null, lastSeq, lastSeq.findPosition(column), -1, -1); - - if (currentColour == null) - { - return initialCol; - } - else - { - return ((Integer) currentColour).intValue(); - } - } - - } - - /** - * DOCUMENT ME! - * - * @param g - * DOCUMENT ME! - * @param seq - * DOCUMENT ME! - * @param sg - * DOCUMENT ME! - * @param start - * DOCUMENT ME! - * @param end - * DOCUMENT ME! - * @param x1 - * DOCUMENT ME! - * @param y1 - * DOCUMENT ME! - * @param width - * DOCUMENT ME! - * @param height - * DOCUMENT ME! - */ - // String type; - // SequenceFeature sf; - SequenceI lastSeq; - - SequenceFeature[] sequenceFeatures; - - int sfSize, sfindex, spos, epos; - - /** - * show scores as heights - */ - protected boolean varyHeight = false; - - synchronized public void drawSequence(Graphics g, SequenceI seq, - int start, int end, int y1) - { - - if (seq.getDatasetSequence().getSequenceFeatures() == null - || seq.getDatasetSequence().getSequenceFeatures().length == 0) - { - return; - } - - if (g != null) - { - fm = g.getFontMetrics(); - } - - if (av.featuresDisplayed == null || renderOrder == null - || newFeatureAdded) - { - findAllFeatures(); - if (av.featuresDisplayed.size() < 1) - { - return; - } - - sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures(); - } - - if (lastSeq == null - || seq != lastSeq - || seq.getDatasetSequence().getSequenceFeatures() != sequenceFeatures) - { - lastSeq = seq; - sequenceFeatures = seq.getDatasetSequence().getSequenceFeatures(); - } - - if (transparency != 1 && g != null) - { - Graphics2D g2 = (Graphics2D) g; - g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, - transparency)); - } - - if (!offscreenRender) - { - spos = lastSeq.findPosition(start); - epos = lastSeq.findPosition(end); - } - - sfSize = sequenceFeatures.length; - String type; - for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++) - { - type = renderOrder[renderIndex]; - - if (type == null || !av.featuresDisplayed.containsKey(type)) - { - continue; - } - - // loop through all features in sequence to find - // current feature to render - for (sfindex = 0; sfindex < sfSize; sfindex++) - { - if (!sequenceFeatures[sfindex].type.equals(type)) - { - continue; - } - - if (featureGroups != null - && sequenceFeatures[sfindex].featureGroup != null - && sequenceFeatures[sfindex].featureGroup.length() != 0 - && featureGroups - .containsKey(sequenceFeatures[sfindex].featureGroup) - && !((Boolean) featureGroups - .get(sequenceFeatures[sfindex].featureGroup)) - .booleanValue()) - { - continue; - } - - if (!offscreenRender - && (sequenceFeatures[sfindex].getBegin() > epos || sequenceFeatures[sfindex] - .getEnd() < spos)) - { - continue; - } - - if (offscreenRender && offscreenImage == null) - { - if (sequenceFeatures[sfindex].begin <= start - && sequenceFeatures[sfindex].end >= start) - { - // this is passed out to the overview and other sequence renderers - // (e.g. molecule viewer) to get displayed colour for rendered - // sequence - currentColour = new Integer( - getColour(sequenceFeatures[sfindex]).getRGB()); - // used to be retreived from av.featuresDisplayed - // currentColour = av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type); - - } - } - else if (sequenceFeatures[sfindex].type.equals("disulfide bond")) - { - - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - getColour(sequenceFeatures[sfindex]) - // new Color(((Integer) av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type)).intValue()) - , start, end, y1); - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - getColour(sequenceFeatures[sfindex]) - // new Color(((Integer) av.featuresDisplayed - // .get(sequenceFeatures[sfindex].type)).intValue()) - , start, end, y1); - - } - else if (showFeature(sequenceFeatures[sfindex])) - { - if (av.showSeqFeaturesHeight - && sequenceFeatures[sfindex].score != Float.NaN) - { - renderScoreFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - getColour(sequenceFeatures[sfindex]), start, end, y1, - normaliseScore(sequenceFeatures[sfindex])); - } - else - { - renderFeature(g, seq, - seq.findIndex(sequenceFeatures[sfindex].begin) - 1, - seq.findIndex(sequenceFeatures[sfindex].end) - 1, - getColour(sequenceFeatures[sfindex]), start, end, y1); - } - } - - } - - } - - if (transparency != 1.0f && g != null) - { - Graphics2D g2 = (Graphics2D) g; - g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, - 1.0f)); - } - } - - Hashtable minmax = new Hashtable(); - - /** - * normalise a score against the max/min bounds for the feature type. - * - * @param sequenceFeature - * @return byte[] { signed, normalised signed (-127 to 127) or unsigned - * (0-255) value. - */ - private final byte[] normaliseScore(SequenceFeature sequenceFeature) - { - float[] mm = ((float[][]) minmax.get(sequenceFeature.type))[0]; - final byte[] r = new byte[] - { 0, (byte) 255 }; - if (mm != null) - { - if (r[0] != 0 || mm[0] < 0.0) - { - r[0] = 1; - r[1] = (byte) ((int) 128.0 + 127.0 * (sequenceFeature.score / mm[1])); - } - else - { - r[1] = (byte) ((int) 255.0 * (sequenceFeature.score / mm[1])); - } - } - return r; - } - - char s; - - int i; - - void renderFeature(Graphics g, SequenceI seq, int fstart, int fend, - Color featureColour, int start, int end, int y1) - { - - if (((fstart <= end) && (fend >= start))) - { - if (fstart < start) - { // fix for if the feature we have starts before the sequence start, - fstart = start; // but the feature end is still valid!! - } - - if (fend >= end) - { - fend = end; - } - int pady = (y1 + av.charHeight) - av.charHeight / 5; - for (i = fstart; i <= fend; i++) - { - s = seq.getCharAt(i); - - if (jalview.util.Comparison.isGap(s)) - { - continue; - } - - g.setColor(featureColour); - - g.fillRect((i - start) * av.charWidth, y1, av.charWidth, - av.charHeight); - - if (offscreenRender || !av.validCharWidth) - { - continue; - } - - g.setColor(Color.white); - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - g.drawString(String.valueOf(s), charOffset - + (av.charWidth * (i - start)), pady); - - } - } - } - - void renderScoreFeature(Graphics g, SequenceI seq, int fstart, int fend, - Color featureColour, int start, int end, int y1, byte[] bs) - { - - if (((fstart <= end) && (fend >= start))) - { - if (fstart < start) - { // fix for if the feature we have starts before the sequence start, - fstart = start; // but the feature end is still valid!! - } - - if (fend >= end) - { - fend = end; - } - int pady = (y1 + av.charHeight) - av.charHeight / 5; - int ystrt = 0, yend = av.charHeight; - if (bs[0] != 0) - { - // signed - zero is always middle of residue line. - if (bs[1] < 128) - { - yend = av.charHeight * (128 - bs[1]) / 512; - ystrt = av.charHeight - yend / 2; - } - else - { - ystrt = av.charHeight / 2; - yend = av.charHeight * (bs[1] - 128) / 512; - } - } - else - { - yend = av.charHeight * bs[1] / 255; - ystrt = av.charHeight - yend; - - } - for (i = fstart; i <= fend; i++) - { - s = seq.getCharAt(i); - - if (jalview.util.Comparison.isGap(s)) - { - continue; - } - - g.setColor(featureColour); - int x = (i - start) * av.charWidth; - g.drawRect(x, y1, av.charWidth, av.charHeight); - g.fillRect(x, y1 + ystrt, av.charWidth, yend); - - if (offscreenRender || !av.validCharWidth) - { - continue; - } - - g.setColor(Color.black); - charOffset = (av.charWidth - fm.charWidth(s)) / 2; - g.drawString(String.valueOf(s), charOffset - + (av.charWidth * (i - start)), pady); - - } - } - } - - boolean newFeatureAdded = false; - - /** - * Called when alignment in associated view has new/modified features to - * discover and display. - * - */ - public void featuresAdded() - { - lastSeq = null; - findAllFeatures(); - } - - boolean findingFeatures = false; - - /** - * search the alignment for all new features, give them a colour and display - * them. Then fires a PropertyChangeEvent on the changeSupport object. - * - */ - void findAllFeatures() - { - synchronized (firing) - { - if (firing.equals(Boolean.FALSE)) - { - firing = Boolean.TRUE; - findAllFeatures(true); // add all new features as visible - changeSupport.firePropertyChange("changeSupport", null, null); - firing = Boolean.FALSE; - } - } - } - - /** - * Searches alignment for all features and updates colours - * - * @param newMadeVisible - * if true newly added feature types will be rendered immediatly - */ - synchronized void findAllFeatures(boolean newMadeVisible) - { - newFeatureAdded = false; - - if (findingFeatures) - { - newFeatureAdded = true; - return; - } - - findingFeatures = true; - - if (av.featuresDisplayed == null) - { - av.featuresDisplayed = new Hashtable(); - } - - allfeatures = new Vector(); - Vector oldfeatures = new Vector(); - if (renderOrder != null) - { - for (int i = 0; i < renderOrder.length; i++) - { - if (renderOrder[i] != null) - { - oldfeatures.addElement(renderOrder[i]); - } - } - } - if (minmax == null) - { - minmax = new Hashtable(); - } - AlignmentI alignment = av.getAlignment(); - for (int i = 0; i < alignment.getHeight(); i++) - { - SequenceFeature[] features = alignment.getSequenceAt(i) - .getDatasetSequence().getSequenceFeatures(); - - if (features == null) - { - continue; - } - - int index = 0; - while (index < features.length) - { - if (!av.featuresDisplayed.containsKey(features[index].getType())) - { - - if (featureGroups.containsKey(features[index].getType())) - { - boolean visible = ((Boolean) featureGroups - .get(features[index].featureGroup)).booleanValue(); - - if (!visible) - { - index++; - continue; - } - } - - if (!(features[index].begin == 0 && features[index].end == 0)) - { - // If beginning and end are 0, the feature is for the whole sequence - // and we don't want to render the feature in the normal way - - if (newMadeVisible - && !oldfeatures.contains(features[index].getType())) - { - // this is a new feature type on the alignment. Mark it for - // display. - av.featuresDisplayed.put(features[index].getType(), - new Integer(getColour(features[index].getType()) - .getRGB())); - setOrder(features[index].getType(), 0); - } - } - } - if (!allfeatures.contains(features[index].getType())) - { - allfeatures.addElement(features[index].getType()); - } - if (features[index].score != Float.NaN) - { - int nonpos = features[index].getBegin() >= 1 ? 0 : 1; - float[][] mm = (float[][]) minmax.get(features[index].getType()); - if (mm == null) - { - mm = new float[][] - { null, null }; - minmax.put(features[index].getType(), mm); - } - if (mm[nonpos] == null) - { - mm[nonpos] = new float[] - { features[index].score, features[index].score }; - - } - else - { - if (mm[nonpos][0] > features[index].score) - { - mm[nonpos][0] = features[index].score; - } - if (mm[nonpos][1] < features[index].score) - { - mm[nonpos][1] = features[index].score; - } - } - } - index++; - } - } - updateRenderOrder(allfeatures); - findingFeatures = false; - } - - protected Boolean firing = Boolean.FALSE; - - /** - * replaces the current renderOrder with the unordered features in - * allfeatures. The ordering of any types in both renderOrder and allfeatures - * is preserved, and all new feature types are rendered on top of the existing - * types, in the order given by getOrder or the order given in allFeatures. - * Note. this operates directly on the featureOrder hash for efficiency. TODO: - * eliminate the float storage for computing/recalling the persistent ordering - * New Cability: updates min/max for colourscheme range if its dynamic - * - * @param allFeatures - */ - private void updateRenderOrder(Vector allFeatures) - { - Vector allfeatures = new Vector(allFeatures); - String[] oldRender = renderOrder; - renderOrder = new String[allfeatures.size()]; - Object mmrange, fc = null; - boolean initOrders = (featureOrder == null); - int opos = 0; - if (oldRender != null && oldRender.length > 0) - { - for (int j = 0; j < oldRender.length; j++) - { - if (oldRender[j] != null) - { - if (initOrders) - { - setOrder(oldRender[j], (1 - (1 + (float) j) - / (float) oldRender.length)); - } - if (allfeatures.contains(oldRender[j])) - { - renderOrder[opos++] = oldRender[j]; // existing features always - // appear below new features - allfeatures.removeElement(oldRender[j]); - if (minmax != null) - { - mmrange = minmax.get(oldRender[j]); - if (mmrange != null) - { - fc = featureColours.get(oldRender[j]); - if (fc != null && fc instanceof GraduatedColor - && ((GraduatedColor) fc).isAutoScale()) - { - ((GraduatedColor) fc).updateBounds( - ((float[][]) mmrange)[0][0], - ((float[][]) mmrange)[0][1]); - } - } - } - } - } - } - } - if (allfeatures.size() == 0) - { - // no new features - leave order unchanged. - return; - } - int i = allfeatures.size() - 1; - int iSize = i; - boolean sort = false; - String[] newf = new String[allfeatures.size()]; - float[] sortOrder = new float[allfeatures.size()]; - Enumeration en = allfeatures.elements(); - // sort remaining elements - while (en.hasMoreElements()) - { - newf[i] = en.nextElement().toString(); - if (minmax != null) - { - // update from new features minmax if necessary - mmrange = minmax.get(newf[i]); - if (mmrange != null) - { - fc = featureColours.get(newf[i]); - if (fc != null && fc instanceof GraduatedColor - && ((GraduatedColor) fc).isAutoScale()) - { - ((GraduatedColor) fc).updateBounds(((float[][]) mmrange)[0][0], - ((float[][]) mmrange)[0][1]); - } - } - } - if (initOrders || !featureOrder.containsKey(newf[i])) - { - int denom = initOrders ? allfeatures.size() : featureOrder.size(); - // new unordered feature - compute persistent ordering at head of - // existing features. - setOrder(newf[i], i / (float) denom); - } - // set order from newly found feature from persisted ordering. - sortOrder[i] = 2 - ((Float) featureOrder.get(newf[i])).floatValue(); - if (i < iSize) - { - // only sort if we need to - sort = sort || sortOrder[i] > sortOrder[i + 1]; - } - i--; - } - if (iSize > 1 && sort) - { - jalview.util.QuickSort.sort(sortOrder, newf); - } - sortOrder = null; - System.arraycopy(newf, 0, renderOrder, opos, newf.length); - } - - /** - * get a feature style object for the given type string. Creates a - * java.awt.Color for a featureType with no existing colourscheme. TODO: - * replace return type with object implementing standard abstract colour/style - * interface - * - * @param featureType - * @return java.awt.Color or GraduatedColor - */ - public Object getFeatureStyle(String featureType) - { - Object fc = featureColours.get(featureType); - if (fc == null) - { - jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); - Color col = ucs.createColourFromName(featureType); - featureColours.put(featureType, fc = col); - } - return fc; - } - - /** - * return a nominal colour for this feature - * - * @param featureType - * @return standard color, or maximum colour for graduated colourscheme - */ - public Color getColour(String featureType) - { - Object fc = getFeatureStyle(featureType); - - if (fc instanceof Color) - { - return (Color) fc; - } - else - { - if (fc instanceof GraduatedColor) - { - return ((GraduatedColor) fc).getMaxColor(); - } - } - throw new Error(MessageManager.formatMessage("error.implementation_error_unrecognised_render_object_for_features_type", new String[]{fc.getClass().toString(),featureType})); - } - - /** - * calculate the render colour for a specific feature using current feature - * settings. - * - * @param feature - * @return render colour for the given feature - */ - public Color getColour(SequenceFeature feature) - { - Object fc = getFeatureStyle(feature.getType()); - if (fc instanceof Color) - { - return (Color) fc; - } - else - { - if (fc instanceof GraduatedColor) - { - return ((GraduatedColor) fc).findColor(feature); - } - } - throw new Error(MessageManager.formatMessage("error.implementation_error_unrecognised_render_object_for_features_type", new String[]{fc.getClass().toString(),feature.getType()})); - } - - private boolean showFeature(SequenceFeature sequenceFeature) - { - Object fc = getFeatureStyle(sequenceFeature.type); - if (fc instanceof GraduatedColor) + if (ap != null && ap.getSeqPanel() != null && ap.getSeqPanel().seqCanvas != null + && ap.getSeqPanel().seqCanvas.fr != null) { - return ((GraduatedColor) fc).isColored(sequenceFeature); - } - else - { - return true; + transferSettings(ap.getSeqPanel().seqCanvas.fr); } } @@ -1095,7 +194,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer highlight.addResult(sequences[0], features[index].getBegin(), features[index].getEnd()); - ap.seqPanel.seqCanvas.highlightSearchResults(highlight); + ap.getSeqPanel().seqCanvas.highlightSearchResults(highlight); } Object col = getFeatureStyle(name.getText()); @@ -1235,7 +334,9 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer lastDescriptionAdded = description.getText().replaceAll("\n", " "); // TODO: determine if the null feature group is valid if (lastFeatureGroupAdded.length() < 1) + { lastFeatureGroupAdded = null; + } } if (!newFeatures) @@ -1253,7 +354,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer sf.description = lastDescriptionAdded; setColour(sf.type, fcol); - av.featuresDisplayed.put(sf.type, getColour(sf.type)); + getFeaturesDisplayed().setVisible(sf.type); try { @@ -1274,27 +375,19 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer for (int i = 0; i < sequences.length; i++) { features[i].type = lastFeatureAdded; - if (lastFeatureGroupAdded != null) - features[i].featureGroup = lastFeatureGroupAdded; + // fix for JAL-1538 - always set feature group here + features[i].featureGroup = lastFeatureGroupAdded; features[i].description = lastDescriptionAdded; sequences[i].addSequenceFeature(features[i]); ffile.parseDescriptionHTML(features[i], false); } - if (av.featuresDisplayed == null) - { - av.featuresDisplayed = new Hashtable(); - } - if (lastFeatureGroupAdded != null) { - if (featureGroups == null) - featureGroups = new Hashtable(); - featureGroups.put(lastFeatureGroupAdded, new Boolean(true)); + setGroupVisibility(lastFeatureGroupAdded, true); } setColour(lastFeatureAdded, fcol); - av.featuresDisplayed.put(lastFeatureAdded, - getColour(lastFeatureAdded)); + setVisible(lastFeatureAdded); findAllFeatures(false); @@ -1313,6 +406,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer return true; } + /** * update the amend feature button dependent on the given style * @@ -1340,145 +434,4 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer // colour.setForeground(colour.getBackground()); } } - - public void setColour(String featureType, Object col) - { - // overwrite - // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof - // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null; - // Object c = featureColours.get(featureType); - // if (c == null || c instanceof Color || (c instanceof GraduatedColor && - // !((GraduatedColor)c).getMaxColor().equals(_col))) - { - featureColours.put(featureType, col); - } - } - - public void setTransparency(float value) - { - transparency = value; - } - - public float getTransparency() - { - return transparency; - } - - /** - * Replace current ordering with new ordering - * - * @param data - * { String(Type), Colour(Type), Boolean(Displayed) } - */ - public void setFeaturePriority(Object[][] data) - { - setFeaturePriority(data, true); - } - - /** - * - * @param data - * { String(Type), Colour(Type), Boolean(Displayed) } - * @param visibleNew - * when true current featureDisplay list will be cleared - */ - public void setFeaturePriority(Object[][] data, boolean visibleNew) - { - if (visibleNew) - { - if (av.featuresDisplayed != null) - { - av.featuresDisplayed.clear(); - } - else - { - av.featuresDisplayed = new Hashtable(); - } - } - if (data == null) - { - return; - } - - // The feature table will display high priority - // features at the top, but theses are the ones - // we need to render last, so invert the data - renderOrder = new String[data.length]; - - if (data.length > 0) - { - for (int i = 0; i < data.length; i++) - { - String type = data[i][0].toString(); - setColour(type, data[i][1]); // todo : typesafety - feature color - // interface object - if (((Boolean) data[i][2]).booleanValue()) - { - av.featuresDisplayed.put(type, new Integer(getColour(type) - .getRGB())); - } - - renderOrder[data.length - i - 1] = type; - } - } - - } - - Map featureOrder = null; - - /** - * analogous to colour - store a normalized ordering for all feature types in - * this rendering context. - * - * @param type - * Feature type string - * @param position - * normalized priority - 0 means always appears on top, 1 means - * always last. - */ - public float setOrder(String type, float position) - { - if (featureOrder == null) - { - featureOrder = new Hashtable(); - } - featureOrder.put(type, new Float(position)); - return position; - } - - /** - * get the global priority (0 (top) to 1 (bottom)) - * - * @param type - * @return [0,1] or -1 for a type without a priority - */ - public float getOrder(String type) - { - if (featureOrder != null) - { - if (featureOrder.containsKey(type)) - { - return ((Float) featureOrder.get(type)).floatValue(); - } - } - return -1; - } - - /** - * @param listener - * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener) - */ - public void addPropertyChangeListener(PropertyChangeListener listener) - { - changeSupport.addPropertyChangeListener(listener); - } - - /** - * @param listener - * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) - */ - public void removePropertyChangeListener(PropertyChangeListener listener) - { - changeSupport.removePropertyChangeListener(listener); - } } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 2210148..3475fe3 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -20,12 +20,8 @@ */ package jalview.gui; -import jalview.analysis.AlignmentSorter; import jalview.bin.Cache; -import jalview.commands.OrderCommand; -import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; import jalview.gui.Help.HelpId; import jalview.io.JalviewFileChooser; @@ -56,10 +52,10 @@ import java.io.FileOutputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.Vector; import javax.help.HelpSetException; @@ -107,6 +103,8 @@ public class FeatureSettings extends JPanel Object[][] originalData; + private float originalTransparency; + final JInternalFrame frame; JScrollPane scrollPane = new JScrollPane(); @@ -123,8 +121,8 @@ public class FeatureSettings extends JPanel { this.af = af; fr = af.getFeatureRenderer(); - - transparency.setMaximum(100 - (int) (fr.transparency * 100)); + // allow transparency to be recovered + transparency.setMaximum(100 - (int) ((originalTransparency=fr.getTransparency()) * 100)); try { @@ -165,8 +163,8 @@ public class FeatureSettings extends JPanel if (SwingUtilities.isRightMouseButton(evt)) { popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0), - table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(), - evt.getY()); + table.getValueAt(selectedRow, 1), fr.getMinMax(), + evt.getX(), evt.getY()); } else if (evt.getClickCount() == 2) { @@ -185,7 +183,8 @@ public class FeatureSettings extends JPanel if (evt.isPopupTrigger()) { popupSort(selectedRow, (String) table.getValueAt(selectedRow, 0), - table.getValueAt(selectedRow, 1), fr.minmax, evt.getX(), + table.getValueAt(selectedRow, 1), fr.getMinMax(), + evt.getX(), evt.getY()); } } @@ -222,8 +221,7 @@ public class FeatureSettings extends JPanel dassourceBrowser = new DasSourceBrowser(this); dasSettingsPane.add(dassourceBrowser, BorderLayout.CENTER); - if (af.getViewport().featuresDisplayed == null - || fr.renderOrder == null) + if (af.getViewport().isShowSequenceFeatures() || !fr.hasRenderOrder()) { fr.findAllFeatures(true); // display everything! } @@ -288,7 +286,7 @@ public class FeatureSettings extends JPanel public void actionPerformed(ActionEvent e) { - me.sortByScore(new String[] + me.af.avc.sortAlignmentByFeatureScore(new String[] { type }); } @@ -300,7 +298,7 @@ public class FeatureSettings extends JPanel public void actionPerformed(ActionEvent e) { - me.sortByDens(new String[] + me.af.avc.sortAlignmentByFeatureDensity(new String[] { type }); } @@ -424,10 +422,6 @@ public class FeatureSettings extends JPanel synchronized public void setTableData() { - if (fr.featureGroups == null) - { - fr.featureGroups = new Hashtable(); - } Vector allFeatures = new Vector(); Vector allGroups = new Vector(); SequenceFeature[] tmpfeatures; @@ -458,10 +452,7 @@ public class FeatureSettings extends JPanel if (!allGroups.contains(group)) { allGroups.addElement(group); - if (group != null) - { - checkGroupState(group); - } + checkGroupState(group); } } @@ -479,21 +470,14 @@ public class FeatureSettings extends JPanel } /** + * Synchronise gui group list and check visibility of group * * @param group - * @return true if group has been seen before and is already added to set. + * @return true if group is visible */ private boolean checkGroupState(String group) { - boolean visible; - if (fr.featureGroups.containsKey(group)) - { - visible = ((Boolean) fr.featureGroups.get(group)).booleanValue(); - } - else - { - visible = true; // new group is always made visible - } + boolean visible = fr.checkGroupVisibility(group, true); if (groupPanel == null) { @@ -514,10 +498,8 @@ public class FeatureSettings extends JPanel if (alreadyAdded) { - return true; + return visible; } - - fr.featureGroups.put(group, new Boolean(visible)); final String grp = group; final JCheckBox check = new JCheckBox(group, visible); check.setFont(new Font("Serif", Font.BOLD, 12)); @@ -525,9 +507,8 @@ public class FeatureSettings extends JPanel { public void itemStateChanged(ItemEvent evt) { - fr.featureGroups.put(check.getText(), - new Boolean(check.isSelected())); - af.alignPanel.seqPanel.seqCanvas.repaint(); + fr.setGroupVisibility(check.getText(), check.isSelected()); + af.alignPanel.getSeqPanel().seqCanvas.repaint(); if (af.alignPanel.overviewPanel != null) { af.alignPanel.overviewPanel.updateOverviewImage(); @@ -538,7 +519,7 @@ public class FeatureSettings extends JPanel } }); groupPanel.add(check); - return false; + return visible; } boolean resettingTable = false; @@ -582,13 +563,8 @@ public class FeatureSettings extends JPanel continue; } - if (group == null || fr.featureGroups.get(group) == null - || ((Boolean) fr.featureGroups.get(group)).booleanValue()) + if (group == null || checkGroupState(group)) { - if (group != null) - { - checkGroupState(group); - } type = tmpfeatures[index].getType(); if (!visibleChecks.contains(type)) { @@ -623,19 +599,20 @@ public class FeatureSettings extends JPanel Object[][] data = new Object[fSize][3]; int dataIndex = 0; - if (fr.renderOrder != null) + if (fr.hasRenderOrder()) { if (!handlingUpdate) - { + { fr.findAllFeatures(groupChanged != null); // prod to update + // colourschemes. but don't + // affect display + // First add the checks in the previous render order, + // in case the window has been closed and reopened } - // colourschemes. but don't - // affect display - // First add the checks in the previous render order, - // in case the window has been closed and reopened - for (int ro = fr.renderOrder.length - 1; ro > -1; ro--) + List frl = fr.getRenderOrder(); + for (int ro = frl.size() - 1; ro > -1; ro--) { - type = fr.renderOrder[ro]; + type = frl.get(ro); if (!visibleChecks.contains(type)) { @@ -644,8 +621,8 @@ public class FeatureSettings extends JPanel data[dataIndex][0] = type; data[dataIndex][1] = fr.getFeatureStyle(type); - data[dataIndex][2] = new Boolean( - af.getViewport().featuresDisplayed.containsKey(type)); + data[dataIndex][2] = new Boolean(af.getViewport() + .getFeaturesDisplayed().isVisible(type)); dataIndex++; visibleChecks.removeElement(type); } @@ -663,7 +640,7 @@ public class FeatureSettings extends JPanel if (data[dataIndex][1] == null) { // "Colour has been updated in another view!!" - fr.renderOrder = null; + fr.clearRenderOrder(); return; } @@ -685,8 +662,8 @@ public class FeatureSettings extends JPanel if (groupPanel != null) { - groupPanel.setLayout(new GridLayout(fr.featureGroups.size() / 4 + 1, - 4)); + groupPanel.setLayout(new GridLayout( + fr.getFeatureGroupsSize() / 4 + 1, 4)); groupPanel.validate(); bigPanel.add(groupPanel, BorderLayout.NORTH); @@ -843,9 +820,10 @@ public class FeatureSettings extends JPanel PrintWriter out = new PrintWriter(new OutputStreamWriter( new FileOutputStream(choice), "UTF-8")); - Iterator e = fr.featureColours.keySet().iterator(); - float[] sortOrder = new float[fr.featureColours.size()]; - String[] sortTypes = new String[fr.featureColours.size()]; + Set fr_colours = fr.getAllFeatureColours(); + Iterator e = fr_colours.iterator(); + float[] sortOrder = new float[fr_colours.size()]; + String[] sortTypes = new String[fr_colours.size()]; int i = 0; while (e.hasNext()) { @@ -1068,7 +1046,7 @@ public class FeatureSettings extends JPanel { public void actionPerformed(ActionEvent e) { - sortByScore(null); + af.avc.sortAlignmentByFeatureScore(null); } }); sortByDens.setFont(JvSwingUtils.getLabelFont()); @@ -1078,7 +1056,22 @@ public class FeatureSettings extends JPanel { public void actionPerformed(ActionEvent e) { - sortByDens(null); + af.avc.sortAlignmentByFeatureDensity(null); + } + }); + help.setFont(JvSwingUtils.getLabelFont()); + help.setText(MessageManager.getString("action.help")); + help.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + try + { + Help.showHelpWindow(HelpId.SequenceFeatureSettings); + } catch (HelpSetException e1) + { + e1.printStackTrace(); + } } }); help.setFont(JvSwingUtils.getLabelFont()); @@ -1102,6 +1095,7 @@ public class FeatureSettings extends JPanel { public void actionPerformed(ActionEvent e) { + fr.setTransparency(originalTransparency); updateFeatureRenderer(originalData); close(); } @@ -1198,131 +1192,6 @@ public class FeatureSettings extends JPanel settingsPane.add(buttonPanel, java.awt.BorderLayout.SOUTH); } - protected void sortByDens(String[] typ) - { - sortBy(typ, "Sort by Density", AlignmentSorter.FEATURE_DENSITY); - } - - protected void sortBy(String[] typ, String methodText, final String method) - { - if (typ == null) - { - typ = getDisplayedFeatureTypes(); - } - String gps[] = null; - gps = getDisplayedFeatureGroups(); - if (typ != null) - { - ArrayList types = new ArrayList(); - for (int i = 0; i < typ.length; i++) - { - if (typ[i] != null) - { - types.add(typ[i]); - } - typ = new String[types.size()]; - types.toArray(typ); - } - } - if (gps != null) - { - ArrayList grps = new ArrayList(); - - for (int i = 0; i < gps.length; i++) - { - if (gps[i] != null) - { - grps.add(gps[i]); - } - } - gps = new String[grps.size()]; - grps.toArray(gps); - } - AlignmentPanel alignPanel = af.alignPanel; - AlignmentI al = alignPanel.av.getAlignment(); - - int start, stop; - SequenceGroup sg = alignPanel.av.getSelectionGroup(); - if (sg != null) - { - start = sg.getStartRes(); - stop = sg.getEndRes(); - } - else - { - start = 0; - stop = al.getWidth(); - } - SequenceI[] oldOrder = al.getSequencesArray(); - AlignmentSorter.sortByFeature(typ, gps, start, stop, al, method); - af.addHistoryItem(new OrderCommand(methodText, oldOrder, alignPanel.av - .getAlignment())); - alignPanel.paintAlignment(true); - - } - - protected void sortByScore(String[] typ) - { - sortBy(typ, "Sort by Feature Score", AlignmentSorter.FEATURE_SCORE); - } - - private String[] getDisplayedFeatureTypes() - { - String[] typ = null; - if (fr != null) - { - synchronized (fr.renderOrder) - { - typ = new String[fr.renderOrder.length]; - System.arraycopy(fr.renderOrder, 0, typ, 0, typ.length); - for (int i = 0; i < typ.length; i++) - { - if (af.viewport.featuresDisplayed.get(typ[i]) == null) - { - typ[i] = null; - } - } - } - } - return typ; - } - - private String[] getDisplayedFeatureGroups() - { - String[] gps = null; - ArrayList _gps = new ArrayList(); - if (fr != null) - { - - if (fr.featureGroups != null) - { - Iterator en = fr.featureGroups.keySet().iterator(); - int g = 0; - boolean valid = false; - while (en.hasNext()) - { - String gp = (String) en.next(); - Boolean on = (Boolean) fr.featureGroups.get(gp); - if (on != null && on.booleanValue()) - { - valid = true; - _gps.add(gp); - } - } - if (!valid) - { - return null; - } - else - { - gps = new String[_gps.size()]; - _gps.toArray(gps); - } - } - } - return gps; - } - public void fetchDAS_actionPerformed(ActionEvent e) { fetchDAS.setEnabled(false); diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index dbacd8b..6f3e7b8 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -182,7 +182,7 @@ public class Finder extends GFinder searchResults.getResultEnd(i), "Search Results"); } - if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs, + if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, true, ap)) { ap.alignFrame.showSeqFeatures.setSelected(true); @@ -231,11 +231,11 @@ public class Finder extends GFinder if ((idMatch.size() > 0)) { haveResults = true; - ap.idPanel.highlightSearchResults(idMatch); + ap.getIdPanel().highlightSearchResults(idMatch); } else { - ap.idPanel.highlightSearchResults(null); + ap.getIdPanel().highlightSearchResults(null); } if (searchResults.getSize() > 0) diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index b6116d9..36e4c52 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -129,7 +129,7 @@ public class FontChooser extends GFontChooser public void smoothFont_actionPerformed(ActionEvent e) { ap.av.antiAlias = smoothFont.isSelected(); - ap.annotationPanel.image = null; + ap.getAnnotationPanel().image = null; ap.paintAlignment(true); } diff --git a/src/jalview/gui/HTMLOptions.java b/src/jalview/gui/HTMLOptions.java new file mode 100644 index 0000000..0ef4710 --- /dev/null +++ b/src/jalview/gui/HTMLOptions.java @@ -0,0 +1,143 @@ +package jalview.gui; + +import jalview.util.MessageManager; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.BorderFactory; +import javax.swing.ButtonGroup; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; + +public class HTMLOptions extends JPanel +{ + JDialog dialog; + + public boolean cancelled = false; + + String value; + + public HTMLOptions() + { + try + { + jbInit(); + } catch (Exception ex) + { + ex.printStackTrace(); + } + + ButtonGroup bg = new ButtonGroup(); + bg.add(lineart); + bg.add(text); + + JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION, + JOptionPane.DEFAULT_OPTION, null, new Object[] + { this }); + + dialog = pane.createDialog(Desktop.desktop, "HTML Rendering options"); + dialog.setVisible(true); + + } + + private void jbInit() throws Exception + { + lineart.setFont(JvSwingUtils.getLabelFont()); + lineart.setText(MessageManager.getString("label.lineart")); + text.setFont(JvSwingUtils.getLabelFont()); + text.setText(MessageManager.getString("action.text")); + text.setSelected(true); + askAgain.setFont(JvSwingUtils.getLabelFont()); + askAgain.setText(MessageManager.getString("label.dont_ask_me_again")); + ok.setText(MessageManager.getString("action.ok")); + ok.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(e); + } + }); + cancel.setText(MessageManager.getString("action.cancel")); + cancel.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + cancel_actionPerformed(e); + } + }); + jLabel1.setFont(JvSwingUtils.getLabelFont()); + jLabel1.setText("Select HTML character rendering style"); + this.setLayout(borderLayout1); + jPanel3.setBorder(BorderFactory.createEtchedBorder()); + jPanel2.add(text); + jPanel2.add(lineart); + jPanel2.add(askAgain); + jPanel1.add(ok); + jPanel1.add(cancel); + jPanel3.add(jLabel1); + jPanel3.add(jPanel2); + this.add(jPanel3, java.awt.BorderLayout.CENTER); + this.add(jPanel1, java.awt.BorderLayout.SOUTH); + } + + JRadioButton lineart = new JRadioButton(); + + JRadioButton text = new JRadioButton(); + + JCheckBox askAgain = new JCheckBox(); + + JButton ok = new JButton(); + + JButton cancel = new JButton(); + + JPanel jPanel1 = new JPanel(); + + JLabel jLabel1 = new JLabel(); + + JPanel jPanel2 = new JPanel(); + + JPanel jPanel3 = new JPanel(); + + BorderLayout borderLayout1 = new BorderLayout(); + + public void ok_actionPerformed(ActionEvent e) + { + if (lineart.isSelected()) + { + value = "Lineart"; + } + else + { + value = "Text"; + } + + if (!askAgain.isSelected()) + { + jalview.bin.Cache.applicationProperties.remove("HTML_RENDERING"); + } + else + { + jalview.bin.Cache.setProperty("HTML_RENDERING", value); + } + + dialog.setVisible(false); + } + + public void cancel_actionPerformed(ActionEvent e) + { + cancelled = true; + dialog.setVisible(false); + } + + public String getValue() + { + return value; + } +} diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 91b23e4..3bc3168 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -60,7 +60,7 @@ public class IdCanvas extends JPanel AnnotationPanel ap; - Font idfont; + private Font idfont; /** * Creates a new IdCanvas object. @@ -119,7 +119,7 @@ public class IdCanvas extends JPanel gg.setColor(Color.black); } - if (av.rightAlignIds) + if (av.isRightAlignIds()) { xPos = panelWidth - fm.stringWidth(s.getDisplayId(av.getShowJVSuffix())) - 4; @@ -247,15 +247,15 @@ public class IdCanvas extends JPanel { if (av.seqNameItalics) { - idfont = new Font(av.getFont().getName(), Font.ITALIC, av.getFont() - .getSize()); + setIdfont(new Font(av.getFont().getName(), Font.ITALIC, av.getFont() + .getSize())); } else { - idfont = av.getFont(); + setIdfont(av.getFont()); } - gg.setFont(idfont); + gg.setFont(getIdfont()); fm = gg.getFontMetrics(); if (av.antiAlias) @@ -279,7 +279,7 @@ public class IdCanvas extends JPanel int annotationHeight = 0; - if (av.showAnnotation) + if (av.isShowAnnotation()) { if (ap == null) { @@ -310,19 +310,19 @@ public class IdCanvas extends JPanel for (int i = starty; i < alheight; i++) { SequenceI s = av.getAlignment().getSequenceAt(i); - if (av.hasHiddenRows()) + if (av.isDisplayReferenceSeq() || av.hasHiddenRows()) { setHiddenFont(s); } else { - gg.setFont(idfont); + gg.setFont(getIdfont()); } drawIdString(gg, s, i, 0, ypos); } - if (labels != null && av.showAnnotation) + if (labels != null && av.isShowAnnotation()) { gg.translate(0, ypos + (alheight * av.charHeight)); labels.drawComponent(gg, getWidth()); @@ -350,7 +350,7 @@ public class IdCanvas extends JPanel continue; } - if (av.hasHiddenRows()) + if (av.isDisplayReferenceSeq() || av.hasHiddenRows()) { setHiddenFont(sequence); } @@ -383,7 +383,7 @@ public class IdCanvas extends JPanel String string = sequence.getDisplayId(av.getShowJVSuffix()); - if (av.rightAlignIds) + if (av.isRightAlignIds()) { xPos = panelWidth - fm.stringWidth(string) - 4; } @@ -474,7 +474,7 @@ public class IdCanvas extends JPanel } else { - gg.setFont(idfont); + gg.setFont(getIdfont()); } } @@ -489,4 +489,14 @@ public class IdCanvas extends JPanel searchResults = list; repaint(); } + + public Font getIdfont() + { + return idfont; + } + + public void setIdfont(Font idfont) + { + this.idfont = idfont; + } } diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 6b1109a..a22e918 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -52,7 +52,7 @@ import javax.swing.ToolTipManager; public class IdPanel extends JPanel implements MouseListener, MouseMotionListener, MouseWheelListener { - protected IdCanvas idCanvas; + private IdCanvas idCanvas; protected AlignViewport av; @@ -81,11 +81,11 @@ public class IdPanel extends JPanel implements MouseListener, { this.av = av; alignPanel = parent; - idCanvas = new IdCanvas(av); + setIdCanvas(new IdCanvas(av)); linkImageURL = getClass().getResource("/images/link.gif").toString(); seqAnnotReport = new SequenceAnnotationReport(linkImageURL); setLayout(new BorderLayout()); - add(idCanvas, BorderLayout.CENTER); + add(getIdCanvas(), BorderLayout.CENTER); addMouseListener(this); addMouseMotionListener(this); addMouseWheelListener(this); @@ -102,7 +102,7 @@ public class IdPanel extends JPanel implements MouseListener, @Override public void mouseMoved(MouseEvent e) { - SeqPanel sp = alignPanel.seqPanel; + SeqPanel sp = alignPanel.getSeqPanel(); int seq = Math.max(0, sp.findSeq(e)); if (seq > -1 && seq < av.getAlignment().getHeight()) { @@ -111,7 +111,7 @@ public class IdPanel extends JPanel implements MouseListener, seqAnnotReport .createSequenceAnnotationReport(tip, sequence, av.isShowDbRefs(), av.isShowNpFeats(), - sp.seqCanvas.fr.minmax); + sp.seqCanvas.fr.getMinMax()); setToolTipText("" + sequence.getDisplayId(true) + " " + tip.toString() + ""); } @@ -128,7 +128,7 @@ public class IdPanel extends JPanel implements MouseListener, { mouseDragging = true; - int seq = Math.max(0, alignPanel.seqPanel.findSeq(e)); + int seq = Math.max(0, alignPanel.getSeqPanel().findSeq(e)); if (seq < lastid) { @@ -202,7 +202,7 @@ public class IdPanel extends JPanel implements MouseListener, return; } - int seq = alignPanel.seqPanel.findSeq(e); + int seq = alignPanel.getSeqPanel().findSeq(e); String url = null; int i = 0; String id = av.getAlignment().getSequenceAt(seq).getName(); @@ -315,7 +315,7 @@ public class IdPanel extends JPanel implements MouseListener, return; } - int seq = alignPanel.seqPanel.findSeq(e); + int seq = alignPanel.getSeqPanel().findSeq(e); if (SwingUtilities.isRightMouseButton(e)) { @@ -443,7 +443,7 @@ public class IdPanel extends JPanel implements MouseListener, */ public void highlightSearchResults(List list) { - idCanvas.setHighlighted(list); + getIdCanvas().setHighlighted(list); if (list == null) { @@ -459,6 +459,16 @@ public class IdPanel extends JPanel implements MouseListener, } } + public IdCanvas getIdCanvas() + { + return idCanvas; + } + + public void setIdCanvas(IdCanvas idCanvas) + { + this.idCanvas = idCanvas; + } + // this class allows scrolling off the bottom of the visible alignment class ScrollThread extends Thread { diff --git a/src/jalview/gui/IdwidthAdjuster.java b/src/jalview/gui/IdwidthAdjuster.java index 0c53c58..6c9c400 100755 --- a/src/jalview/gui/IdwidthAdjuster.java +++ b/src/jalview/gui/IdwidthAdjuster.java @@ -119,12 +119,12 @@ public class IdwidthAdjuster extends JPanel implements MouseListener, { active = true; - Dimension d = ap.idPanel.idCanvas.getPreferredSize(); + Dimension d = ap.getIdPanel().getIdCanvas().getPreferredSize(); int dif = evt.getX() - oldX; if (((d.width + dif) > 20) || (dif > 0)) { - ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif, + ap.getIdPanel().getIdCanvas().setPreferredSize(new Dimension(d.width + dif, d.height)); ap.paintAlignment(true); } diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index cccf34d..a2cd147 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -25,7 +25,10 @@ import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; +import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.datamodel.StructureViewerModel; +import jalview.datamodel.StructureViewerModel.StructureData; import jalview.schemabinding.version2.AlcodMap; import jalview.schemabinding.version2.Alcodon; import jalview.schemabinding.version2.AlcodonFrame; @@ -64,11 +67,15 @@ import jalview.schemes.ColourSchemeProperty; import jalview.schemes.GraduatedColor; import jalview.schemes.ResidueColourScheme; import jalview.schemes.ResidueProperties; +import jalview.schemes.UserColourScheme; import jalview.structure.StructureSelectionManager; +import jalview.structures.models.AAStructureBindingModel; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.jarInputStreamProvider; import jalview.viewmodel.AlignmentViewport; +import jalview.viewmodel.seqfeatures.FeatureRendererSettings; +import jalview.viewmodel.seqfeatures.FeaturesDisplayed; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.jabaws2.Jws2Instance; @@ -92,11 +99,14 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.IdentityHashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.StringTokenizer; @@ -123,6 +133,23 @@ import org.exolab.castor.xml.Unmarshaller; */ public class Jalview2XML { + /* + * SequenceI reference -> XML ID string in jalview XML. Populated as XML reps + * of sequence objects are created. + */ + IdentityHashMap seqsToIds = null; + + /** + * jalview XML Sequence ID to jalview sequence object reference (both dataset + * and alignment sequences. Populated as XML reps of sequence objects are + * created.) + */ + Map seqRefIds = null; + + Vector frefedSequence = null; + + boolean raiseGUI = true; // whether errors are raised in dialog boxes or not + /** * create/return unique hash string for sq * @@ -137,7 +164,7 @@ public class Jalview2XML } if (seqsToIds.containsKey(sq)) { - return (String) seqsToIds.get(sq); + return seqsToIds.get(sq); } else { @@ -178,31 +205,14 @@ public class Jalview2XML { if (seqsToIds == null) { - seqsToIds = new IdentityHashMap(); + seqsToIds = new IdentityHashMap(); } if (seqRefIds == null) { - seqRefIds = new Hashtable(); + seqRefIds = new HashMap(); } } - /** - * SequenceI reference -> XML ID string in jalview XML. Populated as XML reps - * of sequence objects are created. - */ - java.util.IdentityHashMap seqsToIds = null; - - /** - * jalview XML Sequence ID to jalview sequence object reference (both dataset - * and alignment sequences. Populated as XML reps of sequence objects are - * created.) - */ - java.util.Hashtable seqRefIds = null; // key->SequenceI resolution - - Vector frefedSequence = null; - - boolean raiseGUI = true; // whether errors are raised in dialog boxes or not - public Jalview2XML() { } @@ -227,7 +237,7 @@ public class Jalview2XML { if (ref[1] instanceof jalview.datamodel.Mapping) { - SequenceI seq = (SequenceI) seqRefIds.get(sref); + SequenceI seq = seqRefIds.get(sref); while (seq.getDatasetSequence() != null) { seq = seq.getDatasetSequence(); @@ -238,7 +248,7 @@ public class Jalview2XML { if (ref[1] instanceof jalview.datamodel.AlignedCodonFrame) { - SequenceI seq = (SequenceI) seqRefIds.get(sref); + SequenceI seq = seqRefIds.get(sref); while (seq.getDatasetSequence() != null) { seq = seq.getDatasetSequence(); @@ -300,16 +310,17 @@ public class Jalview2XML /** * List of pdbfiles added to Jar */ - Vector pdbfiles = null; + List pdbfiles = null; // SAVES SEVERAL ALIGNMENT WINDOWS TO SAME JARFILE - public void SaveState(File statefile) + public void saveState(File statefile) { + FileOutputStream fos = null; try { - FileOutputStream fos = new FileOutputStream(statefile); + fos = new FileOutputStream(statefile); JarOutputStream jout = new JarOutputStream(fos); - SaveState(jout); + saveState(jout); } catch (Exception e) { @@ -325,6 +336,18 @@ public class Jalview2XML errorMessage += "(output file was '" + statefile + "')"; } e.printStackTrace(); + } finally + { + if (fos != null) + { + try + { + fos.close(); + } catch (IOException e) + { + // ignore + } + } } reportErrors(); } @@ -334,7 +357,7 @@ public class Jalview2XML * * @param jout */ - public void SaveState(JarOutputStream jout) + public void saveState(JarOutputStream jout) { JInternalFrame[] frames = Desktop.desktop.getAllFrames(); @@ -350,8 +373,6 @@ public class Jalview2XML // NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS // ////////////////////////////////////////////////// - // NOTE ALSO new PrintWriter must be used for each new JarEntry - PrintWriter out = null; Vector shortNames = new Vector(); @@ -410,7 +431,7 @@ public class Jalview2XML fileName = fileName + ".xml"; } - SaveState(apanel, fileName, jout); + saveState(apanel, fileName, jout); String dssid = getDatasetIdRef(af.getViewport().getAlignment() .getDataset()); @@ -447,7 +468,7 @@ public class Jalview2XML } // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW - public boolean SaveAlignment(AlignFrame af, String jarFile, + public boolean saveAlignment(AlignFrame af, String jarFile, String fileName) { try @@ -465,7 +486,7 @@ public class Jalview2XML { jfileName = jfileName + ".xml"; } - SaveState(apanel, jfileName, jout); + saveState(apanel, jfileName, jout); String dssid = getDatasetIdRef(af.getViewport().getAlignment() .getDataset()); if (!dsses.containsKey(dssid)) @@ -503,12 +524,12 @@ public class Jalview2XML { jfileName = jfileName + ".xml"; } - SaveState(_af.alignPanel, jfileName, true, jout); + saveState(_af.alignPanel, jfileName, true, jout); } } /** - * create a JalviewModel from an algnment view and marshall it to a + * create a JalviewModel from an alignment view and marshall it to a * JarOutputStream * * @param ap @@ -520,14 +541,14 @@ public class Jalview2XML * @param out * jar entry name */ - public JalviewModel SaveState(AlignmentPanel ap, String fileName, + public JalviewModel saveState(AlignmentPanel ap, String fileName, JarOutputStream jout) { - return SaveState(ap, fileName, false, jout); + return saveState(ap, fileName, false, jout); } /** - * create a JalviewModel from an algnment view and marshall it to a + * create a JalviewModel from an alignment view and marshall it to a * JarOutputStream * * @param ap @@ -542,12 +563,12 @@ public class Jalview2XML * @param out * jar entry name */ - public JalviewModel SaveState(AlignmentPanel ap, String fileName, + public JalviewModel saveState(AlignmentPanel ap, String fileName, boolean storeDS, JarOutputStream jout) { initSeqRefs(); - Vector jmolViewIds = new Vector(); // - Vector userColours = new Vector(); + List viewIds = new ArrayList(); + List userColours = new ArrayList(); AlignViewport av = ap.av; @@ -716,81 +737,22 @@ public class Jalview2XML pdb.setId(entry.getId()); pdb.setType(entry.getType()); - // - // store any JMol views associated with this seqeunce - // this section copes with duplicate entries in the project, so a - // dataset only view *should* be coped with sensibly - AppJmol jmol; + + /* + * Store any structure views associated with this sequence. This + * section copes with duplicate entries in the project, so a dataset + * only view *should* be coped with sensibly. + */ // This must have been loaded, is it still visible? JInternalFrame[] frames = Desktop.desktop.getAllFrames(); String matchedFile = null; for (int f = frames.length - 1; f > -1; f--) { - if (frames[f] instanceof AppJmol) + if (frames[f] instanceof StructureViewerBase) { - jmol = (AppJmol) frames[f]; - for (int peid = 0; peid < jmol.jmb.pdbentry.length; peid++) - { - if (!jmol.jmb.pdbentry[peid].getId().equals(entry.getId()) - && !(entry.getId().length() > 4 && entry - .getId() - .toLowerCase() - .startsWith( - jmol.jmb.pdbentry[peid].getId() - .toLowerCase()))) - { - continue; - } - if (matchedFile == null) - { - matchedFile = jmol.jmb.pdbentry[peid].getFile(); - } - else if (!matchedFile.equals(jmol.jmb.pdbentry[peid] - .getFile())) - { - Cache.log - .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): " - + jmol.jmb.pdbentry[peid].getFile()); - ; // record the - } - // file so we - // can get at it if the ID - // match is ambiguous (e.g. - // 1QIP==1qipA) - String statestring = jmol.jmb.viewer.getStateInfo(); - - for (int smap = 0; smap < jmol.jmb.sequence[peid].length; smap++) - { - // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1) - if (jds == jmol.jmb.sequence[peid][smap]) - { - StructureState state = new StructureState(); - state.setVisible(true); - state.setXpos(jmol.getX()); - state.setYpos(jmol.getY()); - state.setWidth(jmol.getWidth()); - state.setHeight(jmol.getHeight()); - state.setViewId(jmol.getViewId()); - state.setAlignwithAlignPanel(jmol.isUsedforaligment(ap)); - state.setColourwithAlignPanel(jmol - .isUsedforcolourby(ap)); - state.setColourByJmol(jmol.isColouredByJmol()); - if (!jmolViewIds.contains(state.getViewId())) - { - // Make sure we only store a Jmol state once in each XML - // document. - jmolViewIds.addElement(state.getViewId()); - state.setContent(statestring.replaceAll("\n", "")); - } - else - { - state.setContent("# duplicate state"); - } - pdb.addStructureState(state); - } - - } - } + StructureViewerBase viewFrame = (StructureViewerBase) frames[f]; + matchedFile = saveStructureState(ap, jds, pdb, entry, + viewIds, matchedFile, viewFrame); } } @@ -804,12 +766,13 @@ public class Jalview2XML pdb.setFile(matchedFile); // entry.getFile()); if (pdbfiles == null) { - pdbfiles = new Vector(); + pdbfiles = new ArrayList(); } if (!pdbfiles.contains(entry.getId())) { - pdbfiles.addElement(entry.getId()); + pdbfiles.add(entry.getId()); + DataInputStream dis = null; try { File file = new File(matchedFile); @@ -817,7 +780,7 @@ public class Jalview2XML { byte[] data = new byte[(int) file.length()]; jout.putNextEntry(new JarEntry(entry.getId())); - DataInputStream dis = new DataInputStream( + dis = new DataInputStream( new FileInputStream(file)); dis.readFully(data); @@ -829,6 +792,18 @@ public class Jalview2XML } catch (Exception ex) { ex.printStackTrace(); + } finally + { + if (dis != null) + { + try + { + dis.close(); + } catch (IOException e) + { + // ignore + } + } } } @@ -997,7 +972,7 @@ public class Jalview2XML if (sg.cs instanceof jalview.schemes.UserColourScheme) { - groups[i].setColour(SetUserColourScheme(sg.cs, userColours, + groups[i].setColour(setUserColourScheme(sg.cs, userColours, jms)); } else @@ -1016,7 +991,7 @@ public class Jalview2XML else if (sg.cs instanceof jalview.schemes.UserColourScheme) { groups[i] - .setColour(SetUserColourScheme(sg.cs, userColours, jms)); + .setColour(setUserColourScheme(sg.cs, userColours, jms)); } else { @@ -1079,7 +1054,7 @@ public class Jalview2XML if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) { - view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(), + view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(), userColours, jms)); } else if (av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient) @@ -1107,7 +1082,7 @@ public class Jalview2XML view.setConsThreshold(cs.getConservationInc()); if (cs instanceof jalview.schemes.UserColourScheme) { - view.setBgColour(SetUserColourScheme(cs, userColours, jms)); + view.setBgColour(setUserColourScheme(cs, userColours, jms)); } } @@ -1123,12 +1098,12 @@ public class Jalview2XML view.setFontSize(av.font.getSize()); view.setFontStyle(av.font.getStyle()); view.setRenderGaps(av.renderGaps); - view.setShowAnnotation(av.getShowAnnotation()); + view.setShowAnnotation(av.isShowAnnotation()); view.setShowBoxes(av.getShowBoxes()); view.setShowColourText(av.getColourText()); view.setShowFullId(av.getShowJVSuffix()); - view.setRightAlignIds(av.rightAlignIds); - view.setShowSequenceFeatures(av.showSequenceFeatures); + view.setRightAlignIds(av.isRightAlignIds()); + view.setShowSequenceFeatures(av.isShowSequenceFeatures()); view.setShowText(av.getShowText()); view.setShowUnconserved(av.getShowUnconserved()); view.setWrapAlignment(av.getWrapAlignment()); @@ -1145,11 +1120,12 @@ public class Jalview2XML view.setFollowHighlight(av.followHighlight); view.setFollowSelection(av.followSelection); view.setIgnoreGapsinConsensus(av.getIgnoreGapsConsensus()); - if (av.featuresDisplayed != null) + if (av.getFeaturesDisplayed() != null) { jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings(); - String[] renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder; + String[] renderOrder = ap.getSeqPanel().seqCanvas.getFeatureRenderer() + .getRenderOrder().toArray(new String[0]); Vector settingsAdded = new Vector(); Object gstyle = null; @@ -1158,7 +1134,7 @@ public class Jalview2XML { for (int ro = 0; ro < renderOrder.length; ro++) { - gstyle = ap.seqPanel.seqCanvas.getFeatureRenderer() + gstyle = ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getFeatureStyle(renderOrder[ro]); Setting setting = new Setting(); setting.setType(renderOrder[ro]); @@ -1176,13 +1152,13 @@ public class Jalview2XML } else { - setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer() + setting.setColour(ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getColour(renderOrder[ro]).getRGB()); } - setting.setDisplay(av.featuresDisplayed - .containsKey(renderOrder[ro])); - float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer() + setting.setDisplay(av.getFeaturesDisplayed().isVisible( + renderOrder[ro])); + float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getOrder(renderOrder[ro]); if (rorder > -1) { @@ -1194,8 +1170,8 @@ public class Jalview2XML } // Make sure we save none displayed feature settings - Iterator en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours - .keySet().iterator(); + Iterator en = ap.getSeqPanel().seqCanvas.getFeatureRenderer() + .getFeatureColours().keySet().iterator(); while (en.hasNext()) { String key = en.next().toString(); @@ -1206,11 +1182,11 @@ public class Jalview2XML Setting setting = new Setting(); setting.setType(key); - setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer() + setting.setColour(ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getColour(key).getRGB()); setting.setDisplay(false); - float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer() + float rorder = ap.getSeqPanel().seqCanvas.getFeatureRenderer() .getOrder(key); if (rorder > -1) { @@ -1219,8 +1195,9 @@ public class Jalview2XML fs.addSetting(setting); settingsAdded.addElement(key); } - en = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups - .keySet().iterator(); + // is groups actually supposed to be a map here ? + en = ap.getSeqPanel().seqCanvas.getFeatureRenderer().getFeatureGroups() + .iterator(); Vector groupsAdded = new Vector(); while (en.hasNext()) { @@ -1231,8 +1208,8 @@ public class Jalview2XML } Group g = new Group(); g.setName(grp); - g.setDisplay(((Boolean) ap.seqPanel.seqCanvas - .getFeatureRenderer().featureGroups.get(grp)) + g.setDisplay(((Boolean) ap.getSeqPanel().seqCanvas + .getFeatureRenderer().checkGroupVisibility(grp, false)) .booleanValue()); fs.addGroup(g); groupsAdded.addElement(grp); @@ -1253,8 +1230,8 @@ public class Jalview2XML for (int c = 0; c < av.getColumnSelection().getHiddenColumns() .size(); c++) { - int[] region = (int[]) av.getColumnSelection() - .getHiddenColumns().elementAt(c); + int[] region = av.getColumnSelection() + .getHiddenColumns().get(c); HiddenColumns hc = new HiddenColumns(); hc.setStart(region[0]); hc.setEnd(region[1]); @@ -1308,8 +1285,94 @@ public class Jalview2XML return object; } + /** + * Save the state of a structure viewer + * + * @param ap + * @param jds + * @param pdb + * the archive XML element under which to save the state + * @param entry + * @param viewIds + * @param matchedFile + * @param viewFrame + * @return + */ + protected String saveStructureState(AlignmentPanel ap, SequenceI jds, + Pdbids pdb, PDBEntry entry, List viewIds, + String matchedFile, StructureViewerBase viewFrame) + { + final AAStructureBindingModel bindingModel = viewFrame + .getBinding(); + for (int peid = 0; peid < bindingModel + .getPdbCount(); peid++) + { + final PDBEntry pdbentry = bindingModel.getPdbEntry(peid); + final String pdbId = pdbentry.getId(); + if (!pdbId.equals(entry.getId()) + && !(entry.getId().length() > 4 && entry.getId() + .toLowerCase() + .startsWith(pdbId.toLowerCase()))) + { + continue; + } + if (matchedFile == null) + { + matchedFile = pdbentry.getFile(); + } + else if (!matchedFile.equals(pdbentry + .getFile())) + { + Cache.log + .warn("Probably lost some PDB-Sequence mappings for this structure file (which apparently has same PDB Entry code): " + + pdbentry.getFile()); + } + // record the + // file so we + // can get at it if the ID + // match is ambiguous (e.g. + // 1QIP==1qipA) + String statestring = viewFrame.getStateInfo(); + + for (int smap = 0; smap < viewFrame.getBinding() + .getSequence()[peid].length; smap++) + { + // if (jal.findIndex(jmol.jmb.sequence[peid][smap]) > -1) + if (jds == viewFrame.getBinding().getSequence()[peid][smap]) + { + StructureState state = new StructureState(); + state.setVisible(true); + state.setXpos(viewFrame.getX()); + state.setYpos(viewFrame.getY()); + state.setWidth(viewFrame.getWidth()); + state.setHeight(viewFrame.getHeight()); + final String viewId = viewFrame.getViewId(); + state.setViewId(viewId); + state.setAlignwithAlignPanel(viewFrame.isUsedforaligment(ap)); + state.setColourwithAlignPanel(viewFrame + .isUsedforcolourby(ap)); + state.setColourByJmol(viewFrame.isColouredByViewer()); + /* + * Only store each structure viewer's state once in each XML document. + */ + if (!viewIds.contains(viewId)) + { + viewIds.add(viewId); + state.setContent(statestring.replaceAll("\n", "")); + } + else + { + state.setContent("# duplicate state"); + } + pdb.addStructureState(state); + } + } + } + return matchedFile; + } + private AnnotationColours constructAnnotationColours( - AnnotationColourGradient acg, Vector userColours, + AnnotationColourGradient acg, List userColours, JalviewModelSequence jms) { AnnotationColours ac = new AnnotationColours(); @@ -1318,7 +1381,7 @@ public class Jalview2XML ac.setAnnotation(acg.getAnnotation()); if (acg.getBaseColour() instanceof jalview.schemes.UserColourScheme) { - ac.setColourScheme(SetUserColourScheme(acg.getBaseColour(), + ac.setColourScheme(setUserColourScheme(acg.getBaseColour(), userColours, jms)); } else @@ -1429,6 +1492,7 @@ public class Jalview2XML an.addProperty(prop); } } + AnnotationElement ae; if (aa[i].annotations != null) { @@ -1762,8 +1826,8 @@ public class Jalview2XML return mp; } - String SetUserColourScheme(jalview.schemes.ColourSchemeI cs, - Vector userColours, JalviewModelSequence jms) + String setUserColourScheme(jalview.schemes.ColourSchemeI cs, + List userColours, JalviewModelSequence jms) { String id = null; jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs; @@ -1808,7 +1872,7 @@ public class Jalview2XML return id; } - jalview.schemes.UserColourScheme GetUserColourScheme( + jalview.schemes.UserColourScheme getUserColourScheme( JalviewModelSequence jms, String id) { UserColours[] uc = jms.getUserColours(); @@ -1866,7 +1930,7 @@ public class Jalview2XML * @param file * - HTTP URL or filename */ - public AlignFrame LoadJalviewAlign(final String file) + public AlignFrame loadJalviewAlign(final String file) { jalview.gui.AlignFrame af = null; @@ -1881,7 +1945,7 @@ public class Jalview2XML // so we can re-open the jar input stream for each entry. jarInputStreamProvider jprovider = createjarInputStreamProvider(file); - af = LoadJalviewAlign(jprovider); + af = loadJalviewAlign(jprovider); } catch (MalformedURLException e) { @@ -1954,7 +2018,7 @@ public class Jalview2XML * @param jprovider * @return */ - public AlignFrame LoadJalviewAlign(final jarInputStreamProvider jprovider) + public AlignFrame loadJalviewAlign(final jarInputStreamProvider jprovider) { errorMessage = null; if (uniqueSetSuffix == null) @@ -1963,7 +2027,7 @@ public class Jalview2XML } if (seqRefIds == null) { - seqRefIds = new Hashtable(); + seqRefIds = new HashMap(); } if (viewportsAdded == null) { @@ -2001,7 +2065,7 @@ public class Jalview2XML object = (JalviewModel) unmar.unmarshal(in); if (true) // !skipViewport(object)) { - _af = LoadFromObject(object, file, true, jprovider); + _af = loadFromObject(object, file, true, jprovider); if (object.getJalviewModelSequence().getViewportCount() > 0) { af = _af; @@ -2227,7 +2291,7 @@ public class Jalview2XML * data source provider * @return alignment frame created from view stored in DOM */ - AlignFrame LoadFromObject(JalviewModel object, String file, + AlignFrame loadFromObject(JalviewModel object, String file, boolean loadTreesAndStructures, jarInputStreamProvider jprovider) { SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0); @@ -2248,11 +2312,11 @@ public class Jalview2XML boolean multipleView = false; - JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq(); + JSeq[] jseqs = object.getJalviewModelSequence().getJSeq(); int vi = 0; // counter in vamsasSeq array - for (int i = 0; i < JSEQ.length; i++) + for (int i = 0; i < jseqs.length; i++) { - String seqId = JSEQ[i].getId(); + String seqId = jseqs[i].getId(); if (seqRefIds.get(seqId) != null) { @@ -2264,15 +2328,15 @@ public class Jalview2XML jseq = new jalview.datamodel.Sequence(vamsasSeq[vi].getName(), vamsasSeq[vi].getSequence()); jseq.setDescription(vamsasSeq[vi].getDescription()); - jseq.setStart(JSEQ[i].getStart()); - jseq.setEnd(JSEQ[i].getEnd()); + jseq.setStart(jseqs[i].getStart()); + jseq.setEnd(jseqs[i].getEnd()); jseq.setVamsasId(uniqueSetSuffix + seqId); seqRefIds.put(vamsasSeq[vi].getId(), jseq); tmpseqs.add(jseq); vi++; } - if (JSEQ[i].getHidden()) + if (jseqs[i].getHidden()) { if (hiddenSeqs == null) { @@ -2327,9 +2391,9 @@ public class Jalview2XML // structures for the alignment for (int i = 0; i < vamsasSeq.length; i++) { - if (JSEQ[i].getFeaturesCount() > 0) + if (jseqs[i].getFeaturesCount() > 0) { - Features[] features = JSEQ[i].getFeatures(); + Features[] features = jseqs[i].getFeatures(); for (int f = 0; f < features.length; f++) { jalview.datamodel.SequenceFeature sf = new jalview.datamodel.SequenceFeature( @@ -2359,9 +2423,9 @@ public class Jalview2XML { addDBRefs(al.getSequenceAt(i).getDatasetSequence(), vamsasSeq[i]); } - if (JSEQ[i].getPdbidsCount() > 0) + if (jseqs[i].getPdbidsCount() > 0) { - Pdbids[] ids = JSEQ[i].getPdbids(); + Pdbids[] ids = jseqs[i].getPdbids(); for (int p = 0; p < ids.length; p++) { jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry(); @@ -2424,7 +2488,7 @@ public class Jalview2XML AlcodMap[] maps = alc[i].getAlcodMap(); for (int m = 0; m < maps.length; m++) { - SequenceI dnaseq = (SequenceI) seqRefIds + SequenceI dnaseq = seqRefIds .get(maps[m].getDnasq()); // Load Mapping jalview.datamodel.Mapping mapping = null; @@ -2678,7 +2742,7 @@ public class Jalview2XML { if (groups[i].getColour().startsWith("ucs")) { - cs = GetUserColourScheme(jms, groups[i].getColour()); + cs = getUserColourScheme(jms, groups[i].getColour()); } else if (groups[i].getColour().equals("AnnotationColourGradient") && groups[i].getAnnotationColours() != null) @@ -2702,7 +2766,7 @@ public class Jalview2XML for (int s = 0; s < groups[i].getSeqCount(); s++) { String seqId = groups[i].getSeq(s) + ""; - jalview.datamodel.SequenceI ts = (jalview.datamodel.SequenceI) seqRefIds + jalview.datamodel.SequenceI ts = seqRefIds .get(seqId); if (ts != null) @@ -2874,7 +2938,7 @@ public class Jalview2XML if (isnewview) { - af = loadViewport(file, JSEQ, hiddenSeqs, al, jms, view, + af = loadViewport(file, jseqs, hiddenSeqs, al, jms, view, uniqueSeqSetId, viewId, autoAlan); av = af.viewport; ap = af.alignPanel; @@ -2959,358 +3023,501 @@ public class Jalview2XML // //LOAD STRUCTURES if (loadTreesAndStructures) { - // run through all PDB ids on the alignment, and collect mappings between - // jmol view ids and all sequences referring to it - Hashtable jmolViewIds = new Hashtable(); + loadStructures(jprovider, jseqs, af, ap); + } + // and finally return. + return af; + } + + /** + * Load and link any saved structure viewers. + * + * @param jprovider + * @param jseqs + * @param af + * @param ap + */ + protected void loadStructures(jarInputStreamProvider jprovider, + JSeq[] jseqs, AlignFrame af, AlignmentPanel ap) + { + /* + * Run through all PDB ids on the alignment, and collect mappings between + * distinct view ids and all sequences referring to that view. + */ + Map structureViewers = new LinkedHashMap(); - for (int i = 0; i < JSEQ.length; i++) + for (int i = 0; i < jseqs.length; i++) + { + if (jseqs[i].getPdbidsCount() > 0) { - if (JSEQ[i].getPdbidsCount() > 0) + Pdbids[] ids = jseqs[i].getPdbids(); + for (int p = 0; p < ids.length; p++) { - Pdbids[] ids = JSEQ[i].getPdbids(); - for (int p = 0; p < ids.length; p++) + final int structureStateCount = ids[p].getStructureStateCount(); + for (int s = 0; s < structureStateCount; s++) { - for (int s = 0; s < ids[p].getStructureStateCount(); s++) + // check to see if we haven't already created this structure view + final StructureState structureState = ids[p].getStructureState(s); + String sviewid = (structureState.getViewId() == null) ? null + : structureState.getViewId() + + uniqueSetSuffix; + jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry(); + // Originally : ids[p].getFile() + // : TODO: verify external PDB file recovery still works in normal + // jalview project load + jpdb.setFile(loadPDBFile(jprovider, ids[p].getId())); + jpdb.setId(ids[p].getId()); + + int x = structureState.getXpos(); + int y = structureState.getYpos(); + int width = structureState.getWidth(); + int height = structureState.getHeight(); + + // Probably don't need to do this anymore... + // Desktop.desktop.getComponentAt(x, y); + // TODO: NOW: check that this recovers the PDB file correctly. + String pdbFile = loadPDBFile(jprovider, ids[p].getId()); + jalview.datamodel.SequenceI seq = seqRefIds + .get(jseqs[i].getId() + ""); + if (sviewid == null) { - // check to see if we haven't already created this structure view - String sviewid = (ids[p].getStructureState(s).getViewId() == null) ? null - : ids[p].getStructureState(s).getViewId() - + uniqueSetSuffix; - jalview.datamodel.PDBEntry jpdb = new jalview.datamodel.PDBEntry(); - // Originally : ids[p].getFile() - // : TODO: verify external PDB file recovery still works in normal - // jalview project load - jpdb.setFile(loadPDBFile(jprovider, ids[p].getId())); - jpdb.setId(ids[p].getId()); - - int x = ids[p].getStructureState(s).getXpos(); - int y = ids[p].getStructureState(s).getYpos(); - int width = ids[p].getStructureState(s).getWidth(); - int height = ids[p].getStructureState(s).getHeight(); - - // Probably don't need to do this anymore... - // Desktop.desktop.getComponentAt(x, y); - // TODO: NOW: check that this recovers the PDB file correctly. - String pdbFile = loadPDBFile(jprovider, ids[p].getId()); - jalview.datamodel.SequenceI seq = (jalview.datamodel.SequenceI) seqRefIds - .get(JSEQ[i].getId() + ""); - if (sviewid == null) - { - sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width - + "," + height; - } - if (!jmolViewIds.containsKey(sviewid)) - { - jmolViewIds.put(sviewid, new Object[] - { new int[] - { x, y, width, height }, "", - new Hashtable(), new boolean[] - { false, false, true } }); - // Legacy pre-2.7 conversion JAL-823 : - // do not assume any view has to be linked for colour by - // sequence - } + sviewid = "_jalview_pre2_4_" + x + "," + y + "," + width + + "," + height; + } + if (!structureViewers.containsKey(sviewid)) + { + structureViewers.put(sviewid, new StructureViewerModel(x, y, width, height, + false, false, true)); + // Legacy pre-2.7 conversion JAL-823 : + // do not assume any view has to be linked for colour by + // sequence + } - // assemble String[] { pdb files }, String[] { id for each - // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, { - // seqs_file 2}, boolean[] { - // linkAlignPanel,superposeWithAlignpanel}} from hash - Object[] jmoldat = jmolViewIds.get(sviewid); - ((boolean[]) jmoldat[3])[0] |= ids[p].getStructureState(s) - .hasAlignwithAlignPanel() ? ids[p].getStructureState( - s).getAlignwithAlignPanel() : false; - // never colour by linked panel if not specified - ((boolean[]) jmoldat[3])[1] |= ids[p].getStructureState(s) - .hasColourwithAlignPanel() ? ids[p] - .getStructureState(s).getColourwithAlignPanel() - : false; - // default for pre-2.7 projects is that Jmol colouring is enabled - ((boolean[]) jmoldat[3])[2] &= ids[p].getStructureState(s) - .hasColourByJmol() ? ids[p].getStructureState(s) - .getColourByJmol() : true; - - if (((String) jmoldat[1]).length() < ids[p] - .getStructureState(s).getContent().length()) + // assemble String[] { pdb files }, String[] { id for each + // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, { + // seqs_file 2}, boolean[] { + // linkAlignPanel,superposeWithAlignpanel}} from hash + StructureViewerModel jmoldat = structureViewers.get(sviewid); + jmoldat.setAlignWithPanel(jmoldat.isAlignWithPanel() + | (structureState.hasAlignwithAlignPanel() ? structureState + .getAlignwithAlignPanel() : false)); + + /* + * Default colour by linked panel to false if not specified (e.g. + * for pre-2.7 projects) + */ + boolean colourWithAlignPanel = jmoldat.isColourWithAlignPanel(); + colourWithAlignPanel |= (structureState + .hasColourwithAlignPanel() ? structureState + .getColourwithAlignPanel() : false); + jmoldat.setColourWithAlignPanel(colourWithAlignPanel); + + /* + * Default colour by viewer to true if not specified (e.g. for + * pre-2.7 projects) + */ + boolean colourByViewer = jmoldat.isColourByViewer(); + colourByViewer &= structureState + .hasColourByJmol() ? structureState + .getColourByJmol() : true; + jmoldat.setColourByViewer(colourByViewer); + + if (jmoldat.getStateData().length() < structureState + .getContent().length()) + { { - { - jmoldat[1] = ids[p].getStructureState(s).getContent(); - } + jmoldat.setStateData(structureState.getContent()); } - if (ids[p].getFile() != null) + } + if (ids[p].getFile() != null) + { + File mapkey = new File(ids[p].getFile()); + StructureData seqstrmaps = jmoldat.getFileData().get(mapkey); + if (seqstrmaps == null) { - File mapkey = new File(ids[p].getFile()); - Object[] seqstrmaps = (Object[]) ((Hashtable) jmoldat[2]) - .get(mapkey); - if (seqstrmaps == null) - { - ((Hashtable) jmoldat[2]).put(mapkey, - seqstrmaps = new Object[] - { pdbFile, ids[p].getId(), new Vector(), - new Vector() }); - } - if (!((Vector) seqstrmaps[2]).contains(seq)) - { - ((Vector) seqstrmaps[2]).addElement(seq); - // ((Vector)seqstrmaps[3]).addElement(n) : - // in principle, chains - // should be stored here : do we need to - // TODO: store and recover seq/pdb_id : - // chain mappings - } + jmoldat.getFileData().put( + mapkey, + seqstrmaps = jmoldat.new StructureData(pdbFile, + ids[p].getId())); } - else + if (!seqstrmaps.getSeqList().contains(seq)) { - errorMessage = ("The Jmol views in this project were imported\nfrom an older version of Jalview.\nPlease review the sequence colour associations\nin the Colour by section of the Jmol View menu.\n\nIn the case of problems, see note at\nhttp://issues.jalview.org/browse/JAL-747"); - warn(errorMessage); + seqstrmaps.getSeqList().add(seq); + // TODO and chains? } } + else + { + errorMessage = ("The Jmol views in this project were imported\nfrom an older version of Jalview.\nPlease review the sequence colour associations\nin the Colour by section of the Jmol View menu.\n\nIn the case of problems, see note at\nhttp://issues.jalview.org/browse/JAL-747"); + warn(errorMessage); + } } } } + } + // Instantiate the associated structure views + for (Entry entry : structureViewers.entrySet()) { + createOrLinkStructureViewer(entry, af, ap); + } + } - // Instantiate the associated Jmol views - for (Entry entry : jmolViewIds.entrySet()) + /** + * + * @param viewerData + * @param af + * @param ap + */ + protected void createOrLinkStructureViewer( + Entry viewerData, AlignFrame af, + AlignmentPanel ap) + { + final StructureViewerModel svattrib = viewerData.getValue(); + + /* + * Search for any viewer windows already open from other alignment views + * that exactly match the stored structure state + */ + StructureViewerBase comp = findMatchingViewer(viewerData); + + if (comp != null) + { + linkStructureViewer(ap, comp, svattrib); + return; + } + + /* + * Pending an XML element for ViewerType, just check if stateData contains + * "chimera" (part of the chimera session filename). + */ + if (svattrib.getStateData().indexOf("chimera") > -1) + { + createChimeraViewer(viewerData, af); + } + else + { + createJmolViewer(viewerData, af); + } + } + + /** + * Create a new Chimera viewer. + * + * @param viewerData + * @param af + */ + protected void createChimeraViewer(Entry viewerData, + AlignFrame af) + { + final StructureViewerModel data = viewerData.getValue(); + String chimeraSession = data.getStateData(); + + if (new File(chimeraSession).exists()) + { + Set> fileData = data.getFileData() + .entrySet(); + List pdbs = new ArrayList(); + List allseqs = new ArrayList(); + for (Entry pdb : fileData) + { + String filePath = pdb.getValue().getFilePath(); + String pdbId = pdb.getValue().getPdbId(); + pdbs.add(new PDBEntry(filePath, pdbId)); + final List seqList = pdb.getValue().getSeqList(); + SequenceI[] seqs = seqList.toArray(new SequenceI[seqList.size()]); + allseqs.add(seqs); + } + + boolean colourByChimera = data.isColourByViewer(); + boolean colourBySequence = data.isColourWithAlignPanel(); + + // TODO can/should this be done via StructureViewer (like Jmol)? + final PDBEntry[] pdbArray = pdbs.toArray(new PDBEntry[pdbs + .size()]); + final SequenceI[][] seqsArray = allseqs.toArray(new SequenceI[allseqs.size()][]); + new ChimeraViewFrame(chimeraSession, af.alignPanel, pdbArray, + seqsArray, + colourByChimera, colourBySequence); + } + else + { + Cache.log.error("Chimera session file " + chimeraSession + + " not found"); + } + } + + /** + * Create a new Jmol window. First parse the Jmol state to translate filenames + * loaded into the view, and record the order in which files are shown in the + * Jmol view, so we can add the sequence mappings in same order. + * + * @param viewerData + * @param af + */ + protected void createJmolViewer( + final Entry viewerData, AlignFrame af) + { + final StructureViewerModel svattrib = viewerData.getValue(); + String state = svattrib.getStateData(); + List pdbfilenames = new ArrayList(); + List seqmaps = new ArrayList(); + List pdbids = new ArrayList(); + StringBuilder newFileLoc = new StringBuilder(64); + int cp = 0, ncp, ecp; + Map oldFiles = svattrib.getFileData(); + while ((ncp = state.indexOf("load ", cp)) > -1) + { + do + { + // look for next filename in load statement + newFileLoc.append(state.substring(cp, + ncp = (state.indexOf("\"", ncp + 1) + 1))); + String oldfilenam = state.substring(ncp, + ecp = state.indexOf("\"", ncp)); + // recover the new mapping data for this old filename + // have to normalize filename - since Jmol and jalview do + // filename + // translation differently. + StructureData filedat = oldFiles.get(new File(oldfilenam)); + newFileLoc.append(Platform.escapeString(filedat.getFilePath())); + pdbfilenames.add(filedat.getFilePath()); + pdbids.add(filedat.getPdbId()); + seqmaps.add(filedat.getSeqList() + .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) + { + // just append rest of state + newFileLoc.append(state.substring(cp)); + } + else + { + System.err.print("Ignoring incomplete Jmol state for PDB ids: "); + newFileLoc = new StringBuilder(state); + newFileLoc.append("; load append "); + for (File id : oldFiles.keySet()) + { + // add this and any other pdb files that should be present in + // the viewer + StructureData filedat = oldFiles.get(id); + newFileLoc.append(filedat.getFilePath()); + pdbfilenames.add(filedat.getFilePath()); + pdbids.add(filedat.getPdbId()); + seqmaps.add(filedat.getSeqList() + .toArray(new SequenceI[0])); + newFileLoc.append(" \""); + newFileLoc.append(filedat.getFilePath()); + newFileLoc.append("\""); + + } + newFileLoc.append(";"); + } + + if (newFileLoc.length() > 0) + { + int histbug = newFileLoc.indexOf("history = "); + histbug += 10; + int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", histbug); + String val = (diff == -1) ? null : newFileLoc + .substring(histbug, diff); + if (val != null && val.length() >= 4) + { + if (val.contains("e")) { - String sviewid = entry.getKey(); - Object[] svattrib = entry.getValue(); - int[] geom = (int[]) svattrib[0]; - String state = (String) svattrib[1]; - Hashtable oldFiles = (Hashtable) 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 - Vector pdbfilenames = new Vector(); - Vector seqmaps = new Vector(); - Vector pdbids = new Vector(); - - // Search to see if we've already created this Jmol view - AppJmol comp = null; - JInternalFrame[] frames = null; - do + if (val.trim().equals("true")) { - try - { - frames = Desktop.desktop.getAllFrames(); - } catch (ArrayIndexOutOfBoundsException e) - { - // occasional No such child exceptions are thrown here... - frames = null; - try - { - Thread.sleep(10); - } catch (Exception f) - { - } - ; - } - } while (frames == null); - // search for any Jmol windows already open from other - // alignment views that exactly match the stored structure state - for (int f = 0; comp == null && f < frames.length; f++) + val = "1"; + } + else { - if (frames[f] instanceof AppJmol) - { - if (sviewid != null - && ((AppJmol) frames[f]).getViewId().equals(sviewid)) - { - // post jalview 2.4 schema includes structure view id - comp = (AppJmol) frames[f]; - } - else if (frames[f].getX() == x && frames[f].getY() == y - && frames[f].getHeight() == height - && frames[f].getWidth() == width) - { - comp = (AppJmol) frames[f]; - } - } + val = "0"; } + newFileLoc.replace(histbug, diff, val); + } + } - if (comp == null) + final String[] pdbf = pdbfilenames.toArray(new String[pdbfilenames + .size()]); + final String[] id = pdbids.toArray(new String[pdbids.size()]); + final SequenceI[][] sq = seqmaps + .toArray(new SequenceI[seqmaps.size()][]); + final String fileloc = newFileLoc.toString(); + final String sviewid = viewerData.getKey(); + final AlignFrame alf = af; + final Rectangle rect = new Rectangle(svattrib.getX(), + svattrib.getY(), svattrib.getWidth(), svattrib.getHeight()); + try + { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() + { + @Override + public void run() { - // create a new Jmol window. - // First parse the Jmol state to translate filenames loaded into the - // view, and record the order in which files are shown in the Jmol - // view, so we can add the sequence mappings in same order. - StringBuffer newFileLoc = null; - int cp = 0, ncp, ecp; - while ((ncp = state.indexOf("load ", cp)) > -1) - { - if (newFileLoc == null) - { - 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, - ecp = state.indexOf("\"", 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)); - newFileLoc.append(Platform - .escapeString((String) filedat[0])); - pdbfilenames.addElement((String) filedat[0]); - pdbids.addElement((String) filedat[1]); - seqmaps.addElement(((Vector) 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) + JalviewStructureDisplayI sview = null; + try { - // just append rest of state - newFileLoc.append(state.substring(cp)); - } - else + // JAL-1333 note - we probably can't migrate Jmol views to UCSF + // Chimera! + sview = new StructureViewer(alf.alignPanel + .getStructureSelectionManager()).createView( + StructureViewer.ViewerType.JMOL, pdbf, id, sq, + alf.alignPanel, svattrib, fileloc, rect, sviewid); + addNewStructureViewer(sview); + } catch (OutOfMemoryError ex) { - System.err - .print("Ignoring incomplete Jmol state for PDB ids: "); - newFileLoc = new StringBuffer(state); - newFileLoc.append("; load append "); - for (File id : oldFiles.keySet()) + new OOMWarning("restoring structure view for PDB id " + id, + (OutOfMemoryError) ex.getCause()); + if (sview != null && sview.isVisible()) { - // add this and any other pdb files that should be present in - // the viewer - Object[] filedat = oldFiles.get(id); - String nfilename; - newFileLoc.append(((String) filedat[0])); - pdbfilenames.addElement((String) filedat[0]); - pdbids.addElement((String) filedat[1]); - seqmaps.addElement(((Vector) filedat[2]) - .toArray(new SequenceI[0])); - newFileLoc.append(" \""); - newFileLoc.append((String) filedat[0]); - newFileLoc.append("\""); - + sview.closeViewer(); + sview.setVisible(false); + sview.dispose(); } - newFileLoc.append(";"); } + } + }); + } catch (InvocationTargetException ex) + { + warn("Unexpected error when opening Jmol view.", ex); - if (newFileLoc != null) - { - int histbug = newFileLoc.indexOf("history = "); - histbug += 10; - int diff = histbug == -1 ? -1 : newFileLoc.indexOf(";", - histbug); - String val = (diff == -1) ? null : newFileLoc.substring( - histbug, diff); - if (val != null && val.length() >= 4) - { - if (val.contains("e")) - { - if (val.trim().equals("true")) - { - val = "1"; - } - else - { - val = "0"; - } - newFileLoc.replace(histbug, diff, val); - } - } - // TODO: assemble String[] { pdb files }, String[] { id for each - // file }, orig_fileloc, SequenceI[][] {{ seqs_file 1 }, { - // seqs_file 2}} from hash - final String[] pdbf = pdbfilenames - .toArray(new String[pdbfilenames.size()]), id = pdbids - .toArray(new String[pdbids.size()]); - final SequenceI[][] sq = seqmaps - .toArray(new SequenceI[seqmaps.size()][]); - final String fileloc = newFileLoc.toString(), vid = sviewid; - final AlignFrame alf = af; - final java.awt.Rectangle rect = new java.awt.Rectangle(x, y, - width, height); - try - { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() - { - @Override - public void run() - { - JalviewStructureDisplayI sview = null; - try - { - // JAL-1333 note - we probably can't migrate Jmol views to UCSF Chimera! - sview = new StructureViewer(alf.alignPanel.getStructureSelectionManager()).createView(StructureViewer.Viewer.JMOL, pdbf, id, sq, alf.alignPanel, - useinJmolsuperpos, usetoColourbyseq, - jmolColouring, fileloc, rect, vid); - addNewStructureViewer(sview); - } catch (OutOfMemoryError ex) - { - new OOMWarning("restoring structure view for PDB id " - + id, (OutOfMemoryError) ex.getCause()); - if (sview != null && sview.isVisible()) - { - sview.closeViewer(); - sview.setVisible(false); - sview.dispose(); - } - } - } - }); - } catch (InvocationTargetException ex) - { - warn("Unexpected error when opening Jmol view.", ex); + } catch (InterruptedException e) + { + // e.printStackTrace(); + } + } + } - } catch (InterruptedException e) - { - // e.printStackTrace(); - } - } + /** + * Returns any open frame that matches given structure viewer data. The match + * is based on the unique viewId, or (for older project versions) the frame's + * geometry. + * + * @param viewerData + * @return + */ + protected StructureViewerBase findMatchingViewer( + Entry viewerData) + { + final String sviewid = viewerData.getKey(); + final StructureViewerModel svattrib = viewerData.getValue(); + StructureViewerBase comp = null; + JInternalFrame[] frames = getAllFrames(); + for (JInternalFrame frame : frames) + { + if (frame instanceof StructureViewerBase) + { + /* + * Post jalview 2.4 schema includes structure view id + */ + if (sviewid != null + && ((StructureViewerBase) frame).getViewId().equals( + sviewid)) + { + comp = (AppJmol) frame; + // todo: break? + } + /* + * Otherwise test for matching position and size of viewer frame + */ + else if (frame.getX() == svattrib.getX() + && frame.getY() == svattrib.getY() + && frame.getHeight() == svattrib.getHeight() + && frame.getWidth() == svattrib.getWidth()) + { + comp = (AppJmol) frame; + // todo: break? + } + } + } + return comp; + } - } - else - // if (comp != null) - { - // NOTE: if the jalview project is part of a shared session then - // view synchronization should/could be done here. + /** + * Link an AlignmentPanel to an existing structure viewer. + * + * @param ap + * @param viewer + * @param oldFiles + * @param useinViewerSuperpos + * @param usetoColourbyseq + * @param viewerColouring + */ + protected void linkStructureViewer(AlignmentPanel ap, + StructureViewerBase viewer, StructureViewerModel svattrib) + { + // NOTE: if the jalview project is part of a shared session then + // view synchronization should/could be done here. - // add mapping for sequences in this view to an already open Jmol - // instance - 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 = ((Vector) filedat[2]) - .toArray(new SequenceI[0]); - comp.jmb.ssm.setMapping(seq, null, pdbFile, - jalview.io.AppletFormatAdapter.FILE); - comp.jmb.addSequenceForStructFile(pdbFile, seq); - } - // and add the AlignmentPanel's reference to the Jmol view - comp.addAlignmentPanel(ap); - if (useinJmolsuperpos) - { - comp.useAlignmentPanelForSuperposition(ap); - } - else - { - comp.excludeAlignmentPanelForSuperposition(ap); - } - if (usetoColourbyseq) - { - comp.useAlignmentPanelForColourbyseq(ap, !jmolColouring); - } - else - { - comp.excludeAlignmentPanelForColourbyseq(ap); - } - } + final boolean useinViewerSuperpos = svattrib.isAlignWithPanel(); + final boolean usetoColourbyseq = svattrib.isColourWithAlignPanel(); + final boolean viewerColouring = svattrib.isColourByViewer(); + Map oldFiles = svattrib.getFileData(); + + /* + * Add mapping for sequences in this view to an already open viewer + */ + final AAStructureBindingModel binding = viewer.getBinding(); + for (File id : oldFiles.keySet()) + { + // add this and any other pdb files that should be present in the + // viewer + StructureData filedat = oldFiles.get(id); + String pdbFile = filedat.getFilePath(); + SequenceI[] seq = filedat.getSeqList().toArray(new SequenceI[0]); + binding.getSsm().setMapping(seq, null, pdbFile, + jalview.io.AppletFormatAdapter.FILE); + binding.addSequenceForStructFile(pdbFile, seq); + } + // and add the AlignmentPanel's reference to the view panel + viewer.addAlignmentPanel(ap); + if (useinViewerSuperpos) + { + viewer.useAlignmentPanelForSuperposition(ap); + } + else + { + viewer.excludeAlignmentPanelForSuperposition(ap); + } + if (usetoColourbyseq) + { + viewer.useAlignmentPanelForColourbyseq(ap, !viewerColouring); + } + else + { + viewer.excludeAlignmentPanelForColourbyseq(ap); + } + } + + /** + * Get all frames within the Desktop. + * + * @return + */ + protected JInternalFrame[] getAllFrames() + { + JInternalFrame[] frames = null; + // TODO is this necessary - is it safe - risk of hanging? + do + { + try + { + frames = Desktop.desktop.getAllFrames(); + } catch (ArrayIndexOutOfBoundsException e) + { + // occasional No such child exceptions are thrown here... + try + { + Thread.sleep(10); + } catch (InterruptedException f) + { } } - } - // and finally return. - return af; + } while (frames == null); + return frames; } /** @@ -3474,7 +3681,7 @@ public class Jalview2XML af.viewport.setConservationSelected(view.getConservationSelected()); af.viewport.setShowJVSuffix(view.getShowFullId()); - af.viewport.rightAlignIds = view.getRightAlignIds(); + af.viewport.setRightAlignIds(view.getRightAlignIds()); af.viewport.setFont(new java.awt.Font(view.getFontName(), view .getFontStyle(), view.getFontSize())); af.alignPanel.fontChanged(); @@ -3502,7 +3709,7 @@ public class Jalview2XML { if (view.getBgColour().startsWith("ucs")) { - cs = GetUserColourScheme(jms, view.getBgColour()); + cs = getUserColourScheme(jms, view.getBgColour()); } else if (view.getBgColour().startsWith("Annotation")) { @@ -3536,10 +3743,8 @@ public class Jalview2XML af.viewport.setColourAppliesToAllGroups(true); - if (view.getShowSequenceFeatures()) - { - af.viewport.showSequenceFeatures = true; - } + af.viewport.setShowSequenceFeatures(view.getShowSequenceFeatures()); + if (view.hasCentreColumnLabels()) { af.viewport.setCentreColumnLabels(view.getCentreColumnLabels()); @@ -3606,9 +3811,14 @@ public class Jalview2XML // recover featre settings if (jms.getFeatureSettings() != null) { - af.viewport.featuresDisplayed = new Hashtable(); + FeaturesDisplayed fdi; + af.viewport.setFeaturesDisplayed(fdi = new FeaturesDisplayed()); String[] renderOrder = new String[jms.getFeatureSettings() .getSettingCount()]; + Hashtable featureGroups = new Hashtable(); + Hashtable featureColours = new Hashtable(); + Hashtable featureOrder = new Hashtable(); + for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) { Setting setting = jms.getFeatureSettings().getSetting(fs); @@ -3635,41 +3845,42 @@ public class Jalview2XML gc.setColourByLabel(setting.getColourByLabel()); } // and put in the feature colour table. - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( - setting.getType(), gc); + featureColours.put(setting.getType(), gc); } else { - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( - setting.getType(), + featureColours.put(setting.getType(), new java.awt.Color(setting.getColour())); } renderOrder[fs] = setting.getType(); if (setting.hasOrder()) { - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder( - setting.getType(), setting.getOrder()); + featureOrder.put(setting.getType(), setting.getOrder()); } else { - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setOrder( - setting.getType(), - fs / jms.getFeatureSettings().getSettingCount()); + featureOrder.put(setting.getType(), new Float(fs + / jms.getFeatureSettings().getSettingCount())); } if (setting.getDisplay()) { - af.viewport.featuresDisplayed.put(setting.getType(), new Integer( - setting.getColour())); + fdi.setVisible(setting.getType()); } } - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder; - Hashtable fgtable; - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureGroups = fgtable = new Hashtable(); + Hashtable fgtable = new Hashtable(); for (int gs = 0; gs < jms.getFeatureSettings().getGroupCount(); gs++) { Group grp = jms.getFeatureSettings().getGroup(gs); fgtable.put(grp.getName(), new Boolean(grp.getDisplay())); } + // FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, + // fgtable, featureColours, jms.getFeatureSettings().hasTransparency() ? + // jms.getFeatureSettings().getTransparency() : 0.0, featureOrder); + FeatureRendererSettings frs = new FeatureRendererSettings( + renderOrder, fgtable, featureColours, 1.0f, featureOrder); + af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer() + .transferSettings(frs); + } if (view.getHiddenColumnsCount() > 0) @@ -3759,7 +3970,7 @@ public class Jalview2XML { cs = new AnnotationColourGradient( annAlignment.getAlignmentAnnotation()[i], - GetUserColourScheme(jms, + getUserColourScheme(jms, viewAnnColour.getColourScheme()), viewAnnColour.getAboveThreshold()); } @@ -3970,7 +4181,7 @@ public class Jalview2XML return false; } - public void AddToSkipList(AlignFrame af) + public void addToSkipList(AlignFrame af) { if (skipList == null) { @@ -4051,7 +4262,7 @@ public class Jalview2XML // need to create or add a new dataset sequence reference to this sequence if (sqid != null) { - dsq = (jalview.datamodel.SequenceI) seqRefIds.get(sqid); + dsq = seqRefIds.get(sqid); } // check again if (dsq == null) @@ -4247,7 +4458,7 @@ public class Jalview2XML /** * recover from hash */ - jmap.setTo((SequenceI) seqRefIds.get(dsfor)); + jmap.setTo(seqRefIds.get(dsfor)); } else { @@ -4306,7 +4517,7 @@ public class Jalview2XML boolean keepSeqRefs) { initSeqRefs(); - jalview.schemabinding.version2.JalviewModel jm = SaveState(ap, null, + jalview.schemabinding.version2.JalviewModel jm = saveState(ap, null, null); if (!keepSeqRefs) @@ -4329,7 +4540,7 @@ public class Jalview2XML viewportsAdded = new Hashtable(); - AlignFrame af = LoadFromObject(jm, null, false, null); + AlignFrame af = loadFromObject(jm, null, false, null); af.alignPanels.clear(); af.closeMenuItem_actionPerformed(true); @@ -4463,14 +4674,14 @@ public class Jalview2XML // register sequence object so the XML parser can recover it. if (seqRefIds == null) { - seqRefIds = new Hashtable(); + seqRefIds = new HashMap(); } if (seqsToIds == null) { - seqsToIds = new IdentityHashMap(); + seqsToIds = new IdentityHashMap(); } - seqRefIds.put(jv2vobj.get(jvobj).toString(), jvobj); - seqsToIds.put(jvobj, id); + seqRefIds.put(jv2vobj.get(jvobj).toString(), (SequenceI) jvobj); + seqsToIds.put((SequenceI) jvobj, id); } else if (jvobj instanceof jalview.datamodel.AlignmentAnnotation) { @@ -4531,5 +4742,4 @@ public class Jalview2XML { skipList = skipList2; } - } diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 9263cd9..586e2fa 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -40,6 +40,7 @@ import jalview.schemes.ResidueProperties; import jalview.structure.StructureSelectionManager; import jalview.util.MessageManager; import jalview.util.jarInputStreamProvider; +import jalview.viewmodel.seqfeatures.FeatureRendererSettings; import java.io.InputStreamReader; import java.util.Hashtable; @@ -411,29 +412,31 @@ public class Jalview2XML_V1 } af.viewport.setColourAppliesToAllGroups(true); - af.viewport.showSequenceFeatures = view.getShowSequenceFeatures(); + af.viewport.setShowSequenceFeatures(view.getShowSequenceFeatures()); if (jms.getFeatureSettings() != null) { - af.viewport.featuresDisplayed = new Hashtable(); + Hashtable featuresDisplayed = new Hashtable(); + Hashtable featureColours = new Hashtable(); String[] renderOrder = new String[jms.getFeatureSettings() .getSettingCount()]; for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++) { Setting setting = jms.getFeatureSettings().getSetting(fs); - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour( + featureColours.put( setting.getType(), new java.awt.Color(setting.getColour())); renderOrder[fs] = setting.getType(); if (setting.getDisplay()) { - af.viewport.featuresDisplayed.put(setting.getType(), new Integer( + featuresDisplayed.put(setting.getType(), new Integer( setting.getColour())); } } - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder; + FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, new Hashtable(), featureColours, 1.0f, null); + af.alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer().transferSettings(frs); } af.setMenusFromViewport(af.viewport); diff --git a/src/jalview/gui/JalviewChimeraBindingModel.java b/src/jalview/gui/JalviewChimeraBindingModel.java index f68b585..0dcde11 100644 --- a/src/jalview/gui/JalviewChimeraBindingModel.java +++ b/src/jalview/gui/JalviewChimeraBindingModel.java @@ -10,6 +10,8 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding { private ChimeraViewFrame cvf; + private FeatureRenderer fr = null; + public JalviewChimeraBindingModel(ChimeraViewFrame chimeraViewFrame, StructureSelectionManager ssm, PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, String protocol) @@ -18,19 +20,17 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding cvf = chimeraViewFrame; } - FeatureRenderer fr = null; - @Override - public jalview.api.FeatureRenderer getFeatureRenderer( + public FeatureRenderer getFeatureRenderer( AlignmentViewPanel alignment) { - AlignmentPanel ap = (alignment == null) ? cvf.ap + AlignmentPanel ap = (alignment == null) ? cvf.getAlignmentPanel() : (AlignmentPanel) alignment; - if (ap.av.showSequenceFeatures) + if (ap.av.isShowSequenceFeatures()) { if (fr == null) { - fr = ap.cloneFeatureRenderer(); + fr = (jalview.gui.FeatureRenderer) ap.cloneFeatureRenderer(); } else { @@ -47,10 +47,10 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding { return new SequenceRenderer(((AlignmentPanel) alignment).av); } + @Override public void refreshGUI() { - // appJmolWindow.repaint(); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() @@ -63,7 +63,7 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding public void updateColours(Object source) { - AlignmentPanel ap = (AlignmentPanel) source, topap; + AlignmentPanel ap = (AlignmentPanel) source; // ignore events from panels not used to colour this view if (!cvf.isUsedforcolourby(ap)) { @@ -71,27 +71,22 @@ public class JalviewChimeraBindingModel extends JalviewChimeraBinding } if (!isLoadingFromArchive()) { - colourBySequence(ap.av.getShowSequenceFeatures(), ap); + colourBySequence(ap.av.isShowSequenceFeatures(), ap); } } + @Override public void releaseReferences(Object svl) { - // TODO Auto-generated method stub - } @Override protected void releaseUIResources() { - // TODO Auto-generated method stub - } @Override public void refreshPdbEntries() { - // TODO Auto-generated method stub - } } diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index e433243..b4e0e00 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -20,11 +20,14 @@ */ package jalview.gui; +import jalview.util.MessageManager; + import java.awt.Color; import java.awt.Font; import java.awt.Rectangle; import java.awt.event.ActionListener; +import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; @@ -209,4 +212,24 @@ public final class JvSwingUtils } } + public static void jvInitComponent(AbstractButton comp, String i18nString) + { + setColorAndFont(comp); + if (i18nString != null && !i18nString.isEmpty()) + { + comp.setText(MessageManager.getString(i18nString)); + } + } + + public static void jvInitComponent(JComponent comp) + { + setColorAndFont(comp); + } + + private static void setColorAndFont(JComponent comp) + { + comp.setBackground(Color.white); + comp.setFont(JvSwingUtils.getLabelFont()); + } + } diff --git a/src/jalview/gui/OverviewPanel.java b/src/jalview/gui/OverviewPanel.java index e8555f7..5df60d2 100755 --- a/src/jalview/gui/OverviewPanel.java +++ b/src/jalview/gui/OverviewPanel.java @@ -67,7 +67,7 @@ public class OverviewPanel extends JPanel implements Runnable // main visible SeqCanvas SequenceRenderer sr; - FeatureRenderer fr; + jalview.renderer.seqfeatures.FeatureRenderer fr; /** * Creates a new OverviewPanel object. @@ -85,7 +85,7 @@ public class OverviewPanel extends JPanel implements Runnable sr.renderGaps = false; sr.forOverview = true; fr = new FeatureRenderer(ap); - + // scale the initial size of overviewpanel to shape of alignment float initialScale = (float) av.getAlignment().getWidth() / (float) av.getAlignment().getHeight(); @@ -254,9 +254,9 @@ public class OverviewPanel extends JPanel implements Runnable { miniMe = null; - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { - fr.transferSettings(ap.seqPanel.seqCanvas.getFeatureRenderer()); + fr.transferSettings(ap.getSeqPanel().seqCanvas.getFeatureRenderer()); } int alwidth = av.getAlignment().getWidth(); @@ -344,7 +344,7 @@ public class OverviewPanel extends JPanel implements Runnable { color = sr.getResidueBoxColour(seq, lastcol).getRGB(); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { color = fr.findFeatureColour(color, seq, lastcol); } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index c2bee83..8565f9f 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -29,6 +29,7 @@ import jalview.commands.EditCommand.Action; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; import jalview.datamodel.DBRefEntry; import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; @@ -140,6 +141,8 @@ public class PopupMenu extends JPopupMenu JMenuItem sequenceDetails = new JMenuItem(); JMenuItem sequenceSelDetails = new JMenuItem(); + + JMenuItem makeReferenceSeq = new JMenuItem(); JMenuItem chooseAnnotations = new JMenuItem(); @@ -220,6 +223,8 @@ public class PopupMenu extends JPopupMenu JMenu groupLinksMenu; + JMenuItem hideInsertions = new JMenuItem(); + /** * Creates a new PopupMenu object. * @@ -322,6 +327,12 @@ public class PopupMenu extends JPopupMenu if (seq != null) { sequenceMenu.setText(sequence.getName()); + if (seq == ap.av.getAlignment().getSeqrep()) + { + makeReferenceSeq.setText("Unmark representative"); + } else { + makeReferenceSeq.setText("Mark as representative"); + } if (seq.getDatasetSequence().getPDBId() != null && seq.getDatasetSequence().getPDBId().size() > 0) @@ -369,7 +380,6 @@ public class PopupMenu extends JPopupMenu } // structureMenu.remove(colStructureMenu); } - if (ap.av.getAlignment().isNucleotide() == true) { AlignmentAnnotation[] aa = ap.av.getAlignment() @@ -441,7 +451,6 @@ public class PopupMenu extends JPopupMenu } } } - } menuItem = new JMenuItem( @@ -1507,7 +1516,28 @@ public class PopupMenu extends JPopupMenu editSequence_actionPerformed(actionEvent); } }); + makeReferenceSeq.setText(MessageManager + .getString("label.mark_as_representative")); + makeReferenceSeq.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent actionEvent) + { + makeReferenceSeq_actionPerformed(actionEvent); + + } + }); + hideInsertions.setText(MessageManager.getString("label.hide_insertions")); + hideInsertions.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + hideInsertions_actionPerformed(e); + } + }); /* * annotationMenuItem.setText("By Annotation"); * annotationMenuItem.addActionListener(new ActionListener() { public void @@ -1517,7 +1547,11 @@ public class PopupMenu extends JPopupMenu groupMenu.add(sequenceSelDetails); add(groupMenu); add(sequenceMenu); - this.add(structureMenu); + add(structureMenu); + if (sequence!=null) + { + add(hideInsertions); + } // annotations configuration panel suppressed for now // groupMenu.add(chooseAnnotations); @@ -1539,6 +1573,7 @@ public class PopupMenu extends JPopupMenu groupMenu.add(jMenu1); sequenceMenu.add(sequenceName); sequenceMenu.add(sequenceDetails); + sequenceMenu.add(makeReferenceSeq); colourMenu.add(textColour); colourMenu.add(noColourmenuItem); colourMenu.add(clustalColour); @@ -1913,6 +1948,43 @@ public class PopupMenu extends JPopupMenu refresh(); } + protected void makeReferenceSeq_actionPerformed(ActionEvent actionEvent) + { + if (!ap.av.getAlignment().hasSeqrep()) + { + // initialise the display flags so the user sees something happen + ap.av.setDisplayReferenceSeq(true); + ap.av.setColourByReferenceSeq(true); + ap.av.getAlignment().setSeqrep(sequence); + } + else + { + if (ap.av.getAlignment().getSeqrep() == sequence) + { + ap.av.getAlignment().setSeqrep(null); + } + else + { + ap.av.getAlignment().setSeqrep(sequence); + } + } + refresh(); + } + + protected void hideInsertions_actionPerformed(ActionEvent actionEvent) + { + if (sequence != null) + { + ColumnSelection cs = ap.av.getColumnSelection(); + if (cs == null) + { + cs = new ColumnSelection(); + } + cs.hideInsertionsFor(sequence); + ap.av.setColumnSelection(cs); + } + refresh(); + } protected void sequenceSelectionDetails_actionPerformed() { createSequenceDetailsReport(ap.av.getSequenceSelection()); @@ -1943,7 +2015,9 @@ public class PopupMenu extends JPopupMenu true, true, false, - (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax + (ap.getSeqPanel().seqCanvas.fr != null) ? ap + .getSeqPanel().seqCanvas.fr + .getMinMax() : null); contents.append("

    "); } @@ -2660,7 +2734,7 @@ public class PopupMenu extends JPopupMenu System.arraycopy(features, 0, tfeatures, 0, rsize); features = tfeatures; seqs = rseqs; - if (ap.seqPanel.seqCanvas.getFeatureRenderer().amendFeatures(seqs, + if (ap.getSeqPanel().seqCanvas.getFeatureRenderer().amendFeatures(seqs, features, true, ap)) { ap.alignFrame.setShowSeqFeatures(true); diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index bdc83e5..c024b1c 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -23,7 +23,7 @@ package jalview.gui; import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.bin.Cache; import jalview.gui.Help.HelpId; -import jalview.gui.StructureViewer.Viewer; +import jalview.gui.StructureViewer.ViewerType; import jalview.io.JalviewFileChooser; import jalview.io.JalviewFileView; import jalview.jbgui.GPreferences; @@ -289,7 +289,7 @@ public class Preferences extends GPreferences addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false)); addTempFactor.setEnabled(structSelected); structViewer.setSelectedItem(Cache.getDefault(STRUCTURE_DISPLAY, - Viewer.JMOL.name())); + ViewerType.JMOL.name())); chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, "")); chimeraPath.addActionListener(new ActionListener() { @@ -892,7 +892,7 @@ public class Preferences extends GPreferences @Override protected void structureViewer_actionPerformed(String selectedItem) { - if (!selectedItem.equals(Viewer.CHIMERA.name())) + if (!selectedItem.equals(ViewerType.CHIMERA.name())) { return; } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index ab0a0b8..c8a0ec7 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -107,7 +107,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable { public void internalFrameClosing(InternalFrameEvent evt) { - ap.idPanel.idCanvas.setHighlighted(null); + ap.getIdPanel().getIdCanvas().setHighlighted(null); } }); @@ -197,7 +197,7 @@ public class RedundancyPanel extends GSliderPanel implements Runnable redundantSequences.add(originalSequences[i]); } } - ap.idPanel.idCanvas.setHighlighted(redundantSequences); + ap.getIdPanel().getIdCanvas().setHighlighted(redundantSequences); } /** diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index f2c5154..32773b9 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -20,14 +20,28 @@ */ package jalview.gui; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; - -import jalview.datamodel.*; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; import jalview.util.MessageManager; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import javax.swing.ToolTipManager; + /** * DOCUMENT ME! * @@ -114,7 +128,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, }); pop.add(item); - if (av.getColumnSelection().getHiddenColumns().size() > 1) + if (av.getColumnSelection().hasHiddenColumns()) { item = new JMenuItem( MessageManager.getString("action.reveal_all")); @@ -327,7 +341,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, { if (mouseDragging) { - ap.seqPanel.scrollCanvas(null); + ap.getSeqPanel().scrollCanvas(null); } } @@ -335,7 +349,7 @@ public class ScalePanel extends JPanel implements MouseMotionListener, { if (mouseDragging) { - ap.seqPanel.scrollCanvas(evt); + ap.getSeqPanel().scrollCanvas(evt); } } @@ -355,25 +369,24 @@ public class ScalePanel extends JPanel implements MouseMotionListener, res = av.getColumnSelection().adjustForHiddenColumns(res); reveal = null; - for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++) + if (av.getColumnSelection().getHiddenColumns() != null) { - int[] region = (int[]) av.getColumnSelection().getHiddenColumns() - .elementAt(i); - if (res + 1 == region[0] || res - 1 == region[1]) + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - reveal = region; - ToolTipManager.sharedInstance().registerComponent(this); - this.setToolTipText(MessageManager - .getString("label.reveal_hidden_columns")); - break; - } - else - { - this.setToolTipText(null); + if (res + 1 == region[0] || res - 1 == region[1]) + { + reveal = region; + ToolTipManager.sharedInstance().registerComponent(this); + this.setToolTipText(MessageManager + .getString("label.reveal_hidden_columns")); + break; + } + else + { + this.setToolTipText(null); + } } - } - repaint(); } @@ -466,18 +479,18 @@ public class ScalePanel extends JPanel implements MouseMotionListener, } gg.drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + 2, - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + (fm.getDescent() * 2)); } else { gg.drawLine( - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + fm.getDescent(), - (int) (((i - startx - 1) * av.charWidth) + (av.charWidth / 2)), + ((i - startx - 1) * av.charWidth) + (av.charWidth / 2), y + (fm.getDescent() * 2)); } } @@ -486,7 +499,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, { gg.setColor(Color.blue); int res; - if (av.getShowHiddenMarkers()) + if (av.getShowHiddenMarkers() + && av.getColumnSelection().getHiddenColumns() != null) { for (int i = 0; i < av.getColumnSelection().getHiddenColumns() .size(); i++) diff --git a/src/jalview/gui/ScriptWindow.java b/src/jalview/gui/ScriptWindow.java index d935eb7..641efcb 100644 --- a/src/jalview/gui/ScriptWindow.java +++ b/src/jalview/gui/ScriptWindow.java @@ -22,10 +22,14 @@ package jalview.gui; import org.jmol.api.*; +import jalview.jbgui.GStructureViewer; + import java.awt.*; import java.awt.event.*; + import javax.swing.*; import javax.swing.text.*; + import java.util.Vector; import org.jmol.i18n.GT; @@ -53,7 +57,7 @@ public final class ScriptWindow extends JPanel implements ActionListener, JmolViewer viewer; - AppJmol appJmol; + GStructureViewer appJmol; public ScriptWindow(AppJmol appJmol) { diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d73ee70..5032f69 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -34,6 +34,7 @@ import java.awt.Graphics2D; import java.awt.RenderingHints; import java.awt.Shape; import java.awt.image.BufferedImage; +import java.util.List; import javax.swing.JComponent; @@ -573,7 +574,7 @@ public class SeqCanvas extends JComponent drawPanel(g, startRes, endx, 0, al.getHeight(), ypos); - if (av.showAnnotation) + if (av.isShowAnnotation()) { g.translate(0, cHeight + ypos + 3); if (annotations == null) @@ -598,7 +599,7 @@ public class SeqCanvas extends JComponent int getAnnotationHeight() { - if (!av.showAnnotation) + if (!av.isShowAnnotation()) { return 0; } @@ -627,7 +628,8 @@ public class SeqCanvas extends JComponent * @param offset * DOCUMENT ME! */ - void drawPanel(Graphics g1, int startRes, int endRes, int startSeq, + public void drawPanel(Graphics g1, int startRes, int endRes, + int startSeq, int endSeq, int offset) { if (!av.hasHiddenColumns()) @@ -636,7 +638,7 @@ public class SeqCanvas extends JComponent } else { - java.util.Vector regions = av.getColumnSelection().getHiddenColumns(); + List regions = av.getColumnSelection().getHiddenColumns(); int screenY = 0; int blockStart = startRes; @@ -644,7 +646,7 @@ public class SeqCanvas extends JComponent for (int i = 0; regions != null && i < regions.size(); i++) { - int[] region = (int[]) regions.elementAt(i); + int[] region = regions.get(i); int hideStart = region[0]; int hideEnd = region[1]; @@ -710,7 +712,7 @@ public class SeqCanvas extends JComponent sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq), startRes, endRes, offset + ((i - startSeq) * av.charHeight)); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { fr.drawSequence(g, nextSeq, startRes, endRes, offset + ((i - startSeq) * av.charHeight)); diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index c10a4a9..7c6a202 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -243,44 +243,6 @@ public class SeqPanel extends JPanel implements MouseListener, return seq; } - SequenceFeature[] findFeaturesAtRes(SequenceI sequence, int res) - { - Vector tmp = new Vector(); - SequenceFeature[] features = sequence.getSequenceFeatures(); - if (features != null) - { - for (int i = 0; i < features.length; i++) - { - if (av.featuresDisplayed == null - || !av.featuresDisplayed.containsKey(features[i].getType())) - { - continue; - } - - if (features[i].featureGroup != null - && seqCanvas.fr.featureGroups != null - && seqCanvas.fr.featureGroups - .containsKey(features[i].featureGroup) - && !((Boolean) seqCanvas.fr.featureGroups - .get(features[i].featureGroup)).booleanValue()) - { - continue; - } - - if ((features[i].getBegin() <= res) - && (features[i].getEnd() >= res)) - { - tmp.addElement(features[i]); - } - } - } - - features = new SequenceFeature[tmp.size()]; - tmp.copyInto(features); - - return features; - } - void endEditing() { if (editCommand != null && editCommand.getSize() > 0) @@ -743,14 +705,14 @@ public class SeqPanel extends JPanel implements MouseListener, } // use aa to see if the mouse pointer is on a - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { int rpos; - SequenceFeature[] features = findFeaturesAtRes( + List features = ap.getFeatureRenderer().findFeaturesAtRes( sequence.getDatasetSequence(), rpos = sequence.findPosition(res)); seqARep.appendFeatures(tooltipText, rpos, features, - this.ap.seqPanel.seqCanvas.fr.minmax); + this.ap.getSeqPanel().seqCanvas.fr.getMinMax()); } if (tooltipText.length() == 6) // { @@ -1389,21 +1351,21 @@ public class SeqPanel extends JPanel implements MouseListener, av.setSelectionGroup(null); } - SequenceFeature[] features = findFeaturesAtRes( + List features = seqCanvas.getFeatureRenderer().findFeaturesAtRes( sequence.getDatasetSequence(), sequence.findPosition(findRes(evt))); - if (features != null && features.length > 0) + if (features != null && features.size()> 0) { SearchResults highlight = new SearchResults(); - highlight.addResult(sequence, features[0].getBegin(), - features[0].getEnd()); + highlight.addResult(sequence, features.get(0).getBegin(), + features.get(0).getEnd()); seqCanvas.highlightSearchResults(highlight); } - if (features != null && features.length > 0) + if (features != null && features.size()> 0) { seqCanvas.getFeatureRenderer().amendFeatures(new SequenceI[] - { sequence }, features, false, ap); + { sequence }, features.toArray(new SequenceFeature[features.size()]), false, ap); seqCanvas.highlightSearchResults(null); } @@ -1518,16 +1480,16 @@ public class SeqPanel extends JPanel implements MouseListener, if (javax.swing.SwingUtilities.isRightMouseButton(evt)) { - SequenceFeature[] allFeatures = findFeaturesAtRes( + List allFeatures = ap.getFeatureRenderer().findFeaturesAtRes( sequence.getDatasetSequence(), sequence.findPosition(res)); Vector links = new Vector(); - for (int i = 0; i < allFeatures.length; i++) + for (SequenceFeature sf:allFeatures) { - if (allFeatures[i].links != null) + if (sf.links != null) { - for (int j = 0; j < allFeatures[i].links.size(); j++) + for (int j = 0; j < sf.links.size(); j++) { - links.addElement(allFeatures[i].links.elementAt(j)); + links.addElement(sf.links.elementAt(j)); } } } diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index bcbebbd..438ef00 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.api.FeatureRenderer; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -80,11 +81,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer // If EPS graphics, stringWidth will be a double, not an int double dwidth = fm.getStringBounds("M", g).getWidth(); - monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && (float) av.charWidth == dwidth); + monospacedFont = (dwidth == fm.getStringBounds("|", g).getWidth() && av.charWidth == dwidth); this.renderGaps = renderGaps; } + @Override public Color getResidueBoxColour(SequenceI seq, int i) { allGroups = av.getAlignment().findAllGroups(seq); @@ -105,6 +107,31 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } /** + * Get the residue colour at the given sequence position - as determined by + * the sequence group colour (if any), else the colour scheme, possibly + * overridden by a feature colour. + * + * @param seq + * @param position + * @param fr + * @return + */ + @Override + public Color getResidueColour(final SequenceI seq, int position, + FeatureRenderer fr) + { + // TODO replace 8 or so code duplications with calls to this method + // (refactored as needed) + Color col = getResidueBoxColour(seq, position); + + if (fr != null) + { + col = fr.findFeatureColour(col, seq, position); + } + return col; + } + + /** * DOCUMENT ME! * * @param cs @@ -188,7 +215,9 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer int y1) { if (seq == null) + { return; // fix for racecondition + } int i = start; int length = seq.getLength(); @@ -290,6 +319,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } else { + boolean srep = av.isDisplayReferenceSeq(); boolean getboxColour = false; for (int i = start; i <= end; i++) { @@ -335,7 +365,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer if (currentSequenceGroup.getShowNonconserved()) // todo optimize { // todo - use sequence group consensus - s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, + s = getDisplayChar(srep, i, s, '.'); } @@ -378,7 +408,7 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } if (av.getShowUnconserved()) { - s = getDisplayChar(av.getAlignmentConsensusAnnotation(), i, s, + s = getDisplayChar(srep, i, s, '.'); } @@ -393,10 +423,12 @@ public class SequenceRenderer implements jalview.api.SequenceRenderer } } - private char getDisplayChar(AlignmentAnnotation consensus, int position, + private char getDisplayChar(final boolean usesrep, int position, char s, char c) { - char conschar = consensus.annotations[position].displayCharacter + // TODO - use currentSequenceGroup rather than alignemnt + // currentSequenceGroup.getConsensus() + char conschar = (usesrep) ? av.getAlignment().getSeqrep().getCharAt(position) : av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter .charAt(0); if (conschar != '-' && s == conschar) { diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 81b3bd3..cbd0d58 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -300,7 +300,7 @@ public class SliderPanel extends GSliderPanel } } - ap.seqPanel.seqCanvas.repaint(); + ap.getSeqPanel().seqCanvas.repaint(); } /** diff --git a/src/jalview/gui/SplashScreen.java b/src/jalview/gui/SplashScreen.java index 14e1a0e..76565ce 100755 --- a/src/jalview/gui/SplashScreen.java +++ b/src/jalview/gui/SplashScreen.java @@ -20,10 +20,20 @@ */ package jalview.gui; -import java.awt.*; -import java.awt.event.*; - -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import javax.swing.JInternalFrame; +import javax.swing.JLayeredPane; +import javax.swing.JPanel; +import javax.swing.JTextPane; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; @@ -172,8 +182,8 @@ public class SplashScreen extends JPanel implements Runnable, authlist.setSize(new Dimension(750, 375)); add(authlist, BorderLayout.CENTER); revalidate(); - iframe.setBounds((int) ((Desktop.instance.getWidth() - 750) / 2), - (int) ((Desktop.instance.getHeight() - 375) / 2), 750, + iframe.setBounds((Desktop.instance.getWidth() - 750) / 2, + (Desktop.instance.getHeight() - 375) / 2, 750, authlist.getHeight() + iconimg.getHeight()); iframe.validate(); iframe.setVisible(true); diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index 22f12ea..8ff4c70 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -24,6 +24,7 @@ import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; +import jalview.datamodel.StructureViewerModel; import jalview.structure.StructureSelectionManager; import java.awt.Rectangle; @@ -41,19 +42,19 @@ public class StructureViewer { StructureSelectionManager ssm; - public enum Viewer + public enum ViewerType { JMOL, CHIMERA }; - public Viewer getViewerType() + public ViewerType getViewerType() { String viewType = Cache.getDefault(Preferences.STRUCTURE_DISPLAY, - Viewer.JMOL.name()); - return Viewer.valueOf(viewType); + ViewerType.JMOL.name()); + return ViewerType.valueOf(viewType); } - public void setViewerType(Viewer type) + public void setViewerType(ViewerType type) { Cache.setProperty(Preferences.STRUCTURE_DISPLAY, type.name()); } @@ -69,15 +70,15 @@ public class StructureViewer return viewStructures(getViewerType(), ap, pr, collateForPDB); } - public JalviewStructureDisplayI viewStructures(Viewer viewerType, + public JalviewStructureDisplayI viewStructures(ViewerType viewerType, AlignmentPanel ap, PDBEntry[] pr, SequenceI[][] collateForPDB) { JalviewStructureDisplayI sview = null; - if (viewerType.equals(Viewer.JMOL)) + if (viewerType.equals(ViewerType.JMOL)) { sview = new AppJmol(ap, pr, ap.av.collateForPDB(pr)); } - else if (viewerType.equals(Viewer.CHIMERA)) + else if (viewerType.equals(ViewerType.CHIMERA)) { sview = new ChimeraViewFrame(ap, pr, ap.av.collateForPDB(pr)); } @@ -89,15 +90,15 @@ public class StructureViewer return sview; } - public JalviewStructureDisplayI viewStructures(Viewer viewerType, + public JalviewStructureDisplayI viewStructures(ViewerType viewerType, AlignmentPanel ap, PDBEntry pr, SequenceI[] collateForPDB) { JalviewStructureDisplayI sview = null; - if (viewerType.equals(Viewer.JMOL)) + if (viewerType.equals(ViewerType.JMOL)) { sview = new AppJmol(pr, collateForPDB, null, ap); } - else if (viewerType.equals(Viewer.CHIMERA)) + else if (viewerType.equals(ViewerType.CHIMERA)) { sview = new ChimeraViewFrame(pr, collateForPDB, null, ap); } @@ -115,24 +116,42 @@ public class StructureViewer return viewStructures(getViewerType(), ap, pdb, sequenceIs); } - public JalviewStructureDisplayI createView(Viewer viewer, String[] pdbf, - String[] id, SequenceI[][] sq, AlignmentPanel alignPanel, - boolean useinJmolsuperpos, boolean usetoColourbyseq, - boolean jmolColouring, String fileloc, Rectangle rect, String vid) + /** + * Create a new panel controlling a structure viewer. + * + * @param type + * @param pdbf + * @param id + * @param sq + * @param alignPanel + * @param viewerData + * @param fileloc + * @param rect + * @param vid + * @return + */ + public JalviewStructureDisplayI createView(ViewerType type, + String[] pdbf, String[] id, SequenceI[][] sq, + AlignmentPanel alignPanel, StructureViewerModel viewerData, String fileloc, + Rectangle rect, String vid) { + final boolean useinViewerSuperpos = viewerData.isAlignWithPanel(); + final boolean usetoColourbyseq = viewerData.isColourWithAlignPanel(); + final boolean viewerColouring = viewerData.isColourByViewer(); + JalviewStructureDisplayI sview = null; - switch (viewer) + switch (type) { case JMOL: - sview = new AppJmol(pdbf, id, sq, alignPanel, useinJmolsuperpos, - usetoColourbyseq, jmolColouring, fileloc, rect, vid); + sview = new AppJmol(pdbf, id, sq, alignPanel, usetoColourbyseq, + useinViewerSuperpos, viewerColouring, fileloc, rect, vid); break; case CHIMERA: Cache.log.error("Unsupported structure viewer type " - + viewer.toString()); + + type.toString()); break; default: - Cache.log.error("Unknown structure viewer type " + viewer.toString()); + Cache.log.error("Unknown structure viewer type " + type.toString()); } return sview; } diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java new file mode 100644 index 0000000..13af0e8 --- /dev/null +++ b/src/jalview/gui/StructureViewerBase.java @@ -0,0 +1,225 @@ +package jalview.gui; + +import jalview.gui.ViewSelectionMenu.ViewSetProvider; +import jalview.jbgui.GStructureViewer; + +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +import javax.swing.JMenuItem; + +/** + * Base class with common functionality for JMol, Chimera or other structure + * viewers. + * + * @author gmcarstairs + * + */ +public abstract class StructureViewerBase extends GStructureViewer + implements Runnable, ViewSetProvider +{ + + /** + * list of sequenceSet ids associated with the view + */ + protected List _aps = new ArrayList(); + /** + * list of alignment panels to use for superposition + */ + protected Vector _alignwith = new Vector(); + /** + * list of alignment panels that are used for colouring structures by aligned + * sequences + */ + protected Vector _colourwith = new Vector(); + private String viewId = null; + private AlignmentPanel ap; + + /** + * + * @param ap2 + * @return true if this Jmol instance is linked with the given alignPanel + */ + public boolean isLinkedWith(AlignmentPanel ap2) + { + return _aps.contains(ap2.av.getSequenceSetId()); + } + + public boolean isUsedforaligment(AlignmentPanel ap2) + { + + return (_alignwith != null) && _alignwith.contains(ap2); + } + + public boolean isUsedforcolourby(AlignmentPanel ap2) + { + return (_colourwith != null) && _colourwith.contains(ap2); + } + + /** + * + * @return TRUE if the view is NOT being coloured by the alignment colours. + */ + public boolean isColouredByViewer() + { + return !getBinding().isColourBySequence(); + } + + public String getViewId() + { + if (viewId == null) + { + viewId = System.currentTimeMillis() + "." + this.hashCode(); + } + return viewId; + } + + protected void setViewId(String viewId) + { + this.viewId = viewId; + } + + public abstract String getStateInfo(); + + protected void buildActionMenu() + { + if (_alignwith == null) + { + _alignwith = new Vector(); + } + if (_alignwith.size() == 0 && ap != null) + { + _alignwith.add(ap); + } + ; + for (Component c : viewerActionMenu.getMenuComponents()) + { + if (c != alignStructs) + { + viewerActionMenu.remove((JMenuItem) c); + } + } + } + + public AlignmentPanel getAlignmentPanel() + { + return ap; + } + + protected void setAlignmentPanel(AlignmentPanel alp) + { + this.ap = alp; + } + + public AlignmentPanel[] getAllAlignmentPanels() + { + AlignmentPanel[] t, list = new AlignmentPanel[0]; + for (String setid : _aps) + { + AlignmentPanel[] panels = PaintRefresher.getAssociatedPanels(setid); + if (panels != null) + { + t = new AlignmentPanel[list.length + panels.length]; + System.arraycopy(list, 0, t, 0, list.length); + System.arraycopy(panels, 0, t, list.length, panels.length); + list = t; + } + } + + return list; + } + + /** + * set the primary alignmentPanel reference and add another alignPanel to the + * list of ones to use for colouring and aligning + * + * @param nap + */ + public void addAlignmentPanel(AlignmentPanel nap) + { + if (getAlignmentPanel() == null) + { + setAlignmentPanel(nap); + } + if (!_aps.contains(nap.av.getSequenceSetId())) + { + _aps.add(nap.av.getSequenceSetId()); + } + } + + /** + * remove any references held to the given alignment panel + * + * @param nap + */ + public void removeAlignmentPanel(AlignmentPanel nap) + { + try + { + _alignwith.remove(nap); + _colourwith.remove(nap); + if (getAlignmentPanel() == nap) + { + setAlignmentPanel(null); + for (AlignmentPanel aps : getAllAlignmentPanels()) + { + if (aps != nap) + { + setAlignmentPanel(aps); + break; + } + } + } + } catch (Exception ex) + { + } + if (getAlignmentPanel() != null) + { + buildActionMenu(); + } + } + + public void useAlignmentPanelForSuperposition(AlignmentPanel nap) + { + addAlignmentPanel(nap); + if (!_alignwith.contains(nap)) + { + _alignwith.add(nap); + } + } + + public void excludeAlignmentPanelForSuperposition(AlignmentPanel nap) + { + if (_alignwith.contains(nap)) + { + _alignwith.remove(nap); + } + } + + public void useAlignmentPanelForColourbyseq(AlignmentPanel nap, boolean enableColourBySeq) + { + useAlignmentPanelForColourbyseq(nap); + getBinding().setColourBySequence(enableColourBySeq); + seqColour.setSelected(enableColourBySeq); + viewerColour.setSelected(!enableColourBySeq); + } + + public void useAlignmentPanelForColourbyseq(AlignmentPanel nap) + { + addAlignmentPanel(nap); + if (!_colourwith.contains(nap)) + { + _colourwith.add(nap); + } + } + + public void excludeAlignmentPanelForColourbyseq(AlignmentPanel nap) + { + if (_colourwith.contains(nap)) + { + _colourwith.remove(nap); + } + } +} diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index ee0bfaf..6ce68b3 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -20,27 +20,47 @@ */ package jalview.gui; -import java.beans.*; -import java.io.*; -import java.util.*; -import java.util.List; - -import javax.imageio.*; - -import java.awt.*; -import java.awt.event.*; -import java.awt.image.*; -import javax.swing.*; - -import org.jibble.epsgraphics.*; -import jalview.analysis.*; +import jalview.analysis.AlignmentSorter; +import jalview.analysis.NJTree; +import jalview.api.analysis.ScoreModelI; +import jalview.api.analysis.ViewBasedAnalysisI; +import jalview.bin.Cache; import jalview.commands.CommandI; import jalview.commands.OrderCommand; -import jalview.datamodel.*; -import jalview.io.*; -import jalview.jbgui.*; +import jalview.datamodel.Alignment; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AlignmentView; +import jalview.datamodel.BinaryNode; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.NodeTransformI; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.datamodel.SequenceNode; +import jalview.io.JalviewFileChooser; +import jalview.io.JalviewFileView; +import jalview.io.NewickFile; +import jalview.jbgui.GTreePanel; +import jalview.schemes.ResidueProperties; import jalview.util.MessageManager; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.beans.PropertyChangeEvent; +import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.imageio.ImageIO; +import javax.swing.ButtonGroup; +import javax.swing.JMenuItem; +import javax.swing.JRadioButtonMenuItem; + +import org.jibble.epsgraphics.EpsGraphics2D; + /** * DOCUMENT ME! * @@ -293,8 +313,26 @@ public class TreePanel extends GTreePanel seqs = av.getSelectionGroup().getSequencesInOrder( av.getAlignment()); } - - tree = new NJTree(seqs, seqStrings, type, pwtype, start, end); + ScoreModelI sm = ResidueProperties.getScoreModel(pwtype); + if (sm instanceof ViewBasedAnalysisI) + { + try + { + sm = sm.getClass().newInstance(); + ((ViewBasedAnalysisI) sm) + .configureFromAlignmentView(treeCanvas.ap); + } catch (Exception q) + { + Cache.log.error("Couldn't create a scoremodel instance for " + + sm.getName()); + } + tree = new NJTree(seqs, seqStrings, type, pwtype, sm, start, end); + } + else + { + tree = new NJTree(seqs, seqStrings, type, pwtype, null, start, + end); + } showDistances(true); } diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 7736332..8dc84b8 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -20,13 +20,34 @@ */ package jalview.io; -import java.io.*; -import java.net.*; -import java.util.*; - -import jalview.analysis.*; -import jalview.datamodel.*; -import jalview.schemes.*; +import jalview.analysis.Conservation; +import jalview.api.AlignViewportI; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.GraphLine; +import jalview.datamodel.HiddenSequences; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.ColourSchemeProperty; +import jalview.schemes.ResidueProperties; +import jalview.schemes.UserColourScheme; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.InputStreamReader; +import java.io.StringReader; +import java.net.URL; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; public class AnnotationFile { @@ -67,18 +88,18 @@ public class AnnotationFile } /** - * convenience method for pre-2.4 feature files which have no view, hidden + * convenience method for pre-2.9 annotation files which have no view, hidden * columns or hidden row keywords. * * @param annotations * @param list * @param properties - * @return feature file as a string. + * @return annotation file as a string. */ public String printAnnotations(AlignmentAnnotation[] annotations, List list, Hashtable properties) { - return printAnnotations(annotations, list, properties, null); + return printAnnotations(annotations, list, properties, null, null, null); } @@ -119,10 +140,56 @@ public class AnnotationFile * @return annotation file */ public String printAnnotations(AlignmentAnnotation[] annotations, - List list, Hashtable properties, ViewDef[] views) + List list, Hashtable properties, + ColumnSelection cs, AlignmentI al, ViewDef view) { - // TODO: resolve views issue : annotationFile could contain visible region, - // or full data + hidden region specifications for a view. + if (view != null) + { + if (view.viewname != null) + { + text.append("VIEW_DEF\t" + view.viewname + "\n"); + } + if (list == null) + { + list = view.visibleGroups; + } + if (cs == null) + { + cs = view.hiddencols; + } + if (al == null) + { + // add hidden rep sequences. + } + } + // first target - store and restore all settings for a view. + if (al != null && al.hasSeqrep()) + { + text.append("VIEW_SETREF\t" + al.getSeqrep().getName() + "\n"); + } + if (cs != null && cs.hasHiddenColumns()) + { + text.append("VIEW_HIDECOLS\t"); + List hc = cs.getHiddenColumns(); + boolean comma = false; + for (int[] r : hc) + { + if (!comma) + { + comma = true; + } + else + { + text.append(","); + } + text.append(r[0]); + text.append("-"); + text.append(r[1]); + } + text.append("\n"); + } + // TODO: allow efficient recovery of annotation data shown in several + // different views if (annotations != null) { boolean oneColour = true; @@ -320,7 +387,9 @@ public class AnnotationFile } if (row.hasScore()) + { text.append("\t" + row.score); + } text.append(newline); @@ -403,7 +472,8 @@ public class AnnotationFile text.append(properties.get(key)); } // TODO: output alignment visualization settings here if required - + // iterate through one or more views, defining, marking columns and rows as visible/hidden, and emmitting view properties. + // View specific annotation is } return text.toString(); @@ -590,9 +660,33 @@ public class AnnotationFile String refSeqId = null; + public boolean annotateAlignmentView(AlignViewportI viewport, + String file, String protocol) + { + ColumnSelection colSel = viewport.getColumnSelection(); + if (colSel == null) + { + colSel = new ColumnSelection(); + } + boolean rslt = readAnnotationFile(viewport.getAlignment(), colSel, + file, protocol); + if (rslt + && (colSel.hasSelectedColumns() || colSel.hasHiddenColumns())) + { + viewport.setColumnSelection(colSel); + } + + return rslt; + } public boolean readAnnotationFile(AlignmentI al, String file, String protocol) { + return readAnnotationFile(al, null, file, protocol); + } + + public boolean readAnnotationFile(AlignmentI al, ColumnSelection colSel, + String file, String protocol) + { BufferedReader in = null; try { @@ -619,7 +713,7 @@ public class AnnotationFile } if (in != null) { - return parseAnnotationFrom(al, in); + return parseAnnotationFrom(al, colSel, in); } } catch (Exception ex) @@ -642,7 +736,8 @@ public class AnnotationFile private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE"; - public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) + public boolean parseAnnotationFrom(AlignmentI al, ColumnSelection colSel, + BufferedReader in) throws Exception { nlinesread = 0; @@ -834,6 +929,58 @@ public class AnnotationFile modified = true; continue; } + // else if (token.equalsIgnoreCase("VIEW_DEF")) + // { + // addOrSetView(al,st); + // modified = true; + // continue; + // } + else if (token.equalsIgnoreCase("VIEW_SETREF")) + { + if (refSeq != null) + { + al.setSeqrep(refSeq); + } + modified = true; + continue; + } + else if (token.equalsIgnoreCase("VIEW_HIDECOLS")) + { + if (st.hasMoreTokens()) + { + if (colSel == null) + { + colSel = new ColumnSelection(); + } + parseHideCols(colSel, st.nextToken()); + } + modified = true; + continue; + } + else if (token.equalsIgnoreCase("HIDE_INSERTIONS")) + { + SequenceI sr = refSeq == null ? al.getSeqrep() : refSeq; + if (sr == null) + { + sr = al.getSequenceAt(0); + } + if (sr != null) + { + if (colSel == null) + { + System.err + .println("Cannot process HIDE_INSERTIONS without an alignment view: Ignoring line: " + + line); + } + else + { + // consider deferring this till after the file has been parsed ? + colSel.hideInsertionsFor(sr); + } + } + modified = true; + continue; + } // Parse out the annotation row graphStyle = AlignmentAnnotation.getGraphValueFromString(token); @@ -852,7 +999,9 @@ public class AnnotationFile { description = line; if (st.hasMoreTokens()) + { line = st.nextToken(); + } } if (st.hasMoreTokens()) @@ -1004,7 +1153,7 @@ public class AnnotationFile (StringTokenizer) _deferred_args[1], // st (SequenceI) _deferred_args[2], // refSeq (_deferred_args[3] == null) ? null : groupRefLookup - .get((String) _deferred_args[3]) // the reference + .get(_deferred_args[3]) // the reference // group, or null ); } @@ -1024,7 +1173,7 @@ public class AnnotationFile (StringTokenizer) _combine_args[0], // st (SequenceI) _combine_args[1], // refSeq (_combine_args[2] == null) ? null : groupRefLookup - .get((String) _combine_args[2]) // the reference group, + .get(_combine_args[2]) // the reference group, // or null ); } @@ -1032,6 +1181,40 @@ public class AnnotationFile return modified; } + private void parseHideCols(ColumnSelection colSel, String nextToken) + { + StringTokenizer inval = new StringTokenizer(nextToken,","); + while (inval.hasMoreTokens()) + { + String range = inval.nextToken().trim(); + int from, to = range.indexOf("-"); + if (to == -1) + { + from = to = Integer.parseInt(range); + if (from >= 0) + { + colSel.hideColumns(from, to); + } + } + else + { + from = Integer.parseInt(range.substring(0, to)); + if (to < range.length() - 1) + { + to = Integer.parseInt(range.substring(to + 1)); + } + else + { + to = from; + } + if (from > 0 && to >= from) + { + colSel.hideColumns(from, to); + } + } + } + } + private Object autoAnnotsKey(AlignmentAnnotation annotation, SequenceI refSeq, String groupRef) { @@ -1602,4 +1785,19 @@ public class AnnotationFile } return sp.toString(); } + + public String printAnnotationsForView(AlignViewportI viewport) + { + return printAnnotations(viewport.isShowAnnotation() ? viewport + .getAlignment().getAlignmentAnnotation() : null, viewport + .getAlignment().getGroups(), viewport.getAlignment() + .getProperties(), viewport.getColumnSelection(), + viewport.getAlignment(), null); + } + + public String printAnnotationsForAlignment(AlignmentI al) + { + return printAnnotations(al.getAlignmentAnnotation(), al.getGroups(), + al.getProperties(), null, al, null); + } } diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index d3b19fa..89adead 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -47,7 +47,9 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FORMATS = new String[] { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", - "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC }; // , "SimpleBLAST" }; + "PDB", "JnetFile", "RNAML", PhylipFile.FILE_DESC, "HTML" }; // , + // "SimpleBLAST" + // }; /** * List of valid format strings for use by callers of the formatSequences @@ -62,16 +64,16 @@ public class AppletFormatAdapter * that are writable by the application. */ public static final String[] WRITABLE_EXTENSIONS = new String[] - { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", - "jvp", "sto,stk", "jar", PhylipFile.FILE_EXT }; + { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", + "sto,stk", PhylipFile.FILE_EXT, "jvp" }; /** * List of writable formats by the application. Order must correspond with the * WRITABLE_EXTENSIONS list of formats. */ public static final String[] WRITABLE_FNAMES = new String[] - { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", - "STH", "Jalview", PhylipFile.FILE_DESC }; + { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "STH", + PhylipFile.FILE_DESC, "Jalview" }; /** * List of readable format file extensions by application in order @@ -79,7 +81,8 @@ public class AppletFormatAdapter */ public static final String[] READABLE_EXTENSIONS = new String[] { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", - "jar,jvp", "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT }; // ".blast" + "jar,jvp", "sto,stk", "xml,rnaml", PhylipFile.FILE_EXT, + "html" }; // ".blast" /** * List of readable formats by application in order corresponding to @@ -87,7 +90,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FNAMES = new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", - "Stockholm", "RNAML", PhylipFile.FILE_DESC };// , + "Stockholm", "RNAML", PhylipFile.FILE_DESC, "HTML" };// , // "SimpleBLAST" // }; @@ -109,7 +112,7 @@ public class AppletFormatAdapter for (int i = 0, iSize = els.length - 1; i < iSize; i++) { list.append(els[i]); - list.append(","); + list.append(", "); } list.append(" and " + els[els.length - 1] + "."); return list.toString(); @@ -268,6 +271,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(inFile, type); } + // else if (format.equals(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(inFile, type); + // } else if (format.equals("RNAML")) { afile = new RnamlFile(inFile, type); @@ -392,6 +399,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(source); } + // else if (format.equals(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(source); + // } Alignment al = new Alignment(afile.getSeqsAsArray()); afile.addAnnotations(al); @@ -527,6 +538,10 @@ public class AppletFormatAdapter { afile = new PhylipFile(); } + // else if (format.equalsIgnoreCase(HtmlFile.FILE_DESC)) + // { + // afile = new HtmlFile(); + // } else if (format.equalsIgnoreCase("RNAML")) { afile = new RnamlFile(); diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java new file mode 100644 index 0000000..db43a3f --- /dev/null +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -0,0 +1,222 @@ +package jalview.io; + +import jalview.api.FeaturesDisplayedI; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.exceptions.NoFileSelectedException; +import jalview.gui.AlignViewport; +import jalview.gui.AlignmentPanel; +import jalview.gui.FeatureRenderer; +import jalview.json.binding.v1.BioJsAlignmentPojo; +import jalview.json.binding.v1.BioJsFeaturePojo; +import jalview.json.binding.v1.BioJsSeqPojo; +import jalview.schemes.ColourSchemeProperty; +import jalview.util.MessageManager; + +import java.awt.Color; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.net.URL; +import java.util.ArrayList; + +import com.json.JSONException; + +public class BioJsHTMLOutput +{ + private AlignViewport av; + + private jalview.api.FeatureRenderer fr; + + private String globalColorScheme; + + private FeaturesDisplayedI displayedFeatures; + + private String jalviewVersion; + + private String webStartLaunchServletUrl = "http://www.jalview.org/services/launchApp"; + + public BioJsHTMLOutput(AlignmentPanel ap, + FeatureRenderer fr1) + { + + jalviewVersion = jalview.bin.Cache.getProperty("VERSION"); + webStartLaunchServletUrl = jalview.bin.Cache.getDefault( + "www.jalview.org", "http://www.jalview.org") + + "/services/launchApp"; + if (ap != null) + { + this.av = ap.av; + this.globalColorScheme = ColourSchemeProperty.getColourName(av + .getGlobalColourScheme()); + this.fr = ap.cloneFeatureRenderer(); + displayedFeatures = av.getFeaturesDisplayed(); + } + } + + private void exportJalviewAlignmentAsBioJsHtmlFile() + { + try + { + String outputFile = getOutputFile(); + String jalviewAlignmentJson = getJalviewAlignmentAsJsonString(av + .getAlignment()); + String bioJSTemplateString = getBioJsTemplateAsString(this); + String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString + .replaceAll( +"#sequenceData#", jalviewAlignmentJson) + .toString(); + + PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter( + outputFile)); + out.print(generatedBioJsWithJalviewAlignmentAsJson); + out.flush(); + out.close(); + jalview.util.BrowserLauncher.openURL("file:///" + outputFile); + } catch (NoFileSelectedException ex) + { + // do noting if no file was selected + } catch (Exception e) + { + e.printStackTrace(); + } + } + + public String getOutputFile() throws NoFileSelectedException + { + String selectedFile = null; + JalviewFileChooser jvFileChooser = new JalviewFileChooser( + jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + { "html" }, new String[] + { "HTML files" }, "HTML files"); + jvFileChooser.setFileView(new JalviewFileView()); + + // TODO uncomment when supported by MassageManager + jvFileChooser.setDialogTitle(MessageManager + .getString("label.save_as_biojs_html")); + jvFileChooser.setDialogTitle("save as BioJs HTML"); + jvFileChooser.setToolTipText(MessageManager.getString("action.save")); + + int fileChooserOpt = jvFileChooser.showSaveDialog(null); + if (fileChooserOpt == JalviewFileChooser.APPROVE_OPTION) + { + jalview.bin.Cache.setProperty("LAST_DIRECTORY", jvFileChooser + .getSelectedFile().getParent()); + selectedFile = jvFileChooser.getSelectedFile().getPath(); + } + else + { + throw new NoFileSelectedException("No file was selected."); + } + + return selectedFile; + } + + public String getJalviewAlignmentAsJsonString(AlignmentI alignment) + throws IOException, JSONException + { + BioJsAlignmentPojo bjsAlignment = new BioJsAlignmentPojo(); + + bjsAlignment.setGlobalColorScheme(getGlobalColorScheme()); + bjsAlignment.setJalviewVersion(jalviewVersion); + bjsAlignment.setWebStartUrl(webStartLaunchServletUrl); + + int count = 0; + for (SequenceI seq : alignment.getSequences()) + { + StringBuilder name = new StringBuilder(); + name.append(seq.getName()).append("/").append(seq.getStart()) + .append("-").append(seq.getEnd()); + + BioJsSeqPojo seqPojo = new BioJsSeqPojo(); + seqPojo.setId(String.valueOf(++count)); + seqPojo.setEnd(seq.getEnd()); + seqPojo.setStart(seq.getStart()); + seqPojo.setName(name.toString()); + seqPojo.setSeq(seq.getSequenceAsString()); + + SequenceFeature[] seqFeatures = seq.getDatasetSequence() + .getSequenceFeatures(); + if (seqFeatures != null) + { + ArrayList bjsSeqFeatures = new ArrayList(); + for (SequenceFeature sf : seqFeatures) + { + if (displayedFeatures != null + && displayedFeatures.isVisible(sf.getType())) + { + + // TODO: translate graduated/complex colourschemes to biojs model + String featureColour = jalview.util.Format.getHexString(fr + .findFeatureColour(Color.white, seq, + seq.findIndex(sf.getBegin()))); + BioJsFeaturePojo bjsFeature = new BioJsFeaturePojo(); + bjsFeature.setFillColor(featureColour); + bjsFeature.setXstart(seq.findIndex(sf.getBegin()) - 1); + bjsFeature.setXend(seq.findIndex(sf.getEnd())); + bjsFeature.setText(sf.getType()); + bjsSeqFeatures.add(bjsFeature); + } + } + seqPojo.setFeatures(bjsSeqFeatures); + } + bjsAlignment.getSeqs().add(seqPojo); + } + + return new com.json.JSONObject(bjsAlignment).toString() + .replaceAll("xstart", "xStart").replaceAll("xend", "xEnd"); + } + + public static String getBioJsTemplateAsString(Object currentObj) + throws IOException + { + InputStreamReader isReader = null; + BufferedReader buffReader = null; + StringBuilder sb = new StringBuilder(); + URL url = currentObj.getClass().getResource( + "/templates/BioJSTemplate.txt"); + if (url != null) + { + try + { + isReader = new InputStreamReader(url.openStream()); + buffReader = new BufferedReader(isReader); + String line; + String lineSeparator = System.getProperty("line.separator"); + while ((line = buffReader.readLine()) != null) + { + sb.append(line).append(lineSeparator); + } + + } catch (Exception ex) + { + ex.printStackTrace(); + } finally + { + if (isReader != null) + { + isReader.close(); + } + + if (buffReader != null) + { + buffReader.close(); + } + } + } + return sb.toString(); + } + + public String getGlobalColorScheme() + { + return globalColorScheme; + } + + public void setGlobalColorScheme(String globalColorScheme) + { + this.globalColorScheme = globalColorScheme; + } + +} diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 87b829f..5b621e7 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -678,7 +678,7 @@ public class FeaturesFile extends AlignFile * hash of feature types and colours * @return features file contents */ - public String printJalviewFormat(SequenceI[] seqs, Hashtable visible) + public String printJalviewFormat(SequenceI[] seqs, Map visible) { return printJalviewFormat(seqs, visible, true, true); } @@ -697,7 +697,7 @@ public class FeaturesFile extends AlignFile * of group or type) * @return features file contents */ - public String printJalviewFormat(SequenceI[] seqs, Hashtable visible, + public String printJalviewFormat(SequenceI[] seqs, Map visible, boolean visOnly, boolean nonpos) { StringBuffer out = new StringBuffer(); @@ -714,11 +714,11 @@ public class FeaturesFile extends AlignFile // write feature colours only if we're given them and we are generating // viewed features // TODO: decide if feature links should also be written here ? - Enumeration en = visible.keys(); + Iterator en = visible.keySet().iterator(); String type, color; - while (en.hasMoreElements()) + while (en.hasNext()) { - type = en.nextElement().toString(); + type = en.next().toString(); if (visible.get(type) instanceof GraduatedColor) { @@ -926,12 +926,12 @@ public class FeaturesFile extends AlignFile * @param visible * @return */ - public String printGFFFormat(SequenceI[] seqs, Hashtable visible) + public String printGFFFormat(SequenceI[] seqs, Map visible) { return printGFFFormat(seqs, visible, true, true); } - public String printGFFFormat(SequenceI[] seqs, Hashtable visible, + public String printGFFFormat(SequenceI[] seqs, Map visible, boolean visOnly, boolean nonpos) { StringBuffer out = new StringBuffer(); diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 82b94c3..0285bf0 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -152,6 +152,7 @@ public class FileLoader implements Runnable public AlignFrame LoadFileWaitTillLoaded(FileParse source, String format) { this.source = source; + file = source.getInFile(); protocol = source.type; this.format = format; @@ -276,7 +277,7 @@ public class FileLoader implements Runnable .println("IMPLEMENTATION ERROR: Cannot read consecutive Jalview XML projects from a stream."); // We read the data anyway - it might make sense. } - alignFrame = new Jalview2XML(raiseGUI).LoadJalviewAlign(file); + alignFrame = new Jalview2XML(raiseGUI).loadJalviewAlign(file); } else { @@ -352,6 +353,11 @@ public class FileLoader implements Runnable { alignFrame.setFileName(file, format); } + if (source instanceof HtmlFile) + { + ((HtmlFile) source).LoadAlignmentFeatures(alignFrame); + + } if (raiseGUI) { // add the window to the GUI diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 8e9a49c..764715f 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -22,8 +22,17 @@ package jalview.io; import jalview.util.MessageManager; -import java.io.*; -import java.net.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.StringReader; +import java.net.MalformedURLException; +import java.net.URL; import java.util.zip.GZIPInputStream; /** @@ -99,7 +108,9 @@ public class FileParse throw new Error(MessageManager.getString("error.implementation_error_null_fileparse")); } if (from == this) + { return; + } index = ++from.index; inFile = from.inFile; suffixSeparator = from.suffixSeparator; @@ -157,7 +168,7 @@ public class FileParse { warningMessage = "Failed to resolve as a GZ stream (" + x.getMessage() + ")"; - x.printStackTrace(); + // x.printStackTrace(); } ; } @@ -281,7 +292,9 @@ public class FileParse { checkURLSource(fileStr); if (suffixSeparator == '#') + { extractSuffix(fileStr); // URL lref is stored for later reference. + } } catch (IOException e) { String suffixLess = extractSuffix(fileStr); @@ -323,7 +336,9 @@ public class FileParse { String suffixLess = extractSuffix(fileStr); if (suffixLess != null) + { is = getClass().getResourceAsStream("/" + suffixLess); + } } if (is != null) { @@ -371,7 +386,9 @@ public class FileParse public String nextLine() throws IOException { if (!error) + { return dataIn.readLine(); + } throw new IOException(MessageManager.formatMessage("exception.invalid_source_stream", new String[]{errormessage})); } diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 8ca0c35..df5353c 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -255,6 +255,41 @@ public class FormatAdapter extends AppletFormatAdapter return this.formatSequences(format, alignment, suffix); } + public Alignment readFile(String inFile, String type, String format) + throws java.io.IOException + { + Alignment al; + if (format.equals("HTML")) + { + afile = new HtmlFile(inFile, type); + al = new Alignment(afile.getSeqsAsArray()); + afile.addAnnotations(al); + } + else + { + al = super.readFile(inFile, type, format); + } + + return al; + } + + public AlignmentI readFromFile(FileParse source, String format) + throws java.io.IOException + { + Alignment al; + if (format.equals("HTML")) + { + afile = new HtmlFile(source); + al = new Alignment(afile.getSeqsAsArray()); + afile.addAnnotations(al); + } + else + { + al = (Alignment) super.readFromFile(source, format); + } + return al; + } + /** * validate format is valid for IO in Application. This is basically the * AppletFormatAdapter.isValidFormat call with additional checks for diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 50b07e4..2d2626f 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -34,7 +34,7 @@ public class HTMLOutput SequenceRenderer sr; - FeatureRenderer fr; + jalview.renderer.seqfeatures.FeatureRenderer fr; Color color; diff --git a/src/jalview/io/HtmlFile.java b/src/jalview/io/HtmlFile.java new file mode 100644 index 0000000..3cb7c3f --- /dev/null +++ b/src/jalview/io/HtmlFile.java @@ -0,0 +1,152 @@ +package jalview.io; + +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceFeature; +import jalview.gui.AlignFrame; +import jalview.json.binding.v1.BioJsAlignmentPojo.JalviewBioJsColorSchemeMapper; +import jalview.schemes.ColourSchemeI; + +import java.io.IOException; +import java.util.Iterator; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; + +public class HtmlFile extends AlignFile +{ + // public static final String FILE_EXT = "html"; + // + // public static final String FILE_DESC = "HTML"; + + private ColourSchemeI cs; + + public HtmlFile() + { + super(); + } + + public HtmlFile(FileParse source) throws IOException + { + super(source); + } + + public HtmlFile(String inFile, String type) throws IOException + { + super(inFile, type); + } + + @SuppressWarnings("unchecked") + @Override + public void parse() throws IOException + { + try + { + StringBuilder htmlData = new StringBuilder(); + String currentLine; + while ((currentLine = nextLine()) != null) + { + htmlData.append(currentLine); + } + + Document doc = Jsoup.parse(htmlData.toString()); + Element content = doc.getElementById("seqData"); + + String alignmentJsonString = content.val(); + JSONParser jsonParser = new JSONParser(); + JSONObject alignmentJsonObj = (JSONObject) jsonParser + .parse(alignmentJsonString); + JSONArray seqJsonArray = (JSONArray) alignmentJsonObj.get("seqs"); + String bioJsColourScheme = (String) alignmentJsonObj + .get("globalColorScheme"); + cs = getJalviewColorScheme(bioJsColourScheme); + + for (Iterator sequenceIter = seqJsonArray.iterator(); sequenceIter + .hasNext();) + { + JSONObject sequence = sequenceIter.next(); + String sequcenceString = sequence.get("seq").toString(); + Sequence seq = new Sequence(sequence.get("name").toString(), + sequcenceString, Integer.valueOf(sequence.get("start") + .toString()), Integer.valueOf(sequence.get("end") + .toString())); + + JSONArray jsonSeqArray = (JSONArray) sequence.get("features"); + SequenceFeature[] retrievedSeqFeatures = getJalviewSequenceFeatures( + jsonSeqArray, seq); + if (retrievedSeqFeatures != null) + { + seq.setSequenceFeatures(retrievedSeqFeatures); + } + seqs.add(seq); + + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + + public SequenceFeature[] getJalviewSequenceFeatures( + JSONArray jsonSeqFeatures, Sequence seq) + { + SequenceFeature[] seqFeatures = null; + int count = 0; + if (jsonSeqFeatures != null) + { + seqFeatures = new SequenceFeature[jsonSeqFeatures.size()]; + for (@SuppressWarnings("unchecked") + Iterator seqFeatureItr = jsonSeqFeatures.iterator(); seqFeatureItr + .hasNext();) + { + + SequenceFeature sequenceFeature = new SequenceFeature(); + JSONObject jsonFeature = seqFeatureItr.next(); + Long begin = (Long) jsonFeature.get("xStart"); + Long end = (Long) jsonFeature.get("xEnd"); + String type = (String) jsonFeature.get("text"); + // String color = (String) jsonFeature.get("fillColor"); + + sequenceFeature.setBegin(seq.findPosition(begin.intValue())); + sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1); + sequenceFeature.setType(type); + seqFeatures[count++] = sequenceFeature; + } + } + return seqFeatures; + } + + public void LoadAlignmentFeatures(AlignFrame af) + { + + af.setShowSeqFeatures(true); + af.changeColour(cs); + af.setMenusForViewport(); + } + + private ColourSchemeI getJalviewColorScheme(String bioJsColourSchemeName) + { + ColourSchemeI jalviewColor = null; + for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper + .values()) + { + if (cs.getBioJsName().equals(bioJsColourSchemeName)) + { + jalviewColor = cs.getJvColourScheme(); + break; + } + } + return jalviewColor; + } + + @Override + public String print() + { + throw new UnsupportedOperationException( + "Print method of HtmlFile not yet supported!"); + } + +} diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java new file mode 100644 index 0000000..3c9c608 --- /dev/null +++ b/src/jalview/io/HtmlSvgOutput.java @@ -0,0 +1,299 @@ +package jalview.io; + +import jalview.datamodel.SequenceI; +import jalview.gui.AlignViewport; +import jalview.gui.AlignmentPanel; +import jalview.gui.AnnotationPanel; +import jalview.gui.FeatureRenderer; +import jalview.gui.HTMLOptions; +import jalview.math.AlignmentDimension; +import jalview.util.MessageManager; + +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.io.File; +import java.io.FileOutputStream; + +import org.jfree.graphics2d.svg.SVGGraphics2D; +import org.jfree.graphics2d.svg.SVGHints; + +public class HtmlSvgOutput +{ + AlignViewport av; + + FeatureRenderer fr; + AlignmentPanel ap; + + AnnotationPanel annotationPanel; + + public HtmlSvgOutput(File file, AlignmentPanel ap) + { + + this.av = ap.av; + this.ap = ap; + this.annotationPanel = ap.getAnnotationPanel(); + generateHtmlSvgOutput(file); + } + + public void generateHtmlSvgOutput(File file) + { + try + { + if (file == null /* + * && !(System.getProperty("java.awt.headless") != null + * && System + * .getProperty("java.awt.headless").equals("true")) + */) + { + + JalviewFileChooser chooser = getHTMLChooser(); + chooser.setFileView(new jalview.io.JalviewFileView()); + chooser.setDialogTitle(ap.alignFrame.getTitle()); + chooser.setToolTipText(MessageManager.getString("action.save")); + int value = chooser.showSaveDialog(ap.alignFrame); + + if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION) + { + jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser + .getSelectedFile().getParent()); + file = chooser.getSelectedFile(); + } + } + + AlignmentDimension aDimension = ap.getAlignmentDimension(); + SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(), + aDimension.getHeight()); + SVGGraphics2D g2 = new SVGGraphics2D(aDimension.getWidth(), + aDimension.getHeight()); + + String renderStyle = jalview.bin.Cache.getDefault("HTML_RENDERING", + "Prompt each time"); + + // If we need to prompt, and if the GUI is visible then + // Prompt for rendering style + if (renderStyle.equalsIgnoreCase("Prompt each time") + && !(System.getProperty("java.awt.headless") != null && System + .getProperty("java.awt.headless").equals("true"))) + { + HTMLOptions svgOption = new HTMLOptions(); + renderStyle = svgOption.getValue(); + + if (renderStyle == null || svgOption.cancelled) + { + return; + } + } + + if (renderStyle.equalsIgnoreCase("lineart")) + { + g1.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE, + SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR); + g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE, + SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR); + } + printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1, + g2); + FileOutputStream out = new FileOutputStream(file); + + String titleSvgData = g1.getSVGDocument(); + String alignSvgData = g2.getSVGDocument(); + String htmlData = getHtml(titleSvgData, alignSvgData); + + out.write(htmlData.getBytes()); + out.flush(); + out.close(); + if (!(System.getProperty("java.awt.headless") != null && System + .getProperty("java.awt.headless").equals("true"))) + { + jalview.util.BrowserLauncher.openURL("file:///" + file); + } + } catch (Exception e) + { + e.printStackTrace(); + } + } + + static JalviewFileChooser getHTMLChooser() + { + return new jalview.io.JalviewFileChooser( + jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] + { "html" }, new String[] + { "Hypertext Markup Language" }, "Hypertext Markup Language"); + } + + public int printUnwrapped(int pwidth, int pheight, int pi, Graphics... pg) + throws PrinterException + { + int idWidth = ap.getVisibleIdWidth(false); + FontMetrics fm = ap.getFontMetrics(av.getFont()); + int scaleHeight = av.getCharHeight() + fm.getDescent(); + + pg[0].setColor(Color.white); + pg[0].fillRect(0, 0, pwidth, pheight); + pg[0].setFont(av.getFont()); + + // ////////////////////////////////// + // / How many sequences and residues can we fit on a printable page? + int totalRes = (pwidth - idWidth) / av.getCharWidth(); + int totalSeq = (pheight - scaleHeight) / av.getCharHeight() - 1; + int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1; + + // /////////////////////////// + // / Only print these sequences and residues on this page + int startRes; + + // /////////////////////////// + // / Only print these sequences and residues on this page + int endRes; + + // /////////////////////////// + // / Only print these sequences and residues on this page + int startSeq; + + // /////////////////////////// + // / Only print these sequences and residues on this page + int endSeq; + startRes = (pi % pagesWide) * totalRes; + endRes = (startRes + totalRes) - 1; + + if (endRes > (av.getAlignment().getWidth() - 1)) + { + endRes = av.getAlignment().getWidth() - 1; + } + startSeq = (pi / pagesWide) * totalSeq; + endSeq = startSeq + totalSeq; + if (endSeq > av.getAlignment().getHeight()) + { + endSeq = av.getAlignment().getHeight(); + } + int pagesHigh = ((av.getAlignment().getHeight() / totalSeq) + 1) + * pheight; + if (av.isShowAnnotation()) + { + pagesHigh += ap.getAnnotationPanel().adjustPanelHeight() + 3; + } + pagesHigh /= pheight; + if (pi >= (pagesWide * pagesHigh)) + { + return Printable.NO_SUCH_PAGE; + } + + // draw Scale + pg[1].translate(0, 0); + ap.getScalePanel().drawScale(pg[1], startRes, endRes, pwidth - idWidth, + scaleHeight); + pg[1].translate(-idWidth, scaleHeight); + + // ////////////// + // Draw the ids + Color currentColor = null; + Color currentTextColor = null; + pg[0].translate(0, scaleHeight); + pg[0].setFont(ap.getIdPanel().getIdCanvas().getIdfont()); + SequenceI seq; + for (int i = startSeq; i < endSeq; i++) + { + seq = av.getAlignment().getSequenceAt(i); + if ((av.getSelectionGroup() != null) + && av.getSelectionGroup().getSequences(null).contains(seq)) + { + currentColor = Color.gray; + currentTextColor = Color.black; + } + else + { + currentColor = av.getSequenceColour(seq); + currentTextColor = Color.black; + } + pg[0].setColor(currentColor); + pg[0].fillRect(0, (i - startSeq) * av.getCharHeight(), idWidth, + av.getCharHeight()); + pg[0].setColor(currentTextColor); + int xPos = 0; + if (av.isRightAlignIds()) + { + fm = pg[0].getFontMetrics(); + xPos = idWidth + - fm.stringWidth(seq.getDisplayId(av.getShowJVSuffix())) + - 4; + } + pg[0].drawString( + seq.getDisplayId(av.getShowJVSuffix()), + xPos, + (((i - startSeq) * av.getCharHeight()) + av.getCharHeight()) + - (av.getCharHeight() / 5)); + } + pg[0].setFont(av.getFont()); + pg[0].translate(idWidth, 0); + + // draw main sequence panel + pg[1].translate(idWidth, 0); + ap.getSeqPanel().seqCanvas.drawPanel(pg[1], startRes, endRes, startSeq, + endSeq, 0); + if (av.isShowAnnotation() && (endSeq == av.getAlignment().getHeight())) + { + // draw annotation label - need to offset for current scroll position + int offset = -ap.getAlabels().getScrollOffset(); + pg[0].translate(0, offset); + pg[0].translate(-idWidth - 3, + (endSeq - startSeq) * av.getCharHeight() + 3); + ap.getAlabels().drawComponent(pg[0], idWidth); + pg[0].translate(idWidth + 3, 0); + pg[0].translate(0, -offset); + + // draw annotation - need to offset for current scroll position + pg[1].translate(0, offset); + pg[1].translate(-idWidth - 3, + (endSeq - startSeq) * av.getCharHeight() + 3); + pg[1].translate(idWidth + 3, 0); + ap.getAnnotationPanel().renderer.drawComponent( + ap.getAnnotationPanel(), av, pg[1], -1, startRes, endRes + 1); + pg[1].translate(0, -offset); + } + + return Printable.PAGE_EXISTS; + } + + private String getHtml(String titleSvg, String alignmentSvg) + { + StringBuilder htmlSvg = new StringBuilder(); + htmlSvg.append("" + + ""); + htmlSvg.append("
    "); + htmlSvg.append( +"
    "); + htmlSvg.append( +"
    ") + .append(titleSvg) + .append("
    ") + .append("
    \n\n\n\n"); + htmlSvg.append( +"
    "); + htmlSvg.append( + "
    ") + .append(alignmentSvg) +.append("
    ") + .append("
    "); + htmlSvg.append("
    "); + + htmlSvg.append("\n" + + "\n" + + ""); + + return htmlSvg.toString(); + } +} diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 9c7478b..4fb2516 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -136,8 +136,14 @@ public class IdentifyFile break; } + // if (data.matches("<(\"[^\"]*\"|'[^']*'|[^'\">])*>")) + if (data.matches("<(?i)html(\"[^\"]*\"|'[^']*'|[^'\">])*>")) + { + reply = "HTML"; + break; + } - if ((data.indexOf("<") > -1)) + if (data.matches("<(?i)rnaml (\"[^\"]*\"|'[^']*'|[^'\">])*>")) { reply = "RNAML"; @@ -275,6 +281,7 @@ public class IdentifyFile break; } + /* * // TODO comment out SimpleBLAST identification for Jalview 2.4.1 else * if (!lineswereskipped && data.indexOf("BLAST")<4) { reply = @@ -320,6 +327,7 @@ public class IdentifyFile public static void main(String[] args) { + for (int i = 0; args != null && i < args.length; i++) { IdentifyFile ider = new IdentifyFile(); diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index 6fba9c6..1757239 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -22,6 +22,7 @@ package jalview.io; import java.util.ArrayList; import java.util.Hashtable; +import java.util.List; import java.util.Vector; import jalview.datamodel.DBRefEntry; @@ -54,30 +55,30 @@ public class SequenceAnnotationReport * TODO refactor to Jalview 'utilities' somehow. */ public void appendFeatures(final StringBuffer tooltipText2, int rpos, - SequenceFeature[] features) + List features) { appendFeatures(tooltipText2, rpos, features, null); } public void appendFeatures(final StringBuffer tooltipText2, int rpos, - SequenceFeature[] features, Hashtable minmax) + List features, Hashtable minmax) { String tmpString; if (features != null) { - for (int i = 0; i < features.length; i++) + for (SequenceFeature feature:features) { - if (features[i].getType().equals("disulfide bond")) + if (feature.getType().equals("disulfide bond")) { - if (features[i].getBegin() == rpos - || features[i].getEnd() == rpos) + if (feature.getBegin() == rpos + || feature.getEnd() == rpos) { if (tooltipText2.length() > 6) { tooltipText2.append("
    "); } - tooltipText2.append("disulfide bond " + features[i].getBegin() - + ":" + features[i].getEnd()); + tooltipText2.append("disulfide bond " + feature.getBegin() + + ":" + feature.getEnd()); } } else @@ -87,25 +88,25 @@ public class SequenceAnnotationReport tooltipText2.append("
    "); } // TODO: remove this hack to display link only features - boolean linkOnly = features[i].getValue("linkonly") != null; + boolean linkOnly = feature.getValue("linkonly") != null; if (!linkOnly) { - tooltipText2.append(features[i].getType() + " "); + tooltipText2.append(feature.getType() + " "); if (rpos != 0) { // we are marking a positional feature - tooltipText2.append(features[i].begin); + tooltipText2.append(feature.begin); } - if (features[i].begin != features[i].end) + if (feature.begin != feature.end) { - tooltipText2.append(" " + features[i].end); + tooltipText2.append(" " + feature.end); } - if (features[i].getDescription() != null - && !features[i].description.equals(features[i] + if (feature.getDescription() != null + && !feature.description.equals(feature .getType())) { - tmpString = features[i].getDescription(); + tmpString = feature.getDescription(); String tmp2up = tmpString.toUpperCase(); int startTag = tmp2up.indexOf(""); if (startTag > -1) @@ -150,27 +151,27 @@ public class SequenceAnnotationReport } } // check score should be shown - if (features[i].getScore() != Float.NaN) + if (feature.getScore() != Float.NaN) { float[][] rng = (minmax == null) ? null : ((float[][]) minmax - .get(features[i].getType())); + .get(feature.getType())); if (rng != null && rng[0] != null && rng[0][0] != rng[0][1]) { - tooltipText2.append(" Score=" + features[i].getScore()); + tooltipText2.append(" Score=" + feature.getScore()); } } - if (features[i].getValue("status") != null) + if (feature.getValue("status") != null) { - String status = features[i].getValue("status").toString(); + String status = feature.getValue("status").toString(); if (status.length() > 0) { - tooltipText2.append("; (" + features[i].getValue("status") + tooltipText2.append("; (" + feature.getValue("status") + ")"); } } } } - if (features[i].links != null) + if (feature.links != null) { if (linkImageURL != null) { @@ -178,7 +179,7 @@ public class SequenceAnnotationReport } else { - for (String urlstring : (Vector) features[i].links) + for (String urlstring : (Vector) feature.links) { try { @@ -364,7 +365,6 @@ public class SequenceAnnotationReport // ADD NON POSITIONAL SEQUENCE INFO SequenceFeature[] features = ds.getSequenceFeatures(); - SequenceFeature[] tfeat = new SequenceFeature[1]; if (showNpFeats && features != null) { for (int i = 0; i < features.length; i++) @@ -372,7 +372,8 @@ public class SequenceAnnotationReport if (features[i].begin == 0 && features[i].end == 0) { int sz = -tip.length(); - tfeat[0] = features[i]; + List tfeat = new ArrayList(); + tfeat.add(features[i]); appendFeatures(tip, 0, tfeat, minmax); sz += tip.length(); maxWidth = Math.max(maxWidth, sz); diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index 6293a1b..90447db 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -1304,7 +1304,7 @@ public class VamsasAppDatastore }; if (dojvsync) { - fromxml.LoadJalviewAlign(jprovider); + fromxml.loadJalviewAlign(jprovider); } } catch (Exception e) { @@ -1352,7 +1352,7 @@ public class VamsasAppDatastore }; if (dojvsync) { - fromxml.LoadJalviewAlign(jarstream); + fromxml.loadJalviewAlign(jarstream); } } catch (Exception e) { @@ -1498,7 +1498,7 @@ public class VamsasAppDatastore jxml.setSkipList(skipList); if (dojvsync) { - jxml.SaveState(new JarOutputStream(cappdata + jxml.saveState(new JarOutputStream(cappdata .getClientOutputStream())); } diff --git a/src/jalview/io/packed/ParsePackedSet.java b/src/jalview/io/packed/ParsePackedSet.java index df1acf1..8980e2c 100644 --- a/src/jalview/io/packed/ParsePackedSet.java +++ b/src/jalview/io/packed/ParsePackedSet.java @@ -123,8 +123,9 @@ public class ParsePackedSet { br = new BufferedReader(src.getReader()); } + // TODO: add columnSelection to context if (new jalview.io.AnnotationFile().parseAnnotationFrom( - context.getLastAlignment(), br)) + context.getLastAlignment(), null, br)) { context.updateSetModified(true); } diff --git a/src/jalview/javascript/MouseOverStructureListener.java b/src/jalview/javascript/MouseOverStructureListener.java index 465a672..2ecaf6c 100644 --- a/src/jalview/javascript/MouseOverStructureListener.java +++ b/src/jalview/javascript/MouseOverStructureListener.java @@ -202,7 +202,7 @@ public class MouseOverStructureListener extends JSFunctionExec implements SequenceRenderer sr = ((jalview.appletgui.AlignmentPanel) source) .getSequenceRenderer(); FeatureRenderer fr = ((jalview.appletgui.AlignmentPanel) source).av - .getShowSequenceFeatures() ? new jalview.appletgui.FeatureRenderer( + .isShowSequenceFeatures() ? new jalview.appletgui.FeatureRenderer( ((jalview.appletgui.AlignmentPanel) source).av) : null; if (fr != null) { diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 387bb7f..4ecedaf 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -214,6 +214,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem createPNG = new JMenuItem(); + JMenuItem createBioJS = new JMenuItem(); + JMenuItem createSVG = new JMenuItem(); protected JMenuItem font = new JMenuItem(); @@ -266,6 +268,8 @@ public class GAlignFrame extends JInternalFrame JMenuItem annotationColour = new JMenuItem(); + JMenuItem annotationColumn = new JMenuItem(); + protected JMenuItem rnahelicesColour = new JMenuItem(); JMenuItem associatedData = new JMenuItem(); @@ -1197,6 +1201,19 @@ public class GAlignFrame extends JInternalFrame htmlMenuItem_actionPerformed(e); } }); + + // TODO uncomment when supported by MassageManager + // createBioJS.setText(MessageManager.getString("label.biojs_html_export")); + createBioJS.setText("BioJS"); + createBioJS.addActionListener(new java.awt.event.ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + bioJSMenuItem_actionPerformed(e); + } + }); + overviewMenuItem.setText(MessageManager .getString("label.overview_window")); overviewMenuItem.addActionListener(new java.awt.event.ActionListener() @@ -1603,7 +1620,6 @@ public class GAlignFrame extends JInternalFrame font_actionPerformed(e); } }); - seqLimits.setText(MessageManager .getString("label.show_sequence_limits")); seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true)); @@ -1860,6 +1876,17 @@ public class GAlignFrame extends JInternalFrame } }); + annotationColumn.setText(MessageManager + .getString("action.select_by_annotation")); + annotationColumn.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + annotationColumn_actionPerformed(e); + } + }); + rnahelicesColour.setText(MessageManager .getString("action.by_rna_helixes")); rnahelicesColour.addActionListener(new ActionListener() @@ -2353,6 +2380,7 @@ public class GAlignFrame extends JInternalFrame jMenu2.add(htmlMenuItem); jMenu2.add(epsFile); jMenu2.add(createPNG); + jMenu2.add(createBioJS); jMenu2.add(createSVG); addSequenceMenu.add(addFromFile); addSequenceMenu.add(addFromText); @@ -2393,6 +2421,7 @@ public class GAlignFrame extends JInternalFrame selectMenu.add(unGroup); selectMenu.add(grpsFromSelection); selectMenu.add(deleteGroups); + selectMenu.add(annotationColumn); calculateMenu.add(expandAlignment); // TODO - determine if the listenToViewSelections button is needed : see bug // JAL-574 @@ -2611,6 +2640,11 @@ public class GAlignFrame extends JInternalFrame { } + protected void bioJSMenuItem_actionPerformed(ActionEvent e) + { + + } + protected void closeMenuItem_actionPerformed(boolean b) { } @@ -2966,6 +3000,11 @@ public class GAlignFrame extends JInternalFrame } + public void annotationColumn_actionPerformed(ActionEvent e) + { + + } + public void rnahelicesColour_actionPerformed(ActionEvent e) { diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 610f32e..3596619 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -21,7 +21,7 @@ package jalview.jbgui; import jalview.gui.JvSwingUtils; -import jalview.gui.StructureViewer.Viewer; +import jalview.gui.StructureViewer.ViewerType; import jalview.util.MessageManager; import java.awt.BorderLayout; @@ -780,8 +780,8 @@ public class GPreferences extends JPanel structViewer.setFont(verdana11); structViewer.setBounds(new Rectangle(160, ypos, 120, height)); - structViewer.addItem(Viewer.JMOL.name()); - structViewer.addItem(Viewer.CHIMERA.name()); + structViewer.addItem(ViewerType.JMOL.name()); + structViewer.addItem(ViewerType.CHIMERA.name()); structViewer.addActionListener(new ActionListener() { @Override diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 58b2eb1..24e7ee3 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -20,6 +20,7 @@ */ package jalview.jbgui; +import jalview.api.structures.JalviewStructureDisplayI; import jalview.util.MessageManager; import java.awt.event.ActionEvent; @@ -32,8 +33,52 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JRadioButtonMenuItem; -public class GStructureViewer extends JInternalFrame +public abstract class GStructureViewer extends JInternalFrame implements + JalviewStructureDisplayI { + // private AAStructureBindingModel bindingModel; + + protected JMenu savemenu = new JMenu(); + + protected JMenu viewMenu = new JMenu(); + + protected JMenu chainMenu = new JMenu(); + + protected JMenu viewerActionMenu = new JMenu(); + + protected JMenuItem alignStructs = new JMenuItem(); + + protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem(); + + protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem(); + + protected JMenuItem helpItem = new JMenuItem(); + + /** + * Constructor + */ public GStructureViewer() { try @@ -47,10 +92,16 @@ public class GStructureViewer extends JInternalFrame private void jbInit() throws Exception { + JMenuBar menuBar = new JMenuBar(); this.setJMenuBar(menuBar); + + JMenu fileMenu = new JMenu(); fileMenu.setText(MessageManager.getString("action.file")); + savemenu.setActionCommand(MessageManager.getString("action.save_image")); savemenu.setText(MessageManager.getString("action.save_as")); + + JMenuItem pdbFile = new JMenuItem(); pdbFile.setText(MessageManager.getString("label.pdb_file")); pdbFile.addActionListener(new ActionListener() { @@ -59,6 +110,8 @@ public class GStructureViewer extends JInternalFrame pdbFile_actionPerformed(actionEvent); } }); + + JMenuItem png = new JMenuItem(); png.setText("PNG"); png.addActionListener(new ActionListener() { @@ -67,6 +120,8 @@ public class GStructureViewer extends JInternalFrame png_actionPerformed(actionEvent); } }); + + JMenuItem eps = new JMenuItem(); eps.setText("EPS"); eps.addActionListener(new ActionListener() { @@ -75,6 +130,8 @@ public class GStructureViewer extends JInternalFrame eps_actionPerformed(actionEvent); } }); + + JMenuItem viewMapping = new JMenuItem(); viewMapping.setText(MessageManager.getString("label.view_mapping")); viewMapping.addActionListener(new ActionListener() { @@ -85,7 +142,11 @@ public class GStructureViewer extends JInternalFrame }); viewMenu.setText(MessageManager.getString("action.view")); chainMenu.setText(MessageManager.getString("action.show_chain")); + + JMenu colourMenu = new JMenu(); colourMenu.setText(MessageManager.getString("label.colours")); + + JMenuItem backGround = new JMenuItem(); backGround.setText(MessageManager.getString("label.background_colour") + "..."); backGround.addActionListener(new ActionListener() @@ -207,6 +268,8 @@ public class GStructureViewer extends JInternalFrame viewerColour_actionPerformed(actionEvent); } }); + + JMenu helpMenu = new JMenu(); helpMenu.setText(MessageManager.getString("action.help")); helpItem.setText(MessageManager.getString("label.jmol_help")); helpItem.addActionListener(new ActionListener() @@ -254,6 +317,8 @@ public class GStructureViewer extends JInternalFrame colourMenu.add(viewerColour); colourMenu.add(backGround); + ButtonGroup colourButtons = new ButtonGroup(); + colourButtons.add(seqColour); colourButtons.add(chainColour); colourButtons.add(chargeColour); @@ -279,66 +344,6 @@ public class GStructureViewer extends JInternalFrame { } - JMenuBar menuBar = new JMenuBar(); - - JMenu fileMenu = new JMenu(); - - protected JMenu savemenu = new JMenu(); - - JMenuItem pdbFile = new JMenuItem(); - - JMenuItem png = new JMenuItem(); - - JMenuItem eps = new JMenuItem(); - - JMenuItem viewMapping = new JMenuItem(); - - protected JMenu viewMenu = new JMenu(); - - protected JMenu chainMenu = new JMenu(); - - JMenu jMenu1 = new JMenu(); - - protected JMenu colourMenu = new JMenu(); - - protected JMenu viewerActionMenu = new JMenu(); - - protected JMenuItem alignStructs = new JMenuItem(); - - JMenuItem backGround = new JMenuItem(); - - protected JRadioButtonMenuItem seqColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem chainColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem chargeColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem hydroColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem userColour = new JRadioButtonMenuItem(); - - protected JRadioButtonMenuItem viewerColour = new JRadioButtonMenuItem(); - - protected ButtonGroup colourButtons = new ButtonGroup(); - - JMenu helpMenu = new JMenu(); - - protected JMenuItem helpItem = new JMenuItem(); - public void pdbFile_actionPerformed(ActionEvent actionEvent) { @@ -428,4 +433,14 @@ public class GStructureViewer extends JInternalFrame { } + + // { + // return bindingModel; + // } + + // public void setBindingModel(AAStructureBindingModel bindingModel) + // { + // this.bindingModel = bindingModel; + // } + } diff --git a/src/jalview/json/binding/v1/BioJsAlignmentPojo.java b/src/jalview/json/binding/v1/BioJsAlignmentPojo.java new file mode 100644 index 0000000..8e8747f --- /dev/null +++ b/src/jalview/json/binding/v1/BioJsAlignmentPojo.java @@ -0,0 +1,151 @@ +package jalview.json.binding.v1; + +import jalview.schemes.Blosum62ColourScheme; +import jalview.schemes.BuriedColourScheme; +import jalview.schemes.ColourSchemeI; +import jalview.schemes.HelixColourScheme; +import jalview.schemes.HydrophobicColourScheme; +import jalview.schemes.NucleotideColourScheme; +import jalview.schemes.PIDColourScheme; +import jalview.schemes.PurinePyrimidineColourScheme; +import jalview.schemes.RNAInteractionColourScheme; +import jalview.schemes.StrandColourScheme; +import jalview.schemes.TaylorColourScheme; +import jalview.schemes.TurnColourScheme; +import jalview.schemes.ZappoColourScheme; + +import java.util.ArrayList; + +public class BioJsAlignmentPojo +{ + private String globalColorScheme = "none"; + + private String jalviewVersion; + + private String webStartUrl; + private ArrayList seqs = new ArrayList(); + + public BioJsAlignmentPojo() + { + + } + public ArrayList getSeqs() + { + return seqs; + } + + public void setSeqs(ArrayList seqs) + { + this.seqs = seqs; + } + public String getGlobalColorScheme() + { + return globalColorScheme; + } + public void setGlobalColorScheme(String globalColorScheme) + { + for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper + .values()) + { + if (cs.getJalviewName().equals(globalColorScheme)) + { + this.globalColorScheme = cs.getBioJsName(); + break; + } + } + + // JALVIEW colors not in biojs + // Blosum62 + // T-Coffee Scores (almost same with Blosom62 + // RNA Interaction type - no color applied + // RNA Helices - missing + + // BIOJS Colour not in jalview + // schemes.push name: "Lesk", id: "lesk" + // schemes.push name: "Cinema", id: "cinema" + // schemes.push name: "MAE", id: "mae" + // schemes.push name: "Clustal2", id: "clustal2" + + } + + + public String getJalviewVersion() + { + return jalviewVersion; + } + + public void setJalviewVersion(String jalviewVersion) + { + this.jalviewVersion = jalviewVersion; + } + + public String getWebStartUrl() + { + return webStartUrl; + } + + public void setWebStartUrl(String webStartUrl) + { + this.webStartUrl = webStartUrl; + } + + public enum JalviewBioJsColorSchemeMapper + { + USER_DEFINED("User Defined", "user defined", null), NONE("None", "foo", + null), CLUSTAL("Clustal", "clustal", null), ZAPPO("Zappo", + "zappo", new ZappoColourScheme()), TAYLOR( + "Taylor", "taylor", new TaylorColourScheme()), NUCLEOTIDE( + "Nucleotide", "nucleotide", new NucleotideColourScheme()), PURINE_PYRIMIDINE( + "Purine/Pyrimidine", "purine", + new PurinePyrimidineColourScheme()), HELIX_PROPENCITY( + "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY( + "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY( + "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX( + "Buried Index", "buried", new BuriedColourScheme()), HYDROPHOBIC( + "Hydrophobic", "hydro", new HydrophobicColourScheme()), + + // The color types below are not yet supported by BioJs MSA viewer + T_COFFE_SCORES("T-Coffee Scores", "T-Coffee Scores", + null), RNA_INT_TYPE( + "RNA Interaction type", "RNA Interaction type", + new RNAInteractionColourScheme()), BLOSUM62("Blosum62", + "Blosum62", new Blosum62ColourScheme()), RNA_HELICES( + "RNA Helices", "RNA Helices", null), PERCENTAGE_IDENTITY( + "% Identity", "pid", + new PIDColourScheme()); + + private String jalviewName; + private String bioJsName; + + private ColourSchemeI jvColourScheme; + + private JalviewBioJsColorSchemeMapper(String jalviewName, + String bioJsName, ColourSchemeI jvColourScheme) + { + this.jalviewName = jalviewName; + this.bioJsName = bioJsName; + this.setJvColourScheme(jvColourScheme); + } + + public String getJalviewName() + { + return jalviewName; + } + + public String getBioJsName() + { + return bioJsName; + } + + public ColourSchemeI getJvColourScheme() + { + return jvColourScheme; + } + + public void setJvColourScheme(ColourSchemeI jvColourScheme) + { + this.jvColourScheme = jvColourScheme; + } + + } +} diff --git a/src/jalview/json/binding/v1/BioJsFeaturePojo.java b/src/jalview/json/binding/v1/BioJsFeaturePojo.java new file mode 100644 index 0000000..3c2fdda --- /dev/null +++ b/src/jalview/json/binding/v1/BioJsFeaturePojo.java @@ -0,0 +1,60 @@ +package jalview.json.binding.v1; + +public class BioJsFeaturePojo +{ + + private int xstart; + + private int xend; + + private String text; + + private String fillColor; + + public BioJsFeaturePojo() + { + } + + + public String getText() + { + return text; + } + + public void setText(String text) + { + this.text = text; + } + + public String getFillColor() + { + return "#" + fillColor; + } + + public void setFillColor(String fillColor) + { + this.fillColor = fillColor; + } + + public int getXstart() + { + return xstart; + } + + public void setXstart(int xstart) + { + this.xstart = xstart; + } + + public int getXend() + { + return xend; + } + + public void setXend(int xend) + { + this.xend = xend; + } + + +} diff --git a/src/jalview/json/binding/v1/BioJsSeqPojo.java b/src/jalview/json/binding/v1/BioJsSeqPojo.java new file mode 100644 index 0000000..bac8601 --- /dev/null +++ b/src/jalview/json/binding/v1/BioJsSeqPojo.java @@ -0,0 +1,90 @@ +package jalview.json.binding.v1; + +import java.util.ArrayList; + + +public class BioJsSeqPojo +{ + private String seq; + + private String name; + + private String id; + + private int start; + + private int end; + + private ArrayList features = new ArrayList(); + + public BioJsSeqPojo() + { + } + + public BioJsSeqPojo(int start, int end, String id, String name, String seq) + { + this.id = id; + this.name = name; + this.seq = seq; + } + public String getSeq() + { + return seq; + } + + public void setSeq(String seq) + { + this.seq = seq; + } + + public String getName() + { + + return name; + } + + public void setName(String name) + { + this.name = name; + } + + public String getId() + { + return id; + } + + public void setId(String id) + { + this.id = id; + } + + public int getStart() + { + return start; + } + + public void setStart(int start) + { + this.start = start; + } + + public int getEnd() + { + return end; + } + + public void setEnd(int end) + { + this.end = end; + } + + public ArrayList getFeatures() + { + return features; + } + + public void setFeatures(ArrayList features) + { + this.features = features; + } +} diff --git a/src/jalview/math/AlignmentDimension.java b/src/jalview/math/AlignmentDimension.java new file mode 100644 index 0000000..ea3abf4 --- /dev/null +++ b/src/jalview/math/AlignmentDimension.java @@ -0,0 +1,35 @@ +package jalview.math; + +public class AlignmentDimension +{ + private int width; + + private int height; + + public AlignmentDimension(int width, int height) + { + this.width = width; + this.height = height; + } + + public int getWidth() + { + return width; + } + + public void setWidth(int width) + { + this.width = width; + } + + public int getHeight() + { + return height; + } + + public void setHeight(int height) + { + this.height = height; + } + +} diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java new file mode 100644 index 0000000..5e6ac29 --- /dev/null +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -0,0 +1,435 @@ +package jalview.renderer.seqfeatures; + +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +public class FeatureRenderer extends + jalview.viewmodel.seqfeatures.FeatureRendererModel +{ + + FontMetrics fm; + + int charOffset; + + boolean offscreenRender = false; + + /** + * DOCUMENT ME! + * + * @param g + * DOCUMENT ME! + * @param seq + * DOCUMENT ME! + * @param sg + * DOCUMENT ME! + * @param start + * DOCUMENT ME! + * @param end + * DOCUMENT ME! + * @param x1 + * DOCUMENT ME! + * @param y1 + * DOCUMENT ME! + * @param width + * DOCUMENT ME! + * @param height + * DOCUMENT ME! + */ + protected SequenceI lastSeq; + + char s; + + int i; + + int av_charHeight, av_charWidth; + + boolean av_validCharWidth, av_isShowSeqFeatureHeight; + + protected void updateAvConfig() + { + av_charHeight = av.getCharHeight(); + av_charWidth = av.getCharWidth(); + av_validCharWidth = av.isValidCharWidth(); + av_isShowSeqFeatureHeight = av.isShowSequenceFeaturesHeight(); + } + + void renderFeature(Graphics g, SequenceI seq, int fstart, int fend, + Color featureColour, int start, int end, int y1) + { + updateAvConfig(); + if (((fstart <= end) && (fend >= start))) + { + if (fstart < start) + { // fix for if the feature we have starts before the sequence start, + fstart = start; // but the feature end is still valid!! + } + + if (fend >= end) + { + fend = end; + } + int pady = (y1 + av_charHeight) - av_charHeight / 5; + for (i = fstart; i <= fend; i++) + { + s = seq.getCharAt(i); + + if (jalview.util.Comparison.isGap(s)) + { + continue; + } + + g.setColor(featureColour); + + g.fillRect((i - start) * av_charWidth, y1, av_charWidth, + av_charHeight); + + if (offscreenRender || !av_validCharWidth) + { + continue; + } + + g.setColor(Color.white); + charOffset = (av_charWidth - fm.charWidth(s)) / 2; + g.drawString(String.valueOf(s), charOffset + + (av_charWidth * (i - start)), pady); + + } + } + } + + void renderScoreFeature(Graphics g, SequenceI seq, int fstart, int fend, + Color featureColour, int start, int end, int y1, byte[] bs) + { + updateAvConfig(); + if (((fstart <= end) && (fend >= start))) + { + if (fstart < start) + { // fix for if the feature we have starts before the sequence start, + fstart = start; // but the feature end is still valid!! + } + + if (fend >= end) + { + fend = end; + } + int pady = (y1 + av_charHeight) - av_charHeight / 5; + int ystrt = 0, yend = av_charHeight; + if (bs[0] != 0) + { + // signed - zero is always middle of residue line. + if (bs[1] < 128) + { + yend = av_charHeight * (128 - bs[1]) / 512; + ystrt = av_charHeight - yend / 2; + } + else + { + ystrt = av_charHeight / 2; + yend = av_charHeight * (bs[1] - 128) / 512; + } + } + else + { + yend = av_charHeight * bs[1] / 255; + ystrt = av_charHeight - yend; + + } + for (i = fstart; i <= fend; i++) + { + s = seq.getCharAt(i); + + if (jalview.util.Comparison.isGap(s)) + { + continue; + } + + g.setColor(featureColour); + int x = (i - start) * av_charWidth; + g.drawRect(x, y1, av_charWidth, av_charHeight); + g.fillRect(x, y1 + ystrt, av_charWidth, yend); + + if (offscreenRender || !av_validCharWidth) + { + continue; + } + + g.setColor(Color.black); + charOffset = (av_charWidth - fm.charWidth(s)) / 2; + g.drawString(String.valueOf(s), charOffset + + (av_charWidth * (i - start)), pady); + + } + } + } + + BufferedImage offscreenImage; + + public Color findFeatureColour(Color initialCol, SequenceI seq, int res) + { + return new Color(findFeatureColour(initialCol.getRGB(), seq, res)); + } + + /** + * This is used by the Molecule Viewer and Overview to get the accurate + * colourof the rendered sequence + */ + public synchronized int findFeatureColour(int initialCol, final SequenceI seq, + int column) + { + if (!av.isShowSequenceFeatures()) + { + return initialCol; + } + + final SequenceI aseq = (seq.getDatasetSequence() != null) ? seq + .getDatasetSequence() : seq; + if (seq != lastSeq) + { + lastSeq = seq; + sequenceFeatures = aseq.getSequenceFeatures(); + if (sequenceFeatures != null) + { + sfSize = sequenceFeatures.length; + } + } + else + { + if (sequenceFeatures != aseq.getSequenceFeatures()) + { + sequenceFeatures = aseq.getSequenceFeatures(); + if (sequenceFeatures != null) + { + sfSize = sequenceFeatures.length; + } + } + } + + if (sequenceFeatures == null || sfSize == 0) + { + return initialCol; + } + + if (jalview.util.Comparison.isGap(lastSeq.getCharAt(column))) + { + return Color.white.getRGB(); + } + + // Only bother making an offscreen image if transparency is applied + if (transparency != 1.0f && offscreenImage == null) + { + offscreenImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB); + } + + currentColour = null; + // TODO: non-threadsafe - each rendering thread needs its own instance of + // the feature renderer - or this should be synchronized. + offscreenRender = true; + + if (offscreenImage != null) + { + offscreenImage.setRGB(0, 0, initialCol); + drawSequence(offscreenImage.getGraphics(), lastSeq, column, column, 0); + + return offscreenImage.getRGB(0, 0); + } + else + { + drawSequence(null, lastSeq, lastSeq.findPosition(column), -1, -1); + + if (currentColour == null) + { + return initialCol; + } + else + { + return ((Integer) currentColour).intValue(); + } + } + + } + + private volatile SequenceFeature[] sequenceFeatures; + + int sfSize; + + int sfindex; + + int spos; + + int epos; + + public synchronized void drawSequence(Graphics g, final SequenceI seq, + int start, int end, int y1) + { + final SequenceI aseq = (seq.getDatasetSequence() != null) ? seq + .getDatasetSequence() : seq; + if (aseq.getSequenceFeatures() == null + || aseq.getSequenceFeatures().length == 0) + { + return; + } + + if (g != null) + { + fm = g.getFontMetrics(); + } + + updateFeatures(); + + if (lastSeq == null || seq != lastSeq + || aseq.getSequenceFeatures() != sequenceFeatures) + { + lastSeq = seq; + sequenceFeatures = aseq.getSequenceFeatures(); + } + + if (transparency != 1 && g != null) + { + Graphics2D g2 = (Graphics2D) g; + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, + transparency)); + } + + if (!offscreenRender) + { + spos = lastSeq.findPosition(start); + epos = lastSeq.findPosition(end); + } + + sfSize = sequenceFeatures.length; + String type; + for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++) + { + type = renderOrder[renderIndex]; + + if (type == null || !showFeatureOfType(type)) + { + continue; + } + + // loop through all features in sequence to find + // current feature to render + for (sfindex = 0; sfindex < sfSize; sfindex++) + { + if (!sequenceFeatures[sfindex].type.equals(type)) + { + continue; + } + + if (featureGroups != null + && sequenceFeatures[sfindex].featureGroup != null + && sequenceFeatures[sfindex].featureGroup.length() != 0 + && featureGroups + .containsKey(sequenceFeatures[sfindex].featureGroup) + && !featureGroups + .get(sequenceFeatures[sfindex].featureGroup) + .booleanValue()) + { + continue; + } + + if (!offscreenRender + && (sequenceFeatures[sfindex].getBegin() > epos || sequenceFeatures[sfindex] + .getEnd() < spos)) + { + continue; + } + + if (offscreenRender && offscreenImage == null) + { + if (sequenceFeatures[sfindex].begin <= start + && sequenceFeatures[sfindex].end >= start) + { + // this is passed out to the overview and other sequence renderers + // (e.g. molecule viewer) to get displayed colour for rendered + // sequence + currentColour = new Integer( + getColour(sequenceFeatures[sfindex]).getRGB()); + // used to be retreived from av.featuresDisplayed + // currentColour = av.featuresDisplayed + // .get(sequenceFeatures[sfindex].type); + + } + } + else if (sequenceFeatures[sfindex].type.equals("disulfide bond")) + { + + renderFeature(g, seq, + seq.findIndex(sequenceFeatures[sfindex].begin) - 1, + seq.findIndex(sequenceFeatures[sfindex].begin) - 1, + getColour(sequenceFeatures[sfindex]) + // new Color(((Integer) av.featuresDisplayed + // .get(sequenceFeatures[sfindex].type)).intValue()) + , start, end, y1); + renderFeature(g, seq, + seq.findIndex(sequenceFeatures[sfindex].end) - 1, + seq.findIndex(sequenceFeatures[sfindex].end) - 1, + getColour(sequenceFeatures[sfindex]) + // new Color(((Integer) av.featuresDisplayed + // .get(sequenceFeatures[sfindex].type)).intValue()) + , start, end, y1); + + } + else if (showFeature(sequenceFeatures[sfindex])) + { + if (av_isShowSeqFeatureHeight + && sequenceFeatures[sfindex].score != Float.NaN) + { + renderScoreFeature(g, seq, + seq.findIndex(sequenceFeatures[sfindex].begin) - 1, + seq.findIndex(sequenceFeatures[sfindex].end) - 1, + getColour(sequenceFeatures[sfindex]), start, end, y1, + normaliseScore(sequenceFeatures[sfindex])); + } + else + { + renderFeature(g, seq, + seq.findIndex(sequenceFeatures[sfindex].begin) - 1, + seq.findIndex(sequenceFeatures[sfindex].end) - 1, + getColour(sequenceFeatures[sfindex]), start, end, y1); + } + } + + } + + } + + if (transparency != 1.0f && g != null && transparencyAvailable) + { + Graphics2D g2 = (Graphics2D) g; + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, + 1.0f)); + } + } + + boolean transparencyAvailable = true; + + protected void setTransparencyAvailable(boolean isTransparencyAvailable) + { + transparencyAvailable = isTransparencyAvailable; + } + + @Override + public boolean isTransparencyAvailable() + { + return transparencyAvailable; + } + + /** + * Called when alignment in associated view has new/modified features to + * discover and display. + * + */ + public void featuresAdded() + { + lastSeq = null; + findAllFeatures(); + } +} diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index efad430..85ec3aec0 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -258,7 +258,7 @@ public class AnnotationColourGradient extends FollowerColourScheme public Color findColour(char c, int j, SequenceI seq) { Color currentColour = Color.white; - AlignmentAnnotation annotation = (seqAssociated ? seqannot.get(seq) + AlignmentAnnotation annotation = (seqAssociated && seqannot!=null ? seqannot.get(seq) : this.annotation); if (annotation == null) { diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index 41f7781..70c7685 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -21,14 +21,13 @@ package jalview.schemes; import jalview.analysis.AAFrequency; - -import java.awt.Color; -import java.util.Map; - import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.SequenceCollectionI; import jalview.datamodel.SequenceI; +import java.awt.Color; +import java.util.Map; + public class Blosum62ColourScheme extends ResidueColourScheme { public Blosum62ColourScheme() @@ -59,6 +58,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme if (max.indexOf(res) > -1) { + // TODO use a constant here? currentColour = new Color(154, 154, 255); } else @@ -74,6 +74,7 @@ public class Blosum62ColourScheme extends ResidueColourScheme if (c > 0) { + // TODO use a constant here? currentColour = new Color(204, 204, 255); } else diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 8acf1f2..d13f0a9 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -20,6 +20,7 @@ */ package jalview.schemes; +import jalview.analysis.scoremodels.FeatureScoreModel; import jalview.analysis.scoremodels.PIDScoreModel; import jalview.api.analysis.ScoreModelI; @@ -1498,6 +1499,7 @@ public class ResidueProperties // scoreMatrices.put("Conservation EnhPos", new // ScoreMatrix("Conservation EnhPos",propMatrixEpos,0)); scoreMatrices.put("PID", new PIDScoreModel()); + scoreMatrices.put("Displayed Features", new FeatureScoreModel()); } private ResidueProperties() diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java new file mode 100644 index 0000000..664c903 --- /dev/null +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -0,0 +1,364 @@ +package jalview.structures.models; + +import jalview.api.StructureSelectionManagerProvider; +import jalview.datamodel.PDBEntry; +import jalview.datamodel.SequenceI; +import jalview.structure.StructureListener; +import jalview.structure.StructureSelectionManager; +import jalview.util.MessageManager; + +import java.awt.event.ComponentEvent; +import java.util.ArrayList; +import java.util.List; + +/** + * A base class to hold common function for protein structure model binding. + * Initial version created by refactoring JMol and Chimera binding models, but + * other structure viewers could in principle be accommodated in future. + * + * @author gmcarstairs + * + */ +public abstract class AAStructureBindingModel extends + SequenceStructureBindingModel implements StructureListener, + StructureSelectionManagerProvider +{ + + private StructureSelectionManager ssm; + + private PDBEntry[] pdbEntry; + + /* + * sequences mapped to each pdbentry + */ + private SequenceI[][] sequence; + + /* + * array of target chains for sequences - tied to pdbentry and sequence[] + */ + private String[][] chains; + + /* + * datasource protocol for access to PDBEntrylatest + */ + String protocol = null; + + protected boolean colourBySequence = true; + + /** + * Constructor + * + * @param ssm + * @param seqs + */ + public AAStructureBindingModel(StructureSelectionManager ssm, + SequenceI[][] seqs) + { + this.ssm = ssm; + this.sequence = seqs; + } + + /** + * Constructor + * + * @param ssm + * @param pdbentry + * @param sequenceIs + * @param chains + * @param protocol + */ + public AAStructureBindingModel(StructureSelectionManager ssm, + PDBEntry[] pdbentry, SequenceI[][] sequenceIs, String[][] chains, + String protocol) + { + this.ssm = ssm; + this.sequence = sequenceIs; + this.chains = chains; + this.pdbEntry = pdbentry; + this.protocol = protocol; + if (chains == null) + { + this.chains = new String[pdbentry.length][]; + } + } + + public StructureSelectionManager getSsm() + { + return ssm; + } + + /** + * Returns the i'th PDBEntry (or null) + * + * @param i + * @return + */ + public PDBEntry getPdbEntry(int i) + { + return (pdbEntry != null && pdbEntry.length > i) ? pdbEntry[i] : null; + } + + /** + * Returns the number of modelled PDB file entries. + * + * @return + */ + public int getPdbCount() + { + return pdbEntry == null ? 0 : pdbEntry.length; + } + + public SequenceI[][] getSequence() + { + return sequence; + } + + public String[][] getChains() + { + return chains; + } + + public String getProtocol() + { + return protocol; + } + + // TODO may remove this if calling methods can be pulled up here + protected void setPdbentry(PDBEntry[] pdbentry) + { + this.pdbEntry = pdbentry; + } + + protected void setSequence(SequenceI[][] sequence) + { + this.sequence = sequence; + } + + protected void setChains(String[][] chains) + { + this.chains = chains; + } + + /** + * Construct a title string for the viewer window based on the data Jalview + * knows about + * @param viewerName TODO + * @param verbose + * + * @return + */ + public String getViewerTitle(String viewerName, boolean verbose) + { + if (getSequence() == null || getSequence().length < 1 + || getPdbCount() < 1 + || getSequence()[0].length < 1) + { + return ("Jalview " + viewerName + " Window"); + } + // TODO: give a more informative title when multiple structures are + // displayed. + StringBuilder title = new StringBuilder(64); + final PDBEntry pdbEntry = getPdbEntry(0); + title.append(viewerName + " view for " + getSequence()[0][0].getName() + + ":" + + pdbEntry.getId()); + + if (verbose) + { + if (pdbEntry.getProperty() != null) + { + if (pdbEntry.getProperty().get("method") != null) + { + title.append(" Method: "); + title.append(pdbEntry.getProperty().get("method")); + } + if (pdbEntry.getProperty().get("chains") != null) + { + title.append(" Chain:"); + title.append(pdbEntry.getProperty().get("chains")); + } + } + } + return title.toString(); + } + + /** + * Called by after closeViewer is called, to release any resources and + * references so they can be garbage collected. Override if needed. + */ + protected void releaseUIResources() + { + + } + + public boolean isColourBySequence() + { + return colourBySequence; + } + + public void setColourBySequence(boolean colourBySequence) + { + this.colourBySequence = colourBySequence; + } + + protected void addSequenceAndChain(int pe, SequenceI[] seq, + String[] tchain) + { + if (pe < 0 || pe >= getPdbCount()) + { + throw new Error(MessageManager.formatMessage( + "error.implementation_error_no_pdbentry_from_index", + new Object[] + { Integer.valueOf(pe).toString() })); + } + final String nullChain = "TheNullChain"; + List s = new ArrayList(); + List c = new ArrayList(); + if (getChains() == null) + { + setChains(new String[getPdbCount()][]); + } + if (getSequence()[pe] != null) + { + for (int i = 0; i < getSequence()[pe].length; i++) + { + s.add(getSequence()[pe][i]); + if (getChains()[pe] != null) + { + if (i < getChains()[pe].length) + { + c.add(getChains()[pe][i]); + } + else + { + c.add(nullChain); + } + } + else + { + if (tchain != null && tchain.length > 0) + { + c.add(nullChain); + } + } + } + } + for (int i = 0; i < seq.length; i++) + { + if (!s.contains(seq[i])) + { + s.add(seq[i]); + if (tchain != null && i < tchain.length) + { + c.add(tchain[i] == null ? nullChain : tchain[i]); + } + } + } + SequenceI[] tmp = s.toArray(new SequenceI[s.size()]); + getSequence()[pe] = tmp; + if (c.size() > 0) + { + String[] tch = c.toArray(new String[c.size()]); + for (int i = 0; i < tch.length; i++) + { + if (tch[i] == nullChain) + { + tch[i] = null; + } + } + getChains()[pe] = tch; + } + else + { + getChains()[pe] = null; + } + } + + /** + * add structures and any known sequence associations + * + * @returns the pdb entries added to the current set. + */ + public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe, SequenceI[][] seq, + String[][] chns) + { + List v = new ArrayList(); + List rtn = new ArrayList(); + for (int i = 0; i < getPdbCount(); i++) + { + v.add(getPdbEntry(i)); + } + for (int i = 0; i < pdbe.length; i++) + { + int r = v.indexOf(pdbe[i]); + if (r == -1 || r >= getPdbCount()) + { + rtn.add(new int[] + { v.size(), i }); + v.add(pdbe[i]); + } + else + { + // just make sure the sequence/chain entries are all up to date + addSequenceAndChain(r, seq[i], chns[i]); + } + } + pdbe = v.toArray(new PDBEntry[v.size()]); + setPdbentry(pdbe); + if (rtn.size() > 0) + { + // expand the tied sequence[] and string[] arrays + SequenceI[][] sqs = new SequenceI[getPdbCount()][]; + String[][] sch = new String[getPdbCount()][]; + System.arraycopy(getSequence(), 0, sqs, 0, getSequence().length); + System.arraycopy(getChains(), 0, sch, 0, this.getChains().length); + setSequence(sqs); + setChains(sch); + pdbe = new PDBEntry[rtn.size()]; + for (int r = 0; r < pdbe.length; r++) + { + int[] stri = (rtn.get(r)); + // record the pdb file as a new addition + pdbe[r] = getPdbEntry(stri[0]); + // and add the new sequence/chain entries + addSequenceAndChain(stri[0], seq[stri[1]], chns[stri[1]]); + } + } + else + { + pdbe = null; + } + return pdbe; + } + + /** + * Add sequences to the pe'th pdbentry's sequence set. + * + * @param pe + * @param seq + */ + public void addSequence(int pe, SequenceI[] seq) + { + addSequenceAndChain(pe, seq, null); + } + + /** + * add the given sequences to the mapping scope for the given pdb file handle + * + * @param pdbFile + * - pdbFile identifier + * @param seq + * - set of sequences it can be mapped to + */ + public void addSequenceForStructFile(String pdbFile, SequenceI[] seq) + { + for (int pe = 0; pe < getPdbCount(); pe++) + { + if (getPdbEntry(pe).getFile().equals(pdbFile)) + { + addSequence(pe, seq); + } + } + } + +} \ No newline at end of file diff --git a/src/jalview/structures/models/SequenceStructureBindingModel.java b/src/jalview/structures/models/SequenceStructureBindingModel.java index 7d023a8..d758726 100644 --- a/src/jalview/structures/models/SequenceStructureBindingModel.java +++ b/src/jalview/structures/models/SequenceStructureBindingModel.java @@ -48,8 +48,8 @@ public class SequenceStructureBindingModel implements /** * - * @return true if Jmol is still restoring state or loading is still going on - * (see setFinsihedLoadingFromArchive) + * @return true if viewer is still restoring state or loading is still going + * on (see setFinishedLoadingFromArchive) */ @Override public boolean isLoadingFromArchive() diff --git a/src/jalview/util/ColorUtils.java b/src/jalview/util/ColorUtils.java index fd76086..44ce010 100644 --- a/src/jalview/util/ColorUtils.java +++ b/src/jalview/util/ColorUtils.java @@ -60,6 +60,26 @@ public class ColorUtils } /** + * Convert to Tk colour code format + * + * @param colour + * @return + * @see http + * ://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/colortool.html# + * tkcode + */ + public static final String toTkCode(Color colour) + { + String colstring = "#" + ((colour.getRed() < 16) ? "0" : "") + + Integer.toHexString(colour.getRed()) + + ((colour.getGreen() < 16) ? "0" : "") + + Integer.toHexString(colour.getGreen()) + + ((colour.getBlue() < 16) ? "0" : "") + + Integer.toHexString(colour.getBlue()); + return colstring; + } + + /** * Returns a colour three shades darker. Note you can't guarantee that * brighterThan reverses this, as darkerThan may result in black. * diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 1b42faf..08b31fa 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -24,6 +24,7 @@ import jalview.analysis.Conservation; import jalview.api.AlignCalcManagerI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.FeaturesDisplayedI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AlignmentView; @@ -636,10 +637,6 @@ public abstract class AlignmentViewport implements AlignViewportI public void setHiddenColumns(ColumnSelection colsel) { this.colSel = colsel; - if (colSel.getHiddenColumns() != null) - { - hasHiddenColumns = true; - } } @Override @@ -648,9 +645,14 @@ public abstract class AlignmentViewport implements AlignViewportI return colSel; } + @Override public void setColumnSelection(ColumnSelection colSel) { this.colSel = colSel; + if (colSel != null) + { + updateHiddenColumns(); + } } /** @@ -670,15 +672,22 @@ public abstract class AlignmentViewport implements AlignViewportI this.hiddenRepSequences = hiddenRepSequences; } - protected boolean hasHiddenColumns = false; + @Override + public boolean hasHiddenColumns() + { + return colSel != null && colSel.hasHiddenColumns(); + } public void updateHiddenColumns() { - hasHiddenColumns = colSel.getHiddenColumns() != null; + // this method doesn't really do anything now. But - it could, since a + // column Selection could be in the process of modification + // hasHiddenColumns = colSel.hasHiddenColumns(); } protected boolean hasHiddenRows = false; + @Override public boolean hasHiddenRows() { return hasHiddenRows; @@ -696,6 +705,7 @@ public abstract class AlignmentViewport implements AlignViewportI sequenceSetID = new String(newid); } + @Override public String getSequenceSetId() { if (sequenceSetID == null) @@ -857,7 +867,6 @@ public abstract class AlignmentViewport implements AlignViewportI colSel.hideSelectedColumns(); setSelectionGroup(null); - hasHiddenColumns = true; } public void hideColumns(int start, int end) @@ -870,23 +879,17 @@ public abstract class AlignmentViewport implements AlignViewportI { 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 @@ -1029,8 +1032,8 @@ public abstract class AlignmentViewport implements AlignViewportI public boolean isHiddenRepSequence(SequenceI seq) { - return hiddenRepSequences != null - && hiddenRepSequences.containsKey(seq); + return alignment.getSeqrep()==seq || (hiddenRepSequences != null + && hiddenRepSequences.containsKey(seq)); } public SequenceGroup getRepresentedSequences(SequenceI seq) @@ -1039,32 +1042,24 @@ public abstract class AlignmentViewport implements AlignViewportI : hiddenRepSequences.get(seq)); } + @Override public int adjustForHiddenSeqs(int alignmentIndex) { return alignment.getHiddenSequences().adjustForHiddenSeqs( alignmentIndex); } - // Selection manipulation - /** - * broadcast selection to any interested parties - */ + @Override public abstract void sendSelection(); + @Override 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 - */ + + @Override public SequenceI[] getSelectionAsNewSequence() { SequenceI[] sequences; @@ -1093,12 +1088,7 @@ public abstract class AlignmentViewport implements AlignViewportI return sequences; } - /** - * get the currently selected sequence objects or all the sequences in the - * alignment. - * - * @return array of references to sequence objects - */ + @Override public SequenceI[] getSequenceSelection() { @@ -1114,31 +1104,16 @@ public abstract class AlignmentViewport implements AlignViewportI 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[] - */ + @Override public jalview.datamodel.CigarArray getViewAsCigars( boolean selectedRegionOnly) { - return new jalview.datamodel.CigarArray(alignment, - (hasHiddenColumns ? colSel : null), + return new jalview.datamodel.CigarArray(alignment, colSel, (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 - */ + @Override public jalview.datamodel.AlignmentView getAlignmentView( boolean selectedOnly) @@ -1146,34 +1121,17 @@ public abstract class AlignmentViewport implements AlignViewportI 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 - */ + @Override public jalview.datamodel.AlignmentView getAlignmentView( boolean selectedOnly, boolean markGroups) { return new AlignmentView(alignment, colSel, selectionGroup, - hasHiddenColumns, selectedOnly, markGroups); + colSel != null && colSel.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[] - */ + @Override public String[] getViewAsString(boolean selectedRegionOnly) { @@ -1196,7 +1154,7 @@ public abstract class AlignmentViewport implements AlignViewportI } selection = new String[iSize]; - if (hasHiddenColumns) + if (colSel != null && colSel.hasHiddenColumns()) { selection = colSel.getVisibleSequenceStrings(start, end, seqs); } @@ -1211,15 +1169,8 @@ public abstract class AlignmentViewport implements AlignViewportI 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 - */ + + @Override public int[][] getVisibleRegionBoundaries(int min, int max) { Vector regions = new Vector(); @@ -1228,7 +1179,7 @@ public abstract class AlignmentViewport implements AlignViewportI do { - if (hasHiddenColumns) + if (colSel != null && colSel.hasHiddenColumns()) { if (start == 0) { @@ -1249,7 +1200,7 @@ public abstract class AlignmentViewport implements AlignViewportI regions.addElement(new int[] { start, end }); - if (hasHiddenColumns) + if (colSel != null && colSel.hasHiddenColumns()) { start = colSel.adjustForHiddenColumns(end); start = colSel.getHiddenBoundaryLeft(start) + 1; @@ -1286,18 +1237,15 @@ public abstract class AlignmentViewport implements AlignViewportI return ala; } - /** - * @return the padGaps - */ + + @Override public boolean isPadGaps() { return padGaps; } - /** - * @param padGaps - * the padGaps to set - */ + + @Override public void setPadGaps(boolean padGaps) { this.padGaps = padGaps; @@ -1309,6 +1257,7 @@ public abstract class AlignmentViewport implements AlignViewportI * * @param ap */ + @Override public void alignmentChanged(AlignmentViewPanel ap) { if (isPadGaps()) @@ -1470,6 +1419,7 @@ public abstract class AlignmentViewport implements AlignViewportI * * @see jalview.api.AlignViewportI#calcPanelHeight() */ + @Override public int calcPanelHeight() { // setHeight of panels @@ -1601,6 +1551,36 @@ public abstract class AlignmentViewport implements AlignViewportI } oldrfs.clear(); } + /** + * show the reference sequence in the alignment view + */ + private boolean displayReferenceSeq=false; + /** + * colour according to the reference sequence defined on the alignment + */ + private boolean colourByReferenceSeq=false; + + @Override + public boolean isDisplayReferenceSeq() + { + return alignment.hasSeqrep() && displayReferenceSeq; + } + + @Override + public void setDisplayReferenceSeq(boolean displayReferenceSeq) + { + this.displayReferenceSeq = displayReferenceSeq; + } + + public boolean isColourByReferenceSeq() + { + return alignment.hasSeqrep() && colourByReferenceSeq; + } + + public void setColourByReferenceSeq(boolean colourByReferenceSeq) + { + this.colourByReferenceSeq = colourByReferenceSeq; + } @Override public Color getSequenceColour(SequenceI seq) @@ -1659,4 +1639,90 @@ public abstract class AlignmentViewport implements AlignViewportI { sequenceColours = null; }; + + FeaturesDisplayedI featuresDisplayed = null; + + @Override + public FeaturesDisplayedI getFeaturesDisplayed() + { + return featuresDisplayed; + } + + @Override + public void setFeaturesDisplayed(FeaturesDisplayedI featuresDisplayedI) + { + featuresDisplayed = featuresDisplayedI; + } + + @Override + public boolean areFeaturesDisplayed() + { + return featuresDisplayed != null && featuresDisplayed.getRegisterdFeaturesCount()>0; + } + + /** + * display setting for showing/hiding sequence features on alignment view + */ + boolean showSequenceFeatures = false; + + /** + * set the flag + * + * @param b + * features are displayed if true + */ + @Override + public void setShowSequenceFeatures(boolean b) + { + showSequenceFeatures = b; + } + @Override + public boolean isShowSequenceFeatures() + { + return showSequenceFeatures; + } + + boolean showSeqFeaturesHeight; + + @Override + public void setShowSequenceFeaturesHeight(boolean selected) + { + showSeqFeaturesHeight = selected; + } + + @Override + public boolean isShowSequenceFeaturesHeight() + { + return showSeqFeaturesHeight; + } + + private boolean showAnnotation = true; + + private boolean rightAlignIds = false; + + + @Override + public void setShowAnnotation(boolean b) + { + showAnnotation = b; + } + + @Override + public boolean isShowAnnotation() + { + return showAnnotation; + } + + @Override + public boolean isRightAlignIds() + { + return rightAlignIds; + } + + @Override + public void setRightAlignIds(boolean rightAlignIds) + { + this.rightAlignIds = rightAlignIds; + } + } diff --git a/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java b/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java new file mode 100644 index 0000000..3cd4ef7 --- /dev/null +++ b/src/jalview/viewmodel/annotationfilter/AnnotationFilterParameter.java @@ -0,0 +1,101 @@ +package jalview.viewmodel.annotationfilter; + +import java.util.ArrayList; +import java.util.List; + +public class AnnotationFilterParameter +{ + public enum ThresholdType + { + NO_THRESHOLD, BELOW_THRESHOLD, ABOVE_THRESHOLD; + } + + public enum SearchableAnnotationField + { + DISPLAY_STRING, DESCRIPTION; + } + private ThresholdType thresholdType; + + private float thresholdValue; + + private boolean filterAlphaHelix = false; + + private boolean filterBetaSheet = false; + + private boolean filterTurn = false; + + private String regexString; + + private List regexSearchFields = new ArrayList(); + + public ThresholdType getThresholdType() + { + return thresholdType; + } + + public void setThresholdType(ThresholdType thresholdType) + { + this.thresholdType = thresholdType; + } + + public float getThresholdValue() + { + return thresholdValue; + } + + public void setThresholdValue(float thresholdValue) + { + this.thresholdValue = thresholdValue; + } + + public String getRegexString() + { + return regexString; + } + + public void setRegexString(String regexString) + { + this.regexString = regexString; + } + + public List getRegexSearchFields() + { + return regexSearchFields; + } + + public void addRegexSearchField(SearchableAnnotationField regexSearchField) + { + this.regexSearchFields.add(regexSearchField); + } + + public boolean isFilterAlphaHelix() + { + return filterAlphaHelix; + } + + public void setFilterAlphaHelix(boolean alphaHelix) + { + this.filterAlphaHelix = alphaHelix; + } + + public boolean isFilterBetaSheet() + { + return filterBetaSheet; + } + + public void setFilterBetaSheet(boolean betaSheet) + { + this.filterBetaSheet = betaSheet; + } + + public boolean isFilterTurn() + { + return filterTurn; + } + + public void setFilterTurn(boolean turn) + { + this.filterTurn = turn; + } + +} diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java new file mode 100644 index 0000000..c7cee04 --- /dev/null +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -0,0 +1,949 @@ +package jalview.viewmodel.seqfeatures; + +import jalview.api.AlignViewportI; +import jalview.api.FeaturesDisplayedI; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.renderer.seqfeatures.FeatureRenderer; +import jalview.schemes.GraduatedColor; +import jalview.viewmodel.AlignmentViewport; + +import java.awt.Color; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + +public abstract class FeatureRendererModel implements + jalview.api.FeatureRenderer +{ + + /** + * global transparency for feature + */ + protected float transparency = 1.0f; + + protected Map featureColours = new ConcurrentHashMap(); + + protected Map featureGroups = new ConcurrentHashMap(); + + protected Object currentColour; + + protected String[] renderOrder; + + protected PropertyChangeSupport changeSupport = new PropertyChangeSupport( + this); + + protected AlignmentViewport av; + + public AlignViewportI getViewport() + { + return av; + } + + public FeatureRendererSettings getSettings() + { + return new FeatureRendererSettings(this); + } + + public void transferSettings(FeatureRendererSettings fr) + { + this.renderOrder = fr.renderOrder; + this.featureGroups = fr.featureGroups; + this.featureColours = fr.featureColours; + this.transparency = fr.transparency; + this.featureOrder = fr.featureOrder; + } + + /** + * update from another feature renderer + * + * @param fr + * settings to copy + */ + public void transferSettings(jalview.api.FeatureRenderer _fr) + { + FeatureRenderer fr = (FeatureRenderer) _fr; + FeatureRendererSettings frs = new FeatureRendererSettings(fr); + this.renderOrder = frs.renderOrder; + this.featureGroups = frs.featureGroups; + this.featureColours = frs.featureColours; + this.transparency = frs.transparency; + this.featureOrder = frs.featureOrder; + if (av != null && av != fr.getViewport()) + { + // copy over the displayed feature settings + if (_fr.getFeaturesDisplayed() != null) + { + FeaturesDisplayedI fd = getFeaturesDisplayed(); + if (fd == null) + { + setFeaturesDisplayedFrom(_fr.getFeaturesDisplayed()); + } + else + { + synchronized (fd) + { + fd.clear(); + java.util.Iterator fdisp = _fr.getFeaturesDisplayed() + .getVisibleFeatures(); + while (fdisp.hasNext()) + { + fd.setVisible(fdisp.next()); + } + } + } + } + } + } + + public void setFeaturesDisplayedFrom(FeaturesDisplayedI featuresDisplayed) + { + av.setFeaturesDisplayed(new FeaturesDisplayed(featuresDisplayed)); + } + + @Override + public void setVisible(String featureType) + { + FeaturesDisplayedI fdi = av.getFeaturesDisplayed(); + if (fdi == null) + { + av.setFeaturesDisplayed(fdi = new FeaturesDisplayed()); + } + if (!fdi.isRegistered(featureType)) + { + pushFeatureType(Arrays.asList(new String[] + { featureType })); + } + fdi.setVisible(featureType); + } + + @Override + public void setAllVisible(List featureTypes) + { + FeaturesDisplayedI fdi = av.getFeaturesDisplayed(); + if (fdi == null) + { + av.setFeaturesDisplayed(fdi = new FeaturesDisplayed()); + } + List nft = new ArrayList(); + for (String featureType : featureTypes) + { + if (!fdi.isRegistered(featureType)) + { + nft.add(featureType); + } + } + if (nft.size() > 0) + { + pushFeatureType(nft); + } + fdi.setAllVisible(featureTypes); + } + + /** + * push a set of new types onto the render order stack. Note - this is a + * direct mechanism rather than the one employed in updateRenderOrder + * + * @param types + */ + private void pushFeatureType(List types) + { + + int ts = types.size(); + String neworder[] = new String[(renderOrder == null ? 0 + : renderOrder.length) + ts]; + types.toArray(neworder); + if (renderOrder != null) + { + System.arraycopy(neworder,0,neworder,renderOrder.length,ts); + System.arraycopy(renderOrder, 0, neworder, 0, renderOrder.length); + } + renderOrder = neworder; + } + + protected Hashtable minmax = new Hashtable(); + + public Hashtable getMinMax() + { + return minmax; + } + + /** + * normalise a score against the max/min bounds for the feature type. + * + * @param sequenceFeature + * @return byte[] { signed, normalised signed (-127 to 127) or unsigned + * (0-255) value. + */ + protected final byte[] normaliseScore(SequenceFeature sequenceFeature) + { + float[] mm = ((float[][]) minmax.get(sequenceFeature.type))[0]; + final byte[] r = new byte[] + { 0, (byte) 255 }; + if (mm != null) + { + if (r[0] != 0 || mm[0] < 0.0) + { + r[0] = 1; + r[1] = (byte) ((int) 128.0 + 127.0 * (sequenceFeature.score / mm[1])); + } + else + { + r[1] = (byte) ((int) 255.0 * (sequenceFeature.score / mm[1])); + } + } + return r; + } + + boolean newFeatureAdded = false; + + boolean findingFeatures = false; + + protected boolean updateFeatures() + { + if (av.getFeaturesDisplayed() == null || renderOrder == null + || newFeatureAdded) + { + findAllFeatures(); + if (av.getFeaturesDisplayed().getVisibleFeatureCount() < 1) + { + return false; + } + } + // TODO: decide if we should check for the visible feature count first + return true; + } + + /** + * search the alignment for all new features, give them a colour and display + * them. Then fires a PropertyChangeEvent on the changeSupport object. + * + */ + protected void findAllFeatures() + { + synchronized (firing) + { + if (firing.equals(Boolean.FALSE)) + { + firing = Boolean.TRUE; + findAllFeatures(true); // add all new features as visible + changeSupport.firePropertyChange("changeSupport", null, null); + firing = Boolean.FALSE; + } + } + } + + @Override + public List findFeaturesAtRes(SequenceI sequence, int res) + { + ArrayList tmp = new ArrayList(); + SequenceFeature[] features = sequence.getSequenceFeatures(); + + while (features == null && sequence.getDatasetSequence() != null) + { + sequence = sequence.getDatasetSequence(); + features = sequence.getSequenceFeatures(); + } + + if (features != null) + { + for (int i = 0; i < features.length; i++) + { + if (!av.areFeaturesDisplayed() + || !av.getFeaturesDisplayed().isVisible( + features[i].getType())) + { + continue; + } + + if (features[i].featureGroup != null + && featureGroups != null + && featureGroups.containsKey(features[i].featureGroup) + && !featureGroups.get(features[i].featureGroup) + .booleanValue()) + { + continue; + } + + if ((features[i].getBegin() <= res) + && (features[i].getEnd() >= res)) + { + tmp.add(features[i]); + } + } + } + return tmp; + } + + /** + * Searches alignment for all features and updates colours + * + * @param newMadeVisible + * if true newly added feature types will be rendered immediatly + * TODO: check to see if this method should actually be proxied so + * repaint events can be propagated by the renderer code + */ + @Override + public synchronized void findAllFeatures(boolean newMadeVisible) + { + newFeatureAdded = false; + + if (findingFeatures) + { + newFeatureAdded = true; + return; + } + + findingFeatures = true; + if (av.getFeaturesDisplayed() == null) + { + av.setFeaturesDisplayed(new FeaturesDisplayed()); + } + FeaturesDisplayedI featuresDisplayed = av.getFeaturesDisplayed(); + + ArrayList allfeatures = new ArrayList(); + ArrayList oldfeatures = new ArrayList(); + if (renderOrder != null) + { + for (int i = 0; i < renderOrder.length; i++) + { + if (renderOrder[i] != null) + { + oldfeatures.add(renderOrder[i]); + } + } + } + if (minmax == null) + { + minmax = new Hashtable(); + } + AlignmentI alignment = av.getAlignment(); + for (int i = 0; i < alignment.getHeight(); i++) + { + SequenceI asq = alignment.getSequenceAt(i); + SequenceI dasq = asq.getDatasetSequence(); + SequenceFeature[] features = dasq != null ? dasq + .getSequenceFeatures() : asq.getSequenceFeatures(); + + if (features == null) + { + continue; + } + + int index = 0; + while (index < features.length) + { + if (!featuresDisplayed.isRegistered(features[index].getType())) + { + String fgrp = features[index].getFeatureGroup(); + if (fgrp != null) + { + Boolean groupDisplayed = featureGroups.get(fgrp); + if (groupDisplayed == null) + { + groupDisplayed = Boolean.valueOf(newMadeVisible); + featureGroups.put(fgrp, groupDisplayed); + } + if (!groupDisplayed.booleanValue()) + { + index++; + continue; + } + } + if (!(features[index].begin == 0 && features[index].end == 0)) + { + // If beginning and end are 0, the feature is for the whole sequence + // and we don't want to render the feature in the normal way + + if (newMadeVisible + && !oldfeatures.contains(features[index].getType())) + { + // this is a new feature type on the alignment. Mark it for + // display. + featuresDisplayed.setVisible(features[index].getType()); + setOrder(features[index].getType(), 0); + } + } + } + if (!allfeatures.contains(features[index].getType())) + { + allfeatures.add(features[index].getType()); + } + if (features[index].score != Float.NaN) + { + int nonpos = features[index].getBegin() >= 1 ? 0 : 1; + float[][] mm = (float[][]) minmax.get(features[index].getType()); + if (mm == null) + { + mm = new float[][] + { null, null }; + minmax.put(features[index].getType(), mm); + } + if (mm[nonpos] == null) + { + mm[nonpos] = new float[] + { features[index].score, features[index].score }; + + } + else + { + if (mm[nonpos][0] > features[index].score) + { + mm[nonpos][0] = features[index].score; + } + if (mm[nonpos][1] < features[index].score) + { + mm[nonpos][1] = features[index].score; + } + } + } + index++; + } + } + updateRenderOrder(allfeatures); + findingFeatures = false; + } + + protected Boolean firing = Boolean.FALSE; + + /** + * replaces the current renderOrder with the unordered features in + * allfeatures. The ordering of any types in both renderOrder and allfeatures + * is preserved, and all new feature types are rendered on top of the existing + * types, in the order given by getOrder or the order given in allFeatures. + * Note. this operates directly on the featureOrder hash for efficiency. TODO: + * eliminate the float storage for computing/recalling the persistent ordering + * New Cability: updates min/max for colourscheme range if its dynamic + * + * @param allFeatures + */ + private void updateRenderOrder(List allFeatures) + { + List allfeatures = new ArrayList(allFeatures); + String[] oldRender = renderOrder; + renderOrder = new String[allfeatures.size()]; + Object mmrange, fc = null; + boolean initOrders = (featureOrder == null); + int opos = 0; + if (oldRender != null && oldRender.length > 0) + { + for (int j = 0; j < oldRender.length; j++) + { + if (oldRender[j] != null) + { + if (initOrders) + { + setOrder(oldRender[j], (1 - (1 + (float) j) + / oldRender.length)); + } + if (allfeatures.contains(oldRender[j])) + { + renderOrder[opos++] = oldRender[j]; // existing features always + // appear below new features + allfeatures.remove(oldRender[j]); + if (minmax != null) + { + mmrange = minmax.get(oldRender[j]); + if (mmrange != null) + { + fc = featureColours.get(oldRender[j]); + if (fc != null && fc instanceof GraduatedColor + && ((GraduatedColor) fc).isAutoScale()) + { + ((GraduatedColor) fc).updateBounds( + ((float[][]) mmrange)[0][0], + ((float[][]) mmrange)[0][1]); + } + } + } + } + } + } + } + if (allfeatures.size() == 0) + { + // no new features - leave order unchanged. + return; + } + int i = allfeatures.size() - 1; + int iSize = i; + boolean sort = false; + String[] newf = new String[allfeatures.size()]; + float[] sortOrder = new float[allfeatures.size()]; + for (String newfeat : allfeatures) + { + newf[i] = newfeat; + if (minmax != null) + { + // update from new features minmax if necessary + mmrange = minmax.get(newf[i]); + if (mmrange != null) + { + fc = featureColours.get(newf[i]); + if (fc != null && fc instanceof GraduatedColor + && ((GraduatedColor) fc).isAutoScale()) + { + ((GraduatedColor) fc).updateBounds(((float[][]) mmrange)[0][0], + ((float[][]) mmrange)[0][1]); + } + } + } + if (initOrders || !featureOrder.containsKey(newf[i])) + { + int denom = initOrders ? allfeatures.size() : featureOrder.size(); + // new unordered feature - compute persistent ordering at head of + // existing features. + setOrder(newf[i], i / (float) denom); + } + // set order from newly found feature from persisted ordering. + sortOrder[i] = 2 - ((Float) featureOrder.get(newf[i])).floatValue(); + if (i < iSize) + { + // only sort if we need to + sort = sort || sortOrder[i] > sortOrder[i + 1]; + } + i--; + } + if (iSize > 1 && sort) + { + jalview.util.QuickSort.sort(sortOrder, newf); + } + sortOrder = null; + System.arraycopy(newf, 0, renderOrder, opos, newf.length); + } + + /** + * get a feature style object for the given type string. Creates a + * java.awt.Color for a featureType with no existing colourscheme. TODO: + * replace return type with object implementing standard abstract colour/style + * interface + * + * @param featureType + * @return java.awt.Color or GraduatedColor + */ + public Object getFeatureStyle(String featureType) + { + Object fc = featureColours.get(featureType); + if (fc == null) + { + jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(); + Color col = ucs.createColourFromName(featureType); + featureColours.put(featureType, fc = col); + } + return fc; + } + + /** + * return a nominal colour for this feature + * + * @param featureType + * @return standard color, or maximum colour for graduated colourscheme + */ + public Color getColour(String featureType) + { + Object fc = getFeatureStyle(featureType); + + if (fc instanceof Color) + { + return (Color) fc; + } + else + { + if (fc instanceof GraduatedColor) + { + return ((GraduatedColor) fc).getMaxColor(); + } + } + throw new Error("Implementation Error: Unrecognised render object " + + fc.getClass() + " for features of type " + featureType); + } + + /** + * calculate the render colour for a specific feature using current feature + * settings. + * + * @param feature + * @return render colour for the given feature + */ + public Color getColour(SequenceFeature feature) + { + Object fc = getFeatureStyle(feature.getType()); + if (fc instanceof Color) + { + return (Color) fc; + } + else + { + if (fc instanceof GraduatedColor) + { + return ((GraduatedColor) fc).findColor(feature); + } + } + throw new Error("Implementation Error: Unrecognised render object " + + fc.getClass() + " for features of type " + feature.getType()); + } + + protected boolean showFeature(SequenceFeature sequenceFeature) + { + Object fc = getFeatureStyle(sequenceFeature.type); + if (fc instanceof GraduatedColor) + { + return ((GraduatedColor) fc).isColored(sequenceFeature); + } + else + { + return true; + } + } + + protected boolean showFeatureOfType(String type) + { + return av.getFeaturesDisplayed().isVisible(type); + } + + public void setColour(String featureType, Object col) + { + // overwrite + // Color _col = (col instanceof Color) ? ((Color) col) : (col instanceof + // GraduatedColor) ? ((GraduatedColor) col).getMaxColor() : null; + // Object c = featureColours.get(featureType); + // if (c == null || c instanceof Color || (c instanceof GraduatedColor && + // !((GraduatedColor)c).getMaxColor().equals(_col))) + { + featureColours.put(featureType, col); + } + } + + public void setTransparency(float value) + { + transparency = value; + } + + public float getTransparency() + { + return transparency; + } + + Map featureOrder = null; + + /** + * analogous to colour - store a normalized ordering for all feature types in + * this rendering context. + * + * @param type + * Feature type string + * @param position + * normalized priority - 0 means always appears on top, 1 means + * always last. + */ + public float setOrder(String type, float position) + { + if (featureOrder == null) + { + featureOrder = new Hashtable(); + } + featureOrder.put(type, new Float(position)); + return position; + } + + /** + * get the global priority (0 (top) to 1 (bottom)) + * + * @param type + * @return [0,1] or -1 for a type without a priority + */ + public float getOrder(String type) + { + if (featureOrder != null) + { + if (featureOrder.containsKey(type)) + { + return ((Float) featureOrder.get(type)).floatValue(); + } + } + return -1; + } + + @Override + public Map getFeatureColours() + { + return new ConcurrentHashMap(featureColours); + } + + /** + * Replace current ordering with new ordering + * + * @param data + * { String(Type), Colour(Type), Boolean(Displayed) } + */ + public void setFeaturePriority(Object[][] data) + { + setFeaturePriority(data, true); + } + + /** + * + * @param data + * { String(Type), Colour(Type), Boolean(Displayed) } + * @param visibleNew + * when true current featureDisplay list will be cleared + */ + public void setFeaturePriority(Object[][] data, boolean visibleNew) + { + FeaturesDisplayedI av_featuresdisplayed = null; + if (visibleNew) + { + if ((av_featuresdisplayed = av.getFeaturesDisplayed()) != null) + { + av.getFeaturesDisplayed().clear(); + } + else + { + av.setFeaturesDisplayed(av_featuresdisplayed = new FeaturesDisplayed()); + } + } + else + { + av_featuresdisplayed = av.getFeaturesDisplayed(); + } + if (data == null) + { + return; + } + // The feature table will display high priority + // features at the top, but theses are the ones + // we need to render last, so invert the data + renderOrder = new String[data.length]; + + if (data.length > 0) + { + for (int i = 0; i < data.length; i++) + { + String type = data[i][0].toString(); + setColour(type, data[i][1]); // todo : typesafety - feature color + // interface object + if (((Boolean) data[i][2]).booleanValue()) + { + av_featuresdisplayed.setVisible(type); + } + + renderOrder[data.length - i - 1] = type; + } + } + + } + + /** + * @param listener + * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void addPropertyChangeListener(PropertyChangeListener listener) + { + changeSupport.addPropertyChangeListener(listener); + } + + /** + * @param listener + * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener) + */ + public void removePropertyChangeListener(PropertyChangeListener listener) + { + changeSupport.removePropertyChangeListener(listener); + } + + public Set getAllFeatureColours() + { + return featureColours.keySet(); + } + + public void clearRenderOrder() + { + renderOrder = null; + } + + public boolean hasRenderOrder() + { + return renderOrder != null; + } + + public List getRenderOrder() + { + if (renderOrder == null) + { + return Arrays.asList(new String[] + {}); + } + return Arrays.asList(renderOrder); + } + + public int getFeatureGroupsSize() + { + return featureGroups != null ? 0 : featureGroups.size(); + } + + @Override + public List getFeatureGroups() + { + // conflict between applet and desktop - featureGroups returns the map in + // the desktop featureRenderer + return (featureGroups == null) ? Arrays.asList(new String[0]) : Arrays + .asList(featureGroups.keySet().toArray(new String[0])); + } + + public boolean checkGroupVisibility(String group, boolean newGroupsVisible) + { + if (featureGroups == null) + { + // then an exception happens next.. + } + if (featureGroups.containsKey(group)) + { + return featureGroups.get(group).booleanValue(); + } + if (newGroupsVisible) + { + featureGroups.put(group, new Boolean(true)); + return true; + } + return false; + } + + /** + * get visible or invisible groups + * + * @param visible + * true to return visible groups, false to return hidden ones. + * @return list of groups + */ + @Override + public List getGroups(boolean visible) + { + if (featureGroups != null) + { + ArrayList gp = new ArrayList(); + + for (Object grp : featureGroups.keySet()) + { + Boolean state = featureGroups.get(grp); + if (state.booleanValue() == visible) + { + gp.add(grp); + } + } + return gp; + } + return null; + } + + @Override + public void setGroupVisibility(String group, boolean visible) + { + featureGroups.put(group, new Boolean(visible)); + } + + @Override + public void setGroupVisibility(List toset, boolean visible) + { + if (toset != null && toset.size() > 0 && featureGroups != null) + { + boolean rdrw = false; + for (String gst : toset) + { + Boolean st = featureGroups.get(gst); + featureGroups.put(gst, new Boolean(visible)); + if (st != null) + { + rdrw = rdrw || (visible != st.booleanValue()); + } + } + if (rdrw) + { + // set local flag indicating redraw needed ? + } + } + } + + @Override + public Hashtable getDisplayedFeatureCols() + { + Hashtable fcols = new Hashtable(); + if (getViewport().getFeaturesDisplayed() == null) + { + return fcols; + } + Iterator en = getViewport().getFeaturesDisplayed() + .getVisibleFeatures(); + while (en.hasNext()) + { + String col = en.next(); + fcols.put(col, getColour(col)); + } + return fcols; + } + + @Override + public FeaturesDisplayedI getFeaturesDisplayed() + { + return av.getFeaturesDisplayed(); + } + + @Override + public String[] getDisplayedFeatureTypes() + { + String[] typ = null; + typ = getRenderOrder().toArray(new String[0]); + FeaturesDisplayedI feature_disp = av.getFeaturesDisplayed(); + if (feature_disp != null) + { + synchronized (feature_disp) + { + for (int i = 0; i < typ.length; i++) + { + if (!feature_disp.isVisible(typ[i])) + { + typ[i] = null; + } + } + } + } + return typ; + } + + @Override + public String[] getDisplayedFeatureGroups() + { + String[] gps = null; + ArrayList _gps = new ArrayList(); + Iterator en = getFeatureGroups().iterator(); + int g = 0; + boolean valid = false; + while (en.hasNext()) + { + String gp = (String) en.next(); + if (checkGroupVisibility(gp, false)) + { + valid = true; + _gps.add(gp); + } + if (!valid) + { + return null; + } + else + { + gps = new String[_gps.size()]; + _gps.toArray(gps); + } + } + return gps; + } + +} diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java new file mode 100644 index 0000000..6e85b83 --- /dev/null +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererSettings.java @@ -0,0 +1,77 @@ +package jalview.viewmodel.seqfeatures; + +import jalview.schemes.GraduatedColor; + +import java.util.Arrays; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class FeatureRendererSettings implements Cloneable +{ + String[] renderOrder; + + Map featureGroups; + + Map featureColours; + + float transparency; + + Map featureOrder; + + public FeatureRendererSettings(String[] renderOrder, + Hashtable featureGroups, Hashtable featureColours, + float transparency, Hashtable featureOrder) + { + super(); + this.renderOrder = Arrays.copyOf(renderOrder,renderOrder.length); + this.featureGroups = new ConcurrentHashMap(featureGroups); + this.featureColours = new ConcurrentHashMap(featureColours); + this.transparency = transparency; + this.featureOrder = new ConcurrentHashMap(featureOrder); + } + + /** + * create an independent instance of the feature renderer settings + * + * @param fr + */ + public FeatureRendererSettings( + jalview.viewmodel.seqfeatures.FeatureRendererModel fr) + { + renderOrder = null; + featureGroups = new ConcurrentHashMap(); + featureColours = new ConcurrentHashMap(); + featureOrder = new ConcurrentHashMap(); + if (fr.renderOrder != null) + { + this.renderOrder = new String[fr.renderOrder.length]; + System.arraycopy(fr.renderOrder, 0, renderOrder, 0, + fr.renderOrder.length); + } + if (fr.featureGroups != null) + { + this.featureGroups = new ConcurrentHashMap(fr.featureGroups); + } + if (fr.featureColours != null) + { + this.featureColours = new ConcurrentHashMap(fr.featureColours); + } + Iterator en = fr.featureColours.keySet().iterator(); + while (en.hasNext()) + { + Object next = en.next(); + Object val = featureColours.get(next); + if (val instanceof GraduatedColor) + { + featureColours.put(next, new GraduatedColor((GraduatedColor) val)); + } + } + this.transparency = fr.transparency; + if (fr.featureOrder != null) + { + this.featureOrder = new ConcurrentHashMap(fr.featureOrder); + } + } +} \ No newline at end of file diff --git a/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java b/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java new file mode 100644 index 0000000..57d57da --- /dev/null +++ b/src/jalview/viewmodel/seqfeatures/FeatureSettingsModel.java @@ -0,0 +1,8 @@ +package jalview.viewmodel.seqfeatures; + +import jalview.api.FeatureSettingsModelI; + +public class FeatureSettingsModel implements FeatureSettingsModelI +{ + +} diff --git a/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java new file mode 100644 index 0000000..b04764c --- /dev/null +++ b/src/jalview/viewmodel/seqfeatures/FeaturesDisplayed.java @@ -0,0 +1,94 @@ +package jalview.viewmodel.seqfeatures; + +import jalview.api.FeaturesDisplayedI; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; + +public class FeaturesDisplayed implements FeaturesDisplayedI +{ + private HashSet featuresDisplayed = new HashSet(); + + private HashSet featuresRegistered = new HashSet(); + + public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2) + { + Iterator fdisp = featuresDisplayed2.getVisibleFeatures(); + String ftype; + while (fdisp.hasNext()) + { + ftype = fdisp.next(); + featuresDisplayed.add(ftype); + featuresRegistered.add(ftype); + } + } + + public FeaturesDisplayed() + { + // TODO Auto-generated constructor stub + } + + @Override + public Iterator getVisibleFeatures() + { + return featuresDisplayed.iterator(); + } + + @Override + public boolean isVisible(String featureType) + { + return featuresDisplayed.contains(featureType); + } + + @Override + public boolean areVisible(Collection featureTypes) + { + return featuresDisplayed.containsAll(featureTypes); + } + + @Override + public void clear() + { + featuresDisplayed.clear(); + featuresRegistered.clear(); + } + + @Override + public void setAllVisible(Collection makeVisible) + { + featuresDisplayed.addAll(makeVisible); + featuresRegistered.addAll(makeVisible); + } + + @Override + public void setAllRegisteredVisible() + { + featuresDisplayed.addAll(featuresRegistered); + } + + @Override + public void setVisible(String featureType) + { + featuresDisplayed.add(featureType); + featuresRegistered.add(featureType); + } + + @Override + public boolean isRegistered(String type) + { + return featuresRegistered.contains(type); + } + + @Override + public int getVisibleFeatureCount() + { + return featuresDisplayed.size(); + } + + @Override + public int getRegisterdFeaturesCount() + { + return featuresRegistered.size(); + } +} diff --git a/src/jalview/ws/AWSThread.java b/src/jalview/ws/AWSThread.java index edb56a9..d3682d4 100644 --- a/src/jalview/ws/AWSThread.java +++ b/src/jalview/ws/AWSThread.java @@ -28,7 +28,7 @@ import jalview.datamodel.AlignmentView; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.WebserviceInfo; -import jalview.gui.FeatureRenderer.FeatureRendererSettings; +import jalview.viewmodel.seqfeatures.FeatureRendererSettings; import jalview.util.MessageManager; public abstract class AWSThread extends Thread diff --git a/src/jalview/ws/HttpClientUtils.java b/src/jalview/ws/HttpClientUtils.java index 229fa4e..1bdf64f 100644 --- a/src/jalview/ws/HttpClientUtils.java +++ b/src/jalview/ws/HttpClientUtils.java @@ -29,6 +29,7 @@ import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; +import org.apache.http.HttpVersion; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; @@ -40,6 +41,9 @@ import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.InputStreamBody; import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.params.BasicHttpParams; +import org.apache.http.params.CoreProtocolPNames; +import org.apache.http.params.HttpParams; /** * Helpful procedures for working with services via HTTPClient @@ -64,7 +68,10 @@ public class HttpClientUtils List vals) throws ClientProtocolException, IOException { - HttpClient httpclient = new DefaultHttpClient(); + HttpParams params = new BasicHttpParams(); + params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, + HttpVersion.HTTP_1_1); + HttpClient httpclient = new DefaultHttpClient(params); HttpPost httppost = new HttpPost(postUrl); UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8"); httppost.setEntity(ue); diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index 6c438be..929581d 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -351,7 +351,7 @@ public class AADisorderClient extends JabawsCalcWorker implements { if (dispFeatures) { - jalview.gui.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap) + jalview.api.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap) .cloneFeatureRenderer(); for (String ft : fc.keySet()) { diff --git a/src/jalview/ws/rest/params/AnnotationFile.java b/src/jalview/ws/rest/params/AnnotationFile.java index 0268c35..1820182 100644 --- a/src/jalview/ws/rest/params/AnnotationFile.java +++ b/src/jalview/ws/rest/params/AnnotationFile.java @@ -73,9 +73,8 @@ public class AnnotationFile extends InputType if (format.equals(JVANNOT)) { return new StringBody( - new jalview.io.AnnotationFile().printAnnotations( - al.getAlignmentAnnotation(), al.getGroups(), - al.getProperties())); + new jalview.io.AnnotationFile() + .printAnnotationsForAlignment(al)); } else { diff --git a/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java new file mode 100644 index 0000000..1dbaa4a --- /dev/null +++ b/test/jalview/analysis/scoremodels/FeatureScoreModelTest.java @@ -0,0 +1,74 @@ +package jalview.analysis.scoremodels; + +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.io.FileLoader; +import jalview.io.FormatAdapter; + +import org.junit.Assert; +import org.junit.Test; + +public class FeatureScoreModelTest +{ + public static String alntestFile = "FER1_MESCR/72-76 DVYIL\nFER1_SPIOL/71-75 DVYIL\nFER3_RAPSA/21-25 DVYVL\nFER1_MAIZE/73-77 DVYIL\n"; + + int[] sf1 = new int[] + { 74, 74, 73, 73, 23, 23, -1, -1 }; + + int[] sf2 = new int[] + { -1, -1, 74, 75, -1, -1, 76, 77 }; + + int[] sf3 = new int[] + { -1, -1, -1, -1, -1, -1, 76, 77 }; + + @Test + public void testFeatureScoreModel() throws Exception + { + AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(alntestFile, + FormatAdapter.PASTE); + AlignmentI al = alf.getViewport().getAlignment(); + Assert.assertEquals(4, al.getHeight()); + Assert.assertEquals(5, al.getWidth()); + for (int i = 0; i < 4; i++) + { + SequenceI ds = al.getSequenceAt(i).getDatasetSequence(); + if (sf1[i * 2] > 0) + { + ds.addSequenceFeature(new SequenceFeature("sf1", "sf1", "sf1", + sf1[i * 2], sf1[i * 2 + 1], "sf1")); + } + if (sf2[i * 2] > 0) + { + ds.addSequenceFeature(new SequenceFeature("sf2", "sf2", "sf2", + sf2[i * 2], sf2[i * 2 + 1], "sf2")); + } + if (sf3[i * 2] > 0) + { + ds.addSequenceFeature(new SequenceFeature("sf3", "sf3", "sf3", + sf3[i * 2], sf3[i * 2 + 1], "sf3")); + } + } + alf.setShowSeqFeatures(true); + alf.getFeatureRenderer().setVisible("sf1"); + alf.getFeatureRenderer().setVisible("sf2"); + alf.getFeatureRenderer().setVisible("sf3"); + alf.getFeatureRenderer().findAllFeatures(true); + Assert.assertEquals("Number of feature types", 3, alf + .getFeatureRenderer().getDisplayedFeatureTypes().length); + Assert.assertTrue(alf.getCurrentView().areFeaturesDisplayed()); + FeatureScoreModel fsm = new FeatureScoreModel(); + Assert.assertTrue(fsm.configureFromAlignmentView(alf.getCurrentView() + .getAlignPanel())); + alf.selectAllSequenceMenuItem_actionPerformed(null); + float[][] dm = fsm.findDistances(alf.getViewport().getAlignmentView( + true)); + Assert.assertTrue("FER1_MESCR should be identical with RAPSA (2)", + dm[0][2] == 0f); + Assert.assertTrue( + "FER1_MESCR should be further from SPIOL (1) than it is from RAPSA (2)", + dm[0][1] > dm[0][2]); + + } +} diff --git a/test/jalview/datamodel/SequenceTest.java b/test/jalview/datamodel/SequenceTest.java index 3f91710..40476a0 100644 --- a/test/jalview/datamodel/SequenceTest.java +++ b/test/jalview/datamodel/SequenceTest.java @@ -12,7 +12,7 @@ import org.junit.Test; public class SequenceTest { - Sequence seq; + SequenceI seq; @Before public void setUp() @@ -20,6 +20,21 @@ public class SequenceTest seq = new Sequence("FER1", "AKPNGVL"); } @Test + public void testInsertGapsAndGapmaps() + { + SequenceI aseq = seq.deriveSequence(); + aseq.insertCharAt(2, 3, '-'); + aseq.insertCharAt(6, 3, '-'); + assertEquals("Gap insertions not correct", "AK---P---NGVL", + aseq.getSequenceAsString()); + List gapInt = aseq.getInsertions(); + assertEquals("Gap interval 1 start wrong", 2, gapInt.get(0)[0]); + assertEquals("Gap interval 1 end wrong", 4, gapInt.get(0)[1]); + assertEquals("Gap interval 2 start wrong", 6, gapInt.get(1)[0]); + assertEquals("Gap interval 2 end wrong", 8, gapInt.get(1)[1]); + } + + @Test public void testGetAnnotation() { // initial state returns null not an empty array @@ -94,7 +109,7 @@ public class SequenceTest @Test public void testAddAlignmentAnnotation() { - assertNull(seq.annotation); + assertNull(seq.getAnnotation()); final AlignmentAnnotation annotation = new AlignmentAnnotation("a", "b", 2d); assertNull(annotation.sequenceRef); diff --git a/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java new file mode 100644 index 0000000..7dfbba1 --- /dev/null +++ b/test/jalview/ext/rbvi/chimera/ChimeraCommandsTest.java @@ -0,0 +1,92 @@ +package jalview.ext.rbvi.chimera; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.awt.Color; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.junit.Test; + +public class ChimeraCommandsTest +{ + @Test + public void testAddColourRange() + { + Map>>> map = new LinkedHashMap>>>(); + ChimeraCommands.addColourRange(map, Color.pink, 1, 2, 4, "A"); + ChimeraCommands.addColourRange(map, Color.pink, 1, 8, 8, "A"); + ChimeraCommands.addColourRange(map, Color.pink, 1, 5, 7, "B"); + ChimeraCommands.addColourRange(map, Color.red, 1, 3, 5, "A"); + ChimeraCommands.addColourRange(map, Color.red, 0, 1, 4, "B"); + ChimeraCommands.addColourRange(map, Color.orange, 0, 5, 9, "C"); + + // three colours mapped + assertEquals(3, map.keySet().size()); + + // Red has two models, Pink and Orange one each + assertEquals(2, map.get(Color.red).keySet().size()); + assertEquals(1, map.get(Color.orange).keySet().size()); + assertEquals(1, map.get(Color.pink).keySet().size()); + + // pink model 1 has two chains, red.0 / red.1 / orange.0 one each + assertEquals(2, map.get(Color.pink).get(1).keySet().size()); + assertEquals(1, map.get(Color.red).get(0).keySet().size()); + assertEquals(1, map.get(Color.red).get(1).keySet().size()); + assertEquals(1, map.get(Color.orange).get(0).keySet().size()); + + // inspect positions + List posList = map.get(Color.pink).get(1).get("A"); + assertEquals(2, posList.size()); + assertTrue(Arrays.equals(new int[] + { 2, 4 }, posList.get(0))); + assertTrue(Arrays.equals(new int[] + { 8, 8 }, posList.get(1))); + + posList = map.get(Color.pink).get(1).get("B"); + assertEquals(1, posList.size()); + assertTrue(Arrays.equals(new int[] + { 5, 7 }, posList.get(0))); + + posList = map.get(Color.red).get(0).get("B"); + assertEquals(1, posList.size()); + assertTrue(Arrays.equals(new int[] + { 1, 4 }, posList.get(0))); + + posList = map.get(Color.red).get(1).get("A"); + assertEquals(1, posList.size()); + assertTrue(Arrays.equals(new int[] + { 3, 5 }, posList.get(0))); + + posList = map.get(Color.orange).get(0).get("C"); + assertEquals(1, posList.size()); + assertTrue(Arrays.equals(new int[] + { 5, 9 }, posList.get(0))); + } + + @Test + public void testBuildColourCommands() + { + + Map>>> map = new LinkedHashMap>>>(); + ChimeraCommands.addColourRange(map, Color.blue, 0, 2, 5, "A"); + ChimeraCommands.addColourRange(map, Color.blue, 0, 7, 7, "B"); + ChimeraCommands.addColourRange(map, Color.blue, 0, 9, 23, "A"); + ChimeraCommands.addColourRange(map, Color.blue, 1, 1, 1, "A"); + ChimeraCommands.addColourRange(map, Color.blue, 1, 4, 7, "B"); + ChimeraCommands.addColourRange(map, Color.yellow, 1, 8, 8, "A"); + ChimeraCommands.addColourRange(map, Color.yellow, 1, 3, 5, "A"); + ChimeraCommands.addColourRange(map, Color.red, 0, 3, 5, "A"); + + // Colours should appear in the Chimera command in the order in which + // they were added; within colour, by model, by chain, and positions as + // added + String command = ChimeraCommands.buildColourCommands(map).get(0); + assertEquals( + "color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B; color #ffff00 #1:8.A,3-5.A; color #ff0000 #0:3-5.A", + command); + } +} diff --git a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java index 1736af5..858806b 100644 --- a/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java +++ b/test/jalview/ext/rbvi/chimera/JalviewChimeraView.java @@ -1,19 +1,14 @@ package jalview.ext.rbvi.chimera; -import static org.junit.Assert.*; +import static org.junit.Assert.assertTrue; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.StructureViewer; -import jalview.gui.StructureViewer.Viewer; +import jalview.gui.StructureViewer.ViewerType; import jalview.io.FormatAdapter; -import java.awt.Desktop; -import java.io.File; - -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -58,25 +53,30 @@ public class JalviewChimeraView if (dsq.getPDBId()!=null && dsq.getPDBId().size()>0) { for (int q=0;q 0 + assertTrue(refseq.getAnnotation() != null + && refseq.getAnnotation().length > 0); + assertTrue(newseq.getAnnotation() != null && newseq.getAnnotation().length > 0); for (AlignmentAnnotation oannot : refseq.getAnnotation()) { diff --git a/test/jalview/util/ColorUtilsTest.java b/test/jalview/util/ColorUtilsTest.java index da2e6ca..3bbcf27 100644 --- a/test/jalview/util/ColorUtilsTest.java +++ b/test/jalview/util/ColorUtilsTest.java @@ -39,4 +39,17 @@ public class ColorUtilsTest ColorUtils.brighterThan(darkColour)); assertNull(ColorUtils.brighterThan(null)); } + + /** + * @see http://www.rtapo.com/notes/named_colors.html + */ + @Test + public void testToTkCode() + { + assertEquals("#fffafa", ColorUtils.toTkCode(new Color(255, 250, 250))); // snow + assertEquals("#e6e6fa", ColorUtils.toTkCode(new Color(230, 230, 250))); // lavender + assertEquals("#dda0dd", ColorUtils.toTkCode(new Color(221, 160, 221))); // plum + assertEquals("#800080", ColorUtils.toTkCode(new Color(128, 0, 128))); // purple + assertEquals("#00ff00", ColorUtils.toTkCode(new Color(0, 255, 0))); // lime + } } diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java index db7d505..1e47800 100644 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@ -20,11 +20,9 @@ */ package jalview.ws.jabaws; -import static org.junit.Assert.*; - -import java.util.ArrayList; -import java.util.List; - +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.io.AnnotationFile; @@ -34,6 +32,9 @@ import jalview.ws.jws2.AADisorderClient; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.jabaws2.Jws2Instance; +import java.util.ArrayList; +import java.util.List; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -124,9 +125,8 @@ public class DisorderAnnotExportImport { String aligfileout = new FormatAdapter().formatSequences("PFAM", al.getSequencesArray()); - String anfileout = new AnnotationFile().printAnnotations( - al.getAlignmentAnnotation(), al.getGroups(), - al.getProperties()); + String anfileout = new AnnotationFile() + .printAnnotationsForAlignment(al); assertTrue( "Test " + testname diff --git a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java index f0b8f99..0743581 100644 --- a/test/jalview/ws/jabaws/JpredJabaStructExportImport.java +++ b/test/jalview/ws/jabaws/JpredJabaStructExportImport.java @@ -33,7 +33,6 @@ import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.SequenceAnnotationWSClient; import jalview.ws.jws2.jabaws2.Jws2Instance; -import jalview.ws.params.ArgumentI; import jalview.ws.params.AutoCalcSetting; import java.awt.Component; @@ -81,7 +80,9 @@ public class JpredJabaStructExportImport System.out.println("State of jpredws: " + jpredws); if (jpredws == null) + { System.exit(0); + } jalview.io.FileLoader fl = new jalview.io.FileLoader(false); @@ -186,9 +187,8 @@ public class JpredJabaStructExportImport String aligfileout = new FormatAdapter().formatSequences("PFAM", al.getSequencesArray()); - String anfileout = new AnnotationFile().printAnnotations( - al.getAlignmentAnnotation(), al.getGroups(), - al.getProperties()); + String anfileout = new AnnotationFile() + .printAnnotationsForAlignment(al); assertTrue( "Test " + testname @@ -270,10 +270,10 @@ public class JpredJabaStructExportImport // write out parameters jalview.gui.AlignFrame nalf = null; assertTrue("Couldn't write out the Jar file", - new Jalview2XML(false).SaveAlignment(af, + new Jalview2XML(false).saveAlignment(af, "testJPredWS_param.jar", "trial parameter writeout")); assertTrue("Couldn't read back the Jar file", (nalf = new Jalview2XML( - false).LoadJalviewAlign("testJpredWS_param.jar")) != null); + false).loadJalviewAlign("testJpredWS_param.jar")) != null); if (nalf != null) { AutoCalcSetting acs = af.getViewport().getCalcIdSettingsFor( diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 9a723ca..5eeff50 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -20,33 +20,27 @@ */ package jalview.ws.jabaws; -import static org.junit.Assert.*; - -import java.awt.Component; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Vector; - -import javax.swing.JMenu; -import javax.swing.JMenuItem; - -import jalview.api.AlignCalcManagerI; -import jalview.datamodel.AlignmentAnnotation; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import jalview.datamodel.AlignmentI; -import jalview.datamodel.Annotation; import jalview.gui.Jalview2XML; import jalview.io.AnnotationFile; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; -import jalview.ws.jws2.AADisorderClient; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.RNAalifoldClient; import jalview.ws.jws2.SequenceAnnotationWSClient; -import jalview.ws.jws2.dm.JabaOption; import jalview.ws.jws2.jabaws2.Jws2Instance; import jalview.ws.params.AutoCalcSetting; +import java.awt.Component; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JMenu; +import javax.swing.JMenuItem; + import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; @@ -84,7 +78,9 @@ public class RNAStructExportImport System.out.println("State of rnaalifoldws: " + rnaalifoldws); if (rnaalifoldws == null) + { System.exit(0); + } jalview.io.FileLoader fl = new jalview.io.FileLoader(false); @@ -137,9 +133,8 @@ public class RNAStructExportImport String aligfileout = new FormatAdapter().formatSequences("PFAM", al.getSequencesArray()); - String anfileout = new AnnotationFile().printAnnotations( - al.getAlignmentAnnotation(), al.getGroups(), - al.getProperties()); + String anfileout = new AnnotationFile() + .printAnnotationsForAlignment(al); assertTrue( "Test " + testname @@ -220,10 +215,10 @@ public class RNAStructExportImport // write out parameters jalview.gui.AlignFrame nalf = null; assertTrue("Couldn't write out the Jar file", - new Jalview2XML(false).SaveAlignment(af, + new Jalview2XML(false).saveAlignment(af, "testRnalifold_param.jar", "trial parameter writeout")); assertTrue("Couldn't read back the Jar file", (nalf = new Jalview2XML( - false).LoadJalviewAlign("testRnalifold_param.jar")) != null); + false).loadJalviewAlign("testRnalifold_param.jar")) != null); if (nalf != null) { AutoCalcSetting acs = af.getViewport().getCalcIdSettingsFor( diff --git a/utils/InstallAnywhere/Jalview.iap_xml b/utils/InstallAnywhere/Jalview.iap_xml index ecd0306..d77a93b 100755 --- a/utils/InstallAnywhere/Jalview.iap_xml +++ b/utils/InstallAnywhere/Jalview.iap_xml @@ -1040,6 +1040,58 @@ and any path to a file to save to the file]]> + + + + + + false + + + true + + + true + + + + + + + + + + + + false + + + + + + true + + + true + + + true + + + + + + 348699 + + + false + + + 0 + + + + @@ -6324,8 +6376,11 @@ and any path to a file to read from that file]]> - - + + + + + @@ -7062,8 +7117,9 @@ and any path to a file to read from that file]]> - - + + +