From 154bbcda10113dbffe0ddbd9e833869a746f8d8a Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Fri, 13 May 2022 17:34:23 +0200 Subject: [PATCH 1/5] use and test new maxquant reults structure --- pom.xml | 2 +- .../life/qbic/utils/MaxQuantParser.groovy | 4 +++ .../life/qbic/utils/MaxQuantParserSpec.groovy | 24 +++++++----------- .../QABCD_sample_ids.txt} | 0 .../sample_ids.txt | 0 .../txt/experimentalDesignTemplate.txt | 0 .../combined/txt/summary_1234.pdf | Bin .../{combined => }/txt/allPeptides.txt | 0 .../{combined => }/txt/evidence.txt | 0 .../{combined => }/txt/parameters.txt | 0 .../{combined => }/txt/peptides.txt | 0 .../{combined => }/txt/proteinGroups.txt | 0 .../QABCD_sample_ids.txt} | 0 .../mqpar.xml} | 0 .../Q0010_sample_ids.txt} | Bin .../txt/experimentalDesignTemplate.txt | 0 .../combined/txt/summary/summary_1234.pdf | Bin .../validates/sample_ids.txt | 0 .../{combined => }/txt/allPeptides.txt | 0 .../validates/{combined => }/txt/evidence.txt | 0 .../{combined => }/txt/parameters.txt | 0 .../validates/{combined => }/txt/peptides.txt | 0 .../{combined => }/txt/proteinGroups.txt | 0 23 files changed, 14 insertions(+), 16 deletions(-) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/{missing_combined_directory/mqpar.xml => missing_file_in_txt_directory/QABCD_sample_ids.txt} (100%) delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/sample_ids.txt delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/experimentalDesignTemplate.txt delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/summary_1234.pdf rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/{combined => }/txt/allPeptides.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/{combined => }/txt/evidence.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/{combined => }/txt/parameters.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/{combined => }/txt/peptides.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/{combined => }/txt/proteinGroups.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/{missing_combined_directory/sample_ids.txt => missing_txt_directory/QABCD_sample_ids.txt} (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/{missing_file_in_txt_directory/combined/txt/experimentalDesignTemplate.txt => missing_txt_directory/mqpar.xml} (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/{fails/missing_file_in_txt_directory/combined/txt/summary_1234.pdf => validates/Q0010_sample_ids.txt} (100%) delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/experimentalDesignTemplate.txt delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/summary/summary_1234.pdf delete mode 100644 src/test/resources/dummyFileSystem/maxquant-run-output/validates/sample_ids.txt rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{combined => }/txt/allPeptides.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{combined => }/txt/evidence.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{combined => }/txt/parameters.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{combined => }/txt/peptides.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{combined => }/txt/proteinGroups.txt (100%) diff --git a/pom.xml b/pom.xml index 1a94f480..1636b271 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ data-model-lib life.qbic - 2.18.0 + 2.19.0-SNAPSHOT org.mockito diff --git a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy index 084d9f0a..58fdfc98 100644 --- a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy +++ b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy @@ -85,6 +85,8 @@ class MaxQuantParser implements DatasetParser { MaxQuantRunResult maxQuantRunResult = MaxQuantRunResult.createFrom(fileTreeMap) return maxQuantRunResult } catch (ValidationException validationException) { + println root + println validationException.getAllMessages() throw new DatasetValidationException(validationException) } catch(Exception e) { throw new DataParserException(e.message, e.cause) @@ -226,9 +228,11 @@ class MaxQuantParser implements DatasetParser { */ private static void validateJson(String json) throws ValidationException { // Step1: load schema + println json JSONObject jsonObject = new JSONObject(json) InputStream schemaStream = MaxQuantOutput.getSchemaAsStream() JSONObject rawSchema = new JSONObject(new JSONTokener(schemaStream)) + println rawSchema SchemaLoader jsonSchemaLoader = SchemaLoader.builder() .schemaClient(SchemaClient.classPathAwareClient()) .schemaJson(rawSchema) diff --git a/src/test/groovy/life/qbic/utils/MaxQuantParserSpec.groovy b/src/test/groovy/life/qbic/utils/MaxQuantParserSpec.groovy index 8fdc2267..c2bfe703 100644 --- a/src/test/groovy/life/qbic/utils/MaxQuantParserSpec.groovy +++ b/src/test/groovy/life/qbic/utils/MaxQuantParserSpec.groovy @@ -32,35 +32,29 @@ class MaxQuantParserSpec extends Specification { assert maxQuantRunResult.runParameters.getRelativePath() == "./mqpar.xml" assert maxQuantRunResult.runParameters.getName()== "mqpar.xml" - assert maxQuantRunResult.sampleIds.getRelativePath() == "./sample_ids.txt" - assert maxQuantRunResult.sampleIds.getName()== "sample_ids.txt" + assert maxQuantRunResult.sampleIds.getRelativePath() == "./QABCD_sample_ids.txt" + assert maxQuantRunResult.sampleIds.getName()== "QABCD_sample_ids.txt" - //Files in ./combined/txt/ can be parsed - assert maxQuantRunResult.allPeptides.getRelativePath() == "./combined/txt/allPeptides.txt" + //Files in ./txt/ can be parsed + assert maxQuantRunResult.allPeptides.getRelativePath() == "./txt/allPeptides.txt" assert maxQuantRunResult.allPeptides.getName()== "allPeptides.txt" - assert maxQuantRunResult.evidence.getRelativePath() == "./combined/txt/evidence.txt" + assert maxQuantRunResult.evidence.getRelativePath() == "./txt/evidence.txt" assert maxQuantRunResult.evidence.getName()== "evidence.txt" - assert maxQuantRunResult.experimentalDesignTemplate.getRelativePath() == "./combined/txt/experimentalDesignTemplate.txt" - assert maxQuantRunResult.experimentalDesignTemplate.getName()== "experimentalDesignTemplate.txt" - - assert maxQuantRunResult.parameters.getRelativePath() == "./combined/txt/parameters.txt" + assert maxQuantRunResult.parameters.getRelativePath() == "./txt/parameters.txt" assert maxQuantRunResult.parameters.getName()== "parameters.txt" - assert maxQuantRunResult.peptides.getRelativePath() == "./combined/txt/peptides.txt" + assert maxQuantRunResult.peptides.getRelativePath() == "./txt/peptides.txt" assert maxQuantRunResult.peptides.getName()== "peptides.txt" - assert maxQuantRunResult.proteinGroups.getRelativePath() == "./combined/txt/proteinGroups.txt" + assert maxQuantRunResult.proteinGroups.getRelativePath() == "./txt/proteinGroups.txt" assert maxQuantRunResult.proteinGroups.getName()== "proteinGroups.txt" - - assert maxQuantRunResult.summary.getRelativePath() == "./combined/txt/summary/summary_1234.pdf" - assert maxQuantRunResult.summary.getName()== "summary_1234.pdf" } def "parsing an invalid file structure throws DatasetValidationException"() { given: - def pathToDirectory = Paths.get(exampleDirectoriesRoot, "fails/missing_combined_directory") + def pathToDirectory = Paths.get(exampleDirectoriesRoot, "fails/missing_txt_directory") when: maxQuantParser.parseFrom(pathToDirectory) then: diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_combined_directory/mqpar.xml b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/QABCD_sample_ids.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_combined_directory/mqpar.xml rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/QABCD_sample_ids.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/sample_ids.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/sample_ids.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/experimentalDesignTemplate.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/experimentalDesignTemplate.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/summary_1234.pdf b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/summary_1234.pdf deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/allPeptides.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/allPeptides.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/allPeptides.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/allPeptides.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/evidence.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/evidence.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/evidence.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/evidence.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/parameters.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/parameters.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/parameters.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/parameters.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/peptides.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/peptides.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/peptides.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/peptides.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/proteinGroups.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/proteinGroups.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/combined/txt/proteinGroups.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_root_files_directory/txt/proteinGroups.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_combined_directory/sample_ids.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_txt_directory/QABCD_sample_ids.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_combined_directory/sample_ids.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_txt_directory/QABCD_sample_ids.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/experimentalDesignTemplate.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_txt_directory/mqpar.xml similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/experimentalDesignTemplate.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_txt_directory/mqpar.xml diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/summary_1234.pdf b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/Q0010_sample_ids.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/summary_1234.pdf rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/Q0010_sample_ids.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/experimentalDesignTemplate.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/experimentalDesignTemplate.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/summary/summary_1234.pdf b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/summary/summary_1234.pdf deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/sample_ids.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/sample_ids.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/allPeptides.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/allPeptides.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/allPeptides.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/allPeptides.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/evidence.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/evidence.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/evidence.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/evidence.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/parameters.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/parameters.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/parameters.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/parameters.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/peptides.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/peptides.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/peptides.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/peptides.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/proteinGroups.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/proteinGroups.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/combined/txt/proteinGroups.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/txt/proteinGroups.txt From ee0063da35a61404eb80fc44e7bc29960e789739 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Fri, 13 May 2022 18:07:18 +0200 Subject: [PATCH 2/5] fix test structure --- .../missing_file_in_txt_directory/{combined => }/txt/evidence.txt | 0 .../{combined => }/txt/parameters.txt | 0 .../missing_file_in_txt_directory/{combined => }/txt/peptides.txt | 0 .../{combined => }/txt/proteinGroups.txt | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/{combined => }/txt/evidence.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/{combined => }/txt/parameters.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/{combined => }/txt/peptides.txt (100%) rename src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/{combined => }/txt/proteinGroups.txt (100%) diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/evidence.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/evidence.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/evidence.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/evidence.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/parameters.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/parameters.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/parameters.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/parameters.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/peptides.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/peptides.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/peptides.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/peptides.txt diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/proteinGroups.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/proteinGroups.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/combined/txt/proteinGroups.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/fails/missing_file_in_txt_directory/txt/proteinGroups.txt From bf06cde35d8f070fb33a149430238bdd31a28ed7 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Fri, 13 May 2022 18:36:46 +0200 Subject: [PATCH 3/5] correctly parse structure without combined folder --- .../life/qbic/utils/MaxQuantParser.groovy | 25 ++++++++----------- ...10_sample_ids.txt => QABCD_sample_ids.txt} | 0 2 files changed, 11 insertions(+), 14 deletions(-) rename src/test/resources/dummyFileSystem/maxquant-run-output/validates/{Q0010_sample_ids.txt => QABCD_sample_ids.txt} (100%) diff --git a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy index 58fdfc98..791e1a75 100644 --- a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy +++ b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy @@ -85,8 +85,6 @@ class MaxQuantParser implements DatasetParser { MaxQuantRunResult maxQuantRunResult = MaxQuantRunResult.createFrom(fileTreeMap) return maxQuantRunResult } catch (ValidationException validationException) { - println root - println validationException.getAllMessages() throw new DatasetValidationException(validationException) } catch(Exception e) { throw new DataParserException(e.message, e.cause) @@ -120,16 +118,14 @@ class MaxQuantParser implements DatasetParser { rootChildren.each { currentChild -> if (currentChild.containsKey("children")) { //folder - parseCombinedInformation(map) + parseSubfolderInformation(map) } else if (currentChild.containsKey("fileType")) { //file - switch (currentChild.get("name")) { - case "mqpar.xml": - insertAsProperty(map, currentChild, RequiredRootFileKeys.RUN_PARAMETERS.getKeyName()) - break - case "sample_ids.txt": - insertAsProperty(map, currentChild, RequiredRootFileKeys.SAMPLE_ID.getKeyName()) - break + String name = currentChild.get("name") + if(name.equals("mqpar.xml")) { + insertAsProperty(map, currentChild, RequiredRootFileKeys.RUN_PARAMETERS.getKeyName()) + } else if(name.endsWith("sample_ids.txt")) { + insertAsProperty(map, currentChild, RequiredRootFileKeys.SAMPLE_ID.getKeyName()) } } } @@ -139,12 +135,12 @@ class MaxQuantParser implements DatasetParser { * Method which adapts the parsed content of the txt directory in place to the expected file structure. * @see {valid datastructure example} * - * After parsing the files of the txt directory are contained in the children property of the combined directory, which itself is contained in the root directory. + * After parsing the files of the txt directory and a potential intermediate directory, which itself is contained in the root directory. * The underlying datastructure however expects a mapping of the expected files as a Map entry in the root directory. * @param maxQuantInformation a nested map representing the parsed fileTree structure * @since 1.9.0 */ - private static void parseCombinedInformation(Map maxQuantInformation) { + private static void parseSubfolderInformation(Map maxQuantInformation) { List rootFolderInformation = maxQuantInformation.get("children") as List def combinedFolderInformation def txtFolderInformation @@ -153,6 +149,9 @@ class MaxQuantParser implements DatasetParser { if (map.get("name") == "combined") { combinedFolderInformation = map.get("children") } + if (map.get("name") == "txt") { + txtFolderInformation = map.get("children") as List + } } if (combinedFolderInformation) { combinedFolderInformation.findAll { map -> @@ -228,11 +227,9 @@ class MaxQuantParser implements DatasetParser { */ private static void validateJson(String json) throws ValidationException { // Step1: load schema - println json JSONObject jsonObject = new JSONObject(json) InputStream schemaStream = MaxQuantOutput.getSchemaAsStream() JSONObject rawSchema = new JSONObject(new JSONTokener(schemaStream)) - println rawSchema SchemaLoader jsonSchemaLoader = SchemaLoader.builder() .schemaClient(SchemaClient.classPathAwareClient()) .schemaJson(rawSchema) diff --git a/src/test/resources/dummyFileSystem/maxquant-run-output/validates/Q0010_sample_ids.txt b/src/test/resources/dummyFileSystem/maxquant-run-output/validates/QABCD_sample_ids.txt similarity index 100% rename from src/test/resources/dummyFileSystem/maxquant-run-output/validates/Q0010_sample_ids.txt rename to src/test/resources/dummyFileSystem/maxquant-run-output/validates/QABCD_sample_ids.txt From 72dc222b84794720850490c2e68f31ea7ff7f978 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Tue, 17 May 2022 15:12:38 +0200 Subject: [PATCH 4/5] Update src/main/groovy/life/qbic/utils/MaxQuantParser.groovy Co-authored-by: jnnfr --- src/main/groovy/life/qbic/utils/MaxQuantParser.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy index 791e1a75..3c3314a2 100644 --- a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy +++ b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy @@ -118,7 +118,7 @@ class MaxQuantParser implements DatasetParser { rootChildren.each { currentChild -> if (currentChild.containsKey("children")) { //folder - parseSubfolderInformation(map) + parseTxtFolder(map) } else if (currentChild.containsKey("fileType")) { //file String name = currentChild.get("name") From a8831754d89ea07b864ebf0dff5b9ea46a31c897 Mon Sep 17 00:00:00 2001 From: wow-such-code Date: Tue, 17 May 2022 15:17:20 +0200 Subject: [PATCH 5/5] remove unused folder parsing, rename method, fix comment --- .../life/qbic/utils/MaxQuantParser.groovy | 24 ++----------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy index 3c3314a2..aed1088f 100644 --- a/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy +++ b/src/main/groovy/life/qbic/utils/MaxQuantParser.groovy @@ -135,31 +135,19 @@ class MaxQuantParser implements DatasetParser { * Method which adapts the parsed content of the txt directory in place to the expected file structure. * @see {valid datastructure example} * - * After parsing the files of the txt directory and a potential intermediate directory, which itself is contained in the root directory. + * After parsing, the files of the txt directory are contained in the children property of the root directory. * The underlying datastructure however expects a mapping of the expected files as a Map entry in the root directory. * @param maxQuantInformation a nested map representing the parsed fileTree structure * @since 1.9.0 */ - private static void parseSubfolderInformation(Map maxQuantInformation) { + private static void parseTxtFolder(Map maxQuantInformation) { List rootFolderInformation = maxQuantInformation.get("children") as List - def combinedFolderInformation def txtFolderInformation - def summaryFolderInformation rootFolderInformation.findAll { map -> - if (map.get("name") == "combined") { - combinedFolderInformation = map.get("children") - } if (map.get("name") == "txt") { txtFolderInformation = map.get("children") as List } } - if (combinedFolderInformation) { - combinedFolderInformation.findAll { map -> - if (map.get("name") == "txt") { - txtFolderInformation = map.get("children") as List - } - } - } if (txtFolderInformation) { txtFolderInformation.each { Map child -> switch (child.get("name")) { @@ -182,19 +170,11 @@ class MaxQuantParser implements DatasetParser { insertAsProperty(maxQuantInformation, child, RequiredTxtFileKeys.PROTEIN_GROUPS.getKeyName()) break default: - if(child.get("name") == "summary") summaryFolderInformation = child.get("children") as List //ignoring other children break } } } - if(summaryFolderInformation){ - summaryFolderInformation.each{ Map child -> - if (child.get("name").toString().matches("summary_[0-9]{4}.*")) { - insertAsProperty(maxQuantInformation, child, RequiredTxtFileKeys.SUMMARY.getKeyName()) - } - } - } } /**