Additional Endpoints
Restricted usage
The endpoints documented below are for illustrative purposes only. An admin must set up the appropriate namespace(s), context(s), etc.
If you have data you would like to upsert into the service, contact us at ldh-admin@bcm.edu.
A. PUT endpoints
The following endpoints exist for convenience. Their existence is mainly due the minimal size of a document in this service - i.e., a document typically contains only an ID and metadata. In contrast, other LDH services may see other documents that are orders of magnitude larger.
| # | Endpoint | Description | Required fields (columns, in order for TSV payload) |
|---|---|---|---|
| 1 | /{sbjValType}/sbjVals/objVal | Upsert multiple mappings, with the object values in possibly different object types. | sbjVal, objValType, objVal |
| 2 | /{sbjValType}/sbjVals/{objValType}/objVal | Upsert multiple mappings, with the object values in one object type. | sbjVal, objVal |
| 3 | /{sbjValType}/sbjVal/{sbjVal}/objVals/objVal | Upsert one subject value with multiple object values in possibly different object types. | sbjVal, objVal |
| 4 | /{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType}/objVal | Upsert one subject value with multiple object values, all of which belong in a one object type. | objVal |
| 5 | /{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType}/objVal/{objVal} | Upsert one subject value and one object value pair. | N/A |
- The last endpoint (#5) uses the values in the URL. This is not a batch upsert, so no payload is needed. However, a content length header (
-H "Content-Length: 0") or blank payload (-H "Content-Type: text/plain" --data "") may be needed to indicate an empty payload.
A.1 Input file formats
Batch upsert endpoints (#1-4) take either JSON (Content-Type: application/json) or TSV (Content-Type: text/tab-separated-values or Content-Type: text/tsv) input payloads.
A.1.1 JSON
As a convenience, the values in an objVals.{objValType} array do not have to be structured. An element can either be (1) a string, or (2) an object of them form { "objVals": "{objVal}" }. Either format (or a mix of them) will be accepted, as shown in the examples below.
As another convenience, the endpoints where the subject value is set in the URL (endpoints #3 and #4) do not expect the sbjVal. However, note that providing a sbjVal that conflicts with the request URL will result in an error response.
Examples of JSON input for each endpoint are provided below.
/{sbjValType}/sbjVals/objVal (e.g., /sandbox/sbjVals/objVal)
[
{
"sbjVal": "CASV4220344313",
"objVals": {
"gnomadSv2": [
"INS_10_73724",
{
"objVal": "INS_10_73725"
}
],
"nist": [
"HG3_Ill_Krunchall_15451"
]
}
},
{
"sbjVal": "CASV4216852855",
"objVals": {
"nist": [
"HG2_10X_allpass_107"
]
}
}
]/{sbjValType}/sbjVals/{objValType}/objVal (e.g., /sandbox/sbjVals/gnomadSv2/objVal)
[
{
"sbjVal": "CASV4220344313",
"objVals": {
"gnomadSv2": [
"INS_10_73724",
"INS_10_73725"
]
}
},
{
"sbjVal": "CASV4081448226",
"objVals": {
"gnomadSv2": [
"DEL_1_11"
]
}
}
]/{sbjValType}/sbjVal/{sbjVal}/objVals (e.g., /sandbox/sbjVal/CASV4220344313/objVals)
{
"objVal": {
"gnomadSv2": [
"INS_10_73724",
"INS_10_73725"
],
"nist": [
"HG3_Ill_Krunchall_15451"
]
}
}/{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType}/objVal (e.g., /sandbox/sbjVal/CASV4220344313/objVals/gnomadSv2/objVal)
{
"objVal": {
"gnomadSv2": [
"INS_10_73724",
"INS_10_73725"
]
}
}A.1.2 TSV
Tab-delimited files must have, at a minimum, the columns required for the endpoint. As a convenience, the complete set (all three columns) can be included in the order sbjVal, objValType, and objVal. However, note that optional values (depending on the endpoint) that conflict with the request URL will result in an error response.
Example payloads for each batch endpoint are provided below.
/{sbjValType}/sbjVals/objVal (e.g., /sandbox/sbjVals/objVal)
CASV4220344313 gnomadSv2 INS_10_73724
CASV4220344313 gnomadSv2 INS_10_73725
CASV4216852855 nist HG2_10X_allpass_107/{sbjValType}/sbjVals/{objValType}/objVal (e.g., /sandbox/sbjVals/gnomadSv2/objVal)
CASV4220344313 INS_10_73724
CASV4220344313 INS_10_73725/{sbjValType}/sbjVal/{sbjVal}/objVals (e.g., /sandbox/sbjVal/CASV4220344313/objVals)
gnomadSv2 INS_10_73724
gnomadSv2 INS_10_73725
nist HG3_Ill_Krunchall_15451/{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType}/objVal (e.g., /sandbox/sbjVal/CASV4220344313/objVals/gnomadSv2/objVal)
INS_10_73724
INS_10_73725A.2 Example batch upsert request
curl -H "Authorization: Bearer $jwt" -X PUT \
-H "Content-Type: text/tab-separated-values" --data-binary @test.tsv \
"https://${HOST}/ldh/val-map/genomicLocation/sbjVals/ENCODEGeneRegulatoryElement"GL4233433099 EH38E1795881
GL4233433155 EH38E3900574
GL4233433216 EH38E3334376
GL4233433265 EH38E3334393
GL4233433322 EH38E3900581{
"data": {
"edgeLdChangeType": {
"insert": 5,
"update": 0
},
"edgeLdForChangeType": {
"insert": 5,
"update": 0
},
"ldChangeType": {
"insert": 5,
"update": 0
},
"sbjChangeType": {
"insert": 3,
"update": 2
}
}
}A.3 Input restrictions
Payloads used in the batch endpoints are subject to size restrictions. Both (a) the number of bytes and (b) the number of records will be checked. For example, a file must be <= 20 MB in size and have <= 50k mappings to upsert.
These limits are configurable in the case that separate instances of the service are launched.
A large file can be split, as shown in the example below.
# Example: split a large file into smaller files, each with 20,000 lines
split -l 20000 fileToSplit.tsv "optionalPrefix." --additional-suffix=".tsv"optionalPrefix.aa.tsv
optionalPrefix.ab.tsv
optionalPrefix.ac.tsv
// ...time0=$(date +%s.%N)
for file in ./optionalPrefix.*.tsv ; do
echo $file ;
curl -H "Authorization: Bearer $jwt" -X PUT \
-H "Content-Type: text/tab-separated-values" --data-binary @${file} \
"https://${HOST}/ldh/val-map/sandbox/sbjVals/imgtAcc/objVal" ;
done
time1=$(date +%s.%N)
echo "Time elapsed: $( echo "$time1 - $time0" | bc -l )"B. DELETE endpoints
| Endpoint | Description |
|---|---|
/{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType}/{objVal} | Delete the mapping between one subject value and one object value. Delete the object value itself if orphaned (if linked to no other subject values). |
/{sbjValType}/sbjVal/{sbjVal}/objVals/{objValType} | Delete the mappings between one subject value and all of its object values within an object value type. Delete any values that are orphaned. |
/{sbjValType}/sbjVal/{sbjVal} | Delete one subject value and all its object value mappings. |
