EricArcher / strataG

strataG is a toolkit for haploid sequence and multilocus genetic data summaries, and analyses of population structure.
25 stars 12 forks source link

.fscWriteEst problem with complex params missing #51

Closed konopinski closed 3 years ago

konopinski commented 3 years ago

Dear Eric, I do not want to spoil you but you might have already noticed I adore your package, although I focus mostly on running fastsimcoal with help of strataG. I think I found a minor problem with .fscWriteEst function. When there are no complex parameters to estimate the the function fscWrite returns an error: Error in `$<-.data.frame`(`*tmp*`, "name", value = " = ") : replacement has 1 row, data has 0 The thing is that in .fscWriteEst in line: cmplx.df$name <- paste0(cmplx.df$name, " = ", cmplx.df$value) there are empty characters for both cmplx.df$name and cmplx.df$value, so paste returns only =. The solution that worked for me was to put a condition if(nrow(cmplx.df) != 0) on the two subsequent lines. I would make a push request with that fix but I rarely use git and forgot how to do that... My simulations do not converge anyway (perhaps due to at least a few complex params) so I do not even know if the fix does make any sense. Cheers Maciek

EricArcher commented 3 years ago

Thanks for the catch on this bug. I've changed the code to test for an empty cmplx.df at this location and pushed a new version. Let me know if this works.

Cheers, Eric

konopinski commented 3 years ago

Thanks! Problem solved.