Versions Compared

Key

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

Data in Synapse can be downloaded using the our programmatic clients (Python, R, and command line), or from the Synapse UI. as well as the web client. In this guide, you will learn the basic commands to download data programmatically.

...

Code Block
entity <- synGet("syn3260973", version=1)


See Versioning for more details.

Downloading Linked Data

...

Code Block
library(synapser)
synLogin()
linkEnt = synGet("syn1234")
entity = synGet("syn1234", followLink=TRUE)


...

Downloading Location

To override the default download location, you can specify the downloadLocation parameter.

...

Finding and Downloading Files via Annotations

Files can be annotated in Synapse to help organize your data and make files findable. In order to search the annotations, a file view must be created first.

For example, the PCBC Project has a table listing sequencing data files that are annotated. To find all mRNA fastq files originating from CD34+ cells in the we can query by:

...

Code Block
results <- synTableQuery('select * from syn7511263 where dataType="mRNA" AND fileType="fastq" AND Cell_Type_of_Origin="CD34+ cells"')
df <- as.data.frame(results)
entity <- lapply(df$file.id, function(x) synGet(x))


Recursive

...

Downloading

The folder structure that is present on Synapse can be maintained by recursive downloading.

...

Code Block
# Unfortunately, this feature is not available in the R client


...

Downloading Wikis

The structure of a wiki page can be extracted through the R and Python clients. The ID, title, and parent wiki page of each sub-wiki page is also determined through the same method.

...