Mark A. White wrote:
> ***  For details on how to be removed from this list visit the  ***
> ***          CCP4 home page http://www.ccp4.ac.uk         ***
> 
> I have a couple of simple awk commands that will calculate both I/sI and 
> Redundancy, by 
> parsing the the scalepack output log.
> ### I/sigma by Shell
> awk '{ if ($11 > 1. && ($1>$2 || $2=="hkl")) printf"Sig: %7.2f%5.2f %8.1f 
> \n",$1,$2,(0.5*($4-$3)+($5-$4)+2.5*($6-$5)+4.5*($7-$6)+7.5*($8-$7)+15*($9-$8)+25*$10)/($11+0.01)
>  
> }' scalepack.log | tail -16
> #### Redundancy by Shell
> awk '{ if ($13 > $3 && ($1>$2 || $2=="hkl")) printf"Red: %7.2f%5.2f %8.1f 
> \n",$1,$2,($4+2*$5+3*$6+4*$7+5.3*$8+7.3*$9+10*$10+14*$11+1337*$12)/($13+0.01) 
> }' 
> scalepack.log | tail -16
> 
> PS. You will probably need to reassemble the above commands.  Each one is a 
> single command 
> line, which can be placed at the end of your scalepack.com script. Note that 
> I usually use 
> 15 resolution shells, so that the output of each command is truncated to 16 
> lines, 
> otherwise you get a lot of junk, particularly from the latest versions of 
> scalepack. 
> Change the "tail" command to limit your output to the number of resolution 
> shells plus 1.
> 
> 
> [email protected] wrote:
> 
>>
>> I've written an awk/nawk script that will post-process a Scalepack log file 
>> to produce 
>> pseudo <I/SIGI> values as a function of resolution, as well as the (pseudo) 
>> overall 
>> value. It does this by massaging the "I/Sigma in resolution shells" table, 
>> calculating a 
>> pseudo <I/SIGI> weighted by the number of reflections in each individual 
>> I/SIGI//resolution bin. (Some counting of number of reflections is also 
>> corrected.) This 
>> process is obviously an inaccurate, stopgap measure, but some would argue 
>> that it is 
>> better than nothing. Perhaps the next update of Scalepack will report more 
>> complete 
>> statistics, along the lines of Scala?
>> ~~~~~~~~~~~~~~~~~~~~~~~~
>> David Borhani, Ph.D.
>> Group Leader, Biochemistry
>> Vox:        508-849-2944
>> Fax:        508-755-8361
>> Email:        [email protected]
>> Smail:         Abbott Bioresearch Center, Inc.
>>        100 Research Drive
>>        Worcester, MA 01605 U.S.A.
>> http://abbott.com/abbottbioresearch/
>> ~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> # awk/nawk file
>> # DWB 1Oct2003
>> #
>> # Extract <I/SigI> statistics as a function of resolution from a scalepack 
>> log file.
>> #
>> # Usage:
>> #
>> # awk -f scalepack_Isig.nawk scalepack.log > scalepack.log.I_over_sigma
>> #
>> # Typical input data from a Scalepack log file:
>> #
>> #    Shell            I/Sigma in resolution shells:
>> #  Lower Upper      No. of reflections with I / Sigma less than
>> #  limit limit     0     1     2     3     5    10    20   >20  total
>> #  50.00  3.21    26    51    73   101   163   335   707  8474   9181
>> #   3.21  2.55   110   214   315   410   609  1131  2521  6690   9211
>> #   2.55  2.23   206   383   608   815  1253  2197  4277  4879   9156
>> #   2.23  2.02   195   466   761  1051  1700  3119  5758  3388   9146
>> #   2.02  1.88   448   941  1464  1959  2863  4859  7434  1757   9191
>> #   1.88  1.77   664  1511  2344  3100  4420  6558  8520   575   9095
>> #   1.77  1.68   846  2131  3370  4420  5934  7891  9022   155   9177
>> #   1.68  1.61  1088  2852  4441  5629  7030  8529  9050    48   9098
>> #   1.61  1.54  1281  3455  5197  6204  7313  8206  8435    11   8446
>> #   1.54  1.49   685  1986  3076  3847  4671  5115  5162     2   5164
>> # All hkl       5549 13990 21649 27536 35956 47940 60886 25979  86865
>> #
>> #-----------------------------------------------------------
>> #
>> BEGIN {
>> # skip to correct start of table...
>>  x = 0
>>  y = 0
>>  nrbins = 0
>> #
>>  while (x != 1)
>>  {
>>   getline
>>   if ($1 == "Shell" && $2 == "I/Sigma" && $4 == "resolution") {x = 1}
>>  }
>> # Skip to "  limit limit     0     1     2..." line, and load up I/Sigma bin 
>> values...
>>  getline ; getline
>>  nibins = NF-3
>>  for (i = 3; i <= NF-1; ++i)
>>  {
>> # Force ">20" to be interpreted as "30.0"
>>   if (substr($i,1,1) == ">") $i = substr($i,2,length($i)) * 1.5
>> # Force real value rather than text for all ibin values
>>   ibin[i-2] = $i + 0.
>>  }
>> }
>> #
>> # Process table data...
>> #
>> {
>>  while (y != 1)
>>  {
>> # Process regular lines of the table
>>   if ($1 != "All")
>>   {
>> # Increment resolution bin counter, store resolution limits for this line...
>>    ++nrbins
>>    rbin[1,nrbins] = $1
>>    rbin[2,nrbins] = $2
>> # Store number of reflections in each I/SigI for this line...
>>    for (i = 3; i <= nibins + 2; ++i) bin[i - 2,nrbins] = $i
>>    getline
>>   }
>>   else
>>   {
>>   y = 1
>>   }
>>  }
>> }
>> #
>> END {
>>  printf "Pseudo <I/sigI> Statistics from scalepack log file: %s\n\n", 
>> FILENAME
>>  printf "    bin   dmax   dmin     Nhkl  <I/sigI>\n"
>>  printf "----------------------------------------\n"
>>  ntot = 0
>>  isigtot = 0
>> # Loop over resolution bins...
>>  for (j = 1; j <= nrbins; ++j)
>>  {
>>   n[j] = 0
>>   isig[j] = 0
>> # Loop over I/SigI bins at given resolution...
>>   for (i = 1; i <= nibins; ++i)
>>   {
>> # Total number of reflections, calculate pseudo I/SigI...
>>    n[j] = n[j] + bin[i,j]
>>    isig[j] = isig[j] + bin[i,j] * ibin[i]
>>    isigtot = isigtot + bin[i,j] * ibin[i]
>>   }
>> # Overall statistics...
>>   isig[j] = isig[j] / n[j]
>>   ntot = ntot + n[j]
>>   printf "    %3i %6.2f %6.2f %8i %8.2f\n", j, rbin[1,j], rbin[2,j], n[j], 
>> isig[j]
>>  }
>>  isigtot = isigtot / ntot
>>  printf "----------------------------------------\n"
>>  printf "OVERALL %6.2f %6.2f %8i %8.2f\n", rbin[1,1], rbin[2,nrbins], ntot, 
>> isigtot
>> }
>> # END of awk/nawk file 
> 
> 

Reply via email to