[Bio] / Sprout / SaplingPerformer.pl Repository:
ViewVC logotype

View of /Sprout/SaplingPerformer.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Wed Dec 16 01:45:19 2009 UTC (9 years, 2 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_04082011, rast_rel_2010_0928, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2010_0526, rast_rel_2014_0729, rast_rel_2010_1206, mgrast_release_3_0, mgrast_dev_03252011, rast_rel_2010_0118, rast_rel_2011_0119, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_10262011, HEAD
Sapling v08 changes.

#!/usr/bin/perl
use strict;

# Script for testing ERDB performance.

use Sapling;
use SeedUtils;
use Tracer;
use Time::HiRes;
use Stats;

# Set up tracing and backgrounding.
my ($options, $mode) = StandardSetup([qw(ERDB)], {}, "", @ARGV);
# Get a statistics object.
my $stats = Stats->new();
# Get the Sapling DB.
my $sap = Sapling->new();
if ($mode eq 'stream') {
    ## METADATA STORAGE TEST
    require FreezeThaw;
    require XML::Simple;
    require YAML;
    # Get the metadata.
    my $metaData = $sap->{_metaData};
    # Freeze it.
    my $frozen = FreezeThaw::freeze($metaData);
    # Thaw it 50 times.
    my $count = 50;
    Trace("FreezeThaw test.") if T(2);
    my $start = time();
    while ($count-- > 0) {
        my $thawed = FreezeThaw::thaw($frozen);
    }
    $stats->Add(ThawTime => time() - $start);
    $stats->Add(FrozenLen => length($frozen));
    # Unparse it.
    my $xml = XML::Simple::XMLout($metaData);
    # Parse it 50 times.
    $count = 50;
    Trace("XMLin test.") if T(2);
    $start = time();
    while ($count-- > 0) {
        my $parsed = XML::Simple::XMLin($xml);
    }
    $stats->Add(ParseTime => time() - $start);
    $stats->Add(XmlLen => length($xml));
    # Dump it.
    my $yaml = YAML::Dump($metaData);
    # Load it 50 times.
    $count = 50;
    Trace("YAML test.") if T(2);
    $start = time();
    while ($count-- > 0) {
        my $loaded = YAML::Load($yaml);
    }
    $stats->Add(LoadTime => time() - $start);
    $stats->Add(YamlLen => length($yaml));
    # Display the results.
    Trace("Statistics for test:\n" . $stats->Show()) if T(2);
} else {
    ## NORMAL DATABASE TEST
    # Get all protein features of the Campy genome.
    Trace("Reading genome features.") if T(2);
    my @feats = $sap->GetAll('Genome IsOwnerOf Feature Produces ProteinSequence',
                             'Genome(id) = ?', [360108.3], [qw(Feature(id)
                                                            Feature(function)
                                                            Feature(sequence-length)
                                                            ProteinSequence(sequence))]);
    # Loop through the features, getting the locations of the hypotheticals.
    Trace("Processing hypotheticals.") if T(2);
    for my $featData (@feats) {
        my ($fid, $function) = @$featData;
        if (hypo($function)) {
            my @locs = $sap->GetLocations($fid);
            my $loc = join(", ", @locs);
            print join("\t", $fid, $function, $loc->String()) . "\n";
        }
    }
}
# All Done.
Trace("All Done.") if T(2);


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3