Downloading Data

Overview

Data in Synapse can be downloaded using the programmatic clients (Python, R, and command line) as well as the web client.

Downloading a File

Every entity in Synapse has a unique synID associated with it. It can be found on every entity page next to Synapse ID:, starting with syn ending with numbers (i.e. syn00123). Files can be downloaded by using the get command. By default, the File downloaded will always be the most recent version. If the current version of the File has already been downloaded, it will not re-download the File.

For example, to get the experimental protocol file on Adult Mouse Cardiac Myocyte Isolation (syn3158111) from the Progenitor Cell Biology Consortium (PCBC) you would run the following:

synapse get syn3158111


Once a File has been downloaded, you can find the filepath using the following:

# When downloading using the command line client, it will print the filepath of where the file was saved to.

Versions

If there are multiple versions of a File, a specific version can be downloaded by passing the version parameter.

In this example, there are multiple versions of an miRNA FASTQ file (syn3260973) from the Progenitor Cell Biology Consortium. To download the first version:

synapse get syn3260973 -v 1


See versioning for more details.

Download Location

By default, for the Python and R clients, the download location will always be in the Synapse cache whereas the command line client downloads to your current working directory. In each case you can specify the downloadLocation parameter.

synapse get syn00123 --downloadLocation /path/to/folder

Finding and Downloading Files

Files can be annotated to facilitate finding them. In order to search the annotations, a File View must be created first. It is possible to query based on any of the annotations attached to the files.

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

synapse query 'select * from syn7511263 where dataType="mRNA" AND fileType="fastq" AND Cell_Type_of_Origin="CD34+ cells"'

Once you’ve queried for the files of interest, they can be downloaded using the following:

synapse get -q 'select * from syn7511263 where dataType="mRNA" AND fileType="fastq" AND Cell_Type_of_Origin="CD34+ cells"'

Recursive Downloads

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

synapse get -r syn2390898

Download Tables

Please view here to learn how to use Tables.

Download Wikis

The structure of a project’s 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.

wiki = syn.getWikiHeaders("syn00123")

The Markdown and other information of a Project sub-Wiki page can be obtained by knowing the id of the Wiki. The Wiki page id can either be obtained through the above method or can be found in the URL “www.synapse.org/#!Synapse:syn00123/wiki/12345” where 12345 is the Wiki page id.

wiki = syn.getWiki("syn00123", 12345)


See Also

Versioning, Tables, Wikis, File Views, Annotations and Queries

Need More Help!

Try posting a question to our Forum.

Let us know what was unclear or what has not been covered. Reader feedback is key to making the documentation better, so please let us know or open an issue in our Github repository (Sage-Bionetworks/synapseDocs).

2016 Sage Bionetworks Contact us Creative Commons License