Writing genepop from genind
0
0
Entering edit mode
4 months ago
eaabbott0 • 0

I had to remove some loci from a genepop file and now have a genind object. However, a lot of my downstream analyses require a file path to a .gen file and won't accept an object loaded from my environment. I tried to use the genind_to_genepop() function from the package graph4lg:

genind_to_genepop(genind_obj, output = "path/to/file/converted_file.txt")

But when I try to read it in, I get the error:

Error in read.genepop("oly.no23.gen", ncode = 2L, quiet = FALSE) :
some alleles are not encoded with 2 characters Check 'ncode' argument

In my genind file, all alleles are coded with 2 characters and missing data is coded with NA. I tried substituting the NAs with 00, but am still getting the same error.

Any help would be much appreciated

Here's what the genind looks like:

/// GENIND OBJECT /////////

 // 561 individuals; 2,342 loci; 4,684 alleles; size: 11.3 Mb

 // Basic content
   @tab:  561 x 4684 matrix of allele counts
   @loc.n.all: number of alleles per locus (range: 2-2)
   @loc.fac: locus factor for the 4684 columns of @tab
   @all.names: list of allele names for each locus
   @ploidy: ploidy of each individual  (range: 2-2)
   @type:  codom
   @call: .local(x = x, i = i, j = j, loc = ..1, drop = drop)

 // Optional content
   @pop: population of each individual (group size range: 89-95)
R genepop genind graph4lg stacks • 460 views
ADD COMMENT

Login before adding your answer.

Traffic: 4867 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6