Repository: mwang87/MassQueryLanguage (language: python)

Issue:
[Testing] Update Integration testing



Discussion / hints:

Fix patch:
diff --git a/.gitmodules b/.gitmodules
index 46bf2ca..1dafb18 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,6 @@
 [submodule "proteosafe/CCMSDeployments"]
 	path = proteosafe/CCMSDeployments
 	url = https://github.com/CCMS-UCSD/CCMSDeployments.git
+[submodule "proteosafe/CCMS-Integration-Tests"]
+	path = proteosafe/CCMS-Integration-Tests
+	url = https://github.com/CCMS-UCSD/CCMS-Integration-Tests.git
diff --git a/massql/msql_engine.py b/massql/msql_engine.py
index 86a2ca6..9f62d60 100644
--- a/massql/msql_engine.py
+++ b/massql/msql_engine.py
@@ -110,6 +110,7 @@ def _evalute_variable_query(parsed_dict, input_filename, cache=True, parallel=Fa
         for value in condition["value"]:
             try:
                 # Checking if X is in any string
+                # TODO: Check multiple conditions, to see if any of them have an X, e.g. (101 OR X-10)
                 if "X" in value[0]:
                     if value == "X":
                         # This is the main varaible, not expression containing it
@@ -186,6 +187,7 @@ def _evalute_variable_query(parsed_dict, input_filename, cache=True, parallel=Fa
 
         masses_considered_df = pd.DataFrame()
         masses_considered_df["mz"] = pd.concat(masses_considered_df_list)
+        # NOTE: This might cause bugs, we might consider every mass within every single scan, or at least we could make the tolernace as even smaller than half the max
         masses_considered_df["mz_max"] = masses_considered_df["mz"].apply(lambda x: _determine_mz_max(x, variable_properties["ppm_tolerance"], variable_properties["da_tolerance"]))
         
         masses_considered_df = masses_considered_df.sort_values("mz")
diff --git a/proteosafe/CCMS-Integration-Tests b/proteosafe/CCMS-Integration-Tests
new file mode 160000
index 0000000..4384137
--- /dev/null
+++ b/proteosafe/CCMS-Integration-Tests
@@ -0,0 +1,1 @@
+Subproject commit 43841376c8167389f8bc64af3529b163e191825c
diff --git a/proteosafe/Makefile b/proteosafe/Makefile
new file mode 100644
index 0000000..4e67f65
--- /dev/null
+++ b/proteosafe/Makefile
@@ -0,0 +1,17 @@
+-include Makefile.credentials
+
+test-manual-beta-msql-nf:
+	python ./CCMS-Integration-Tests/workflow_integration/submit_test_job_batch.py \
+	--credential_username ${CCMS_TESTUSER_USERNAME} \
+	--credential_password ${CCMS_TESTUSER_PASSWORD} \
+	--workflow_version ${WORKFLOW_VERSION} \
+	--credential_server proteomics3.ucsd.edu \
+	--workflow_task_file msql-nf/test-integration-workflow/test_tasks.csv
+
+test-manual-gnps-msql-nf:
+	python ./CCMS-Integration-Tests/workflow_integration/submit_test_job_batch.py \
+	--credential_username ${CCMS_TESTUSER_USERNAME} \
+	--credential_password ${CCMS_TESTUSER_PASSWORD} \
+	--workflow_version ${WORKFLOW_VERSION} \
+	--credential_server gnps.ucsd.edu \
+	--workflow_task_file msql-nf/test-integration-workflow/test_tasks.csv
\ No newline at end of file
diff --git a/proteosafe/README.md b/proteosafe/README.md
index 2377dbd..78a70d2 100644
--- a/proteosafe/README.md
+++ b/proteosafe/README.md
@@ -3,4 +3,21 @@
 1. msql - deprecated
 1. msql-nf - user selected datasets to query
 1. msql-repo-nf - user selected datasets
-1. msql-full-repo-nf - updating
\ No newline at end of file
+1. msql-full-repo-nf - updating
+
+## Deployment
+
+We are using the standard proteosafe deployment scripts within each workflow folder
+## Testing
+
+Beta
+
+```
+make test-manual-beta-msql-nf
+```
+
+GNPS
+
+```
+make test-manual-gnps-msql-nf
+```
\ No newline at end of file


Test patch:
diff --git a/proteosafe/msql-nf/test-integration-workflow/test_tasks.csv b/proteosafe/msql-nf/test-integration-workflow/test_tasks.csv
new file mode 100644
index 0000000..fc0f816
--- /dev/null
+++ b/proteosafe/msql-nf/test-integration-workflow/test_tasks.csv
@@ -0,0 +1,6 @@
+task_id,description,regressioncountviews
+f875745343574b1680138b6e12103afd,sanity test,query_results
+3afe33c186a44bfe945a74d21c06f51e,Fusaricidin,query_results
+db21c5c316034b09a74668b53828b39b,Trimethoprem,query_results
+3290b45278624b9b877bdee60dfbc7b3,Brominated,query_results
+fcb68f55a00c4ea39153266cd2bd42de,Iron OR queries,query_results
diff --git a/proteosafe/msql-nf/test-integration-workflow/test_tasks.tsv b/proteosafe/msql-nf/test-integration-workflow/test_tasks.tsv
deleted file mode 100644
index 9366f14..0000000
--- a/proteosafe/msql-nf/test-integration-workflow/test_tasks.tsv
+++ /dev/null
@@ -1,6 +0,0 @@
-task_id,description,regressioncountviews
-f875745343574b1680138b6e12103afd,sanity test,query_results
-1ea2218dca694a3caec42c62aa8ce8e5,Fusaricidin,query_results
-db21c5c316034b09a74668b53828b39b,Trimethoprem,query_results
-4680a9f0057146979fd6a922e0c39153,Brominated,query_results
-abde4e2dd65a4ea496827434ad407dd7,GlycoAlkaloid - multiple queries,query_results
\ No newline at end of file
diff --git a/tests/test_query.py b/tests/test_query.py
index 55b08ec..a56e754 100644
--- a/tests/test_query.py
+++ b/tests/test_query.py
@@ -448,27 +448,17 @@ def test_topdown():
     print(results_df)
 
 
-@pytest.mark.skip(reason="too slow")
-def test_double_brominated():
-    #msql_engine.init_ray()
+def test_quad_brominated():
 
     query = "QUERY scaninfo(MS1DATA) WHERE \
-        RTMIN=11.6 \
-        AND RTMAX=12.2 \
-        AND MS1MZ=X:TOLERANCEMZ=0.1:INTENSITYPERCENT=25:INTENSITYMATCH=Y:INTENSITYMATCHREFERENCE \
-        AND MS1MZ=X+2:TOLERANCEMZ=0.1:INTENSITYMATCH=Y*0.5:INTENSITYMATCHPERCENT=30 \
-        AND MS1MZ=X-2:TOLERANCEMZ=0.1:INTENSITYMATCH=Y*0.5:INTENSITYMATCHPERCENT=30 \
-        AND MS1MZ=X+4:TOLERANCEMZ=0.3:INTENSITYMATCH=Y*0.25:INTENSITYMATCHPERCENT=30 \
-        AND MS1MZ=X-4:TOLERANCEMZ=0.3:INTENSITYMATCH=Y*0.25:INTENSITYMATCHPERCENT=30"
-
-    # query = "QUERY scaninfo(MS1DATA) WHERE \
-    #     RTMIN=11.6 \
-    #     AND RTMAX=12.2 \
-    #     AND MS1MZ=614.79895019:TOLERANCEMZ=0.1:INTENSITYPERCENT=25:INTENSITYMATCH=Y:INTENSITYMATCHREFERENCE \
-    #     AND MS1MZ=616.79895019:TOLERANCEMZ=0.1:INTENSITYMATCH=Y*0.5:INTENSITYMATCHPERCENT=30 \
-    #     AND MS1MZ=612.79895019:TOLERANCEMZ=0.1:INTENSITYMATCH=Y*0.5:INTENSITYMATCHPERCENT=30 \
-    #     AND MS1MZ=618.79895019:TOLERANCEMZ=0.3:INTENSITYMATCH=Y*0.25:INTENSITYMATCHPERCENT=30 \
-    #     AND MS1MZ=610.79895019:TOLERANCEMZ=0.3:INTENSITYMATCH=Y*0.25:INTENSITYMATCHPERCENT=30"
+        RTMIN=11.8 AND \
+        RTMAX=12 \
+        MS1MZ=X:TOLERANCEMZ=0.2:INTENSITYPERCENT=25:INTENSITYMATCH=Y:INTENSITYMATCHREFERENCE AND \
+        MS1MZ=X+2:TOLERANCEMZ=0.2:INTENSITYMATCH=Y*0.66:INTENSITYMATCHPERCENT=30 AND \
+        MS1MZ=X-2:TOLERANCEMZ=0.2:INTENSITYMATCH=Y*0.66:INTENSITYMATCHPERCENT=30 AND \
+        MS1MZ=X+4:TOLERANCEMZ=0.2:INTENSITYMATCH=Y*0.17:INTENSITYMATCHPERCENT=40 AND \
+        MS1MZ=X-4:TOLERANCEMZ=0.2:INTENSITYMATCH=Y*0.17:INTENSITYMATCHPERCENT=40 AND \
+        X=range(min=572,max=573)"
 
     parse_obj = msql_parser.parse_msql(query)
     print(json.dumps(parse_obj, indent=4))
@@ -605,7 +595,8 @@ def main():
     #test_nocache()
     #test_topdown()
     #test_defect()
-    test_or_against_iron()
+    #test_or_against_iron()
+    test_quad_brominated()
 
 if __name__ == "__main__":
     main()