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

View of /Sprout/DeleteChips.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Tue Dec 14 19:45:18 2010 UTC (8 years, 2 months ago) by parrello
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, rast_rel_2014_0912, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, rast_rel_2014_0729, mgrast_release_3_0, mgrast_dev_03252011, 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, myrast_33, rast_rel_2011_0928, mgrast_dev_04052011, mgrast_dev_10262011, HEAD
New program to delete Staph from the expression data.

#!/usr/bin/perl -w

# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
# This file is part of the SEED Toolkit.
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License.
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.

use strict;
use Tracer;
use Stats;
use ERDB;
use Sapling;
use SeedUtils;
use FC;

=head1 DeleteChips Script

=head2 Introduction

    DeleteChips [options] id1 id2 ...

Expression Data Delete Script

This script deletes the expression data for the specified genomes. This includes the
chips and the associated experiments, the coregulations, and the atomic regulons.

=head2 Command-Line Options

=over 4

=item trace

Specifies the tracing level. The higher the tracing level, the more messages
will appear in the trace log. Use E to specify emergency tracing.

=item user

Name suffix to be used for log files. If omitted, the PID is used.

=item sql

If specified, turns on tracing of SQL activity.

=item background

Save the standard and error output to files. The files will be created
in the FIG temporary directory and will be named C<err>I<User>C<.log> and
C<out>I<User>C<.log>, respectively, where I<User> is the value of the
B<user> option above.

=item help

Display this command's parameters and options.

=item warn

Create an event in the RSS feed when an error occurs.



# Get the command-line options and parameters.
my ($options, @parameters) = StandardSetup([qw(ERDB Sapling) ],
                                              trace => ["2", "tracing level"],
# Set a variable to contain return type information.
my $rtype;
# Create the statistics object.
my $stats = Stats->new();
my $myStartTime = time();
# Insure we catch errors.
eval {
    # Create the SAPLING object.
    my $sap = ERDB::GetDatabase('Sapling');
    # We'll put our list of genomes to process in here.
    my @genomes = @ARGV;
    # Loop through the genomes found.
    for my $genome (@genomes) {
        Trace("Processing genome $genome.") if T(2);
        # First, delete the chips.
        my @ids = $sap->GetFlat("HadResultsProducedBy", "HadResultsProducedBy(from-link) = ?",
                                  [$genome], 'to-link');
        # Loop through the chips.
        for my $chip (@ids) {
            # Delete this chip.
            Trace("Deleting chip $chip.") if T(2);
            my $subStats = $sap->Delete(Chip => $chip);
        # Get the atomic regulons.
        @ids = $sap->GetFlat("IsConfiguredBy", "IsConfiguredBy(from-link) = ?",
                                     [$genome], 'to-link');
        # Loop through the regulons.
        for my $regulon (@ids) {
            # Delete this regulon.
            Trace("Deleting regulon $regulon.") if T(3);
            my $subStats = $sap->Delete(AtomicRegulon => $regulon);
        # Release the memory for the regulon IDs.
        @ids = ();
        # Delete the coregulations for features.
        Trace("Deleting coregulation coefficients for $genome.") if T(2);
        my $deleteCount = $sap->DeleteLike("IsCoregulatedWith", "IsCoregulatedWith(from-link) LIKE ?",
        $stats->Add(IsCoregulatedWith => $deleteCount);
        # Find this genome's coregulated sets.
        Trace("Searching for coregulated sets in $genome.") if T(2);
        my %ids = map { $_ => 1 } $sap->GetFlat("IsRegulatedWith",
                                                "IsRegulatedWith(from-link) LIKE ?",
                                                ["fig|$genome.%"], 'to-link');
        for my $coset (keys %ids) {
            # Delete this coregulated set.
            Trace("Deleting coregulated set $coset.") if T(3);
            my $subStats = $sap->Delete(CoregulatedSet => $coset);
if ($@) {
    Trace("Script failed with error: $@") if T(0);
} else {
    Trace("Script complete.") if T(2);
# Display the run statistics.
$stats->Add(duration => (time() - $myStartTime));
Trace("Statistics for this run:\n" . $stats->Show()) if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3