merlin: MERLIN wrappers

View source: R/merlin.R

merlinR Documentation

MERLIN wrappers

Description

Wrappers for the MERLIN software, providing multipoint LOD scores and other computations on pedigrees with marker data. These functions require MERLIN to be installed and correctly pointed to in the PATH environment variable.

Usage

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 MERLIN files be deleted automatically?

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.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.

References

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

Examples


## 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, 4))

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

## End(Not run)


paramlink documentation built on April 15, 2022, 9:06 a.m.