Adding artificial gwas generation
This commit is contained in:
parent
1efbc18547
commit
13c101ca11
14501
Code/Data/artif_gwas.csv
Normal file
14501
Code/Data/artif_gwas.csv
Normal file
File diff suppressed because one or more lines are too long
36
Code/Data/gen_gwas.R
Normal file
36
Code/Data/gen_gwas.R
Normal file
@ -0,0 +1,36 @@
|
||||
# npdro::createSimulation2() example for gwas simulation
|
||||
if (!require("devtools")) install.packages("devtools")
|
||||
library(devtools)
|
||||
install_github("insilico/npdro")
|
||||
library(npdro)
|
||||
|
||||
## Set Working Directory to file directory - RStudio approach
|
||||
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
|
||||
|
||||
gen.gwas = function(samples, vars, batch_size=1000){
|
||||
for (x in 1:ceiling(samples/batch_size)){
|
||||
curr_batch <- samples - (batch_size*(x-1))
|
||||
batch_gen <- ifelse(curr_batch > batch_size, batch_size, curr_batch)
|
||||
data <- createSimulation2(data.type = "discrete", avg.maf = 0.2,
|
||||
sim.type = "mainEffect",
|
||||
pct.train = 1.0,
|
||||
pct.imbalance=round(runif(n = 1, min = 0.1, max = 0.9),2),
|
||||
main.bias = 0.4, pct.signals = 0.2,
|
||||
num.samples = batch_gen,
|
||||
num.variables = vars)
|
||||
|
||||
rownames(data$train) <- as.integer(rownames(data$train))+
|
||||
(batch_size*(x-1))
|
||||
|
||||
if (x == 1){
|
||||
write.table(data$train, "artif_gwas.csv", row.names = TRUE)
|
||||
} else{
|
||||
write.table(data$train, "artif_gwas.csv", row.names = TRUE,
|
||||
append = TRUE, col.names = FALSE)
|
||||
}
|
||||
}
|
||||
return(data$train)
|
||||
}
|
||||
|
||||
gen.gwas(1000000, 10000)
|
||||
|
||||
5
Code/Schrick-Noah_CS-6643_Research-Project.cpp
Normal file
5
Code/Schrick-Noah_CS-6643_Research-Project.cpp
Normal file
@ -0,0 +1,5 @@
|
||||
#include <boost/mpi.hpp>
|
||||
#include <boost/mpi/environment.hpp>
|
||||
|
||||
#include <plinkio/plinkio.h>
|
||||
#include <Rcpp.h>
|
||||
1
Code/Schrick-Noah_CS-6643_Research-Project.h
Normal file
1
Code/Schrick-Noah_CS-6643_Research-Project.h
Normal file
@ -0,0 +1 @@
|
||||
|
||||
1
Presentations/.~lock.Schrick-Noah_CS-6643_Proposal.ppt#
Normal file
1
Presentations/.~lock.Schrick-Noah_CS-6643_Proposal.ppt#
Normal file
@ -0,0 +1 @@
|
||||
,noah,NovaArchSys,03.12.2022 18:36,file:///home/noah/.config/libreoffice/4;
|
||||
Loading…
x
Reference in New Issue
Block a user