Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The effect of this architecture is that repeated uploads or downloads of an entity's file are avoided when the local copy is not modified.  This strategy does not avoid repeated downloads of an entity's file to a variety of local folders.  We feel that the potential efficiency gains of doing this are outweighed by the complexity of tracking multiple, mutable copies of a file.

File Usage Examples

...

In each example, we have a project in which the File will reside:

Code Block
project<-(name="myproject")

...


# 'synStore' will either create the project or retrieve it if it already exists

...


project<-synStore(project)

...


pid<-propertyValue(project,

...

 "id")

 

 

Example 1: Create File entity wrapping local file, save to Synapse, retrieve, and save again

Code Block
file <- File(path="~/myproject/genotypedata.csv", name="genotypedata", parentId=pid)

...


# 'synStore' will upload the file to Synapse

...


# locally we record that the uploaded file is available at ~/myproject/genotypedata.csv

...


file <- synStore(file)

...


# we can get the ID of the file in Synapse

...


fileId <- propertyValue(file, "id")

...


# ----- Now assume a new session (perhaps a different user)

...


# at first we have only the Synapse file ID

...


fileId <- "synXXXXX"

...


file <-synGet(fileId, load=F)

...


# client recognizes that local copy exists, avoiding repeated download

...


getFileLocation(file)

...


> "~/myproject/genotypedata.csv"

...


# now change something, e.g. add an annotation...

...


synAnnot(file, "data type")<-"genotype"

...


# ... and save.

...

  the client determines that the file is unchanged so does not upload again

...


file <-synStore(file)

...


# we can also download to a specific location

...


fileCopy<-synGet(fileId, downloadLocation="~/scratch/", load=F)

...


getFileLocation(fileCopy)

...


> "~/scratch/genotypedata.csv"

...


# we now have two copies on the

...

Example 2: Link to File on web, then download

project<-(name="myproject")
project<-synStore(project)
pid<-propertyValue(project, "id")

...

 local file system



Example 2: Link to File on web, then download

Code Block
# we use 'synapseStore=F' to indicate that we only wish to link

...


file <- File(path="ftp://ftp.ncbi.nlm.nih.gov/geo/series/GSE1nnn/GSE1000/matrix/GSExxxx_RAW.tar", synapseStore=F, name="genotypedata", parentId=pid)

...


# Synapse stores the metadata, but does not upload the file

...


file <- synStore(file)

...


# we can get the ID of the file in Synapse

...


fileId <- propertyValue(file, "id")

...


# synGet downloads the file to a default location

...


file <-synGet(fileId, load=F)

...


getFileLocation(file)

...


> "~/.synapseCache/GSExxxx_RAW.tar"

...


# now change the meta data and save

...


synAnnot(file, "data type")<-"gene expression"

...


# synStore does not upload the file

...


file<-synStore(file)

 

 

 

 

 

Command Set

We conceptual divide the client commands into three levels (1) Common functions, (2) Advanced functions and (3) low-level Web API functions.  The first collection of commands captures the majority of functionality of interest to users. The second collection rounds out the functionality with less frequently used functions.  The third set comprises simple, low level wrappers around the Synapse web service interface.  By including this third set users can access web services in advance of having specialized commands in the analytic clients.

...