#!/usr/bin/perl $NUM_OF_MOLECULES=6; chkargs(); my $arr_res_active_passive=&get_imput_res(); my $air_file=$ARGV[0]; &fill_segid(); &make_air_file( $arr_res_active_passive, $air_file); print "DONE!!\n"; END; 1; sub chkargs { if(scalar(@ARGV)== 0) { print "Usage:\n $0 filename for the AIR generated file\n"; exit(1); } } sub make_air_file { my $arr_res_active_passive = $_[0]; my $air_file = $_[1]; my $i=0; my $j=0; my $ki=0; my $kj=0; my $kk=0; my $ctrl=0; open AIRFILE, ">", $air_file or die "Can not write file $air_file\n$!\n"; for($i=0;$i<$NUM_OF_MOLECULES;$i++) { print AIRFILE "!\n! HADDOCK AIR restraints for molecule $SEGID[$i]\n!\n"; for($j=0 ; $j; chomp $input ; if($input ne undef) { $input=&clean_residuelist($input); @{$arr_res_active_passive[$i][0]}=split /\s+/,$input; # print "@{$arr_res_active_passive[$i][0]}\n"; } print "PASSIVE Residues for molecule $i:\n"; $input=; chomp $input ; if($input ne undef) { $input=&clean_residuelist($input); @{$arr_res_active_passive[$i][1]}=split /\s+/,$input; # print "@{$arr_res_active_passive[$i][1]}\n"; } } return \@arr_res_active_passive; } sub clean_residuelist { my $str=$_[0]; $str=~s/\,/\ /g; #print "2- ".$str."\n"; $str=~s/\s+/\ /g; #print "3- ".$str."\n"; $str=~s/[^\d\ ]//g; #@arr=split '\ ',$str; #print "4- "."@arr"."\n"; return $str; }