Skip to content

Commit

Permalink
Merge branch 'master' into datatables
Browse files Browse the repository at this point in the history
  • Loading branch information
mwang87 committed Sep 9, 2019
2 parents d45a251 + 23c6297 commit 5da7054
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyc
code/credentials.py
*credentials.py
database/metadata.db
3 changes: 3 additions & 0 deletions code/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
<li class="nav-item">
<a class="nav-link" href="/datalookup">File Query - Sample Information</a>
</li>
<li class="nav-item">
<a class="nav-link" href="ftp://massive.ucsd.edu/MSV000084206/other/ReDU_all_identifications.tsv">Download Annotations</a>
</li>
</ul>

</nav>
Expand Down
51 changes: 22 additions & 29 deletions code/test/test_redu_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,24 @@
import json

BASE_URL = "https://redu.ucsd.edu/"
URL_ONE = "displayglobalmultivariate"
URL_TWO = "processcomparemultivariate"
SAMPLE_TASK_ID = "ffa003f6c4d844188f1f751d34c649b0"
URL_THREE = "ReDUValidator" #optional
URL_FIVE = "compoundfilename"
TEST_COMPOUND = "2,5-Dimethoxyphenethylamine"
URL_SIX = "compoundenrichment"
URL_FOUR = "/attributes"
URL_SEVEN = "attribute/MassSpectrometer/attributeterms?filters=%5B%5D"
URL_EIGHT = "dump"

def test_pca_library_search(self):
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(self):
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(self):
def test_pca_feature_based():
query_url = BASE_URL + "processcomparemultivariate?task={}".format("bb49a839face44cbb5ec3e6f855e7285")
r = requests.get(query_url)
r.raise_for_status()
Expand All @@ -38,56 +30,57 @@ def test_pca_feature_based(self):


def test_data_dump():
query_url = BASE_URL + URL_EIGHT
query_url = BASE_URL + "dump"
response = requests.get(query_url)
data = response.content
file_size = sys.getsizeof(data)

if file_size < 17762000:
sys.exit(1)
return 1

return 0

def test_attribute_filtration():
query_url = BASE_URL + URL_SEVEN
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())
print(key_value)
expected_keys = ["attributename", "attributeterm", "ontologyterm", "countfiles"]

if (key_value != expected_keys):
sys.exit(1)
return 1

return 0


def test_attribute_terms_display():
query_url = BASE_URL + URL_FOUR
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):
sys.exit(1)
return 1

return 0

def test_file_enrichment():
query_url = BASE_URL + URL_FIVE
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'):
sys.exit(1)
return 1

return 0

def test_compound_enrichment():
query_url = BASE_URL + URL_SIX
query_url = BASE_URL + "compoundenrichment"
params = {'compoundname' : TEST_COMPOUND}
response = requests.post(query_url, params )
data = json.loads(response.content)
Expand All @@ -96,29 +89,29 @@ def test_compound_enrichment():
expected_keys = ["attribute_name", "attribute_term", "totalfiles", "compoundfiles", "percentage"]

if key_value != expected_keys:
sys.exit(1)
return 1

return 0

def test_your_pca():
params = {'task': SAMPLE_TASK_ID}
query_url = BASE_URL + URL_TWO
query_url = BASE_URL + "processcomparemultivariate"
response = requests.get(query_url, params = params)
data = response.content
file_size = sys.getsizeof(data)

if (file_size < 28000000):
sys.exit(1)
return 1

return 0


def test_global_pca():
response = requests.get(BASE_URL + URL_ONE)
response = requests.get(BASE_URL + "displayglobalmultivariate")
data = response.content
file_size = sys.getsizeof(data)
if (file_size < 27762100):
sys.exit(1)
file_size = sys.getsizeof(data)

if (file_size < 27760000):
return 1

return 0

0 comments on commit 5da7054

Please sign in to comment.