Skip to end of banner
Go to start of banner

Code Integration Scenarios

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 28 Next »

Code Integration: Operations and Scenarios

R Convenience Functions

codeObj <- Code(name, parent, localRoot)

parameters

name

parent: a Project ID

localRoot: local 'root' directory for code files.  If omitted a default is used.

side effects
none

returns

new Code object

addFile(codeObj, localPath)

parameters

codeObj

localPath: path to file or directory on machine running the R session

side effects

 none

returns

 nothing

storeEntity(codeObj)

parameters

 codeObj

side effects

zips files and pushes them to S3.  The file path stored is relative to the 'localRoot' in the code object.

Creates or updates metadata in Synapse, including S3 location.

returns

 nothing

downloadEntity(codeId, localRoot)

parameters

codeId: id of metadata object in Synapse

localRoot: local 'root' directory for code files.  If omitted a default is used.

side effects

 Downloads code files to directory(ies) under the 'local root'

returns

Code object

loadEntity(codeObj)

parameters

codeObj

side effects

If (codeId!=null)

  • Get current Step. 
  • Adds reference to Synapse Code object into Step.

'sources' code into memory

(i.e. if 'codeObj' is just a local variable, this is a utility to source a collection of files.)

returns

codeObj

deleteEntity(codeId)

parameters

codeId: ID of the object in Synapse

side effects

Delete metadata from Synapse.

Deletes files from S3. 

returns

Nothing.

Scenarios

The development cycle:

Discover, retrieve, load and run code

A user, browsing Synapse, sees a piece of code of interest (mentioned in a discussion or used in an analysis), and clicks on it.  She sees:

entity.3733 <- downloadEntity(3733)

and begins by executing this in R.

Retrieve existing code, modify and save.

Develop new code, then save.

(Per Matt F., this is an important use case for data curators.)

Run code and capture provenance info.


  • No labels