Skip to content

Commit 3f8db0d

Browse files
Merge pull request #320 from qbicsoftware/development
Prepare version 2.19.0
2 parents 9ba17e7 + eb55db6 commit 3f8db0d

File tree

9 files changed

+148
-24
lines changed

9 files changed

+148
-24
lines changed
-24.4 KB
Loading

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<groupId>life.qbic</groupId>
99
<artifactId>data-model-lib</artifactId>
10-
<version>2.18.0</version>
10+
<version>2.19.0-SNAPSHOT</version>
1111
<name>data-model-lib</name>
1212
<url>http://github.com/qbicsoftware/data-model-lib</url>
1313
<description>Data models. A collection of QBiC's central data models and DTOs. </description>

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

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ final class MaxQuantRunResult {
2929
private final static Set maxQuantFileTypes = [
3030
FQDN_FILES + ".AllPeptides",
3131
FQDN_FILES + ".Evidence",
32-
FQDN_FILES + ".ExperimentalDesignTemplate",
3332
FQDN_FILES + ".Parameters",
3433
FQDN_FILES + ".Peptides",
3534
FQDN_FILES + ".ProteinGroups",
3635
FQDN_FILES + ".RunParameters",
3736
GENERAL_FILES + ".SampleIds",
38-
FQDN_FILES + ".Summary"
3937
]
4038

4139
private final AllPeptides allPeptides
4240

4341
private final Evidence evidence
4442

43+
@Deprecated
4544
private final ExperimentalDesignTemplate experimentalDesignTemplate
4645

4746
private final Parameters parameters
@@ -54,8 +53,10 @@ final class MaxQuantRunResult {
5453

5554
private final SampleIds sampleIds
5655

56+
@Deprecated
5757
private final Summary summary
5858

59+
@Deprecated
5960
MaxQuantRunResult(AllPeptides allPeptides, Evidence evidence, ExperimentalDesignTemplate experimentalDesignTemplate, Parameters parameters, Peptides peptides, ProteinGroups proteinGroups, RunParameters runParameters, SampleIds sampleIds, Summary summary) {
6061
this.allPeptides = Objects.requireNonNull(allPeptides, "allPeptides must not be null.")
6162
this.evidence = Objects.requireNonNull(evidence, "evidence must not be null.")
@@ -68,9 +69,19 @@ final class MaxQuantRunResult {
6869
this.summary = Objects.requireNonNull(summary, "summary must not be null.")
6970
}
7071

72+
MaxQuantRunResult(AllPeptides allPeptides, Evidence evidence, Parameters parameters, Peptides peptides, ProteinGroups proteinGroups, RunParameters runParameters, SampleIds sampleIds) {
73+
this.allPeptides = Objects.requireNonNull(allPeptides, "allPeptides must not be null.")
74+
this.evidence = Objects.requireNonNull(evidence, "evidence must not be null.")
75+
this.parameters = Objects.requireNonNull(parameters, "parameters must not be null.")
76+
this.peptides = Objects.requireNonNull(peptides, "peptides must not be null.")
77+
this.proteinGroups = Objects.requireNonNull(proteinGroups, "proteinGroups must not be null.")
78+
this.runParameters = Objects.requireNonNull(runParameters, "runParameters must not be null.")
79+
this.sampleIds = Objects.requireNonNull(sampleIds, "sampleIds must not be null.")
80+
}
81+
7182
/**
72-
* Static factory method that creates a new maxQuantRunResult instance from the bioinformatic pipeline output.
73-
* See this @{link <a href="https://github.com/qbicsoftware/data-model-lib/blob/master/src/test/resources/examples/resultset/maxquant/valid-resultset-example.json">example</a>}
83+
* Static factory method that creates a new maxQuantRunResult instance from the MaxQuant output.
84+
* See this @{link <a href="https://github.com/qbicsoftware/data-model-lib/blob/master/src/test/resources/examples/resultset/maxquant/valid-resultset-example_latest.json">example</a>}
7485
* for a JSON representation of a valid map structure
7586
*
7687
* @param Map maxQuantRunOutput
@@ -82,27 +93,23 @@ final class MaxQuantRunResult {
8293
//Check if the required folders are in the root directory
8394
Objects.requireNonNull(maxQuantRunOutput.get("allPeptides"), "The provided directory must contain a allPeptides.txt file.")
8495
Objects.requireNonNull(maxQuantRunOutput.get("evidence"), "The provided directory must contain a evidence.txt file.")
85-
Objects.requireNonNull(maxQuantRunOutput.get("experimentalDesignTemplate"), "The provided directory must contain a experimentalDesignTemplate.txt file.")
8696
Objects.requireNonNull(maxQuantRunOutput.get("parameters"), "The provided directory must contain a parameters.txt file.")
8797
Objects.requireNonNull(maxQuantRunOutput.get("peptides"), "The provided directory must contain a peptides.txt file.")
8898
Objects.requireNonNull(maxQuantRunOutput.get("proteinGroups"), "The provided directory must contain a proteinGroups.txt file.")
8999
Objects.requireNonNull(maxQuantRunOutput.get("runParameters"), "The provided director must contain a runParameters.xml file.")
90100
Objects.requireNonNull(maxQuantRunOutput.get("sampleIds"), "The provided directory must contain a sampleIds.txt file.")
91-
Objects.requireNonNull(maxQuantRunOutput.get("summary"), "The provided directory must contain a summary.pdf file.")
92101

93102
//Get Files from Root Directory
94103
AllPeptides allPeptides = parseFile(maxQuantRunOutput.get("allPeptides") as Map) as AllPeptides
95104
Evidence evidence = parseFile(maxQuantRunOutput.get("evidence") as Map) as Evidence
96-
ExperimentalDesignTemplate experimentalDesignTemplate = parseFile(maxQuantRunOutput.get("experimentalDesignTemplate") as Map) as ExperimentalDesignTemplate
97105
Parameters parameters = parseFile(maxQuantRunOutput.get("parameters") as Map) as Parameters
98106
Peptides peptides = parseFile(maxQuantRunOutput.get("peptides") as Map) as Peptides
99107
ProteinGroups proteinGroups = parseFile(maxQuantRunOutput.get("proteinGroups") as Map) as ProteinGroups
100108
RunParameters runParameters = parseFile(maxQuantRunOutput.get("runParameters") as Map) as RunParameters
101109
SampleIds sampleIds = parseFile(maxQuantRunOutput.get("sampleIds") as Map) as SampleIds
102-
Summary summary = parseFile(maxQuantRunOutput.get("summary") as Map) as Summary
103110

104111
//Create new MaxQuantRunResult object with parsed information
105-
return new MaxQuantRunResult(allPeptides, evidence, experimentalDesignTemplate, parameters, peptides, proteinGroups, runParameters, sampleIds, summary)
112+
return new MaxQuantRunResult(allPeptides, evidence, parameters, peptides, proteinGroups, runParameters, sampleIds)
106113
}
107114

108115
/**
@@ -128,6 +135,7 @@ final class MaxQuantRunResult {
128135
* @return an ExperimentalDesignTemplate file generated by MaxQuant
129136
* @since 2.10.0
130137
*/
138+
@Deprecated
131139
ExperimentalDesignTemplate getExperimentalDesignTemplate() {
132140
return experimentalDesignTemplate
133141
}
@@ -182,6 +190,7 @@ final class MaxQuantRunResult {
182190
* @return a Summary file generated by MaxQuant
183191
* @since 2.10.0
184192
*/
193+
@Deprecated
185194
Summary getSummary() {
186195
return summary
187196
}

src/main/resources/schemas/maxquant-result-set.schema.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
{
116116
"properties": {
117117
"name": {
118-
"pattern": "sample_ids"
118+
"pattern": "Q\\w{4}_sample_ids"
119119
},
120120
"fileType": {
121121
"pattern": "txt"
@@ -143,23 +143,19 @@
143143
"properties": {
144144
"allPeptides": {"$ref": "#/definitions/allPeptides"},
145145
"evidence": {"$ref": "#/definitions/evidence"},
146-
"experimentalDesignTemplate": {"$ref": "#/definitions/experimentalDesignTemplate"},
147146
"parameters": {"$ref": "#/definitions/parameters"},
148147
"peptides": {"$ref": "#/definitions/peptides"},
149148
"proteinGroups": {"$ref": "#/definitions/proteinGroups"},
150149
"runParameters": {"$ref": "#/definitions/runParameters"},
151150
"sampleIds": {"$ref": "#/definitions/sampleIds"},
152-
"summary": {"$ref": "#/definitions/summary"}
153151
},
154152
"required": [
155153
"allPeptides",
156154
"evidence",
157-
"experimentalDesignTemplate",
158155
"parameters",
159156
"peptides",
160157
"proteinGroups",
161158
"runParameters",
162-
"sampleIds",
163-
"summary"
159+
"sampleIds"
164160
]
165161
}

src/test/groovy/life/qbic/datamodel/datasets/datastructure/MaxQuantRunResultSpec.groovy

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ class MaxQuantRunResultSpec extends Specification {
3131
Map invalidDataStructure
3232

3333
def setupSpec() {
34-
InputStream validStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("examples/resultset/maxquant/valid-resultset-example.json")
34+
InputStream validStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("examples/resultset/maxquant/valid-resultset-example_latest.json")
3535
validDataStructure = (Map) new JsonSlurper().parse(validStream)
3636
validStream.close()
3737

38-
InputStream invalidStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("examples/resultset/maxquant/invalid-resultset-example.json")
38+
InputStream invalidStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("examples/resultset/maxquant/no-sampleid-resultset-example.json")
3939
invalidDataStructure = (Map) new JsonSlurper().parse(invalidStream)
4040
invalidStream.close()
4141
}
@@ -48,24 +48,20 @@ class MaxQuantRunResultSpec extends Specification {
4848
final MaxQuantRunResult maxQuantRunResult = MaxQuantRunResult.createFrom(validExample)
4949
AllPeptides allPeptides = maxQuantRunResult.allPeptides
5050
Evidence evidence = maxQuantRunResult.evidence
51-
ExperimentalDesignTemplate experimentalDesignTemplate = maxQuantRunResult.experimentalDesignTemplate
5251
Parameters parameters = maxQuantRunResult.parameters
5352
Peptides peptides = maxQuantRunResult.peptides
5453
ProteinGroups proteinGroups = maxQuantRunResult.proteinGroups
5554
RunParameters runParameters = maxQuantRunResult.runParameters
5655
SampleIds sampleIds = maxQuantRunResult.sampleIds
57-
Summary summary = maxQuantRunResult.summary
5856
then:
5957

6058
allPeptides.name == "allPeptides.txt"
6159
evidence.name == "evidence.txt"
62-
experimentalDesignTemplate.name == "experimentalDesignTemplate.txt"
6360
parameters.name == "parameters.txt"
6461
peptides.name == "peptides.txt"
6562
proteinGroups.name == "proteinGroups.txt"
6663
runParameters.name == "mqpar.xml"
67-
sampleIds.name == "sample_ids.txt"
68-
summary.name == "summary_1234.pdf"
64+
sampleIds.name == "Q0010_sample_ids.txt"
6965
}
7066

7167
def "Invalid fileTree will return a NullPointerException"() {

src/test/groovy/life/qbic/datamodel/maxquant/MaxQuantOutputSpec.groovy

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package life.qbic.datamodel.maxquant
22

3+
import groovy.json.JsonSlurper
34
import org.everit.json.schema.Schema
45
import org.everit.json.schema.ValidationException
56
import org.everit.json.schema.loader.SchemaClient
@@ -35,7 +36,7 @@ class MaxQuantOutputSpec extends Specification {
3536

3637
and:
3738
String validMaxQuantOutput = this.class.getClassLoader()
38-
.getResourceAsStream("examples/resultset/maxquant/valid-resultset-example.json")
39+
.getResourceAsStream("examples/resultset/maxquant/valid-resultset-example_latest.json")
3940
.text
4041

4142
and:
@@ -101,4 +102,52 @@ class MaxQuantOutputSpec extends Specification {
101102
then:
102103
thrown(ValidationException)
103104
}
105+
106+
def "Validating the outdated schema v2 shall raise a validation exception"() {
107+
given:
108+
def stream = MaxQuantOutput.getSchemaAsStream()
109+
110+
and:
111+
String wrongMaxQuantOutput = this.class.getClassLoader()
112+
.getResourceAsStream("examples/resultset/maxquant/old_valid-resultset-example.json")
113+
.text
114+
115+
and:
116+
SchemaLoader schemaLoader = SchemaLoader.builder()
117+
.schemaClient(SchemaClient.classPathAwareClient())
118+
.schemaJson(new JSONObject(new JSONTokener(stream)))
119+
.resolutionScope("classpath://schemas/")
120+
.build()
121+
Schema schema = schemaLoader.load().build()
122+
123+
when:
124+
schema.validate(new JSONObject(wrongMaxQuantOutput))
125+
126+
then:
127+
thrown(ValidationException)
128+
}
129+
130+
def "An invalid project code in the sample ids file shall raise a validation exception"() {
131+
given:
132+
def stream = MaxQuantOutput.getSchemaAsStream()
133+
134+
and:
135+
String missingMaxQuantOutput = this.class.getClassLoader()
136+
.getResourceAsStream("examples/resultset/maxquant/invalid-project-resultset-example.json")
137+
.text
138+
139+
and:
140+
SchemaLoader schemaLoader = SchemaLoader.builder()
141+
.schemaClient(SchemaClient.classPathAwareClient())
142+
.schemaJson(new JSONObject(new JSONTokener(stream)))
143+
.resolutionScope("classpath://schemas/")
144+
.build()
145+
Schema schema = schemaLoader.load().build()
146+
147+
when:
148+
schema.validate(new JSONObject(missingMaxQuantOutput))
149+
150+
then:
151+
thrown(ValidationException)
152+
}
104153
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"allPeptides": {
3+
"name": "allPeptides.txt",
4+
"fileType": "txt",
5+
"path": "./txt/allPeptides.txt"
6+
},
7+
"evidence": {
8+
"name": "evidence.txt",
9+
"fileType": "txt",
10+
"path": "./txt/evidence.txt"
11+
},
12+
"parameters": {
13+
"name": "parameters.txt",
14+
"fileType": "txt",
15+
"path": "./txt/parameters.txt"
16+
},
17+
"peptides": {
18+
"name": "peptides.txt",
19+
"fileType": "txt",
20+
"path": "./txt/peptides.txt"
21+
},
22+
"proteinGroups": {
23+
"name": "proteinGroups.txt",
24+
"fileType": "txt",
25+
"path": "./txt/proteinGroups.txt"
26+
},
27+
"runParameters": {
28+
"name": "mqpar.xml",
29+
"fileType": "xml",
30+
"path": "./mqpar.xml"
31+
},
32+
"sampleIds": {
33+
"name": "0010_sample_ids.txt",
34+
"fileType": "txt",
35+
"path": "./0010_sample_ids.txt"
36+
}
37+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"allPeptides": {
3+
"name": "allPeptides.txt",
4+
"fileType": "txt",
5+
"path": "./txt/allPeptides.txt"
6+
},
7+
"evidence": {
8+
"name": "evidence.txt",
9+
"fileType": "txt",
10+
"path": "./txt/evidence.txt"
11+
},
12+
"parameters": {
13+
"name": "parameters.txt",
14+
"fileType": "txt",
15+
"path": "./txt/parameters.txt"
16+
},
17+
"peptides": {
18+
"name": "peptides.txt",
19+
"fileType": "txt",
20+
"path": "./txt/peptides.txt"
21+
},
22+
"proteinGroups": {
23+
"name": "proteinGroups.txt",
24+
"fileType": "txt",
25+
"path": "./txt/proteinGroups.txt"
26+
},
27+
"runParameters": {
28+
"name": "mqpar.xml",
29+
"fileType": "xml",
30+
"path": "./mqpar.xml"
31+
},
32+
"sampleIds": {
33+
"name": "Q0010_sample_ids.txt",
34+
"fileType": "txt",
35+
"path": "./Q0010_sample_ids.txt"
36+
}
37+
}

0 commit comments

Comments
 (0)