Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'MaskedArray' object has no attribute 'folded' #24

Open
CoCo477 opened this issue Dec 17, 2024 · 0 comments
Open

AttributeError: 'MaskedArray' object has no attribute 'folded' #24

CoCo477 opened this issue Dec 17, 2024 · 0 comments

Comments

@CoCo477
Copy link

CoCo477 commented Dec 17, 2024

Hi Dr. Portik,

I am running dadi for hypothesis testing with 5 2D models ("no_mig", "sec_contact_asym_mig", "anc_asym_mig", "sym_mig", "asym_mig") on 2 populations with
high-throughput sequencing data. I made the folded sfs files with easySFS from vcf files which I am then feeding to dadi_pipeline.

First, I used the scripts in Two_Population_Pipeline fold and made some necessary modifications to generate the Results_Summary_Short.txt file for each model. Then I'd like to use scripts in Goodness_of_Fit fold and make some necessary modifications to generate the Simulation_Results_[model name].txt file for each model. But there seems to be an issue with this step. Five models work perfectly fine, but one model(anc_asym_mig) keep failing with the following error:
Traceback (most recent call last):
File "Simulate_and_Optimize.py", line 232, in
param_labels=p_labels)
File "/data2/yangk/WYH/04.Demographic_History/03.LDfilter_dadi/ancient_gene_flow/Optimize_Functions_GOF.py", line 447, in Perform_S>
param_labels=param_labels, optimizer=optimizer)
File "/data2/yangk/WYH/04.Demographic_History/03.LDfilter_dadi/ancient_gene_flow/Optimize_Functions_GOF.py", line 253, in Optimize_>
output_file = "{}.log.txt".format(model_name))
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 742, in optimize_log_fmin
disp=False, maxiter=maxiter, full_output=True)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 543, in fmin
res = _minimize_neldermead(func, x0, args, callback=callback, **opts)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 689, in _minimize_neldermead
fsim[k] = func(sim[k])
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/scipy/optimize/optimize.py", line 427, in function_wrapper
return function(*(wrapper_args + args))
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 78, in _object_func_log
return _object_func(numpy.exp(log_params), args, **kwargs)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 54, in _object_func
result = ll_multinom(sfs, data)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 563, in ll_multinom
ll_arr = ll_multinom_per_bin(model, data)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 547, in ll_multinom_per_bin
return ll_per_bin(theta_opt
model, data)
File "/data2/yangk/miniconda3/envs/py36/lib/python3.6/site-packages/dadi/Inference.py", line 484, in ll_per_bin
if hasattr(data, 'folded') and data.folded and not model.folded:
AttributeError: 'MaskedArray' object has no attribute 'folded'

I found in dadi user group that someone also came across the same error using dadi_pipeline, but dadi's auther was not sure what exactly is happening (https://groups.google.com/g/dadi-user/c/-TXzZeo-TN0/m/70R0VvyhAAAJ).

I am attaching the errors files for anc_asym_mig model(error_for_anc_asym_mig.txt), the sfs files(fs_P2CSHJ64_P3CSHJ34.fs and max_fs_P2CSHJ86_P3CSHJ38.fs), the python script for running optimizations(dadi_Run_Optimizations_for_anc_asym_mig.py), the short summary results for 5 models' optimizations(Results_Summary_Short.txt), and the python script for simulation and optimization(Simulate_and_Optimize_for_anc_asym_mig.py). I would really appreciate some tips on how to make this model run in dadi_pipeline!

dadi_pipeline.zip

Thank you so much and all the best,

CoCo477

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant