Expression Tests¶
This page outlines the success and failure criteria for all tests of Expression resources.
Expression API Tests¶
Expression API tests assert the correct configuration of expression-related API routes. In order for a test case to succeed, the following conditions must be met when evaluating the response:
For all cases,
Content-Type
checking is enforced. The response MUST have aContent-Type
header ofapplication/vnd.ga4gh.rnaget.v1.0.0+json
ORapplication/json
For all cases,
Status Code
checking is enforced. The response MUST have the expected status codeFor all cases, schema checking is enforced. The json object in the response body MUST conform to a pre-defined schema of required fields and data types, which is specific to each API route
Expression API Test Cases¶
Get Supported Expression Formats¶
Route:
/expressions/formats
Description: Requests the available expression data file formats on the server. Expects an array of strings to be returned in the response body.
Rationale: Asserts that
/expressions/formats
returns an array of strings, indicating which expression file formats the server supportsRequest:
GET /expressions/formats
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
[
"loom",
"tsv"
]
Success Criteria:
Status Code == 200
AND response body is an array of strings in json formatFailure Criteria:
Status Code != 200
OR response body is NOT an array of strings in json format
Expression Filters¶
Route:
/expressions/filters
Description: Requests the filters that can be used to narrow search results for a list of
Expressions
Rationale: Asserts that the endpoint returns an array of
filter
objectsRequest:
GET /expressions/filters
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
[
{
"fieldType": "string",
"values": [
"1.0"
],
"filter": "version",
"description": "version to search for"
},
{
"fieldType": "string",
"filter": "studyID",
"description": "parent studyID"
}
]
Success Criteria:
Status Code == 200
AND response body is array offilters
Failure Criteria:
Status Code != 200
OR response body is NOT array offilters
Get Test Expression Ticket¶
Route:
/expressions/<id>/ticket
Description: Requests test expression
ticket
by itsid
. Expects the returned expression to match theticket
json schema.Rationale: Asserts that the
/expressions/<id>/ticket
endpoint returns a validticket
.Request:
GET /expressions/ac3e9279efd02f1c98de4ed3d335b98e/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"id": "ac3e9279efd02f1c98de4ed3d335b98e",
"version": "1.0",
"studyID": "f3ba0b59bed0fa2f1030e7cb508324d1",
"url": "https://url/to/expression/file",
"units": "TPM",
"fileType": "loom/tsv"
}
Success Criteria:
Status Code == 200
AND response body is validticket
Failure Criteria:
Status Code != 200
OR response body is NOT validticket
Single Expression Ticket - Not Found¶
Route:
/expressions/<id>/ticket
Description: Requests an expression ticket with an invalid
id
, that is, anid
that does not correspond to anyExpression
on the server. Expects a404 Not Found
status code in the response, and a response body with an error message.Rationale: Asserts that the
/expressions/<id>/ticket
endpoint does not return arbitraryticket
.Request:
GET /expressions/nonexistentid9999999999999999999/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 404 Not Found
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"message": "Entry not found in database."
}
Success Criteria:
Status Code == 404
AND response body is validError
jsonFailure Criteria:
Status Code != 404
OR response body is NOT validError
json
Get Test Expression Bytes¶
Route:
/expressions/<id>/bytes
Description: Requests test expression matrix as
bytes
by itsid
.Rationale: Asserts that the
/expressions/<id>/bytes
endpoint returns matrix bytes.Request:
GET /expressions/ac3e9279efd02f1c98de4ed3d335b98e/bytes
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Success Criteria:
Status Code == 200
Failure Criteria:
Status Code != 200
Single Expression Bytes - Not Found¶
Route:
/expressions/<id>/bytes
Description: Requests expression matrix
bytes
with an invalidid
that doesn’t correspond to anyExpression
on the server. Expects a404 Not Found
status code and an error message in response body.Rationale: Asserts that the
/expressions/<id>/bytes
endpoint does not return arbitrary matrix.Request:
GET /expressions/nonexistentid9999999999999999999/bytes
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 404 Not Found
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"message": "Entry not found in database."
}
Success Criteria:
Status Code == 404
AND response body is validError
jsonFailure Criteria:
Status Code != 404
OR response body is NOT validError
json
Expression Ticket by Format¶
Route:
/expressions/ticket
Description: Requests joined matrix, specifying only the required ‘format’ parameter. Expects
ticket
response.Rationale: Asserts that the
/expressions/ticket
returns a validticket
.Request:
GET /expressions/ticket?format=loom
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"studyID": "6cccbbd76b9c4837bd7342dd616d0fec",
"url": "/path/to/E-MTAB-5423-query-results.tpms.loom",
"units": "TPM",
"version": "1.0",
"fileType": "loom"
}
Success Criteria:
Status Code == 200
AND response body isticket
Failure Criteria:
Status Code != 200
OR response body is NOTticket
Expression Ticket - All Filters¶
Route:
/expressions/ticket
Description: Requests joined matrix, using all filtering parameters associated with test expression. Expects
ticket
.Rationale: Asserts that
/expressions/ticket
returnsticket
when specifying filters.Request:
GET /expressions/ticket?format=loom&version=1.0&studyID=f3ba0b59bed0fa2f1030e7cb508324d1
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"url": "https://path/to/expression.loom",
"units": "TPM",
"fileType": "loom"
}
Success Criteria:
Status Code == 200
AND response body isticket
Failure Criteria:
Status Code != 200
OR response body is NOTticket
Expression Ticket - Single Filter, 1¶
Route:
/expressions/ticket
Description: Requests joined matrix using only 1 filtering parameter associated with test expression (in addition to format). Expects
ticket
.Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields a valid
ticket
.Requests:
GET /expressions/ticket?format=loom&version=1.0
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"url": "https://path/to/expression.loom",
"units": "TPM",
"version": "1.0",
"fileType": "loom"
}
Success Criteria:
Status Code == 200
AND response body isticket
Failure Criteria:
Status Code != 200
OR response body is NOTticket
Expression Ticket - Single Filter, 2¶
Route:
/expressions/ticket
Description: Requests joined matrix using only 1 filtering parameter (a different filter than above) associated with test expression (in addition to format). Expects
ticket
.Rationale: Asserts filtering parameters can be used independently of one another, and that each filter yields a valid
ticket
.Requests:
GET /expressions/ticket?format=loom&studyID=f3ba0b59bed0fa2f1030e7cb508324d1
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"studyID": "f3ba0b59bed0fa2f1030e7cb508324d1",
"url": "/path/to/expression.loom",
"units": "TPM",
"fileType": "loom"
}
Success Criteria:
Status Code == 200
AND response body isticket
.Failure Criteria:
Status Code != 200
OR response body is NOTticket
.
Expression Ticket - Format Not Specified¶
Route:
/expressions/ticket
Description: Requests joined matrix WITHOUT specifying the required
format
parameter. Expects a4xx
response with error message.Rationale: As the
format
parameter is required to specify file format for the/expressions/ticket
endpoint, this test asserts malformed requests raise an error.Request:
GET /expressions/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 400 Bad Request
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"message": "Input payload validation failed"
}
Success Criteria:
Status Code == 4xx
AND response body is validError
jsonFailure Criteria:
Status Code != 4xx
AND response body is NOT validError
json
Expression Ticket - Filetype Matches¶
Route:
/expressions/ticket
Description: Requests joined matrix, only specifying the required
format
parameter. Checks thatticket
has afileType
matching requestedformat
.Rationale: Asserts that the
/expressions/ticket
endpoint returnsticket
with fileType matching the request.Request:
GET /expressions/ticket?format=loom
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"url": "/path/to/E-MTAB-5423-query-results.tpms.loom",
"units": "TPM",
"fileType": "loom"
}
Success Criteria:
Status Code == 200
AND response body isticket
ANDfileType
matches requestedformat
Failure Criteria:
Status Code != 200
OR response body is NOTticket
ORfileType
DOES NOT match requestedformat
Expression Bytes by Format¶
Route:
/expressions/bytes
Description: Requests joined matrix bytes, only specifying the required
format
parameter.Rationale: Asserts that the
/expressions/bytes
endpoint returns matrix bytes.Request:
GET /expressions/bytes?format=loom
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Success Criteria:
Status Code == 200
Failure Criteria:
Status Code != 200
Expression Bytes - All Filters¶
Route:
/expressions/bytes
Description: Requests joined matrix bytes using all expression filters.
Rationale: Asserts that the
/expressions/bytes
endpoint returns matrix bytes when all filters are provided.Request:
GET /expressions/bytes?format=loom&version=1.0&studyID=f3ba0b59bed0fa2f1030e7cb508324d1
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Success Criteria:
Status Code == 200
Failure Criteria:
Status Code != 200
Expression Bytes - Single Filter, 1¶
Route:
/expressions/bytes
Description: Requests joined matrix bytes using one expression filter (in addition to format).
Rationale: Asserts filter parameters can be used independently of one another.
Request:
GET /expressions/bytes?format=loom&version=1.0
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Success Criteria:
Status Code == 200
Failure Criteria:
Status Code != 200
Expression Bytes - Single Filter, 2¶
Route:
/expressions/bytes
Description: Requests joined matrix bytes using one expression filter (different than above), in addition to format.
Rationale: Asserts filter parameters can be used independently of one another.
Request:
GET /expressions/bytes?format=loom&studyID=f3ba0b59bed0fa2f1030e7cb508324d1
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Success Criteria:
Status Code == 200
Failure Criteria:
Status Code != 200
Expression Bytes - Format Not Specified¶
Route:
/expressions/bytes
Description: Requests joined matrix bytes WITHOUT specifying required
format
parameter. Expects a4xx
response with error message.Rationale: As the
format
parameter is required to specify file format for the/expressions/bytes
endpoint, this test asserts malformed requests raise an error.Request:
GET /expressions/bytes
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 400 Bad Request
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
{
"message": "Input payload validation failed"
}
Success Criteria:
Status Code == 4xx
AND response body is validError
jsonFailure Criteria:
Status Code != 4xx
AND response body is NOT validError
json
Expression API Non-Implemented Test Cases¶
Expression Formats Not Implemented¶
Route:
/expressions/formats
Description: If the
Expressions
endpoint is specified asNot Implemented
in the config file, then this test will be run. Requests the/expressions/formats
endpoint, expecting a501 Not Implemented
status code responseRationale: Asserts that
Expression
related endpoints are correctly non-implemented according to the specRequest:
GET /expressions/formats
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Ticket by Id Not Implemented¶
Route:
/expressions/<id>/ticket
Description: If expressions endpoints are
Not Implemented
, this test will request/expressions/<id>/ticket
, expecting a501 Not Implemented
status code responseRationale: Asserts
Expression
related endpoints are correctly non-implementedRequest:
GET /expressions/nonexistentid9999999999999999999/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Bytes by Id Not Implemented¶
Route:
/expressions/<id>/bytes
Description: If expressions endpoints are
Not Implemented
, this test will request/expressions/<id>/bytes
, expecting a501 Not Implemented
status code responseRationale: Asserts
Expression
related endpoints are correctly non-implementedRequest:
GET /expressions/nonexistentid9999999999999999999/bytes
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Filters Not Implemented¶
Route:
/expressions/filters
Description: If expressions endpoints are
Not Implemented
, this test will request/expressions/filters
, expecting a501 Not Implemented
status code responseRationale: Asserts that
Expression
related endpoints are correctly non-implementedRequest:
GET /expressions/filters
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Ticket Not Implemented¶
Route:
/expressions/ticket
Description: If expressions endpoints are
Not Implemented
, this test will request/expressions/ticket
, expecting a501 Not Implemented
status code responseRationale: Asserts that
Expression
related endpoints are correctly non-implementedRequest:
GET /expressions/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Bytes Not Implemented¶
Route:
/expressions/bytes
Description: If expressions endpoints are
Not Implemented
, this test will request/expressions/bytes
, expecting a501 Not Implemented
status code responseRationale: Asserts that
Expression
related endpoints are correctly non-implementedRequest:
GET /expressions/bytes
Accept: application/octet-stream, application/vnd.loom, text/tab-separated-values
Successful Response:
HTTP/1.1 501 Not Implemented
Content-Type: application/vnd.ga4gh.rnaget.v1.0.0+json
Success Criteria:
Status Code == 501
Failure Criteria:
Status Code != 501
Expression Content Tests¶
Expression content tests assert that expression matrices downloaded from the RNAget server contain the expected content/results based on the request. Matrix rows, columns, and values are cross-referenced against the request to ensure the correct data has been returned.
Expression Content Test Cases¶
Expression Ticket by Id Content Test Cases¶
Route:
/expressions/<id>/ticket
Description: Download test expression by ticket multiple times (sometimes slicing by featureIDList, featureNameList, sampleIDList).
Rationale: Asserts correct matrix file is associated with the test expression
id
. Validates expression values match expected. Validates returned columns/rows match expected based on slice parameters.Request:
GET /expressions/ac3e9279efd02f1c98de4ed3d335b98e/ticket
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Success Criteria: Test expression matrix columns, rows, values match expected
Failure Criteria: Test expression matrix columns, rows, values DO NOT match expected
Expression Bytes by Id Content Test Cases¶
Route:
/expressions/<id>/bytes
Description: Download test expression by bytes multiple times (sometimes slicing by featureIDList, featureNameList, sampleIDList).
Rationale: Asserts correct matrix file is associated with the test expression
id
. Validates expression values match expected. Validates returned columns/rows match expected based on slice parameters.Request:
GET /expressions/ac3e9279efd02f1c98de4ed3d335b98e/bytes
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Success Criteria: Test expression matrix columns, rows, values match expected
Failure Criteria: Test expression matrix columns, rows, values DO NOT match expected
Expression Ticket Content Test Cases¶
Route:
/expressions/ticket
Description: Download joined expression matrix by ticket multiple times (sometimes slicing by featureIDList, featureNameList, sampleIDList).
Rationale: Asserts joined matrix. Validates expression values match expected. Validates returned columns/rows match expected based on slice parameters.
Request:
GET /expressions/ticket?format=loom
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Success Criteria: Joined expression matrix columns, rows, values match expected
Failure Criteria: Joined expression matrix columns, rows, values DO NOT match expected
Expression Bytes Content Test Cases¶
Route:
/expressions/bytes
Description: Download joined expression matrix by bytes multiple times (sometimes slicing by featureIDList, featureNameList, sampleIDList).
Rationale: Asserts joined matrix. Validates expression values match expected. Validates returned columns/rows match expected based on slice parameters.
Request:
GET /expressions/bytes?format=loom
Accept: application/vnd.ga4gh.rnaget.v1.0.0+json, application/json
Success Criteria: Joined expression matrix columns, rows, values match expected
Failure Criteria: Joined expression matrix columns, rows, values DO NOT match expected