Running Kinship Matrix or IBD Analysis without Geographic Coordinates in dartR

27 views
Skip to first unread message

Juliana Souza

unread,
Aug 11, 2025, 2:56:16 PMAug 11
to dartR

Dear dartR Team,

I am currently working with SNP data and would like to run either a pairwise kinship matrix or an Isolation by Distance (IBD) analysis using dartR. From my understanding, dartR implements IBD estimation through a Mantel test, which requires geographic coordinates.

In my dataset, geographic coordinates are not available. The goal of my analysis is to investigate relatedness patterns that might indicate potential half-sibling relationships among individuals. Is there a way to perform either the pairwise kinship matrix calculation or an IBD analysis in dartR without spatial data? If not, would you recommend an alternative approach or function within the package that could address this?

Thank you in advance for your attention.

Best,
Juliana

Jose Luis Mijangos

unread,
Aug 11, 2025, 6:41:15 PMAug 11
to dartR
HI Juliana,

Please try the code below.

Cheers,
Luis 

#Download EMIBD9 for your system from the link below and move it to your working directory
#https://github.com/green-striped-gecko/dartRverse/tree/main/binaries
library(dartRverse)
# Loading data
MyData <- platypus.gl
# Run EMIBD9 program
Myrun.EMIBD9 <- gl.run.EMIBD9(x = MyData, , Inbreed = FALSE)
# Distance heatmap representation
Myplot.heatmap <- gl.plot.heatmap(
  D = Myrun.EMIBD9$rel,
  dendrogram = "column",
  label.size = 1,
  legend.title = "Populations",
  diag.na = TRUE,
  na.color = "#B3B3B3"
)
# Similarity network plot
Mygrm.network <- gl.grm.network(
  x = MyData,
  G = Myrun.EMIBD9$rel,
  standardise = FALSE,
  categorise = TRUE,
  method = "fr",
  node.size = 8,
  node.label.size = 2,
  node.label.color = "#000000",
  link.size = 2,
  kinship.threshold = 0.13,
  title = "Network of a similarity matrix",
  legend.title = "Populations",
  title.size = 16,
  legend.size = 14
)

Juliana Lopes

unread,
Aug 12, 2025, 11:23:32 AMAug 12
to da...@googlegroups.com
Dear Luis,
Thank you for such a fast response. I used the code, however could not create the Myrun.EMIBD9 object. I have a graphic output (not the complete image). I understand not generating the figure completely, since it is such a big dataset (509 individuals, ~1,200 SNPs), but I don't understand why the object failed. My main goal is to obtain the IBD matrix, so the graphic representation is not even that important.

Do you have any suggestions?
Best,
Juliana

Here's the results:

Finished!
Returning a list containing the input gl object, a square matrix  of pairwise kinship, and the raw EMIBD9 results table as follows:
           $rel -- a square matrix of relatedness 
           $raw -- raw EMIBD9 results table 
Starting gl.plot.heatmap 
  Processing a data matrix
Starting gl.colors 
Selected color type div 
Completed: gl.colors 
Error in plot.new() : figure margins too large
> # Distance heatmap representation
> Myplot.heatmap <- gl.plot.heatmap(
+   D = Myrun.EMIBD9$rel,
+   dendrogram = "column",
+   label.size = 1,
+   legend.title = "Populations",
+   diag.na = TRUE,
+   na.color = "#B3B3B3"
+ )
Starting gl.plot.heatmap 
Error: object 'Myrun.EMIBD9' not found


--
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/453f2bf1-2fbb-473a-ae05-c546d950c7dcn%40googlegroups.com.
Myrun.EMIBD9 test.png

Jose Luis Mijangos

unread,
Aug 12, 2025, 6:52:27 PMAug 12
to dartR
Hi Juliana,

That error occurs because the plot you’re generating is too large to be displayed in RStudio’s plot panel. You can try either of the following solutions:

1. Make the plot panel as large as possible in RStudio, then re-run the function.

2. Set the parameter plot.out = FALSE in the function gl.run.EMIBD9. For example:

Myrun.EMIBD9 <- gl.run.EMIBD9(
  x = MyData,
  Inbreed = FALSE,
  plot.out = FALSE
)

Cheers,
Luis
Reply all
Reply to author
Forward
0 new messages