#!/usr/bin/perl -w @todo = `ls *.lista*`; #looks at each file containing the phrase ".lista" in the name. %record=(); #reads in the delay from each filename. foreach(@todo){ chomp; open IN, "< $_"; $_ =~ /^(\d+\.*\d*)/; $T=$1; #breaks up each file by assignment name and records the peak height for each residue for a given delay. while(){ next unless /N\-H/; @_=split; $record{$_[0]}{$T}=$_[3]; } close IN; } foreach(keys %record){ $res = $_; open OUT, ">$_.dat"; $count=0; foreach( sort {$a <=> $b} keys %{$record{$res}} ){ #sorts the assignments in each delay file alphabetically. $count++; if($count==1) {$norm_fac=$record{$res}{$_};} #defines the peak height of the first delay as the normalization factor. print OUT $_/1000,"\t\t",$record{$res}{$_}/$norm_fac,"\n"; #calculates the normalized peak heights for each delay. } close OUT; }