CP TO MRC - Copy SPIDER files To MRC format files

(1/6/20)

PURPOSE

Copies a SPIDER-format image/volume file into a MRC format file. to more fully support MRC file usage. As of 2015 this operation converts to the MRC 2014+ format. Starting with SPIDER version: 22.11 this operation creates little-endian (native Intel) byte order output files. This operation and its expected inputs were altered in Jan 2020.   Example.

SEE ALSO

CP FROM ASCII [Copy ASCII text file to SPIDER file]
CP FROM EMI [Copy EMISPEC format file to SPIDER file]
CP FROM MRC [Copy MRC file to SPIDER file]
CP FROM NIK [Copy Nikon Coolscan format file to SPIDER file]
CP FROM PDB [Copy PDB file to SPIDER format]
CP FROM RAW [Copy Raw Image to SPIDER file]
CP FROM TERM [Copy Terminal input to SPIDER image/volume]
CP FROM TIFF [Copy TIFF format file to SPIDER file]
CP FROM VAX [Copy VAX SPIDER file to a Unix SPIDER file]
CP TO ASCII [Copy SPIDER file to ASCII text format]
CP TO BRIX [Copy SPIDER volume to BRIX file for "O" input]
CP TO MRC [Copy SPIDER files To MRC format files]
CP TO OPEND [Copy SPIDER file To Opposite Byte Endian]
CP TO POST [Copy SPIDER image to a POSTscript image]
CP TO RAW [Copy SPIDER file to a 8-bit raw image]
CP TO TIFF [Copy SPIDER file to a TIFF format]

USAGE

.OPERATION: CP TO MRC

.SPIDER INPUT FILE NAME OR TEMPLATE (E.G. SPI_STK@**): SPI000
[Enter the SPIDER file you want to copy. It can be an image, image stack, image series, volume, or a volume stack.]

.MRC OUTPUT FILE NAME OR TEMPLATE (E.G. **@MRC_STK.mrc): @mrc_stk.mrc
[Enter name for MRC format output file. Stacks are allowed.]

.MRC DATA MODE (0/1/2/6): 2
[Possible MRC Data modes
0: 8-bit signed integer,
1: 16-bit signed integer,
2: 32-bit real,
6: 16-bit unsigned integer]

If SPIDER input contains an image or image stack SPIDER asks the following two questions:

.DATA ORIGIN (UL/LL): UL
[MRC data origin can be UL: upper left or LL: Lower left. Relion and Cryosparc expect to have the origin: 'UL'.]

.PIXEL SIZE (A) FOR X & Y AXES: 1.0 , 1.0
[Pixel size value will be be multiplied by the number of pixels in each axis to get the MRC cell dimensions.]

However if SPIDER input contains an image or image stack SPIDER asks the following two questions:
'DATA ORIGIN (UL/LL) & HANDEDNESS (L/R): UL L [MRC data origin can be UL: upper left or LL: Lower left. Relion and Cryosparc expect to have the origin: 'UL' and handedness: 'L'.]

.PIXEL SIZE (A) FOR X, Y & Z AXES: 1.0 , 1.0, 1.0
[Pixel size value will be be multiplied by the number of pixels in each axis to get the MRC cell dimensions.]

NOTES

  1. Can not copy SPIDER Fourier files.

  2. The simple 'CP' operation can now be used to copy to/from MRC files by just specifying the MRC extension.

  3. The MRC file format is sometimes referred to as CCP4 format.

  4. The ancient legacy procedure "fit_ccp4_to_pdb.spi" below creates a CCP4 file aligned for use in 'O'.

SUBROUTINES

COPYTOMRC, OPFILES, OPSTREAMFILE

CALLER

COPY1
;
; fit_ccp4_to_pdb.spi
;
; THIS ANCIENT PROCEDURE ORIENTS AND SHIFTS A SPIDER VOLUME THAT HAS BEEN CONVERTED TO
; A BRIX VOLUME BY "CP TO BRIX" AND HAS BEEN USED (THE BRIX VOLUME) TO
; FIT A PDB STRUCTURE USING "O" OR REAL SPACE REFINEMENT (RSR). THE OUTPUT 
; OF THIS PROCEDURE IS A CCP4 VOLUME WHICH IS AT THE CORRECT LOCATION AND 
; ORIENTATION AS THAT OF THE FITTED PDB STRUCTURE. THIS CAN BE VISUALIZED 
; USING "O", "CHIMERA" OR "PYMOL".

; ALTERNATIVELY, 

; (1) ONE CAN ALSO ORIENT AND SHIFT THE FITTED PDB FILE TO FIT THE CCP4 
; VOLUME WHICH IS GENERATED FROM THE UNROTATED AND UNSHIFTED SPIDER VOLUME,
; WHICH CAN BE VISUALIZED BY USING "O", "CHIMERA" OR "PYMOL". USE PROCEDURE 
; "fit_pdb_to_ccp4.spi" IN THE SPIDER PROCEDURE DIRECTORY"spider/proc/".

; (2) ONE CAN USE "CP TO BRIX" TO CONVERT THE UNROTATED AND UNSHIFTED 
; SPIDER VOLUME TO A BRIX VOLUME WHICH CAN BE USED TO VISUALIZE THE
; FITTED PDB STRUCTURE IN "O", "CHIMERA" OR "PYMOL".

;;;;;;;;;;;;;;;;;;;;;; BEGINING OF INPUT PARAMETERS ;;;;;;;;;;;;;;;;;;

 [input]  = 'vol_spi'
 [output] = 'vol_ccp4.ccp4'
 [ps]     = 2.82            ; Pixel size
 [len]    = 32              ; Data length for CCP4 file  

 ;;;;;;;;;;;;;;;;;;;;;; END OF INPUT PARAMETERS ;;;;;;;;;;;;;;;;;;;;;;;;

 ; ROTATE THE VOLUME SO THAT X = Y, Y = X AND Z = -Z
 RT 3D
   [input]
   _1
   90, 0, 0

 RT 3D
   _1
   _2
   0, 180, 0

 RT 3D
   _2
   _3
   180, 0, 0

 ; FIND NX, NY AND NZ
 FI [NX],[NY],[NZ]
   [input]
   12, 2, 1

 ; FIND THE CENTER IN PIXELS, FOR EVEN DIMENSION, IT IS NX/2 ETC..
 ; FOR ODD DIMENSION, IT IS (NX/2 + 1) ETC..

 [xc] = INT([NX]/2)
 [yc] = INT([NY]/2)
 [zc] = INT([NZ]/2)

 [x]  = ([NX] - 2*[xc]) + [xc]
 [y]  = ([NY] - 2*[yc]) + [yc]
 [z]  = ([NZ] - 2*[zc]) + [zc]

 ; CALCULATE THE CENTER IN ANGSTROMS
 [xa] = [x] * [ps]
 [ya] = [y] * [ps]
 [za] = [x] * [ps]

 ; CREATE THE MRC (CCP4) FILE
 ; NOTE: FOR DISPLAY, "CHIMERA" READS THE ORIGIN WHEREAS "O" READS THE STARTING 
 ; POINTS OF XYZ. ORIGIN IS GIVEN IN ANGSTROMS, STARTING POINTS ARE GIVEN IN PIXELS.

 CP TO MRC
   _3
   [output]
   [len] 
   LL
   [ps], [ps], [ps]    
 
 EN
 

© Copyright Notice /       Enquiries: spider@health.gov.ny