Difference between revisions of "Co-op Documentation"
(123 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
==Getting Started== | ==Getting Started== | ||
See [[WormBase Staff Resources]]. | See [[WormBase Staff Resources]]. | ||
− | ===Members/Contacts=== | + | ===WormBase WebDev Team Members/Contacts=== |
− | * | + | *Lincoln Stein - [mailto:lincoln.stein@gmail.com lincoln.stein@gmail.com] |
*Todd Harris - [mailto:todd@wormbase.org todd@wormbase.org] | *Todd Harris - [mailto:todd@wormbase.org todd@wormbase.org] | ||
− | * | + | *Sibyl Gao - [mailto:sibyl@wormbase.org sibyl@wormbase.org] |
− | + | *Scott Cain - [mailto:scott@scottcain.net scott@scottcain.net] | |
===Meetings=== | ===Meetings=== | ||
− | |||
− | |||
− | |||
*WormBase OICR Developers Teleconference with Lincoln | *WormBase OICR Developers Teleconference with Lincoln | ||
− | ** | + | **First Friday of the Month, 11:00AM |
− | **Lincoln's office | + | **Phone-in 1-800-747-5150 |
− | + | ***Access Code: 6738514 | |
− | *WormBase International | + | **OR: Lincoln's office |
− | ** | + | *WormBase International Group (HelpDesk) Teleconference |
− | ** | + | **First Thursday of the Month, 11:30AM |
− | + | **1-866-528-2256 | |
***Access Code: 714646 | ***Access Code: 714646 | ||
− | *Group Meeting | + | **[[Help_desk_schedule|HelpDesk Schedule and Agendas]] |
− | **Fridays, | + | **[[Conference calls|Past Agendas and Minutes]] |
+ | *Stein Lab, Group Meeting | ||
+ | **Fridays, 2:00PM | ||
**HL31 Conference Room/TBA | **HL31 Conference Room/TBA | ||
+ | * Web Development Issues Meeting | ||
+ | ** Tuesday 10:00am | ||
+ | ** [[WebDev_Issues_Meetings]] | ||
==Tools/Resources== | ==Tools/Resources== | ||
Line 331: | Line 40: | ||
===Git=== | ===Git=== | ||
+ | ====Intro to Git==== | ||
+ | Tutorial: [http://try.github.io try.github.io] | ||
+ | |||
Git is a version control system used for collaboration and backup in the development process. One starting point is the [http://progit.org/book/ch1-3.html progit tutorial] | Git is a version control system used for collaboration and backup in the development process. One starting point is the [http://progit.org/book/ch1-3.html progit tutorial] | ||
*WormBase repository located at https://github.com/organizations/WormBase | *WormBase repository located at https://github.com/organizations/WormBase | ||
Line 342: | Line 54: | ||
git '''add''' a.txt | git '''add''' a.txt | ||
git '''commit''' -m “Added ''change1'' and ''change2'' to a.txt” | git '''commit''' -m “Added ''change1'' and ''change2'' to a.txt” | ||
+ | git '''pull''' | ||
git '''push''' | git '''push''' | ||
</code> | </code> | ||
− | If | + | Notes: |
− | + | * pull is similar to using 'git fetch' + 'git merge'. However, performing them separately allows you to review the changes coming in before merging. | |
− | + | * the -m flag allows the user to input the message inline. Exlcuding it will result in an editor being opened for message entry | |
− | git | + | |
− | + | ====Setting-Up Repository==== | |
− | + | *If you do not already have an account on GitHub, sign up | |
− | + | *Send a request to [mailto:todd@wormbase.org Todd] to grant you access to both the dev.wormbase.org machine and the WormBase repositories | |
+ | *Connect via ssh to dev.wormbase.org | ||
+ | *Follow the GitHub instructions for [http://help.github.com/linux-set-up-git/ Set Up Git] to configure SSH keys | ||
+ | **Skip step 1, git should already be installed | ||
+ | *To check-out the repository: | ||
+ | $ cd /usr/local/wormbase/website | ||
+ | $ git clone git@github.com:WormBase/website.git | ||
+ | $ mv website [your username] | ||
+ | *See [[Administration:Installing_WormBase]] for more details | ||
===Browser (Debugging)=== | ===Browser (Debugging)=== | ||
Line 359: | Line 80: | ||
*Firefox->Web Developer->Web Console/Error Console | *Firefox->Web Developer->Web Console/Error Console | ||
− | === | + | ===ACeDB=== |
− | |||
− | |||
*ACeDB | *ACeDB | ||
**Usage: | **Usage: | ||
***Navigate to /usr/local/wormbase/acedb/bin and run: "./tace ../wormbase" | ***Navigate to /usr/local/wormbase/acedb/bin and run: "./tace ../wormbase" | ||
***For more help, try the [http://www.acedb.org/Cornell/tace.html tace tutorial] | ***For more help, try the [http://www.acedb.org/Cornell/tace.html tace tutorial] | ||
+ | **Troubleshooting: | ||
+ | ***To restart the server on dev: '''Must be super user''' | ||
+ | /etc/init.d/xinetd stop | ||
+ | ps aux | grep sgiface | ||
+ | !!If sgifaceserver is still running use 'kill #####' (where ##### is the process id) | ||
+ | /etc/init.d/xinetd start | ||
+ | |||
+ | ===CouchDB=== | ||
+ | **Troubleshooting: | ||
+ | ***To restart the server on dev: | ||
+ | sudo /etc/init.d/couchdb restart | ||
+ | |||
+ | ===MySQL=== | ||
+ | **Troubleshooting: | ||
+ | ***To restart the server on dev: | ||
+ | sudo /etc/init.d/mysql restart | ||
+ | |||
+ | ===Template Toolkit=== | ||
+ | *[http://template-toolkit.org/docs/index.html Template Toolkit Documentation] | ||
+ | *Common useful macros for templates can be found in: | ||
+ | **/root/templates/config/main | ||
+ | ***e.g. tags2link | ||
+ | **/root/templates/shared/page_elements.tt2 | ||
+ | ***e.g. cell_content, build_data_table | ||
+ | ***cell_content is mainly used for build_data_table to format the information to be displayed | ||
+ | ****makes use of other macros for displaying special data such as links(MACRO tags2link) and evidence boxes(MACRO evidence) | ||
+ | ****runs into errors when an ACe object is passed. Corrections should be made in the API to prevent ACe objects being returned to interface | ||
+ | ****Can be used to display many types of data (not restricted for use in build_data_table) | ||
+ | ****determines type of the content through a series of checks | ||
+ | *****If the passed reference is an array, it performs recursion on each element | ||
+ | *****If hash, outputs the key followed by the formatted content | ||
+ | *****To add new case, check for a uniquely identifying property of the data and then perform the desired action (e.g. run a corresponding MACRO on the data) | ||
+ | # e.g. Evidence data is always stored in a hash with a 'text' key and an 'evidence' key | ||
+ | # Therefore cell_content checks whether the evidence key is defined in the data to be outputted | ||
+ | # If it is, the evidence() macro is run with the data. | ||
+ | [% MACRO cell_content(cell) BLOCK; | ||
+ | ... | ||
+ | ELSIF cell.evidence.defined; | ||
+ | evidence(cell.evidence,table_name _ index, cell.text, 'details'); | ||
+ | ... | ||
+ | END; %] | ||
+ | |||
+ | ===Other=== | ||
+ | Some other tools that you should be aware of but may not be required to know/use include: | ||
+ | *JavaScript | ||
*MySQL | *MySQL | ||
*Xapian | *Xapian | ||
Line 375: | Line 139: | ||
**Installation directory (for updating): [WormBase dir]/root/js/jquery/plugins/ | **Installation directory (for updating): [WormBase dir]/root/js/jquery/plugins/ | ||
− | ==General | + | ==General Concepts== |
− | *[https://wiki.oicr.on.ca/display/BCF/In-House+Tutorials+and+Workshops | + | ===Starting the server=== |
+ | *In a terminal, connect to wb-dev (via ssh) and navigate to the root of your dev site (where you checked-out the git repository e.g. /usr/local/wormbase/website/[user]/) | ||
+ | *Run the startup script: "./script/wormbase_server.pl -p ####" where #### is a port number | ||
+ | **Typical options are -d for debugging and -r to auto-restart when changes to the code are detected | ||
+ | **Output can be redirected into a log file ">>logs/server_log.log 2>&1" (redirects both output and errors into server_log.log) | ||
+ | **Therefore a full command could be "./script/wormbase_server.pl -d -r -p 8023 >>logs/server_log.log 2>&1" | ||
+ | **Logs can be monitored in real-time by running "tail -f logs/server_log.log" or "tail -f logs/wb-dev-catalyst.log" in a separate terminal | ||
+ | *Check [https://wiki.oicr.on.ca/display/BCF/In-House+Tutorials+and+Workshops OICR Tutorials and Workshops] for useful Unix commands (OICR login required) | ||
+ | |||
+ | ===Debugging Tools=== | ||
+ | * Chrome provides a very useful set of tools for debugging that can be accessed by either 'Inspect Element' in the context(right-click) menu, or from Menu->Tools->Developer Tools (Shift+Ctrl+i) | ||
+ | * Firefox has a "firebug" plugin that provides similar functionality | ||
+ | *The tools can be used to monitor different aspects of the page | ||
+ | **Network information such as GET/POST requests and their corresponding info (e.g. url and parameters) | ||
+ | **Underlying HTML and scripts for the page | ||
− | |||
===Widget Data Loading=== | ===Widget Data Loading=== | ||
[[File:DataLoadingWidget1.png|200px|thumb|Widget Loading]] | [[File:DataLoadingWidget1.png|200px|thumb|Widget Loading]] | ||
Line 387: | Line 164: | ||
#API methods request data from appropriate databases, process/format/package the data, and then return it(/lib/WormBase/API/Object/[Class].pm) | #API methods request data from appropriate databases, process/format/package the data, and then return it(/lib/WormBase/API/Object/[Class].pm) | ||
#Sends data to the template to be used in rendering the widget (/root/templates/classes/[Class]/[Widget].tt2) | #Sends data to the template to be used in rendering the widget (/root/templates/classes/[Class]/[Widget].tt2) | ||
+ | ===Tool Data Loading=== | ||
+ | [[File:ToolDataLoading.png|350px|thumb|Tool Loading]] | ||
+ | Typical flow of information: | ||
+ | #Request information such as the url and parameters are passed from the browser to the server | ||
+ | #Tools controller in server processes requests to /tools/... and calls corresponding API method | ||
+ | #*Determines tool and action from url (e.g. /tools/tree/run... => tool=tree, action=run) | ||
+ | #** Note: schema and gmap tools have similar function to other tools, tree and epic respectively | ||
+ | #** Any calls to these are translated to calls to the corresponding tool (e.g. schema->tree or gmap->epic) | ||
+ | #*Processes special parameters such as inline (for embedding in widget) | ||
+ | #*Calls the API method corresponding to the action (e.g. "run" in tree.pm) | ||
+ | #API method processes information passed from Controller and returns processed/packaged info to Tools Controller | ||
+ | #*Loads data passed from Controller(e.g. "my $name = $params->{'name'};" loads the name) | ||
+ | #*Loads appropriate data from databases (e.g. ACe object corresponding to the given 'name' & 'class' params) | ||
+ | #*Performs subsequent processing on data (e.g. blast tool runs blast with the given params) | ||
+ | #*Formats/packages data (e.g. commonly used method is _pack_obj which stores appropriate info for creating links for the interface) | ||
+ | #** Note: it is important to not return raw data (primarily ACe objects) to the interface. Two possible fixes are _pack_obj($object) or "$object" (stringify) | ||
+ | #** Note: it is also important to return "undef" instead of null or empty arrays/hashes | ||
+ | #Tools Controller passes API results to View (Template) | ||
+ | #View (Template) arranges/outputs the data for display | ||
+ | #*Uses various methods/macros | ||
+ | #**tag2link to convert a hash generated using _pack_obj into a link | ||
+ | #**build_data_table to generate a formatted data table | ||
+ | #** Note: common/useful macros can be found in /root/templates/config/main and /root/templates/shared/page_elements.tt2 | ||
+ | |||
+ | ==Guides== | ||
+ | * [[Adding Data to a Widget (Example)]] | ||
+ | * [[Creating a widget]] | ||
+ | * [[Creating a tool]] | ||
==Other Info== | ==Other Info== | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Useful files for debugging include: | Useful files for debugging include: | ||
− | */logs/ | + | */logs/wormbase-catalyst-access.log |
Other: | Other: | ||
*If the port you have been using appears to be busy but the server is not running, | *If the port you have been using appears to be busy but the server is not running, | ||
− | ps -aux|grep - | + | ps -aux|grep -#### |
kill -9 ID | kill -9 ID | ||
− | where | + | where #### is the port number(e.g. 8023) and ID is the process id that is using the port(e.g. 10361) |
− | |||
*To dump data in API methods include Data::Dumper | *To dump data in API methods include Data::Dumper | ||
use Data::Dumper | use Data::Dumper | ||
Line 407: | Line 206: | ||
warn(Dumper(\@data)); | warn(Dumper(\@data)); | ||
*Sometimes firewall blocks certain ports, so you may be unable to connect to your dev server on the wb-dev machine through the browser | *Sometimes firewall blocks certain ports, so you may be unable to connect to your dev server on the wb-dev machine through the browser | ||
− | ssh -L 8080:localhost: | + | ssh -L 8080:localhost:#### wb-dev.oicr.on.ca |
− | ./wormbase_server.pl -p | + | (where '####' is the port that you have been assigned by Todd). |
− | Then | + | You will be prompted to login. Then cd to /usr/local/wormbase/website/your_name/ |
+ | and type this command as usual: | ||
+ | ./wormbase_server.pl -p #### -d -r | ||
+ | where #### is your desired port number. Then point your browser at localhost:8080 <br /> | ||
+ | |||
+ | ==Current Tasks== | ||
+ | |||
+ | Additional tasks that require further investigation | ||
+ | *Loading/processing large amounts of data | ||
+ | **Details: | ||
+ | ***Likely approach will be to change the database used from ACeDB to NoSQL/CouchDB | ||
+ | ***[http://beta.wormbase.org/resources/laboratory/VC#1--10 Sample Issue] | ||
+ | **Progress: | ||
+ | ***[https://github.com/aduong/ace2couch Ace2Couch Scripts] for migrating data | ||
+ | ***[https://github.com/aduong/AceCouch AceCouch Perl API] | ||
+ | |||
+ | [[Category: Getting Started (Web Dev)]] |
Latest revision as of 14:31, 17 May 2016
Contents
Getting Started
WormBase WebDev Team Members/Contacts
- Lincoln Stein - lincoln.stein@gmail.com
- Todd Harris - todd@wormbase.org
- Sibyl Gao - sibyl@wormbase.org
- Scott Cain - scott@scottcain.net
Meetings
- WormBase OICR Developers Teleconference with Lincoln
- First Friday of the Month, 11:00AM
- Phone-in 1-800-747-5150
- Access Code: 6738514
- OR: Lincoln's office
- WormBase International Group (HelpDesk) Teleconference
- First Thursday of the Month, 11:30AM
- 1-866-528-2256
- Access Code: 714646
- HelpDesk Schedule and Agendas
- Past Agendas and Minutes
- Stein Lab, Group Meeting
- Fridays, 2:00PM
- HL31 Conference Room/TBA
- Web Development Issues Meeting
- Tuesday 10:00am
- WebDev_Issues_Meetings
Tools/Resources
The following are some of the tools with which many major aspects of WormBase are developed. You should familiarize yourself with them through documentation and examples.
Perl
There is significant documentation on getting started with Perl. One starting point is PerlMonks For information regarding the use of ACeDB in conjuction with Perl (e.g. retrieving data), check AcePerl Documentation. The Ace::Object section contains most of the information related to interacting with ACeDB objects.
Catalyst
Catalyst is the web development framework used to develop WormBase. To get started, read and try examples from
- The Definitive Guide to Catalyst (should be available on bookshelf)
- CPAN - About Catalyst
Git
Intro to Git
Tutorial: try.github.io
Git is a version control system used for collaboration and backup in the development process. One starting point is the progit tutorial
- WormBase repository located at https://github.com/organizations/WormBase
- Common commands
- status, add, checkout, commit, push, pull, log, fetch, merge
- Usage example:
Given that we have modified two files a.txt and b.txt but do not wish to keep the changes made to b.txt
git status
git checkout b.txt
git add a.txt
git commit -m “Added change1 and change2 to a.txt”
git pull
git push
Notes:
- pull is similar to using 'git fetch' + 'git merge'. However, performing them separately allows you to review the changes coming in before merging.
- the -m flag allows the user to input the message inline. Exlcuding it will result in an editor being opened for message entry
Setting-Up Repository
- If you do not already have an account on GitHub, sign up
- Send a request to Todd to grant you access to both the dev.wormbase.org machine and the WormBase repositories
- Connect via ssh to dev.wormbase.org
- Follow the GitHub instructions for Set Up Git to configure SSH keys
- Skip step 1, git should already be installed
- To check-out the repository:
$ cd /usr/local/wormbase/website $ git clone git@github.com:WormBase/website.git $ mv website [your username]
- See Administration:Installing_WormBase for more details
Browser (Debugging)
Many browsers provide useful tools to developers that can be used for debugging
Chrome
- Tools->Developer Tools/JavaScript Console
Firefox
- Firefox->Web Developer->Web Console/Error Console
ACeDB
- ACeDB
- Usage:
- Navigate to /usr/local/wormbase/acedb/bin and run: "./tace ../wormbase"
- For more help, try the tace tutorial
- Troubleshooting:
- To restart the server on dev: Must be super user
- Usage:
/etc/init.d/xinetd stop ps aux | grep sgiface !!If sgifaceserver is still running use 'kill #####' (where ##### is the process id) /etc/init.d/xinetd start
CouchDB
- Troubleshooting:
- To restart the server on dev:
- Troubleshooting:
sudo /etc/init.d/couchdb restart
MySQL
- Troubleshooting:
- To restart the server on dev:
- Troubleshooting:
sudo /etc/init.d/mysql restart
Template Toolkit
- Template Toolkit Documentation
- Common useful macros for templates can be found in:
- /root/templates/config/main
- e.g. tags2link
- /root/templates/shared/page_elements.tt2
- e.g. cell_content, build_data_table
- cell_content is mainly used for build_data_table to format the information to be displayed
- makes use of other macros for displaying special data such as links(MACRO tags2link) and evidence boxes(MACRO evidence)
- runs into errors when an ACe object is passed. Corrections should be made in the API to prevent ACe objects being returned to interface
- Can be used to display many types of data (not restricted for use in build_data_table)
- determines type of the content through a series of checks
- If the passed reference is an array, it performs recursion on each element
- If hash, outputs the key followed by the formatted content
- To add new case, check for a uniquely identifying property of the data and then perform the desired action (e.g. run a corresponding MACRO on the data)
- /root/templates/config/main
# e.g. Evidence data is always stored in a hash with a 'text' key and an 'evidence' key # Therefore cell_content checks whether the evidence key is defined in the data to be outputted # If it is, the evidence() macro is run with the data. [% MACRO cell_content(cell) BLOCK; ... ELSIF cell.evidence.defined; evidence(cell.evidence,table_name _ index, cell.text, 'details'); ... END; %]
Other
Some other tools that you should be aware of but may not be required to know/use include:
- JavaScript
- MySQL
- Xapian
- GFF
- Cytoscape Web
- Cytoscape Tutorial
- Plugin generally used for pathway analysis
- This plugin is used in the Interactions widget on the Gene page ([WormBase dir]/root/templates/classes/gene/interactions.tt2)
- Installation directory (for updating): [WormBase dir]/root/js/jquery/plugins/
General Concepts
Starting the server
- In a terminal, connect to wb-dev (via ssh) and navigate to the root of your dev site (where you checked-out the git repository e.g. /usr/local/wormbase/website/[user]/)
- Run the startup script: "./script/wormbase_server.pl -p ####" where #### is a port number
- Typical options are -d for debugging and -r to auto-restart when changes to the code are detected
- Output can be redirected into a log file ">>logs/server_log.log 2>&1" (redirects both output and errors into server_log.log)
- Therefore a full command could be "./script/wormbase_server.pl -d -r -p 8023 >>logs/server_log.log 2>&1"
- Logs can be monitored in real-time by running "tail -f logs/server_log.log" or "tail -f logs/wb-dev-catalyst.log" in a separate terminal
- Check OICR Tutorials and Workshops for useful Unix commands (OICR login required)
Debugging Tools
- Chrome provides a very useful set of tools for debugging that can be accessed by either 'Inspect Element' in the context(right-click) menu, or from Menu->Tools->Developer Tools (Shift+Ctrl+i)
- Firefox has a "firebug" plugin that provides similar functionality
- The tools can be used to monitor different aspects of the page
- Network information such as GET/POST requests and their corresponding info (e.g. url and parameters)
- Underlying HTML and scripts for the page
Widget Data Loading
REST Controller:
- Catches internal url (/rest/widget/...)
- Determines the class and widget from the url
- From class and widget, determines which fields are required from the configuration file (wormbase.conf)
- API methods request data from appropriate databases, process/format/package the data, and then return it(/lib/WormBase/API/Object/[Class].pm)
- Sends data to the template to be used in rendering the widget (/root/templates/classes/[Class]/[Widget].tt2)
Tool Data Loading
Typical flow of information:
- Request information such as the url and parameters are passed from the browser to the server
- Tools controller in server processes requests to /tools/... and calls corresponding API method
- Determines tool and action from url (e.g. /tools/tree/run... => tool=tree, action=run)
- Note: schema and gmap tools have similar function to other tools, tree and epic respectively
- Any calls to these are translated to calls to the corresponding tool (e.g. schema->tree or gmap->epic)
- Processes special parameters such as inline (for embedding in widget)
- Calls the API method corresponding to the action (e.g. "run" in tree.pm)
- Determines tool and action from url (e.g. /tools/tree/run... => tool=tree, action=run)
- API method processes information passed from Controller and returns processed/packaged info to Tools Controller
- Loads data passed from Controller(e.g. "my $name = $params->{'name'};" loads the name)
- Loads appropriate data from databases (e.g. ACe object corresponding to the given 'name' & 'class' params)
- Performs subsequent processing on data (e.g. blast tool runs blast with the given params)
- Formats/packages data (e.g. commonly used method is _pack_obj which stores appropriate info for creating links for the interface)
- Note: it is important to not return raw data (primarily ACe objects) to the interface. Two possible fixes are _pack_obj($object) or "$object" (stringify)
- Note: it is also important to return "undef" instead of null or empty arrays/hashes
- Tools Controller passes API results to View (Template)
- View (Template) arranges/outputs the data for display
- Uses various methods/macros
- tag2link to convert a hash generated using _pack_obj into a link
- build_data_table to generate a formatted data table
- Note: common/useful macros can be found in /root/templates/config/main and /root/templates/shared/page_elements.tt2
- Uses various methods/macros
Guides
Other Info
Useful files for debugging include:
- /logs/wormbase-catalyst-access.log
Other:
- If the port you have been using appears to be busy but the server is not running,
ps -aux|grep -#### kill -9 ID
where #### is the port number(e.g. 8023) and ID is the process id that is using the port(e.g. 10361)
- To dump data in API methods include Data::Dumper
use Data::Dumper ... warn(Dumper(\@data));
- Sometimes firewall blocks certain ports, so you may be unable to connect to your dev server on the wb-dev machine through the browser
ssh -L 8080:localhost:#### wb-dev.oicr.on.ca (where '####' is the port that you have been assigned by Todd). You will be prompted to login. Then cd to /usr/local/wormbase/website/your_name/ and type this command as usual: ./wormbase_server.pl -p #### -d -r where #### is your desired port number. Then point your browser at localhost:8080
Current Tasks
Additional tasks that require further investigation
- Loading/processing large amounts of data
- Details:
- Likely approach will be to change the database used from ACeDB to NoSQL/CouchDB
- Sample Issue
- Progress:
- Ace2Couch Scripts for migrating data
- AceCouch Perl API
- Details: