From 9bf299f84cdc26d4e1da9fd8dce702dd08750485 Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Thu, 19 Jan 2023 17:20:42 +0000 Subject: [PATCH 1/6] Extra colums for Tomogram table --- .../updates/2023_01_16_Tomogram_new_cols.sql | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 schema/updates/2023_01_16_Tomogram_new_cols.sql diff --git a/schema/updates/2023_01_16_Tomogram_new_cols.sql b/schema/updates/2023_01_16_Tomogram_new_cols.sql new file mode 100644 index 0000000..b253ba7 --- /dev/null +++ b/schema/updates/2023_01_16_Tomogram_new_cols.sql @@ -0,0 +1,28 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2023_01_16_Tomogram_new_cols.sql', 'ONGOING'); + +ALTER TABLE Tomogram + ADD fileDirectory varchar(255) DEFAULT NULL COMMENT 'Directory path for files referenced by this table', + ADD centralSliceImage varchar(255) DEFAULT NULL COMMENT 'Tomogram central slice file', + ADD tomogramMovie varchar(255) DEFAULT NULL COMMENT 'Movie traversing the tomogram across an axis', + ADD xyShiftPlot varchar(255) DEFAULT NULL COMMENT 'XY shift plot file', + ADD projXY varchar(255) DEFAULT NULL COMMENT 'XY projection file', + ADD projXZ varchar(255) DEFAULT NULL COMMENT 'XZ projection file', + ADD processingJobId int(11) unsigned DEFAULT NULL, + ADD recordTimeStamp datetime DEFAULT current_timestamp() COMMENT 'Creation or last update date/time', + ADD CONSTRAINT Tomogram_fk_processingJobId FOREIGN KEY (processingJobId) REFERENCES ProcessingJob (processingJobId); + +/* +-- Undo changes +ALTER TABLE Tomogram + DROP IF EXISTS fileDirectory, + DROP IF EXISTS centralSliceImage, + DROP IF EXISTS tomogramMovie, + DROP IF EXISTS xyShiftPlot, + DROP IF EXISTS projXY, + DROP IF EXISTS projXZ, + DROP IF EXISTS processingJobId, + DROP IF EXISTS recordTimeStamp, + DROP CONSTRAINT IF EXISTS Tomogram_FK_processingJobId; +*/ + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2023_01_16_Tomogram_new_cols.sql'; From 6b1621037704a336cc11ffbb33288347fc7fc61e Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Thu, 19 Jan 2023 17:28:31 +0000 Subject: [PATCH 2/6] rm IGNORE keyword to pass test --- schema/updates/2023_01_16_Tomogram_new_cols.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/updates/2023_01_16_Tomogram_new_cols.sql b/schema/updates/2023_01_16_Tomogram_new_cols.sql index b253ba7..c421d3c 100644 --- a/schema/updates/2023_01_16_Tomogram_new_cols.sql +++ b/schema/updates/2023_01_16_Tomogram_new_cols.sql @@ -1,4 +1,4 @@ -INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2023_01_16_Tomogram_new_cols.sql', 'ONGOING'); +INSERT INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2023_01_16_Tomogram_new_cols.sql', 'ONGOING'); ALTER TABLE Tomogram ADD fileDirectory varchar(255) DEFAULT NULL COMMENT 'Directory path for files referenced by this table', From 957be0069498a4f361f102c358d1029744577533 Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Thu, 19 Jan 2023 17:35:54 +0000 Subject: [PATCH 3/6] Cryo Electron Tomography tables --- schema/updates/2022_06_22_cryo-ET_tables.sql | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 schema/updates/2022_06_22_cryo-ET_tables.sql diff --git a/schema/updates/2022_06_22_cryo-ET_tables.sql b/schema/updates/2022_06_22_cryo-ET_tables.sql new file mode 100644 index 0000000..ca3954a --- /dev/null +++ b/schema/updates/2022_06_22_cryo-ET_tables.sql @@ -0,0 +1,49 @@ +INSERT INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2022_06_22_cryo-ET_tables.sql', 'ONGOING'); + +ALTER TABLE Movie + ADD COLUMN IF NOT EXISTS angle float COMMENT 'unit: degrees relative to perpendicular to beam', + ADD COLUMN IF NOT EXISTS fluence float COMMENT 'accumulated electron fluence from start to end of acquisition of this movie (commonly, but incorrectly, referred to as ‘dose’)', + ADD COLUMN IF NOT EXISTS numberOfFrames int(11) unsigned COMMENT 'number of frames per movie. This should be equivalent to the number of MotionCorrectionDrift entries, but the latter is a property of data analysis, whereas the number of frames is an intrinsic property of acquisition.'; + +CREATE TABLE Tomogram ( + tomogramId int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, + dataCollectionId int(11) unsigned COMMENT 'FK to DataCollection table', + autoProcProgramId int(10) unsigned COMMENT 'FK, gives processing times/status and software information', + volumeFile varchar(255) COMMENT '.mrc file representing the reconstructed tomogram volume', + stackFile varchar(255) NULL DEFAULT NULL COMMENT '.mrc file containing the motion corrected images ordered by angle used as input for the reconstruction', + sizeX int(11) unsigned COMMENT 'unit: pixels', + sizeY int(11) unsigned COMMENT 'unit: pixels', + sizeZ int(11) unsigned COMMENT 'unit: pixels', + pixelSpacing float COMMENT 'Angstrom/pixel conversion factor', + residualErrorMean float COMMENT 'Alignment error, unit: nm', + residualErrorSD float COMMENT 'Standard deviation of the alignment error, unit: nm', + xAxisCorrection float COMMENT 'X axis angle (etomo), unit: degrees', + tiltAngleOffset float COMMENT 'tilt Axis offset (etomo), unit: degrees', + zShift float COMMENT 'shift to center volumen in Z (etomo)', + CONSTRAINT FOREIGN KEY Tomogram_fk_dataCollectionId (dataCollectionId) REFERENCES DataCollection (dataCollectionId) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT FOREIGN KEY Tomogram_fk_autoProcProgramId (autoProcProgramId) REFERENCES AutoProcProgram (autoProcProgramId) ON DELETE SET NULL ON UPDATE CASCADE +) +COMMENT 'For storing per-sample, per-position data analysis results (reconstruction)'; + +CREATE TABLE TiltImageAlignment ( + movieId int(11) unsigned NOT NULL COMMENT 'FK to Movie table', + tomogramId int(11) unsigned NOT NULL COMMENT 'FK to Tomogram table; tuple (movieID, tomogramID) is unique', + defocusU float COMMENT 'unit: Angstroms', + defocusV float COMMENT 'unit: Angstroms', + psdFile varchar(255), + resolution float COMMENT 'unit: Angstroms', + fitQuality float, + refinedMagnification float NULL DEFAULT NULL COMMENT 'unitless', + refinedTiltAngle float COMMENT 'units: degrees', + refinedTiltAxis float COMMENT 'units: degrees', + residualError float COMMENT 'Residual error, unit: nm', + PRIMARY KEY (movieId, tomogramId), + CONSTRAINT FOREIGN KEY TiltImageAlignment_fk_movieId (movieId) REFERENCES Movie (movieId) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT FOREIGN KEY TiltImageAlignment_fk_tomogramId (tomogramId) REFERENCES Tomogram (tomogramId) ON DELETE CASCADE ON UPDATE CASCADE +) +COMMENT 'For storing per-movie analysis results (reconstruction)'; + +ALTER TABLE BeamLineSetup + ADD amplitudeContrast float COMMENT 'Needed for cryo-ET'; + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2022_06_22_cryo-ET_tables.sql'; From 72280e972922474a245ff88b384aa18fb3cfc285 Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Thu, 19 Jan 2023 17:42:47 +0000 Subject: [PATCH 4/6] Remove 'unsigned' keyword from movieId FK in TiltImageAlignment --- schema/updates/2022_06_22_cryo-ET_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/updates/2022_06_22_cryo-ET_tables.sql b/schema/updates/2022_06_22_cryo-ET_tables.sql index ca3954a..37c3f82 100644 --- a/schema/updates/2022_06_22_cryo-ET_tables.sql +++ b/schema/updates/2022_06_22_cryo-ET_tables.sql @@ -26,7 +26,7 @@ CREATE TABLE Tomogram ( COMMENT 'For storing per-sample, per-position data analysis results (reconstruction)'; CREATE TABLE TiltImageAlignment ( - movieId int(11) unsigned NOT NULL COMMENT 'FK to Movie table', + movieId int(11) NOT NULL COMMENT 'FK to Movie table', tomogramId int(11) unsigned NOT NULL COMMENT 'FK to Tomogram table; tuple (movieID, tomogramID) is unique', defocusU float COMMENT 'unit: Angstroms', defocusV float COMMENT 'unit: Angstroms', From 8174e5716af78eebe9682c45b66268e6f6c91a03 Mon Sep 17 00:00:00 2001 From: KarlLevik Date: Thu, 19 Jan 2023 17:48:24 +0000 Subject: [PATCH 5/6] Change Tomogram FK dataCollectionId from int(11) unsigned to int(10) unsigned --- schema/updates/2022_06_22_cryo-ET_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema/updates/2022_06_22_cryo-ET_tables.sql b/schema/updates/2022_06_22_cryo-ET_tables.sql index 37c3f82..5dbf693 100644 --- a/schema/updates/2022_06_22_cryo-ET_tables.sql +++ b/schema/updates/2022_06_22_cryo-ET_tables.sql @@ -7,7 +7,7 @@ ALTER TABLE Movie CREATE TABLE Tomogram ( tomogramId int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, - dataCollectionId int(11) unsigned COMMENT 'FK to DataCollection table', + dataCollectionId int(10) unsigned COMMENT 'FK to DataCollection table', autoProcProgramId int(10) unsigned COMMENT 'FK, gives processing times/status and software information', volumeFile varchar(255) COMMENT '.mrc file representing the reconstructed tomogram volume', stackFile varchar(255) NULL DEFAULT NULL COMMENT '.mrc file containing the motion corrected images ordered by angle used as input for the reconstruction', From 5164724db2d7e07d1065a7bebc2f1b146aa038e8 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Wed, 1 Feb 2023 12:28:39 +0000 Subject: [PATCH 6/6] Remove processingJobId as it's not needed --- schema/updates/2023_01_16_Tomogram_new_cols.sql | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/schema/updates/2023_01_16_Tomogram_new_cols.sql b/schema/updates/2023_01_16_Tomogram_new_cols.sql index c421d3c..ce71dbf 100644 --- a/schema/updates/2023_01_16_Tomogram_new_cols.sql +++ b/schema/updates/2023_01_16_Tomogram_new_cols.sql @@ -7,9 +7,7 @@ ALTER TABLE Tomogram ADD xyShiftPlot varchar(255) DEFAULT NULL COMMENT 'XY shift plot file', ADD projXY varchar(255) DEFAULT NULL COMMENT 'XY projection file', ADD projXZ varchar(255) DEFAULT NULL COMMENT 'XZ projection file', - ADD processingJobId int(11) unsigned DEFAULT NULL, - ADD recordTimeStamp datetime DEFAULT current_timestamp() COMMENT 'Creation or last update date/time', - ADD CONSTRAINT Tomogram_fk_processingJobId FOREIGN KEY (processingJobId) REFERENCES ProcessingJob (processingJobId); + ADD recordTimeStamp datetime DEFAULT current_timestamp() COMMENT 'Creation or last update date/time'; /* -- Undo changes @@ -20,9 +18,7 @@ ALTER TABLE Tomogram DROP IF EXISTS xyShiftPlot, DROP IF EXISTS projXY, DROP IF EXISTS projXZ, - DROP IF EXISTS processingJobId, - DROP IF EXISTS recordTimeStamp, - DROP CONSTRAINT IF EXISTS Tomogram_FK_processingJobId; + DROP IF EXISTS recordTimeStamp; */ UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2023_01_16_Tomogram_new_cols.sql';