0e0c418dfb483343c7071b928e395577fcf195b6
[jalview.git] / utils / jalviewjs / site-resources / jalview_embedded_example1.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Embedded JalviewJS Example 1</title><meta charset="utf-8" />
5 <script src="swingjs/swingjs2.js"></script>
6 <script>
7
8 // BH 2019.10.06 adds Tree and Pca functionality
9 // BH see issue JAL-3451
10
11 if (!self.SwingJS)alert('swingjs2.js was not found. It needs to be in swingjs folder in the same directory as ' + document.location.href)
12 Info = {
13   code: null,
14   main: "jalview.bin.JalviewJS2",
15 //  core: "NONE",
16         core:"_jalview",
17   readyFunction: null,
18         serverURL: 'https://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php',
19         j2sPath: 'swingjs/j2s',
20         console:'none',
21         allowjavascript: true
22 }
23
24 jvGet = function(what) {
25         switch(what) {
26         case "tree":
27                 testApplet.app.openTreePanel$jalview_gui_AlignFrame$S$S(null, "NJ","BLOSUM62")
28                 break;
29         case "pca":
30                 testApplet.app.openPcaPanel$jalview_gui_AlignFrame$S(null, "BLOSUM62")
31                 break;
32         case "3D":
33                 break;
34         }
35         
36 }
37
38 $(document).ready(function() {
39
40   SwingJS.getApplet('testApplet', Info);
41
42 });
43
44 </script>
45 </head>
46 <body style="background-image: url(images/coolVeryLightBG.png);">
47 <table style="width:1400px;border:2px solid lightblue;border-spacing:0;font-size:16pt;" padding="10" valign="top">
48 <tr>
49 <td style="font-size:24;font-weight:bold;background-color:lightblue" colspan=2><center>Demonstration of embedded JalviewJS components</center>
50 </td>
51
52
53 </tr><tr>
54
55
56 <td valign=top style="padding:20px;background-color:lightgray">
57 <div style="padding:20px;width:600px;height:400px;overflow-y:auto;background-color:white">
58 This simple page illustrates how one can embed the JalviewJS desktop into a web page. 
59 The basic idea is that we have something interesting to say &mdash; some sort of scientific context &mdash; something we want to get 
60 across to our visitors with more than just text and images. The idea is to have a <b>dynamic</b> page that will involve <b>user interaction</b>. 
61 <br><br>
62 We start with a Jalview desktop. You can't see it, because I have placed it in a <code>div</code> tag with style <i>width:0px;height:0px</i> just after the period that ends this sentence.
63 <div id="jalview-desktop-div" style="width:0px;height:0px;"></div>
64 <br>
65 The idea is NOT to teach visitors how to use Jalview. The idea is to seamlessly integrate components of Jalview that can be used to enrich a discussion. 
66 Like JSmol in <a target="_blank" href="http://proteopedia.org/wiki/index.php/Main_Page"><img src=https://pbs.twimg.com/profile_images/818051034/proteopedia_135x200_small_logo_for_Twitter_400x400.png width=16 height=16/>Proteopedia</a>.
67 For example, in the space to the right, after a few seconds, you will see an alignment frame. This alignment is for 15 genes that code for one of the domains in the ferredoxin family (<a href=https://pfam.xfam.org/family/NIR_SIR_ferr target=_blank>NIR_SIR_ferr (PF03460)</a>). 
68 <br><br>
69 What you see initially is just the first few residues. Doesn't look like much of an alignment, does it? But <b>scroll to the right</b>. 
70 See the big block of red color? That's the <i>Ferredoxin fold</i>domain.
71
72 </div>
73 </td><td style="background-color:lightgray;padding:20px">
74 <div id="jalview-alignment-div" style="padding:20px;position:relative;top:0px;left:0px;width:680px;height:400px">
75 <br><br>
76 The alignment frame will appear here momentarily. When it does, you can go ahead and manipulate the alignment with your mouse.
77 </div>
78 </td>
79
80
81 </tr><tr>
82
83
84 <td colspan=2 valign=top style="padding:0px 0px 0px 0px"> 
85 <table style="background-color:lightgray"><tr><td  style="padding:0px 0px 0px 20px">
86 <b>Select a few alignments</b> by left-dragging across a few rows of the alignment to make a selection box. 
87 Then click one of the buttons below to see more information about your selected subset of the alignment.
88 <ul>
89 <li><button onclick='jvGet("tree")'>similarity tree</button></li>
90 <li><button onclick='jvGet("pca")'>principal component analysis</button></li>
91 </ul>
92
93
94
95
96 </td><td style="padding:0px 0px 0px 0px">
97 <table style="border-spacing:0"><tr><td style="background-color:lightgray;padding:10px 0px 10px 20px">
98 <div id="jalview-tree-div" style="position:relative;top:0px;left:0px;width:500px;height:500px">
99 <br><br><br><br>
100 jalview-tree-div
101 </div>
102 </td><td style="background-color:lightgray;padding:10px 20px 10px 0px">
103 <div id="jalview-pca-div" style="position:relative;top:0px;left:0px;width:500px;height:500px">
104 <br><br><br><br>
105 jalview-pca-div
106 </div>
107 </td></tr></table>
108
109 </td></tr></table>
110
111
112 </td></tr>
113
114 <tr>
115
116 <td valign=top style="padding:20px;height:650px" >
117
118 <div id="jalview-structureviewer-div" style="position:relative;top:0px;left:0px;width:600px;height:600px">
119 jalview-strucddtureviewer-div
120 </div>
121 </td>
122 <td valign=top style="padding:20px;background-color:white" >
123 One more thing. Let's take a look at the 3D structure of one these proteins. Ferredoxins are important, because they have 
124 iron-sulfur clusters that can accept and deliver electrons in metabolic processes. Let's see if we can find it. 
125 <br><center><button onclick='jvGet("3D")'>add the 3D structure</button>
126 </td></tr></table>
127
128
129 <!-- debugging (hidden) -->
130 <script>getClassList = function(){J2S._saveFile('_j2sclasslist.txt', Clazz.ClassFilesLoaded.sort().join('\n'))}</script>
131 <div style="display:none;position:absolute;left:900px;top:30px;width:600px;height:300px;">
132 <div id="sysoutdiv" style="border:1px solid green;width:100%;height:95%;overflow:auto"></div>
133 This is System.out. <a href="javascript:testApplet._clearConsole()">clear it</a> <br>Add ?j2snocore to URL to see full class list; ?j2sdebug to use uncompressed j2s/core files <br><a href="javascript:getClassList()">get _j2sClassList.txt</a>
134 </div>
135
136 </body>
137 </html>