Skip to contents

Reads mtz files and store both header information and reflection data records in named lists. A third list is used, if the mtz file is an unmerged file, for storing batch headers.

Usage

readMTZ(filename, message = FALSE)

Arguments

filename

A character string. The path to a valid mtz file.

message

A logical variable. If TRUE the function prints a message highlighting data included in the mtz file. Default value is message=FALSE.

Value

A named list of length 3. The first element is called "reflections" and is a dataframe with as many columns as are included in the mtz file. The name of each column of the dataframe coincides with the name of the corresponding column in the mtz. The second element is called "header" and is a named list in which each name correspond to a valid field in the mtz header (see details in

readMTZHeader). The third element is called "batch_header" and is a list with as many elements as the number of batches (images) included in the mtz file. Each list element is, itself, a named list including all the useful variables stored in batch headers. If no batch headers are contained in the file (merged mtz), the batch_header element is NULL.

Examples


datadir <- system.file("extdata",package="cry")
filename <- file.path(datadir,"1dei_phases.mtz")
ltmp <- readMTZ(filename)
#> Warning: truncating string with embedded nuls
print(names(ltmp))
#> [1] "reflections"  "header"       "batch_header"
print(class(ltmp$reflections))
#> [1] "data.frame"
str(ltmp$reflections)
#> 'data.frame':	8377 obs. of  16 variables:
#>  $ H          : num  0 0 0 0 0 0 0 0 0 0 ...
#>  $ K          : num  0 0 0 0 0 1 1 1 1 1 ...
#>  $ L          : num  4 6 8 10 14 3 4 5 6 7 ...
#>  $ FP         : num  420.2 784.6 266.9 60.6 94.3 ...
#>  $ SIGFP      : num  48.03 53.49 18.89 21.46 5.33 ...
#>  $ FC         : num  411.5 719.3 156.4 79.5 42.4 ...
#>  $ PHIC       : num  0 180 0 0 0 ...
#>  $ FC_ALL     : num  441.5 780.3 145.6 82.5 46.5 ...
#>  $ PHIC_ALL   : num  0 180 360 0 360 ...
#>  $ FWT        : num  398.9 788.8 388.2 30.8 142 ...
#>  $ PHWT       : num  0 180 360 0 360 ...
#>  $ DELFWT     : num  42.62 8.47 242.59 51.63 95.55 ...
#>  $ PHDELWT    : num  180 180 360 180 360 ...
#>  $ FOM        : num  1 1 1 0.934 0.999 ...
#>  $ FC_ALL_LS  : num  461 743.4 145.4 81.8 42.3 ...
#>  $ PHIC_ALL_LS: num  0 180 360 0 360 ...
print(class(ltmp$header))
#> [1] "list"
print(class(ltmp$batch_header))
#> [1] "NULL"

refs <- ltmp$reflections
print(colnames(refs))
#>  [1] "H"           "K"           "L"           "FP"          "SIGFP"      
#>  [6] "FC"          "PHIC"        "FC_ALL"      "PHIC_ALL"    "FWT"        
#> [11] "PHWT"        "DELFWT"      "PHDELWT"     "FOM"         "FC_ALL_LS"  
#> [16] "PHIC_ALL_LS"
print(range(refs$H))
#> [1]  0 35