View source: R/poolfstat_DT2pooldata.R
poolfstat_DT2pooldata | R Documentation |
Used to takes a data table of pool-seq read counts and creates an object of class
"pooldata", as per the poolfstat
package (Hivert et al. 2018).
poolfstat_DT2pooldata(dat, flip = FALSE, poolInfo)
dat |
Data table: A long-format data table of read counts for pool-seq samples of biallelic SNP loci to be converted into a pooldata object. Must contain all the following columns:
Alternatively, a pooldata object to be converted into a data table.
See param |
flip |
Logical: Should the function be reversed? Default is |
poolInfo |
Data table: Contains the sample sample sizes (number of diploids) for
for each unique pool listed in
You only need to specify |
When flip==FALSE
, returns a pooldata object as per
the poolfstat
package. Alternatively, when flip==TRUE
, returns
a data table.
Hivert et al. (2018) Genetics. DOI: 10.1534/genetics.118.300900
library(genomalicious)
# Load in the pool metadata and reads
data(data_PoolInfo)
data(data_PoolFreqs)
# Pool info
data_PoolInfo
# Pool reads in $DP, $AO, and $RO
data_PoolFreqs[, c('POOL','DP','AO','RO')]
# Make pooldata object
pooldataObj <-poolfstat_DT2pooldata(
data_PoolFreqs,
flip=FALSE,
poolInfo=data_PoolInfo
)
class(pooldataObj)
pooldataObj
# And go back to data table
pooldataTab <- poolfstat_DT2pooldata(pooldataObj, flip=TRUE)
head(pooldataTab)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.