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

View of /DomReg/scripts/add_BindingSite_and_BSMotif_to_FIGRegulons.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Apr 19 20:29:04 2007 UTC (12 years, 10 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/site_table.txt");
while($_ = <IN>){
    chomp($_);
    @parts = split("\t",$_);
    $rtb_site_id = $parts[0];
    $name  = $parts[1];
    $start  = $parts[2];
    $stop  = $parts[3];
    $regulator_peg = $parts[4];
    $sequence = $parts[5];
    $genome = $parts[6];
    $contig = $parts[7];
    $signature = $parts[8];
    $structure = $parts[9];

    my $regulator_instance_obj, $bsmotif_obj, $bindingsite_obj, $Regulator;
    $regulator_instance_obj =  $dbmaster->RegulatorInstance->get_objects( { 'figid' => $regulator_peg } );
    $regulator_instance = $regulator_instance_obj->[0];   
    if($regulator_instance){
	$Regulator = $regulator_instance->Regulator();
    }

    $bsmotif_obj =  $dbmaster->BSMotif->get_objects( { 'consensus' => $signature } );
    if(!scalar(@$bsmotif_obj)){
	if($Regulator){
	    $bsmotif_obj = $dbmaster->BSMotif->create( { 'name'    => $name,
							 'consensus' => $signature,
							 'structure' => $structure,
							 'Regulator'=> $Regulator,
							 'DataSource' => $source_obj
						     });
	}
	else{
	    $bsmotif_obj = $dbmaster->BSMotif->create( { 'name'    => $name,
							 'consensus' => $signature,
							 'structure' => $structure,
							 'DataSource' => $source_obj
							 });
	    
	}
	$bsmotif = $bsmotif_obj;
    }
    else{
	$bsmotif = $bsmotif_obj->[0];   
    }
    
    $bindingsite_obj =  $dbmaster->BindingSite->get_objects( { 'RTBID' => $rtb_site_id } );
    if(!scalar(@$bindingsite_obj)){   
	$bindingsite_obj =  $dbmaster->BindingSite->create( { 'RTBID' => $rtb_site_id,
	                                                      'name' => $name,
							      'start' => $start,
                                                              'stop' => $stop,
							      'contig' => $contig,
							      'RegulatorInstance' => $regulator_instance,
							      'sequence' => $sequence,
							      'organism' => $genome,
							      'contig' => $contig,
                                                              'BSMotif' => $bsmotif,
							      'DataSource' => $source_obj
							  } );
	
    }
}

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3