Synapse helps you upload and organize your data in an efficient way through the use of projects, files, and folders.
Projects
Projects in Synapse are “containers” that group relevant content and people together. All data must be uploaded into a project. Projects can be private so only you can see the contents, they can be shared with your collaborators, or they can be made public so anyone on the web can view your research.
...
Organize your work: With Synapse, you can organize the parts in your workflow (data, code, etc) into a hierarchy like a file system. With the tabs across the top of each project, you can easily navigate to your Wikisyour wikis, Files files and Foldersfolders, SQL-based Tablesbased tables, and even conduct conversations using Discussion Forumsusing discussion forums.
Store data, code, and results: You can upload your data, code, and results to Synapse, or store a reference to their location in your local computer system or on the web. Everything can be stored as Files files hosted by Synapse, in your own external cloud storage, or using Docker Containerscontainers.
Control data access or release it publicly: You have complete control over how users and groups can interact with your work. Work privately, openly, or somewhere in between.
Link and share content with others: Just as you can control the access to your work, projects can serve as a platform for linking and sharing your work with others.
Custom, searchable annotations: Assign any key/value pair you want. Those values become searchable and available to those granted access.
Attach figures and documents: Upload documents and images via the website or programmatically.
...
Creating a Project
To create a new Project:
...
project:
Click the Projects icon in the left-hand toolbar, and click the plus sign (+) icon next to Projects
(Alternatively, you can go to your dashboard and click Create a New Project
...
...
Enter a unique name for your Project and click OK
Files
Synapse files can be created by uploading content from your local computer or linking to digital files on the web. You can /wiki/spaces/DOCS/pages/2667708522, /wiki/spaces/DOCS/pages/2667774092, or /wiki/spaces/DOCS/pages/1972405096.
Files in Synapse always have a “parent”, which could be a project or a folder. You can organize collections of files into folders and sub-folders, just as you would on your local computer.
Synapse files (as well as folders and projects) are identified by a unique identifier called a Synapse ID, or synID. The synID is represented by the prefix “syn” followed by numbers (for example, syn12345678
). This identifier can be used to refer to a specific file on the web and through the programmatic clients.
You can control who has access to files that you upload in two ways. First, you can apply sharing settings, which control who can view, edit, download, or delete a file. Second, you can also apply conditions for use, which are additional requirements that Synapse users must meet before accessing your file. By default, files inherit the conditions for use of the Synapse folder where they are uploaded. You can also add additional conditions for use on specific files within a folder.
To read more about how to use sharing settings and conditions for use together, see the full article on /wiki/spaces/DOCS/pages/2024276030.
Folders
Folders offer an additional way to organize your data. Instead of uploading a bunch of single files into your project, you can create folders to separate your data in a systematic way. You can create a folder within a folder within a folder, and so on.
Creating a Folder
To create a folder:
Within your Synapse project, click the Files tab
To create a folder at this level*, click the Files Tools menu, followed by Add New Folder
Enter a folder name and click Save
*To create a folder within a folder, click on the folder name within the project, and click the Folder Tools menu, followed by Add New Folder, and proceed to step 3.
Uploading a File via the Synapse UI
To upload a file:
Within your Synapse project, click the Files tab
Click the Files Tools menu (or, to upload a file to a folder, then first go to the folder, and click the Folder Tools menu), followed by Upload or Link to a File
Click Browse to select the file, or drag and drop it to upload, or click Link to URL to add a link to an external storage space
Click Save
Uploading a File Programmatically
You can annotate your data during the upload process or after. Find more information here.
Command line
The command line has the sub-command store
, which can be used to upload and add a file to Synapse.
Code Block |
---|
# Add a local file to an existing project (syn12345) on Synapse
synapse store raw_data.txt --parentId syn12345
|
Python
The main function for uploading or updating a file in the Python client is through the store
function. For more information about this function, see the Python Docs.
Code Block |
---|
import synapseclient
from synapseclient import File
syn = synapseclient.login()
# Add a local file to an existing project (syn12345) on Synapse
file = File(path='/path/to/raw_data.txt', parent='syn12345')
file = syn.store(file)
|
R
The main function for uploading or updating a file in the Python client is through the synStore
function. For more information about this function, see the R Docs.
Code Block |
---|
library(synapser)
synLogin()
# Add a local file to an existing project (syn12345) on Synapse
file <- File(path='/path/to/raw_data.txt', parentId='syn12345')
file <- synStore(file)
|
Moving a File or Folder via the Synapse UI
Using the Synapse UI, you can move single files one at a time, or you can move an entire folder and all of its file contents. You cannot move more than one folder at once. For this reason, if you are primarily using the web interface to manage your files, you should consider your folder structure carefully when you create your initial project.
To move a file or folder:
Within the file or folder, click File Tools or Folder Tools, followed by Move File or Move Folder
In the resulting pop-up window, browse for the destination folder or project or use the search bar to enter the Synapse ID of the new location
Moving a File or Folder Programmatically
Command line
The command line client has a sub-command mv
which can be used to move files and folders.
Code Block |
---|
# move a file or folder (syn123) to a different folder/project (syn456)
synapse mv --id syn123 --parentId syn456
|
Python
You can change the file or folder location in the Python client by fetching the file information, changing the parent property, and storing the change.
Code Block |
---|
import synapseclient syn = synapseclient.login() # fetch the file/folder to move (syn123 in this example) # note the downloadFile=False parameter to fetch only the file's metadata and not the entire file foo = syn.get('syn123', downloadFile=False) # change the parentId to the new location, can be a folder or project (syn456 in this example) foo.properties. |
...
parentId = 'syn456'
# store the file/folder to move it
syn.store(foo)
|
R
You can change the file or folder location in the R client by fetching the file information, changing the parent property, and storing the change.
Code Block |
---|
library(synapser)
synLogin()
# fetch the file/folder to move (syn123 in this example)
# note the downloadFile=False parameter to fetch only the file's metadata and not the entire file
foo <- synGet('syn123', downloadFile = FALSE)
# change the parentId to the new location, can be a folder or project (syn456 in this example)
foo$properties$parentId <- 'syn10056031'
# store the file/folder to move it
synStore(foo)
|
Deleting a File or Folder via the Synapse UI
Deleting a file will permanently remove it from Synapse. The synID that was associated with the deleted file will not be re-used. To delete a file:
Within the project, click the Files tab
Click the file or folder you want to delete (or the file/folder within a folder)
Click File Tools or Folder Tools, followed by Delete File or Delete Folder
Deleting a File or Folder Programmatically
Deleting a file will permanently remove it from Synapse. The synID that was associated with the deleted file will not be re-used.
Command line
Code Block |
---|
synapse delete syn56789 |
Python
Code Block |
---|
import synapseclient
syn = synapseclient.login()
entity = syn.delete("syn56789")
|
R
Code Block |
---|
library(synapser)
synLogin()
entity <- synDelete("syn56789")
|
File Previews
Synapse has a viewer for certain file types so that you can preview them before you download. Synapse previews will show the contents of the following file types:
PDFs
CSV (may show a portion of the table only)
Videos (.mp4, .webm, .ogg)
Jupyter notebooks (.ipybn)
Images (.jpeg, .png, .gif, .svg)
HTML (limited rendering only)
Markdown (.md or .rmd)
To see a file preview, navigate to the Files tab of a project and click on the file name. If a file preview is available, it will be visible in the left window.
Deleting a Project
Deleting a project will permanently remove it from Synapse. The synID that was associated with the deleted project will not be re-used. To delete a project:
Navigate to the project you want to delete
Within the project, click the Project Tools button
Click Delete Project
In the dialog box, click the red Delete button to permanently delete the project, or click Cancel if you do not want to delete the project