...
Command | comments | R Syntax | Python Syntax | Command Line Syntax |
---|---|---|---|---|
1 – Basic Level | ||||
Create a Synapse file handle in memory, specifying the path to the file in the local file system, the name in Synapse, and the Folder in Synapse. This step 'stages' a file to be sent to Synapse. | The specified file doesn't move or get copied at this time. | File(path="/path/to/file", name="foo", parentId="syn101") | ||
Create a Synapse file handle in memory which will be a serialized version of an in-memory object. | The object is not serialized at this time. (We are hoping people will like calling the object a File, even though it takes an in-memory object as a parameter.) | File(obj=<obj ref>, name="foo", parentId="syn101") | ||
TODO: File which is a URL, not be uploaded to Synapse, just linked. | ||||
Create a Synapse Record in memory, specifying the paths to one or more files in the local file system, the name in Synapse, and the Folder in Synapse. This step 'stages' a Record to be sent to Synapse. | Files aren't moved or copied at this time. TODO: Should the files instead be set like attributes, using synSet()? | Record(paths=list("path1", "path2"), name="foo", parentId="syn101") | Record(paths=list("path1", "path2"), name="foo", parentId="syn101") | |
Create a Folder or Project in memory. | Folder(name="foo", parentId="syn101") Project(name="foo", parentId="syn101") | |||
Set an entity's attribute (property or annotation) in memory. Client first checks properties, then goes to annotations; setting to NULL deletes it | synSet(entity, name)<-value | entity.parentId="syn101" | ||
Gets an entity's attribute value (property or annotation) from the object already in memory. If value is not set then NULL is returned. | (TODO: Do we need an isSet(entity, name) method?) | synGetAnnotationOrProperty(entity, name) (We obviously need a better name here.) | entity.name | |
Create or update an entity (File, Folder, etc.) in Synapse. May also specify (1) whether a name collision in an attempted 'create' should become an 'update', (2) whether to 'force' a new version to be created, (3) the list of entities 'used' to generate this one, (4) the list of entities 'executed' to generate this one, (5) the name of the generation activity, and (6) the description of the generation activity. | synStore(entity, used, executed, activityName=NULL, activityDescription=NULL, createOrUpdate=T, forceVersion=T) | |||
Get an entity (file, folder, etc.) from the Synapse server, with its attributes (properties, annotations) and, optionally, with its associated file(s). | synGet(id, version, downloadFile=T, load=T) | synapse.get(id, version, downloadFile=True, load=True) | synapse get ID -v NUMBER | |
synGet(entity, downloadFile=T, load=T) | ||||
Add a file to a Record entity in memory. | TODO: Can this be combined with synSet(record, ...)? | synAdd(record)<-"path/to/file" | record.add("/path/to/file") | |
Add an in-memory object to a Record entity. | TODO: Can this be combined with synSet(record, ...)? | synAdd(record)<-object | ||
Open the web browser to the page for this entity. | onWeb(entityId) / onWeb(entity) | |||
log-in | get API key and write to user's properties file | synapseLogin(<user>,<pw>) | ||
log-out | delete API key from properties file | synapseLogout() | ||
Run code, capturing output, code and provenance relationship. | synapseExceute() | |||
2 – Power User Level | ||||
Execute query | TODO: pagination, e.g. the function returns an iterator. Look at current implementation in R client. | synQuery(queryString) | ||
we talked about this, but is it needed? | synGetEntity() | |||
we talked about this, but is it needed? | synStoreEntity() | |||
Delete an entity, and all of its children (e.g. all Folders and Files within a Folder). | synDelete() | |||
Retrieve the wiki for an entity | TODO: Is it a requirement that we retrieve attachments? If not, do we retrieve file handles? | synGetWiki(id, version) / synGetWiki(entity) | ||
synStoreWiki() | ||||
synGetAnnotations() | ||||
synSetAnnotations() | ||||
synGetProperties() | ||||
Access properties, throwing exception if property is not defined. | synSetProperties() | |||
synGetAnnotation() | ||||
synSetAnnotation() | ||||
Access property, throwing exception if property is not defined. | synGetProperty() | |||
Access property, throwing exception if property is not defined. Setting to NULL deletes. | synSetProperty() | |||
Create an Activity (provenance object) in memory. | Activity(name, description, used, executed) | |||
Create or update the Activity in Synapse | synStoreActivity(activity) | |||
Get the Activity which generated the given entity. | synGetActivity(entity) / synGetActivity(entityId) | |||
Set the Activity which generated the given entity | synSetActivity(entity)<-activity | |||
3 – Web API Level | ||||
Execute GET request | synRestGET(endpoint, uri) | |||
Execute POST request | synRestPOST(endpoint, uri, body) | |||
Execute PUT request | synRestPUT(endpoint, uri, body) | |||
Execute DELETE request | synRestDELETE(endpoint, uri) |
Common Configuration File
...
TODO: What is the format? JSON? Like a Java properties file (ea. line "foo=bar")? Other?
Things to specify in the common config file:
- username/password (or key)
- root cache location
Cache Design Principles
The function and design principles of the client-side file cache need to be made explicit :The and consistent across analytical clients.
Current implementation within the R Client:
- only entity files are cached (not metadata)
- cache is mix of read/write
- each entity version has a location within the cache is based on its URI (e.g. .synapseCache/proddata.sagebase.org/417767/1683088/version/5)
- files.json specifies what resides within the archive
- <fileName> file which R Client currently assumes to be a zip (this is immutable by convention until storeEntity is called)
- <fileName>_unpacked directory within which all unzipped content lives
- this subdirectory is writable (by convention)
- re-stores file if not an archive (both as <fileName> and <fileName>_unpacked/<fileName>)
Each analytical client client has a file cache on the local file system. When an File or Record entity is fetched, if its associated files are fetched then they go into the cache.
...