Skip to content

Projects in Synapse

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.

Read more about Projects

Recommendations for Structuring Your Synapse Project

Tutorial Purpose

In this tutorial you will:

  1. Create a new project
  2. Print stored attributes about your project
  3. Get an existing project

Prerequisites

1. Create a new project

import synapseclient
from synapseclient import Project

syn = synapseclient.login()

# Project names must be globally unique
project = Project(name="My uniquely named project about Alzheimer's Disease")
project = syn.store(obj=project)

Now that you have created your project you are able to inspect the project in the synapse web UI.

2. Print stored attributes about your project

my_synapse_project_id = project.id
print(f"My project ID is: {my_synapse_project_id}")

project_creation_date = project.createdOn
print(f"I created my project on: {project.createdOn}")

user_id_who_created_project = project.createdBy
print(f"The ID of the user that created my project is: {user_id_who_created_project}")

project_modified_on_date = project.modifiedOn
print(f"My project was last modified on: {project_modified_on_date}")
You'll notice the output looks like:
My project ID is: syn12345678
I created my project on: 2000-01-01T12:00:00.001Z
The ID of the user that created my project is: 1234567
My project was last modified on: 2000-01-01T12:00:00.001Z

Find all of the available attributes about your project in the API Reference section of the documentation.

3. Get an existing project

Each Project only needs to be created once. Since you've already created it you can access it again by retrieving the synapse ID of the project and retrieving the existing project object.

my_project_id = syn.findEntityId(
    name="My uniquely named project about Alzheimer's Disease"
)
my_project_object = syn.get(entity=my_project_id)
print(f"I just got my project: {my_project_object.name}, id: {my_project_id}")

The result will look like:
I just got my project: My uniquely named project about Alzheimer's Disease, id: syn12345678

Source code for this tutorial

Click to show me
"""
Here is where you'll find the code for the Project tutorial.
"""

# Step 1: Create a new project
import synapseclient
from synapseclient import Project

syn = synapseclient.login()

# Project names must be globally unique
project = Project(name="My uniquely named project about Alzheimer's Disease")
project = syn.store(obj=project)

# Step 2: Print stored attributes about your project
print(f"My project ID is: {project.id}")

print(f"I created my project on: {project.createdOn}")

print(f"The ID of the user that created my project is: {project.createdBy}")

print(f"My project was last modified on: {project.modifiedOn}")

# Step 3: Get an existing project
my_project_id = syn.findEntityId(
    name="My uniquely named project about Alzheimer's Disease"
)
my_project_object = syn.get(entity=my_project_id)
print(f"I just got my project: {my_project_object.name}, id: {my_project_id}")

References used in this tutorial