R: function to merge objects of snp.data-class

merge.snp.data {GenABEL} | R Documentation

## function to merge objects of snp.data-class

### Description

function to merge two objects of snp.data-class

### Usage

    	## S3 method for class 'snp.data'
    merge(x, y, ... , error_amount = 1e+06, replacena = TRUE,
    	forcestranduse = FALSE, sort = TRUE,
    	intersected_snps_only = FALSE)

### Arguments

`x` | the first object of `snp.data-class`
`y` | the second object of `snp.data-class`
`...` | additional arguments (not used or passed)
`error_amount` | if this amount of errors is exceeded, only error table is returned
`replacena` | Some genotypes may be missing in set 1, but measured in set 2. If replacena=TRUE, genotypes from the set 2 will appear in the merged data.
`forcestranduse` | if TRUE, forces use of strand infomation even if coding information is sufficient for merging
`sort` | if TRUE, sorts the object according to chromosome and SNP position
`intersected_snps_only` | if TRUE, then only interesected SNPs will be in output

### Details

By default, when a genotype for a person is measured in both set "x" and set "y", and these are not equal, the value specified by set "x" is returned in the merged set. In case when genotype is NA in the first set, the behaviour depends on the value of the "replacena" parameter – if set to TRUE (default), these are replaced with the non-NA values from set "y".

When "forcestranduse" is set to FALSE, strand information is not used unless the coding is not sufficient for merging the data (i.e. starnd information is used only to merge A/T and G/C polymorphisms).

SNP error is returned to "snp" table when SNP coding is incompatible between the two sets. For such SNPs, only the data provided by set "x" are used in the merged data.

ID error is returned to "id" table when genotypes of the same person at the same SNP are different between set "x" and set "y". For such genotypes, the data provided by set "x" are used in the merged data.

### Value

A list is returned

`id` | This table summarises individual genotype inconsistencies. These may occur when some person is present and genotyped for the same marker in both sets, but these genotypes are inconsistent. The table's first column, "id", contains personal ID, the second, "snpnames", contain SNP name, and third (set "x") and fourth (set "y") contain the genotypes for this person at this SNP in sets 1 and 2.
`snp` | This table summarises coding errors. These occur when for some SNPs coding in the set 1 is not compatible with set 2. The table's first column ("snpnames") provides SNP name, and second (set "x") and third (set "y") report coding used in respective sets.
`data` | merged object of `snp.data-class`

### Author(s)

Maksim Struchalin, Yurii Aulchenko

### See Also

`merge.gwaa.data`, `add.phdata`

### Examples

    	require(GenABEL.data)
    	data(srdta)
    	x1 <- srdta[c(1,3,5,6),c(2,4,5,6)]@gtdata
    	x2 <- srdta[c(2,4,5,6),c(1,3,5,6)]@gtdata
    	x3 <- merge(x1,x2)
    	as.character(x1)
    	as.character(x2)
    	as.character(x3$data)
    	as.character(srdta[1:6,1:6])

[Package GenABEL version 1.8-0 Index]