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

Lacking 'locus.info' in p variable (fastsimcoal) #50

Closed konopinski closed 3 years ago

konopinski commented 3 years ago

Dear Eric, Firstly, I love your package! I have just installed it on Linux and try to run some simple simulations. My code is as follows:

genetics <- fscSettingsGenetics(
  fscBlock_dna(20, 1e-4, chromosome = 1),
  fscBlock_dna(20, 1e-5, chromosome = 2),
  fscBlock_dna(20, 1e-7, chromosome = 3),
  fscBlock_dna(20, 1e-10, chromosome = 4)
)
params <- fscWrite(demes,genetics,use.wd = TRUE)
fscRun(params)
proj <- fscReadArp(params,marker = "dna",sep.chrom = TRUE)

Unfortunately, the last line produces an error. I have track it down to .fscParseAllSites function where it stucks at: gen.data <- vector("list", nrow(locus.info)) The thing is fscWrite does not fill in locus.info slot in parameters. I would fix it but I am not sure what does it contain. I only guess it might be equal to p$settings$genetics. Am I right? Maciek Konopiński

EricArcher commented 3 years ago

The locus.info slot is populated in fscRun() and is a result of a combination of the genetics specifications and run parameters. Thus, the change you should make is to have fscRun(params) update the params object prior to reading the .arp files created (see example in fscReadArp()):

params <- fscWrite(demes,genetics,use.wd = TRUE)
params <- fscRun(params)
proj <- fscReadArp(params,marker = "dna",sep.chrom = TRUE)

I'll try to edit the help files to make this clearer.

Cheers, Eric

konopinski commented 3 years ago

Works perfectly - I should have copied helpfile script :) By the way, you could add a few additional commands on installing fastsimcoal in Linux. I work on Ubuntu and needed to do some actions before I made it work. I had to place the file in /usr/local/bin (sudo cp [file] /usr/local/bin), manually make fsc26 executable (chmod +x fsc26) and change permissions (chmod 777 fsc26). Everything as superuser. Now it works excellent. Last time I used strataG 2.0.2 with fastimcoal but fortunately I forgot how to use it. I started from scratch now and I feel it's way more clear in current version than it was before. Thanks a lot for your work.

EricArcher commented 3 years ago

Glad to hear it. Thanks for your suggestion on LINUX installations. I'll add that to the fscTutorial().

Cheers, Eric