SNP.match: SNP matching

Description Usage Arguments Details Value See Also

View source: R/snp_match.r

Description

Returns a vector of the positions of (first) SNP matching of its first argument in its second.

Usage

1

Arguments

x

A bed.matrix or a data.frame.

table

A bed.matrix or a data.frame.

Details

When x is a bed.matrix, the data.frame [email protected] will be used; the same holds for table. The columns that will be taken in consideration are id, chr, pos, A1, and A2. Not all columns are mandatory (see below). All columns present in x must be present in table.

The matching criterium depends on the columns present in x. There are 5 possible criteria : (i) matching by chromosome and position, (ii) matching by chromosome, position, and alleles, (iii) matching by id, (iv) matching by id, chromosome and position, and (v) matching by id, chromosome, position and alleles.

For each SNP in x, the function looks for the position of the first matching SNP in table. If alleles are included in the matching criterium (ie if allele columns A1 and A2 are present in x), the function also checks for SNP matching with swapped alleles (a SNP A/C would match a SNP C/A), or with reference strand flipped (i.e. a SNP A/C would match a SNP T/G) or both (a SNP A/C would match a SNP G/T).

This function should prove useful for data set merging.

Value

A named list with one or three members, depending on whether alleles are included in the matching criterium.

index

An integer vector giving the position of first match in table, or NA if there is no match

swap

A logical vector indicating whether the match is with swapped alleles

flip

A logical vector indicating whether the match is with flipped strand

See Also

SNP.duplicated


gaston documentation built on Jan. 31, 2018, 1:05 a.m.