R/fake.snps.R

#' Create a vector of fake non-sense SNPs
#'
#' @importFrom dplyr filter sample_n select %>%
#' 
#' 
#' @param summary Summary sheet with info on SNPs
#' @param n Number to generate
#' @param group Optional grouping paramter. Reports as a list

fake.snps <- function(summary = NULL, n= 3000, group = NULL){

	if(is.null(summary)) stop("Please input a list of SNPs with characteristics to select based off of.")
	if(is.null(n)) stop("Input number of fake snps")
	if(is.null(group)) message("No grouping parameter selected")

	# will have to change the SELECT statement if change the group...
	# dont know how to do this yet.

	fake_snps <- list()

	if(!is.null(group)){
		for(i in group){

		summary %>% 
			filter(k == i) %>%
			sample_n(n) %>%
			select(rsid) %>%
			as.vector ->
			fake_snps[[i]]
		}
	}

	return(fake_snps)
}
Chris1221/coR-ge documentation built on May 6, 2019, 11:18 a.m.