-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbcb168
commit 9323ff2
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
def checkSesFolders() { | ||
def Map entity = [:] | ||
// Check if subject folders contain sessions ================================== | ||
isSesFolder = true | ||
// Emit false otherwise CHECKS ANAT FOLDER ONLY | ||
Channel.fromPath( "$params.bids/sub*/ses*", type: 'dir', checkIfExists: true ) | ||
.ifEmpty { isSesFolder=false} | ||
|
||
// Depending on whether the dataset uses session-level folders, | ||
// file-depths must be dynamically configured. | ||
// This is controlled by the ses_directory parameter. | ||
// FitResultsSave_BIDS knows | ||
// how to deal with that based on SID passed by nextflow | ||
// when setenv('NEXTFLOW','1') | ||
|
||
if (isSesFolder){ | ||
println "Session-level organization has been ENABLED." | ||
entity.dirInputLevel = "**/**/" | ||
entity.qmrlabSesFlag = "true" | ||
}else{ | ||
println "Session-level organization has been DISABLED." | ||
entity.dirInputLevel = "**/" | ||
entity.qmrlabSesFlag = "false" | ||
} | ||
|
||
return entity | ||
} | ||
|
||
|
||
def getSubSesEntity(sid) { | ||
def Map out = [:] | ||
out.sub = ("${sid}" =~ /(sub[^_]+)/)[0][0] | ||
if (isSesFolder){ | ||
out.ses = ("${sid}" =~ /(ses[^_]+)/)[0][0] | ||
out.ses = out.ses + "/" | ||
}else{ | ||
out.ses = '' | ||
} | ||
return out | ||
} |