Exclude data range from XDS ASCII.HKL: Difference between revisions

From XDSwiki
Jump to navigation Jump to search
(Created page with "This is a jiffy (binaries for [ftp://turn5.biologie.uni-konstanz.de/pub/linux_bin/exclude_data_range_from_XDS_ASCII.HKL Linux] and [ftp://turn5.biologie.uni-konstanz.de/pub/ma...")
 
No edit summary
Line 1: Line 1:
This is a jiffy (binaries for [ftp://turn5.biologie.uni-konstanz.de/pub/linux_bin/exclude_data_range_from_XDS_ASCII.HKL Linux] and [ftp://turn5.biologie.uni-konstanz.de/pub/mac_bin/exclude_data_range_from_XDS_ASCII.HKL Mac]) that removes reflections of a given frame range. The first and last frame of the range must be input. The program reads XDS_ASCII.HKL and writes XDS_ASCII.HKL.exclude_data_range . If several frame ranges should be removed, the program can be run repeatedly - but of course then the files must be renamed.
This is a jiffy (binaries for [ftp://turn5.biologie.uni-konstanz.de/pub/linux_bin/exclude_data_range_from_XDS_ASCII.HKL Linux] and [ftp://turn5.biologie.uni-konstanz.de/pub/mac_bin/exclude_data_range_from_XDS_ASCII.HKL Mac]) that removes reflections of a given frame range. The first and last frame of the range must be input. The program reads XDS_ASCII.HKL and writes XDS_ASCII.HKL.exclude_data_range . If several frame ranges should be removed, the program can be run repeatedly - but of course then the files must be renamed.
Bad frames may e.g. be identified by [[xdscc12]].
<pre>
<pre>
! purpose: remove data on bad frames (identified e.g. by xdscc12) from XDS_ASCII.HKL
! purpose: remove data on bad frames from XDS_ASCII.HKL
! Kay Diederichs July 3, 2019
! Kay Diederichs July 3, 2019
PROGRAM main
PROGRAM main
       CHARACTER line*512
       CHARACTER line*512
       INTEGER inunit,outunit,first,last,ier,ih,ik,il
       INTEGER inunit,outunit,first,last,ier,ih,ik,il
       REAL intensity,sigma,xd,yd,zd
       REAL :: intensity,sigma,xd,yd,zd=0
        
        
       OPEN(NEWUNIT=inunit,FILE='XDS_ASCII.HKL',STATUS='old',ACTION='READ')
       OPEN(NEWUNIT=inunit,FILE='XDS_ASCII.HKL',STATUS='old',ACTION='READ')
Line 13: Line 15:
       OPEN(NEWUNIT=outunit,FILE='XDS_ASCII.HKL.exclude_data_range',STATUS='unknown',ACTION='WRITE')
       OPEN(NEWUNIT=outunit,FILE='XDS_ASCII.HKL.exclude_data_range',STATUS='unknown',ACTION='WRITE')


! copy only lines that either cannot be read, or where ZD < first or ZD > last
! copy only lines that either cannot be read, or where ZD < first-1 or ZD > last  
! (keep in mind that reflections of frame i have a ZD between i-1 and i)
       DO
       DO
         READ(inunit,'(a)',end=99)line
         READ(inunit,'(a)',end=99) line
         READ(line,*,iostat=ier) ih,ik,il,intensity,sigma,xd,yd,zd
         READ(line,*,iostat=ier) ih,ik,il,intensity,sigma,xd,yd,zd
         IF (ier==0 .AND. zd>=first .AND. zd<=last) CYCLE  
         IF (ier==0 .AND. zd > first-1 .AND. zd < last) CYCLE  
         WRITE(outunit,'(a)') TRIM(line)
         WRITE(outunit,'(a)') TRIM(line)
       END DO
       END DO

Revision as of 09:16, 5 July 2019

This is a jiffy (binaries for Linux and Mac) that removes reflections of a given frame range. The first and last frame of the range must be input. The program reads XDS_ASCII.HKL and writes XDS_ASCII.HKL.exclude_data_range . If several frame ranges should be removed, the program can be run repeatedly - but of course then the files must be renamed.

Bad frames may e.g. be identified by xdscc12.

! purpose: remove data on bad frames from XDS_ASCII.HKL
! Kay Diederichs July 3, 2019
PROGRAM main
      CHARACTER line*512
      INTEGER inunit,outunit,first,last,ier,ih,ik,il
      REAL :: intensity,sigma,xd,yd,zd=0
      
      OPEN(NEWUNIT=inunit,FILE='XDS_ASCII.HKL',STATUS='old',ACTION='READ')
      PRINT*,'first and last frame of range that should be excluded?'
      READ*,first,last
      OPEN(NEWUNIT=outunit,FILE='XDS_ASCII.HKL.exclude_data_range',STATUS='unknown',ACTION='WRITE')

! copy only lines that either cannot be read, or where ZD < first-1 or ZD > last 
! (keep in mind that reflections of frame i have a ZD between i-1 and i)
      DO
        READ(inunit,'(a)',end=99) line
        READ(line,*,iostat=ier) ih,ik,il,intensity,sigma,xd,yd,zd
        IF (ier==0 .AND. zd > first-1 .AND. zd < last) CYCLE 
        WRITE(outunit,'(a)') TRIM(line)
      END DO
   99 STOP
END PROGRAM main