Create_Single_SNP_Object: For a single SNP, create an SNPFastImpute Object

Description Usage Arguments Details Value Examples

View source: R/Create_SNP_XGBoost_Object_function.R

Description

For a single SNP, create an SNPFastImpute Object

Usage

1

Arguments

df

the dataframe containing NAs, p columns of SNPs, n rows of samples.

a

the column indicator of the SNP in the dataset.

size

the windows size around the SNP to use as predictor variables.

Details

Basically the function do two different jobs. Using the known values for each SNP to predict the missing values for that SNP.

Value

an object for the corresponding SNP.

If the SNP has missing value, then this object is a list with 6 elements:

1. model_fit: indicator whether we need to fit a model for the SNP. 2. SNP_position: position of the SNP. 3. NA_positions: position of the missing values. 4. train_data: samples that are not missing for this SNP. 5. train_lable: the values of the non-missing samples for this SNP 6. pred_data: samples that are missing for this SNP. 7. pred_label: an empty vector to store the future predicted labels.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data("Test_df")
single_SNP_Obj <- Create_Single_SNP_Object(Test_df, 1, 10)
## return a list of SNP related information for model building.

## Create_Single_SNP_Object(Test_df, 50, 200)
## Error message.
## Stop as the size of the windows are larger than the number of SNPs in the dataframe.

## Create_Single_SNP_Object(matrix(NA, 10, 5), 1, 1)
## Should print a warning message that all samples for this SNP are NA's.
## return a list containing a model_fit value equal to false.

GaoGN517/689_SNPFastImpute_Mac documentation built on Dec. 8, 2019, 12:33 a.m.