-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpr_config_files.R
129 lines (96 loc) · 5.22 KB
/
gpr_config_files.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
rm(list = ls())
##############################################################################
# Generate ROGERS Partitions #
# Copyright (C) 2022 #
# #
# This program is free software: you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the #
# Free Software Foundation, either version 3 of the License, or (at your #
# option) any later version. This program is distributed in the hope that #
# it will be useful, but WITHOUT ANY WARRANTY; without even the implied #
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# Elaine Cecilia Gatto | Prof. Dr. Ricardo Cerri | Prof. Dr. Mauri Ferrandin #
# Federal University of Sao Carlos (UFSCar: https://www2.ufscar.br/) Campus #
# Sao Carlos Computer Department (DC: https://site.dc.ufscar.br/) #
# Program of Post Graduation in Computer Science #
# (PPG-CC: https://ppgcc.dc.ufscar.br/) Bioinformatics and Machine Learning #
# Group (BIOMAL: https://www.biomal.ufscar.br/) #
# #
##############################################################################
########################################################################
# WORSKSPACE
########################################################################
FolderRoot = "~/Generate-Partitions-Rogers"
FolderScripts = "~/Generate-Partitions-Rogers/R"
###############################################################################
# LOAD LIBRARY/PACKAGE #
###############################################################################
library(stringr)
###############################################################################
# READING DATASET INFORMATION FROM DATASETS-ORIGINAL.CSV #
###############################################################################
setwd(FolderRoot)
datasets = data.frame(read.csv("datasets-original.csv"))
n = nrow(datasets)
###############################################################################
# CREATING FOLDER TO SAVE CONFIG FILES #
###############################################################################
FolderCF = paste(FolderRoot, "/GPR-Config-Files", sep="")
if(dir.exists(FolderCF)==FALSE){dir.create(FolderCF)}
###############################################################################
# CREATING CONFIG FILES FOR EACH DATASET #
###############################################################################
i = 1
while(i<=n){
# specific dataset
ds = datasets[i,]
# print the dataset name
cat("\ndataset = ", ds$Name)
# Confi File Name
file_name = paste(FolderCF, "/GPR-", ds$Name, ".csv", sep="")
# Starts building the configuration file
output.file <- file(file_name, "wb")
# Config file table header
write("Config, Value",
file = output.file, append = TRUE)
# Absolute path to the folder where the dataset's "tar.gz" is stored
# write("Dataset_Path, \"/home/u704616/Datasets\"",
# file = output.file, append = TRUE)
write("Dataset_Path, /home/elaine/Datasets",
file = output.file, append = TRUE)
# job name
job_name = paste("gpr-", ds$Name, sep = "")
# directory name
# folder_name = paste("\"/scratch/", job_name, "\"", sep = "")
# folder_name = paste("/scratch/", job_name, sep = "")
# folder_name = paste("~/Exhaustive-MiF1-ECC/", job_name, sep = "")
# folder_name = paste("~/tmp/", job_name, sep = "")
folder_name = paste("/dev/shm/", job_name, sep = "")
# Absolute path to the folder where temporary processing will be done.
# You should use "scratch", "tmp" or "/dev/shm", it will depend on the
# cluster model where your experiment will be run.
str1 = paste("Temporary_Path, ", folder_name, sep="")
write(str1,file = output.file, append = TRUE)
# dataset name
str3 = paste("dataset_name, ", ds$Name, sep="")
write(str3, file = output.file, append = TRUE)
# Dataset number according to "datasets-original.csv" file
str2 = paste("number_dataset, ", ds$Id, sep="")
write(str2, file = output.file, append = TRUE)
# Number used for X-Fold Cross-Validation
write("number_folds, 10", file = output.file, append = TRUE)
# Number of cores to use for parallel processing
write("number_cores, 10", file = output.file, append = TRUE)
# finish writing to the configuration file
close(output.file)
# increment
i = i + 1
# clean
gc()
}
###############################################################################
# Please, any errors, contact us: [email protected] #
# Thank you very much! # #
###############################################################################