This repository was archived by the owner on Aug 20, 2024. It is now read-only.
forked from nextflow-io/nf-schema
-
Notifications
You must be signed in to change notification settings - Fork 18
format file-path-pattern #118
Merged
nvnieuwk
merged 7 commits into
nextflow-io:master
from
nvnieuwk:feat/format-filepathpattern
Oct 18, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1bace9e
Add file-path-pattern format
nvnieuwk c307732
add file-path-pattern support for the samplesheet
nvnieuwk 1cd18b2
update changelog
nvnieuwk 055eb80
update docs and add check if any files are found
nvnieuwk 101eaec
fix lint
nvnieuwk 90983d0
review comments
nvnieuwk 83a6b5c
Merge branch 'master' into feat/format-filepathpattern
nvnieuwk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
34 changes: 34 additions & 0 deletions
34
...-validation/src/main/nextflow/validation/FormatValidators/FilePathPatternValidator.groovy
This file contains hidden or 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,34 @@ | ||
| package nextflow.validation | ||
|
|
||
| import java.nio.file.Path | ||
| import groovy.util.logging.Slf4j | ||
|
|
||
| import org.everit.json.schema.FormatValidator | ||
| import nextflow.Nextflow | ||
|
|
||
| @Slf4j | ||
| public class FilePathPatternValidator implements FormatValidator { | ||
|
|
||
| @Override | ||
| public Optional<String> validate(final String subject) { | ||
| if (subject.startsWith('s3://')) { | ||
| log.debug("S3 paths are not supported by 'FilePathPatternValidator': '${subject}'") | ||
| return Optional.empty() | ||
| } | ||
| ArrayList files = Nextflow.file(subject) as ArrayList | ||
| ArrayList errors = [] | ||
|
|
||
| if(files.size() == 0) { | ||
| return Optional.of("No files were found using the globbing pattern '${subject}'" as String) | ||
| } | ||
| for( file : files ) { | ||
| if (file.isDirectory()) { | ||
| errors.add("'${file.toString()}' is not a file, but a directory" as String) | ||
| } | ||
| } | ||
| if(errors.size > 0) { | ||
| return Optional.of(errors.join('\n')) | ||
| } | ||
| return Optional.empty() | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These files will be added to the channel in an array if I understood well, we should document this