Skip to content

feat: add parser uri to readers, add function to download portal project fo…#43

Merged
jtschwar merged 4 commits intomainfrom
io
Jan 30, 2026
Merged

feat: add parser uri to readers, add function to download portal project fo…#43
jtschwar merged 4 commits intomainfrom
io

Conversation

@jtschwar
Copy link
Contributor

@jtschwar jtschwar commented Jan 29, 2026

Pull request overview

This PR adds functionality to download AreTomo files from the CryoET Data Portal and improves the reader functions by introducing URI-based object resolution.

Changes:

  • Added URI-based resolution for tomograms and segmentations in readers
  • Renamed variables in writers for consistency (tomogramtomo, segmentation_volumeseg_vol, segmentationseg)
  • Added new portal download functionality with CLI commands for downloading CryoET Data Portal projects

@jtschwar jtschwar requested a review from Copilot January 30, 2026 22:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds functionality to download AreTomo files from the CryoET Data Portal and improves the reader functions by introducing URI-based object resolution.

Changes:

  • Added URI-based resolution for tomograms and segmentations in readers
  • Renamed variables in writers for consistency (tomogramtomo, segmentation_volumeseg_vol, segmentationseg)
  • Added new portal download functionality with CLI commands for downloading CryoET Data Portal projects

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/copick_utils/io/readers.py Added URI parsing support via resolve_copick_objects, added docstrings, changed function signature parameter names
src/copick_utils/io/writers.py Renamed variables for brevity (tomogramtomo, segmentation_volumeseg_vol, segmentationseg)
src/copick_utils/io/portal.py New module for downloading AreTomo files from CryoET Data Portal including tiltseries, alignments, and metadata
src/copick_utils/cli/download.py New CLI command for downloading projects from CryoET Data Portal
src/copick_utils/cli/download_commands.py Module exporting download commands for CLI integration
pyproject.toml Added mdocfile dependency and new CLI entry point for download commands

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

uri = f'{algorithm}@{voxel_size}'
vol = resolve_copick_objects(uri, run.root, 'tomogram', run_name = run.name)
return vol[0].numpy()
except: # Report which orbject is missing
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'orbject' to 'object'.

Suggested change
except: # Report which orbject is missing
except: # Report which object is missing

Copilot uses AI. Check for mistakes.
uri = f'{name}:{user_id}/{session_id}@{voxel_spacing}'
segs = resolve_copick_objects(uri, run.root, 'segmentation', run_name = run.name)
return segs[0].numpy()
except:
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare except clause catches all exceptions including system exits and keyboard interrupts. Specify the expected exception type(s) to avoid masking unexpected errors.

Copilot uses AI. Check for mistakes.
download_aretomo_files_for_tiltseries(dataset_id, run_name, output_dir, tiltseries_id)

# note: this function assumes that there is only one tiltseries per run
# note: the tiltseries name is equivlaent to the run name
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'equivlaent' to 'equivalent'.

Suggested change
# note: the tiltseries name is equivlaent to the run name
# note: the tiltseries name is equivalent to the run name

Copilot uses AI. Check for mistakes.
@jtschwar jtschwar merged commit 7743ee5 into main Jan 30, 2026
2 checks passed
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 this pull request may close these issues.

1 participant