From 6ebe7a19bd6a245ffd2dd49e7330c00f4b95486b Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Wed, 3 Mar 2021 17:57:11 +0000 Subject: [PATCH 1/2] Proposed new tables for CryoEM. Beware: these are subject to change --- .../updates/2021_03_03_cryoEMv2_0_tables.sql | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql diff --git a/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql b/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql new file mode 100644 index 00000000..83fb9dcb --- /dev/null +++ b/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql @@ -0,0 +1,72 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2021_03_03_cryoEMv2_0_tables.sql', 'ONGOING'); + +CREATE TABLE ParticlePicker ( + particlePickerId int unsigned auto_increment PRIMARY KEY, + autoProcProgramId int unsigned, + firstMotionCorrectionId int unsigned, + particlePickingTemplate varchar(255) COMMENT 'Cryolo model', + particleDiameter float COMMENT 'Unit: nm', + numberOfParticles int unsigned, + CONSTRAINT `ParticlePicker_fk_autoProcProgramId` + FOREIGN KEY (`autoProcProgramId`) + REFERENCES `AutoProcProgram` (`autoProcProgramId`) + ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `ParticlePicker_fk_motionCorrectionId` + FOREIGN KEY (`firstMotionCorrectionId`) + REFERENCES `MotionCorrection` (`motionCorrectionId`) + ON DELETE NO ACTION ON UPDATE CASCADE +) +COMMENT 'An instance of a particle picker program that was run'; + +-- 2D and 3D particle classification fields are almost the same, so using +-- the same tables seems to make sense: +CREATE TABLE ParticleClassification ( + particleClassificationId int unsigned auto_increment PRIMARY KEY, + particlePickerId int unsigned, + type enum('2D', '3D') COMMENT 'Indicates the type of particle classification', + batchNumber int unsigned COMMENT 'Corresponding to batch number', + classNumber int unsigned COMMENT 'Identified of the class. A unique ID given by Relion', + numberOfParticlesPerBatch int unsigned COMMENT 'total number of particles per batch (a large integer)', + numberOfClassesPerBatch int unsigned, + particlesPerClass int unsigned COMMENT 'Number of particles within the selected class, can then be used together with the total number above to calculate the percentage', -- is this just numberOfParticlesPerBatch * numberOfClassesPerBatch ? If so, this column is unnecessary. + rotationAccuracy int unsigned COMMENT '???', -- or "accuracyRotations" as in spreadsheet? float? + translationAccuracy float COMMENT 'Unit: Angstroms', + estimatedResolution float COMMENT '???, Unit: Angstroms', + overallFourierCompleteness float, + symmetry varchar(20), + -- classRepresentativePreview ?, + CONSTRAINT `ParticleClassification_fk_particlePickerId` + FOREIGN KEY (`particlePickerId`) + REFERENCES `ParticlePicker` (`particlePickerId`) + ON DELETE CASCADE ON UPDATE CASCADE +) +COMMENT 'Results of 2D or 2D classification'; + +-- Are we creating a "final" model later? If so, should they +-- go into the same table? +-- Also, the ispyb schema has a couple of other "model" tables, so this should +-- probably have some kind of prefix to make clear it's for EM. +CREATE TABLE CryoemInitialModel ( + cryoemInitialModelId int unsigned auto_increment PRIMARY KEY, + resolution float COMMENT 'Unit: Angstroms', + numberOfParticles int unsigned +) +COMMENT 'Initial cryo-EM model generation results'; + +-- n:m relationship between ParticleClassification and InitialModel: +CREATE TABLE ParticleClassification_has_CryoemInitialModel ( + particleClassificationId int unsigned, + cryoemInitialModelId int unsigned, + PRIMARY KEY (particleClassificationId, cryoemInitialModelId), + CONSTRAINT `ParticleClassification_has_CryoemInitialModel_fk1` + FOREIGN KEY (`particleClassificationId`) + REFERENCES `ParticleClassification` (`particleClassificationId`) + ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `ParticleClassification_has_InitialModel_fk2` + FOREIGN KEY (`cryoemInitialModelId`) + REFERENCES `CryoemInitialModel` (`cryoemInitialModelId`) + ON DELETE CASCADE ON UPDATE CASCADE +); + + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2021_03_03_cryoEMv2_0_tables.sql'; From 277c27c12c3f36d3772d186f7a886121df5ccbd5 Mon Sep 17 00:00:00 2001 From: Karl Levik Date: Thu, 4 Mar 2021 15:37:48 +0000 Subject: [PATCH 2/2] Add ParticleClassification.classImageFullPath + modify ParticlePicker table --- .../ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql b/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql index 83fb9dcb..969edf76 100644 --- a/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql +++ b/schemas/ispyb/updates/2021_03_03_cryoEMv2_0_tables.sql @@ -2,13 +2,18 @@ INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2021_03_03_c CREATE TABLE ParticlePicker ( particlePickerId int unsigned auto_increment PRIMARY KEY, - autoProcProgramId int unsigned, + particlePickerProgramId int unsigned, + particleClassificationProgramId int unsigned, firstMotionCorrectionId int unsigned, particlePickingTemplate varchar(255) COMMENT 'Cryolo model', particleDiameter float COMMENT 'Unit: nm', numberOfParticles int unsigned, - CONSTRAINT `ParticlePicker_fk_autoProcProgramId` - FOREIGN KEY (`autoProcProgramId`) + CONSTRAINT `ParticlePicker_fk_particlePickerProgramId` + FOREIGN KEY (`particlePickerProgramId`) + REFERENCES `AutoProcProgram` (`autoProcProgramId`) + ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `ParticlePicker_fk_particleClassificationProgramId` + FOREIGN KEY (`particleClassificationProgramId`) REFERENCES `AutoProcProgram` (`autoProcProgramId`) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `ParticlePicker_fk_motionCorrectionId` @@ -26,6 +31,7 @@ CREATE TABLE ParticleClassification ( type enum('2D', '3D') COMMENT 'Indicates the type of particle classification', batchNumber int unsigned COMMENT 'Corresponding to batch number', classNumber int unsigned COMMENT 'Identified of the class. A unique ID given by Relion', + classImageFullPath varchar(255) COMMENT 'The PNG of the class', numberOfParticlesPerBatch int unsigned COMMENT 'total number of particles per batch (a large integer)', numberOfClassesPerBatch int unsigned, particlesPerClass int unsigned COMMENT 'Number of particles within the selected class, can then be used together with the total number above to calculate the percentage', -- is this just numberOfParticlesPerBatch * numberOfClassesPerBatch ? If so, this column is unnecessary.