R/readMS.R

Defines functions readMS

Documented in readMS

readMS <- function(file, big.data=FALSE){

if(!big.data){
out     <- read.ms.output(file.ms.output=file)
gametes <- out$gametes
dir.create("SwapMS")

for(xx in 1:length(gametes)){

 d <- gametes[[xx]]
 d <- list(matrix=d,positions=NaN)
 samplename <- paste("ms_sample_",xx,".RD",sep="")
 save(d,file= file.path ("SwapMS",samplename) )

}
test <- readData("SwapMS", SNP.DATA=TRUE, FAST=TRUE, format="RData", big.data=big.data)
unlink("SwapMS",recursive=TRUE)
return(test)
}# end of !big.data

if(big.data){
out     <- read.big.ms.output(file)
gametes <- out$gametes
dir.create("SwapMS")

for(xx in 1:length(gametes)){
 open(gametes[[xx]])
 d <- gametes[[xx]][,]
 close(gametes[[xx]])
 d <- list(matrix=d,positions=NaN)
 samplename <- paste("ms_sample_",xx,".RD",sep="")
 save(d,file= file.path ("SwapMS",samplename) )

}
test <- readData("SwapMS", SNP.DATA=TRUE, FAST=TRUE, format="RData", big.data=big.data)
unlink("SwapMS",recursive=TRUE)
return(test)
}#end of big.data




}

Try the PopGenome package in your browser

Any scripts or data that you put into this service are public.

PopGenome documentation built on Feb. 1, 2020, 1:07 a.m.