Skip to content

different qmatrix each time I run? #4

@Dahn-YoungDong

Description

@Dahn-YoungDong

set.seed(13)
for (i in lambda_values){
tess3.ls = tess3(genotypes, coord = coordinates, K = K, mask = mask, lambda = i,

Hello Jeronymo, Thanks for your help along the way.

Whenever I rerun the tess3 function, I receive a different qmatrix, and result in different ancestry proportions for my barplot. Why is it so? Should I do the "set.seed()?"

I adapted your code and took out the loop and lambda parameter.

`K = c(1:5) # set the number of K to be tested
ploidy = 2 # species ploidy
CPU = 4 #Number of cores for run in parallel

tess3.ls <- tess3(X = genotypes, coord = coordinates, K = K,
method = "projected.ls", ploidy = ploidy, openMP.core.num = CPU)

q.matrix <- qmatrix(tess3.ls, K = 5)

my.colors <- c(1:5)
my.palette <- CreatePalette(my.colors, 6)
barplot(q.matrix, border = T, space = 0,
main = "Ancestry matrix",
xlab = "Individuals", ylab = "Ancestry proportions",
col.palette = my.palette) -> bp
axis(1, at = 0.5:nrow(q.matrix), labels = snps@meta[,3][bp$order], las = 3, cex.axis = 1)
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions