[Bio] / FortyEightMeta / mg_gen_subsystem_tax.pl Repository:
ViewVC logotype

View of /FortyEightMeta/mg_gen_subsystem_tax.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Fri May 30 23:23:51 2008 UTC (11 years, 9 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_rel_2008_0806, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_rel_2008_0923, mgrast_release_3_0, mgrast_dev_03252011, mgrast_rel_2008_0924, mgrast_rel_2008_1110_v2, mgrast_rel_2008_0625, 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, mgrast_rel_2008_0919, mgrast_rel_2008_1110, myrast_33, mgrast_rel_2008_0917, mgrast_dev_04052011, mgrast_dev_02222011, HEAD
Development checkin of new metagenomics RAST pipeline.

# Generate normalized subsysteam "taxonomy" data.

use Data::Dumper;
use FIG;
use FIG_Config;
use strict;

my $fig = new FIG;

my $ssdir = "$FIG_Config::data/Subsystems";
opendir(D, $ssdir) or die "cannot open subsystem directory $ssdir: $!";

my %ss_to_tax;

# Load the subsystem data.

for my $ss (sort readdir(D))
    next if $ss =~ /^\./;
    my $sdir = "$ssdir/$ss";
    next unless -d $sdir;
    # print "$ss\n";
    if (open(C, "$sdir/CLASSIFICATION"))
	my $c = <C>;
	chomp $c;
	next if $c =~ /Experimental/;
	my ($h1, $h2) = split(/\t/, $c);
	$ss_to_tax{$ss} = join("\t", $h1, $h2, $ss);

# Now walk the subsystem index, and write the expanded fid-to-tax data.

my $sth = $fig->db_handle()->{_dbh}->prepare(qq(SELECT protein, subsystem, role
						FROM subsystem_index
						WHERE variant != '-1'),
					 { mysql_use_result => 1 });
my($protein, $subsystem, $role);
$sth->bind_columns(\ ($protein, $subsystem, $role));
while ($sth->fetch)
    my $s = $ss_to_tax{$subsystem};
    print join("\t", $protein, $s, $role), "\n" if $s;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3