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

validate_atlases.py additional_references error #275

Closed
viktorpm opened this issue May 2, 2024 · 5 comments · Fixed by #290
Closed

validate_atlases.py additional_references error #275

viktorpm opened this issue May 2, 2024 · 5 comments · Fixed by #290
Assignees
Labels
bug Something isn't working

Comments

@viktorpm
Copy link
Contributor

viktorpm commented May 2, 2024

Describe the bug

  • When I tried to run validate_atlases.py both in an interactive session on the HPC and as a submitted job I received this error:
allen_human_500um 0.1
/nfs/nhome/live/vplattner/_projects/validation/brainglobe-atlasapi/brainglobe_atlasapi/core.py:65: UserWarning: This atlas seems to be outdated as no additional_references list is found in metadata!
  warnings.warn(
Traceback (most recent call last):
  File "/nfs/nhome/live/vplattner/_projects/validation/brainglobe-atlasapi/brainglobe_atlasapi/atlas_generation/validate_atlases.py", line 252, in <module>
    temp_validation_results = validate_atlas(
                              ^^^^^^^^^^^^^^^
  File "/nfs/nhome/live/vplattner/_projects/validation/brainglobe-atlasapi/brainglobe_atlasapi/atlas_generation/validate_atlases.py", line 222, in validate_atlas
    validation_function(BrainGlobeAtlas(atlas_name))
  File "/nfs/nhome/live/vplattner/_projects/validation/brainglobe-atlasapi/brainglobe_atlasapi/atlas_generation/validate_atlases.py", line 132, in validate_additional_references
    ) in atlas.additional_references.references_list:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'BrainGlobeAtlas' object has no attribute 'additional_references'
  • I manually removed all additional_references related functions and tests in the local code to be able to run the validation.

To Reproduce

module load mamba
mamba init
mamba activate bg-atlasapi
git clone https://github.com/brainglobe/brainglobe-atlasapi.git
cd brainglobe-atlasapi/
git checkout main

pip install -e ".[allenmouse, dev]"
pip install scikit-image
pip install imio
pip install brainio

python brainglobe_atlasapi/atlas_generation/validate_atlases.py

Computer used (please complete the following information):

  • OS: Linux
  • submitted job on HPC or interactive conda environment
@viktorpm viktorpm added the bug Something isn't working label May 2, 2024
@viktorpm viktorpm self-assigned this May 2, 2024
@adamltyson
Copy link
Member

I think this should be added to the validation scripts, to check that the atlases have additional_references set correctly (or at all).

@alessandrofelder
Copy link
Member

The warning is useful in this case, I think, @viktorpm

UserWarning: This atlas seems to be outdated as no additional_references list is found in metadata!

This suggests that there is an atlas (is it the human atlas or the one after in the validation list?) that hasn't been updated since we introduced the additional references concept in the code.

How I think it is intended to work (for atlases with no additional references):

@viktorpm
Copy link
Contributor Author

viktorpm commented May 7, 2024

@alessandrofelder, looks like the human atlas doesn't return what the validate_additional_references function expects. The warning has always been there, so that shouldn't be a problem. I tried to print the reference list allenhu.additional_references.references_list but got an error. Should we try to catch the error and continue the validation or fix the atlas (it is likely a bigger job)?

allen mouse 100um atlas

allen100 = BrainGlobeAtlas("allen_mouse_100um") 

allen100.additional_references.references_list

[]

allen human 500um atlas

allenhu = BrainGlobeAtlas("allen_human_500um")
/home/plattnerv/miniforge3/envs/bg-atlasapi/lib/python3.11/site-packages/brainglobe_atlasapi/core.py:65: UserWarning: This atlas seems to be outdated as no additional_references list is found in metadata!
  warnings.warn(

allenhu.additional_references.references_list

Traceback (most recent call last):
  File "/home/plattnerv/.pycharm_helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
AttributeError: 'BrainGlobeAtlas' object has no attribute 'additional_references'

@adamltyson
Copy link
Member

To fix the issue, I think (famous last words) that the human atlas just needs to be regenerated. It should then have the correct metadata. I think the issue stems from the fact that it hasn't been regenerated since the concept of additional references was added to the atlas API.

@viktorpm
Copy link
Contributor Author

viktorpm commented May 7, 2024

I agree, but I couldn't find an easy fix for the script. I'll make it my priority to work on that (in a new PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants