Co-op Documentation

From WormBaseWiki
Jump to navigationJump to search

Current Tasks

Tasks In Progress

Tasks in Progress

Other Tasks

Additional tasks that require further investigation

Getting Started

See WormBase Staff Resources.

Members/Contacts

Meetings

  • WormBase OICR Developers Teleconference
    • Mondays, 3:00PM
    • Phone-in 1-800-747-5150 id: 6738514
  • WormBase OICR Developers Teleconference with Lincoln
  • WormBase International Group (HelpDesk) Teleconference
    • Every other Thursday, 11:30AM
    • Lincoln's Office
    • Alternatively: 1-866-528-2256
      • Access Code: 714646
    • Conference calls
  • Group Meeting
    • Fridays, 3:00PM
    • HL31 Conference Room/TBA

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

Git

Git is a version control system used for collaboration and backup in the development process. One starting point is the progit tutorial

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 push

If we have did not have the most recent version, then we will run into an issue when trying to push. In this case we can:

git fetch
git merge
git push

Note: pull is similar to using fetch + merge

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

Other

Some other tools that you should be aware of but may not be required to know/interact with include:

  • JavaScript
  • ACeDB
    • Usage:
      • Navigate to /usr/local/wormbase/acedb/bin and run: "./tace ../wormbase"
      • For more help, try the tace tutorial
  • 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 XXXX" where XXXX 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

Widget Loading

REST Controller:

  1. Catches internal url (/rest/widget/...)
  2. Determines the class and widget from the url
  3. From class and widget, determines which fields are required from the configuration file (wormbase.conf)
  4. API methods request data from appropriate databases, process/format/package the data, and then return it(/lib/WormBase/API/Object/[Class].pm)
  5. Sends data to the template to be used in rendering the widget (/root/templates/classes/[Class]/[Widget].tt2)

Tool Data Loading

Tool Loading

Typical flow of information:

  1. Request information such as the url and parameters are passed from the browser to the server
  2. Tools controller in server processes requests to /tools/... and calls corresponding API method
    1. 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)
    2. Processes special parameters such as inline (for embedding in widget)
    3. Calls the API method corresponding to the action (e.g. "run" in tree.pm)
  3. API method processes information passed from Controller and returns processed/packaged info to Tools Controller
    1. Loads data passed from Controller(e.g. "my $name = $params->{'name'};" loads the name)
    2. Loads appropriate data from databases (e.g. ACe object corresponding to the given 'name' & 'class' params)
    3. Performs subsequent processing on data (e.g. blast tool runs blast with the given params)
    4. 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
  4. Tools Controller passes API results to View (Template)
  5. View (Template) arranges/outputs the data for display
    1. Uses various methods/macros
      1. tag2link to convert a hash generated using _pack_obj into a link
      2. 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

Other Info

Useful Macros when editing templates can be found in:

  • /root/templates/config/main
    • e.g. tags2link
  • /root/templates/shared/page_elements.tt2
    • e.g. build_data_table

Useful files for debugging include:

  • /logs/wb-dev-catalyst.log

Other:

  • If the port you have been using appears to be busy but the server is not running,
ps -aux|grep -XXXX
kill -9 ID

where XXXX is the port number(e.g. 8023) and ID is the process id that is using the port(e.g. 10361) NOTE: Do not kill other users' processes if you are using a shared dev machine (e.g. wb-dev)

  • 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:XXXX wb-dev.oicr.on.ca
./wormbase_server.pl -p XXXX -d -r

Then go to localhost:8080 in browser