ctlab / GADMA

Genetic Algorithm for Demographic Model Analysis
Other
47 stars 14 forks source link

failed to generate code #56

Closed alexsanyum closed 2 years ago

alexsanyum commented 3 years ago

Hi @noscode , I am having problems when working with vcf files and popmaps. Every time that I run gadma I return:

Run 1 warning: failed to generate code due to the following exception: 'generator' object has no attribute 'remove'

You can find the picture of the best model in the output directory.

Also, when checking the output directory, the parameters files (params_file and extra_params_file) never change

Any insight you might be able to give would be much appreciated!

Greetings, Alex

noscode commented 3 years ago

Hi @alexsanyum ,

Thank you very much for your interest to GADMA and especially for your feedback! It is indeed strange behavior and I will check it out. Could you please tell me what system do you use (Linux, Windows or Mac OS)?

Best regards, Ekaterina

noscode commented 3 years ago

Hi again,

I think that I have found the error for the generation of code. I will fix it in the following release. Right now you can install demes library (pip install demes) and everything should work. Let me know if it does not work.

The thing that worries me is about parameter files. Is it still an issue if you install demes?

alexsanyum commented 3 years ago

Hi @noscode ,

I have installed demes but the issue is still there.

I am using Ubuntu 20.04.2 LTS OS, and I am running gadma from anaconda3 base environment.

noscode commented 3 years ago

Sorry for that! I have released the new version, could you check it out please?

alexsanyum commented 3 years ago

Hi,

The warning change to:

Run 1 warning: failed to generate code due to the following exception: list.remove(x): x not in list

I installed demes so I don't know why is not on the list.

In addition, I do not think that is related but just in case, I also have two warnings at the beginning of the run launch (before the warning about the code generator)

Run launch number 1
RuntimeWarning: Mean of empty slice. (/home/alex/anaconda3/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3440)

and

WARNING:matplotlib.font_manager:findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
WARNING:matplotlib.font_manager:findfont: Generic family 'sans-serif' not found because none of the following families were found: Helvetica

I figured out that the warning about numpy is because, in the beginning, time is NaN value. And for the matplotlib, is an issue with my OS, I cannot install sans serif font, but the plot generates successfully.

These errors just display once at the beginning

noscode commented 3 years ago

Hi @alexsanyum

I have added the check if element is in the list. I suggest to update the version from the test pypi: https://test.pypi.org/project/gadma/. Hope that will work!

The warning about font is okay.

alexsanyum commented 3 years ago

It works!!!

I really appreciate your help :D

noscode commented 3 years ago

That is a great news! I am glad to help, feel free to ask if something will go wrong again! Right now it is pre-release but soon I will publish a full release to pypi.

Best regards, Ekaterina

anubhabkhan commented 2 years ago

Hey,

Now we get the error : UserWarning: Code for momentsLD will not be generated as: There are more than one chromosome in VCF file and only total length in Sequence length, please, specify length for chromosomes separately via dict (/usr/local/lib/python3.6/site-packages/gadma/cli/settings_storage.py:1468)

How do we specify the chromosome separately? could not find many instructions.

Thanks so much

Anubhab

noscode commented 2 years ago

Hi Anubhab,

Sorry, looks like something that I should add to the documentation. There is one example of params_file at the end of this section. There is example of how to specify sequence length using the dictionary:

Sequence length: {chromosome1: 249250621, chromosome2: 243199373}

MomentsLD requires sequence length of each chromosome. According to the message your VCF file has more than one chromosome so you have to specify these lengths separately like example above.

Best regards, Ekaterina

anubhabkhan commented 2 years ago

Thank you. This is very helpful. Anubhab

anubhabkhan commented 2 years ago

Hey,

After adding the sequence length, I get the error:

File "/usr/local/bin/gadma", line 11, in sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/gadma/core/core.py", line 51, in main settings_storage, args = arg_parser.get_settings() File "/usr/local/lib/python3.6/site-packages/gadma/cli/arg_parser.py", line 127, in get_settings settings_storage = SettingsStorage.from_file(args.params, args.extra) File "/usr/local/lib/python3.6/site-packages/gadma/cli/settings_storage.py", line 1017, in from_file return obj.update_from_file(param_file, extra_param_file) File "/usr/local/lib/python3.6/site-packages/gadma/cli/settings_storage.py", line 972, in update_from_file ruamel.yaml.RoundTripLoader) File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/main.py", line 951, in load return loader._constructor.get_single_data() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/constructor.py", line 111, in get_single_data node = self.composer.get_single_node() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/composer.py", line 78, in get_single_node document = self.compose_document() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/composer.py", line 101, in compose_document node = self.compose_node(None, None) File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/composer.py", line 138, in compose_node node = self.compose_mapping_node(anchor) File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/composer.py", line 218, in compose_mapping_node item_value = self.compose_node(node, item_key) File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/composer.py", line 111, in compose_node if self.parser.check_event(AliasEvent): File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/parser.py", line 140, in check_event self.current_event = self.state() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/parser.py", line 603, in parse_block_mapping_value if self.scanner.check_token(ValueToken): File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/scanner.py", line 1764, in check_token self._gather_comments() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/scanner.py", line 1806, in _gather_comments self.fetch_more_tokens() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/scanner.py", line 283, in fetch_more_tokens return self.fetch_value() File "/usr/local/lib/python3.6/site-packages/ruamel/yaml/scanner.py", line 656, in fetch_value self.reader.get_mark(), ruamel.yaml.scanner.ScannerError: mapping values are not allowed here in "GADMA_param_sort_all1.par", line 4, column 59

my parameters file is :

Output directory: GADMA/Output_sort_all_seq Input data: input.vcf, pop_order.txt Outgroup: False Sequence length:{HiC_scaffold_1: 100107381, HiC_scaffold_2: 105422710, HiC_scaffold_3: 84653302, HiC_scaffold_4: 71730761, HiC_scaffold_5: 82087087, HiC_scaffold_6: 72648741, HiC_scaffold_7: 206147042, HiC_scaffold_8: 75724504, HiC_scaffold_9: 42998131, HiC_scaffold_10: 56992115, HiC_scaffold_11: 68020579, HiC_scaffold_12: 69753810, HiC_scaffold_13: 174872996, HiC_scaffold_14: 125785404, HiC_scaffold_15: 95956831, HiC_scaffold_16: 92867347, HiC_scaffold_17: 25658408, HiC_scaffold_18: 72251902, HiC_scaffold_19: 70704222, HiC_scaffold_20: 58087477, HiC_scaffold_21: 66824428, HiC_scaffold_22: 65113277, HiC_scaffold_23: 99334673, HiC_scaffold_24: 206517395, HiC_scaffold_25: 119051098, HiC_scaffold_26: 169401614, HiC_scaffold_27: 144118974}

On 12 Sep 2022, at 17:51, Ekaterina Noskova @.***> wrote:

Hi Anubhab,

Sorry, looks like something that I should add to the documentation. There is one example of params_file at the end of this section https://gadma.readthedocs.io/en/latest/user_manual/set_engine.html#momentsld. There is example of how to specify sequence length using the dictionary:

Sequence length: {chromosome1: 249250621, chromosome2: 243199373} MomentsLD requires sequence length of each chromosome. According to the message your VCF file has more than one chromosome so you have to specify these lengths separately like example above.

Best regards, Ekaterina

— Reply to this email directly, view it on GitHub https://github.com/ctlab/GADMA/issues/56#issuecomment-1243659334, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFU7WMOUIW5QA2Y4CZWUXLLV54N5HANCNFSM5C7PSPTQ. You are receiving this because you commented.