pneuvial / adjclust

Adjacency-constrained hierarchical clustering of a similarity matrix
https://pneuvial.github.io/adjclust/
16 stars 8 forks source link

snpClust Problem while setting all > 1 to 1 #82

Open lisiarend opened 1 month ago

lisiarend commented 1 month ago

Hello,

I have a problem while trying to cluster my LD (large dgCMatrix) with snpClust.

My input is a non-public data set, so I cannot hand over the data. But I ran the following steps: h <- 5 ld <- snpStats::ld(geno, stats = c("R.squared"), depth = h)

Resulting in ld being a Large dgCMatrix with dimensions 59087 x 59087.

Then I tried to cluster the matrix with snpClust: fitH <- adjclust::snpClust(geno, h = h, stats = "R.squared")

And I am getting this error: Error in if (any(i < 0L)) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In run.snpClust(x, h = h, stats = stats) : Forcing the LD similarity to be smaller than or equal to 1 2: In int2i(as.integer(i), n) : NAs introduced by coercion to integer range

I already checked, the error occurs in line 12 of the function run.snpClust.

Can you help me? I don't know why this is line is making an error.

tuxette commented 1 month ago

Hi @lisiarend ! Do you have any missing values in your matrix ld? I would advise that you first perform the checks on this matrix by yourself:

I am currently on vacation so my answers will probably be slow.

pneuvial commented 2 weeks ago

Hi @lisiarend,

Have you been able to investigate the suggestions by @tuxette ?

Also, I understand that your data is not public, but maybe you could send us an anonymized version of a small subset of the data where you can reproduce the same problem?