diff --git a/screening/source/core-plugins/screening/1/dss/reporting-plugins/default-plate-image-analysis/plugin.properties b/screening/source/core-plugins/screening/1/dss/reporting-plugins/default-plate-image-analysis/plugin.properties index 5a2f11acc9610f1915234e1bf6aaec90126cdb40..136a7a6b380f0cb396813ad865b7c65ed909644b 100644 --- a/screening/source/core-plugins/screening/1/dss/reporting-plugins/default-plate-image-analysis/plugin.properties +++ b/screening/source/core-plugins/screening/1/dss/reporting-plugins/default-plate-image-analysis/plugin.properties @@ -1,4 +1,4 @@ label = Image Analysis Results class = ch.systemsx.cisd.openbis.dss.generic.server.plugins.ImageAnalysisMergedRowsReportingPlugin -dataset-types = HCS_ANALYSIS_WELL_FEATURES +dataset-types = HCS_ANALYSIS_WELL_FEATURES_CONTAINER,HCS_ANALYSIS_WELL_FEATURES properties-file = diff --git a/screening/source/core-plugins/screening/1/as/initialize-master-data.py b/screening/source/core-plugins/screening/2/as/initialize-master-data.py similarity index 98% rename from screening/source/core-plugins/screening/1/as/initialize-master-data.py rename to screening/source/core-plugins/screening/2/as/initialize-master-data.py index b8ae4367241115c3769bdd01bc9086ccdfb7a454..9ae0ea6f9fd39ecbf2b1636079d3004dad3fe9e1 100644 --- a/screening/source/core-plugins/screening/1/as/initialize-master-data.py +++ b/screening/source/core-plugins/screening/2/as/initialize-master-data.py @@ -196,6 +196,10 @@ data_set_type_HCS_IMAGE_CONTAINER_SEGMENTATION = tr.getOrCreateNewDataSetType('H data_set_type_HCS_IMAGE_CONTAINER_SEGMENTATION.setDescription('Container for HCS segmentation (a.k.a. overlays) images of different resolutions (original, overviews, thumbnails).') data_set_type_HCS_IMAGE_CONTAINER_SEGMENTATION.setContainerType(True) +data_set_type_HCS_ANALYSIS_WELL_FEATURES_CONTAINER = tr.getOrCreateNewDataSetType('HCS_ANALYSIS_WELL_FEATURES_CONTAINER') +data_set_type_HCS_ANALYSIS_WELL_FEATURES_CONTAINER.setDescription('Container for HCS image analysis well feature vectors.') +data_set_type_HCS_ANALYSIS_WELL_FEATURES_CONTAINER.setContainerType(True) + # Exists in the database by default #data_set_type_UNKNOWN = tr.getOrCreateNewDataSetType('UNKNOWN') #data_set_type_UNKNOWN.setDescription('Unknown') @@ -337,7 +341,7 @@ assignment_MATERIAL_GENE_GENE_SYMBOLS.setMandatory(False) assignment_MATERIAL_GENE_GENE_SYMBOLS.setSection(None) assignment_MATERIAL_GENE_GENE_SYMBOLS.setPositionInForms(4) -assignment_DATA_SET_HCS_ANALYSIS_WELL_FEATURES_ANALYSIS_PROCEDURE = tr.assignPropertyType(data_set_type_HCS_ANALYSIS_WELL_FEATURES, prop_type_ANALYSIS_PROCEDURE) +assignment_DATA_SET_HCS_ANALYSIS_WELL_FEATURES_ANALYSIS_PROCEDURE = tr.assignPropertyType(data_set_type_HCS_ANALYSIS_WELL_FEATURES_CONTAINER, prop_type_ANALYSIS_PROCEDURE) assignment_DATA_SET_HCS_ANALYSIS_WELL_FEATURES_ANALYSIS_PROCEDURE.setMandatory(False) assignment_DATA_SET_HCS_ANALYSIS_WELL_FEATURES_ANALYSIS_PROCEDURE.setSection(None) assignment_DATA_SET_HCS_ANALYSIS_WELL_FEATURES_ANALYSIS_PROCEDURE.setPositionInForms(1) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java index fbbd2235b1fe1c571f09c2db03f4afd7d217df49..871261f80b38efcf0a5180c01076ca6b701ca0ba 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/PlateStorageProcessor.java @@ -31,6 +31,7 @@ import ch.systemsx.cisd.openbis.dss.etl.dataaccess.IImagingQueryDAO; import ch.systemsx.cisd.openbis.dss.etl.dto.ImageDatasetInfo; import ch.systemsx.cisd.openbis.dss.etl.dto.ImageLibraryInfo; import ch.systemsx.cisd.openbis.dss.etl.dto.ImageZoomLevel; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorDataSetInformation; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.ImageDataSetInformation; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.ThumbnailsInfo; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.ThumbnailsStorageFormat.FileFormat; @@ -83,8 +84,18 @@ public final class PlateStorageProcessor extends AbstractImageStorageProcessor { public static DatasetOwnerInformation create(DataSetInformation dataSetInformation) { - return new DatasetOwnerInformation(dataSetInformation.getDataSetCode(), - dataSetInformation); + String datasetCode; + + if (dataSetInformation instanceof FeatureVectorDataSetInformation) + { + datasetCode = + ((FeatureVectorDataSetInformation) dataSetInformation) + .getContainerDatasetPermId(); + } else + { + datasetCode = dataSetInformation.getDataSetCode(); + } + return new DatasetOwnerInformation(datasetCode, dataSetInformation); } private final Experiment experiment; diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorContainerDataSet.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorContainerDataSet.java new file mode 100644 index 0000000000000000000000000000000000000000..2fd157e7a69337b64d20e9eb55ed6c594bc3be8b --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorContainerDataSet.java @@ -0,0 +1,105 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.dto.api.impl; + +import java.io.File; + +import ch.systemsx.cisd.etlserver.registrator.DataSetRegistrationDetails; +import ch.systemsx.cisd.etlserver.registrator.api.v1.IDataSet; +import ch.systemsx.cisd.etlserver.registrator.api.v1.impl.DataSet; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.IFeatureVectorDataSet; +import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v1.IExperimentImmutable; +import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v1.ISampleImmutable; +import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; + +/** + * @author jakubs + */ +public class FeatureVectorContainerDataSet extends DataSet<DataSetInformation> implements + IFeatureVectorDataSet +{ + + /** + * @param registrationDetails + * @param dataSetFolder + * @param service + */ + public FeatureVectorContainerDataSet( + DataSetRegistrationDetails<? extends DataSetInformation> registrationDetails, + File dataSetFolder, IEncapsulatedOpenBISService service) + { + super(registrationDetails, dataSetFolder, service); + } + + private FeatureVectorDataSet originalDataset; + + public IDataSet getOriginalDataset() + { + return originalDataset; + } + + public void setOriginalDataSet(FeatureVectorDataSet mainDataSet) + { + this.originalDataset = mainDataSet; + } + + @Override + public void setAnalysisProcedure(String analysisProcedure) + { + originalDataset.setAnalysisProcedure(analysisProcedure); + } + + @Override + public void setSample(ISampleImmutable sampleOrNull) + { + super.setSample(sampleOrNull); + if (originalDataset != null) + { + originalDataset.setSample(sampleOrNull); + // calling this line assures, that the sample in the contained dataset will not be kept. + originalDataset.getRegistrationDetails().getDataSetInformation().setLinkSample(false); + } + } + + @Override + public void setExperiment(IExperimentImmutable experimentOrNull) + { + super.setExperiment(experimentOrNull); + if (originalDataset != null) + { + originalDataset.setExperiment(experimentOrNull); + } + } + + @Override + public void setDataSetType(String dataSetTypeCode) + { + throw new IllegalStateException( + "It is illegal to manually set dataSetType of the feature vector dataset."); + } + + @Override + public void setPropertyValue(String propertyCode, String propertyValue) + { + if (originalDataset != null) + { + originalDataset.setPropertyValue(propertyCode, propertyValue); + } + } + +} diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorDataSetInformation.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorDataSetInformation.java index 31546a1008b8106309db8046abb81596edeba48b..07f4ad65da63ce5c8af4a0ff29cacb4249835751 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorDataSetInformation.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/dto/api/impl/FeatureVectorDataSetInformation.java @@ -40,6 +40,8 @@ public class FeatureVectorDataSetInformation extends DataSetInformation private List<FeatureDefinition> features; + private String containerDatasetPermId; + public FeatureVectorDataSetInformation() { this.features = new ArrayList<FeatureDefinition>(); @@ -84,4 +86,14 @@ public class FeatureVectorDataSetInformation extends DataSetInformation return dto; } + public String getContainerDatasetPermId() + { + return containerDatasetPermId; + } + + public void setContainerDatasetPermId(String containerDatasetPermId) + { + this.containerDatasetPermId = containerDatasetPermId; + } + } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/FeatureVectorContainerDataSetRegistrationFactory.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/FeatureVectorContainerDataSetRegistrationFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..70a6ba9e212da71c00a3d110b32ac86f4be9bce0 --- /dev/null +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/FeatureVectorContainerDataSetRegistrationFactory.java @@ -0,0 +1,56 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.dss.etl.jython; + +import java.io.File; + +import ch.systemsx.cisd.etlserver.registrator.AbstractDataSetRegistrationDetailsFactory; +import ch.systemsx.cisd.etlserver.registrator.DataSetRegistrationDetails; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorContainerDataSet; +import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; +import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; + +/** + * Factory class that creates FeatureVectorContainerDataSet + * + * @author jakubs + */ +public class FeatureVectorContainerDataSetRegistrationFactory extends + AbstractDataSetRegistrationDetailsFactory<DataSetInformation> +{ + + public FeatureVectorContainerDataSetRegistrationFactory( + ch.systemsx.cisd.etlserver.registrator.AbstractOmniscientTopLevelDataSetRegistrator.OmniscientTopLevelDataSetRegistratorState registratorState, + DataSetInformation userProvidedDataSetInformationOrNull) + { + super(registratorState, userProvidedDataSetInformationOrNull); + } + + @Override + public FeatureVectorContainerDataSet createDataSet( + DataSetRegistrationDetails<DataSetInformation> registrationDetails, File stagingFile) + { + IEncapsulatedOpenBISService service = registratorState.getGlobalState().getOpenBisService(); + return new FeatureVectorContainerDataSet(registrationDetails, stagingFile, service); + } + + @Override + protected DataSetInformation createDataSetInformation() + { + return new DataSetInformation(); + } +} \ No newline at end of file diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/ImagingDataSetRegistrationTransaction.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/ImagingDataSetRegistrationTransaction.java index bacdac92127e8ec62461004eb2f4bb697a720a43..7c42263bff223bce3b05ecabe4013bc6d27afc2b 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/ImagingDataSetRegistrationTransaction.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/ImagingDataSetRegistrationTransaction.java @@ -20,11 +20,14 @@ import static ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.Screeni import static ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants.MICROSCOPY_IMAGE_TYPE_SUBSTRING; import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; +import java.util.Properties; +import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.common.io.FileBasedContentNode; import ch.systemsx.cisd.etlserver.registrator.DataSetRegistrationDetails; @@ -38,7 +41,11 @@ import ch.systemsx.cisd.openbis.dss.Constants; import ch.systemsx.cisd.openbis.dss.etl.Hdf5ThumbnailGenerator; import ch.systemsx.cisd.openbis.dss.etl.Utils; import ch.systemsx.cisd.openbis.dss.etl.dto.ImageLibraryInfo; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureDefinition; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorContainerDataSet; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorDataSet; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorDataSetInformation; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeaturesBuilder; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.ImageContainerDataSet; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.ImageDataSetInformation; import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.ImageDataSetStructure; @@ -48,6 +55,9 @@ import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.IImagingDataSetRegistrationTr import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.ImageFileInfo; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.SimpleImageDataConfig; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.ThumbnailsStorageFormat; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.IFeatureVectorDataSet; +import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.SimpleFeatureVectorDataConfig; +import ch.systemsx.cisd.openbis.dss.etl.featurevector.CsvFeatureVectorParser; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; import ch.systemsx.cisd.openbis.dss.generic.shared.dto.Size; import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConstants; @@ -112,6 +122,49 @@ public class ImagingDataSetRegistrationTransaction extends DataSetRegistrationTr return createNewImageDataSet(details); } + /** + * Creates new container dataset which contains one feature vector dataset. + */ + public IFeatureVectorDataSet createNewFeatureVectorDataSet( + SimpleFeatureVectorDataConfig featureDataSetConfig, File featureVectorFileOrNull) + { + List<FeatureDefinition> featureDefinitions; + Properties properties = featureDataSetConfig.getProperties(); + if (properties == null) + { + featureDefinitions = + ((FeaturesBuilder) featureDataSetConfig.getFeaturesBuilder()) + .getFeatureDefinitionValuesList(); + } else + { + try + { + featureDefinitions = + CsvFeatureVectorParser.parse(featureVectorFileOrNull, properties); + } catch (IOException ex) + { + throw CheckedExceptionTunnel.wrapIfNecessary(ex); + } + } + DataSetRegistrationDetails<FeatureVectorDataSetInformation> registrationDetails = + factory.createFeatureVectorRegistrationDetails(featureDefinitions); + @SuppressWarnings("unchecked") + DataSet<FeatureVectorDataSetInformation> dataSet = + (DataSet<FeatureVectorDataSetInformation>) createNewDataSet(registrationDetails); + + FeatureVectorDataSet featureDataset = + new FeatureVectorDataSet(dataSet, getGlobalState().getOpenBisService()); + + // create container + FeatureVectorContainerDataSet containerDataset = + createFeatureVectorContainerDataSet(featureDataset); + + registrationDetails.getDataSetInformation().setContainerDatasetPermId( + containerDataset.getDataSetCode()); + + return containerDataset; + } + /** * Creates container dataset which contains dataset with original images (created on the fly). * If thumbnails are required they are generated and moved to a thumbnail dataset which becomes @@ -269,6 +322,22 @@ public class ImagingDataSetRegistrationTransaction extends DataSetRegistrationTr return containerDataset; } + private FeatureVectorContainerDataSet createFeatureVectorContainerDataSet( + FeatureVectorDataSet mainDataset) + { + String containerDatasetTypeCode = "HCS_ANALYSIS_WELL_FEATURES_CONTAINER"; + @SuppressWarnings("unchecked") + FeatureVectorContainerDataSet containerDataSet = + (FeatureVectorContainerDataSet) createNewDataSet( + factory.featureVectorContainerDatasetFactory, containerDatasetTypeCode); + containerDataSet.setContainedDataSetCodes(Collections.singletonList(mainDataset + .getDataSetCode())); + + containerDataSet.setOriginalDataSet(mainDataset); + + return containerDataSet; + } + // Copies properties and relations to datasets from the main dataset to the container and // resets them in the main dataset. private static void moveDatasetRelations(IDataSet mainDataset, IDataSet containerDataset) @@ -398,13 +467,10 @@ public class ImagingDataSetRegistrationTransaction extends DataSetRegistrationTr public String moveFile(String src, IDataSet dst, String dstInDataset) { ImageContainerDataSet imageContainerDataset = tryAsImageContainerDataset(dst); + if (imageContainerDataset != null) { - String destination = dstInDataset; - if (destination.startsWith(originalDirName) == false) - { - destination = prependOriginalDirectory(destination).getPath(); - } + String destination = getDestinationInOriginal(dstInDataset); DataSet<ImageDataSetInformation> originalDataset = imageContainerDataset.getOriginalDataset(); if (originalDataset == null) @@ -416,10 +482,42 @@ public class ImagingDataSetRegistrationTransaction extends DataSetRegistrationTr .setDatasetRelativeImagesFolderPath(new File(destination)); return super.moveFile(src, originalDataset, destination); - } else + } + + FeatureVectorContainerDataSet featureContainer = tryAsFeatureVectorContainerDataset(dst); + if (featureContainer != null) + { + IDataSet originalDataSet = featureContainer.getOriginalDataset(); + + if (originalDataSet == null) + { + throw new UserFailureException( + "Cannot move the files because the original dataset is missing: " + src); + } + + return super.moveFile(src, originalDataSet, getDestinationInOriginal(dstInDataset)); + } + + return super.moveFile(src, dst, dstInDataset); + } + + private String getDestinationInOriginal(String dstInDataset) + { + String destination = dstInDataset; + if (destination.startsWith(originalDirName) == false) + { + destination = prependOriginalDirectory(destination).getPath(); + } + return destination; + } + + private static FeatureVectorContainerDataSet tryAsFeatureVectorContainerDataset(IDataSet dataset) + { + if (dataset instanceof FeatureVectorContainerDataSet) { - return super.moveFile(src, dst, dstInDataset); + return (FeatureVectorContainerDataSet) dataset; } + return null; } private static ImageContainerDataSet tryAsImageContainerDataset(IDataSet dataset) diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/JythonPlateDatasetFactory.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/JythonPlateDatasetFactory.java index 6ec83543850915a81c255cd3dc3534fb3e49ab0a..3725195121e1f14de133a8e5e86ca516516c1fcb 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/JythonPlateDatasetFactory.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/JythonPlateDatasetFactory.java @@ -46,13 +46,15 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.basic.dto.ScreeningConst * @author jakubs */ -public class JythonPlateDatasetFactory extends ProgrammableDropboxObjectFactory<DataSetInformation> implements - IImagingDatasetFactory +public class JythonPlateDatasetFactory extends ProgrammableDropboxObjectFactory<DataSetInformation> + implements IImagingDatasetFactory { final IDataSetRegistrationDetailsFactory<ImageDataSetInformation> imageDatasetFactory; final IDataSetRegistrationDetailsFactory<DataSetInformation> imageContainerDatasetFactory; + final IDataSetRegistrationDetailsFactory<DataSetInformation> featureVectorContainerDatasetFactory; + final IDataSetRegistrationDetailsFactory<FeatureVectorDataSetInformation> featureVectorDatasetFactory; public JythonPlateDatasetFactory(OmniscientTopLevelDataSetRegistratorState registratorState, @@ -66,8 +68,8 @@ public class JythonPlateDatasetFactory extends ProgrammableDropboxObjectFactory< new JythonImageDataSetRegistrationFactory(this.registratorState, this.userProvidedDataSetInformationOrNull); this.featureVectorDatasetFactory = - new ProgrammableDropboxObjectFactory<FeatureVectorDataSetInformation>(this.registratorState, - this.userProvidedDataSetInformationOrNull) + new ProgrammableDropboxObjectFactory<FeatureVectorDataSetInformation>( + this.registratorState, this.userProvidedDataSetInformationOrNull) { @Override protected FeatureVectorDataSetInformation createDataSetInformation() @@ -75,6 +77,10 @@ public class JythonPlateDatasetFactory extends ProgrammableDropboxObjectFactory< return new FeatureVectorDataSetInformation(); } }; + + this.featureVectorContainerDatasetFactory = + new FeatureVectorContainerDataSetRegistrationFactory(this.registratorState, + this.userProvidedDataSetInformationOrNull); } /** By default a standard dataset is created. */ @@ -125,7 +131,8 @@ public class JythonPlateDatasetFactory extends ProgrammableDropboxObjectFactory< public String figureGeometry( DataSetRegistrationDetails<ImageDataSetInformation> registrationDetails) { - IEncapsulatedOpenBISService openBisService = registratorState.getGlobalState().getOpenBisService(); + IEncapsulatedOpenBISService openBisService = + registratorState.getGlobalState().getOpenBisService(); return PlateGeometryOracle.figureGeometry(registrationDetails, openBisService); } diff --git a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/v2/ImagingDataSetRegistrationTransactionV2Delegate.java b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/v2/ImagingDataSetRegistrationTransactionV2Delegate.java index 8a66c3aa36560cf3b2aaed01d20dc8ac3158a158..711f9d0841d58f24b2fdbd591613f5d810d46481 100644 --- a/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/v2/ImagingDataSetRegistrationTransactionV2Delegate.java +++ b/screening/source/java/ch/systemsx/cisd/openbis/dss/etl/jython/v2/ImagingDataSetRegistrationTransactionV2Delegate.java @@ -17,16 +17,11 @@ package ch.systemsx.cisd.openbis.dss.etl.jython.v2; import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Properties; import net.lemnik.eodsql.DynamicTransactionQuery; -import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; import ch.systemsx.cisd.etlserver.TopLevelDataSetRegistratorGlobalState; import ch.systemsx.cisd.etlserver.registrator.DataSetRegistrationContext; -import ch.systemsx.cisd.etlserver.registrator.DataSetRegistrationDetails; import ch.systemsx.cisd.etlserver.registrator.api.v1.IDataSet; import ch.systemsx.cisd.etlserver.registrator.api.v1.IDataSetUpdatable; import ch.systemsx.cisd.etlserver.registrator.api.v1.IExperiment; @@ -35,17 +30,11 @@ import ch.systemsx.cisd.etlserver.registrator.api.v1.IMaterial; import ch.systemsx.cisd.etlserver.registrator.api.v1.IProject; import ch.systemsx.cisd.etlserver.registrator.api.v1.ISample; import ch.systemsx.cisd.etlserver.registrator.api.v1.ISpace; -import ch.systemsx.cisd.etlserver.registrator.api.v1.impl.DataSet; -import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureDefinition; -import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorDataSet; -import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeatureVectorDataSetInformation; -import ch.systemsx.cisd.openbis.dss.etl.dto.api.impl.FeaturesBuilder; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.IImageDataSet; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v1.SimpleImageDataConfig; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.IFeatureVectorDataSet; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.IImagingDataSetRegistrationTransactionV2; import ch.systemsx.cisd.openbis.dss.etl.dto.api.v2.SimpleFeatureVectorDataConfig; -import ch.systemsx.cisd.openbis.dss.etl.featurevector.CsvFeatureVectorParser; import ch.systemsx.cisd.openbis.dss.etl.jython.ImagingDataSetRegistrationTransaction; import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.authorization.IAuthorizationService; import ch.systemsx.cisd.openbis.dss.generic.shared.api.internal.v1.IDataSetImmutable; @@ -82,31 +71,8 @@ public class ImagingDataSetRegistrationTransactionV2Delegate implements public IFeatureVectorDataSet createNewFeatureVectorDataSet( SimpleFeatureVectorDataConfig featureDataSetConfig, File featureVectorFileOrNull) { - List<FeatureDefinition> featureDefinitions; - Properties properties = featureDataSetConfig.getProperties(); - if (properties == null) - { - featureDefinitions = - ((FeaturesBuilder) featureDataSetConfig.getFeaturesBuilder()) - .getFeatureDefinitionValuesList(); - } else - { - try - { - featureDefinitions = - CsvFeatureVectorParser.parse(featureVectorFileOrNull, properties); - } catch (IOException ex) - { - throw CheckedExceptionTunnel.wrapIfNecessary(ex); - } - } - DataSetRegistrationDetails<FeatureVectorDataSetInformation> registrationDetails = - transaction.getFactory().createFeatureVectorRegistrationDetails(featureDefinitions); - @SuppressWarnings("unchecked") - DataSet<FeatureVectorDataSetInformation> dataSet = - (DataSet<FeatureVectorDataSetInformation>) transaction - .createNewDataSet(registrationDetails); - return new FeatureVectorDataSet(dataSet, transaction.getGlobalState().getOpenBisService()); + return transaction.createNewFeatureVectorDataSet(featureDataSetConfig, + featureVectorFileOrNull); } @Override diff --git a/screening/source/sql/postgresql/migration/migration-115-116.sql b/screening/source/sql/postgresql/migration/migration-115-116.sql new file mode 100644 index 0000000000000000000000000000000000000000..c491764ab56b9c3a6e17e185bce3c68701364037 --- /dev/null +++ b/screening/source/sql/postgresql/migration/migration-115-116.sql @@ -0,0 +1,26 @@ +------------------------------------------------------- +-- migrate custom property types from HCS_ANALYSIS_WELL_FEATURES to HCS_ANALYSIS_WELL_FEATURES_CONTAINER +------------------------------------------------------- + + +insert into data_set_type_property_types( id, dsty_id, prty_id, is_mandatory, is_managed_internally, pers_id_registerer, registration_timestamp, ordinal, section, script_id, is_shown_edit ) + +select + nextval('dstpt_id_seq'), + container.id, + dstpt.prty_id, + dstpt.is_mandatory, + dstpt.is_managed_internally, + dstpt.pers_id_registerer, + now(), + dstpt.ordinal, + dstpt.section, + dstpt.script_id, + dstpt.is_shown_edit +from + data_set_type_property_types dstpt, + data_set_types container +where + dstpt.dsty_id = (select dst.id from data_set_types dst where dst.code = 'HCS_ANALYSIS_WELL_FEATURES') AND + dstpt.prty_id <> (select id from property_types where code = 'ANALYSIS_PROCEDURE') AND + container.code = 'HCS_ANALYSIS_WELL_FEATURES_CONTAINER'; \ No newline at end of file