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

View of /FigKernelScripts/make_occ_counts.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Dec 1 20:46:40 2003 UTC (16 years ago) by efrank
Branch: MAIN
CVS Tags: V00-00-01, merge-trunktag-bobdev_news-2, Root-bobdev_news, merge-bobdev_news-1, caBIG-dataload-0, merge-trunktag-bobdev_news-1, merge-bodev_news-3, efrank-preMakefileToStandardMk, delong-01, delong-02, caBIG-00-00-00, merge-bobdev_news-2, V00-00-00, merge-trunktag-bodev_news-3
Branch point for: Branch-bobdev_news

Makefile:
	get it to work with the release tools

All the rest:
	had to rename foo to foo.pl so that makefiles could recognize
	perl source from, say, Makefiles and READMEs

# -*- perl -*-

use Carp;
use Data::Dumper;
use FIG;

my $fig = new FIG;
$| = 1;

# usage: make_occ_counts CutOff > counts

( $cutoff = shift @ARGV)
    || die "usage: make_occ_counts CutOff > counts";

opendir(SIMS,"$FIG_Config::data/Sims") || die "could not open Sims";
@files = grep { $_ !~ /^\./ } readdir(SIMS);
closedir(SIMS);

foreach $file (@files)
{
    &process("$FIG_Config::data/Sims/$file");
}

sub process {
    my($file) = @_;
    my(%seen,$x,$curr,$count);

    open(TMP,"<$file") || die "could not open $file";
    
    if (defined($x = <TMP>))
    {
	chop $x;
	$x = [split(/\t/,$x)];
    }
    while (defined($x))
    {
	$curr = $x->[0];
	$count = 0;
	undef %seen;
	while (defined($x) && ($x->[0] eq $curr))
	{
	    if ((! $seen{$x->[1]}) && ($x->[10] <= $cutoff))
	    {
		$seen{$x->[1]} = 1;
		$count++;
	    }

	    if (defined($x = <TMP>))
	    {
		chop $x;
		$x = [split(/\t/,$x)];
	    }
	}
	print "$count\t$curr\n";
    }
    close(TMP);
}

undef $fig;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3