Title: Ensembl website refactoring
1- Ensembl website refactoring
- James Smith
- Js5_at_sanger.ac.uk
- Ensembl Web Team Project Leader
2New design
Information about release
Search box on all pages.
Context sensitive links
Dynamic error handling, sending errors to the
browser.
How-to style links
3New design
Information style panel
Spreadsheet style panel
4New design
Print previews have been styled so that the
output is rendered without a lot of the
decoration and navigation of the webpage.
5New design
Release information moved to top right
No navigation menu, help link, search.
Collapsed panelsnot displayed inprint mode.
/- boxes and navigation tools hidden
6New design no CSS??
Viewing page with CSS disabled, this is the view
a screen reader will see
7Plugins
- Currently if we wish to have two variants of the
website, then we need to have two copies of the
whole code to allow for minor tweaks in a large
number of modules. This means - Whenever the core Ensembl webcode is updated,
each variant has to work their modifications back
into the main branch risking missing changes
and wasting development time. - In the redevelopment we are developing a plugin
system, where - Each variant has its own set of modules a
Plugin outside the core webcode, which add
to, replace or modify the action of the core
modules.
8Plugins changes requried
- Plugins will allow us to
- add additional scripts
- add/modify panels within scripts.
- Changes to the code will be extensive (most will
need re-writing) but relatively simple - EWRendererObjectTypeHTML objects split
into EWComponentObjectType (for
rendering) and EWConfigurationObjectType
(for configuration) - EWDataFactoryObjectTypeFactory modules
will be replaced by EWFactoryObjectType - EWDataObjectType modules will be replaced
by EWObjectObjectType modules.
9- Extending the
- Ensembl Website
- Part 1 Writing a new script.
- James Smith
- Js5_at_sanger.ac.uk
- Ensembl Web Team Project Leader
10Writing a new script
- To add a new script we need to
- Write a new script in perl/default
- And one or more of the following
- new ScriptConfig module
- new Factory module and/or functions
- new Object module and/or functions
- new Configuration module and/or functions
- new Component module and/or functions
- We will look at writing a status page
11Current status module
- Current status script produces a plain text page
12New status display
13The Script
- The script needs to
- Handle user input, either directly from the
web-page parameters or through web-page
cookies webpage new EnsEMBLWebWebpage(
... ) - Set up any objects required webpage new
EnsEMBLWebWebpage( ... ) - Handle errors that are generated
webpage-gthas_a_problem webpage-gtrender_er
ror_page - Configure the display webpage-gtconfigure( ...
) - Render the display webpage-gtrender
14Sample webpage script
- !/usr/local/bin/perl
- package status
- use strict
- use warnings
- no warnings "uninitialized"
- use EnsEMBLWebWebPage
- Initialize the page
- EnsEMBLWebWebPage is effectively a
webpage factory, which creates elements - the elements of the webpage including the
renderer, factory, objects, etc. - Parameters
- 'scriptname gt opt set if want to use alt.
scripts input checks - 'objecttype gt req type of object to use
(BEObjectGene,... - 'renderer gt opt defaults to Apache,
where to send output - 'outputtype gt res in future will may
allow rendering in Text, XML, PDF, Excel - my webpage new EnsEMBLWebWebPage(
'objecttype' gt 'Server )
15New status display
Configured by context_menu
Configured by status
16Configuring the display
- To configure the display we have to add elements
to the webpage - The main content of the webpage is made up one
or more panels, which we have to configure at
this stage. - The left-hand navigation menu is made up of one
or more input blocks. - The configuration functions can create or extend
these panels or blocks. - To add a panel self-gtpage-gtcontent-gtadd_panel
( ... ) - To add a section to a panel self-gtpage-gtconten
t-gtpanel( ... )-gtadd_component_first() etc - To add a menu block self-gtpage-gtmenu-gtadd_blo
ck( ... ) - To add a menu entry self-gtpage-gtmenu-gtadd_ent
ry( ... )
17Sample Configuration module
use EnsEMBLWebWebPage my webpage new
EnsEMBLWebWebPage( 'objecttype' gt
'Server ) foreach _at_webpage-gtdataObjects
webpage-gtconfigure( _, qw(status context_menu)
) webpage-gtrender()
- package EnsEMBLWebConfigurationServer
- use strict
- use EnsEMBLWebConfiguration
- our _at_ISA qw( EnsEMBLWebConfiguration )
- sub status
- my self shift
- my content self-gtpage-gtcontent
- First panel, two-column style displaying
the server information. - if( my panel1 self-gtnew_panel(
"Information", - 'code' gt "info",
Name this one info - 'caption' gt 'Current server information',
This is its caption - 'object' gt self-gtobject
Finally pass it the WebObject object. - ) )
- panel1-gtadd_components(qw(
- name EnsEMBLWebComponentServer
name - url EnsEMBLWebComponentServer
url - version EnsEMBLWebComponentServer
version - webserver EnsEMBLWebComponentServer
webserver
This function creates the two panels used to
generate the right hand side of the status, one
based on the two-column format, and one based
on a spreadsheet layout.
18Sample Configuration module
use EnsEMBLWebWebPage my webpage new
EnsEMBLWebWebPage( 'objecttype' gt
'Server ) foreach _at_webpage-gtdataObjects
webpage-gtconfigure( _, qw(status context_menu)
) webpage-gtrender()
- package EnsEMBLWebConfigurationServer
- ......
- sub context_menu
- my self shift
- self-gtadd_block( 'server', 'bulleted', 'Server
information' ) - self-gtadd_entry( server',
- 'text' gt 'Server information',
- 'href' gt "/ENV'ENSEMBL_SPECIES'/status
- )
- my colourmap_URL "/ENV'ENSEMBL_SPECIES'/co
lourmap" - my _at_colourmap_OPT (
- 'Sorted by Red, Green' gt
colourmap_URL?sortrgb , - 'Sorted by Red, Blue' gt
colourmap_URL?sortrbg , - 'Sorted by Green, Red' gt
colourmap_URL?sortgrb , - 'Sorted by Green, Blue' gt
colourmap_URL?sortgbr , - 'Sorted by Blue, Red' gt
colourmap_URL?sortbrg , - 'Sorted by Blue, Green' gt
colourmap_URL?sortbgr ,
This function creates a left-hand-side
navigation menu block, and adds entries for the
status page, and also the colour-map script.This
menu is shared with the colour map script.
19Handling persistent user info
- There are two types of user configuration stored
on the server based on a users cookie. You will
already be familiar with the EnsEMBLWebUserCon
fig objects for configuring the images on the
pages these will be kept. - We are now adding a second type,
EnsEMBLWebScriptConfig, these hold script
specific information. You create a
EnsEMBLWebScriptConfig object which is
configured by the package EnsEMBLWebScriptConf
igscriptname, and/or plugin packages. - This package contains a single function init
which acts on the EWSC object when it is
created and sets the default values for the
ScriptConfig object. - The storage of the cookie is transparent to the
script it is embedded in the new call for the
EnsEMBLWebWebPage object, so you dont have
to worry about calling it.
20Sample ScriptConfig module
use EnsEMBLWebWebPage my webpage new
EnsEMBLWebWebPage( 'objecttype' gt
'Server ) foreach _at_webpage-gtdataObjects
webpage-gtconfigure( _, qw(status context_menu)
) webpage-gtrender()
- package EnsEMBLWebScriptConfigstatus
- use strict
- sub init
- my (script_config) _at__
- script_config-gt_set_defaults(qw(
- panel_species on
- ))
-
- 1
ScriptConfigs are not objects they contain
just a single function init which is called
with the ScriptConfig object passed to it as the
first parameter, and act upon this ScriptConfig
object.The modules name is based on the name of
the script which is being configured. In this
case we are configuring the species panel to be
collapsible.
21Status display with collapsed panel
Collapsed status stored in theEnsEMBLWebScrip
tConfigin the flag panel_species
22Printing collapsed panels (or not!)
- Changed printer layout.
- release stripe, search box, menus all hidden
when printing output - release information moved to new location.
Collapsed portion isnt displayed at all in the
printer preview version.
23Sample Component module
panel1-gtadd_rows(qw( name
EnsEMBLWebComponentServername url
EnsEMBLWebComponentServerurl version
EnsEMBLWebComponentServerversion
webserver EnsEMBLWebComponentServerwebser
ver perl EnsEMBLWebComponentServer
perl database EnsEMBLWebComponentServer
database contact EnsEMBLWebComponentSe
rvercontact ))
- package EnsEMBLWebComponentServer
- use strict
- sub name
- my( panel, object ) _at__
- (my DATE object-gtspecies_defs-gtARCHIVE_VERSI
ON ) s/(\d)/ \1/ - panel-gtadd_row( 'Site summary',
- qq(ltpgt_at_object-gtspecies_defs-gtENSEMBL_SITETY
PE - DATElt/pgt) - )
- 1
-
- sub url
- my(panel, object) _at__
- panel-gtadd_row( 'Web address',
- qq(ltpgt_at_ object-gtfull_URL( 'species' gt ''
) lt/pgt) - )
24Sample Component module
panel2-gtadd_component( qw( EnsEMBLWebCompon
entServerspreadsheet_Species ))
- package EnsEMBLWebComponentServer
- use strict
- sub spreadsheet_Species
- my( panel, object ) _at__
- panel-gtadd_columns(
- 'key' gt 'species',
- 'align' gt 'left',
- 'title' gt 'Species',
- 'format' gt sub return sprintf( qq(lta
href"s"gtltigtslt/igtlt/agt), _1'link', _0 )
, - 'key' gt 'common',
- 'align' gt 'left',
- 'title' gt 'Common name' ,
- 'key' gt 'gp',
- 'align' gt 'left',
- 'title' gt 'Golden Path' ,
- 'key' gt 'version',
- 'align' gt 'left',
25New status display
Columns defined by add_columns call in
spreadsheet_Species()
Links generated using thecode reference
definedin the add_columns call
26Sample Object module
package EnsEMBLWebComponentServer sub
spreadsheet_Species my( panel, object )
_at__ panel-gtadd_columns( ... ) foreach(
object-gtget_all_species ) panel-gtadd_row(
_ ) return 1
- package EnsEMBLWebObjectServer
- use strict
- use warnings
- no warnings "uninitialized"
- use EnsEMBLWebObject
- our _at_ISA qw(EnsEMBLWebObject)
- sub get_all_species
- my self shift
- _at_species _at_ self-gtspecies_defs-gtENSEMBL_SPECI
ES - my _at_data ()
- foreach my species (_at_species)
- (my name species ) s/_/ /g
- push _at_data,
- 'species gt name,
- 'common gt self-gtspecies_defs-gtother_spec
ies( species, 'SPECIES_COMMON_NAME' ), - 'link gt self-gtfull_URL(
'species'gtspecies ),
This object is very simple as it doesnt have
ensembl object attached, as we can get
everything we need from the species_defs
call The columns in the spreadsheet have keys
species, common, gp and version. The
additional hash element link is used code
reference 'format' gt sub return sprintf(
qq(lta href"s"gtltigtslt/igtlt/agt), _1'link',
_0 ) This code reference, reformats the
species column to be wrapped in an web-link.
For the code reference _0 is the appropriate
element of the row (in this case rowspecies)
and _1 is the whole row.
27Sample Factory module
if( webpage-gthas_a_problem )
webpage-gtrender_error_page else ...
- package EnsEMBLWebFactoryServer
- use strict
- use warnings
- no warnings "uninitialized"
- use EnsEMBLWebFactory
- use EnsEMBLWebProxyObject
- our _at_ISA qw(EnsEMBLWebFactory)
- sub createObjects
- my self shift
- return self-gtproblem( fatal, Database
error, Could not connect to core database. ) - unless self-gtdatabase(core)
- self-gtDataObjects( EnsEMBLWebProxy-gtnew(
Server, , self-gtDBConnection, self-gtInput
) -
- 1
This factory is very simple as it doesnt have to
create any Ensembl objects, usually the second
parameter to Proxy is the BioEnsEMBL
object. The problem object is created to
propogate errors back to the web-browser.
28New status display
This is the rendered problem object created by
the Factory
29- Extending the
- Ensembl Website
- Part 2 Plugins.
- James Smith
- Js5_at_sanger.ac.uk
- Ensembl Web Team Project Leader
30Plugins why?
- We have implemented plugins for four main
reasons - Makes our lives easier maintaining a number of
different Ensembl sites within the web-team www,
dev, pre, archive, vega, personal development
environments and the public mirror code. - Will make those who create there own local
Ensembl installations lives easier as the can
create a personalised configuration file which
they can copy into any new installation, and it
should just work! - Will make those who extend their local
installation of Ensembl lives easier as any
additional code is stored in their own Plugin
space. - Should allow for external groups to develop
features in Ensembl, which can be incorporated
into anyones Ensembl mirror without being
merged into the main code.
31Plugins using to configure e!
- The simplest use of plugins is to store local
overrides for the configuration. - First edit the conf/Plugins.pm file to specify
where and in what name space your plugin is
stored - To get standalone scripts to run from anywhere
hard code your server-root here!! - SiteDefsENSEMBL_SERVERROOT
/my_ensembl_install/xtreme' - SiteDefsENSEMBL_PLUGINS
- 'MyModuleNameSpace' gt 'Directory/root/of/plu
gin/directory', - 'EnsEMBLMyMirror' gt SiteDefsENSEMBL_SER
VERROOT.'/mymirror/', -
- Second create your plugin directory and the conf
directory within it, in this case - /my_ensembl_install/xtreme/mymirror/ and
- /my_ensembl_install/xtreme/mymirror/conf/
- Third create your own SiteDefs.pm, DEFAULTS.ini
and any other species .ini files in this
directory to over-ride the standard settings.
32Plugins SiteDefs.pm
- package EnsEMBLMyMirrorSiteDefs
- use strict
- update_conf function called by main
SiteDefs.pm - sub update_conf
- SiteDefsENSEMBL_PORT 80
- SiteDefsENSEMBL_USER
my_ensembl_user' - SiteDefsENSEMBL_GROUP
my_ensembl_group' - SiteDefsENSEMBL_SERVERADMIN
me_at_my_ensembl.mydomain.org' - SiteDefsENSEMBL_SERVERNAME
'my_ensembl.mydomain.org' - SiteDefsENSEMBL_MAIL_ERRORS 1
- SiteDefsENSEMBL_ERRORS_TO
me_at_mydomain.org - SiteDefsENSEMBL_DEBUG_FLAGS 24
- SiteDefsENSEMBL_USERDB_NAME
'ensembl_web_user_db' - SiteDefsENSEMBL_USERDB_HOST
'my_mysql.mydomain.org'
33Plugins DEFAULTS.ini
- general
- ENSEMBL_HOST my_mysql.mydomain.org
- ENSEMBL_HOST_PORT 3306
- ENSEMBL_WRITE_USER my_mysql_user
- ENSEMBL_WRITE_PASS my_mysql_pass
- ENSEMBL_DBUSER my_mysql_ro
- ENSEMBL_DBPASS
- ENSEMBL_BINARIES_PATH /usr/local/bin
DotterView - ENSEMBL_EMBOSS_PATH /usr/local/emboss
AlignView - ENSEMBL_WISE2_PATH /usr/local/wise2
AlignView - ENSEMBL_BLAST_BIN_PATH /data/bin/wu_blast
BlastView - ENSEMBL_REPEATMASKER /data/bin/RepeatMasker
BlastView - ENSEMBL_BLAST_FILTER /data/bin/wu_blast/filte
r BlastView - ENSEMBL_BLAST_MATRIX /data/bin/wu_blast/matri
x BlastView - ENSEMBL_BLAST_DATA_PATH /data/blastdb/ensembl
BlastView - ENSEMBL_SEARCH textview
34Plugins using to configure e!
- Here we use a standard Sanger plugin, plus
local development plugins. - To get standalone scripts to run from anywhere
hard code your server-root here!! - SiteDefsENSEMBL_SERVERROOT
/my_ensembl_install/xtreme' - SiteDefsENSEMBL_PLUGINS
- 'MyModuleNameSpace' gt 'Directory/root/of/plu
gin/directory', - 'EnsEMBLMyMirror_js5' gt SiteDefsENSEMBL_SE
RVERROOT.'/mymirror_js5/', - 'EnsEMBLMyMirror' gt SiteDefsENSEMBL_SE
RVERROOT.'/mymirror/', -
- This extra plugin conf contains just the
following SiteDefs.pm file - package EnsEMBLSanger_js5SiteDefs
- sub update_conf
- SiteDefsENSEMBL_PORT
41080 - SiteDefsENSEMBL_USER
'js5' - SiteDefsENSEMBL_SERVERADMIN
'js5_at_mydomain.org' - SiteDefsENSEMBL_SERVERNAME
my_ensembl.mydomain.org'
35- Extending the
- Ensembl Website
- Part 3 Extending the script.
- James Smith
- Js5_at_sanger.ac.uk
- Ensembl Web Team Project Leader
36Extending this display
- Want to add a development plugin which displays
the Apache webserver environment information. - Need additional ConfigurationServer module to
add new panel - Need additional to ObjectServer module to
collect environment information - Need additional Component to configure the
additional panel - Required to update Plugins.pm in conf directory
to include module. - Additionally the plugin will add a rudimentary
sitemap for the static content to the top panel.
37Plugins module
- To get plugins to work with standalone scripts
- you need to specify the server root here!!
- SiteDefsENSEMBL_SERVERROOT
'/ensemblweb/js5/wwwdev/xtreme' - Add our module, Key is namespace, Value is
directory containing plugin. - SiteDefsENSEMBL_PLUGINS
- 'EnsEMBLSanger gt ENSEMBL_SERVERROOT.'/
sanger-plugins/sanger', - 'EnsEMBLSanger_js5 gt ENSEMBL_SERVERROOT.'/
sanger-plugins/js5', - 'EnsEMBLDevelopment gt ENSEMBL_SERVERROOT.'/
public-plugins/development', -
- 1
38Plugin Configuration module
- package EnsEMBLDevelopmentConfigurationServe
r - use strict
- use EnsEMBLWebConfiguration
- our _at_ISA qw( EnsEMBLWebConfiguration )
- use EnsEMBLWebDocumentPanelSpreadSheet
- sub status
- my self shift
- if( my panel2 sefl-gtnew_panel(
'SpreadSheet', - 'code gt 'environment',
- 'caption gt 'Apache environment',
- 'object gt self-gtobject,
- status gt panel_apache
- ) )
- panel2-gtadd_components(qw(apache
EnsEMBLDevelopmentComponentServerspreadshe
et_Apache)) - content-gtadd_panel_last( panel2 )
-
39Plugin ScriptConfig
- package EnsEMBLDevelopmentScriptConfigstatus
- use strict
- sub init
- _0-gt_set_defaults(qw(
- panel_apache on)
- )
-
- 1
40Plugin Component module
- package EnsEMBLDevelopmentComponentServer
- use strict
- sub spreadsheet_Apache
- my( panel, object ) _at__
- panel-gtadd_columns(
- 'key' gt 'key', 'align' gt 'left',
'title' gt 'Key' , - 'key' gt 'value', 'align' gt 'left',
'title' gt 'Value' , - )
- foreach (_at_object-gtget_environment)
- panel-gtadd_row( _ )
-
- return 1
-
- sub static_tree
- my(panel,object) _at__
- panel-gtadd_row( 'Document tree', _sub_tree(
object, '/', 0) )
41Plugin Object module
- package EnsEMBLDevelopmentObjectServer
- use strict
- use warnings
- no warnings "uninitialized"
- use EnsEMBLWebObject
- our _at_ISA qw(EnsEMBLWebObject)
- sub get_environment
- my self shift
- return map 'key'gt_,'value'gtENV_
sort keys ENV -
- 1
42Additional Development panel
Extra SpreadSheet panel configured byby the
plugins Coniguration module
43Additional Development panel
Panel can be collapsed as we set up the
additional status flag in the pluginsScriptConf
igstatus module
44Additional Development panel
Additional menu Item added by Sanger plugin
Extra component in Information Panel addedby
the plugins Coniguration module