From: softlib.cs.rice.edu
Last Modified: July 14,1995

OFM - Optimize For Maxhap

written by Chris Hoelscher

PURPOSE

OFM is an auxiliary program in the FASTLINK package. OFM is designed to increase the efficiency of 3 of the main programs (ilink, linkmap, mlink) by helping to ensure that the programs are compiled with the correct value of maxhap (see README.constants). Note: ofm cannot be used for lodscore because the lcp-produced scripts for lodscore have a different structure. Also, optimizing maxhap seems to be important primarily for ilink and linkmap.

In the source code for the main programs, in the file commondefs.h, there is a definition for maxhap, which is currently set to 180. This value is used to statically allocate space for data and computation. If maxhap is larger than necessary, then the program will perform inefficiently. maxhap's lowest allowable value is the allele product.

OFM will analyze the FASTLINK user's lcp-produced script and the locus description file. Then OFM modifies the Makefile used to compile the desired program. Finally, it will remake the target supplied. The newly made target will be optimized for the allele product of the data supplied.

OFM assumes that the programs are run with a script produced by lcp, and that the locus file (often called datafile.dat) is prepared using makeped/preplink. In particular, the first line for each locus should include the string "no. of alleles" in either upper or lower case. If you have a different string there, the program (ofm.c) can be modified to handle it, by changing the constant INFO_LINE_KEY near the beginning of ofm.c. OFM does not require that the locus file be called datafile.dat.

If the lcp-produced script includes multiple runs, OFM assumes that they are all runs of the same program, but the alleles used in each run may vary. If the alleles vary from run to run, then OFM figures out the allele product for each run and uses the largest product as the "optimized" value of maxhap.

For now, OFM is specific to UNIX. To compile on AIX (IBM's version of UNIX) add the flags

       -D_POSIX_SOURCE -D_XOPEN_SOURCE 
to EXTRAFLAGS in Makefile.

USAGE

Before beginning a run on a data set, move to the directory where the data (pedigree file and data file) and script (produced by lcp) reside. Once there, execute the program with the following command line:
ofm target script [source-dir [Makefile]]
The arguments to this program are:
target:
the desired target to remake, it must be one of the valid targets specified in the program or "void", which will NOT remake any target. Valid targets for sequential FASTLINK include: installfast, installslow, ilink, slowilink, linkmap, slowlinkmap, mlink, slowmlink ofm can also be used with the targets for parallel FASTLINK (see README.parallel ).

script:
is the script file which will perform the analysis on the data you wish to optimize your code for.

source_dir:
the directory where the source code is located.

Makefile:
the name of the Makefile, which should be in the source-dir.
If either Makefile or source-dir are not specified on the command line, compiled in constants will be used. If these constants do not represent files available, then the user will be notified of the error and prompted for new file_names to open.

NOTE: ofm will have to be run again when the data is changed.

INSTALLATION

To install ofm, place the ofm.c file into the source directory. The executable can be compiled with the command line
        make ofm
The code itself should work fine as given, but the supplied defaults near the beginning of ofm.c may not match your system.

In the file ofm.c, near the top, there is a section called constants, which should include the lines:

#define DEFAULT_DATAFILE_DIRECTORY "./"
#define DEFAULT_SOURCE_DIRECTORY "./"
#define DEFAULT_MAKEFILE_NAME "Makefile"
There are instructions in the file as to what these are to help you.

The first and last constant will probably not need to be changed, but the middle constant should name the source code directory. I suggest explicitly naming the source dir from "/", since different data directories might need different relative paths to the source directory.

The first constant need only be edited if ofm does not find the datafile. Possible reason for not finding the datafile are:

  1. ofm was not run in the data directory
  2. the data directory is different from the script directory
If #2 is the case, then the first constant should be a relative path from the script directory to the data directory.

The third constant should not need to be edited, but it represents the default name of the Makefile. Possible changes should be to "makefile" or "GNUmakefile", but I think these are unlikely.


back to fastlink