repeatR - Basic Vignette

library(repeatR)
## load example sequence data
data("mousePRDM9", package="repeatR")
## define repeat pattern
myRepPattern<-"PY"
## define repeat length
myRepLength<-84
## select 20 random samples
mousePRDM9.random <- sample(mousePRDM9, 20)
## split original CDS file into repeats
mousePRDM9.random.split<-repeatR::splitRepByPattern(mousePRDM9.random,
    myRepPattern, myRepLength)
## get distance for all-vs-all comparison excluding highly variable sites
dist.mat.hamming.exclude.pos<-repeatR::ListPairwiseDistance(
    x=mousePRDM9.random.split$cds,
    dist.type="hamming",
    wmut=1,
    windel=3.5,
    wslippage=1.75,
    exclude.pos=c(37:39,46:48,55:57),
    post.include=FALSE,
    output.dist="distance")
## calculate bionj tree from resulting distances and write tree in newick format
mousePRDM9.random.bionj<-ape::bionj(as.dist(dist.mat.hamming.exclude.pos))
ape::write.tree(mousePRDM9.random.bionj)
plot(mousePRDM9.random.bionj)