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

bug in maintenance add-species introduced in #1646 #1670

Closed
AprilYUZhang opened this issue Jan 23, 2025 · 6 comments · Fixed by #1671
Closed

bug in maintenance add-species introduced in #1646 #1670

AprilYUZhang opened this issue Jan 23, 2025 · 6 comments · Fixed by #1671

Comments

@AprilYUZhang
Copy link

AprilYUZhang commented Jan 23, 2025

Hi guys, currently I am building pig's demorgraphy. when I run python -m maintenance add-species sus_scrofa , there is a bug happend, here is the error report:

 2025-01-23 19:20:06,515 [17802] INFO     maint: Adding new species SusScr for Ensembl ID sus_scrofa
2025-01-23 19:20:06,516 [17802] INFO     ensembl: making request to http://rest.ensembl.org/info/assembly/sus_scrofa?synonyms=1
2025-01-23 19:20:10,560 [17802] INFO     ensembl: making request to http://rest.ensembl.org/info/data
2025-01-23 19:20:10,758 [17802] INFO     maint: Writing genome data for SusScr sus_scrofa
2025-01-23 19:20:10,826 [17802] INFO     ensembl: making request to http://rest.ensembl.org/info/genomes/sus_scrofa
2025-01-23 19:20:11,161 [17802] INFO     maint: SusScr: name=Sus scrofa, common_name=Pig
2025-01-23 19:20:11,164 [17802] CRITICAL root: Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/*/Experinment/git_repository/stdpopsim/maintenance/__main__.py", line 6, in <module>
    main.main()
  File "/Users/*/Experinment/git_repository/stdpopsim/maintenance/main.py", line 544, in main
    cli()
  File "/Users/*/opt/anaconda3/envs/stdpopsim_env/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/*/opt/anaconda3/envs/stdpopsim_env/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/*/opt/anaconda3/envs/stdpopsim_env/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/*/opt/anaconda3/envs/stdpopsim_env/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/*/opt/anaconda3/envs/stdpopsim_env/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/*/Experinment/git_repository/stdpopsim/maintenance/main.py", line 515, in add_species
    writer.add_species(ensembl_id.lower(), force=force)
  File "/Users/*/Experinment/git_repository/stdpopsim/maintenance/main.py", line 276, in add_species
    write_catalog_stub(
  File "/Users/*/Experinment/git_repository/stdpopsim/maintenance/main.py", line 225, in write_catalog_stub
    chr_names = genome_data["chromosomes"].keys()
                ~~~~~~~~~~~^^^^^^^^^^^^^^^
TypeError: tuple indices must be integers or slices, not str

I guess it might be caused by recent modification, because I didn't receive this error message last week running the same command. Does anyone know why it's giving an error? Thank you very much!

@petrelharp
Copy link
Contributor

Hm, thanks for the report. Just checking - what version of stdpopsim are you using? Is it pip install'ed, or from github? If not from github, could you grab that and try again?

@AprilYUZhang
Copy link
Author

Hi,thank you for your reply! I clone the fork from GitHub. Here is the latest commit in my branch.

commit cb1550ab1a59f90e5034c597eceab9de4555945d (HEAD -> sus_scrofa, origin/main, origin/HEAD, main)
Author: Clara Rehmann <[email protected]>
Date:   Wed Jan 22 20:56:00 2025 -0800

    Dromel qc (#1668)
    
    * qc for DroMel DFE

@petrelharp
Copy link
Contributor

I can confirm this, and reverting to just before @andrewkern's #1646 fixes the problem.

If I insert print(genome_data) just before the line in question, I see that it is

('updated', None)

which is why we get an error trying to look at genome_data["chromosomes"].

I'm guessing this will be easy to fix when @andrewkern has a minute to look at it.

@petrelharp petrelharp changed the title Bug report when I add a new species bug in maintenance add-species introduced in #1646 Jan 24, 2025
@andrewkern
Copy link
Member

darn! this was broken in the changes I introduced in how we pull data from ensembl. PR #1671 should fix this, I think

@petrelharp
Copy link
Contributor

Okay - update your github and this should work? Please let us know if there are issues with the result.

@AprilYUZhang
Copy link
Author

Thank you! It works now.

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

Successfully merging a pull request may close this issue.

3 participants