Problems with gl.propShared and gl.nhybrids - checking for clones and hybrids in dataset

66 views
Skip to first unread message

Chiara Duijser

unread,
Apr 11, 2023, 4:00:29 AM4/11/23
to dartR
Hi all,

I would like to investigate whether I have clones in my dataset. I have filtered my data first using filter secondaries, reproducibility, call rate loci and individuals, read depth, MAFs, monomorphic loci and imputed missing data using nearest neighbour function.

I saw that Simon asked the same question how to check for clonal genotypes in the dataset on April, 2022. I have tried using gl.propShared() as Luis suggested with the following code:

library(dartR)
# calculating the proportion of shared alleles
res <- gl.propShared(platypus.gl)
# converting a matrix into columns
clones_temp <- as.data.frame(as.table(as.matrix(res)))
# filtering individuals using a threshold of 0.99
clones_temp_2 <- clones_temp[clones_temp$Freq>0.99,]
# getting pairs of individuals that are not the same
clones <- clones_temp_2[which(clones_temp_2$Var1!=clones_temp_2$Var2),]

I have downloaded and installed the library(Rcpp). However, I get the error message “Error xcrun: error: invalid active developer path”. I looked this up online and think in order to fix this I have to install Command Line Tools in Terminal (I’m using macOS). Unfortunately, I don’t have enough disk space to download this. It might be a long shot, but are there any other functions or ways to check if I have clones in my dataset that do not require the gl.propShared with C++ implementation?

I have a similar issue with function gl.nhybrids were I want to check for hybrids in my dataset but can’t seem to get it to work on my macbook.

Any advice is very welcome 😊

Thank you,
Chiara

Jose Luis Mijangos

unread,
Apr 12, 2023, 12:31:47 AM4/12/23
to dartR
Hi Chiara,

You could use a genomic relationship matrix using a relatedness_factor = 0.5 as shown below.

> library(dartR)
> res <- gl.grm(platypus.gl)
> res2 <- gl.grm.network(res,x=platypus.gl,relatedness_factor = 0.5)

Cheers,
Luis 

Chiara Duijser

unread,
Apr 12, 2023, 2:23:37 AM4/12/23
to dartR
Hi Luis,

Thank you! I found this solution just before you sent it. This works well!
Do you know if there is any alternative method to investigate potential hybrids in the dataset apart from the function gl.nhybrids? It's not possible to do this with gl.grm.network() specifying a relatedness_factor right?

Best wishes,
Chiara


Op woensdag 12 april 2023 om 14:31:47 UTC+10 schreef luis.m...@gmail.com:
Reply all
Reply to author
Forward
0 new messages