Error in gl.pcoa after keeping only a subset of populations

8 views
Skip to first unread message

Juan Enciso

unread,
Feb 12, 2026, 10:18:15 PM (8 days ago) Feb 12
to dartR
Hello,

I am trying to run gl.pcoa on a subset of populations of my original dataset. For subsetting populations I use gl.keep.pop(gl.object, my.pop.list, recalc = TRUE, mono.rm = TRUE). Then I pass the resulting genlight object to gl.pcoa and I get the following error.

Error in `$<-.data.frame`(`*tmp*`, "structure", value = "structured") :
  replacement has 1 row, data has 0

When I run gl.pcoa with the full dataset or I change some of the populations that I want to subset, I get no errors.

My data comes from ddRAD seq.

Please let me know if this is a known issue with gl.pcoa and if you have suggestions for how to fix it.

Best regards,

Juan Enciso


Bernd.Gruber

unread,
Feb 12, 2026, 11:23:37 PM (8 days ago) Feb 12
to da...@googlegroups.com
Hi
Juan

Can you run a gl.compliance Check before Running the pcoa and after running gl.keep.pop

Cheers Bernd
---------


On 13 Feb 2026, at 14:18, Juan Enciso <juande...@gmail.com> wrote:

Hello,
--
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/26a07e14-2425-4699-bdab-655c214d3c23n%40googlegroups.com.

Juan Enciso

unread,
Feb 13, 2026, 9:32:37 AM (7 days ago) Feb 13
to dartR
Hi Bernd,

I did run gl.compliance.check on the data but the error still appears.

Arthur Georges

unread,
Feb 15, 2026, 2:38:36 AM (5 days ago) Feb 15
to dartR

Hi Juan,

This is a known boundary case. Tracy–Widom method of distinguishing structured axes (those with information) from noise axes can return zero “structured” axes on some subsets.

The function gl.pcoa() currently assumes at least one structured axis and fails when the dataframe containing the structured data is empty. All noise axes.

Can you try using pc.select="broken-stick".

 I am working on this issue.

 All the best,

 Arthur

Reply all
Reply to author
Forward
0 new messages