Spaces:
Sleeping
Sleeping
Upload process_genotype.R
#4
by
AshmithaIRRI
- opened
- process_genotype.R +26 -0
process_genotype.R
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(snpStats)
|
| 2 |
+
library(rrBLUP)
|
| 3 |
+
library(sommer)
|
| 4 |
+
|
| 5 |
+
args <- commandArgs(trailingOnly = TRUE)
|
| 6 |
+
train_path <- args[1]
|
| 7 |
+
test_path <- args[2]
|
| 8 |
+
|
| 9 |
+
geno_Train <- read.csv(train_path, header = TRUE, stringsAsFactors = FALSE)
|
| 10 |
+
geno_Test <- read.csv(test_path, header = TRUE, stringsAsFactors = FALSE)
|
| 11 |
+
|
| 12 |
+
sample_ids_Train <- geno_Train[, 1]
|
| 13 |
+
sample_ids_Test <- geno_Test[, 1]
|
| 14 |
+
|
| 15 |
+
geno_Train <- as.matrix(geno_Train[, -1])
|
| 16 |
+
geno_Test <- as.matrix(geno_Test[, -1])
|
| 17 |
+
|
| 18 |
+
additive_Train <- A.mat(geno_Train)
|
| 19 |
+
dominance_Train <- D.mat(geno_Train)
|
| 20 |
+
additive_Test <- A.mat(geno_Test)
|
| 21 |
+
dominance_Test <- D.mat(geno_Test)
|
| 22 |
+
|
| 23 |
+
write.csv(data.frame(Sample_ID = sample_ids_Train, additive_Train), "Train_additive.csv", row.names = FALSE)
|
| 24 |
+
write.csv(data.frame(Sample_ID = sample_ids_Train, dominance_Train), "Train_dominance.csv", row.names = FALSE)
|
| 25 |
+
write.csv(data.frame(Sample_ID = sample_ids_Test, additive_Test), "Test_additive.csv", row.names = FALSE)
|
| 26 |
+
write.csv(data.frame(Sample_ID = sample_ids_Test, dominance_Test), "Test_dominance.csv", row.names = FALSE)
|