Skip to content

Commit

Permalink
fix code snippet for download all annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
codemonkey800 committed Nov 6, 2024
1 parent 151a605 commit 972e3ad
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,17 @@ export function getDatasetCodeSnippet(datasetId?: number) {
`
}

export function getAllTomogramsCodeSnippet(tomogramVoxelId?: number) {
export function getAllTomogramsCodeSnippet(runId?: number) {
return dedent`
from cryoet_data_portal import (
Client,
TomogramVoxelSpacing,
Run,
)
client = Client()
tomogram_voxel_spacing = TomogramVoxelSpacing.get_by_id(
client,
${tomogramVoxelId},
)
run = Run.get_by_id(client, ${runId})
for annotation in tomogram_voxel_spacing.annotations:
for annotation in run.annotations:
annotation.download()
`
}
Expand Down Expand Up @@ -78,7 +75,7 @@ export function getAnnotationCodeSnippet(

export function APIDownloadTab() {
const { t } = useI18n()
const { datasetId, tomogramId, tomogramVoxelId, type } =
const { runId, datasetId, tomogramId, tomogramVoxelId, type } =
useDownloadModalContext()
const { annotationId, downloadConfig, fileFormat } =
useDownloadModalQueryParamState()
Expand All @@ -97,7 +94,7 @@ export function APIDownloadTab() {
{ type: 'runs', downloadConfig: DownloadConfig.AllAnnotations },
() => ({
label: t('copyApiCodeSnippet'),
content: getAllTomogramsCodeSnippet(tomogramVoxelId),
content: getAllTomogramsCodeSnippet(runId),
calloutKey: 'preferToDownloadViaApiCode',
logType: 'voxel-spacing-id',
}),
Expand Down

0 comments on commit 972e3ad

Please sign in to comment.