Skip to content

Commit da00d85

Browse files
Support nanopore data structure v3 (#328)
* add new version of valid nanopore structure * implement additional v3 changes * Update schema and test to current file structure Co-authored-by: Steffengreiner <Steffen.Greiner@gmx.de>
1 parent 0882ffd commit da00d85

File tree

10 files changed

+1041
-2
lines changed

10 files changed

+1041
-2
lines changed

src/main/groovy/life/qbic/datamodel/datasets/OxfordNanoporeExperiment.groovy

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ final class OxfordNanoporeExperiment implements ExperimentFolder {
3333
FQDN_FILES + ".MuxScanDataLog",
3434
FQDN_FILES + ".ReportMdLog",
3535
FQDN_FILES + ".ReportPDFLog",
36+
FQDN_FILES + ".ReportHTMLLog",
37+
FQDN_FILES + ".ReportJSONLog",
3638
FQDN_FILES + ".SequencingSummaryLog",
3739
FQDN_FILES + ".ThroughputLog",
38-
FQDN_FILES + ".BarcodeAlignmentLog"
40+
FQDN_FILES + ".BarcodeAlignmentLog",
41+
FQDN_FILES + ".PoreActivityLog",
42+
FQDN_FILES + ".SampleSheetLog",
43+
FQDN_FILES + ".PoreScanDataLog"
3944
]
4045

4146
private final static Set nanoporeFolderTypes = [
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package life.qbic.datamodel.datasets.datastructure.files.nanopore
2+
3+
import life.qbic.datamodel.datasets.datastructure.files.DataFile
4+
5+
/**
6+
* A specialisation of a DataFile, represents an Oxford Nanopore pore activity log file
7+
*
8+
*/
9+
class PoreActivityLog extends DataFile {
10+
11+
final private static String FILE_TYPE = "csv"
12+
13+
final private static String NAME_SCHEMA = $/pore_activity_.*/$
14+
15+
protected PoreActivityLog() {}
16+
17+
protected PoreActivityLog(String name, String relativePath) {
18+
super(name, relativePath, FILE_TYPE)
19+
validateName()
20+
}
21+
22+
static PoreActivityLog create(String name, String relativePath) {
23+
return new PoreActivityLog(name, relativePath)
24+
}
25+
26+
private void validateName() {
27+
if (!(this.name =~ NAME_SCHEMA)) {
28+
throw new IllegalArgumentException("Name must match the Nanopore pore activity log name schema!")
29+
}
30+
}
31+
32+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package life.qbic.datamodel.datasets.datastructure.files.nanopore
2+
3+
import life.qbic.datamodel.datasets.datastructure.files.DataFile
4+
5+
/**
6+
* A specialisation of a DataFile, represents an Oxford Nanopore pore scan data log file
7+
*
8+
*/
9+
class PoreScanDataLog extends DataFile {
10+
11+
final private static String FILE_TYPE = "csv"
12+
13+
final private static String NAME_SCHEMA = $/pore_scan_data_.*/$
14+
15+
protected PoreScanDataLog() {}
16+
17+
protected PoreScanDataLog(String name, String relativePath) {
18+
super(name, relativePath, FILE_TYPE)
19+
validateName()
20+
}
21+
22+
static PoreScanDataLog create(String name, String relativePath) {
23+
return new PoreScanDataLog(name, relativePath)
24+
}
25+
26+
private void validateName() {
27+
if (!(this.name =~ NAME_SCHEMA)) {
28+
throw new IllegalArgumentException("Name must match the Nanopore pore scan data log name schema!")
29+
}
30+
}
31+
32+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package life.qbic.datamodel.datasets.datastructure.files.nanopore
2+
3+
import life.qbic.datamodel.datasets.datastructure.files.DataFile
4+
5+
/**
6+
* A specialisation of a DataFile, represents an Oxford Nanopore report HTML log file
7+
*
8+
*/
9+
class ReportHTMLLog extends DataFile {
10+
11+
final private static String FILE_TYPE = "html"
12+
13+
final private static String NAME_SCHEMA = $/report_.*/$
14+
15+
protected ReportHTMLLog() {}
16+
17+
protected ReportHTMLLog(String name, String relativePath) {
18+
super(name, relativePath, FILE_TYPE)
19+
validateName()
20+
}
21+
22+
static ReportHTMLLog create(String name, String relativePath) {
23+
return new ReportHTMLLog(name, relativePath)
24+
}
25+
26+
private void validateName() {
27+
if (!(this.name =~ NAME_SCHEMA)) {
28+
throw new IllegalArgumentException("Name must match the Nanopore report name schema!")
29+
}
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package life.qbic.datamodel.datasets.datastructure.files.nanopore
2+
3+
import life.qbic.datamodel.datasets.datastructure.files.DataFile
4+
5+
/**
6+
* A specialisation of a DataFile, represents an Oxford Nanopore report JSON log file
7+
*
8+
*/
9+
class ReportJSONLog extends DataFile {
10+
11+
final private static String FILE_TYPE = "json"
12+
13+
final private static String NAME_SCHEMA = $/report_.*/$
14+
15+
protected ReportJSONLog() {}
16+
17+
protected ReportJSONLog(String name, String relativePath) {
18+
super(name, relativePath, FILE_TYPE)
19+
validateName()
20+
}
21+
22+
static ReportJSONLog create(String name, String relativePath) {
23+
return new ReportJSONLog(name, relativePath)
24+
}
25+
26+
private void validateName() {
27+
if (!(this.name =~ NAME_SCHEMA)) {
28+
throw new IllegalArgumentException("Name must match the Nanopore report name schema!")
29+
}
30+
}
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package life.qbic.datamodel.datasets.datastructure.files.nanopore
2+
3+
import life.qbic.datamodel.datasets.datastructure.files.DataFile
4+
5+
/**
6+
* A specialisation of a DataFile, represents an Oxford Nanopore sample sheet log file
7+
*
8+
* @author: Andreas Friedrich
9+
*/
10+
class SampleSheetLog extends DataFile {
11+
12+
final private static String FILE_TYPE = "csv"
13+
14+
final private static String NAME_SCHEMA = $/sample_sheet_.*/$
15+
16+
protected SampleSheetLog() {}
17+
18+
protected SampleSheetLog(String name, String relativePath) {
19+
super(name, relativePath, FILE_TYPE)
20+
validateName()
21+
}
22+
23+
static SampleSheetLog create(String name, String relativePath) {
24+
return new SampleSheetLog(name, relativePath)
25+
}
26+
27+
private void validateName() {
28+
if (!(this.name =~ NAME_SCHEMA)) {
29+
throw new IllegalArgumentException("Name must match the Nanopore sample sheet log name schema!")
30+
}
31+
}
32+
33+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package life.qbic.datamodel.instruments
2+
3+
4+
/**
5+
* Represents the Nanopore instrument output data structure schema.
6+
*
7+
* The original schema is defined in as resource and is
8+
* referenced here, wrapped in a Groovy class for reference
9+
* in applications that want to validate the instrument
10+
* output structure against the schema.
11+
*
12+
* @author Sven Fillinger
13+
* @since 1.9.0
14+
*/
15+
class OxfordNanoporeInstrumentOutputV3 {
16+
17+
private static final String SCHEMA_PATH = "/schemas/nanopore-instrument-output_v3.schema.json"
18+
19+
static InputStream getSchemaAsStream() {
20+
return OxfordNanoporeInstrumentOutputV3.getResourceAsStream(SCHEMA_PATH)
21+
}
22+
}

0 commit comments

Comments
 (0)