Regarding dartRverse Function gl.join

39 views
Skip to first unread message

Alan Couch

unread,
Apr 28, 2025, 11:11:53 PMApr 28
to dartR
The function gl.join combines two dartR genlight objects where method='sidebyside' will  combine the two by bringing the loci together against the same set of individuals; and if method='end2end' it will  combine the two by bringing two sets of individuals together against the same set of loci. Just a question about naming given "side by side" implies a dimension (left/right) whereas end to end does not. Would top2bottom be a clearer name for the method? Or am I missing something?

Jose Luis Mijangos

unread,
Apr 29, 2025, 4:19:46 AMApr 29
to dartR
Hi,

Thanks for the suggestion. 

Yes, you are right; the parameter values were not clear enough. 

We gave it a bit more thought and changed the values to "join.by.loc" and "join.by.ind". 

To use the updated version of the function, please install the developing version of dartR.base as shown below.

Cheers,
Luis 

# Install developing version of dartR.base
devtools::install_github("green-striped-gecko/dartR.base@dev")
library(dartRverse)
# Joining by loci in common, both datasets have the same loci in the same order
x1 <- testset.gl[1:10, ]
nInd(x1)
x2 <- testset.gl[11:20, ]
nInd(x2)
gl <- gl.join(x1, x2, method = "join.by.loc", verbose = 2)
nInd(gl)
# Joining by individuals in common, both datasets have the same individuals
# in the same order
x1 <- testset.gl[, 1:100]
nLoc(x1)
x2 <- testset.gl[, 101:200]
nLoc(x2)
gl <- gl.join(x1, x2, method = "join.by.ind", verbose = 2)
nLoc(gl)

Alan Couch

unread,
Apr 30, 2025, 6:09:36 PMApr 30
to dartR
That's great! Thank you Luis. Parameter values much more intuitive now. 

I can't get it to work properly on my dartR objects yet though.  I suspect my sample csvs need tidying as they not identical columns (does that matter?) so I am trying to get to the bottom of that before I will be sure I have a problem here that is not of my own making. Although the gl's do seem compliant  enough? Versions below and the  rbind deparse error and compliance on one of the gl  files in case I have missed something obvious.  Cheers Alan

> dartRverse_install()
dartRverse packages:
✔ dartR.base      1.0.5 | CRAN: 1.0.5 | Github: 1.0.5 (main) | 1.0.5 (beta) | 1.0.5 (dev)
✔ dartR.data      1.0.8 | CRAN: 1.0.8 | Github: 1.0.8 (main) | 1.0.8 (beta) | 1.0.8 (dev)
✔ dartR.sim       0.70 | CRAN: 0.70 | Github: 0.94 (main) | 0.94 (beta) | 0.94 (dev)    
✔ dartR.popgen    1.0.0 | CRAN: 1.0.0 | Github: 1.0.5 (main) | 1.0.5 (beta) | 1.0.5 (dev)
✔ dartR.spatial   0.78 | CRAN: 0.78 | Github: 0.92 (main) | 0.92 (beta) | 0.92 (dev)    
✔ dartR.captive   1.0.2 | CRAN: 1.0.2 | Github: 1.0.2 (main) | 1.0.2 (beta) | 1.0.2 (dev)
✔ dartR.sexlinked 1.0.5 | CRAN: 1.0.5 | Github: 1.0.5 (main) | 1.0.5 (beta) | 1.0.5 (dev)

> gltmp<- gl.join(gl1, gl2, method = "join.by.loc", verbose = 2)
Starting gl.join
  Concatenating two genlight objects, gl1 and gl2 join.by.loc
  Concatenating the individual metrics
Error in rbind(deparse.level, ...) :
  numbers of columns of arguments do not match

Compliance:
Starting gl.compliance.check Processing genlight object with SNP data Warning: data include loci that are scored NA across all individuals. Consider filtering using gl <- gl.filter.allna(gl) Checking coding of SNPs SNP data scored NA, 0, 1 or 2 confirmed Checking for population assignments Population assignments confirmed Checking locus metrics and flags Recalculating locus metrics Checking for monomorphic loci Dataset contains monomorphic loci Checking for loci with all missing data Dataset contains loci with all missing dat Checking whether individual names are unique. Checking for individual metrics Individual metrics confirmed Spelling of coordinates checked and changed if necessary to lat/lon

Bernd.Gruber

unread,
Apr 30, 2025, 9:13:37 PMApr 30
to da...@googlegroups.com

Hi Alan

 

Can you check

nLoc(gl1)

nLoc(gl2)

 

and also

 

table(locNames(gl1)==locNames(gl2))

 

cheers, Bernd

On Tuesday, 29 April 2025 at 1:11:53pm UTC+10 http://al...@couch.net.au wrote:

The function gl.join combines two dartR genlight objects where method='sidebyside' will  combine the two by bringing the loci together against the same set of individuals; and if method='end2end' it will  combine the two by bringing two sets of individuals together against the same set of loci. Just a question about naming given "side by side" implies a dimension (left/right) whereas end to end does not. Would top2bottom be a clearer name for the method? Or am I missing something?

--
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/df6ba039-269f-4df2-9d5a-443c71562e8en%40googlegroups.com.

Alan Couch

unread,
May 1, 2025, 4:20:40 AMMay 1
to dartR
Yes, thanks.  But:
> nLoc(gl1) [1] 599 > nLoc(gl2) [1] 599 > table(locNames(gl1)==locNames(gl2)) TRUE 599

Bernd.Gruber

unread,
May 1, 2025, 4:31:01 AMMay 1
to da...@googlegroups.com
Can you save the two gl objects via

saveRDS(gl1, file=“gl1.rds”)

saveRDS(gl2, file=“gl2.rds”)

And send the rds files to me. 

Cheers Bernd 
---------


On 1 May 2025, at 18:20, Alan Couch <al...@couch.net.au> wrote:

Yes, thanks.  But:

To unsubscribe from this group and stop receiving emails from it, send an email to https://url.au.m.mimecastprotect.com/s/E1drCQnzYJFAOM2AuksxfGP0CT?domain=googlegroups.com.

--
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.

Rizki Awaludin

unread,
May 19, 2025, 8:53:37 AMMay 19
to dartR
Hi, 

Is this issue resolved? 
I also get the same error when combining multiple genlight objects. Will DArT have an option to combine multiple genlight objects in one function?

> data_1_2 <- gl.join(data1, data2, method = "end2end") Starting gl.join Concatenating two genlight objects, data1 and data2 end2end Concatenating the individual metrics Adding the locus metrics Setting the locus metrics flags Adding the history Completed: gl.join > data_1_2_4 <- gl.join(data_1_2, data4, method = "end2end") Starting gl.join Concatenating two genlight objects, data_1_2 and data4 end2end Concatenating the individual metrics Adding the locus metrics Setting the locus metrics flags Adding the history Completed: gl.join > data_5a_5b <- gl.join(data5a, data5b, method = "end2end") Starting gl.join Concatenating two genlight objects, data5a and data5b end2end Concatenating the individual metrics Adding the locus metrics Setting the locus metrics flags Adding the history Completed: gl.join > data_1_2_4_5a_5b <- gl.join(data_1_2_4, data_5a_5b, method = "end2end") Starting gl.join Concatenating two genlight objects, data_1_2_4 and data_5a_5b end2end Concatenating the individual metrics Adding the locus metrics Setting the locus metrics flags Adding the history Completed: gl.join > data_1_2_4_5a_5b_6 <- gl.join(data_1_2_4_5a_5b, data6, method = "end2end") Starting gl.join Concatenating two genlight objects, data_1_2_4_5a_5b and data6 end2end Concatenating the individual metrics Error in rbind(deparse.level, ...) : numbers of columns of arguments do not match

Jose Luis Mijangos

unread,
May 19, 2025, 8:34:08 PMMay 19
to dartR
Hi Rizki,

Yes, the issue has been solved in the developing version of dartR.base, see code below. Note the changes in the parameter names.

Cheers,
Luis

# Install developing version of dartR.base
devtools::install_github("green-striped-gecko/dartR.base@dev")
library(dartRverse)
# Joining by loci in common, both datasets have the same loci in the same order
x1 <- testset.gl[1:10, ]
nInd(x1)
x2 <- testset.gl[11:20, ]
nInd(x2)
gl <- gl.join(x1, x2, method = "join.by.loc", verbose = 2)
nInd(gl)
# Joining by individuals in common, both datasets have the same individuals
# in the same order
x1 <- testset.gl[, 1:100]
nLoc(x1)
x2 <- testset.gl[, 101:200]
nLoc(x2)
gl <- gl.join(x1, x2, method = "join.by.ind", verbose = 2)
nLoc(gl)

Bernd.Gruber

unread,
May 19, 2025, 9:13:22 PMMay 19
to da...@googlegroups.com

Hi Luis,

 

Can we try to get a version that adds more than two.

 

E.g. if a list of gls is provided as the first argument and the second is null, then all of those gls in the list are joined via a loop.

 

It should be straight forward to implement.

 

Cheers, Bernd

 

From: da...@googlegroups.com <da...@googlegroups.com> On Behalf Of Jose Luis Mijangos


Sent: Tuesday, 20 May 2025 10:34 AM
To: dartR <da...@googlegroups.com>

To unsubscribe from this group and stop receiving emails from it, send an email to https://url.au.m.mimecastprotect.com/s/2xIOCzvO1PTg5mVYIwuZf9De7F?domain=googlegroups.com.

--
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 https://url.au.m.mimecastprotect.com/s/_VZGCD1jGNuv4OGLF8HmfjJAWd?domain=googlegroups.com.

--
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.

Reply all
Reply to author
Forward
0 new messages