From ff85f132061f79d4f120599fb2812945f482b600 Mon Sep 17 00:00:00 2001
From: kohleman <kohleman>
Date: Mon, 21 May 2012 13:41:25 +0000
Subject: [PATCH] new drop box for a complete flow cell output

SVN: 25317
---
 .../plugin.properties                         | 11 +++++
 .../register-flowcell-dropbox.py              | 46 +++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/plugin.properties
 create mode 100644 deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/register-flowcell-dropbox.py

diff --git a/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/plugin.properties b/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/plugin.properties
new file mode 100644
index 00000000000..7534e445085
--- /dev/null
+++ b/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/plugin.properties
@@ -0,0 +1,11 @@
+# 
+# Drop box for registering a flow cell output as a data set
+#
+# Variables:
+#   incoming-root-dir
+#     Path to the directory which contains incoming directories for drop boxes.
+incoming-dir = ${incoming-root-dir}/incoming-register-flowcell
+incoming-data-completeness-condition = auto-detection
+top-level-data-set-handler = ch.systemsx.cisd.etlserver.registrator.JythonTopLevelDataSetHandler
+script-path = register-flowcell-dropbox.py
+storage-processor = ch.systemsx.cisd.etlserver.DefaultStorageProcessor
\ No newline at end of file
diff --git a/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/register-flowcell-dropbox.py b/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/register-flowcell-dropbox.py
new file mode 100644
index 00000000000..e19f4394b94
--- /dev/null
+++ b/deep_sequencing_unit/source/core-plugins/illumina-ngs/1/dss/drop-boxes/register-flowcell-dropbox/register-flowcell-dropbox.py
@@ -0,0 +1,46 @@
+'''
+expected incoming Name for HiSeq2000 runs: 110715_SN792_0054_BC035RACXX
+expected incoming Name for GAII runs: 110812_6353WAAXX
+
+Note: 
+print statements go to: ~openbis/sprint/datastore_server/log/startup_log.txt
+'''
+
+from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria
+
+IS_HISEQ_RUN = False
+
+DATASET_TYPE_HISEQ = "ILLUMINA_HISEQ_OUTPUT"
+DATASET_TYPE_GA = "ILLUMINA_GA_OUTPUT"
+
+# Create a "transaction" -- a way of grouping operations together so they all
+# happen or none of them do.
+transaction = service.transaction()
+
+incomingPath = incoming.getAbsolutePath()
+
+# Get the incoming name 
+name = incoming.getName()
+
+split = name.split("_")
+if (len(split) == 4):
+  dataSet = transaction.createNewDataSet(DATASET_TYPE_HISEQ)
+  IS_HISEQ_RUN = True
+if (len(split) == 2):
+  dataSet = transaction.createNewDataSet(DATASET_TYPE_GA)
+
+# Create a data set and set type
+dataSet.setMeasuredData(False)
+  
+# Get the search service
+search_service = transaction.getSearchService()
+ 
+# Search for the sample
+sc = SearchCriteria()
+sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, name));
+foundSamples = search_service.searchForSamples(sc)
+
+if foundSamples.size() > 0:
+  # Add the incoming file into the data set
+  transaction.moveFile(incomingPath, dataSet)
+  dataSet.setSample(foundSamples[0])
-- 
GitLab