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 atlas name #524

Open
3 tasks done
adamltyson opened this issue Mar 10, 2025 · 4 comments
Open
3 tasks done

Validate atlas name #524

adamltyson opened this issue Mar 10, 2025 · 4 comments
Assignees

Comments

@adamltyson
Copy link
Member

adamltyson commented Mar 10, 2025

See #523 for context

To do

  • add more stringent atlas name validation to validate_atlas_name in brainglobe_atlasapi\atlas_generation\validate_atlases.py.
  • adjust repr method which currently allows more flexible atlas names than what should be allowed.
  • add test with new constraints to tests\atlasgen\test_validation.py
@stellaprins
Copy link
Contributor

The following atlas names are already covered :

  • nadkarni_mri_mouselemur_91um
  • example_mouse_100um
  • axolotl_50um

resulting in

  • nadkarni mri mouselemur atlas (res. 91um)
  • example mouse atlas (res. 100um)
  • axolotl atlas (res. 50um)

When I fixed the bug in the str method allowed atlas names that do not end with the resolution so I wanted to add a test that checks whether 50um_axolotl results in 50um axolotl atlas.

However after talking to @alessandrofelder and checking the atlas names on last_versions.conf (GIN) -- they all end with the resolution -- we decided it could make more sense to always expect atlas names to end with the resolution and validate this (if this is not already happening).

Just wanted to check what you're opinion @adamltyson and whether you can think of any other (edge) cases that should be added to the test.

@adamltyson
Copy link
Member Author

However after talking to @alessandrofelder and checking the atlas names on last_versions.conf (GIN) -- they all end with the resolution -- we decided it could make more sense to always expect atlas names to end with the resolution and validate this (if this is not already happening).

Agree. The whole point of the Atlas API is standardisation, so we should validate/enforce it where we can.

@stellaprins stellaprins changed the title More robustly test the repr method for different atlas names Validate atlas name Mar 12, 2025
@stellaprins
Copy link
Contributor

stellaprins commented Mar 12, 2025

Atlas naming convention

allowed name structures

  • [source_id]_[species]_[resolution]
  • [source_id]_[species]_[additional_info]_[resolution]

allowed characters

  • Lowercase letters (a-z)
  • Uppercase letters (A-Z) (see note 2)
  • Underscores (_), hyphens (-) and periods (.)

Elements in atlas name

  • [source_id] e.g., allen, kim, osten
  • [species] e.g., mouse, zfish, human
  • [additional_info] some atlas names include details about the developmental stage and / or specific imaging technique used (e.g., e11-5, p14_mri-MTR, lsfm)
  • [resolution] one or more digits, optionally followed by a period and one or more digits, and ending with "um". (e.g., 37.5um, 100um)

Deduced from looking at the atlas names here https://gin.g-node.org/BrainGlobe/atlases/src/master/last_versions.conf

Note1: @alessandrofelder told me that atlasses with a "mm" resolution will probably be added in the future.

Note 2: kim_dev_mouse_p14_mri-MTR_50um is an atlas I found on GIN last_versions.conf with an invalid name (it contains uppercase letters)

@stellaprins
Copy link
Contributor

Just found out there already is a validate_atlas_name function which is validates that atlas names do not contain upper case letters. Will add the additional constraints I summarised above under naming convententions.

def validate_atlas_name(atlas: BrainGlobeAtlas):
    """
    Ensures atlas names are all lowercase
    """
    assert (
        atlas.atlas_name == atlas.atlas_name.lower()
    ), f"Atlas name {atlas.atlas_name} cannot contain capitals."
    return True

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

2 participants