[Bio] / FigKernelScripts / ex_rare_ar_and_pegs.pl Repository:
ViewVC logotype

View of /FigKernelScripts/ex_rare_ar_and_pegs.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Sep 2 02:37:59 2013 UTC (6 years, 3 months ago) by overbeek
Branch: MAIN
CVS Tags: rast_rel_2014_0729, rast_rel_2014_0912, HEAD
added steps

use Data::Dumper;
use Getopt::Long;
use SeedEnv;
use strict;

my $usage = "usage: ex_rare_ar_and_pegs -d DataDir\n";
my($i,$j);
my $dataD;
my $rc  = GetOptions('d=s' => \$dataD);

if ((! $rc) || (! -d $dataD))
{ 
    print STDERR $usage; exit ;
}

open(AR,">$dataD/rarely.on.AR") || die "could not open $dataD/rarely.on.AR";
my %on;
foreach $_ (`cat $dataD/atomic.regulon.on.off.calls`)
{
    if ($_ =~ /^(\S+)\t(\S+)\t(1)$/)
    {
	push(@{$on{$2}},$1);
    }
}

foreach my $ar (sort { $a <=> $b } keys(%on))
{
    my $x = $on{$ar};
    my $n = @$x;
    if (($n > 0) && ($n < 21))
    {
	foreach my $sample (@$x)
	{
	    print AR join("\t",($ar,$n,$sample)),"\n";
	}
    }
}

close(AR);


open(PEGS,">$dataD/rarely.on.PEGs") || die "could not open $dataD/rarely.on.PEGs";
undef %on;
foreach $_ (`cat $dataD/peg.on.off.calls`)
{
    if ($_ =~ /^(\S+)\t(\S+)\t(1)$/)
    {
	push(@{$on{$2}},$1);
    }
}

foreach my $peg (sort { &SeedUtils::by_fig_id($a,$b) } keys(%on))
{
    my $x = $on{$peg};
    my $n = @$x;
    if (($n > 0) && ($n < 21))
    {
	foreach my $sample (@$x)
	{
	    print PEGS join("\t",($peg,$n,$sample)),"\n";
	}
    }
}
close(PEGS);	

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3