Creating Custom Interfaces

Suppose that you had substantial expertise in graphical interfaces, understood the power of comparative analysis, and wished to support the ability to graphically display the chromosomal regions around a set of genes (normally from distinct genomes). The SEED offers one alternative for doing this (see the region displayed here for an example), but suppose that you did not like forcing users to find appropriate SEED IDs and you thought that you could develop a superior display.

Example 3 illustrates the functions required to determine the location of a SEED gene encoding a specific protein and to acquire the genes from a given region centered on that location. If you were to create a program to accept arbitrary protein IDs, use the conversion capabilities demonstrated in example1, and display the regions graphically around these genes, you would have the core of a useful tool. If you shaded genes from the same subsystem (determined using the capabilities described in example2), you could enhance the supported functionality. Of course, you could also compute which genes could be connected to literature or structures and encode that data as well.

Example Discussion

With the server packages installed, the code in example 3 can be run as follows
> perl "fig|100226.1.peg.3361" 2000
First, we get the location for the subject ID using the Sapling Server
	my $sapObject = SAPserver->new();
my $geneLocH = $sapObject->fid_locations(-ids => [$geneID]);
my $geneLoc = $geneLocH->{$geneID}->[0];
Next, we normalize the direction and compute the desired region.
	if ($geneLoc =~ /^(\S+)_(\d+)([+-])(\d+)/)  # retrieve an encoded location
my($contig,$beg,$strand,$length) = ($1,$2,$3,$4);
my ($left,$right);
if ($strand eq "+")
($left,$right) = ($beg, $beg + ($length-1));
($left,$right) = ($beg - ($length-1), $beg);
my $paddedLeft = ($left > $max_distance) ? $left - $max_distance : 1;
my $paddedRight = $right + $max_distance;
my $sz = ($paddedRight + 1) - $paddedLeft;
my $region = $contig . "_" . $paddedLeft . "+" . $sz;
Then we use the Sapling Server to retrieve all genes in the region and display the results.
	    my $genesInRegionH  = $sapObject->genes_in_region(-locations => [$region],
-includeLocation => 1);
my $genesInRegion = $genesInRegionH->{$region};
foreach my $geneID2 (keys(%$genesInRegion)) {
my $location = $genesInRegion->{$geneID2};
$location =~ /^(\S+)_(\d+)([+-])(\d+)/;
print "$geneID2\t$1\t$2\t$3\t$4\n";

 Example 3 Output Table

fig|100226.1.peg.3358	100226.1:NC_003888	3764143	+	867
fig|100226.1.peg.3359 100226.1:NC_003888 3765006 + 504
fig|100226.1.peg.3360 100226.1:NC_003888 3765814 + 360
fig|100226.1.peg.3361 100226.1:NC_003888 3766170 + 612
fig|100226.1.peg.3362 100226.1:NC_003888 3766852 + 489
fig|100226.1.peg.3363 100226.1:NC_003888 3767961 - 606
fig|100226.1.peg.3364 100226.1:NC_003888 3770099 - 2007