[Bio] / FortyEightMeta / MGDB.pm Repository:
ViewVC logotype

View of /FortyEightMeta/MGDB.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Mon Oct 20 16:13:43 2008 UTC (11 years, 5 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_dev_10262011, mgrast_dev_02212011, mgrast_release_3_0, mgrast_dev_03252011, mgrast_rel_2008_1110_v2, 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_1110, myrast_33, mgrast_dev_04052011, mgrast_dev_02222011, HEAD
Changes since 1.1: +6 -6 lines
use INTEGER instead of SMALLINT for contig offsets.

#
# Common code for table creation in mgrast.
#

package FortyEightMeta::MGDB;

use strict;
use FIG_Config;

#
# Create a new db table in the metagenome database for the purpose of storing
# the computed sims.
#
sub create_sims_db
{
    my ($mgdb, $job_id, $max_id_len) = @_;

    $max_id_len++;
    my $tbl = "tax_sim_$job_id";
    my $best_iden_tbl = "tax_sim_best_by_iden_$job_id";
    my $best_psc_tbl = "tax_sim_best_by_psc_$job_id";

    $mgdb->drop_table(tbl => $tbl);
    $mgdb->create_table(tbl => $tbl,
			flds => qq(
				   dbid	smallint,
				   id1	VARCHAR($max_id_len),
				   id2	VARCHAR(32),
				   iden	smallint ,
				   ali_ln	SMALLINT ,
				   b1	INTEGER ,
				   e1	INTEGER ,
				   b2	INTEGER ,
				   e2	INTEGER ,
				   logpsc	SMALLINT,
				   bsc	SMALLINT ,
				   tax_str	VARCHAR(160),
				   tax_group_1	VARCHAR(3),
				   tax_group_2	VARCHAR(3),
				   tax_group_3	VARCHAR(3),
				   rank_iden	SMALLINT ,
				   rank_psc	SMALLINT
				   ));
    
    $mgdb->drop_table(tbl => $best_iden_tbl);
    $mgdb->create_table(tbl => $best_iden_tbl,
			flds => qq(
				   dbid	smallint,
				   id1	VARCHAR($max_id_len),
				   id2	VARCHAR(32),
				   iden	smallint ,
				   ali_ln	SMALLINT ,
				   b1	INTEGER ,
				   e1	INTEGER ,
				   b2	INTEGER ,
				   e2	INTEGER ,
				   logpsc	SMALLINT,
				   bsc	SMALLINT ,
				   tax_str	VARCHAR(160),
				   tax_group_1	VARCHAR(3),
				   tax_group_2	VARCHAR(3),
				   tax_group_3	VARCHAR(3)
				   ));
    $mgdb->drop_table(tbl => $best_psc_tbl);
    $mgdb->create_table(tbl => $best_psc_tbl,
			flds => qq(
				   dbid	smallint,
				   id1	VARCHAR($max_id_len),
				   id2	VARCHAR(32),
				   iden	smallint ,
				   ali_ln	SMALLINT ,
				   b1	INTEGER ,
				   e1	INTEGER ,
				   b2	INTEGER ,
				   e2	INTEGER ,
				   logpsc	SMALLINT,
				   bsc	SMALLINT ,
				   tax_str	VARCHAR(160),
				   tax_group_1	VARCHAR(3),
				   tax_group_2	VARCHAR(3),
				   tax_group_3	VARCHAR(3)
				   ));
    
    return ($tbl, $best_iden_tbl, $best_psc_tbl);
}
1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3