| SNP.match {gaston} | R Documentation |
SNP matching
Description
Returns a vector of the positions of (first) SNP matching of its first argument in its second.
Usage
SNP.match(x, table, by = "chr:pos:alleles")
Arguments
x |
A bed.matrix or a data.frame |
table |
A bed.matrix or a data.frame |
by |
The criterium used to matchSNPs |
Details
When x is a bed.matrix, the data.frame x@bed 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).
The matching criterium is specified by parameter by.
There are 5 possible criteria : (i) matching by chromosome and position
with by = "chr:pos", (ii) matching by chromosome, position, and alleles
with by = "chr:pos:alleles", (iii) matching by id with by = "id",
(iv) matching by id, chromosome and position with by = "id:chr:pos",
and (v) matching by id, chromosome, position and alleles with by = "id:chr:pos: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 |
swap |
A logical vector indicating whether the match is with swapped alleles |
flip |
A logical vector indicating whether the match is with flipped strand |