From 23e20f55e530844c15d1d8ac32b5c89f338d0457 Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Wed, 29 Jun 2011 14:54:29 +0000
Subject: [PATCH] LMS-2340 Improved scripts and fixed service.properties.

SVN: 21908
---
 eu_basynthec/dist/etc/service.properties      |  8 +++---
 .../etc/transcriptomics/data-set-handler.py   | 11 +++++---
 eu_basynthec/etc/service.properties           | 10 +++----
 ...TranscriptomicsDataSetRegistratorTest.java | 27 +++++++++++++++++++
 4 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/eu_basynthec/dist/etc/service.properties b/eu_basynthec/dist/etc/service.properties
index bc8f4aa8b44..5e124c543fe 100644
--- a/eu_basynthec/dist/etc/service.properties
+++ b/eu_basynthec/dist/etc/service.properties
@@ -128,7 +128,7 @@ metabolomics.delete-unidentified = true
 metabolomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 metabolomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 metabolomics.script-path = /local0/openbis/jython_scripts/metabolomics/data-set-handler.py
-metabolomics.validation-script-path = /local0/openbis/jython_scripts/metabolomics/data-set-validator.py
+metabolomics.validation-script-path = /local0/openbis/jython_scripts/shared/shared-classes.py,/local0/openbis/jython_scripts/metabolomics/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # growth-profiles thread configuration
@@ -139,7 +139,7 @@ growth-profiles.delete-unidentified = true
 growth-profiles.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 growth-profiles.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 growth-profiles.script-path = /local0/openbis/jython_scripts/growth-profiles/data-set-handler.py
-growth-profiles.validation-script-path = /local0/openbis/jython_scripts/growth-profiles/data-set-validator.py
+growth-profiles.validation-script-path = /local0/openbis/jython_scripts/shared/shared-classes.py,/local0/openbis/jython_scripts/growth-profiles/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # transcriptomics thread configuration
@@ -150,7 +150,7 @@ transcriptomics.delete-unidentified = true
 transcriptomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 transcriptomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 transcriptomics.script-path = /local0/openbis/jython_scripts/transcriptomics/data-set-handler.py
-transcriptomics.validation-script-path = /local0/openbis/jython_scripts/transcriptomics/data-set-validator.py
+transcriptomics.validation-script-path = /local0/openbis/jython_scripts/shared/shared-classes.py,/local0/openbis/jython_scripts/transcriptomics/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # proteomics thread configuration
@@ -161,7 +161,7 @@ proteomics.delete-unidentified = true
 proteomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 proteomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 proteomics.script-path = /local0/openbis/jython_scripts/proteomics/data-set-handler.py
-proteomics.validation-script-path = /local0/openbis/jython_scripts/proteomics/data-set-validator.py
+proteomics.validation-script-path = /local0/openbis/jython_scripts/shared/shared-classes.py,/local0/openbis/jython_scripts/proteomics/data-set-validator.py
 
 
 #
diff --git a/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py b/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
index fe8f9dc2d18..01507137934 100644
--- a/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
+++ b/eu_basynthec/dist/etc/transcriptomics/data-set-handler.py
@@ -55,9 +55,14 @@ def convert_data_to_tsv(tr, start_row, start_col, dataset, location):
 	tr.createNewDirectory(dataset, location)
 	tsvFileName = tr.createNewFile(dataset, location, incoming.getName() + ".tsv")
 	tsv = open(tsvFileName, 'w')
-	for line in timeSeriesData.getRawDataLines():
-		for i in range(start_row, len(line) - 1):
-			tsv.write(line[i])
+	raw_data = timeSeriesData.getRawDataLines()
+	for i in range(start_row, len(raw_data)):
+		line = raw_data[i]
+		# write the metabolite id
+		tsv.write(line[0])
+		tsv.write("\t")
+		for j in range(start_col, len(line) - 1):
+			tsv.write(line[j])
 			tsv.write("\t")
 		tsv.write(line[len(line) - 1])
 		tsv.write("\n")
diff --git a/eu_basynthec/etc/service.properties b/eu_basynthec/etc/service.properties
index cbbebee853a..7b048f20cc4 100644
--- a/eu_basynthec/etc/service.properties
+++ b/eu_basynthec/etc/service.properties
@@ -56,7 +56,7 @@ notify-successful-registration = false
 server-url = http://localhost:8888
 
 # The username to use when contacting the openBIS server
-username = etlserver
+username = etlserver-basynthec
 
 # The password to use when contacting the openBIS server
 password = etlserver
@@ -137,7 +137,7 @@ metabolomics.delete-unidentified = true
 metabolomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 metabolomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 metabolomics.script-path = dist/etc/metabolomics/data-set-handler.py
-metabolomics.validation-script-path = dist/etc/metabolomics/data-set-validator.py
+metabolomics.validation-script-path = dist/etc/shared/shared-classes.py,dist/etc/metabolomics/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # growth-profiles thread configuration
@@ -148,7 +148,7 @@ growth-profiles.delete-unidentified = true
 growth-profiles.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 growth-profiles.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 growth-profiles.script-path = dist/etc/growth-profiles/data-set-handler.py
-growth-profiles.validation-script-path = dist/etc/growth-profiles/data-set-validator.py
+growth-profiles.validation-script-path = dist/etc/shared/shared-classes.py,dist/etc/growth-profiles/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # transcriptomics thread configuration
@@ -159,7 +159,7 @@ transcriptomics.delete-unidentified = true
 transcriptomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 transcriptomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 transcriptomics.script-path = dist/etc/transcriptomics/data-set-handler.py
-transcriptomics.validation-script-path = dist/etc/transcriptomics/data-set-validator.py
+transcriptomics.validation-script-path = dist/etc/shared/shared-classes.py,dist/etc/transcriptomics/data-set-validator.py
 
 # ---------------------------------------------------------------------------
 # proteomics thread configuration
@@ -170,7 +170,7 @@ proteomics.delete-unidentified = true
 proteomics.top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
 proteomics.storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
 proteomics.script-path = dist/etc/proteomics/data-set-handler.py
-proteomics.validation-script-path = dist/etc/proteomics/data-set-validator.py
+proteomics.validation-script-path = dist/etc/shared/shared-classes.py,dist/etc/proteomics/data-set-validator.py
 
 
 #
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 c7871185a5e..8c26bae1286 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
@@ -16,10 +16,12 @@
 
 package eu.basynthec.cisd.dss.transcriptomics;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Properties;
 
+import org.apache.commons.io.FileUtils;
 import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.common.test.RecordingMatcher;
@@ -64,6 +66,12 @@ public class TranscriptomicsDataSetRegistratorTest extends AbstractBaSynthecData
         assertNotNull(strainProperty);
         assert null != strainProperty;
         assertEquals("MGP253,MGP776", strainProperty.getValue());
+
+        String location = dataSet.getLocation();
+        File tsvFile =
+                new File(new File(workingDirectory, "/1/" + location),
+                        "tsv/Transcriptomics-Example.xlsx.tsv");
+        checkTsvContent(tsvFile);
         context.assertIsSatisfied();
     }
 
@@ -72,4 +80,23 @@ public class TranscriptomicsDataSetRegistratorTest extends AbstractBaSynthecData
     {
         return "dist/etc/transcriptomics/";
     }
+
+    private void checkTsvContent(File tsvFile) throws IOException
+    {
+        String content = FileUtils.readFileToString(tsvFile);
+        assertEquals("Locustag\tMGP253-1 66687802\tMGP776-2 66730002\n"
+                + "BSU00010\t13.7953\t13.5517\n" + "BSU00020\t13.5907\t13.3277\n"
+                + "BSU00030\t13.8489\t13.6306\n" + "BSU00040\t14.3564\t14.1073\n"
+                + "BSU00050\t14.5239\t14.1992\n" + "BSU00060\t14.3293\t13.933\n"
+                + "BSU00070\t14.481\t14.1348\n" + "BSU00090\t15.474\t15.2813\n"
+                + "BSU00100\t14.4332\t14.1945\n" + "BSU00110\t15.2669\t14.9582\n"
+                + "BSU00120\t15.3344\t15.112\n" + "BSU_misc_RNA_1\t15.4497\t15.2485\n"
+                + "BSU00130\t13.6604\t13.5385\n" + "BSU00180\t9.8208\t9.971\n"
+                + "BSU_misc_RNA_2\t13.6614\t14.0933\n" + "BSU00190\t13.464\t13.1213\n"
+                + "BSU00200\t14.6102\t14.4169\n" + "BSU00210\t13.5285\t13.2043\n"
+                + "BSU00220\t13.1007\t12.8862\n" + "BSU00230\t11.8547\t11.6761\n"
+                + "BSU00240\t10.8623\t11.1397\n" + "BSU00250\t11.6694\t11.429\n"
+                + "BSU00260\t11.7669\t11.4658\n" + "BSU00270\t12.2675\t11.8745\n"
+                + "BSU00280\t12.5574\t12.1608\n", content);
+    }
 }
-- 
GitLab