philosophy of file IO in YARM
Data files can be catagorized by whether they long term or short term storage of information.
A long term data file is something that needs to store information beyond the time of the current calculation. These files must be human readable text files, in a format that is simple to parse. For this purpose, yarm uses two file types, either a 1D Yarm Data File or a 2D Yarm Data File. Both of these data files are input/output to YARM via the readData or writeData subroutines.
Examples of data that might be contained n a 1D Yarm Data File are anything that requires only a single key to identify the data, for example: CSA tensor info, and experimentally measured relaxation rates. For both of these examples, the single key to identify the data is the name of the atom to which the data refers.
example of a few lines from a file containing 1D Yarm Data representing the experimentally measured R2 relaxation rates from a protein:
gandalf(lapham) > cat r2_data "A 1 ARG N" : 14.34 : 3.23 "A 2 HIS N" : 12.11 : 1.23 "A 3 ALA N" : 11.60 : 0.53 "A 4 ALA N" : 11.12 : 0.61The format of the file can be thought of more symbolically as:
"KEY1" : VAL1 : VAL21D Yarm Data files are read into a YARM associative array via the readData subroutine:
%R2exp = &readData( $filename );
The readData subroutine reads in each line, and builds an associative array using the "KEYx" names as keys, and builds a list using the "VALx" values. Thus, in the example above, the %R1exp associative array looks like this:
%R2exp = ( "A 1 ARG N" => [ 14.34, 3.23 ], "A 2 HIS N" => [ 12.11, 1.23 ], "A 3 ALA N" => [ 11.60, 0.53 ], "A 4 ALA N" => [ 11.12, 0.61 ], );and the data can be accessed within a script like this:#!/usr/bin/perl -w %R2exp = &readData( r2_data ); $atom = "A 4 ALA N"; ($R2, $R2err) = @{ $R2exp{$atom} }; print "The measured R2 relaxation rate of $atom is $R2 ($R2err)\n";this would output