Original Document "fileutil.wpd" from B. Fedirchuk: June 10, 1998

SCRC FILE UTILITIES
SPECIFICALLY MADE FOR MANAGING DATA FILES



appendrun merges two run files into a single file.
asc2run converts an ascii file of voltage values into a run file.
axon2run converts data in axotape format to scrc run file format.
copyrun duplicates a run file and saves it under a different name.
dumprun displays the run header and trace data as ascii
lsrun displays the names of the run files and their run headers (*.txt files)
mergelo merge layout files into a single file
removerun there is no removerun command! Use rm. show me some UNIX
renamerun renames an existing run file
rmendfrm removes the last frame from a run file
rmtfetch for "fetching" entire directory structures from another computer or disk to the local system
can be done on the same computer)
salvagerun attempts to salvage an incomplete run from an aborted capture
trimfrms makes a copy of a run file while deleting data from each trace in the frames



appendrun firstrun secondrun
Appendrun is used to merge two run files into a single file. The data from secondrun is appended to firstrun. The run name arguments can be given with or without the .frm suffix. One common use of appendrun is to assemble two averages into a single file which is then viewed with qm.


asc2run [-options] asciifile runfile
Asc2run is used to convert an ascii file representing voltage values into a run file that can be loaded by the SCRC software. Asc2run creates the .frm file in addition to the appropriate number of associated waveform files (.w00, .w01 etc). This utility cannot create traces, but traces can be made by reframing the waveform(s) in the resulting run file in the analysis program.
options:

-s specifies the number of columns to skip for each line of input. You may skip the first n of columns, but once those columns are skipped, the sampled columns must be contiguous. (default is 0)
-c specifies number of channels. Your ascii file must have the appropriate number of columns. (default is 1)
-t specifies a particular character as separating the columns. (default is to consider: space(s) (therefore tab(s) are also seen as separators), comma, parentheses, slash, colon, or semicolon as a column separator - and therefore skip over repeated occurances) If you have columns separated by another character, it must be specified with the "-t character" option.
-m specifies a gain multiplier used to bring the ascii voltage values to a desirable range of A/D units. (the default is 1 and means and input range of 0.160 V: therefore: -0.160 V < ascii values < +0.160 V) Specifying "-m 0.01" would mean that ascii values could be between 16 V.
-f specifies the sampling frequency of the ascii samples (default is 10,000 Hz)
-d specifies the sampling divisors for output waveforms. Divisors must be within quotes and separated by spaces with the whole list given as one arguement. (e.g. -d "1 1 2 1") This would mean that for the 3rd data column of the ascii file, only every 2nd point would be used to construct the waveform. Although this halves the sampling rate for that waveform, the original ascii file still must have the same number of samples as the other columns. (default is 1 for all input channels)



axon2run [-t] axonrun destinationrun*
converts DOS ABF format files created by Axon Instruments software (either Axotape or pClamp) to SCRC type run files. The data must be in Axon DOS binary format (not the newer windows ABF format), so if a windows application was used to create the data file, it must first be saved in DOS ABF format with a .dat extension using the Axon software. The "file comment" and "long description" fields are written to the new run files' .txt file during conversion.
"-t" option: this option can be used to convert the data to traces rather than waveforms if the original Axon file was captured in "oscilloscope" mode (either LOSSFREEOSC or HIGHSPEEDOSC). Traces can be made with other types of Axon data files, but may not yield what you expect! Also, sometimes the last frame of the resulting run file may end up being nonsensical. If that occurs it can be removed from the run file using the "rmendfrm" utility.

*warning: if no destinationrun name is given, it will remove the .dat suffix from the original Axon file and write a runfile with the same prefix but an .frm suffix. This will silently overwrite another .frm file with the same name if one existed.



copyrun sourcerun destinationrun
duplicates a run file and saves it under a different name.
Copyrun copies all of the files making up the run of the given source name, to the given destination name. These files are the frame file ( .frm ), the run description file ( .txt ), the frame description file ( .frd ), and the waveform files ( .w?? ). Any associated analysis, parameter file, or waveform parameter files will not be copied.

If you give the name of an existing run, it will not be overwritten. You must first remove all of the destination's files if you want to replace it with a copy of the source. Don't specify a directory name as the destination: it won't tack on the source file name to the destination directory, like cp does. If you want to copy several run files to another directory, keeping the same names, use cp as in this example:
cp cell5* ../mydir.



dumprun runfile
Dumprun displays the contents of the run header for each named run. Each name specified as an argument may be either the name of a frame file, or the name of a run without the .frm suffix. Several lines will be displayed for each run, starting with general information about the run, and followed by the calibration information for each stored trace and waveform. There are options to convert the data points in frames or traces to ASCII values and display them.
dumprun [ -f ] [ -t ] [-c n]

With the -f option, dumprun will display (dump out) the frame header for each frame, following the run header contents. With the -t , it will dump out not only the frame headers, but also the trace data within each frame, as decimal integer values representing the raw A/D levels recorded. This gives an ASCII text representation of the entire frame file. By default, the trace data will be presented as a single column, one number per line. A greater number of columns can be selected with the -c option. The samples should be read along rows rather than down the columns.

dumprun can be used to move trace data into a spreadsheet for further analysis. For example, create an average of several frames and save it (Bins-save) as "myfile". Then use dumprun to create a new file with the data points as integers. Eg.

dumprun -t myfile > temp.prn
Now read "temp.prn" into your favourite spreadsheet as an ascii file



lsrun (optional filenames)
Lsrun creates a list of the names of the run files with the run headers (*.txt files) in a directory.
eg. lsrun filenames > tempfile # put the output of lsrun into a text file called tempfile


mergelo layout_filenames ...> new_layout_filename
Merglo merges multiple layout files into a single file;
e.g. mergelo layout1.lo layout2.lo ...etc > newlayout.lo

Merglo merges all of the specified layout files into one combined layout, which it puts out on its standard output. It compares the headers of all the given layout files to make sure they were all set up for the same page size.

No changes are made to the panels' sizes or placements. If a panel appears at the same location in two layout files, they will overlap in the merged layout file.



removerun

There is no removerun command! Use the UNIX command "rm" (carefully!!). You can easily remove all of the files making up one run by typing "rm runname.???". (This will also remove associated parameter files.) show me basic UNIX commands


renamerun oldrunname newrunname
Renamerun renames an existing run file. Renamerun renames all of the files making up the run of the given oldname, to the given newname. These files are the frame file (.frm), the text file (.txt), and the waveform files (.wnn). Any associated analysis, parameter file or waveform parameter files will not be renamed. If you give the name of an existing run, it will be not be overwritten or removed. Don't specify a directory name as the new name: it won't tack on the old file name to the destination directory, like mv does.If you want to move several run files to another directory, keeping the same names, use mv as in this example: "mv cell5* ../mydir".


rmendfrm runfilename(s)
removes the last frame from the specified run file(s). It actually removes the all the data from the .frm file (this is very different than manually deleting a frame with "frmsel"). This capability allows you to delete nonsensical last frames that are sometimes created when converting data from Axon Instruments format to SCRC run file format using "axon2run".


rmtfetch
rmtfetch is a utilitity for copying entire directory structures (i.e. including all subdirectories) either from one computer to another or from one disk drive on a computer to another. It "fetches" the files/directories from a remote system onto the local system. It is started just by typing "rmtfetch" at the prompt, it then prompts you to name the source system, source directory and file (or directory) to copy and finally the destination directory. (If you named a source directory, it will be created within the destination directory that you have named - unless it already exists) This is the best way to transfer data files since it conserves all information about ownership and creation times. That information would be lost if the transer was done using FTP. Also, if a directory is named all the contents and structure of subdirectories is retained.


salvagerun -option runfilename
Salvagerun attempts to salvage a compromised runfile, (e.g. an incomplete run from an aborted capture).

Salvagerun can be used to recover data from a runfile which is incomplete, such as the run file you are left with when you run out of disk space during a data capture. The runfile argument can be given with or without the .frm suffix.

Before actually fixing the file, salvagerun makes sure the run header is complete and usable. Since the run may not have been validated by the capture program, by placing the correct run ID in the header, other checks are needed to ensure that the run is valid. It makes sure that the header size, the averaging type, the sampling rate, the window duration, the frame size, and the sampling rate divisors all fall within acceptable limits, and are mutually consistent. If any discrepancy is found, it will not be able to salvage the run, and it will indicate which parameter(s) failed the test.

Next, salvagerun will compare the actual lengths of the waveform files against each other, and against the expected run length. It will warn you if any waveform files are missing. It will then give you a summary of the changes that are required to the runfile. These caninclude fixing the run ID, adjusting the run length and number of frames, padding out short waveform files with zeroes, and clearing the waveform divisors for missing waveform files. If it finds nothing to fix, it will say so and quit.

After these consistency checks and summary, salvagerun asks you if it is OK to proceed. Type an N if you decide to cancel the operation; the run will remain unchanged. If you type a Y, or hit SPACE or RETURN, salvagerun will update the run header with all the necessary corrections, then pad out the waveform files that are too short. The padding will appear as a straight line at the level of 0 A/D units. This portion of the waveforms will obviously be useless in any analysis, but at least the analysis program will let you look at the run, and analyse the valid data up to the point where the padding began. Salvagerun makes no attempt to correct or replace the run description file (.txt), nor the frame description file (.frd); you will have to update these text files by hand, if there is any problem with them.

The -f option can be used to change the sampling frequency as recorded in the run header, if it is incorrect. If the given freq is a number, that number will replace the current value. If it is given as a slash ( / ) followed immediately by a number (in the same argument), the current frequency is divided by the given number. If just a slash, with no following number is given, the current frequency is divided by the number of waveforms in the run. This latter correction is to fix a problem introduced with an old alpha release of the axon2run program, which incorrectly set the sampling frequency.



trimfrms source_filename destination_filename
Trimfrms makes a copy of a run file while deleting data from each trace in the frames.

Trimfrms copies all of the files making up the run of the given source name, to the given destination name. These files are the frame file (.frm), the run description file (.txt), the frame description file (.frd), and the waveform files (.wnn). Any associated analysis parameter file or waveform parameter files will not be copied. The name arguments can be given with or without the .frm suffix. While copying the frame file, trimfrms will trim data from the start and/or end of each trace in the frames, according to your specifications.

The destination name must correspond to the final run name. If you give the name of an existing run, it will be not be overwritten. You must first remove all of the destination's files if you want to replace it with a copy of the source.

Before beginning, trimfrms will show what the current window size is for the triggered sweeps, and ask how much you want to trim from the start, and from the end. Enter the amounts in milliseconds. The default values are 0 , for no trimming. It will then indicate the new window size, and the resulting sizes for each trace.

If you are trimming from the start of the window, you will be warned if any trace will need to be time-shifted in the trimmed run. Such a time shift occurs when the sample rate divisor for any trace does not evenly divide the amount being trimmed from the start, expressed as a number of samples at the basic sampling rate.

After this, trimfrms asks you if it is OK to proceed. Type an N if you decide to cancel the operation. The new run will not be created. If you type a Y , or hit SPACE or RETURN, trimfrms will proceed with copying the files that make up the run. While copying and trimming the frame file, it will adjust the delay and window size parameters in the new run eader, to reflect the new offset and length of the triggered sweeps.