Skip to content

Commit

Permalink
feat: Add more V2 API fields (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
bchu1 authored Sep 20, 2024
1 parent 469b9b8 commit 0770a16
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 2 deletions.
47 changes: 46 additions & 1 deletion frontend/packages/data-portal/app/graphql/getRunByIdDiffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import { diff } from 'deep-object-diff'

import { GetRunByIdQuery } from 'app/__generated__/graphql'
import {
Fiducial_Alignment_Status_Enum,
GetRunByIdV2Query,
Sample_Type_Enum,
Tiltseries_Microscope_Manufacturer_Enum,
Tomogram_Processing_Enum,
Tomogram_Reconstruction_Method_Enum,
} from 'app/__generated_v2__/graphql'

/* eslint-disable no-console */
Expand Down Expand Up @@ -110,14 +113,56 @@ export function logIfHasDiff(
})),
},
},
tomogramVoxelSpacings: {
__typename: 'TomogramVoxelSpacingConnection',
edges: run.tomogram_voxel_spacings.map((tomogramVoxelSpacing) => ({
__typename: 'TomogramVoxelSpacingEdge',
node: {
__typename: 'TomogramVoxelSpacing',
id: tomogramVoxelSpacing.id,
s3Prefix: tomogramVoxelSpacing.s3_prefix!,
tomograms: {
__typename: 'TomogramConnection',
edges: tomogramVoxelSpacing.tomograms.map((tomogram) => ({
__typename: 'TomogramEdge',
node: {
__typename: 'Tomogram',
ctfCorrected: tomogram.ctf_corrected,
fiducialAlignmentStatus:
tomogram.fiducial_alignment_status as Fiducial_Alignment_Status_Enum,
id: tomogram.id,
keyPhotoUrl: tomogram.key_photo_url,
name: tomogram.name,
neuroglancerConfig: tomogram.neuroglancer_config,
processing: tomogram.processing as Tomogram_Processing_Enum,
processingSoftware: tomogram.processing_software,
reconstructionMethod:
tomogram.reconstruction_method as Tomogram_Reconstruction_Method_Enum,
reconstructionSoftware: tomogram.reconstruction_software,
sizeX: tomogram.size_x,
sizeY: tomogram.size_y,
sizeZ: tomogram.size_z,
voxelSpacing: tomogram.voxel_spacing,
alignment: {
__typename: 'Alignment',
affineTransformationMatrix: JSON.stringify(
tomogram.affine_transformation_matrix,
).replaceAll(' ', ''),
},
},
})),
},
},
})),
},
})),
}

const diffObject = diff(v1Transformed, v2)

if (Object.keys(diffObject).length > 0) {
console.log(
`DIFF AT ${url}: ${JSON.stringify(diffObject)} | ${JSON.stringify(
`DIFF AT ${url}: ${JSON.stringify(diffObject)} --- ${JSON.stringify(
diff(v2, v1Transformed),
)}`,
)
Expand Down
62 changes: 61 additions & 1 deletion frontend/packages/data-portal/app/graphql/getRunByIdV2.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(`
id
name
# Metadata sidebar
tiltseries(first: 1) {
edges {
node {
Expand Down Expand Up @@ -62,7 +63,7 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(`
organismName
organismTaxid
otherSetup
# publications
# publications # TODO(bchu): Change to new name.
relatedDatabaseEntries
relatedDatabaseEntries
releaseDate
Expand Down Expand Up @@ -102,6 +103,65 @@ const GET_RUN_BY_ID_QUERY_V2 = gql(`
}
}
}
# Legacy single tomogram
tomogramVoxelSpacings(
first: 1
# where: {
# tomograms: {
# isCanonical: { _eq: true} # TODO(bchu): Uncomment when bool bug fixed.
# }
# }
) {
edges {
node {
id
s3Prefix
tomograms(
first: 1
# where: {
# isCanonical: { _eq: true } # TODO(bchu): Uncomment when bool bug fixed.
# }
) {
edges {
node {
ctfCorrected
fiducialAlignmentStatus
id
keyPhotoUrl
name
neuroglancerConfig
processing
processingSoftware
reconstructionMethod
reconstructionSoftware
sizeX
sizeY
sizeZ
voxelSpacing
alignment {
affineTransformationMatrix
}
}
}
}
}
}
}
# Header
# tiltseriesAggregate { # TODO(bchu): Uncomment when __typename bug is fixed.
# aggregate {
# count
# avg {
# tiltSeriesQuality
# }
# # sum {
# # tiltseriesFramesCount # TODO(bchu): Uncomment when populated.
# # }
# }
# }
}
}
`)
Expand Down

0 comments on commit 0770a16

Please sign in to comment.