-
Notifications
You must be signed in to change notification settings - Fork 21
/
bind-schema.R
58 lines (48 loc) · 1.4 KB
/
bind-schema.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
######################################
#### Bind test schema to entity ####
######################################
## Testing out binding the schema that references synapseAnnotations terms, and
## validating annotations against it.
library("synapser")
library("glue")
synLogin()
## Bind testschema.json to entity
synRestPUT(
uri = "/entity/syn23555343/schema/binding",
body = '{entityId: "syn23555343", schema$id: "karatestorg20201105-testschema.json-0.0.2"}'
)
synRestGET(uri = "/entity/syn23555343/schema/binding")
## Add some files to the project
write("testing a file with valid annotations", "valid.txt")
write("testing a file with invalid annotations", "invalid.txt")
## Valid annotations
valid <- File(
path = "valid.txt",
parent = "syn23555343",
annotations = list(
resourceType = "experimentalData",
consortium = "AMP-AD",
study = "iPSCAstrocytes",
fileFormat = "bam",
assay = "rnaSeq",
species = "Mouse"
)
)
## Invalid annotations
invalid <- File(
path = "invalid.txt",
parent = "syn23555343",
annotations = list(
resourceType = "experimentalData",
consortium = "AMP-AD",
study = "iPSCAstrocytes",
assay = "ChIPSeq",
species = "Mouse"
)
)
synStore(valid)
synStore(invalid)
## Clean up local files
file.remove(c("valid.txt", "invalid.txt"))
synRestGET("/entity/syn23555348/schema/validation")
synRestGET("/entity/syn23555349/schema/validation")