MERLIN wrappers

Description

These functions require MERLIN to be installed and correctly pointed to in the PATH environment variable. The required input files are automatically created (in the working directory) and deleted afterwards. The MERLIN command is executed via a call to system().

Usage

1
2
3
4
5
merlin(x, markers=seq_len(x$nMark), model=TRUE, theta=NULL, 
       options="", verbose=FALSE, generate.files=TRUE, 
       cleanup=generate.files, logfile="")

merlinUnlikely(x, remove=FALSE, verbose=!remove)

Arguments

x

a linkdat object

markers

an integer vector indicating which markers to use (default: all).

model

a logical: If TRUE (and x$model is not NULL), the file "merlin.model" is created and "–model merlin.model" is included to the MERLIN command.

theta

a numeric with values between 0 and 0.5: The recombination value(s) for which the LOD score is computed. The values of theta are converted to centiMorgan positions using the Haldane map function and included in the MERLIN command using the --position parameter. Works only for single markers (i.e. markers must consist of a single integer).

options

a character with additional options to the MERLIN command. See details.

verbose

a logical: Show MERLIN output and other information, or not.

generate.files

a logical. If TRUE, the files "merlin.ped", "merlin.dat", "merlin.map", "merlin.freq" and (if model=TRUE) "merlin.model" are created in the working directory.

cleanup

a logical: Should the files be deleted automatically after the MERLIN run?

logfile

a character. If this is given, the MERLIN screen output will be written to a file with this name.

remove

a logical. If FALSE, the function returns the indices of markers found to unlikely. If TRUE, a new linkdat object is returned, where the unlikely markers have been deleted.

Details

For these functions to work, MERLIN must be installed and the path to merlin.exe included in the PATH variable. The merlin function is first and foremost a wrapper to the parametric linkage functionality of MERLIN. By default the following MERLIN command is run (via a call to system) after creating appropriate files in the current working directory:

merlin -p _merlin.ped -d _merlin.dat -m _merlin.map -f _merlin.freq --model _merlin.model --tabulate --markerNames --quiet

The resulting multipoint LOD scores are extracted from the output and returned in R as a linkres object.

Additional command parameters can be passed on using the options argument (this is simply pasted onto the MERLIN command, so dashes must be included). For example, to obtain singlepoint LOD scores instead of multipoint, set options="--singlepoint". (The singlepoint scores should agree with the results of lod(x), except in cases where some individuals have partial genotypes (see Examples).)

If model=FALSE the --model merlin.model part is removed from the MERLIN command above. This is necessary for some calculations, e.g. likelihoods (see Examples).

The merlinUnlikely function is a wrapper for MERLIN's "–error" command. The syntax is similar to that of mendelianCheck.

Value

If model=TRUE, a linkres object. Otherwise a character containing the complete MERLIN output.

For merlinUnlikely, a numeric containing the indices of the unlikely, or (if remove=TRUE) a new linkdat object where the unlikely markers are removed.

Author(s)

Magnus Dehli Vigeland

References

http://www.sph.umich.edu/csg/abecasis/Merlin/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 
x = linkdat(toyped, model=1)
x

# MERLIN treats partial genotypes (i.e. one known and one unknown allele) as missing:
lod_merlin = merlin(x)
lod_partial = lod(x)
x = modifyMarker(x, marker=1, ids=1, genotype=0)
lod_missing = lod(x)
stopifnot(lod_merlin == round(lod_missing, 3))

# Likelihood computation by MERLIN:
merlin(x, model=F, options="--lik")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.