#!/usr/bin/perl # noe_weeder # # searches XEASY/CYANA upl files for # 'bad' sequential restraints, e.g. HA-HB, HN-HA # and unassigns the corresponding NOEs in a peak list # # uses the upl file generated by caliba (e.g. c13no_cal.upl) # which should first be sorted with 'sort -n c13no_cal.upl' # # Francis Peterson 12/14/02 # modified to work with cyana 2.1 files 072705 BFV # # syntax: noe_weeder sorted_upl_file noesy_peaklist > output_file # $file1 = $ARGV[0]; $file2 = $ARGV[1]; # Search sorted upl files for bad sequential NOEs open (FILE1, "$file1") || die "Couldn't open file: $!\n"; while () { @fld = split; #delimits by whitespace # print "$fld[0] $fld[1] $fld[2] $fld[3] $fld[4] $fld[5] $fld[6] $fld[7] $fld[8] $fld[9] \n"; # print "$fld[3] $fld[0] $fld[5] \n"; # Selects subset of NOE to evaluate for violations unless(($fld[5] eq "H") || ($fld[4] eq "PRO" && ($fld[5] eq "HD2" || $fld[5] eq "HD3" || $fld[5] eq "QD"))){ $res_diff=$fld[3]-$fld[0]; # print "$res_diff \n"; # Finds violations and stores peak number in an array if(($res_diff > 0 ) && ($res_diff < 3 )){ # print "$fld[0] $fld[1] $fld[2] $fld[3] $fld[4] $fld[5] $fld[6] $fld[7] $fld[8] $fld[9] \n"; # print " \n"; push @peak, $fld[8]; # print "@peak \n"; } } } close(FILE1); # Opens peak list and resets assignment of bad sequential NOEs open (FILE2, "$file2") || die "Couldn't open file: $!\n"; while () { @fld = split; #delimits by whitespace if(/dimensions/||/FORMAT/||/INAME/){ print $_; next; } # identify and print header lines without change # if(/#/){ # # print "$_"; # next; # } #Reset bad sequentials to zero $match=0; foreach $peak (@peak){ if($peak==$fld[0]){ $fld[11]=0; #print "$peak $fld[0] $fld[11] \n"; $~ = "PEAKS"; write; $match=1; last; } } if($match==0){ print $_; } } #define format for output format PEAKS = @>>>>> @##.### @##.### @##.### @ @ @>>>>>>>>> @>>>>>>>> @ @ @>>> @>>> @>>> 0 $fld[0], $fld[1], $fld[2], $fld[3], $fld[4], $fld[5], $fld[6], $fld[7], $fld[8], $fld[9], $fld[10], $fld[11], $fld[12] .