-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide Data Files and Folders for Bam and Pod5 registration
- Loading branch information
1 parent
8c76c22
commit d43dd4a
Showing
5 changed files
with
140 additions
and
19 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
30 changes: 30 additions & 0 deletions
30
src/main/groovy/life/qbic/datamodel/datasets/datastructure/files/nanopore/BamFile.groovy
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,30 @@ | ||
package life.qbic.datamodel.datasets.datastructure.files.nanopore | ||
|
||
import life.qbic.datamodel.datasets.datastructure.files.DataFile | ||
|
||
/** | ||
* A specialisation of a DataFile, represents an Oxford Nanopore bam file | ||
* | ||
*/ | ||
class BamFile extends DataFile { | ||
|
||
final private static String FILE_TYPE = "bam" | ||
|
||
final private static String NAME_SCHEMA = /.*\.bam$/ | ||
|
||
protected BamFile(String name, String relativePath) { | ||
super(name, relativePath, FILE_TYPE) | ||
validateName() | ||
} | ||
|
||
static BamFile create(String name, String relativePath) { | ||
return new BamFile(name, relativePath) | ||
} | ||
|
||
private void validateName() { | ||
if (!(this.name =~ NAME_SCHEMA)) { | ||
throw new IllegalArgumentException("Name must match the Nanopore summary schema!") | ||
} | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
...n/groovy/life/qbic/datamodel/datasets/datastructure/folders/nanopore/BamFailFolder.groovy
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,39 @@ | ||
package life.qbic.datamodel.datasets.datastructure.folders.nanopore | ||
|
||
import life.qbic.datamodel.datasets.datastructure.folders.DataFolder | ||
|
||
/** | ||
* A special case of a DataFolder, its name is always bam_fail. | ||
* | ||
* Its children field contains either a list of type List<BamFiles> or List<BamFolder> | ||
* | ||
*/ | ||
class BamFailFolder extends DataFolder { | ||
|
||
final private static String NAME_SCHEMA = /bam_fail/ | ||
|
||
protected BamFailFolder() {} | ||
|
||
protected BamFailFolder(String name, String relativePath, List<?> children) { | ||
super(name, relativePath, children) | ||
validateName() | ||
} | ||
|
||
/** | ||
* Creates a new instance of a BamFailFolder object | ||
* | ||
* @param name The folder name | ||
* @param relativePath The relative path of the folder | ||
* @param children A list with child elements of the folder | ||
* @return A new instance of a BamFailFolder object | ||
*/ | ||
static BamFailFolder create(String name, String relativePath, List<?> children) { | ||
new BamFailFolder(name, relativePath, children) | ||
} | ||
|
||
private void validateName() { | ||
if (!(this.name =~ NAME_SCHEMA)) { | ||
throw new IllegalArgumentException("Name must match the Nanopore BamFail directory schema!") | ||
} | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...n/groovy/life/qbic/datamodel/datasets/datastructure/folders/nanopore/BamPassFolder.groovy
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,39 @@ | ||
package life.qbic.datamodel.datasets.datastructure.folders.nanopore | ||
|
||
import life.qbic.datamodel.datasets.datastructure.folders.DataFolder | ||
|
||
/** | ||
* A special case of a DataFolder, its name is always bam_pass. | ||
* | ||
* Its children field contains either a list of type List<BamFiles> or List<BamFolder> | ||
* | ||
*/ | ||
class BamPassFolder extends DataFolder { | ||
|
||
final private static String NAME_SCHEMA = /bam_pass/ | ||
|
||
protected BamPassFolder() {} | ||
|
||
protected BamPassFolder(String name, String relativePath, List<?> children) { | ||
super(name, relativePath, children) | ||
validateName() | ||
} | ||
|
||
/** | ||
* Creates a new instance of a BamPassFolder object | ||
* | ||
* @param name The folder name | ||
* @param relativePath The relative path of the folder | ||
* @param children A list with child elements of the folder | ||
* @return A new instance of a BamPassFolder object | ||
*/ | ||
static BamPassFolder create(String name, String relativePath, List<?> children) { | ||
new BamPassFolder(name, relativePath, children) | ||
} | ||
|
||
private void validateName() { | ||
if (!(this.name =~ NAME_SCHEMA)) { | ||
throw new IllegalArgumentException("Name must match the Nanopore BamPass directory schema!") | ||
} | ||
} | ||
} |