convert_impstatus: Convert imputation-status values to the QCGWAS standard

Description Usage Arguments Details Value Note Examples

View source: R/convert_impstatus.R

Description

Converts imputation-status data to the standard values used by QC_GWAS

Usage

1
2
3
4
5
convert_impstatus(impstatus,
                  T_strings = c("1", "TRUE", "T"),
                  F_strings = c("0", "FALSE", "F"),
                  NA_strings = c(NA, "NA", ".", "-"),
                  use_log = FALSE, ...)

Arguments

impstatus

vector of imputation-status data.

T_strings

character-string(s) indicating imputed data.

F_strings

character-string(s) indicating genotyped data.

NA_strings

character-string(s) indicating missing data.

use_log, ...

arguments used by QC_GWAS; redundant when convert_impstatus is used separately.

Details

This function is used to convert the imputation-status column into the standard format, where 0 is genotyped and 1 is imputed. Untranslated values (i.e. strings that do not appear in any of the string arguments) will trigger a warning message and are set to NA.

Value

Numeric vector with values 0 for genotyped, 1 for imputed and NA for unknown data.

Note

The implementation of this function has changed. Previously, only character data was translated using the string arguments. Since version 1.0-4, the string arguments are used for all data types, so the user can determine the conversion of logical and numeric values as well.

However, this does mean that values 1 and 0 are no longer converted automatically. They must be specified in the string arguments, or else the function will report them as untranslated and converts them to NA. The same applies to TRUE, FALSE and NA. Note the difference between the character string "NA" and the value NA.

Finally, if the imputation-status column contains character strings, the main QC function QC_GWAS requires that all values are translated. If not, QC_GWAS will abort the QC.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
  status1 <- c(0,0,0,1,1,1,2,NA)
  status2 <- c(TRUE, FALSE, TRUE, FALSE, NA)
  status3 <- c("imputed", "genotyped", "NA", NA)
  status4 <- c(status1, status2, status3)
  
  ( outcome1 <- convert_impstatus(status1,
                                  T_strings = 1,
                                  F_strings = 0,
                                  NA_strings = NA) )
  # status 1 contains an untranslated value "2", which is
  # converted to NA. To avoid the warning message:
  
  ( outcome1 <- convert_impstatus(status1,
                                  T_strings = 1,
                                  F_strings = 0,
                                  NA_strings = c(NA, 2)) )
  
  
  ( outcome2 <- convert_impstatus(status2,
                                  T_strings = TRUE,
                                  F_strings = FALSE,
                                  NA_strings = NA) )
  
  ( outcome3 <- convert_impstatus(status3,
                                  T_strings = "imputed",
                                  F_strings = "genotyped",
                                  NA_strings = c("NA", NA)) )
  # Note that NA_strings includes both the character-string "NA"
  # and the value NA. Otherwise, one of the two would go 
  # "untranslated" and trigger a warning message.
  
  
  # And to check them all together
  ( outcome4 <- convert_impstatus(status4,
                          T_strings = c(1, TRUE, "imputed"),
                          F_strings = c(0, FALSE, "genotyped"),
                          NA_strings = c("NA", NA, 2)) )

QCGWAS documentation built on May 2, 2019, 3:19 p.m.