From aa38618d03f9f23d96361af507d2e339621a30cb Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Mon, 11 Jul 2011 13:05:38 +0000
Subject: [PATCH] LMS-2391 Add data type property to the data set types and set
 the property in the drop box.

SVN: 22071
---
 .../dist/etc/growth-profiles/data-set-handler.py         | 6 ++++++
 eu_basynthec/dist/etc/metabolomics/data-set-handler.py   | 5 +++++
 eu_basynthec/dist/etc/proteomics/data-set-handler.py     | 5 +++++
 .../dist/etc/transcriptomics/data-set-handler.py         | 6 ++++++
 .../dss/AbstractBaSynthecDataSetRegistratorTest.java     | 9 +++++++++
 .../dss/growthprofiles/OD600DataSetRegistratorTest.java  | 7 +++++++
 .../metabolomics/MetabolomicsDataSetRegistratorTest.java | 5 +++++
 .../dss/proteomics/ProteomicsDataSetRegistratorTest.java | 5 +++++
 .../TranscriptomicsDataSetRegistratorTest.java           | 7 +++++++
 9 files changed, 55 insertions(+)

diff --git a/eu_basynthec/dist/etc/growth-profiles/data-set-handler.py b/eu_basynthec/dist/etc/growth-profiles/data-set-handler.py
index bc76e78a48d..1bffee7cc3e 100644
--- a/eu_basynthec/dist/etc/growth-profiles/data-set-handler.py
+++ b/eu_basynthec/dist/etc/growth-profiles/data-set-handler.py
@@ -1,6 +1,9 @@
 from datetime import datetime
 from eu.basynthec.cisd.dss import TimeSeriesDataExcel
 
+def set_data_type(data_set):
+  data_set.setPropertyValue("DATA_TYPE", "OD600")
+
 def retrieve_experiment(tr, exp_id):
   """Get the specified experiment form the server. Return the experiment."""
   if exp_id is None:
@@ -102,12 +105,15 @@ assign_properties(dataset, metadata)
 
 # Store the original and tsv data in data sets
 original_dataset = tr.createNewDataSet("EXCEL_ORIGINAL")
+set_data_type(original_dataset)
 store_original_data(tr, original_dataset, "xls")
 
 tsv_dataset = tr.createNewDataSet("TSV_MULTISTRAIN_EXPORT")
+set_data_type(tsv_dataset)
 convert_data_to_tsv(tr, tsv_dataset, "tsv-multi")
 
 tsv_split_dataset = tr.createNewDataSet("TSV_EXPORT")
+set_data_type(tsv_split_dataset)
 convert_data_to_split_tsv(tr, tsv_split_dataset, "tsv")
 
 # Make the original contain these
diff --git a/eu_basynthec/dist/etc/metabolomics/data-set-handler.py b/eu_basynthec/dist/etc/metabolomics/data-set-handler.py
index 56737bf7a8d..eee034223fc 100644
--- a/eu_basynthec/dist/etc/metabolomics/data-set-handler.py
+++ b/eu_basynthec/dist/etc/metabolomics/data-set-handler.py
@@ -1,6 +1,9 @@
 from datetime import datetime
 from eu.basynthec.cisd.dss import TimeSeriesDataExcel
 
+def set_data_type(data_set):
+  data_set.setPropertyValue("DATA_TYPE", "METABOLITE_INTENSITIES")
+
 def retrieve_experiment(tr, exp_id):
   """Get the specified experiment form the server. Return the experiment."""
   if exp_id is None:
@@ -55,9 +58,11 @@ assign_properties(dataset, metadata)
     
 # Store the original and tsv data in data sets                                                                                                                    
 original_dataset = tr.createNewDataSet("EXCEL_ORIGINAL")
+set_data_type(original_dataset)
 store_original_data(tr, original_dataset, "xls")
 
 tsv_dataset = tr.createNewDataSet("TSV_EXPORT")
+set_data_type(tsv_dataset)
 convert_data_to_tsv(tr, tsv_dataset, "tsv")
 
 # Make the original contain these
diff --git a/eu_basynthec/dist/etc/proteomics/data-set-handler.py b/eu_basynthec/dist/etc/proteomics/data-set-handler.py
index 369cf170b58..81da79a7eda 100644
--- a/eu_basynthec/dist/etc/proteomics/data-set-handler.py
+++ b/eu_basynthec/dist/etc/proteomics/data-set-handler.py
@@ -1,6 +1,9 @@
 from datetime import datetime
 from eu.basynthec.cisd.dss import TimeSeriesDataExcel
 
+def set_data_type(data_set):
+  data_set.setPropertyValue("DATA_TYPE", "PROTEIN_QUANTIFICATIONS")
+
 def retrieve_experiment(tr, exp_id):
   """Get the specified experiment form the server. Return the experiment."""
   if exp_id is None:
@@ -56,9 +59,11 @@ assign_properties(dataset, metadata)
 
 # Store the original and tsv data in data sets                                                                                                                    
 original_dataset = tr.createNewDataSet("EXCEL_ORIGINAL")
+set_data_type(original_dataset)
 store_original_data(tr, original_dataset, "xls")
 
 tsv_dataset = tr.createNewDataSet("TSV_EXPORT")
+set_data_type(tsv_dataset)
 convert_data_to_tsv(tr, tsv_dataset, "tsv")
 
 # Make the original contain these
diff --git a/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py b/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
index 81078ecaa8a..55c20c1e6eb 100644
--- a/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
+++ b/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
@@ -2,6 +2,9 @@ from datetime import datetime
 from eu.basynthec.cisd.dss import TimeSeriesDataExcel
 import re
 
+def set_data_type(data_set):
+  data_set.setPropertyValue("DATA_TYPE", "TRANSCRIPTOMICS")
+
 def getInitialDataRowAndCol(metadata):
   """Extract the initial row and column as specified in the metadata. Returns an array with [row, col]."""
   # get the raw value from the map
@@ -169,12 +172,15 @@ assign_properties(dataset, metadata)
 
 # Store the original and tsv data in data sets
 original_dataset = tr.createNewDataSet("EXCEL_ORIGINAL")
+set_data_type(original_dataset)
 store_original_data(tr, original_dataset, "xls")
 
 tsv_dataset = tr.createNewDataSet("TSV_MULTISTRAIN_EXPORT")
+set_data_type(tsv_dataset)
 convert_data_to_tsv(tr, dataStart[0], dataStart[1], tsv_dataset, "tsv-multi")
 
 tsv_split_dataset = tr.createNewDataSet("TSV_EXPORT")
+set_data_type(tsv_split_dataset)
 convert_data_to_split_tsv(tr, dataStart[0], dataStart[1], tsv_split_dataset, "tsv")
 
 # Make the original contain these
diff --git a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/AbstractBaSynthecDataSetRegistratorTest.java b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/AbstractBaSynthecDataSetRegistratorTest.java
index 4cf7b8ae70c..3091229a84a 100644
--- a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/AbstractBaSynthecDataSetRegistratorTest.java
+++ b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/AbstractBaSynthecDataSetRegistratorTest.java
@@ -35,6 +35,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.builders.ExperimentBuilder;
 import ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationDetails;
 import ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationResult;
+import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData;
 import ch.systemsx.cisd.openbis.generic.shared.dto.NewProperty;
 import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory;
 
@@ -154,4 +155,12 @@ public abstract class AbstractBaSynthecDataSetRegistratorTest extends
         return propertyMap;
     }
 
+    protected void checkDataTypeProperty(NewExternalData dataSet, String expectedValue)
+    {
+        HashMap<String, NewProperty> propertyMap =
+                getDataSetPropertiesMap(dataSet.getDataSetProperties());
+        NewProperty property = propertyMap.get("DATA_TYPE");
+        assertEquals(expectedValue, property.getValue());
+    }
+
 }
\ No newline at end of file
diff --git a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/growthprofiles/OD600DataSetRegistratorTest.java b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/growthprofiles/OD600DataSetRegistratorTest.java
index 8205496cd8a..91b1e6cfd3f 100644
--- a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/growthprofiles/OD600DataSetRegistratorTest.java
+++ b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/growthprofiles/OD600DataSetRegistratorTest.java
@@ -55,6 +55,13 @@ public class OD600DataSetRegistratorTest extends AbstractBaSynthecDataSetRegistr
 
         assertEquals(4, atomicOperationDetails.recordedObject().getDataSetRegistrations().size());
 
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(1), "OD600");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(2), "OD600");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(3), "OD600");
+
         NewExternalData dataSet =
                 atomicOperationDetails.recordedObject().getDataSetRegistrations().get(0);
 
diff --git a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/metabolomics/MetabolomicsDataSetRegistratorTest.java b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/metabolomics/MetabolomicsDataSetRegistratorTest.java
index 641a9ed8277..2a233e66a0f 100644
--- a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/metabolomics/MetabolomicsDataSetRegistratorTest.java
+++ b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/metabolomics/MetabolomicsDataSetRegistratorTest.java
@@ -51,6 +51,11 @@ public class MetabolomicsDataSetRegistratorTest extends AbstractBaSynthecDataSet
 
         assertEquals(3, atomicOperationDetails.recordedObject().getDataSetRegistrations().size());
 
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(1), "PROTEIN_QUANTIFICATIONS");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(2), "PROTEIN_QUANTIFICATIONS");
+
         NewExternalData dataSet =
                 atomicOperationDetails.recordedObject().getDataSetRegistrations().get(0);
 
diff --git a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/proteomics/ProteomicsDataSetRegistratorTest.java b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/proteomics/ProteomicsDataSetRegistratorTest.java
index 3a710758234..6946eace5f1 100644
--- a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/proteomics/ProteomicsDataSetRegistratorTest.java
+++ b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/proteomics/ProteomicsDataSetRegistratorTest.java
@@ -51,6 +51,11 @@ public class ProteomicsDataSetRegistratorTest extends AbstractBaSynthecDataSetRe
 
         assertEquals(3, atomicOperationDetails.recordedObject().getDataSetRegistrations().size());
 
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(1), "METABOLITE_INTENSITIES");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(2), "METABOLITE_INTENSITIES");
+
         NewExternalData dataSet =
                 atomicOperationDetails.recordedObject().getDataSetRegistrations().get(0);
 
diff --git a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/transcriptomics/TranscriptomicsDataSetRegistratorTest.java b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/transcriptomics/TranscriptomicsDataSetRegistratorTest.java
index 1131553c802..11ea320a123 100644
--- a/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/transcriptomics/TranscriptomicsDataSetRegistratorTest.java
+++ b/eu_basynthec/sourceTest/java/eu/basynthec/cisd/dss/transcriptomics/TranscriptomicsDataSetRegistratorTest.java
@@ -55,6 +55,13 @@ public class TranscriptomicsDataSetRegistratorTest extends AbstractBaSynthecData
 
         assertEquals(4, atomicOperationDetails.recordedObject().getDataSetRegistrations().size());
 
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(1), "TRANSCRIPTOMICS");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(2), "TRANSCRIPTOMICS");
+        checkDataTypeProperty(atomicOperationDetails.recordedObject().getDataSetRegistrations()
+                .get(3), "TRANSCRIPTOMICS");
+
         NewExternalData dataSet =
                 atomicOperationDetails.recordedObject().getDataSetRegistrations().get(0);
 
-- 
GitLab