Versions Compared

Key

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

This vignette use case will combine concepts from Annotations and QueriesViewsAnnotating Data With Metadata/wiki/spaces/DOCS/pages/2011070739Uploading and Downloading Data in BulkOrganizing Data Into Projects, Files, and Folders. You will learn how to:

  • Create a manifest

  • Upload 100 files

  • Edit annotations on these files using the Synapse programmatic clients

Annotation

...

Dictionaries

The Sage Bionetworks research teams maintain maintains annotation dictionaries in GitHub. You can use the terms in this repository as a starting point, or you can create your own annotation dictionary.

...

Batch Upload

...

Files with Annotations

To batch upload files, create a tab-delimited manifest which contains, at minimum, the columns path and parent. You can also add additional annotations as columns in your manifest. For example, your manifest might have the following headers: pathparentspecimenIDassayspeciesplatformsex, and fileFormat. See Creating a Manifest in Uploading and Downloading Data in Bulk for additional details.

  • path: the local path to your file 

  • parent: the Synapse ID (in the format syn123456) of the Folder folder or Project project where your files will be uploaded

  • specimenID: the unique identifier for each of your specimens 

  • assay: the technology used to generate the data in this file (for example, RNASeq, ChIPSeq, wholeGenomeSeq) 

  • species: the species of your sample (for example, Mouse, Rat, Human, Triceratops) 

  • platform: the hardware used to generate the data (for example, HiSeq2500, Affy6.0, HoodDNASequencer) 

  • sex: a label assigned at birth based on biological attributes (for example, male or female)

  • fileFormat: is the type of file (e.g. fastq, R script)

path

parent

specimenID

assay

species

platform

sex

fileFormat

/local/path/to/velociraptor_b.fastq

syn123

blue_1

wholeGenomeSeq

Velociraptor mongoliensis

HoodDNASequencer

female

fastq

/local/path/to/velociraptor_d.fastq

syn123

delta_1

wholeGenomeSeq

Velociraptor mongoliensis

HoodDNASequencer

female

fastq

Save this file in a tab-delimited format called velociraptor_manifest.tsv.

Files can be uploaded all at once with a manifest Filefile. If you would like to do a “dry run” validation of the File file before uploading, you can add the parameter dryRun = True to the function syncToSynapse. Note that the dryRun feature checks everything, but does not upload the files.

  • validate the manifest and upload files in the Python client.

  • validate the manifest and upload files in the R client.

Create a File View (

...

web)

Once the Files files have been uploaded with annotations, you can use a File View file view to query, facet, and bulk manipulate the Files files and Metadatametadata.

To create your File Viewfile view:

  1. Navigate to your Projectproject.

  2. Go to the Tables tables tab, select Tables Tools in the upper right corner, and click Add File View.

  3. In the resulting pop-up, give the new View file view a name.

  4. Select the container (Synapse Project project or Folderfolder) of files, and click Next. In this case, you would want the synID of the parent column in the manifest.

  5. Select the columns you would like to keep. Since we are going to edit the annotations later, please make sure you have the column etag listed as one of your columns.

  6. Add All Annotations at the end of the opened window will add all existing annotations.

  7. Click Finish to create the Viewfile view.

(plus) For more information on file views, see /wiki/spaces/DOCS/pages/2011070739.

Perform a One-

...

Time Annotation Update or Deletion (

...

web)

An annotation for a single File file can be modified in the web client Viewview. For example, you can updatespecimenID:delta_1 to specimenID:echo_1.

  1. From your Viewview, select the pencil icon to edit query results.

  2. In the pop-up window, find the single value you want to change and edit the field.

  3. Scroll down to the bottom and click Save to update the file Viewview.

Perform a Bulk Annotation Update or Deletion

...

To download the annotation values from the web client:

  1. Navigate to the your Viewfile view.

  2. Click the Download Options button to the right of the query bar of the File Viewfile view.

  3. Click Export Table to download the file Viewview. Be sure to have Include row metadata (Row Id ID and Row Version) selected when downloading.

Now that you have the File View file view downloaded, you can edit the values using your preferred tool (Python, R, Excel, or other).

With the changes saved, go back to the File View file view in your browser.

  1. Click View Tools located at the upper right of the File Viewfile view.

  2. Select Upload Data to View from the dropdown.

  3. Browse and choose the edited file.

  4. Click Next to preview the uploaded file.

  5. Click Update Table to update the File View file view and populate the changes to all the files in Synapse.

Programmatic Clientsclients

Alternatively, download the File View file view with the R or Python client, then:

  1. Query for the View file view with synTableQuery() or syn.tableQuery(). To delete all the annotations of a key, you have to keep the column in the File View file view but remove the values.

  2. Update and then store the annotations in the R client or Python client.

...