gl.run.structure problem

56 views
Skip to first unread message

Vincent Lesieur

unread,
Dec 7, 2022, 6:02:26 AM12/7/22
to dartR

Hi everyone,

Sorry to bother you with probably a stupid question but I don’t know how to fix the problem. I am trying to use the gl.run.structure function. My dataset contains 170 inds, 1875 SNPs. When I use the following code (just for a test)

sr<-gl.run.structure(gl, k.range = 1:3, num.k.rep = 3, exec = 'c:/structure/structure.exe')

I obtain the error message:

WARNING! Probable error in the input file. 

Individual 170, locus 1876;  encountered the following data

"NA" when expecting an integer

----------------------------------

There were errors in the input file (listed above). According to

"mainparams" the input file should contain one row of markernames with 1875 entries,

 340 rows with 1878 entries .

There are 341 rows of data in the input file, with an average of 1877.99

entries per line.  The following shows the number of entries in each

line of the input file:

# Entries:   Line numbers

     1875:   1

     1878:   2--341

----------------------------------

Exiting the program due to error(s) listed above.

Error in FUN(X[[i]], ...) :

Error running STRUCTURE. Error code 1 returned.

 

I understand that there is a problem with the input file, but I don’t know how to fix it. Any ideas? Many thanks for your help!

Vincent

Jose Luis Mijangos

unread,
Dec 9, 2022, 3:20:38 PM12/9/22
to dartR
Hi Vincent:

The problem is a formatting issue.

For this function to work, make sure that individual and population names have no spaces. To substitute spaces by underscores you could use the R function "gsub" as below.

> popNames(gl) <- gsub(" ", "_", popNames(gl))
> indNames(gl) <- gsub(" ", "_", indNames(gl)) 

I added this note to the function documentation and it is available at the developing version of dartR which you can install as below:

>  library(dartR)
> gl.install.vanilla.dartR(flavour = "dev")

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