[Bio] / DomReg / scripts / add_Regulator_to_FIGRegulons.pl Repository:
ViewVC logotype

View of /DomReg/scripts/add_Regulator_to_FIGRegulons.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Apr 19 20:28:24 2007 UTC (12 years, 11 months ago) by mkubal
Branch: MAIN
CVS Tags: HEAD
v1

#!/usr/bin/env /home/bartels/FIGdisk/env/cee/bin/perl

#use strict;
#use warnings;

use lib '/home/mkubal/PPO/';
use lib '/home/mkubal/DomReg/';
use DBMaster;

my $dbmaster = DBMaster->new('FIGRegulons');

#$DataSource_name = shift(@ARGV);
#$DataSource_version = shift(@ARGV);

$DataSource_name = "RegTransbase";
$DataSource_version = "20060209_1006";

my $source_objs;
my $source_obj;

$source_objs =  $dbmaster->DataSource->get_objects( { 'name' => $DataSource_name,
						     'version' => $DataSource_version
						   } );
if(!scalar(@$source_objs)){
    $source_obj = $dbmaster->DataSource->create( { 'name'    => $DataSource_name,
						   'version' => $DataSource_version
						   } );
}
else{
    $source_obj = $source_objs->[0];
}   

open(IN,"/home/mkubal/DomReg/data/rtb_regulators.txt");
while($_ = <IN>){
    my $family;
    chomp($_);
    @parts = split("\t",$_);
    $name  = $parts[3];
    $family  = $parts[6];
   
   if($name =~/\w/){
       print "$name\n";
       my ($reg_obj,$regfam_obj,$regfam);

       if($family=~/\w/){
	   $regfam_obj =  $dbmaster->RegFam->get_objects( { 'name' => $family } );
	   if(!scalar(@$regfam_obj)){
	       $regfam_obj = $dbmaster->RegFam->create( { 'name'    => $family } );
	   }
	   $regfam = $regfam_obj->[0];
       }
       
       $reg_obj =  $dbmaster->Regulator->get_objects( { 'name' => $name } );
       if(!scalar(@$reg_obj)){
	   $reg_obj = $dbmaster->Regulator->create( { 'name'    => $name,
                                                      'RegFam'  => $regfam,
						      'DataSource' => $source_obj
                                                     } );
       }
   }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3