-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mwang87/ReDU-MS2-GNPS
- Loading branch information
Showing
15 changed files
with
855 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import os | ||
import sys | ||
import requests | ||
import json | ||
|
||
BASE_URL = "https://redu.ucsd.edu/" | ||
SAMPLE_TASK_ID = "ffa003f6c4d844188f1f751d34c649b0" | ||
TEST_COMPOUND = "2,5-Dimethoxyphenethylamine" | ||
|
||
def test_pca_library_search(): | ||
query_url = BASE_URL + "processcomparemultivariate?task={}".format("f39c94cb7afe4568950bf61cdb8fee0d") | ||
r = requests.get(query_url) | ||
r.raise_for_status() | ||
|
||
return 0 | ||
|
||
def test_pca_metabolomics_snets(): | ||
query_url = BASE_URL + "processcomparemultivariate?task={}".format("1ad7bc366aef45ce81d2dfcca0a9a5e7") | ||
r = requests.get(query_url) | ||
r.raise_for_status() | ||
|
||
return 0 | ||
|
||
def test_pca_feature_based(): | ||
query_url = BASE_URL + "processcomparemultivariate?task={}".format("bb49a839face44cbb5ec3e6f855e7285") | ||
r = requests.get(query_url) | ||
r.raise_for_status() | ||
|
||
return 0 | ||
|
||
|
||
def test_data_dump(): | ||
query_url = BASE_URL + "dump" | ||
response = requests.get(query_url) | ||
data = response.content | ||
file_size = sys.getsizeof(data) | ||
|
||
if file_size < 17762000: | ||
return 1 | ||
|
||
return 0 | ||
|
||
def test_attribute_filtration(): | ||
query_url = BASE_URL + "attribute/MassSpectrometer/attributeterms?filters=%5B%5D" | ||
response = requests.get(query_url) | ||
data = json.loads(response.content) | ||
key_value = list(data[0].keys()) | ||
expected_keys = ["attributename", "attributeterm", "ontologyterm", "countfiles"] | ||
|
||
if (key_value != expected_keys): | ||
return 1 | ||
|
||
return 0 | ||
|
||
|
||
def test_attribute_terms_display(): | ||
query_url = BASE_URL + "/attributes" | ||
response = requests.get(query_url) | ||
data = json.loads(response.content) | ||
key_value = list(data[0].keys()) | ||
|
||
expected_keys = ["attributename", "attributedisplay", "countterms"] | ||
|
||
if (key_value != expected_keys): | ||
return 1 | ||
|
||
return 0 | ||
|
||
def test_file_enrichment(): | ||
query_url = BASE_URL + "compoundfilename" | ||
params = {'compoundname' : TEST_COMPOUND} | ||
response = requests.get(query_url, params = params) | ||
data = json.loads(response.content) | ||
|
||
key_value = next(iter(data[0])) | ||
|
||
if (key_value != 'filepath'): | ||
return 1 | ||
|
||
return 0 | ||
|
||
def test_compound_enrichment(): | ||
query_url = BASE_URL + "compoundenrichment" | ||
params = {'compoundname' : TEST_COMPOUND} | ||
response = requests.post(query_url, params ) | ||
data = json.loads(response.content) | ||
key_value = list(data[0].keys()) | ||
|
||
expected_keys = ["attribute_name", "attribute_term", "totalfiles", "compoundfiles", "percentage"] | ||
|
||
if key_value != expected_keys: | ||
return 1 | ||
|
||
return 0 | ||
|
||
def test_your_pca(): | ||
params = {'task': SAMPLE_TASK_ID} | ||
query_url = BASE_URL + "processcomparemultivariate" | ||
response = requests.get(query_url, params = params) | ||
data = response.content | ||
file_size = sys.getsizeof(data) | ||
|
||
if (file_size < 28000000): | ||
return 1 | ||
|
||
return 0 | ||
|
||
|
||
def test_global_pca(): | ||
response = requests.get(BASE_URL + "displayglobalmultivariate") | ||
data = response.content | ||
file_size = sys.getsizeof(data) | ||
|
||
if (file_size < 27760000): | ||
return 1 | ||
|
||
return 0 |
Oops, something went wrong.