#!/usr/local/bin/perl 
# passed in one line of amino acids calcs average hydrophobicity and puts it in a temp file

open (REPORT, ">tempres.txt")||die "could not create temp report file";

# read in hydrophobicity values
open (HYDRO, "scale.txt")||die "couldn't open scale.txt";
while (<HYDRO>){
	#print "in while";
	/(.*)\s+(-?\d+\.\d+).*/;
	$phobicityhash{$1}=$2;
}
$average=0;
$number=0;
close HYDRO;
$currentacid=0;
while (<@ARGV>){
    #print $_;
	$currentacid=$phobicityhash{$_};
        if($currentacid!=undef){
	$average=($average+$currentacid)/($number+1);	
	$number++;
    } 
			
} #whileone acids on one line

print REPORT $average."\t";

close REPORT;

	
