The output files are saved to the specified directory according to out
.
filest(setting, out, thread = 1)
An absolute path to a setting file
An absolute path for output files
A number to specify a maximum thread to be run in parallel
NULL if done successfully. NA if output directory can't be created.
This function takes the specific input file containing the settings for simulations. It allows multiple settings for several simulation within one file. The simulation-setting file must be a text file. The line started with "--" indicates the parameters for simulation, and the line started with "#" are comments. Empty lines are allowed in the setting file. The parameters in the setting file are listed below:
--setting
A name of setting
--population
A list that indicates the numbers of population
separated by comma
--fst
A list that indicates the Fst values separated by comma.
Each Fst value represents a genetic distance of that particular population
and the first population. The Fst values for the first population and the
second population should be the same values, otherwise they will be summed up
and devided by two.
--case
A list that indicates the ratio values of cases separated
by comma
--outlier
A list that indicates the logical values (0/1) whether
that population are outliers, separated by comma
--marker
A number of SNPs
--replicate
A number of replicates
--riskratio
A number of replicates
--no.case.snp
A number of case SNPs
--pc
A logical value (TRUE/FALSE) whether PCs will be calculated.
--fulloutput
A logical value (TRUE/FALSE) whether all
information will be exported.
#Check and run the demo from demo.filest()
demo.filest()
#> Creating a setting file ... /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1.txt
#> Generating the simulated data to ... /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi
#> Start [S0] at 2022-04-27 02:25:01
#> Setting file is : /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1.txt
#> The simulated files will be saved in this directory: /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1
#> Warning: '/var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1' already exists
#> Creating data file setting #1 - rep #1
#> Done - 0.0307450294494628906 secs
#> Writing data files setting #1 - rep #1
#> Done - 0.148672103881835938 secs
#> Creating status file setting #1 - rep #1
#> Done - 0.149502992630004883 secs
#> Estimating Fst setting #1 - rep #1
#> Done - 0.162631988525390625 secs
#> Creating maker information setting #1 - rep #1
#> Overwrite the existed bed file
#> Overwrite the existed bim file
#> Overwrite the existed fam file
#> Done - 0.317824125289916992 secs
#> Generating PC scores #1 - rep #1
#> Generating EigenVector #1 - rep #1
#> Done - 0.660111188888549805 secs
#> [1] "/var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi"
#Here is the code for demo.filest()
txt <- "--setting=example1\n"
txt <- paste0(txt, "--population=100,100\n")
txt <- paste0(txt, "--fst=0.01,0.01\n")
txt <- paste0(txt, "--case=0,0\n")
txt <- paste0(txt, "--outlier=0,0\n")
txt <- paste0(txt, "--marker=1000\n")
txt <- paste0(txt, "--replicate=1\n")
txt <- paste0(txt, "--riskratio=1\n")
txt <- paste0(txt, "--no.case.snp=0\n")
txt <- paste0(txt, "--pc=TRUE\n")
txt <- paste0(txt, "--missing=0\n")
txt <- paste0(txt, "--fulloutput=TRUE\n")
outdir <- file.path(tempdir())
settingfile <- file.path(outdir, "example1.txt")
fo <- file(settingfile,"w")
for (i in txt){ write(i,fo)}
close(fo)
filest(setting = settingfile, out = outdir, thread = 1)
#> Start [S0] at 2022-04-27 02:25:01
#> Setting file is : /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1.txt
#> The simulated files will be saved in this directory: /var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1
#> Warning: '/var/folders/k6/3_1zxcc90dgd495vv1432wf40000gn/T//RtmpIEOawi/example1' already exists
#> Creating data file setting #1 - rep #1
#> Done - 0.0299029350280761719 secs
#> Writing data files setting #1 - rep #1
#> Done - 0.150053977966308594 secs
#> Creating status file setting #1 - rep #1
#> Done - 0.15067601203918457 secs
#> Estimating Fst setting #1 - rep #1
#> Done - 0.162698984146118164 secs
#> Creating maker information setting #1 - rep #1
#> Overwrite the existed bed file
#> Overwrite the existed bim file
#> Overwrite the existed fam file
#> Done - 0.320184946060180664 secs
#> Generating PC scores #1 - rep #1
#> Generating EigenVector #1 - rep #1
#> Done - 0.68758702278137207 secs