A view is a type of table. Views display rows and columns of information, and they can be shared and queried just like a table. Unlike tables, views are essentially queries of other data already in Synapse. They allow you to see groups of files, tables, projects, or submissions and any associated annotations about those items.

Annotations are an essential component to building a view. Annotations are labels that you apply to your data, stored as key-value pairs in Synapse. You can use annotations to select specific subsets of your data across many projects or folders and group things together in one view.

You can use a view to:

  • Search and query many files, tables, projects, and submissions at once

  • View and edit file or table annotations in bulk

  • Group or link files, tables, projects, or submissions together by their annotations

This guide explains how to create views from the web client. Instructions for creating views using the programmatic clients can be found in the Python docs and the R docs.

What Is a Schema?

A schema is the structure of your dataset. In a view, a schema defines the structure by specifying the column names. A schema may also define the values or types of data allowed in each column.

You can define table columns to contain common data types like text, numbers, and dates, or you can define columns to include references to other Synapse objects, like files and folders. Synapse currently supports several kinds of text columns (STRING, LARGE TEXT), dates (as TIMESTAMP), a variety of numeric columns (INTEGER, DOUBLE), and various Synapse identifiers (ENTITYID, USER). For a complete list of column types and definitions, see the REST docs on columnTypes.

Create a File View

A file view lists all files or tables within one or more folders or projects. To create a file view, navigate to the project where you would like to create the view. The project you choose does not have to contain the items you are including in your file view. Navigate into the Tables tab and select Add File View from the Tables Tools menu. You will select the files of interest by defining the scope, which is the project(s) and folders that contain your files. File views can also contain tables or folders; you can choose which kinds of items you would like to include during the setup process. The scope of a file view can have a maximum of 20,000 folders or sub-folders.

Create a Project View

A project view lists all projects you’ve added to the view. To create a project view, select the project in which you would like to create the view. Navigate into the Tables tab and select Add Project View from the Tables Tools menu. You will select the projects of interest by defining the scope as above for file views. The only notable difference between creating a project view and a file view is that for project views, there is a 1:1 relationship between the projects you select in your scope and the projects that are shown in the view. The scope of a project view can have a maximum of 20,000 projects.

Create a Submission View

A submission view lists all submissions within one or multiple evaluation queues. To create a submission view, navigate to the project where you would like to create the view. The project you choose does not have to contain the submissions or the evaluation queues that are included in the view. Navigate to the Tables tab and select Add Submission View in the Tables Tools menu. The submissions that are included in the view are defined by its scope, which is the list of evaluation queues containing the submissions. For more information, read about how to use submission views with evaluation queues. The scope of a submission view can have a maximum of 20,000 evaluation queues.

Updating the Scope or Content of a View

The scope of a view defines what items are grouped together to appear in the view. For example, you can set the scope to be multiple projects or a small number of folders. You can change the scope to edit the types of content displayed. Navigate to the view and then select Show Scope of View in the Tools menu. Click Edit Scope to view and change your view preferences. Once you click Save, Synapse may take a few moments to rebuild the updated view.

Query a View

A view can be queried like any other table in Synapse. See Searching Tables and Views for more information.

Insert a View into a Wiki

Views can also be embedded in a wiki. You can embed the entire view or a subset of it.

Navigate to a wiki and click the Wiki Tools menu. Select Edit Project Wiki. In the wiki editing window, select the Insert tab and then Table: Query on a Synapse Table/View. To embed the entire view into the wiki enter SELECT * FROM syn12345678 in the resulting pop-up window, replacing syn12345678 with the synID for your view.

To embed a subset of a view, use the WHERE clause to select certain rows. For example, entering SELECT * FROM syn12345678 WHERE Cell_Type = ‘PSC’ embeds only rows where the value PSC is entered in the column for cell type. Save the query to embed the view.

Update Annotations in Bulk

Views can be used to update annotations for many files or tables at once. To add new annotations, see the Annotations and Queries article. To update other metadata in bulk, such as Provenance, see the Upload and Download Data in Bulk article.

For example, if you would like to use the Python client to update the annotation “dogSays:bark” to “dogSays:woof” for every file in a file view with the synID syn12345678, you can use:

from synapseclient import Table

foo = syn.tableQuery('select * from syn456')

bar = foo.asDataFrame()

# add in annotation as a column
bar['dogSays'] = 'woof'

# store the fileview with the new annotation in Synapse
fv = syn.store(synapseclient.Table(foo.tableId, bar))

Versioning a View

You can create a version history for any view in Synapse. Versioning helps you keep a record of what changes you made to the view and when you made them. For more information on versioning a view, see the Versioning Tables and Views page.

See Also

Annotations and QueriesTablesWikis

Need More Help? Ask a question in the Synapse Help Forum. Your feedback is key to improving our documentation, so contact us if something is unclear or open an issue.