<p>Ultimately, I achieved this using the R package <a href="https://github.com/EricArcher/strataG" rel="nofollow noreferrer">strataG</a>. The steps taken (in R) are shown below.</p>
<pre><code>arp.object &lt;- arlequinRead(arp.path)
gtype.object &lt;- arp2gtypes(arp.object)
genind.object &lt;- gtypes2genind(gtype.object)
</code></pre>
<p>I found that fastSimcoal2 shows an odd behavior when simulating DNA markers, in which sequences are concatenated together (regardless of marker blocks specified; relevant post <a href="https://groups.google.com/g/fastsimcoal/c/cVT2jU7sqxA" rel="nofollow noreferrer">here</a>). Running the fastSimcoal2 simulations from strataG addressed this bug (and is more straightforward/reproducible, anyways).</p>

CC BY-SA 4.0
2022-06-15T18:33:26.740Z
2022-06-15T18:33:26.740Z
akoontz11
<p>I have <a href="http://cmpg.unibe.ch/software/arlequin35/" rel="nofollow noreferrer">Arlequin</a> output files (*.arp) from <a href="http://cmpg.unibe.ch/software/fastsimcoal27/" rel="nofollow noreferrer">fastSimcoal2</a> that I'm trying to convert to genepop files (to read into <a href="https://cran.r-project.org/web/packages/adegenet/index.html" rel="nofollow noreferrer">adegenet</a>). The Arlequin files are using the &quot;DNA&quot; marker (50 bp long), and each includes ~2,500 samples.</p>
<p>When trying to use the program <a href="http://www.cmpg.unibe.ch/software/PGDSpider/#Download_and_Installation_Instructions" rel="nofollow noreferrer">PGDspider</a> to convert these (either the GUI or the CLI; v2.1.1.5), things proceed smoothly until the 1,000th allele is reached, where the program generates an error:</p>
<pre><code>INFO  07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:596)  -Allele &quot;TGGCATCAGCTTCTTCTAAGCAGGCCCGCTTTGTCTAGCGACAGATCTCG&quot; converted to &quot;999&quot;
INFO  07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:596)  -Allele &quot;ATCTTGTGGTCATGGAGCACCCAGAGCCAAACTCCTAAAGAAGACCCCGC&quot; converted to &quot;1000&quot;
ERROR 07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:611)  -data &quot;1000&quot; in ind &quot;2_375&quot; (population: Sample 2) is too long!!!
INFO  07-03 11:18:10,631 (GenepopWriter.java:parseAlignedSampleData:618)  -In GENEPOP, alleles cannot be coded with more than 3 digits.
</code></pre>
<p>Is there a way around this error? I've processed RADseq data with many 1,000s of alleles using adegenet before, so I know these types of files can be written into genpop--I just don't know how to specify this to PGDspider. There's a field in the .spid file that I might be able to use to fix this (see below), but I don't know what to populate that field with, and there aren't any suggestions from the (limited) documentation.</p>
<pre><code># Specify the locus/locus combination you want to write to the GENEPOP file:
GENEPOP_WRITER_LOCUS_COMBINATION_QUESTION=
</code></pre>
<p>Alternatively, if there are suggestions for running this conversion without using PGDspider, I'm all ears.</p>
<p>Thanks for your help!</p>

CC BY-SA 4.0
2022-03-09T19:06:49.770Z
Spooky bug, it looks like a simple bug in the code. However, the author my have been concerned with RAM capacity and hence the ceiling but a more explicit error code should be generated. You can split the data set into two (more?) lots of 1 to 999 and pipe these through PGDspider.  You could write  a new PGDspider or ask the author for a fix. However 1000 inputs isn't much data.
M__
CC BY-SA 4.0
2022-03-09T19:08:51.610Z
Given this is just above the threshold I would simply break the file into 3? parts.
M__
CC BY-SA 4.0
2022-03-09T20:03:40.490Z
I'm hesitant to break the files apart, only because the error is a result of PGDspider not separating alleles by sample. During the conversion PGDspider writes the alleles as 3 digit numbers, but it isn't restarting the numbering for new individuals in the Arelquin file. Hence, allele 625 in individual 1 is `625`, and allele 1 in individual 2 is `626`. I don't know how to fix that behavior, though...
akoontz11
CC BY-SA 4.0
2022-03-09T21:13:30.003Z
Right okay its a bug, you would have to go into the code. If it was counting in a higher base that could circumvent the issue. You could write an external database which collected (appended) the output before the clock resets and that's probably the easiest way to do it.
M__
<linux><phylogenetics><format-conversion>
Convert Arlequin ("DNA" markers) to Genepop (PGDspider or otherwise)
# Convert Arlequin ("DNA" markers) to Genepop (PGDspider or otherwise)

(Asked by: username_0 on 2022-03-09)

I have Arlequin output files (*.arp) from fastSimcoal2 that I'm trying to convert to genepop files (to read into adegenet). The Arlequin files are using the "DNA" marker (50 bp long), and each includes ~2,500 samples.
When trying to use the program PGDspider to convert these (either the GUI or the CLI; v2.1.1.5), things proceed smoothly until the 1,000th allele is reached, where the program generates an error:
INFO  07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:596)  -Allele "TGGCATCAGCTTCTTCTAAGCAGGCCCGCTTTGTCTAGCGACAGATCTCG" converted to "999"
INFO  07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:596)  -Allele "ATCTTGTGGTCATGGAGCACCCAGAGCCAAACTCCTAAAGAAGACCCCGC" converted to "1000"
ERROR 07-03 11:18:10,630 (GenepopWriter.java:parseAlignedSampleData:611)  -data "1000" in ind "2_375" (population: Sample 2) is too long!!!
INFO  07-03 11:18:10,631 (GenepopWriter.java:parseAlignedSampleData:618)  -In GENEPOP, alleles cannot be coded with more than 3 digits.

Is there a way around this error? I've processed RADseq data with many 1,000s of alleles using adegenet before, so I know these types of files can be written into genpop--I just don't know how to specify this to PGDspider. There's a field in the .spid file that I might be able to use to fix this (see below), but I don't know what to populate that field with, and there aren't any suggestions from the (limited) documentation.
# Specify the locus/locus combination you want to write to the GENEPOP file:
GENEPOP_WRITER_LOCUS_COMBINATION_QUESTION=

Alternatively, if there are suggestions for running this conversion without using PGDspider, I'm all ears.
Thanks for your help!

**Tags:** linux, phylogenetics, format-conversion
> **Comments:**
> **username_1**: Spooky bug, it looks like a simple bug in the code. However, the author my have been concerned with RAM capacity and hence the ceiling but a more explicit error code should be generated. You can split the data set into two (more?) lots of 1 to 999 and pipe these through PGDspider.  You could write  a new PGDspider or ask the author for a fix. However 1000 inputs isn't much data.  
> **username_1**: Given this is just above the threshold I would simply break the file into 3? parts.  
> **username_0**: I'm hesitant to break the files apart, only because the error is a result of PGDspider not separating alleles by sample. During the conversion PGDspider writes the alleles as 3 digit numbers, but it isn't restarting the numbering for new individuals in the Arelquin file. Hence, allele 625 in individual 1 is `625`, and allele 1 in individual 2 is `626`. I don't know how to fix that behavior, though...  
> **username_1**: Right okay its a bug, you would have to go into the code. If it was counting in a higher base that could circumvent the issue. You could write an external database which collected (appended) the output before the clock resets and that's probably the easiest way to do it.  

---

## 1 answers

### Answer by username_0 on 2022-06-15. Score: 2 | Accepted answer

Ultimately, I achieved this using the R package strataG. The steps taken (in R) are shown below.
arp.object <- arlequinRead(arp.path)
gtype.object <- arp2gtypes(arp.object)
genind.object <- gtypes2genind(gtype.object)

I found that fastSimcoal2 shows an odd behavior when simulating DNA markers, in which sequences are concatenated together (regardless of marker blocks specified; relevant post here). Running the fastSimcoal2 simulations from strataG addressed this bug (and is more straightforward/reproducible, anyways).


---

