balselr
balselr.Rmd
library(balselr)
#> Error in get(paste0(generic, ".", class), envir = get_method_env()) :
#> object 'type_sum.accel' not foundRead in some data
Read in a vcf ([Variant Call Format][https://en.wikipedia.org/wiki/Variant_Call_Format]) file:
read_vcf(x=system.file("balselr","example.vcf"))Prepare ncd1 input file
This is an example which shows how to parse a vcf file and output an
input file for ncd1:
prep_my_ncd1_file<-parse_vcf(
infile = system.file(package = "balselr", "example.vcf"),
n0 = 108,
type = "ncd1"
)This is an example which shows how to parse an R object made from a
vcf file and output an input file for ncd1:
Run ncd1 with a 3000 basepair window and a minimum of 8
informative sites per window using 2 cores and a target frequency of
0.5:
res1<-ncd1(x=prep_my_ncd1_file, tf=0.5, w=3000, ncores=2, minIS=8)
res1Make the minIS filter less restrictive and the window smaller:
res2<-ncd1(x=prep_my_ncd1_file, tf=0.5, w=2000, ncores=2, minIS=2)
res2Prepare ncd2 input file
This is an example which shows how to parse a vcf file and output an
input file for ncd1; use 4 individuals for the
outgroup:
prep_my_ncd1_file<-parse_vcf(
infile = system.file(package = "balselr", "example.vcf"),
n0 = 108,
n1 = 4,
type = "ncd2"
)This is an example which shows how to parse an R object made from a
vcf file and output an input file for ncd1; use only one
individual for the outgroup:
Run ncd2 with a 3000 basepair window and a minimum of 8
informative sites per window using 2 cores and a target frequency of
0.5:
res1<-ncd2(x=prep_my_ncd2_file, tf=0.5, w=3000, ncores=2, minIS=8)
res1Make the minIS filter less restrictive and the window smaller:
res2<-ncd2(x=prep_my_ncd2_file, tf=0.5, w=2000, ncores=2, minIS=2)
res2