...
For each file version created, Synapse records the file contents and any associated annotation information. Other metadata about a file (such as the description, name, parent, ACL, and associated wiki) are not recorded as part of the version and will not change between versions.
Uploading a New Version via the Synapse UI
Uploading a new version follows the same steps as uploading a file for the first time. Use the same file name and store it in the same location. It is recommended to add a comment to the new version in order to easily track differences at a glance.
...
Once the new version has been uploaded, click File Tools and select Version History. Then select Edit Version Info to add the version comment.
Uploading a New Version Programmatically
Uploading a new version follows the same steps as uploading a file for the first time. Use the same file name and store it in the same location. It is recommended to add a comment to the new version in order to easily track differences at a glance. Version comments are available in Python and R clients, but not in the command line client.
...
Code Block |
---|
# Upload a new version of raw_data.txt, EXPLICIT UPDATE EXAMPLE library(synapser) # fetch the file in Synapse, where "syn2222" is the synID of the file in Synapse file_to_update <- synGet('syn2222', downloadFile=FALSE) # save the local path to the new version of the file file_to_update$path <- '/path/to/new/version/of/raw_data.txt' # add a version comment file_to_update$versionComment <- 'Added 5 random normally distributed numbers.' # store the new file updated_file <- synStore(file_to_update) # Upload a new version of raw_data.txt, IMPLICIT UPDATE EXAMPLE # Assuming that there is a file created with: synStore(File('path/to/old/raw_data.txt', parentId='syn123456')) # To create a new version of that file, make sure you store it with the exact same name new_file <- synStore(File('path/to/new_version/raw_data.txt', parentId='syn123456')) |
Downloading a Version via the Synapse UI
Navigate to where the file is stored in Synapse and click File Tools and Version History to display a list of all file versions. Select the version you would like to download and, once the page has refreshed, select Download Options and Download File.
Downloading a Version Programatically
By default, the file downloaded will always be the most recent version. However, a specific version can be downloaded by accessing the version history or by passing the version
parameter.
...
Code Block |
---|
entity <- synGet("syn56789", version=1) |
Deleting a Version via the Synapse UI
Deleting a version removes that version number from your version history but does not renumber the remaining versions. For example, if you have three versions of a file and delete the second version, your version history will display version 1 and version 3.
Navigate to the file and select File Tools and then Version History. Find the version you want to delete and click the small “x” on the right side of the corresponding row.
Deleting a Version Programatically
A specific file version can be deleted by accessing the version history or passing the version
parameter. Deleting a version removes that version number from your version history but does not renumber the remaining versions. For example, if you have three versions of a file and delete the second version, your version history will display version 1 and version 3.
...
Code Block |
---|
# Calling `synDelete` returns NULL synDelete("syn56789", version = 1) |
Updating a File Without Changing Versions
If you are using the Synapse UI to update your files, adding or editing annotations and provenance will not update the file version. Refer to the Annotations and Queries article for instructions on adding/editing annotations via the web client.
If you are using programmatic clients to update your files, any change to a file will automatically update the version, including changes to annotations and provenance. In some rare cases, you may not want to create a new version when you make changes to a file. The main function for storing or updating an entity in the Python and R clients is the store function (see the Python docs or R docs for more information). This function takes an optional forceVersion
parameter, whose default value is True
. This means that whenever store
is called to update an existing entity, the version is increased even if nothing has changed on the entity. If you specifically do not want to change the version when using the store
function, include a forceVersion=False
parameter.
Updating Annotations Without Changing Versions
Command line
The commands set-annotations
and set-provenance
will update the metadata without creating a new version.
...
Code Block |
---|
# Get file from Synapse, set download=False since we are only updating annotations file <- synGet('syn56789', downloadFile=FALSE) # Add annotations annotations <- synSetAnnotations(file, annotations=list(fileType = "bam", assay = "RNA-seq")) |
Setting Provenance Without Changing Versions
Please refer to the Provenance article for instructions on adding/editing provenance via the Synapse UI.
...