fastsimcoal28 not generating likelihoods

107 views
Skip to first unread message

Tim

unread,
Jan 25, 2025, 12:14:59 PMJan 25
to fastsimcoal2
Dear Fastsimcoal-Forum, dear Laurent,

I am currently trying to simulate a simple evolutionary scenario for my master's thesis. After navigating countless traps due to poor parameter setting on my side, I managed to not getting any error messages after running the command. However, I'm also unsuccessfully waiting for any results by fastsimcoal.

I stagnate at exactly this logs:
fastsimcoal was invoked with the following command line arguments:
../fsc28_linux64/fsc28 -t Test_FSC.tpl -e Test_FSC.est -M -E20 -L 40 -n 1000 --resetParam 5 -x -d -s0 -b9 -q

Random generator seed : 366350

Population growth detected in input file

fastsimcoal2 is building 0 genealogies ...

Simulating 0 independent chromosomes using 12 batches and 1 threads.

Iteration 1/20 done in 0.276 secs

Population growth detected in input file

fastsimcoal2 is building 0 genealogies ...

Iteration 2/20 done in 0.356 secs

 

When I omit the -q flag, I am bombarded by countless logs of this pattern:
Data type: FREQ   :  recombination and mutation rates
0.0000000100   0.0000000170
   Output expected MAF spectrum
   Do not output expected DAF spectrum


Due to these errors, I assume there are issues with my input DAF files.
These are the files in my fastsimcoal folder.
fsc28  rawSFS  run_angsd.sh  seed.txt  SFStoFSC.py  Test_FSC  Test_FSC.est  Test_FSC_jointDAFpop1_0.obs  Test_FSC_jointDAFpop2_0.obs  Test_FSC_jointDAFpop2_1.obs  Test_FSC.params  Test_FSC.tpl

To create the SFS, I use angsd with the following flags for the unfolded SFS of all autosomes
 -dosaf 1 -gl 2 -minQ 20 -doCounts 1 -minMapQ 20 -remove_bads 1 -uniqueOnly 1 -anc ** -rf **
 
Then, I generate 2dSFS and 3dSFS with winsfs and tried either just changing the header of the angsd output according to the manual
1 observations. No. of demes and sample sizes are on next line
3               24 26 18
1034755791.869008 5088587.139098 344419.417440 112130.210604


or completely changing the 2dSFS files with a python script to change it to the appropriate format (see attached files).
I have added my .tpl and .est files for completeness.
 
Furthermore, do I need the -removezeroSFS flag for ANGSD output or is it not relevant?Thanks a lot in advance.

I am looking forward to your answers!
 
 




FSC_est.txt
2dSFS.txt
FSC_tpl.txt

Tim

unread,
Jan 25, 2025, 12:28:22 PMJan 25
to fastsimcoal2
When I try, running this minimal command, It does finish but still does not create the requested files:
nosingleton -b2

fastsimcoal was invoked with the following command line arguments:
./fsc28 -t Test_FSC.tpl -e Test_FSC.est -M -E2 -L 4 -n 10 --resetParam 5 -x -d -s10 --nosingleton -b2 -T
Reading parameter settings file Test_FSC.est...
done reading parameter settings file!

Random generator seed : 883627

Deme sizes
Deme 0  239906
Deme 1  13376
Deme 2  10


Sample sizes
Deme 0  24
Deme 1  26
Deme 2  18

Sample ages
Deme 0  10
Deme 1  10
Deme 2  3


Inbreeding coefficients
Deme 0  0
Deme 1  0
Deme 2  0

Growth rates
Deme 0  0.001
Deme 1  0.001
Deme 2  -0.2


Historical events
Event 0

#Make lineages of deme 2 active at time 3

Event 1

#Make lineages of deme 0 active at time 10

Event 2

#Make lineages of deme 1 active at time 10



Number of independent loci to simulate : 0
with the same chromosomal structure

Number of linkage blocks to simulate in structure 1: 0


Population growth detected in input file

fastsimcoal2 is building 0 genealogies ...

Simulating 0 independent chromosomes using 12 batches and 1 threads.

        Genealogy # 1/10
        Genealogy # 2/10
        Genealogy # 3/10
        Genealogy # 4/10
        Genealogy # 5/10
        Genealogy # 6/10
        Genealogy # 7/10
        Genealogy # 8/10
        Genealogy # 9/10
        Genealogy # 10/10

Iteration 1/2 done in 0.236 secs


Deme sizes
Deme 0  21491
Deme 1  1612
Deme 2  25


Sample sizes
Deme 0  24
Deme 1  26
Deme 2  18

Sample ages
Deme 0  10.000
Deme 1  10.000
Deme 2  3.000


Inbreeding coefficients
Deme 0  0.000
Deme 1  0.000
Deme 2  0.000

Growth rates
Deme 0  0.001
Deme 1  0.001
Deme 2  -0.200


Historical events
Event 0

#Time              : 0
#Source            : 0
#Sink              : 0
#Migrants          : 0.000
#New relative size : 0.000
#New growth rate   : 0.000
#New migr. matrix  : 0
Event 1

#Time              : 0
#Source            : 0
#Sink              : 0
#Migrants          : 0.000
#New relative size : 0.000
#New growth rate   : 0.000
#New migr. matrix  : 0
Event 2

#Time              : 0
#Source            : 0
#Sink              : 0
#Migrants          : 0.000
#New relative size : 0.000
#New growth rate   : 0.000
#New migr. matrix  : 0
Event 3

#Make lineages of deme 2 active at time 3

Event 4

#Make lineages of deme 0 active at time 10

Event 5

#Make lineages of deme 1 active at time 10



Number of independent loci to simulate : 0
with the same chromosomal structure

Number of linkage blocks to simulate in structure 1: 0


Population growth detected in input file

fastsimcoal2 is building 0 genealogies ...
        Genealogy # 1/10
        Genealogy # 2/10
        Genealogy # 3/10
        Genealogy # 4/10
        Genealogy # 5/10
        Genealogy # 6/10
        Genealogy # 7/10
        Genealogy # 8/10
        Genealogy # 9/10
        Genealogy # 10/10

Iteration 2/2 done in 0.238 secs


Program total execution time: 0.239 seconds


Content of Test_FSC.params:
N_JN$   N_EU$   N_TR$   N_ANC$  T_Hyb$  T_DIV$  Rescaling_Factor        MaxEstLhood     MaxObsLhood
150     5553    20      105     13      593279  1
165412  2258    30      368     5       37631   1

And both "mut" and "true" .trees like this:
#NEXUS
begin trees;  [Treefile generated by fastsimcoal.exe (Laurent Excoffier)]

end;
#NEXUS
begin trees;  [Treefile generated by fastsimcoal.exe (Laurent Excoffier)]

end;

Laurent Excoffier

unread,
Jan 26, 2025, 6:08:39 AMJan 26
to fastsimcoal2
Hi,
a few comments. 
- Your input files have the .txt extensions. Make sure they have the requested .tpl, .est, . obs extensions
- Remove any blank line in your tpl file. I think it is the main problem here...
- Correct following lines as 
//Number of independent (unlinked) chromosomes, and "chromosome structure" flag:  0 for identical structure across chromosomes, and 1 for different structures on different chromosomes.
17 0
as 
//Number of independent (unlinked) chromosomes, and "chromosome structure" flag:  0 for identical structure across chromosomes, and 1 for different structures on different chromosomes.
1 0
- Rec. rate is not taken into account with Freq data so just say
FREQ 1 0 1.7e-8 OUTEXP
- Your command line to invoke fsc could simply look like 
../fsc28_linux64/fsc28 -t Test_FSC.tpl -e Test_FSC.est -M -L 40 -n 1000 -d -q
but my advice would be to increase number of sims, at least 10,000 or even 100,000
- It is always good to look at the generated par file to see if all parameters are correctly replaced by meaningful values.
- Also check the .simparam file to see if all historical events are correctly generated

Hope it helps

laurent

Tim

unread,
Jan 26, 2025, 6:18:15 AMJan 26
to fastsimcoal2
Dear Laurent,

Thanks a ton! You made it work!
The file extensions were of course correct in the cluster but you were right about the blank lines causing problems.

You really made my week.

Best Regards,
Tim
Reply all
Reply to author
Forward
0 new messages