Asked by a user via email:
I'm attempting to use the GWAStools package and unfortunately have not had much luck. I have a GDS object and would like to subset that GDS object for specific individuals, and then save the subsetted GDS object permanently in my directory. I'm attempting to use the gdsSubset function but do not know how to save the subsetted GDS file as a permanent file in my working directory. I would greatly appreciate any insight you may have. I'm including my code below.
Thank you for your help,
# Create a new GDS file containing only the individuals for which we have phenotype and other meta data # read in meta data for the individuals sample_metadata <- read.csv("Scan_annotation_data_object.csv", header=T) # First make vector of sample IDs sampleIDs <- sample_metadata$scanID # Write path to full GDS file. Not sure why it needs the path instead of the actual GDS object in R but oh well. gdsfile <- "C:/Users/Waters/Dropbox (MERLAB)/Puerto_Rico_AD_GWAS/PR5geno.gds" # Create temporary file...only way I can get the function to work PR5geno_subset <- tempfile() gdsSubset(gdsfile, PR5geno_subset, sample.include = sampleIDs) gdsSubsetCheck(gdsfile, PR5_genofile_subset, sample.include = sampleIDs) # Can't move forward. The example doesn't give any insight into how I can save the subset as a new GDS file.