subsample {Geneclust}R Documentation

Make a subsample from an initial dataset

Description

This function enables to make a subsample from an initial dataset by reducing the number of loci to consider.

Usage

subsample(data, nloci, lst = NULL)

Arguments

data An object of class geneclustdata
nloci Number of loci to consider to make the new dataset
lst The indices of loci chosen to make the new dataset. If lst=NULL, these indices are chosen randomly

Value

new.dat The new dataset which is again an object of class geneclustdata. Genetics information are reduced to "nloci" number of loci.

Author(s)

Olivier Francois

Examples


#library(Geneclust)

## Not run: 

# Simulation of a dataset according to the prior distributions. This one
# is made of 2 populations
# 10 loci and 10 alleles per loci
# on a spatial domain enclosed in a rectangle
# (x.coord. in [0,1], y.coord. in [0,1])
# Spatial interaction parameter is 0.5
# We suppose the inbreeding coefficients are the same in each population
# and equal to 0.1

#define a place for simulation outputs
system("mkdir ./tmpData/")
path <- "./tmpData/"

data<-simpatch(path=path,nindiv=100,npop=2,nall=rep(10,10),psi=0.5,fis=c(0.1,0.1),nchain=20000,burnin=10000,stepw=10,plot=FALSE)

datagc<- as.geneclustdata(data$coordinates[,1],data$coordinates[,2],data$genotypes)

#Subsample with 5 randomly chosen loci 
geneclustobjsub<- subsample(data=datagc,nloci=5,lst=NULL)
## End(Not run)


[Package Geneclust version 1.0.0 Index]