Skip to content

Commit 0693826

Browse files
committed
patch: attach parent sample, fix experiment name, fix log file path
1 parent a64cb9f commit 0693826

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drop-boxes/register-nanopore-dropbox/register-nanopore.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def createNewExperiment(transaction, space, project):
8080
newExpID = None
8181
while expExists:
8282
run += 1
83-
newExpID = '/' + space + '/' +project+ '/' + project+str(run)
83+
newExpID = '/' + space + '/' +project+ '/' + project+'E'+str(run)
8484
expExists = newExpID in usedExperimentIdentifiers
8585
usedExperimentIdentifiers.add(newExpID)
8686
return transaction.createNewExperiment(newExpID, NANOPORE_EXP_TYPE_CODE)
@@ -103,7 +103,7 @@ def getTimeStamp():
103103

104104
def copyLogFilesTo(logFiles, filePath, targetFolderPath):
105105
for logFile in logFiles:
106-
src = os.path.join(filePath, logFile)
106+
src = os.path.join(filePath, logFile.getName())
107107
shutil.copy2(src, targetFolderPath)
108108
copiedContent = os.listdir(targetFolderPath)
109109
if len(copiedContent) != len(logFiles):
@@ -172,8 +172,15 @@ def createSampleWithData(transaction, space, parentSampleCode, mapWithDataForSam
172172
"fastqpass": DataFolder
173173
]
174174
"""
175+
search_service = transaction.getSearchService()
176+
sc = SearchCriteria()
177+
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, parentSampleCode))
178+
foundSamples = search_service.searchForSamples(sc)
179+
parentID = foundSamples[0].getSampleIdentifier()
180+
175181
sample = createNewSample(transaction, space, parentSampleCode)
176182
sample.setExperiment(openbisExperiment)
183+
sample.setParentSampleIdentifiers([parentID])
177184

178185
# Aggregate the folders fastqfail and fastqpass under a common folder "<sample code>_fastq"
179186
topFolderFastq = os.path.join(currentPath, parentSampleCode+"_fastq")

0 commit comments

Comments
 (0)