Converting to genepop

28 views
Skip to first unread message

Vanessa Morris

unread,
Mar 9, 2025, 10:14:02 PMMar 9
to dartR
Hi dartR team,

Can I please get your help converting a dartR file to genepop file?

I converted my data file to genlight:

gen <- new("genlight", glhw.filt)
gpop <- gl2genepop(gen, outfile ="glhw.filt.gen")

but then I receive the following error when using gl2genepop:

 stop("Fatal Error: Detected Presence/Absence (SilicoDArT) data. Please provide a SNP dataset\n")

Any advice?


Many thanks,

Vanessa


Jose Luis Mijangos

unread,
Mar 10, 2025, 12:11:54 AMMar 10
to dartR

Hi Vanessa,

Based on the information you provided, it appears that you're using the gl2genepop function code that was posted in this forum four years ago. This function is now implemented in dartR. To resolve the issue, please follow these steps:

  1. Ensure you have the latest version of dartR.base installed on your computer. You can install it using the following code:

    install.packages("dartR.base")

    If you encounter any issues during installation, please refer to our tutorial "Tutorial_2_dartR_Installation_2-Aug-24.pdf," available for download at: http://georges.biomatix.org/dartR.

  2. Remove the function you sourced ("gl2genepop.R") by either:

    • Clearing your workspace, or
    • Removing the function directly from your environment.
      If you need guidance, refer to "Tutorial 1: RStudio Refresher."
  3. Read your data using one of dartR's reading functions:

    • gl.read.csv
    • gl.read.dart
    • gl.read.fasta
    • gl.read.PLINK
    • gl.read.silicodart
    • gl.read.vcf

    For more details, see:

    • Tutorial 3A: Data Input and Data Structures (DArT)
    • Tutorial 3B: Data Input and Data Structures (non-DArT)
  4. Convert your genlight object using the following approach:

library(dartRverse)

 t1 <- gl.read.dart("your_DArT_report") 

gl2genepop(t1, outpath = getwd())

Let me know if this resolves the issue or if you need further assistance.

Best,
Luis

Vanessa Morris

unread,
Mar 10, 2025, 3:11:44 AMMar 10
to dartR
Got the genepop file! Thank you very much.

All the best,
Vanessa

Reply all
Reply to author
Forward
0 new messages