For each K replicate popcluster outputs 6 files. The one you want ends
in .Q, eg, Burdekin_K_3_R_1.Q
Just add .csv to the end of the file name and it will open in excel.
The snmf code is a bit more convoluted. I've pasted what I have below.
I would just use popcluster though as it seems quite good, snmf though
will give you a basic view of the data very very quickly though, but
probably not quite as accurate I'd guess. From memory LEA is an R
package which you may need to install if it complains about not finding it.
Cheers
Peter
gl2geno(gl,outpath=getwd(), outfile = "macc-tc.structure2")
#run LEA
ss <- snmf(input.file = file.path(getwd(), "macc-tc.structure2.geno"),
K = 1:3,
entropy = TRUE,
repetitions = 5,
project = "new",
alpha = 10)
ss
#plot the results
plot(ss, cex = 1.2, col = "darkblue", pch = 19)
# get the cross-entropy of the 5 runs for K =2
ce <- cross.entropy(ss, K =3)
#find best run of the 5 (k=3)
best_run <- which.min(ce)
#plot the qmat
q_mat <- LEA::Q(ss, K= 3, run = best_run)
rownames(q_mat)<- indNames(gl)
head(q_mat)
write.csv(q_mat, file="macc-tc.structurek2.csv", row.names=TRUE)
write.csv(q_mat, file ="bream.structure2.csv")
colnames(q_mat) <- levels(pop(gl))
On 7/10/2025 12:48 pm, Vanessa Morris wrote:
> Thank you both.
>
> Peter, how do you get a Q file? I only get a K file which specifies the
> best run for each k value but I would like to make my own barplot
> showing the assignment of each individual from a csv file.
>
> Bernd, do I need to uninstall dartRverse to run gl.run.snmf? My code
> can't find the function.
>
> Thanks,
> Vanessa
>
> On Tuesday, October 7, 2025 at 9:59:57 AM UTC+11 Bernd. Gruber wrote:
>
> This or snmf (which is also now available in dartR).
>
> gl.run.snmf
>
> cheers, Bernd
>
> -----Original Message-----
> From:
peter...@unmack.net <
peter...@unmack.net> On Behalf Of 'Peter
> Unmack' via dartR
> Sent: Tuesday, 7 October 2025 9:58 AM
> To:
da...@googlegroups.com
> Subject: Re: [dartR] Structure speed and plotting error
>
> The best way to speed up structure is to stop using it and switch
> over to using popcluster. It runs super fast. We've been using it
> for a little while and have been very happy with it's performance
> and output.
>
>
https://onlinelibrary.wiley.com/doi/10.1111/1755-0998.14058
> <
https://onlinelibrary.wiley.com/doi/10.1111/1755-0998.14058>
>
>
https://www.zsl.org/about-zsl/resources/software/popcluster
> <
https://groups.google.com/d/msgid/>
> > dartr/8caadb5e-2d90-4e66-9c5b-b7f6fd5eadd1n%
40googlegroups.com
> <
http://40googlegroups.com>
> > <https://
> >
groups.google.com/d/msgid/dartr/8caadb5e-2d90-4e66-9c5b- <http://
>
groups.google.com/d/msgid/dartr/8caadb5e-2d90-4e66-9c5b->
> > b7f6fd5eadd1n%
40googlegroups.com?
> utm_medium=email&utm_source=footer <
http://40googlegroups.com?
> utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "dartR" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
dartr+un...@googlegroups.com.
> To view this discussion visit
https://groups.google.com/d/msgid/
> dartr/8a52fb0c-5d28-4d55-b6a1-d4fbd859dab5%
40unmack.net <https://
>
groups.google.com/d/msgid/dartr/8a52fb0c-5d28-4d55-b6a1-
> d4fbd859dab5%
40unmack.net>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "dartR" group.
> To unsubscribe from this group and stop receiving emails from it, send
> bf3ae386-43e1-4d0f-b7f7-fbced07613e8n%
40googlegroups.com <https://
>
groups.google.com/d/msgid/dartr/bf3ae386-43e1-4d0f-b7f7-
> fbced07613e8n%
40googlegroups.com?utm_medium=email&utm_source=footer>.