A View is a type of Synapse Table. Views display rows and columns of information, and they can be shared and queried just like a Table. Unlike Tables, Views do not store data. Instead, Views are essentially queries of other data already in Synapse. They allow you to see Files, Tables, Projects, or Submissions and any associated metadata about those objects at a glance. You can define the scope of a View to include the items that you want to group together.
You can use a View to:
Search and query many Projects, Files, Submissions, and Tables at once
View and edit File or Table metadata in bulk
Group or link Files, Tables, Project, or Submissions together by their annotations
You can create a View that contains Files, Tables, Projects, or Submissions. A File View lists all Files or Tables within one or more Folders or Projects. A Project View lists all Projects you’ve added to the view. A Submission View lists all Submissions within one or multiple Evaluation Queues.
Creating Views
You can create Views from the web client to organize and group content within Synapse. Instructions for creating Views using the clients can be found in the Python docs and in the R docs.
Create a File View
To create a File View, select 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 View. Navigate to the Tables tab and select Add File View in 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 this process. The scope of a File View can have a maximum of 20,000 folders or sub-folders.
Create a Project View
To create a Project View, select the Project in which you would like to create the view. You will select the projects of interest by defining the scope as above. 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
To create a Submission View, select the Project in which 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 View can have a maximum of 20,000 evaluation queues.
Updating the Scope or Content of a View
Views can be edited to change the scope or what types of content are 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 Tables for more examples.
Note: Currently, a View is updated only after a query is run against it. If your query results appear to be stale, you will need to run your query again to see the expected updates.
Using Simple Search
Views are in Simple Search mode by default. You can filter for Projects or Files of interest by using the facet menu on the left. You can toggle between simple and advanced search using the Show advanced search/Show simple search link.
Using Advanced Search
In advanced search, you can use a SQL-like query to search for items in that view. In the example below, we’re selecting for all files that have a Cell Type of “PSC”.
Using Programmatic Clients
Like Tables, Views can also be queried directly from the programmatic clients. For example, to query for all contents of syn12345678:
Command Line
synapse query 'SELECT * FROM syn12345678'
Python
query = syn.tableQuery('SELECT * FROM syn12345678')
R
query <- synTableQuery('SELECT * FROM syn12345678')
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.
To embed a subset of the File View, like the advanced search query in the previous example, enter SELECT * FROM syn12345678 WHERE Cell_Type = ‘PSC’
.
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 article. To update other metadata in bulk, such as Provenance, see the Bulk Processing article.
For example, if you would like to use the Python client to update the annotation “dogSays:bark” to “dogSays:woof” in 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 Queries, Tables, Wikis