gl.report.ld.map: Error in xx[i, ii] <- hets[ii]

65 views
Skip to first unread message

Frederik Van Daele

unread,
Dec 14, 2022, 2:12:12 PM12/14/22
to dartR
Hey everyone, 

when I use gl.report.ld.map on a genlight object I get Error in xx[i, ii] <- hets[ii] :   number of items to replace is not a multiple of replacement length. Other functions of dartR work fine. Anyone has a solution? 

Thank you for any insights! 

Jose Luis Mijangos

unread,
Dec 14, 2022, 4:22:12 PM12/14/22
to dartR
Hi Frederik,

How did you read your data into dartR?

It might be that you don’t have information in the slot “loc.all".

What is printed when you type:

> gl$loc.all

If you don’t have information in this slot, you can create a dummy variable, as below:

> gl$loc.all <- rep("G/C",nLoc(gl))

Then try again running the function.

Cheers,
Luis

Frederik Van Daele

unread,
Dec 15, 2022, 5:52:07 AM12/15/22
to dartR
Dear Luis,

This does indeed solve the error! The obejct was created with vcfR2genlight from  adegenet. Is it possible to retain the loc.all information during conversion or extract this information post hoc from the vcf? I also get the following warnings: 49: In snpStats:ld(genotype_loci, depth = ld_depth_b, stats = ld_stat) :  depth too large; it has been reset to 1. This is something that others have experience with large datasets as well: https://support.bioconductor.org/p/83618/. Do you know how I can solve this as well? 

Many thanks! 
With kind regards,
Frederik Van Daele

Jose Luis Mijangos

unread,
Dec 15, 2022, 11:47:10 AM12/15/22
to dartR
Hi Frederik,

You could use the function gl.read.vcf() to read your vcf file. This function will add the loc.all information to the genlight object as well as the quality and filter information from a VCF file.

The "depth too large" warning means that within that chromosome there are no SNPs close enough to calculate LD.

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