From c7cf1459a2a73db505c3f15bd88f56d5af5227e4 Mon Sep 17 00:00:00 2001 From: tpylak <tpylak> Date: Tue, 29 Sep 2009 19:14:39 +0000 Subject: [PATCH] LMS-1180 YeastX: support metabolomics quantification datasets SVN: 12773 --- rtd_yeastx/.classpath | 1 + .../TEST&TEST_PROJECT&TEST_EXP.quantML | 735 ++++++++++++++++++ .../resource/examples/allFields.quantML | 25 + .../ch/systemsx/cisd/yeastx/db/DBUtils.java | 2 +- .../yeastx/eicml/EICMLFilenameFilter.java | 6 +- .../cisd/yeastx/etl/ConstantsYeastX.java | 2 + .../cisd/yeastx/etl/ML2DatabaseUploader.java | 14 + .../yeastx/fiaml/FIAMLFilenameFilter.java | 6 +- .../cisd/yeastx/quant/IQuantMSDAO.java | 50 ++ .../cisd/yeastx/quant/QuantML2Database.java | 135 ++++ .../quant/QuantMLDataSetInfoExtractor.java | 74 ++ .../cisd/yeastx/quant/QuantMLParser.java | 100 +++ .../cisd/yeastx/quant/XmlDateAdapter.java | 43 + .../quant/dto/ConcentrationCompounds.java | 42 + .../yeastx/quant/dto/MSConcentrationDTO.java | 157 ++++ .../yeastx/quant/dto/MSQuantificationDTO.java | 112 +++ .../quant/dto/MSQuantificationsDTO.java | 47 ++ .../source/sql/postgresql/003/schema-003.sql | 3 +- .../migration/migration-002-003.sql | 3 +- .../cisd/yeastx/quant/QuantMLParserTest.java | 94 +++ .../cisd/yeastx/quant/QuantMSDAOTest.java | 63 ++ 21 files changed, 1707 insertions(+), 7 deletions(-) create mode 100644 rtd_yeastx/resource/examples/TEST&TEST_PROJECT&TEST_EXP.quantML create mode 100644 rtd_yeastx/resource/examples/allFields.quantML create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/IQuantMSDAO.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLDataSetInfoExtractor.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/XmlDateAdapter.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/ConcentrationCompounds.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSConcentrationDTO.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationDTO.java create mode 100644 rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationsDTO.java create mode 100644 rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMLParserTest.java create mode 100644 rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java diff --git a/rtd_yeastx/.classpath b/rtd_yeastx/.classpath index fcb08714a47..ea7f89f9fff 100644 --- a/rtd_yeastx/.classpath +++ b/rtd_yeastx/.classpath @@ -21,5 +21,6 @@ <classpathentry kind="lib" path="/libraries/spring/spring.jar" sourcepath="/libraries/spring/src.jar"/> <classpathentry kind="lib" path="/libraries/eodsql/eodsql.jar" sourcepath="/libraries/eodsql/eodsql_src.zip"/> <classpathentry kind="lib" path="/libraries/gwt1.5/gwt-isserializable.jar"/> + <classpathentry kind="lib" path="/libraries/jaxb/jaxb-api.jar" sourcepath="/libraries/jaxb/jaxb-api-src.zip"/> <classpathentry kind="output" path="targets/classes"/> </classpath> diff --git a/rtd_yeastx/resource/examples/TEST&TEST_PROJECT&TEST_EXP.quantML b/rtd_yeastx/resource/examples/TEST&TEST_PROJECT&TEST_EXP.quantML new file mode 100644 index 00000000000..145bf0afe5a --- /dev/null +++ b/rtd_yeastx/resource/examples/TEST&TEST_PROJECT&TEST_EXP.quantML @@ -0,0 +1,735 @@ +<?xml version="1.0" encoding="utf-8"?> +<quantML> + <msQuantification> + <source>msSoft</source> + <valid>true</valid> + <concentration> + <datasetParent>20090822211007858-23605</datasetParent> + <amount>0.689155</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>939.5</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211016773-23606</datasetParent> + <amount>3.775339</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211024338-23607</datasetParent> + <amount>3.909032</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.6</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211027473-23608</datasetParent> + <amount>4.181345</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>921.6</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211029837-23609</datasetParent> + <amount>4.210279</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.8</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211032103-23610</datasetParent> + <amount>4.209338</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>923.5</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211040739-23611</datasetParent> + <amount>3.303593</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211044547-23612</datasetParent> + <amount>-4.328958</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>920.9</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211049391-23613</datasetParent> + <amount>-16.153122</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>919.7</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211052411-23614</datasetParent> + <amount>0.361582</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211056619-23615</datasetParent> + <amount>2.614341</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211100743-23616</datasetParent> + <amount>3.298259</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>924.1</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211104731-23617</datasetParent> + <amount>3.899307</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.8</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211111839-23618</datasetParent> + <amount>3.724714</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211119852-23619</datasetParent> + <amount>2.494577</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211122021-23620</datasetParent> + <amount>3.652310</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211124186-23621</datasetParent> + <amount>4.230794</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>951.6</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211127046-23622</datasetParent> + <amount>4.230957</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>941.4</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211131542-23623</datasetParent> + <amount>4.230698</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>933.0</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211135837-23624</datasetParent> + <amount>4.230236</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>940.1</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211139038-23625</datasetParent> + <amount>4.230934</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>940.1</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211142289-23626</datasetParent> + <amount>4.230776</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>942.7</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211144528-23627</datasetParent> + <amount>4.231008</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>932.4</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211146631-23628</datasetParent> + <amount>3.942793</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>922.2</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211148831-23629</datasetParent> + <amount>4.230723</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>943.3</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211151102-23630</datasetParent> + <amount>4.118647</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>923.5</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23806</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211007858-23605</datasetParent> + <amount>0.726202</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>941.5</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211016773-23606</datasetParent> + <amount>3.697735</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>927.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211024338-23607</datasetParent> + <amount>3.981213</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>928.7</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211027473-23608</datasetParent> + <amount>4.213055</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>938.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211029837-23609</datasetParent> + <amount>4.226762</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>949.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211032103-23610</datasetParent> + <amount>4.118463</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>929.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211040739-23611</datasetParent> + <amount>3.243816</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>927.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211044547-23612</datasetParent> + <amount>-5.900209</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>926.7</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211049391-23613</datasetParent> + <amount>-4.422907</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>925.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211052411-23614</datasetParent> + <amount>-0.271409</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>926.7</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211056619-23615</datasetParent> + <amount>-0.057087</amount> + <unit/> + <comment>signal high</comment> + <valid>false</valid> + <retentionTime>927.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211100743-23616</datasetParent> + <amount>3.122158</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>929.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211104731-23617</datasetParent> + <amount>3.421073</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>928.0</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211111839-23618</datasetParent> + <amount>3.109696</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>928.0</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211119852-23619</datasetParent> + <amount>1.051402</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>927.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211122021-23620</datasetParent> + <amount>3.594872</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>927.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211124186-23621</datasetParent> + <amount>4.251867</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>944.7</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211127046-23622</datasetParent> + <amount>4.255881</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>941.5</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211131542-23623</datasetParent> + <amount>4.252812</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>925.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211135837-23624</datasetParent> + <amount>4.255647</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>934.4</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211139038-23625</datasetParent> + <amount>4.255907</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>947.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211142289-23626</datasetParent> + <amount>4.255880</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>929.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211144528-23627</datasetParent> + <amount>4.255628</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>948.6</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211146631-23628</datasetParent> + <amount>3.911377</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>927.6</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211148831-23629</datasetParent> + <amount>4.248650</amount> + <unit/> + <comment>signal low</comment> + <valid>false</valid> + <retentionTime>939.6</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + <concentration> + <datasetParent>20090822211151102-23630</datasetParent> + <amount>4.102364</amount> + <unit/> + <comment/> + <valid>true</valid> + <retentionTime>929.3</retentionTime> + <Q1>742.1</Q1> + <Q3>620</Q3> + <internalStandard/> + <identity number="1"> + <cmpdId>23808</cmpdId> + </identity> + </concentration> + </msQuantification> +</quantML> \ No newline at end of file diff --git a/rtd_yeastx/resource/examples/allFields.quantML b/rtd_yeastx/resource/examples/allFields.quantML new file mode 100644 index 00000000000..f66be98c85e --- /dev/null +++ b/rtd_yeastx/resource/examples/allFields.quantML @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<quantML> + <msQuantification> + <source>msSoft</source> + <valid>true</valid> + <comment>no comment</comment> + <registrationDate>2009-04-07 12:00:21</registrationDate> + <registrator>John Doe</registrator> + <concentration> + <datasetParent>20090822211007858-23605</datasetParent> + <amount>0.689155</amount> + <unit>kg</unit> + <comment>concentration comment</comment> + <valid>true</valid> + <retentionTime>939.5</retentionTime> + <Q1>664.1</Q1> + <Q3>408</Q3> + <internalStandard>value1</internalStandard> + <identity number="1"> + <cmpdId>1</cmpdId> + <cmpdId>2</cmpdId> + </identity> + </concentration> + </msQuantification> +</quantML> \ No newline at end of file diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java index 86f09faf0ae..b69f0441fec 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/db/DBUtils.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.dbmigration.DatabaseConfigurationContext; public class DBUtils { /** Current version of the database. */ - public static final String DATABASE_VERSION = "002"; + public static final String DATABASE_VERSION = "003"; static { diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICMLFilenameFilter.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICMLFilenameFilter.java index 44940b080f6..3957d1133d4 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICMLFilenameFilter.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/eicml/EICMLFilenameFilter.java @@ -19,15 +19,17 @@ package ch.systemsx.cisd.yeastx.eicml; import java.io.File; import java.io.FilenameFilter; +import ch.systemsx.cisd.yeastx.etl.ConstantsYeastX; + /** * A {@link FilenameFilter} for <code>eicML</code> files. - * + * * @author Bernd Rinn */ final class EICMLFilenameFilter implements FilenameFilter { public boolean accept(File myDir, String name) { - return name.endsWith(".eicML"); + return name.endsWith("." + ConstantsYeastX.EICML_EXT); } } \ No newline at end of file diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ConstantsYeastX.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ConstantsYeastX.java index 81d62cf0744..ceea820ce92 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ConstantsYeastX.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ConstantsYeastX.java @@ -29,5 +29,7 @@ public class ConstantsYeastX public static final String EICML_EXT = "eicML"; + public static final String QUANTML_EXT = "quantML"; + public static final String MZXML_EXT = "mzXML"; } diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java index 9ae705e61b0..701b810fc2f 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/etl/ML2DatabaseUploader.java @@ -36,6 +36,7 @@ import ch.systemsx.cisd.yeastx.db.DBUtils; import ch.systemsx.cisd.yeastx.db.DMDataSetDTO; import ch.systemsx.cisd.yeastx.eicml.EICML2Database; import ch.systemsx.cisd.yeastx.fiaml.FIAML2Database; +import ch.systemsx.cisd.yeastx.quant.QuantML2Database; /** * Extracts and uploads information from dataset files (like <code>eicML</code> or @@ -53,6 +54,8 @@ public class ML2DatabaseUploader implements IDataSetUploader private final FIAML2Database fiaML2Database; + private final QuantML2Database quantML2Database; + private final String uniqueSampleNamePropertyCode; private final String uniqueExperimentNamePropertyCode; @@ -67,6 +70,7 @@ public class ML2DatabaseUploader implements IDataSetUploader DBUtils.init(dbContext); this.eicML2Database = new EICML2Database(dbContext.getDataSource()); this.fiaML2Database = new FIAML2Database(dbContext.getDataSource()); + this.quantML2Database = new QuantML2Database(dbContext.getDataSource()); this.uniqueExperimentNamePropertyCode = DatasetMappingResolver.getUniqueExperimentNamePropertyCode(properties); this.uniqueSampleNamePropertyCode = @@ -86,6 +90,9 @@ public class ML2DatabaseUploader implements IDataSetUploader } else if (extension.equalsIgnoreCase(ConstantsYeastX.EICML_EXT)) { translateEIC(dataSet, dataSetInformation); + } else if (extension.equalsIgnoreCase(ConstantsYeastX.QUANTML_EXT)) + { + translateQuant(dataSet, dataSetInformation); } else { // do nothing @@ -100,6 +107,13 @@ public class ML2DatabaseUploader implements IDataSetUploader } } + private void translateQuant(File dataSet, DataSetInformation dataSetInformation) + throws SQLException + { + DMDataSetDTO openbisBacklink = createBacklink(dataSetInformation); + quantML2Database.uploadQuantMLFile(dataSet, openbisBacklink); + } + private void translateEIC(File dataSet, DataSetInformation dataSetInformation) throws SQLException { diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLFilenameFilter.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLFilenameFilter.java index c861b8ca58b..06e498c8cac 100644 --- a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLFilenameFilter.java +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/fiaml/FIAMLFilenameFilter.java @@ -19,15 +19,17 @@ package ch.systemsx.cisd.yeastx.fiaml; import java.io.File; import java.io.FilenameFilter; +import ch.systemsx.cisd.yeastx.etl.ConstantsYeastX; + /** * A {@link FilenameFilter} for <code>fiaML</code> files. - * + * * @author Bernd Rinn */ final class FIAMLFilenameFilter implements FilenameFilter { public boolean accept(File myDir, String name) { - return name.endsWith(".fiaML"); + return name.endsWith("." + ConstantsYeastX.FIAML_EXT); } } \ No newline at end of file diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/IQuantMSDAO.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/IQuantMSDAO.java new file mode 100644 index 00000000000..511baa92640 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/IQuantMSDAO.java @@ -0,0 +1,50 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import net.lemnik.eodsql.Select; +import net.lemnik.eodsql.Update; + +import ch.systemsx.cisd.yeastx.db.IGenericDAO; +import ch.systemsx.cisd.yeastx.quant.dto.MSConcentrationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO; + +/** + * Creates MS Quantifications records. + * + * @author Tomasz Pylak + */ +public interface IQuantMSDAO extends IGenericDAO +{ + @Select(sql = "insert into MS_QUANTIFICATIONS " + + "( DS_ID, EXPE_ID, SOURCE, VALID, COMMENT, REGISTRATOR, REGISTRATION_DATE ) " + + "values (?{1}, ?{2}, ?{3.source}, ?{3.valid}, ?{3.comment}, " + + " ?{3.registrator}, ?{3.registrationDate} ) returning ID") + public long addQuantification(long datasetId, long experimentId, + MSQuantificationDTO quantification); + + @Select(sql = "insert into MS_QUANT_CONCENTRATIONS " + + "( MS_QUANTIFICATION_ID, PARENT_DS_PERM_ID, AMOUNT, UNIT, VALID, COMMENT, " + + " RETENTION_TIME, Q1, Q3, INTERNAL_STANDARD ) " + + "values (?{1}, ?{2.parentDatasetCode}, ?{2.amount}, ?{2.unit}, ?{2.valid}, ?{2.comment}, " + + " ?{2.retentionTime}, ?{2.q1}, ?{2.q3}, ?{2.internalStandard} ) returning ID") + public long addConcentration(long quantMSId, MSConcentrationDTO concentration); + + @Update(sql = "insert into MS_QUANT_COMPOUNDS (MS_QUANT_CONCENTRATION_ID, COMPOUND_ID) " + + "values (?{1}, ?{2})", batchUpdate = true) + public void addCompoundIds(long concentrationId, Iterable<Long> compoundIds); +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java new file mode 100644 index 00000000000..ac3fc367b1e --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantML2Database.java @@ -0,0 +1,135 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.io.File; +import java.io.FilenameFilter; +import java.sql.SQLException; +import java.util.List; + +import javax.sql.DataSource; + +import net.lemnik.eodsql.QueryTool; +import net.lemnik.eodsql.TransactionQuery; + +import org.springframework.dao.DataAccessException; + +import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; +import ch.systemsx.cisd.yeastx.db.DBUtils; +import ch.systemsx.cisd.yeastx.db.DMDataSetDTO; +import ch.systemsx.cisd.yeastx.etl.ConstantsYeastX; +import ch.systemsx.cisd.yeastx.quant.dto.ConcentrationCompounds; +import ch.systemsx.cisd.yeastx.quant.dto.MSConcentrationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationsDTO; + +/** + * Tool for uploading <code>quantML</code> files to the database. + * + * @author Tomasz Pylak + */ +public class QuantML2Database +{ + + private final IQuantMSDAO dao; + + public QuantML2Database(DataSource datasource) + { + this.dao = QueryTool.getQuery(datasource, IQuantMSDAO.class); + } + + /** + * Method for uploading an <var>fiaMLFile</var> to the database. + */ + public void uploadQuantMLFile(final File file, final DMDataSetDTO dataSet) throws SQLException + { + TransactionQuery transaction = null; + try + { + transaction = dao; + DBUtils.createDataSet(dao, dataSet); + MSQuantificationsDTO quantifications = QuantMLParser.parseQuantifications(file); + uploadQuantifications(quantifications, dataSet); + transaction.close(true); + } catch (Throwable th) + { + try + { + DBUtils.rollbackAndClose(transaction); + } catch (DataAccessException ex) + { + // Avoid this exception shadowing the original exception. + } + throw CheckedExceptionTunnel.wrapIfNecessary(th); + } + } + + private void uploadQuantifications(MSQuantificationsDTO quantifications, DMDataSetDTO dataSet) + { + for (MSQuantificationDTO quantification : quantifications.getQuantifications()) + { + long quantificationId = + dao.addQuantification(dataSet.getId(), dataSet.getExperimentId(), + quantification); + uploadConcentrations(quantificationId, quantification.getConcentrations()); + } + } + + private void uploadConcentrations(long quantificationId, + List<MSConcentrationDTO> concentrations) + { + for (MSConcentrationDTO concentration : concentrations) + { + long concentrationId = dao.addConcentration(quantificationId, concentration); + uploadCompoundIds(concentrationId, concentration.getCompounds()); + } + } + + private void uploadCompoundIds(long concentrationId, ConcentrationCompounds compounds) + { + dao.addCompoundIds(concentrationId, compounds.getCompoundIds()); + } + + public static void main(String[] args) throws SQLException + { + final long start = System.currentTimeMillis(); + final QuantML2Database quantML2Database = + new QuantML2Database(DBUtils.createDefaultDBContext().getDataSource()); + final String dir = args[0]; + int permId = 0; + for (String f : new File(dir).list(createQuantFilter())) + { + System.out.println(f); + quantML2Database.uploadQuantMLFile(new File(dir, f), new DMDataSetDTO(Integer + .toString(++permId), "sample perm id", "sample name", "experiment perm id", + "experiment name")); + } + System.out.println((System.currentTimeMillis() - start) / 1000.0); + } + + private static FilenameFilter createQuantFilter() + { + return new FilenameFilter() + { + public boolean accept(File dir, String name) + { + return name.endsWith("." + ConstantsYeastX.QUANTML_EXT); + } + }; + } + +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLDataSetInfoExtractor.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLDataSetInfoExtractor.java new file mode 100644 index 00000000000..260157e6752 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLDataSetInfoExtractor.java @@ -0,0 +1,74 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException; +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.etlserver.DefaultDataSetInfoExtractor; +import ch.systemsx.cisd.etlserver.IDataSetInfoExtractor; +import ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService; +import ch.systemsx.cisd.openbis.dss.generic.shared.dto.DataSetInformation; +import ch.systemsx.cisd.yeastx.quant.dto.MSConcentrationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationsDTO; + +/** + * A default data set info extractor enriched with parent dataset codes. + * + * @author Tomasz Pylak + */ +public class QuantMLDataSetInfoExtractor implements IDataSetInfoExtractor +{ + private final IDataSetInfoExtractor defaultExtractor; + + public QuantMLDataSetInfoExtractor(final Properties globalProperties) + { + this.defaultExtractor = new DefaultDataSetInfoExtractor(globalProperties); + } + + public DataSetInformation getDataSetInformation(File incomingDataSetPath, + IEncapsulatedOpenBISService openbisService) throws UserFailureException, + EnvironmentFailureException + { + DataSetInformation dataSetInformation = + defaultExtractor.getDataSetInformation(incomingDataSetPath, openbisService); + List<String> parentDatasetCodes = extractParentDatasetCodes(incomingDataSetPath); + dataSetInformation.setParentDataSetCodes(parentDatasetCodes); + return dataSetInformation; + } + + private static List<String> extractParentDatasetCodes(File incomingDataSetPath) + { + MSQuantificationsDTO quantifications = + QuantMLParser.parseQuantifications(incomingDataSetPath); + List<String> parentDatasets = new ArrayList<String>(); + for (MSQuantificationDTO q : quantifications.getQuantifications()) + { + for (MSConcentrationDTO c : q.getConcentrations()) + { + parentDatasets.add(c.getParentDatasetCode()); + } + } + return parentDatasets; + } + +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java new file mode 100644 index 00000000000..d91ed30160d --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/QuantMLParser.java @@ -0,0 +1,100 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.io.File; +import java.io.IOException; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.SchemaOutputResolver; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.Result; +import javax.xml.transform.stream.StreamResult; + +import ch.systemsx.cisd.base.exceptions.CheckedExceptionTunnel; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationsDTO; + +/** + * Loader of MS Quantifications (*.quantML) XML file. + * + * @author Tomasz Pylak + */ +class QuantMLParser +{ + public static MSQuantificationsDTO parseQuantifications(File dataSet) + { + return new QuantMLParser().doParseMSQuantifications(dataSet); + } + + private final Unmarshaller unmarshaller; + + private QuantMLParser() + { + this.unmarshaller = createUnmarshaller(); + } + + private static Unmarshaller createUnmarshaller() + { + try + { + JAXBContext context = JAXBContext.newInstance(MSQuantificationsDTO.class); + + return context.createUnmarshaller(); + } catch (JAXBException ex) + { + throw CheckedExceptionTunnel.wrapIfNecessary(ex); + } + } + + public static void debugGenerateXmlSchema(JAXBContext context) + { + try + { + context.generateSchema(new SchemaOutputResolver() + { + @Override + public Result createOutput(String namespaceUri, String schemaName) + throws IOException + { + return new StreamResult(new File(".", schemaName)); + } + }); + } catch (IOException ex) + { + ex.printStackTrace(); + } + } + + private MSQuantificationsDTO doParseMSQuantifications(File dataSet) + { + + try + { + Object object = unmarshaller.unmarshal(dataSet); + if (object instanceof MSQuantificationsDTO == false) + { + throw new IllegalArgumentException("Wrong type: " + object); + } + return (MSQuantificationsDTO) object; + } catch (JAXBException ex) + { + throw CheckedExceptionTunnel.wrapIfNecessary(ex); + } + } + +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/XmlDateAdapter.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/XmlDateAdapter.java new file mode 100644 index 00000000000..0a8efd546c2 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/XmlDateAdapter.java @@ -0,0 +1,43 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +/** + * @author Tomasz Pylak + */ +public class XmlDateAdapter extends XmlAdapter<String, Date> +{ + static String PATTERN = "yyyy-MM-dd HH:mm:ss"; + + @Override + public String marshal(Date date) throws Exception + { + return new SimpleDateFormat(PATTERN).format(date); + } + + @Override + public Date unmarshal(String dateString) throws Exception + { + return new SimpleDateFormat(PATTERN).parse(dateString); + } + +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/ConcentrationCompounds.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/ConcentrationCompounds.java new file mode 100644 index 00000000000..dc07a43885c --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/ConcentrationCompounds.java @@ -0,0 +1,42 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant.dto; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; + +/** + * Stores all the compound ids of one concentration. + * + * @author Tomasz Pylak + */ +public class ConcentrationCompounds +{ + private List<Long> compoundIds; + + @XmlElement(name = "cmpdId", required = true) + public List<Long> getCompoundIds() + { + return compoundIds; + } + + public void setCompoundIds(List<Long> compoundIds) + { + this.compoundIds = compoundIds; + } +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSConcentrationDTO.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSConcentrationDTO.java new file mode 100644 index 00000000000..7f7f921ed27 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSConcentrationDTO.java @@ -0,0 +1,157 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant.dto; + +import javax.xml.bind.annotation.XmlElement; + +/** + * Stores the content of one concentration. + * + * @author Tomasz Pylak + */ +public class MSConcentrationDTO +{ + private String parentDatasetCode; // not null + + private double amount; // not null + + private String unit;// not null, can be empty + + private boolean valid;// not null + + private String comment; // can be null + + private double retentionTime;// not null + + private double q1; // not null + + private double q3;// not null + + private String internalStandard;// not null, can be empty + + private ConcentrationCompounds compounds; + + @XmlElement(required = true, name = "datasetParent") + public String getParentDatasetCode() + { + return parentDatasetCode; + } + + public void setParentDatasetCode(String parentDatasetCode) + { + this.parentDatasetCode = parentDatasetCode; + } + + @XmlElement(required = true, name = "amount") + public double getAmount() + { + return amount; + } + + public void setAmount(double amount) + { + this.amount = amount; + } + + @XmlElement(required = true, name = "unit") + public String getUnit() + { + return unit; + } + + public void setUnit(String unit) + { + this.unit = unit; + } + + @XmlElement(required = true, name = "valid") + public boolean isValid() + { + return valid; + } + + public void setValid(boolean valid) + { + this.valid = valid; + } + + @XmlElement(name = "comment") + public String getComment() + { + return comment; + } + + public void setComment(String comment) + { + this.comment = comment; + } + + @XmlElement(required = true, name = "retentionTime") + public double getRetentionTime() + { + return retentionTime; + } + + public void setRetentionTime(double retentionTime) + { + this.retentionTime = retentionTime; + } + + @XmlElement(required = true, name = "Q1") + public double getQ1() + { + return q1; + } + + public void setQ1(double q1) + { + this.q1 = q1; + } + + @XmlElement(required = true, name = "Q3") + public double getQ3() + { + return q3; + } + + public void setQ3(double q3) + { + this.q3 = q3; + } + + @XmlElement(required = true, name = "internalStandard") + public String getInternalStandard() + { + return internalStandard; + } + + public void setInternalStandard(String internalStandard) + { + this.internalStandard = internalStandard; + } + + @XmlElement(required = true, name = "identity") + public ConcentrationCompounds getCompounds() + { + return compounds; + } + + public void setCompounds(ConcentrationCompounds compounds) + { + this.compounds = compounds; + } +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationDTO.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationDTO.java new file mode 100644 index 00000000000..bb54fe84da8 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationDTO.java @@ -0,0 +1,112 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant.dto; + +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import ch.systemsx.cisd.yeastx.quant.XmlDateAdapter; + +/** + * Stores the content of one quantification. + * + * @author Tomasz Pylak + */ +public class MSQuantificationDTO +{ + private String source; + + private boolean valid; + + private String comment; + + private String registrator; + + private Date registrationDate; + + private List<MSConcentrationDTO> concentrations; + + @XmlElement(required = true, name = "source") + public String getSource() + { + return source; + } + + public void setSource(String source) + { + this.source = source; + } + + @XmlElement(required = true, name = "valid") + public boolean isValid() + { + return valid; + } + + public void setValid(boolean valid) + { + this.valid = valid; + } + + @XmlElement(name = "comment") + public String getComment() + { + return comment; + } + + public void setComment(String comment) + { + this.comment = comment; + } + + @XmlElement(name = "registrator") + public String getRegistrator() + { + return registrator; + } + + public void setRegistrator(String registrator) + { + this.registrator = registrator; + } + + @XmlElement(name = "registrationDate") + @XmlJavaTypeAdapter(value = XmlDateAdapter.class, type = Date.class) + public Date getRegistrationDate() + { + return registrationDate; + } + + public void setRegistrationDate(Date registrationDate) + { + this.registrationDate = registrationDate; + } + + @XmlElement(required = true, name = "concentration") + public List<MSConcentrationDTO> getConcentrations() + { + return concentrations; + } + + public void setConcentrations(List<MSConcentrationDTO> concetrations) + { + this.concentrations = concetrations; + } +} diff --git a/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationsDTO.java b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationsDTO.java new file mode 100644 index 00000000000..56365034192 --- /dev/null +++ b/rtd_yeastx/source/java/ch/systemsx/cisd/yeastx/quant/dto/MSQuantificationsDTO.java @@ -0,0 +1,47 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant.dto; + +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +/** + * Stores the content of the whole *.quantML file (all quantifications). + * + * @author Tomasz Pylak + */ +@XmlRootElement(name = "quantML") +@XmlType +public class MSQuantificationsDTO +{ + private List<MSQuantificationDTO> quantifications; + + @XmlElement(name = "msQuantification") + public List<MSQuantificationDTO> getQuantifications() + { + return quantifications; + } + + public void setQuantifications(List<MSQuantificationDTO> quantifications) + { + this.quantifications = quantifications; + } + +} diff --git a/rtd_yeastx/source/sql/postgresql/003/schema-003.sql b/rtd_yeastx/source/sql/postgresql/003/schema-003.sql index df0fd975512..65aff18ca8b 100644 --- a/rtd_yeastx/source/sql/postgresql/003/schema-003.sql +++ b/rtd_yeastx/source/sql/postgresql/003/schema-003.sql @@ -196,7 +196,7 @@ CREATE INDEX MS_QUANTIFICATION_FK_EXPE_ID_IDX ON MS_QUANTIFICATIONS(EXPE_ID); CREATE TABLE MS_QUANT_CONCENTRATIONS ( ID BIGSERIAL NOT NULL, MS_QUANTIFICATION_ID TECH_ID NOT NULL, - PARENT_DS_ID TECH_ID NOT NULL, + PARENT_DS_PERM_ID CODE NOT NULL, AMOUNT REAL NOT NULL, UNIT SHORT_LABEL NOT NULL, VALID BOOLEAN NOT NULL, @@ -212,6 +212,7 @@ CREATE TABLE MS_QUANT_CONCENTRATIONS ( -- Table MS_QUANT_COMPOUND CREATE TABLE MS_QUANT_COMPOUNDS ( + ID BIGSERIAL NOT NULL, MS_QUANT_CONCENTRATION_ID TECH_ID NOT NULL, COMPOUND_ID TECH_ID NOT NULL, CONSTRAINT FK_QUANT_COMPOUND_1 FOREIGN KEY (MS_QUANT_CONCENTRATION_ID) REFERENCES MS_QUANT_CONCENTRATIONS (ID) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/rtd_yeastx/source/sql/postgresql/migration/migration-002-003.sql b/rtd_yeastx/source/sql/postgresql/migration/migration-002-003.sql index bbaece7368c..fd4fa370bee 100644 --- a/rtd_yeastx/source/sql/postgresql/migration/migration-002-003.sql +++ b/rtd_yeastx/source/sql/postgresql/migration/migration-002-003.sql @@ -31,7 +31,7 @@ CREATE INDEX MS_QUANTIFICATION_FK_EXPE_ID_IDX ON MS_QUANTIFICATIONS(EXPE_ID); CREATE TABLE MS_QUANT_CONCENTRATIONS ( ID BIGSERIAL NOT NULL, MS_QUANTIFICATION_ID TECH_ID NOT NULL, - PARENT_DS_ID TECH_ID NOT NULL, + PARENT_DS_PERM_ID CODE NOT NULL, AMOUNT REAL NOT NULL, UNIT SHORT_LABEL NOT NULL, VALID BOOLEAN NOT NULL, @@ -47,6 +47,7 @@ CREATE TABLE MS_QUANT_CONCENTRATIONS ( -- Table MS_QUANT_COMPOUND CREATE TABLE MS_QUANT_COMPOUNDS ( + ID BIGSERIAL NOT NULL, MS_QUANT_CONCENTRATION_ID TECH_ID NOT NULL, COMPOUND_ID TECH_ID NOT NULL, CONSTRAINT FK_QUANT_COMPOUND_1 FOREIGN KEY (MS_QUANT_CONCENTRATION_ID) REFERENCES MS_QUANT_CONCENTRATIONS (ID) ON DELETE CASCADE ON UPDATE CASCADE diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMLParserTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMLParserTest.java new file mode 100644 index 00000000000..45ef8ad8ba3 --- /dev/null +++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMLParserTest.java @@ -0,0 +1,94 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.io.File; +import java.util.Date; +import java.util.List; + +import org.testng.AssertJUnit; +import org.testng.annotations.Test; + +import ch.systemsx.cisd.yeastx.quant.dto.MSConcentrationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationDTO; +import ch.systemsx.cisd.yeastx.quant.dto.MSQuantificationsDTO; + +/** + * @author Tomasz Pylak + */ +public class QuantMLParserTest extends AssertJUnit +{ + @Test + public void testParseQuantFileRealContent() + { + File file = new File("resource/examples/TEST&TEST_PROJECT&TEST_EXP.quantML"); + MSQuantificationsDTO quantifications = QuantMLParser.parseQuantifications(file); + assertEquals(1, quantifications.getQuantifications().size()); + MSQuantificationDTO quantification = quantifications.getQuantifications().get(0); + assertEquals("msSoft", quantification.getSource()); + assertTrue(quantification.isValid()); + assertNull(quantification.getComment()); + assertNull(quantification.getRegistrator()); + assertNull(quantification.getRegistrationDate()); + + assertEquals(52, quantification.getConcentrations().size()); + MSConcentrationDTO concentration = quantification.getConcentrations().get(0); + assertEquals(0.689155, concentration.getAmount()); + assertEquals("", concentration.getComment()); + assertTrue(concentration.isValid()); + assertEquals("20090822211007858-23605", concentration.getParentDatasetCode()); + assertEquals("", concentration.getInternalStandard()); + assertEquals("", concentration.getUnit()); + assertEquals(664.1, concentration.getQ1()); + assertEquals(408.0, concentration.getQ3()); + assertEquals(939.5, concentration.getRetentionTime()); + List<Long> compoundIds = concentration.getCompounds().getCompoundIds(); + assertEquals(1, compoundIds.size()); + assertEquals(23806, compoundIds.get(0).longValue()); + } + + @Test + public void testParseQuantFileFullContent() throws Exception + { + File file = new File("resource/examples/allFields.quantML"); + MSQuantificationsDTO quantifications = QuantMLParser.parseQuantifications(file); + assertEquals(1, quantifications.getQuantifications().size()); + MSQuantificationDTO quantification = quantifications.getQuantifications().get(0); + assertEquals("msSoft", quantification.getSource()); + assertTrue(quantification.isValid()); + assertEquals("no comment", quantification.getComment()); + assertEquals("John Doe", quantification.getRegistrator()); + Date expectedDate = new XmlDateAdapter().unmarshal("2009-04-07 12:00:21"); + assertEquals(expectedDate, quantification.getRegistrationDate()); + + assertEquals(1, quantification.getConcentrations().size()); + MSConcentrationDTO concentration = quantification.getConcentrations().get(0); + assertEquals(0.689155, concentration.getAmount()); + assertEquals("concentration comment", concentration.getComment()); + assertTrue(concentration.isValid()); + assertEquals("20090822211007858-23605", concentration.getParentDatasetCode()); + assertEquals("value1", concentration.getInternalStandard()); + assertEquals("kg", concentration.getUnit()); + assertEquals(664.1, concentration.getQ1()); + assertEquals(408.0, concentration.getQ3()); + assertEquals(939.5, concentration.getRetentionTime()); + List<Long> compundIds = concentration.getCompounds().getCompoundIds(); + assertEquals(2, compundIds.size()); + assertEquals(1, compundIds.get(0).longValue()); + assertEquals(2, compundIds.get(1).longValue()); + } +} diff --git a/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java new file mode 100644 index 00000000000..2885f5fde54 --- /dev/null +++ b/rtd_yeastx/sourceTest/java/ch/systemsx/cisd/yeastx/quant/QuantMSDAOTest.java @@ -0,0 +1,63 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.yeastx.quant; + +import java.io.File; +import java.sql.SQLException; + +import net.lemnik.eodsql.QueryTool; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import ch.systemsx.cisd.yeastx.db.AbstractDBTest; +import ch.systemsx.cisd.yeastx.db.DMDataSetDTO; + +/** + * @author Tomasz Pylak + */ +public class QuantMSDAOTest extends AbstractDBTest +{ + private IQuantMSDAO quantmsDAO; + + @BeforeMethod(alwaysRun = true) + public void setDAO() throws SQLException + { + quantmsDAO = QueryTool.getQuery(datasource, IQuantMSDAO.class); + } + + @AfterMethod(alwaysRun = true) + public void close() + { + if (quantmsDAO != null) + { + quantmsDAO.close(); + } + } + + @Test + public void testUploadFiaML() throws SQLException + { + QuantML2Database uploader = new QuantML2Database(datasource); + DMDataSetDTO dataSetDTO = + new DMDataSetDTO("data set perm id", "sample perm id", "sample name", + "experiment perm id", "experiment name"); + uploader.uploadQuantMLFile(new File("resource/examples/allFields.quantML"), dataSetDTO); + } + +} -- GitLab