-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from maxulysse/getRelativePath
Add getRelativePath() function
- Loading branch information
Showing
5 changed files
with
146 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
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
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,23 @@ | ||
workflow { | ||
|
||
def trace_timestamp = new java.util.Date().format( 'yyyy-MM-dd_HH-mm-ss') | ||
|
||
ch_stable_content = Channel.of( | ||
""" | ||
I HAVE STABLE CONTENT | ||
""".stripIndent().trim()) | ||
.collectFile(storeDir: "${params.outdir}/stable", name: 'stable_content.txt', sort: true, newLine: true) | ||
|
||
ch_stable_name = Channel.of( | ||
""" | ||
I DO NOT HAVE STABLE CONTENT | ||
${trace_timestamp} | ||
""".stripIndent().trim()) | ||
.collectFile(storeDir: "${params.outdir}/stable", name: 'stable_name.txt', sort: true, newLine: true) | ||
|
||
ch_unstable_name = Channel.of( | ||
""" | ||
I DO NOT HAVE STABLE NAME | ||
""".stripIndent().trim()) | ||
.collectFile(storeDir: "${params.outdir}/pipeline_info", name: "execution_trace_${trace_timestamp}.txt", sort: true, newLine: true) | ||
} |
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,25 @@ | ||
nextflow_pipeline { | ||
|
||
name "Test getRelativePath" | ||
script "./main.nf" | ||
tag "getRelativePath" | ||
|
||
test("getRelativePath") { | ||
when { | ||
params { | ||
outdir = "$outputDir" | ||
} | ||
} | ||
|
||
then { | ||
// Use getAllFilesFromDir() to get a list of all files and folders from the output directory, minus the timestamped files | ||
def stable_name = getAllFilesFromDir(params.outdir, true, ['pipeline_info/execution_*.{html,txt}'], null ) | ||
def stable_file = getAllFilesFromDir(params.outdir, false, ['pipeline_info/execution_*.{html,txt}'], null ) | ||
assert snapshot( | ||
// Use getRelativePath to get the relative path starting from outputDir | ||
getRelativePath(stable_name, outputDir), | ||
getRelativePath(stable_file, outputDir) | ||
).match() | ||
} | ||
} | ||
} |
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,21 @@ | ||
{ | ||
"getRelativePath": { | ||
"content": [ | ||
[ | ||
"pipeline_info", | ||
"stable", | ||
"stable/stable_content.txt", | ||
"stable/stable_name.txt" | ||
], | ||
[ | ||
"stable/stable_content.txt", | ||
"stable/stable_name.txt" | ||
] | ||
], | ||
"meta": { | ||
"nf-test": "0.9.0", | ||
"nextflow": "24.04.4" | ||
}, | ||
"timestamp": "2024-10-01T18:20:38.379963" | ||
} | ||
} |