Friday, September 30, 2011

Call for abstracts, Solanaceae workshop, Plant and Animal Genome meeting, San Diego, Jan 14, 2012

Continuing a tradition started last year, some of the talks will be selected from abstracts submitted by the Solanaceae community. The work should be advanced, and either address a fundamental -omic question, or use -omics approaches to address a fundamental biological question in the field of Solanaceae. The abstract should be accompanied by a half page indicating the status of the work (preliminary findings, manuscript in preparation, manuscript submitted) and justifying why it should be selected for an oral communication.

The abstract and accompanying half page should be sent by Monday, Oct 10 to:

Selected speakers will be notified by mid-October. Please note that the PAG organization does not refund travel or lodging expenses.

David S. Douches, Michigan State University
Giovanni Giuliano, Italian National Agency for New Technologies, Energy and Sustainable Development

Monday, September 13, 2010

Call for abstracts: Solanaceae workshop, PAG 2011, San Diego, Jan 18, 2011

Call for abstracts, Solanaceae workshop, Plant and animal Genome meeting, San Diego, Jan 18, 2011

This year, we'd like to introduce an innovation in the way we select the speakers for the workshop. Next to the traditionally invited speakers, we'd like to select some from abstracts submitted by the Solanaceae community. The work should be advanced, and either address a fundamental -omic question, or use -omics approaches to address a fundamental biological question in the field of Solanaceae. The abstract should be accompanied by a half page indicating the status of the work (preliminary findings, manuscript in preparation, manuscript submitted) and justifying why it should be selected for an oral communication. The abstract and accompanying half page should be sent by Friday, Sept 30 to:
Selected speakers will be notified by mid-October. Please note that the PAG organization does not refund any expenses or levy registration fees for the speakers. Therefore, before submitting your abstract please check that you have the financial coverage to come to San Diego.

Looking forward to a high profile Solanaceae genomics workshop!

David S. Douches, Michigan State University
Giovanni Giuliano, Italian National Agency for New Technologies, Energy and Sustainable Development

Sunday, August 15, 2010

Stumbling on Subtle Errors

As a budding programmer - and perhaps not the most logical one - I have probably done more debugging than the average person. However, it has allowed me to notice small details which some of the better programmers may not notice (because they are wiser and never make those weird mistakes). Below, I will expand on my numerous problems, and hope that maybe it will be useful to some new intern with a crazy mindset like me.

Most of my work was related to the SGN database. Thus, I needed to use postgreSQL and DBIx::Class (a Perl module which allows the user to access the database through Perl code instead of SQL). Here we go!



1. The query does not end until you add a semicolon, no matter how many times you press enter.

The database does not necessarily work like the terminal, even though you're still technically typing in the terminal. In the terminal, the query ends the moment you press enter, even if you get an error message. However, in the database, you have to type a semicolon first, or it will simply assume that your query is ongoing.

For example, when creating a table, you can split your query into several lines:

CREATE TABLE Persons
(
p_id int,
lastname varchar(255),
firstname varchar(255),
address varchar(255),
city varchar(255)
);

Or you can put it all on one line and let the text wrap:

CREATE TABLE Persons (p_id int, lastname varchar(255), firstname varchar(255), address varchar(255), city varchar(255));

The downfall of entering a query on several lines is that you cannot go back to fix your mistakes. (Well, you could try to open an editor and fix it there, but that's a pain.) You are better off typing it all on one line, adding a semicolon at the end, and then hitting enter. But if you find yourself stuck in a query, type Ctrl + C to get out of it.



2. In the database, put strings in single quotes.

It doesn't like double quoted strings, so just don't do it.



3. In DBIx::Class, find() returns a row object, and search() returns a resultset.

The find() method will give you only one row of information. Use it when you know that there should be only one result returned. You can easily access information by typing the column name. For instance:

my $pet = $schema->resultset('Animals')->find({name => 'Jojo'});
my $type_of_animal = $pet->type;

The search() method returns several rows of information. Thus, I usually try to store this result in an array, because I find it easier to access. However, storing it in a scalar and using ->next() to access the next row of info is fine, too. Here is an example:

my @pet = $schema->resultset('Animals')->search({name => 'Jojo'});
my $type_of_animal = $pet[0]->type;

(You may need to type $pet->get_column('type'); This is especially when there is more than one result after doing the search.)



4. When typing in the resultset and search_related arguments, use the module names, not the database names.

Try to follow this example:

1. Let's say we create two tables called “dog” and “cat” in the database (all lowercase letters).
2. Then we created perl modules called Dog.pm and Cat.pm.
3. In Dog.pm, let's say some programmer decided to write:
__PACKAGE__->has_many(“cats”, “Schema::Cat”, {“foreign.id” => “self.id”})
4. In Cat.pm, he wrote:
__PACKAGE__->has_many(“dogs”, “Schema::Dog”, {foreign.id” => “self.id”});

Here's how you would use this info:
my $pet = $schema->resultset('Dog')->search_related('cats', {id => 3});
my $pet = $schema->resultset('Cat')->search_related('dogs', {id => 25});

Notice that for the resultset(), you use the module name. For search_related(), you use the table name found in that module, not the table name found in the database (like I instinctively wanted to use when I first started).



5. Some helpful database, SQL and DBIx::Class syntax which is not as easily found online:

Going through the database:

\dn – shows the schemas in the database

\dt – shows the tables in the current schema

\d table_name – shows the columns and other info for that specific table

SET search_path TO schema_name – use this to go to a different schema

**********************************************************
Some SQL:

For searching for parts of a string:

SELECT * FROM table_name WHERE column_name ilike '%string%';


Another way to join tables - use USING instead of ON (as shown in http://www.w3schools.com/), but make sure to include parentheses around the column name:

SELECT * FROM table_name JOIN table2_name USING (column_name_in_common);

**********************************************************
...And some DBIx::Class:

Searching for an item in a list of items – don't just type in the array – you need to use 'in':

my @num = qw/1 3 4 7 9/;
my @search = $schema->resultset('Animals')->search({animal_id = {'in' => [@num]}});

**********************************************************
Let me note that anything you type in DBIx::Class can be written as SQL. For instance, the example above can also be written as:

SELECT * FROM animals WHERE animal_id IN (1, 3, 4, 7, 9);

However, when writing this stuff in a Perl script, DBIx::Class is easier. If you used SQL in Perl, you would have to prepare the query, execute, and fetch the results into variables. However, with DBIx::Class, this is done just by creating resultset objects. Also, DBIx::Class has an auto-loader, which means that you never have to worry about keeping your classes in sync with the database schemas. Doesn't that sound nice?



And there you have it. Hope this information is at least somewhat helpful to you all!

P.S. If anyone says DBIC, it's just a short acronym for DBIx::Class. ;)



Helpful Sources:

SQL: http://www.w3schools.com/sql/default.asp
DBIx::Class: http://search.cpan.org/~jrobinson/DBIx-Class-Tutorial-0.0001/

Monday, July 19, 2010

Ajax: Making the Web Even More Interactive

Ajax (Asynchronous Javascript and XML) is a web programming technique that uses other web technologies, such as JavaScript and XML, to make web pages and web applications more interactive.

In order to fully understand and appreciate the concept and capabilities of Ajax, it is important to know how JavaScript works. JavaScript is an object-oriented scripting language that is primarily used in the form of client-side script. It is called a ‘client-side JavaScript’ because the code runs locally on the client’s web browser instead of on a remote server. Because it runs locally, it can respond quickly to the user input, making the web page or application more responsive. JavaScript can be used to write functions that are embedded in HTML pages, and these functions can interact with the Document Object Model (DOM) of the page. When the functions are called, certain content in the page can update without requiring the entire page to reload. Some basic examples of this are changing images or text on as the cursor moves over them, or for input validation of a web form to make sure the user input is acceptable before being submitted to the server.

However, as useful as Javascript is, it does not have the ability to exchange information between the web browser and the remote server. This is where AJAX is needed. AJAX allows the web browser to communicate with a remote server. You might be thinking that it has always been possible your web browser to communicate with the web server, so why do we need Ajax? Indeed, browsers can exchange data the web server, but only with an HTML form that can GET or POST information. After the response is sent back to the browser the entire page must reload in order to see the result of the user input. Reloading the entire page is inefficient and with a slow Internet connection, can be rather annoying. Ajax has the ability to send user-generated requests to a web server and update the results on the page without requiring the rest of the page to reload. With these powerful capabilities, Ajax has become a popular web technology. Google is known as the pioneer in Ajax development since it was the first to launch a large implementation of Ajax with its popular Gmail. Google Suggest and Google Maps are also made possible via Ajax.

Although Ajax stands for ‘asychronous JavaScript and XML’ neither language is required to create an Ajax request. This emphasizes the fact that Ajax is more of a concept, rather than a language. JavaScript is commonly used in Ajax forms, but XML is often replaced with JSON ( JavaScript object notation).

Below is an example of an Ajax request which interacts with a server side script (which in this case is a perl script). In turn, the server side script queries a database with the search term sent from the Ajax request and returns the results in a JSON object which is then parsed and print to the result of the search query.

function update_result(){
var species = $("species").value; //the value sent from the search field
var result_space = $("result_space"); //result_space is a div on the page
new Ajax.Request("/serverside_script.pl", {
parameters: {species: species}, //sent to the server side script
onSuccess: function(response){
var json = response.responseText; //results returned as JSON object
var result = eval("("+json+")"); //eval function parses string
var html = "";
for (var r in result){
html+=result[r]+"
";

}
if(json=="{}"){
html="No matches found.";
}
result_space.innerHTML=html;
}
});
}

While Ajax is very useful, there are several caveats. It is not entirely trivial to develop code that utilizes Ajax, especially when compared to traditional html forms. Luckily, there are several tutorials online that give a great introduction to Ajax and an overview of its syntax. However, purchasing a textbook on Ajax might be worthwhile, especially if you are not an experienced web developer. Another drawback, which is not really specific to Ajax, but to all dynamic web pages, is that using the browsers back button or bookmarking a pages does not work as expected. The solution to this is to give the page a unique URL identifier which allows the user to return to the page in a specific state.

Overall, Ajax is one of the most useful web technologies that exists today. It is used often and widely throughout the web in places that one may not even realize. Learning Ajax is beneficial to both novice and experienced web developers alike. Below are links to Ajax, JavaScript, and JSON tutorials and general information.

http://www.w3schools.com/ajax/default.asp
http://www.w3schools.com/js/default.asp
http://www.json.org/

Tuesday, June 29, 2010

Prototype: Easier Way to Javascript

Before delving into Prototype, I will explain the basic purpose and importance of using Javascript in web development. So, Why use Javascript in the first place instead of just HTML? Well, Javascript widens the user's scope to add flexibility and interactivity to a web page as opposed to HTML. While HTML is often flat and static, Javascript is dynamic and incredibly more interactive with the user and server. It adds more control to the user of software objects and relies on the environment the user is trying to control as opposed to HTML which, in a way, can be more stand alone.

Prototype is a Javascript library that allows user all ready familiar with Javascript or some sort of programming to write Javascript in an easier and clearer syntactical fashion.

The creators of this Javascript library describe Prototype's purpose as it's ability "to ease the development of dynamic web applications."

They were right: Prototype simplifies the complexity of coding Javascript for sophisticated web applications including methods in its library to help increase efficiency , conciseness of commonly used or tedious Javascript tasks.

  • Most Common Uses/Features for Prototype JS:

    • AJAX Requesting

    • Arrays, Hashes,String

    • Utility methods

AJAX
----------------------------------------------------------------------------------------------------------------------------------------
The Prototype Javascript library simplifies Ajax Requesting for the user by creating methods which have an easy to understand syntax and design.
An Ajax Request
life cycle includes :
Created, Initialized, Request Sent, Response being received, Response received.



Sample AJAX Request
new Ajax.Request('url call here',
{
method:'get',
parameters: {key: 'value' , key2: number, etc..},
onSuccess: function(transport){
var response = transport.responseText || "no response text"; alert("Success! \n\n" + response); },
onFailure: function(){ alert('Something went wrong...') }
});

Seen above, onSuccess & onFailure are only two of the onXXXX family of options allowed in the Ajax.Request. Others include : onUinitialized, onLoading, onLoaded, onInteractive, onComplete, onException; this allows for more customization to your Ajax request. Furthermore, the user can add parameters ( that you may need to process in your back end script )can be sent through the Ajax.Request object expanding the possibility of options for modeling your code. The methods option for an Ajax request simply reffers to a GET or POST requests. More often than not, a common use of Ajax.Request can be dealing with some sort of Form. A very convenient feature of Prototype is the fact that when the user needs to pass a parameter from a Form with the request, they can utilize the method : Form.serialize..

$('form id').serialize(true) pass this as a parameter

Moreover, Prototype simplifies the updating of HTML within containers in your script using Ajax.Updater. Similar to the onComplete in Ajax.Request, the Ajax.Updater makes it easier for the user to update any HTML code.


new Ajax.Updated ('container id', 'url', {method: 'get'});

More to look at: Ajax.PeriodicalUpdater


Arrays, Hashes, and other components

----------------------------------------------------------------------------------------------------------------------------------------

The Array class adds variety of functionalities to primitive arrays that use [] indexing and can be a pain to deal with. Using the Array class,the user can find much of the functionality confined to much cleaner methods. Such include push,pop,concat,etc.. [[http://www.prototypejs.org/api/array]] that make the manipulation of Arrays that much easier. Also involved in the Array class is the Enumerable class whose capabilities can increase the functionality in traversing Arrays. The API for Enumerable [[http://www.prototypejs.org/api/enumerable]]can be seen on jsprototype.org. Hashes, a commonly used and useful tool, have become convenient through Prototype as well by allowing for two ways to create them : new Hash() or $H(). This allows a user who has knowledge of the hash to utilize its many benefits.

Utility Methods

-----------------------------------------------------------------------------------------------------------------------------------------

These methods are most commonly used by programmers and is what makes Prototype a refined library that has made javascript much easier to use.

  1. $('id')
    - this is an alias to document.getElementById('id');.. but instead of constantly having to tediously type this out, the user can use this Prototype shortcut and accomplish the exact same task.

  2. $F(element)
    retrieves the value of this Form element..alias of Form.Element.getValue
  3. $A(iterable) ->actualArray
    – turns into Array object
  4. $w(String)
    ->Array – turns a string into an array using space as delimiter.

MORE SOURCES
-------------------------------------------------------------------------------
API Documentation:[[http://api.prototypejs.org/]]
JS Prototype home:[[http://prototypejs.org/]]
Prototype Guide: [[http://www.sergiopereira.com/articles/prototype.js.html]]

Saturday, June 26, 2010

New SGN site design element

The SGN site (http://solgenomics.net/) just go a lot prettier - and hopefully more functional for users as well. We have added some beautiful graphical menus, with an example shown in the picture below. Note how the agricultural field (how appropriate!) gives a 3-D impression with a perspective whose vanishing point coincides with the 'Genes' icon. We felt that the most important menu item should be at the vanishing point, if only because Leonardo daVinci put Jesus in the vanishing point in his famous last supper painting. In design questions, it's always good if you can side with someone like Leonardo! Thanks to web designer Camilo Rosero for this beautiful design!


Wednesday, May 5, 2010

Open source bioinformatics

All the code developed at SGN is "open source". Why the quotes? Because so far, no-one really could see our code. Of course, if you requested it, we provided it. But that is not yet the whole story to open source. Ideally, you would like to collaboratively develop code with others in the community, and merge in improvements made by others. However, merging back changes from outside SGN into the code base was, up to now, too cumbersome, and basically required giving other people full access to our filesystem, which is dangerous.

The version control system called git has really changed that. Every git "checkout" contains the entire history of the project, which means that there is not really a central repository anymore - all are equivalent. What the central repository is, is just a convention. There are websites like http://github.com, which host git repositories (for small repositories, it is even free). We have exported our git repositories to github.com, from where anyone in the world can 'clone' our repository, make changes, and feed back changes for merging with our repository, which is particularly simple using git.

Our git repository can be accessed at http://github.com/solgenomics .