Skip to content
Snippets Groups Projects
Commit b3bb4a8e authored by kohleman's avatar kohleman
Browse files

added support for HiSeq and NextSeq runs

SVN: 33189
parent ada3486a
No related branches found
No related tags found
No related merge requests found
......@@ -24,34 +24,40 @@ import shutil
from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchCriteria
from ch.systemsx.cisd.openbis.generic.shared.api.v1.dto import SearchSubCriteria
def renameFiles(dir, flowcellName):
print dir
print flowcellName
for root, dirs, files in os.walk(dir):
for file in files:
print root + file
os.rename(root + '/' + file, root + "/" + flowcellName + "_" + file)
def splitFolderName (folderName):
runFolder, lane = folderName.rsplit("-", 1)
# check if it is a NextSeq run, as we use only the Flowcell code as a Sample code
if ("NS" in runFolder):
return runFolder.split("_")[-1][1:] + ":" + lane
return runFolder + ":" + lane
def searchSample (transaction, sampleCode):
# Get the search service
search_service = transaction.getSearchService()
print("Searching for " + sampleCode)
# Search for the sample
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sampleCode))
foundSamples = search_service.searchForSamples(sc)
assert(len(foundSamples), 1)
return foundSamples[0]
def process(transaction):
# 140724_M01761_0084_000000000-A8TNL/
incomingPath = transaction.getIncoming().getPath()
incomingFolder = transaction.getIncoming().getName()
flowLane = incomingFolder + ":1"
# Get the search service
search_service = transaction.getSearchService()
# Search for the sample
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, flowLane))
foundSamples = search_service.searchForSamples(sc)
# expected incoming folder names:
# MiSeq: 141217_D00535_0040_BC6GHLANXX-1
# NextSeq: 141217_NS500318_0034_AH1766BGXX-1
# HiSeq: 141204_D00535_0035_BC5LPVANXX-8
if foundSamples.size() > 0:
incomingFolder = transaction.getIncoming().getName()
flowLaneName = splitFolderName(incomingFolder)
flowLane = searchSample(transaction, flowLaneName)
dataSet = transaction.createNewDataSet("UNDETERMINED_READS_DISTRIBUTION")
dataSet.setMeasuredData(False)
dataSet.setSample(foundSamples[0])
transaction.moveFile(incomingPath, dataSet)
dataSet.setSample(flowLane)
transaction.moveFile(transaction.getIncoming().getPath(), dataSet)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment