make.example.files(writing.dir=tempdir())
pooldata=popsync2pooldata(sync.file=paste0(tempdir(),"/ex.sync.gz"),poolsizes=rep(50,15))
#random allele pooling of sample P2 to P10
P2toP10pseudopool=poolify(pooldata,sample.index=2:10,out.samplename="P2toP10")
#merge other sample
newpooldata=data.merge(pooldata.subset(pooldata,pool.index=c(1,11:15)),P2toP10pseudopool)
newpooldata
#Working with allele count data
#create a countdata object (NOTE: This example is just for the sake of illustration)
pooldata2genobaypass(pooldata,writing.dir=tempdir())
countdata=genobaypass2countdata(genobaypass.file=paste0(tempdir(),"/genobaypass"))
countdata@snp.info=pooldata@snp.info
#merge counts (no random allele sampling) from sample P2 to P10
P2toP10mergecounts=poolify(countdata,sample.index=2:10,out.samplename="P2toP10")
#merge other sample from the original countdata
newcountdata=data.merge(countdata.subset(countdata,pop.index=c(1,11:15)),P2toP10mergecounts)
newcountdata
#simulate a pool-seq sample from the pooled counts of P2 to P10 sample
#and merge it with the original Pool-Seq
poolP2toP10=sim.readcounts(P2toP10mergecounts,min.rc=0,seq.eps=0)
#Merge with other PoolSeq sample (First ensure that the same SNPs with the same alleles are merged)
snp.sel.idx=which(paste0(pooldata@snp.info$Chromosome,pooldata@snp.info$Position)%in%
paste0(poolP2toP10@snp.info$Chromosome,poolP2toP10@snp.info$Position))
newpooldata=data.merge(pooldata.subset(pooldata,pool.index=c(1,11:15),snp.index=snp.sel.idx),
poolP2toP10)
newpooldata
Run the code above in your browser using DataLab