| Title: | R Language Bindings for Synapse API |
|---|---|
| Description: | Provides R language bindings for the 'Synapse' platform <https://www.synapse.org>, a collaborative research platform from Sage Bionetworks for sharing data, tracking analyses, and managing provenance. Supports authentication, uploading and downloading files, managing projects, folders, tables, views, annotations, and access permissions. Built on the official 'Synapse' 'Python' client ('synapseclient') via the 'reticulate' package. |
| Authors: | Dan Lu [aut, cre], Tom Yu [aut], Bruce Hoff [aut], Bryan Fauble [aut], Sage Bionetworks [cph] |
| Maintainer: | Dan Lu <[email protected]> |
| License: | Apache License 2.0 |
| Version: | 3.0.0 |
| Built: | 2026-10-31 01:00:16 UTC |
| Source: | https://github.com/Sage-Bionetworks/synapser |
An activity is a Synapse object that helps to keep track of what objects were used
in an analysis step, as well as what objects were generated. Thus, all relationships
between Synapse objects and an activity are governed by dependencies. That is, an
activity needs to know what it used, and outputs need to know what activity
they were generatedBy.
Activity(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, used=list(), executed=list())Activity(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, used=list(), executed=list())
id |
(Optional[str]) The unique immutable ID for this activity. |
name |
(Optional[str]) A name for this Activity. |
description |
(Optional[str]) A description for this Activity. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this object was created. |
modified_on |
(Optional[str]) The date this object was last modified. |
created_by |
(Optional[str]) The user that created this object. |
modified_by |
(Optional[str]) The user that last modified this object. |
used |
(list[Union[UsedEntity, UsedURL]]) The entities or URLs used by this Activity. Only |
executed |
(list[Union[UsedEntity, UsedURL]]) The entities or URLs executed by this Activity. Only |
An S3-style class object.
NULL
Activity(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, used=list(), executed=list()): Constructor for Activity
synDisassociateActivityFromEntity(cls, parent, synapse_client=NULL): Disassociate the Activity from the parent entity. This is the first step in
deleting the Activity. If you have other entities that are associated with this
Activity you must disassociate them by calling this method on them as well.
synGetFromParent(cls, parent, parent_version_number=NULL, synapse_client=NULL): Get the Activity from Synapse based on the parent entity.
## Not run: ## Example 1: Store an Activity on a File # Record the provenance of a file: what it used, and what was executed to # create it. Storing the Activity with a parent associates it with that entity. library(synapser) synLogin() file = synGet("syn123", file_options = FileOptions(download_file = FALSE)) activity = Activity( name = "Normalization", description = "Normalized the raw counts", used = list( UsedEntity(target_id = "syn456", target_version_number = 1L), UsedURL(name = "Reference genome", url = "https://www.ncbi.nlm.nih.gov/grc/human") ), executed = list( UsedURL(name = "Analysis code", url = "https://github.com/my-org/my-analysis") ) ) activity = activity |> synStore(parent = file) print(activity$id) ## Example 2: Delete an Activity # Disassociate the Activity from its parent entity. The Activity itself is # deleted once it has been disassociated from every entity it is attached to; # until then you'll receive an error for each remaining entity. library(synapser) synLogin() Activity() |> synDelete(parent = "syn123") # parent is the entity that the Activity is associated with ## End(Not run)## Not run: ## Example 1: Store an Activity on a File # Record the provenance of a file: what it used, and what was executed to # create it. Storing the Activity with a parent associates it with that entity. library(synapser) synLogin() file = synGet("syn123", file_options = FileOptions(download_file = FALSE)) activity = Activity( name = "Normalization", description = "Normalized the raw counts", used = list( UsedEntity(target_id = "syn456", target_version_number = 1L), UsedURL(name = "Reference genome", url = "https://www.ncbi.nlm.nih.gov/grc/human") ), executed = list( UsedURL(name = "Analysis code", url = "https://github.com/my-org/my-analysis") ) ) activity = activity |> synStore(parent = file) print(activity$id) ## Example 2: Delete an Activity # Disassociate the Activity from its parent entity. The Activity itself is # deleted once it has been disassociated from every entity it is attached to; # until then you'll receive an error for each remaining entity. library(synapser) synLogin() Activity() |> synDelete(parent = "syn123") # parent is the entity that the Activity is associated with ## End(Not run)
Configuration options for entities that support activity/provenance tracking.
This class controls whether activity information (provenance data) should be included when retrieving entities. Activity information tracks the computational steps, data sources, and relationships that led to the creation of an entity.
ActivityOptions(include_activity=FALSE)ActivityOptions(include_activity=FALSE)
include_activity |
(bool) Whether to include activity/provenance information when retrieving the entity. If TRUE, the returned entity will have its activity attribute populated with provenance data (if available). If FALSE, the activity attribute will be NULL. Including activity may result in additional API calls and slower retrieval times. Default is FALSE. |
An S3-style class object.
NULL
ActivityOptions(include_activity=FALSE): Constructor for ActivityOptions
Activity information is only available for entities that support provenance tracking (File, Table, Dataset, etc...). For other entity types, this option is ignored.
## Not run: # Configure activity inclusion: library(synapser) # Include activity information with_activity = ActivityOptions(include_activity = TRUE) # Skip activity information (faster retrieval) without_activity = ActivityOptions(include_activity = FALSE) ## End(Not run)## Not run: # Configure activity inclusion: library(synapser) # Include activity information with_activity = ActivityOptions(include_activity = TRUE) # Skip activity information (faster retrieval) without_activity = ActivityOptions(include_activity = FALSE) ## End(Not run)
Represents a Synapse Agent Registration
Agent(cloud_agent_id=NULL, cloud_alias_id=NULL, registration_id=NULL, registered_on=NULL, type=NULL, sessions=list(), current_session=NULL)Agent(cloud_agent_id=NULL, cloud_alias_id=NULL, registration_id=NULL, registered_on=NULL, type=NULL, sessions=list(), current_session=NULL)
cloud_agent_id |
(Optional[str]) The unique ID of the agent in the cloud provider. |
cloud_alias_id |
(Optional[str]) The alias ID of the agent in the cloud provider. Defaults to 'TSTALIASID' in the Synapse API. |
registration_id |
(Optional[int]) The ID number of the agent assigned by Synapse. |
registered_on |
(Optional[datetime]) The date the agent was registered. |
type |
(Optional[AgentType]) The type of agent. One of either BASELINE or CUSTOM. |
sessions |
(dict[str, AgentSession]) A named list of AgentSession objects, keyed by session ID. |
current_session |
(Optional[AgentSession]) The current session. Prompts will be sent to this session by default. |
An S3-style class object.
NULL
Agent(cloud_agent_id=NULL, cloud_alias_id=NULL, registration_id=NULL, registered_on=NULL, type=NULL, sessions=list(), current_session=NULL): Constructor for Agent
synGetChatHistory(instance): Gets the chat history for the current session.
synGetSession(instance, session_id, synapse_client=NULL): Gets an existing agent session. Adds the session to the Agent's sessions named list and sets it as the current session.
synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, session=NULL, newer_than=NULL, timeout=120L, synapse_client=NULL): Sends a prompt to the agent for the current session. If no session is currently active, a new session will be started.
synRegister(instance, synapse_client=NULL): Registers an agent with the Synapse API. If agent already exists, it will be retrieved.
synStartSession(instance, access_level="PUBLICLY_ACCESSIBLE", synapse_client=NULL): Starts an agent session. Adds the session to the Agent's sessions named list and sets it as the current session.
## Not run: ## Example 1: Chat with the baseline Synapse Agent # You can chat with the same agent which is available in the Synapse UI # at https://www.synapse.org/Chat:default. By default, this "baseline" agent # is used when a registration ID is not provided. In the background, # the Agent class will start a session and set that new session as the # current session if one is not already set. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Register and chat with a custom agent # Only available for internal users (Sage Bionetworks employees). # # Alternatively, you can register a custom agent and chat with it provided # you have already created it. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") |> synRegister() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 3: Prompt an existing custom agent # If you have already registered a custom agent, you can chat with it by # constructing an Agent with its registration ID and sending it a prompt. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Advanced Example: Start and prompt multiple sessions # Here, we connect to a custom agent and start one session with the prompt "Hello". # In the background, this first session is being set as the current session # and future prompts will be sent to this session by default. If we want to send a # prompt to a different session, we can do so by starting it and calling synPrompt again, # but with our new session as an argument. We now have two sessions, both stored in the # my_agent$sessions named list. After the second prompt, my_second_session is now # the current session. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) my_second_session = my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello again", enable_trace = TRUE, print_response = TRUE, session = my_second_session ) ## End(Not run)## Not run: ## Example 1: Chat with the baseline Synapse Agent # You can chat with the same agent which is available in the Synapse UI # at https://www.synapse.org/Chat:default. By default, this "baseline" agent # is used when a registration ID is not provided. In the background, # the Agent class will start a session and set that new session as the # current session if one is not already set. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Register and chat with a custom agent # Only available for internal users (Sage Bionetworks employees). # # Alternatively, you can register a custom agent and chat with it provided # you have already created it. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") |> synRegister() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 3: Prompt an existing custom agent # If you have already registered a custom agent, you can chat with it by # constructing an Agent with its registration ID and sending it a prompt. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Advanced Example: Start and prompt multiple sessions # Here, we connect to a custom agent and start one session with the prompt "Hello". # In the background, this first session is being set as the current session # and future prompts will be sent to this session by default. If we want to send a # prompt to a different session, we can do so by starting it and calling synPrompt again, # but with our new session as an argument. We now have two sessions, both stored in the # my_agent$sessions named list. After the second prompt, my_second_session is now # the current session. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) my_second_session = my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello again", enable_trace = TRUE, print_response = TRUE, session = my_second_session ) ## End(Not run)
Represents a prompt, response, and metadata within an AgentSession.
AgentPrompt(concrete_type="org.sagebionetworks.repo.model.agent.AgentChatRequest", id=NULL, session_id=NULL, prompt=NULL, response=NULL, enable_trace=FALSE, trace=NULL)AgentPrompt(concrete_type="org.sagebionetworks.repo.model.agent.AgentChatRequest", id=NULL, session_id=NULL, prompt=NULL, response=NULL, enable_trace=FALSE, trace=NULL)
concrete_type |
(str) Indicates the type of request this represents to the Synapse REST API. Should not typically need to be changed from its default value. |
id |
(Optional[str]) The unique ID of the agent prompt. |
session_id |
(Optional[str]) The ID of the session that the prompt is associated with. |
prompt |
(Optional[str]) The prompt to send to the agent. |
response |
(Optional[str]) The response from the agent. |
enable_trace |
(Optional[bool]) Whether tracing is enabled for the prompt. |
trace |
(Optional[str]) The trace of the agent session. |
An S3-style class object.
NULL
AgentPrompt(concrete_type="org.sagebionetworks.repo.model.agent.AgentChatRequest", id=NULL, session_id=NULL, prompt=NULL, response=NULL, enable_trace=FALSE, trace=NULL): Constructor for AgentPrompt
## Not run: ## Inspecting the prompts in a session # AgentPrompt objects are created for you when you prompt an agent. They make up # the chat history of an AgentSession. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt(prompt = "Hello", print_response = FALSE) for (agent_prompt in my_agent |> synGetChatHistory()) { print(agent_prompt$prompt) print(agent_prompt$response) } ## End(Not run)## Not run: ## Inspecting the prompts in a session # AgentPrompt objects are created for you when you prompt an agent. They make up # the chat history of an AgentSession. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt(prompt = "Hello", print_response = FALSE) for (agent_prompt in my_agent |> synGetChatHistory()) { print(agent_prompt$prompt) print(agent_prompt$response) } ## End(Not run)
Represents a Synapse Agent Session
AgentSession(id=NULL, access_level="PUBLICLY_ACCESSIBLE", started_on=NULL, started_by=NULL, modified_on=NULL, agent_registration_id=NULL, etag=NULL, chat_history=list())AgentSession(id=NULL, access_level="PUBLICLY_ACCESSIBLE", started_on=NULL, started_by=NULL, modified_on=NULL, agent_registration_id=NULL, etag=NULL, chat_history=list())
id |
(Optional[str]) The unique ID of the agent session. Can only be used by the user that created it. |
access_level |
(Optional[AgentSessionAccessLevel]) The access level of the agent session. One of PUBLICLY_ACCESSIBLE, READ_YOUR_PRIVATE_DATA, or WRITE_YOUR_PRIVATE_DATA. |
started_on |
(Optional[datetime]) The date the agent session was started. |
started_by |
(Optional[int]) The ID of the user who started the agent session. |
modified_on |
(Optional[datetime]) The date the agent session was last modified. |
agent_registration_id |
(Optional[int]) The registration ID of the agent that will be used for this session. |
etag |
(Optional[str]) The etag of the agent session. |
chat_history |
(List[AgentPrompt]) A list of AgentPrompt objects. |
An S3-style class object.
NULL
AgentSession(id=NULL, access_level="PUBLICLY_ACCESSIBLE", started_on=NULL, started_by=NULL, modified_on=NULL, agent_registration_id=NULL, etag=NULL, chat_history=list()): Constructor for AgentSession
synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, newer_than=NULL, timeout=120L, synapse_client=NULL): Sends a prompt to the agent and adds the response to the AgentSession's chat history. A session must be started before sending a prompt.
synStart(instance, synapse_client=NULL): Starts an agent session.
synUpdate(instance, synapse_client=NULL): Updates an agent session. Only updates to the access level are currently supported.
It is recommended to use the Agent class to conduct chat sessions,
but you are free to use AgentSession directly if you wish.
## Not run: ## Example 1: Start a session and send a prompt. # Start a session with a custom agent by providing the agent's registration ID # and calling synStart(). Then, send a prompt to the agent. library(synapser) synLogin() my_session = AgentSession(agent_registration_id = "foo") |> synStart() my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Prompt an existing session. # If you already have an existing session, you can send it a prompt by # constructing an AgentSession with its session ID. library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 3: Update the access level of an existing session. # Construct an AgentSession with its session ID, set the access level you # want, and call synUpdate(). library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session$access_level = "READ_YOUR_PRIVATE_DATA" my_session = my_session |> synUpdate() ## End(Not run)## Not run: ## Example 1: Start a session and send a prompt. # Start a session with a custom agent by providing the agent's registration ID # and calling synStart(). Then, send a prompt to the agent. library(synapser) synLogin() my_session = AgentSession(agent_registration_id = "foo") |> synStart() my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Prompt an existing session. # If you already have an existing session, you can send it a prompt by # constructing an AgentSession with its session ID. library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Example 3: Update the access level of an existing session. # Construct an AgentSession with its session ID, set the access level you # want, and call synUpdate(). library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session$access_level = "READ_YOUR_PRIVATE_DATA" my_session = my_session |> synUpdate() ## End(Not run)
A column model contains the metadata of a single column of a table or view.
Column(id=NULL, name=NULL, column_type=NULL, facet_type=NULL, default_value=NULL, maximum_size=NULL, maximum_list_length=NULL, enum_values=NULL, json_sub_columns=NULL)Column(id=NULL, name=NULL, column_type=NULL, facet_type=NULL, default_value=NULL, maximum_size=NULL, maximum_list_length=NULL, enum_values=NULL, json_sub_columns=NULL)
id |
(Optional[str]) The immutable ID issued to new columns. |
name |
(Optional[str]) The display name of the column. |
column_type |
(Optional[ColumnType]) The column type determines the type of data that can be stored in a column. Switching between types (using a transaction with TableUpdateTransaction in the "changes" list) is generally allowed except for switching to "_LIST" suffixed types. In such cases, a new column must be created and data must be copied over manually. |
facet_type |
(Optional[FacetType]) Set to one of the enumerated values to indicate a column should be treated as a facet. |
default_value |
(Optional[str]) The default value for this column. Columns of type ENTITYID, FILEHANDLEID, USERID, and LARGETEXT are not allowed to have default values. |
maximum_size |
(Optional[int]) A parameter for column types with a maximum size. For example, columns of type "STRING" have a default maximum size of 50 characters, but can be set to a maximum size of 1 to 1000 characters. For a column type of STRING_LIST, this limits the size of individual string elements in the list. |
maximum_list_length |
(Optional[int]) Required if using a column type with a "_LIST" suffix. Describes the maximum number of values that will appear in that list. Value range 1-100 inclusive. Default 100. |
enum_values |
(Optional[list[str]]) Columns of type STRING can be constrained to an enumeration of values set on this list. The maximum number of entries for an enum is 100. |
json_sub_columns |
(Optional[list[JsonSubColumn]]) For a column of type JSON that represents the combination of multiple sub-columns, this property is used to define each sub-column. |
An S3-style class object.
NULL
Column(id=NULL, name=NULL, column_type=NULL, facet_type=NULL, default_value=NULL, maximum_size=NULL, maximum_list_length=NULL, enum_values=NULL, json_sub_columns=NULL): Constructor for Column
synList(prefix=NULL, limit=100L, offset=0L, synapse_client=NULL): List columns with optional prefix filtering.
## Not run: ## Creating a table with columns library(synapser) synLogin() columns = list( Column(name = "my_string_column", column_type = "STRING", maximum_size = 100L), Column(name = "my_integer_column", column_type = "INTEGER"), Column(name = "my_status_column", column_type = "STRING", enum_values = list("pending", "done")), Column(name = "my_list_column", column_type = "STRING_LIST", maximum_list_length = 10L) ) table = Table(name = "My Table", parent_id = "syn123", columns = columns) |> synStore() ## Listing existing column models library(synapser) synLogin() columns = synList(prefix = "my_", limit = 10L) ## End(Not run)## Not run: ## Creating a table with columns library(synapser) synLogin() columns = list( Column(name = "my_string_column", column_type = "STRING", maximum_size = 100L), Column(name = "my_integer_column", column_type = "INTEGER"), Column(name = "my_status_column", column_type = "STRING", enum_values = list("pending", "done")), Column(name = "my_list_column", column_type = "STRING_LIST", maximum_list_length = 10L) ) table = Table(name = "My Table", parent_id = "syn123", columns = columns) |> synStore() ## Listing existing column models library(synapser) synLogin() columns = synList(prefix = "my_", limit = 10L) ## End(Not run)
A Dataset object represents the metadata of a Synapse Dataset.
https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/Dataset.html
Dataset(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="dataset", view_type_mask=128L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), size=NULL, checksum=NULL, count=NULL, columns=list(), annotations=list())Dataset(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="dataset", view_type_mask=128L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), size=NULL, checksum=NULL, count=NULL, columns=list(), annotations=list())
id |
(Optional[character]) The unique immutable ID for this dataset. A new ID will be generated for new Datasets. Once issued, this ID is guaranteed to never change or be re-issued |
name |
(Optional[character]) The name of this dataset. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses |
parent_id |
(Optional[character]) The ID of the Entity that is the parent of this dataset. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. |
version_number |
(Optional[integer]) The version number issued to this version on the object. |
view_entity_type |
(character) The API model string for the type of view. This is used to determine the default columns that are added to the table. Defaults to |
view_type_mask |
(integer) The Bit Mask representing Dataset type. As defined in the Synapse REST API: https://rest-docs.synapse.org/rest/GET/column/tableview/defaults.html. Defaults to 128. |
include_default_columns |
(Optional[logical]) When creating a dataset or view, specifies if default columns should be included. Default columns are columns that are automatically added to the dataset or view. These columns are managed by Synapse and cannot be modified. If you attempt to create a column with the same name as a default column, you will receive a warning when you store the dataset. |
description |
(Optional[character]) The description of the dataset. Must be 1000 characters or less. |
etag |
(Optional[character]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[character]) The date this dataset was created. |
modified_on |
(Optional[character]) The date this dataset was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format |
created_by |
(Optional[character]) The ID of the user that created this dataset. |
modified_by |
(Optional[character]) The ID of the user that last modified this dataset. |
version_label |
(Optional[character]) The version label for this dataset. |
version_comment |
(Optional[character]) The version comment for this dataset. |
is_latest_version |
(Optional[logical]) If this is the latest version of the object. |
is_search_enabled |
(Optional[logical]) When creating or updating a dataset or view specifies if full text search should be enabled. Note that enabling full text search might slow down the indexing of the dataset or view. |
items |
(Optional[list[EntityRef]]) The flat list of file entity references that define this dataset. This is effectively a list of the rows that are in/will be in the dataset after it is stored. The only way to add or remove rows is to add or remove items from this list. |
size |
(Optional[integer]) The cumulative size, in bytes, of all items (files) in the dataset. This is only correct after the dataset has been stored or newly read from Synapse. |
checksum |
(Optional[character]) The checksum is computed over a sorted concatenation of the checksums of all items in the dataset. This is only correct after the dataset has been stored or newly read from Synapse. |
count |
(Optional[integer]) The number of items/files in the dataset. This is only correct after the dataset has been stored or newly read from Synapse. |
columns |
(Optional; a list of Column objects or a named list of Column objects) The columns of this dataset. This is an ordered named list where the key is the name of the column and the value is the Column object. When creating a new instance of a Dataset object you may pass any of the following types as the library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet() dataset$columns[["my_column"]]$column_type = "DOUBLE" dataset = dataset |> synStore() Note that the keys in this named list should match the column names as they are in Synapse. However, know that the name attribute of the Column object is used for all interactions with the Synapse API. The named list key is purely for the usage of this interface. For example, if you wish to rename a column you may do so by changing the name attribute of the Column object. The key in the named list does not need to be changed. The next time you store the dataset the column will be updated in Synapse with the new name and the key in the named list will be updated. |
annotations |
(Optional[named list]) Additional metadata associated with the dataset. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. |
An S3-style class object.
NULL
Dataset(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="dataset", view_type_mask=128L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), size=NULL, checksum=NULL, count=NULL, columns=list(), annotations=list()): Constructor for Dataset
synAddColumn(instance, column, index=NULL): Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this Dataset instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the Dataset
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddItem(instance, item, synapse_client=NULL): Adds an item in the form of an EntityRef to the dataset.
For Folders, children are added recursively. Effect is not seen
until the dataset is stored.
synDeleteColumn(instance, name): Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this Dataset instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synRemoveItem(instance, item, synapse_client=NULL): Removes an item from the dataset. For Folders, all
children of the folder are removed recursively.
Effect is not seen until the dataset is stored.
synReorderColumn(instance, name, index): Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this Dataset instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in
the table. If you pass in an index that is out of bounds the column will be
added to the end of the list.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL): Creates a snapshot of the dataset. A snapshot is a saved, read-only version of the dataset
at the time it was created. Dataset snapshots are created using the asynchronous job API.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL): Update the values of rows in the dataset. This method can only
be used to update values in custom columns. Default columns cannot be updated, but
may be used as primary keys.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
## Not run: ## Example 1: Create a new dataset from a list of EntityRefs. # Dataset items consist of references to Synapse Files using an Entity Reference. # If you are adding items to a Dataset directly, you must provide them in the form of # an EntityRef class instance. library(synapser) synLogin() my_entity_refs = list(EntityRef(id = "syn1234"), EntityRef(id = "syn1235"), EntityRef(id = "syn1236")) my_dataset = Dataset(parent_id = "syn987", name = "my-new-dataset", items = my_entity_refs) my_dataset |> synStore() ## Example 2: Add entities to an existing dataset. # Using synAddItem(), you can add Synapse entities that are Files, Folders, or EntityRefs that point to a Synapse entity. # If the entity is a Folder (or an EntityRef that points to a folder), all of the child Files # within the Folder will be added to the Dataset recursively. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # Add a file to the dataset my_dataset |> synAddItem(File(id = "syn1235")) # Add a folder to the dataset # All child files are recursively added to the dataset my_dataset |> synAddItem(Folder(id = "syn1236")) # Add an entity reference to the dataset my_dataset |> synAddItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## Example 3: Remove entities from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # Remove a file from the dataset my_dataset |> synRemoveItem(File(id = "syn1235")) # Remove a folder from the dataset # All child files are recursively removed from the dataset my_dataset |> synRemoveItem(Folder(id = "syn1236")) # Remove an entity reference from the dataset my_dataset |> synRemoveItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## Example 4: Query data from a dataset. library(synapser) synLogin() row = synQuery(query = "SELECT * FROM syn1234 WHERE id = 'syn1235'") print(row) ## Example 5: Add a custom column to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddColumn(Column(name = "my_annotation", column_type = "STRING")) my_dataset |> synStore() ## Example 6: Update custom column values in a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_dataset |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) ## Example 7: Save a snapshot of a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## Example 8: Deleting a dataset. library(synapser) synLogin() Dataset(id = "syn4567") |> synDelete() ## End(Not run)## Not run: ## Example 1: Create a new dataset from a list of EntityRefs. # Dataset items consist of references to Synapse Files using an Entity Reference. # If you are adding items to a Dataset directly, you must provide them in the form of # an EntityRef class instance. library(synapser) synLogin() my_entity_refs = list(EntityRef(id = "syn1234"), EntityRef(id = "syn1235"), EntityRef(id = "syn1236")) my_dataset = Dataset(parent_id = "syn987", name = "my-new-dataset", items = my_entity_refs) my_dataset |> synStore() ## Example 2: Add entities to an existing dataset. # Using synAddItem(), you can add Synapse entities that are Files, Folders, or EntityRefs that point to a Synapse entity. # If the entity is a Folder (or an EntityRef that points to a folder), all of the child Files # within the Folder will be added to the Dataset recursively. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # Add a file to the dataset my_dataset |> synAddItem(File(id = "syn1235")) # Add a folder to the dataset # All child files are recursively added to the dataset my_dataset |> synAddItem(Folder(id = "syn1236")) # Add an entity reference to the dataset my_dataset |> synAddItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## Example 3: Remove entities from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # Remove a file from the dataset my_dataset |> synRemoveItem(File(id = "syn1235")) # Remove a folder from the dataset # All child files are recursively removed from the dataset my_dataset |> synRemoveItem(Folder(id = "syn1236")) # Remove an entity reference from the dataset my_dataset |> synRemoveItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## Example 4: Query data from a dataset. library(synapser) synLogin() row = synQuery(query = "SELECT * FROM syn1234 WHERE id = 'syn1235'") print(row) ## Example 5: Add a custom column to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddColumn(Column(name = "my_annotation", column_type = "STRING")) my_dataset |> synStore() ## Example 6: Update custom column values in a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_dataset |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) ## Example 7: Save a snapshot of a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## Example 8: Deleting a dataset. library(synapser) synLogin() Dataset(id = "syn4567") |> synDelete() ## End(Not run)
A DatasetCollection object represents the metadata of a Synapse Dataset Collection.
https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/DatasetCollection.html
A Dataset Collection is a type of view defined by a flat list of Datasets.
DatasetCollection(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="datasetcollection", view_type_mask=256L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), columns=list(), annotations=list())DatasetCollection(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="datasetcollection", view_type_mask=256L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), columns=list(), annotations=list())
id |
(Optional[character]) The unique immutable ID for this dataset collection. A new ID will be generated for new DatasetCollections. Once issued, this ID is guaranteed to never change or be re-issued |
name |
(Optional[character]) The name of this dataset collection. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses |
parent_id |
(Optional[character]) The ID of the Entity that is the parent of this dataset collection. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. |
version_number |
(Optional[integer]) The version number issued to this version on the object. |
view_entity_type |
(character) The API model string for the type of view. This is used to determine the default columns that are added to the table. Defaults to |
view_type_mask |
(integer) The Bit Mask representing DatasetCollection type. As defined in the Synapse REST API: https://rest-docs.synapse.org/rest/GET/column/tableview/defaults.html. Defaults to 256. |
include_default_columns |
(Optional[logical]) When creating a dataset collection or view, specifies if default columns should be included. Default columns are columns that are automatically added to the dataset collection or view. These columns are managed by Synapse and cannot be modified. If you attempt to create a column with the same name as a default column, you will receive a warning when you store the dataset collection. |
description |
(Optional[character]) The description of the dataset collection. Must be 1000 characters or less. |
etag |
(Optional[character]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[character]) The date this dataset collection was created. |
modified_on |
(Optional[character]) The date this dataset collection was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format |
created_by |
(Optional[character]) The ID of the user that created this dataset collection. |
modified_by |
(Optional[character]) The ID of the user that last modified this dataset collection. |
version_label |
(Optional[character]) The version label for this dataset collection. |
version_comment |
(Optional[character]) The version comment for this dataset collection. |
is_latest_version |
(Optional[logical]) If this is the latest version of the object. |
is_search_enabled |
(Optional[logical]) When creating or updating a dataset collection or view specifies if full text search should be enabled. Note that enabling full text search might slow down the indexing of the dataset collection or view. |
items |
(Optional[list[EntityRef]]) The flat list of datasets that define this collection. This is effectively a list of the rows that are in/will be in the collection after it is stored. The only way to add or remove rows is to add or remove items from this list. |
columns |
(Optional[Union[list[Column], OrderedDict[str, Column], dict[str, Column]]]) The columns of this dataset collection. This is an ordered named list where the key is the name of the column and the value is the Column object. When creating a new instance of a DatasetCollection object you may pass any of the following types as the library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet() collection$columns[["my_column"]]$column_type = "DOUBLE" collection = collection |> synStore() Note that the keys in this named list should match the column names as they are in Synapse. However, know that the name attribute of the Column object is used for all interactions with the Synapse API. The named list key is purely for the usage of this interface. For example, if you wish to rename a column you may do so by changing the name attribute of the Column object. The key in the named list does not need to be changed. The next time you store the dataset collection the column will be updated in Synapse with the new name and the key in the named list will be updated. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the dataset collection. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. |
An S3-style class object.
NULL
DatasetCollection(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="datasetcollection", view_type_mask=256L, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, items=list(), columns=list(), annotations=list()): Constructor for DatasetCollection
synAddColumn(instance, column, index=NULL): Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this DatasetCollection instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the DatasetCollection
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddItem(instance, item): Adds a dataset to the dataset collection.
Effect is not seen until the dataset collection is stored.
synDeleteColumn(instance, name): Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this DatasetCollection instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synRemoveItem(instance, item): Removes an entity from the dataset collection. Must be a Dataset or EntityRef.
Effect is not seen until the dataset collection is stored.
Unless the version is specified, all entities with the same ID will be removed.
synReorderColumn(instance, name, index): Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this DatasetCollection instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in
the table. If you pass in an index that is out of bounds the column will be
added to the end of the list.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL): Creates a snapshot of the dataset collection. A snapshot is a saved, read-only version of the dataset collection
at the time it was created. Dataset collection snapshots are created using the asynchronous job API.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL): Update the values of rows in the dataset collection. This method can only
be used to update values in custom columns. Default columns cannot be updated, but
may be used as primary keys.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
## Not run: ## Example 1: Create a new Dataset Collection from a list of Datasets. library(synapser) synLogin() my_datasets = list(Dataset(id = "syn1234"), Dataset(id = "syn1235"), Dataset(id = "syn1236")) my_collection = DatasetCollection(parent_id = "syn987", name = "my-new-collection", items = my_datasets) my_collection |> synStore() ## Example 2: Add Datasets to an existing Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # Add a dataset to the collection my_collection |> synAddItem(Dataset(id = "syn1235")) my_collection |> synStore() ## Example 3: Remove Datasets from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # Remove a dataset from the collection my_collection |> synRemoveItem(Dataset(id = "syn1235")) my_collection |> synStore() ## Example 4: Query data from a Dataset Collection. library(synapser) synLogin() row = synQuery(query = "SELECT * FROM syn1234 WHERE id = 'syn1235'") print(row) ## Example 5: Add a custom column to a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synAddColumn(Column(name = "my_annotation", column_type = "STRING")) my_collection |> synStore() ## Example 6: Update custom column values in a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset collection as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_collection |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) ## Example 7: Save a snapshot of a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## Example 8: Deleting a Dataset Collection. library(synapser) synLogin() DatasetCollection(id = "syn4567") |> synDelete() ## End(Not run)## Not run: ## Example 1: Create a new Dataset Collection from a list of Datasets. library(synapser) synLogin() my_datasets = list(Dataset(id = "syn1234"), Dataset(id = "syn1235"), Dataset(id = "syn1236")) my_collection = DatasetCollection(parent_id = "syn987", name = "my-new-collection", items = my_datasets) my_collection |> synStore() ## Example 2: Add Datasets to an existing Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # Add a dataset to the collection my_collection |> synAddItem(Dataset(id = "syn1235")) my_collection |> synStore() ## Example 3: Remove Datasets from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # Remove a dataset from the collection my_collection |> synRemoveItem(Dataset(id = "syn1235")) my_collection |> synStore() ## Example 4: Query data from a Dataset Collection. library(synapser) synLogin() row = synQuery(query = "SELECT * FROM syn1234 WHERE id = 'syn1235'") print(row) ## Example 5: Add a custom column to a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synAddColumn(Column(name = "my_annotation", column_type = "STRING")) my_collection |> synStore() ## Example 6: Update custom column values in a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset collection as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_collection |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) ## Example 7: Save a snapshot of a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## Example 8: Deleting a Dataset Collection. library(synapser) synLogin() DatasetCollection(id = "syn4567") |> synDelete() ## End(Not run)
A single item for a user's download list.
https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/download/DownloadListItem.html
DownloadListItem(file_entity_id, version_number=NULL)DownloadListItem(file_entity_id, version_number=NULL)
file_entity_id |
(character) Synapse ID of the file entity (e.g. "syn123"). |
version_number |
(Optional[integer]) Version of the file to target. |
An S3-style class object.
NULL
DownloadListItem(file_entity_id, version_number=NULL): Constructor for DownloadListItem
## Not run: ## Using this class # Identify files (and optionally their versions) on your download list library(synapser) synLogin() items = list( DownloadListItem(file_entity_id = "syn123"), DownloadListItem(file_entity_id = "syn456", version_number = 2L) ) # Add files to the cart count = synDownloadListAdd(items) print(count) # Download all files in the cart to a local directory. items = synDownloadListFiles() print(items) # Remove files from the cart count = synDownloadListRemove(items) print(count) ## End(Not run)## Not run: ## Using this class # Identify files (and optionally their versions) on your download list library(synapser) synLogin() items = list( DownloadListItem(file_entity_id = "syn123"), DownloadListItem(file_entity_id = "syn456", version_number = 2L) ) # Add files to the cart count = synDownloadListAdd(items) print(count) # Download all files in the cart to a local directory. items = synDownloadListFiles() print(items) # Remove files from the cart count = synDownloadListRemove(items) print(count) ## End(Not run)
Represents a reference to the id and version of an entity to be used in Dataset and
DatasetCollection objects.
EntityRef(id, version)EntityRef(id, version)
id |
(character) The Synapse ID of the entity. |
version |
(integer) Indicates a specific version of the entity. |
An S3-style class object.
NULL
EntityRef(id, version): Constructor for EntityRef
## Not run: ## Adding a specific entity version to a Dataset library(synapser) synLogin() my_dataset = Dataset(id = "syn123") |> synGet() my_dataset |> synAddItem(EntityRef(id = "syn456", version = 1L)) my_dataset = my_dataset |> synStore() ## End(Not run)## Not run: ## Adding a specific entity version to a Dataset library(synapser) synLogin() my_dataset = Dataset(id = "syn123") |> synGet() my_dataset |> synAddItem(EntityRef(id = "syn456", version = 1L)) my_dataset = my_dataset |> synStore() ## End(Not run)
A view of Entities within a defined scope. The purpose of an EntityView, also known
as a FileView, is to create a SQL-like view of entities within a
defined scope. The scope is defined by the scope_ids attribute. The scope_ids
attribute is a list of syn container ids that define where to search for rows to
include in the view. Entities within the scope are included in the view if they
match the criteria defined by the view_type_mask attribute. The view_type_mask
attribute is a bit mask representing the types to include in the view. You may set
this to a single integer value, or you may combine multiple values using a bitwise OR
(bitwOr() in R).
EntityView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type=NULL, view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, scope_ids=list(), annotations=list())EntityView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type=NULL, view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, scope_ids=list(), annotations=list())
id |
(Optional[str]) The unique immutable ID for this entity. A new ID will be generated for new Entities. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this entity. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. Activity cannot be removed during a store operation by setting it to NULL. You must use: |
version_number |
(Optional[int]) The version number issued to this version on the object. |
view_entity_type |
(Optional[str]) The type of view. This is used to determine the default columns that are added to the view. One of |
view_type_mask |
(Optional[int]) Bit mask representing the types to include in the view. You may set this to a single value, or you may combine multiple values using a bitwise OR. When this is returned after storing or reading from Synapse it will be returned as an integer.
library(synapser)
synLogin()
view = EntityView(
name = "My EntityView",
parent_id = "syn1234",
scope_ids = list("syn1234"),
view_type_mask = bitwOr(0x01L, 0x08L) # File | Folder
) |> synStore()
|
include_default_columns |
(Optional[bool]) When creating an EntityView or view, specifies if default columns should be included. Default columns are columns that are automatically added to the EntityView or view. These columns are managed by Synapse and cannot be modified. If you attempt to create a column with the same name as a default column, you will receive a warning when you store the EntityView. |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this entity was created. |
modified_on |
(Optional[str]) The date this entity was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format. |
created_by |
(Optional[str]) The ID of the user that created this entity. |
modified_by |
(Optional[str]) The ID of the user that last modified this entity. |
version_label |
(Optional[str]) The version label for this entity. |
version_comment |
(Optional[str]) The version comment for this entity. |
is_latest_version |
(Optional[bool]) If this is the latest version of the object. |
columns |
(Optional[Union[list[Column], OrderedDict[str, Column], dict[str, Column]]]) The columns of this view. This is an ordered named list where the key is the name of the column and the value is the Column object. When creating a new instance of an EntityView object you may pass any of the following types as the library(synapser) synLogin() view = EntityView(id = "syn1234") |> synGet() view$columns[["my_column"]]$column_type = "DOUBLE" view = view |> synStore() Note that the keys in this named list should match the column names as they are in Synapse. However, know that the name attribute of the Column object is used for all interactions with the Synapse API. The named list key is purely for the usage of this interface. For example, if you wish to rename a column you may do so by changing the name attribute of the Column object. The key in the named list does not need to be changed. The next time you store the view the column will be updated in Synapse with the new name and the key in the named list will be updated. |
is_search_enabled |
(Optional[bool]) When creating or updating an EntityView or view specifies if full text search should be enabled. Note that enabling full text search might slow down the indexing of the EntityView or view. |
scope_ids |
(Optional[set[str]]) The list of container ids that define the scope of this view. This may be a single container or multiple containers. A container in this context may refer to a Project or Folder which contains zero or more entities. The entities in the container(s) will be included in the view if they match the criteria defined by the |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the EntityView. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
An S3-style class object.
NULL
EntityView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type=NULL, view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, scope_ids=list(), annotations=list()): Constructor for EntityView
synAddColumn(instance, column, index=NULL): Add column(s) to the EntityView. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this EntityView instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the EntityView
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL): Bind a JSON schema to the entity.
synDeleteColumn(instance, name): Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this EntityView instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synGetSchema(instance, synapse_client=NULL): Get the JSON schema bound to the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL): Retrieve derived JSON schema keys for the entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synReorderColumn(instance, name, index): Reorder a column in the EntityView. Note that this does not store the column in
Synapse. You must call the synStore() function on this EntityView instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in
the EntityView. If you pass in an index that is out of bounds the column will be
added to the end of the list.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL): Creates a snapshot of the EntityView entity.
Synapse handles snapshot creation differently for Table- and View-like
entities. View snapshots are created using the asynchronous job API.
Making a snapshot of a view allows you to create an immutable version of the
view at the time of the snapshot. This is useful to create checkpoints in time
that you may go back and reference, or use in a publication. Snapshots are
immutable and cannot be changed. They may only be deleted.
synUnbindSchema(instance, synapse_client=NULL): Unbind the JSON schema bound to the entity.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL): This method leverages the logic provided by synUpsertRows() to provide
an interface for updating rows in a View-like entity. Update functionality will only work for
values in custom columns within a View-like entity.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The primary_keys columns must be present in the data being updated. An
error is raised if a primary key column is missing.
- The values in the primary_keys columns cannot be null. A null value
cannot be used to match an existing row, so an error is raised if any row
has a null value in a primary key column.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
synValidateSchema(instance, synapse_client=NULL): Validate the entity against the bound JSON schema.
## Not run: ## Creating an EntityView of the files in a project library(synapser) synLogin() view = EntityView( name = "My File View", parent_id = "syn123", scope_ids = list("syn123"), view_type_mask = 1L # 1 = files ) |> synStore() results = synQuery(query = sprintf("SELECT * FROM %s", view$id)) print(results) ## End(Not run)## Not run: ## Creating an EntityView of the files in a project library(synapser) synLogin() view = EntityView( name = "My File View", parent_id = "syn123", scope_ids = list("syn123"), view_type_mask = 1L # 1 = files ) |> synStore() results = synQuery(query = sprintf("SELECT * FROM %s", view$id)) print(results) ## End(Not run)
An Evaluation is the core object of the Evaluation API, used to support collaborative data analysis challenges in Synapse.
An Evaluation object represents an evaluation queue in Synapse:
https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/Evaluation.html
Evaluation(id=NULL, etag=NULL, name=NULL, description=NULL, owner_id=NULL, created_on=NULL, content_source=NULL, submission_instructions_message=NULL, submission_receipt_message=NULL)Evaluation(id=NULL, etag=NULL, name=NULL, description=NULL, owner_id=NULL, created_on=NULL, content_source=NULL, submission_instructions_message=NULL, submission_receipt_message=NULL)
id |
(Optional[str]) The unique immutable ID for this Evaluation. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. The eTag changes every time an Evaluation is updated; it is used to detect when a client's copy of an Evaluation is out-of-date. |
name |
(Optional[str]) **Required to store.** The name of this Evaluation. |
description |
(Optional[str])**Required to store.** A text description of this Evaluation. |
owner_id |
(Optional[str]) The ID of the Synapse user who created this Evaluation. |
created_on |
(Optional[str]) The date on which Evaluation was created. |
content_source |
(Optional[str])**Required to store.** The Synapse ID of the Entity to which this Evaluation belongs, e.g. a reference to a Synapse project. |
submission_instructions_message |
(Optional[str]) **Required to store.** Message to display to users detailing acceptable formatting for Submissions to this Evaluation. |
submission_receipt_message |
(Optional[str]) **Required to store.** Message to display to users upon successful submission to this Evaluation. |
An S3-style class object.
NULL
Evaluation(id=NULL, etag=NULL, name=NULL, description=NULL, owner_id=NULL, created_on=NULL, content_source=NULL, submission_instructions_message=NULL, submission_receipt_message=NULL): Constructor for Evaluation
synGetAcl(instance, synapse_client=NULL): Get the access control list (ACL) governing this evaluation.
synGetAllEvaluations(access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL): Get a list of all Evaluations, within a given range.
synGetAvailableEvaluations(active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL): Get a list of Evaluations to which the user has SUBMIT permission, within a given range.
synGetEvaluationsByProject(project_id, access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL): Get Evaluations tied to a project.
synGetPermissions(instance, synapse_client=NULL): Get the user permissions for this evaluation.
synUpdateAcl(instance, principal_id=NULL, access_type=NULL, acl=NULL, synapse_client=NULL): Update the access control list (ACL) for this evaluation.
You can either:
1. Provide a principal_id and access_type list to update permissions for a specific user/team
2. Provide a complete ACL named list to update all permissions at once
To remove a principal from the ACL completely, provide an empty list for access_type.
The available access types are:
- "CREATE"
- "SUBMIT"
- "READ_PRIVATE_SUBMISSION"
- "DELETE_SUBMISSION"
- "UPDATE_SUBMISSION"
- "CHANGE_PERMISSIONS"
- "READ"
- "DELETE"
- "UPDATE"
## Not run: ## Example 1: Create a new evaluation in a project # Create a new evaluation on Synapse by storing an evaluation object with the required fields. If there are any fields missing, an error will be raised. library(synapser) synLogin() evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = "syn123456", submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) created = evaluation |> synStore() ## Example 2: Get an evaluation by ID and by name library(synapser) synLogin() # Get an evaluation by ID evaluation_by_id = Evaluation(id = "9999999") |> synGet() # Get an evaluation by name evaluation_by_name = Evaluation(name = "My Challenge Evaluation") |> synGet() ## Example 3: Update an existing evaluation retrieved from Synapse by ID # You can use synStore() to create and update evaluations. library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] evaluation$description = "Updated description for my evaluation" updated = evaluation |> synStore() ## Example 4: Retrieve and update the ACL of an evaluation library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] acl = evaluation |> synGetAcl() # Let's grant this team READ and SUBMIT permissions team_id = "123456" evaluation |> synUpdateAcl(principal_id = team_id, access_type = list("READ", "SUBMIT")) # Now let's revoke all permissions from this team team_to_revoke_from = "654321" evaluation |> synUpdateAcl(principal_id = team_to_revoke_from, access_type = list()) ## Example 5: Delete an evaluation library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] evaluation |> synDelete() ## End(Not run)## Not run: ## Example 1: Create a new evaluation in a project # Create a new evaluation on Synapse by storing an evaluation object with the required fields. If there are any fields missing, an error will be raised. library(synapser) synLogin() evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = "syn123456", submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) created = evaluation |> synStore() ## Example 2: Get an evaluation by ID and by name library(synapser) synLogin() # Get an evaluation by ID evaluation_by_id = Evaluation(id = "9999999") |> synGet() # Get an evaluation by name evaluation_by_name = Evaluation(name = "My Challenge Evaluation") |> synGet() ## Example 3: Update an existing evaluation retrieved from Synapse by ID # You can use synStore() to create and update evaluations. library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] evaluation$description = "Updated description for my evaluation" updated = evaluation |> synStore() ## Example 4: Retrieve and update the ACL of an evaluation library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] acl = evaluation |> synGetAcl() # Let's grant this team READ and SUBMIT permissions team_id = "123456" evaluation |> synUpdateAcl(principal_id = team_id, access_type = list("READ", "SUBMIT")) # Now let's revoke all permissions from this team team_to_revoke_from = "654321" evaluation |> synUpdateAcl(principal_id = team_to_revoke_from, access_type = list()) ## Example 5: Delete an evaluation library(synapser) synLogin() evaluation = synGetAllEvaluations(evaluation_ids = list("9999999"))[[1]] evaluation |> synDelete() ## End(Not run)
A file within Synapse.
File(id=NULL, name=NULL, path=NULL, description=NULL, parent_id=NULL, version_label=NULL, version_comment=NULL, data_file_handle_id=NULL, external_url=NULL, activity=NULL, annotations=list(), content_type=NULL, content_size=NULL, content_md5=NULL, create_or_update=TRUE, force_version=TRUE, is_restricted=FALSE, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_store=TRUE, download_file=TRUE, if_collision="keep.both", synapse_container_limit=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_number=NULL, is_latest_version=NULL, file_handle=NULL)File(id=NULL, name=NULL, path=NULL, description=NULL, parent_id=NULL, version_label=NULL, version_comment=NULL, data_file_handle_id=NULL, external_url=NULL, activity=NULL, annotations=list(), content_type=NULL, content_size=NULL, content_md5=NULL, create_or_update=TRUE, force_version=TRUE, is_restricted=FALSE, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_store=TRUE, download_file=TRUE, if_collision="keep.both", synapse_container_limit=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_number=NULL, is_latest_version=NULL, file_handle=NULL)
id |
(Optional[str]) The unique immutable ID for this file. A new ID will be generated for new Files. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. If not specified, the name will be derived from the file name. |
path |
(Optional[str]) The path to the file on disk. Using shorthand This is used during a This is also used during a |
description |
(Optional[str]) The description of this file. Must be 1000 characters or less. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this Entity. Setting this to a new value and storing it will move this File under the new parent. |
version_label |
(Optional[str]) The version label for this entity. Updates to the entity will increment the version number. |
version_comment |
(Optional[str]) The version comment for this entity |
data_file_handle_id |
(Optional[str]) ID of the file associated with this entity. You may define an existing data_file_handle_id to use the existing data_file_handle_id. The creator of the file must also be the owner of the data_file_handle_id to have permission to store the file. |
external_url |
(Optional[str]) The external URL of this file. If this is set AND |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. Activity cannot be removed during a store operation by setting it to NULL. You must use: |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the file. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
content_type |
(Optional[str]) (New Upload Only) Used to manually specify Content-type header, for example 'application/png' or 'application/json; charset=UTF-8'. If not specified, the content type will be derived from the file extension. This can be specified only during the initial store of this file or any time there is a new file to upload. In order to change this after the File has been created use |
content_size |
(Optional[int]) (New Upload Only) The size of the file in bytes. This can be specified only during the initial creation of the File. This is also only applicable to files not uploaded to Synapse. ie: |
content_md5 |
(Optional[str]) (Store only) The MD5 of the file is known. If not supplied this will be computed in the client is possible. If supplied for a file entity already stored in Synapse it will be calculated again to check if a new upload needs to occur. This will not be filled in during a read for data. It is only used during a store operation. To retrieve the md5 of the file after read from synapse use the |
create_or_update |
(bool) (Store only) Indicates whether the method should automatically perform an update if the file conflicts with an existing Synapse object. |
force_version |
(bool) (Store only) Indicates whether the method should increment the version of the object if something within the entity has changed. For example updating the description or name. You may set this to FALSE and an update to the entity will not increment the version. Updating the An update to the MD5 of the file will force a version update regardless of this flag. |
is_restricted |
(bool) (Store only) If set to TRUE, an email will be sent to the Synapse access control team to start the process of adding terms-of-use or review board approval for this entity. You will be contacted with regards to the specific data being restricted and the requirements of access. This may be used only by an administrator of the specified file. |
merge_existing_annotations |
(bool) (Store only) Works in conjunction with |
associate_activity_to_new_version |
(bool) (Store only) Works in conjunction with |
synapse_store |
(bool) (Store only) Whether the File should be uploaded or if FALSE: only the path should be stored when |
download_file |
(bool) (Get only) If TRUE the file will be downloaded. |
if_collision |
(str) (Get only) Determines how to handle file collisions. Defaults to "keep.both". May be: |
synapse_container_limit |
(Optional[str]) (Get only) A Synapse ID used to limit the search in Synapse if file is specified as a local file. That is, if the file is stored in multiple locations in Synapse only the ones in the specified folder/project will be returned. |
etag |
(Optional[str]) (Read Only) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) (Read Only) The date this entity was created. |
modified_on |
(Optional[str]) (Read Only) The date this entity was last modified. |
created_by |
(Optional[str]) (Read Only) The ID of the user that created this entity. |
modified_by |
(Optional[str]) (Read Only) The ID of the user that last modified this entity. |
version_number |
(Optional[int]) (Read Only) The version number issued to this version on the object. |
is_latest_version |
(Optional[bool]) (Read Only) If this is the latest version of the object. |
file_handle |
(Optional[FileHandle]) (Read Only) The file handle associated with this entity. |
An S3-style class object.
NULL
File(id=NULL, name=NULL, path=NULL, description=NULL, parent_id=NULL, version_label=NULL, version_comment=NULL, data_file_handle_id=NULL, external_url=NULL, activity=NULL, annotations=list(), content_type=NULL, content_size=NULL, content_md5=NULL, create_or_update=TRUE, force_version=TRUE, is_restricted=FALSE, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_store=TRUE, download_file=TRUE, if_collision="keep.both", synapse_container_limit=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_number=NULL, is_latest_version=NULL, file_handle=NULL): Constructor for File
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL): Bind a JSON schema to the entity.
synChangeMetadata(instance, name=NULL, download_as=NULL, content_type=NULL, synapse_client=NULL): Change File Entity metadata for properties that are immutable after creation through the store method.
synCopy(instance, parent_id, update_existing=FALSE, copy_annotations=TRUE, copy_activity="traceback", synapse_client=NULL): Copy the file to another Synapse location. Defaults to the latest version of the file, or the version_number specified in the instance.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you should use the synSetPermissions() function with the access_type set to an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synGetFromId(cls, synapse_id, synapse_client=NULL): Wrapper for synGet.
synGetFromPath(cls, path, synapse_client=NULL): Get the file from Synapse. If the path of the file matches multiple files within Synapse the first one found will be returned. The other matching files will be printed to the console.
Wrapper for synGet.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions that the caller has on an Entity.
synGetSchema(instance, synapse_client=NULL): Get the JSON schema bound to the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL): Retrieve derived JSON schema keys for the entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synUnbindSchema(instance, synapse_client=NULL): Unbind the JSON schema bound to the entity.
synValidateSchema(instance, synapse_client=NULL): Validate the entity against the bound JSON schema.
## Not run: ## Example 1: Uploading a file library(synapser) synLogin() file = File( path = "/path/to/file.txt", parent_id = "syn123", description = "My data file", annotations = list(species = "Homo sapiens") ) |> synStore() print(file$id) ## Example 2: Getting a file's metadata without downloading it library(synapser) synLogin() file = File(id = "syn456") |> synGet(file_options = FileOptions(download_file = FALSE)) print(file$name) ## End(Not run)## Not run: ## Example 1: Uploading a file library(synapser) synLogin() file = File( path = "/path/to/file.txt", parent_id = "syn123", description = "My data file", annotations = list(species = "Homo sapiens") ) |> synStore() print(file$id) ## Example 2: Getting a file's metadata without downloading it library(synapser) synLogin() file = File(id = "syn456") |> synGet(file_options = FileOptions(download_file = FALSE)) print(file$name) ## End(Not run)
Configuration options specific to File entities when using the factory methods.
This dataclass allows you to customize how File entities are handled during retrieval, including download behavior, file location, and collision handling.
FileOptions(download_file=TRUE, download_location=NULL, if_collision="keep.both")FileOptions(download_file=TRUE, download_location=NULL, if_collision="keep.both")
download_file |
(bool) Whether to automatically download the file content when retrieving the File entity. If TRUE, the file will be downloaded to the local filesystem. If FALSE, only the metadata will be retrieved. Default is TRUE. |
download_location |
(Optional[str]) The local directory path where the file should be downloaded. If NULL, the file will be downloaded to the default Synapse cache location. If specified, must be a valid directory path. Default is NULL. |
if_collision |
(str) Strategy to use when a file with the same name already exists at the download location. Valid options are: |
An S3-style class object.
NULL
FileOptions(download_file=TRUE, download_location=NULL, if_collision="keep.both"): Constructor for FileOptions
## Not run: # Configure file download options: library(synapser) # Download file to specific location with overwrite file_options = FileOptions( download_file = TRUE, download_location = "/path/to/downloads/", if_collision = "overwrite.local" ) # Only retrieve metadata, don't download file content metadata_only = FileOptions(download_file = FALSE) ## End(Not run)## Not run: # Configure file download options: library(synapser) # Download file to specific location with overwrite file_options = FileOptions( download_file = TRUE, download_location = "/path/to/downloads/", if_collision = "overwrite.local" ) # Only retrieve metadata, don't download file content metadata_only = FileOptions(download_file = FALSE) ## End(Not run)
Folder is a hierarchical container for organizing data in Synapse.
Folder(id=NULL, name=NULL, parent_id=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), is_restricted=FALSE, create_or_update=TRUE)Folder(id=NULL, name=NULL, parent_id=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), is_restricted=FALSE, create_or_update=TRUE)
id |
(Optional[str]) The unique immutable ID for this folder. A new ID will be generated for new Folders. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this folder. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. |
parent_id |
(Optional[str]) The ID of the Project or Folder that is the parent of this Folder. |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) (Read Only) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) (Read Only) The date this entity was created. |
modified_on |
(Optional[str]) (Read Only) The date this entity was last modified. |
created_by |
(Optional[str]) (Read Only) The ID of the user that created this entity. |
modified_by |
(Optional[str]) (Read Only) The ID of the user that last modified this entity. |
files |
(list[File]) Files that exist within this folder. |
folders |
(list[Folder]) Folders that exist within this folder. |
tables |
(list[Table]) Tables that exist within this folder. |
entityviews |
(list[EntityView]) Entity views that exist within this folder. |
submissionviews |
(list[SubmissionView]) Submission views that exist within this folder. |
datasets |
(list[Dataset]) Datasets that exist within this folder. |
datasetcollections |
(list[DatasetCollection]) Dataset collections that exist within this folder. |
materializedviews |
(list[MaterializedView]) Materialized views that exist within this folder. |
virtualtables |
(list[VirtualTable]) Virtual tables that exist within this folder. |
searchindexes |
(list[SearchIndex]) Search indexes that exist within this folder. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the folder. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
is_restricted |
(bool) (Store only) If set to TRUE, an email will be sent to the Synapse access control team to start the process of adding terms-of-use or review board approval for this entity. You will be contacted with regards to the specific data being restricted and the requirements of access. |
create_or_update |
(bool) (Store only) Indicates whether the method should automatically perform an update if the resource conflicts with an existing Synapse object. When TRUE this means that any changes to the resource will be non-destructive. This boolean is ignored if you've already stored or retrieved the resource from Synapse for this instance at least once. Any changes to the resource will be destructive in this case. For example if you want to delete the content for a field you will need to call |
An S3-style class object.
NULL
Folder(id=NULL, name=NULL, parent_id=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), is_restricted=FALSE, create_or_update=TRUE): Constructor for Folder
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL): Bind a JSON schema to the entity.
synCopy(instance, parent_id, copy_annotations=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL): Copy the folder to another Synapse location. This will recursively copy all Tables, Links, Files, and Folders within the folder.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you should use the synSetPermissions() function with the access_type set to an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeleteProjectSetting(instance, setting_id, synapse_client=NULL): Delete a project setting by its setting ID.
synFlattenFileList(instance): Recursively loop over all of the already retrieved files and folders and return a list of all files in the container.
synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL): Walk a local directory, mirror its folder hierarchy under this container in Synapse, and write a CSV manifest ready for synSyncToSynapse().
The manifest has two columns: path (absolute, symlink-resolved) and parentId (the Synapse ID of the file's containing folder). Existing Synapse folders with matching names and parents are reused. Directory symlinks inside directory_path are not followed; file symlinks record the symlink path and upload the target's contents. Zero-byte files are skipped with a warning — Synapse rejects empty files. I/O errors during walk are logged and skipped; an empty source directory produces a warning and a header-only manifest.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL that a user or group has on an Entity.
synGetInvalidValidation(instance, synapse_client=NULL): Get invalid JSON schema validation results for a container entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions that the caller has on an Entity.
synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL): Get the project setting for this entity.
synGetSchema(instance, synapse_client=NULL): Get the JSON schema bound to the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL): Retrieve derived JSON schema keys for the entity.
synGetSchemaValidationStatistics(instance, synapse_client=NULL): Get validation statistics for a container entity.
synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL): Get STS (AWS Security Token Service) credentials for direct access to the storage location backing this entity. These credentials can be used with AWS tools such as the AWS CLI.
synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL): Index files in this entity for migration to a new storage location.
This is the first step in migrating files to a new storage location. After indexing, use synMigrateIndexedFiles() to perform the actual migration.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synMapDirectoryToAllContainedFiles(instance, root_path): Recursively loop over all of the already retrieved files and folders. Then return back a named list where the key is the path to the directory at each level. The value is a list of all files in that directory AND all files in the child directories.
This is used during the creation of the manifest TSV file during the syncFromSynapse utility function.
synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL): Migrate files that have been indexed with synIndexFilesForMigration().
This is the second step in migrating files to a new storage location. Files must first be indexed using synIndexFilesForMigration().
Interactive confirmation: When called from an interactive shell and force=FALSE (the default), this function will print the number of items queued for migration and prompt for confirmation before proceeding. If standard output is not connected to an interactive terminal (e.g. a script or CI environment), migration is aborted unless force=TRUE is set.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL): Set the upload storage location for this entity. This configures where files uploaded to this entity will be stored.
This is a destructive update. The provided storage_location_id value(s) will replace any storage locations previously configured on this entity. To add a storage location without removing existing ones, first retrieve the current setting with synGetProjectSetting(), then pass its existing locations together with the new ID as storage_location_id. The first ID in the list is the default upload destination.
synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL): Sync this container and all possible sub-folders from Synapse. By default this will download the files that are found and it will populate the files and folders attributes with the found files and folders, along with all other entity types (tables, entityviews, etc.) present in the container. If you only want to retrieve the full tree of metadata about your container specify download_file as FALSE.
This works similar to the Python synapseutils.syncFromSynapse utility function, and generates a manifest.csv file in each synced directory. The manifest uses CSV format with parentId and ID columns, interoperable with the Synapse UI download cart and synDownloadListFiles() output.
Supports syncing Files, Folders, Tables, EntityViews, SubmissionViews, Datasets, DatasetCollections, MaterializedViews, and VirtualTables from Synapse. The metadata for these entity types will be populated in their respective attributes (files, folders, tables, entityviews, submissionviews, datasets, datasetcollections, materializedviews, virtualtables) if they are found within the container.
synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL): Upload files to Synapse using a manifest CSV file.
Accepts manifests produced by synSyncFromSynapse(), synDownloadListFiles(), or the Synapse UI download cart. The manifest must have at minimum a path and parentId column. All other columns that are not part of the standard manifest column set are treated as file annotations.
Standard manifest columns: ID, name, parentId, contentType, path, synapseStore, activityName, activityDescription, forceVersion, used, executed
synUnbindSchema(instance, synapse_client=NULL): Unbind the JSON schema bound to the entity.
synValidateSchema(instance, synapse_client=NULL): Validate the entity against the bound JSON schema.
synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL): Traverse through the hierarchy of entities stored under this container. Mimics os.walk() behavior but yields EntityHeader objects, with optional ASCII tree display that continues printing as the walk progresses.
## Not run: ## Example 1: Creating a folder library(synapser) synLogin() folder = Folder(name = "My Folder", parent_id = "syn123") |> synStore() print(folder$id) ## Example 2: Listing the contents of a folder library(synapser) synLogin() folder = Folder(id = "syn456") |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (file in folder$files) { print(file$name) } ## End(Not run)## Not run: ## Example 1: Creating a folder library(synapser) synLogin() folder = Folder(name = "My Folder", parent_id = "syn123") |> synStore() print(folder$id) ## Example 2: Listing the contents of a folder library(synapser) synLogin() folder = Folder(id = "syn456") |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (file in folder$files) { print(file$name) } ## End(Not run)
A Link entity within Synapse that references another entity.
Represents a Synapse Link.
Link(name=NULL, description=NULL, id=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, parent_id=NULL, target_id=NULL, target_version_number=NULL, links_to_class_name=NULL, activity=NULL, annotations=list(), concrete_type=NULL)Link(name=NULL, description=NULL, id=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, parent_id=NULL, target_id=NULL, target_version_number=NULL, links_to_class_name=NULL, activity=NULL, annotations=list(), concrete_type=NULL)
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
id |
(Optional[str]) The unique immutable ID for this entity. A new ID will be generated for new Entities. Once issued, this ID is guaranteed to never change or be re-issued |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) (Read Only) The date this entity was created. |
modified_on |
(Optional[str]) (Read Only) The date this entity was last modified. |
created_by |
(Optional[str]) (Read Only) The ID of the user that created this entity. |
modified_by |
(Optional[str]) (Read Only) The ID of the user that last modified this entity. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this Entity. |
target_id |
(Optional[str]) The ID of the entity to which this link refers |
target_version_number |
(Optional[int]) The version number of the entity to which this link refers |
links_to_class_name |
(Optional[str]) The synapse Entity's class name that this link points to. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. Activity cannot be removed during a store operation by setting it to NULL. You must use |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the link. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
concrete_type |
(Optional[str]) Indicates which implementation of Entity this object represents. The value is the fully qualified class name, e.g. org.sagebionetworks.repo.model.FileEntity. |
An S3-style class object.
NULL
Link(name=NULL, description=NULL, id=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, parent_id=NULL, target_id=NULL, target_version_number=NULL, links_to_class_name=NULL, activity=NULL, annotations=list(), concrete_type=NULL): Constructor for Link
## Not run: ## Creating a link to another entity library(synapser) synLogin() link = Link(name = "My Link", parent_id = "syn123", target_id = "syn456") |> synStore() print(link$id) # Link to a specific version of the target link = Link( name = "My Versioned Link", parent_id = "syn123", target_id = "syn456", target_version_number = 2L ) |> synStore() ## End(Not run)## Not run: ## Creating a link to another entity library(synapser) synLogin() link = Link(name = "My Link", parent_id = "syn123", target_id = "syn456") |> synStore() print(link$id) # Link to a specific version of the target link = Link( name = "My Versioned Link", parent_id = "syn123", target_id = "syn456", target_version_number = 2L ) |> synStore() ## End(Not run)
Configuration options specific to Link entities when using the factory methods.
This dataclass controls how Link entities are handled during retrieval, particularly whether the link should be followed to return the target entity or if the Link entity itself should be returned.
LinkOptions(follow_link=TRUE)LinkOptions(follow_link=TRUE)
follow_link |
(bool) Whether to follow the link and return the target entity instead of the Link entity itself. If TRUE, the factory method will return the entity that the Link points to (e.g., if a Link points to a File, a File object will be returned). If FALSE, the Link entity itself will be returned, allowing you to inspect the link's properties such as target_id, target_version, etc. Default is TRUE. |
An S3-style class object.
NULL
LinkOptions(follow_link=TRUE): Constructor for LinkOptions
- When follow_link=TRUE, the returned entity type depends on what the Link points to (could be File, Project, Folder, etc.)
- When follow_link=FALSE, a Link entity is always returned
## Not run: # Configure link following behavior: library(synapser) # Follow the link and return the target entity follow_target = LinkOptions(follow_link = TRUE) # Return the Link entity itself return_link = LinkOptions(follow_link = FALSE) ## End(Not run)## Not run: # Configure link following behavior: library(synapser) # Follow the link and return the target entity follow_target = LinkOptions(follow_link = TRUE) # Return the Link entity itself return_link = LinkOptions(follow_link = FALSE) ## End(Not run)
A materialized view is a type of table that is automatically built from a Synapse
SQL query. Its content is read only and based off the defining_sql attribute.
The SQL of the materialized view may contain JOIN clauses on multiple tables.
A MaterializedView object represents this concept in Synapse:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/MaterializedView.html>
MaterializedView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list())MaterializedView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list())
id |
(Optional[str]) The unique immutable ID for this entity. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this entity. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. |
version_number |
(Optional[int]) The version number issued to this version on the object. |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this entity was created. |
modified_on |
(Optional[str]) The date this entity was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format. |
created_by |
(Optional[str]) The ID of the user that created this entity. |
modified_by |
(Optional[str]) The ID of the user that last modified this entity. |
version_label |
(Optional[str]) The version label for this entity. |
version_comment |
(Optional[str]) The version comment for this entity. |
is_latest_version |
(Optional[bool]) If this is the latest version of the object. |
columns |
(Optional[OrderedDict]) (Read Only) The columns of a materialized view are dynamic based on the select statement of the definingSQL. This list of columnIds is for read-only purposes. |
is_search_enabled |
(Optional[bool]) When creating or updating a table or view specifies if full text search should be enabled. |
defining_sql |
(Optional[str]) The synapse SQL statement that defines the data in the materialized view. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the materialized view. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
An S3-style class object.
NULL
MaterializedView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list()): Constructor for MaterializedView
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
<https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
## Not run: ## Example 1: Create a new materialized view with a defining SQL query. library(synapser) synLogin() materialized_view = MaterializedView( name = "My Materialized View", description = "A test materialized view", parent_id = "syn12345", defining_sql = "SELECT * FROM syn67890" ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 2: Update the defining SQL of an existing materialized view. library(synapser) synLogin() materialized_view = MaterializedView(id = "syn12345") |> synGet() |> synSetProperties(defining_sql = "SELECT column1, column2 FROM syn67890") |> synStore() print("Updated Materialized View defining SQL.") ## Example 3: Delete a materialized view. library(synapser) synLogin() MaterializedView(id = "syn12345") |> synDelete() print("Deleted Materialized View.") ## Example 4: Query data from a materialized view. library(synapser) synLogin() query_result = synQuery(query = "SELECT * FROM syn12345") print(query_result) ## Example 5: Retrieve and update annotations for a materialized view. library(synapser) synLogin() materialized_view = MaterializedView(id = "syn12345") |> synGet() materialized_view = materialized_view |> synSetProperties( annotations = append( materialized_view$annotations, list(key1 = "value1", key2 = "value2") ) ) |> synStore() print("Updated annotations for Materialized View.") ## Example 6: Create a materialized view with a JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Join Materialized View", description = "A materialized view with a JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 7: Create a materialized view with a LEFT JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 LEFT JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Left Join Materialized View", description = "A materialized view with a LEFT JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 8: Create a materialized view with a RIGHT JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 RIGHT JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Right Join Materialized View", description = "A materialized view with a RIGHT JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 9: Create a materialized view with a UNION clause. library(synapser) synLogin() defining_sql = " SELECT column1 AS new_column1, column2 AS new_column2 FROM syn12345 UNION SELECT column1 AS new_column1, column2 AS new_column2 FROM syn67890 " materialized_view = MaterializedView( name = "Union Materialized View", description = "A materialized view with a UNION clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## End(Not run)## Not run: ## Example 1: Create a new materialized view with a defining SQL query. library(synapser) synLogin() materialized_view = MaterializedView( name = "My Materialized View", description = "A test materialized view", parent_id = "syn12345", defining_sql = "SELECT * FROM syn67890" ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 2: Update the defining SQL of an existing materialized view. library(synapser) synLogin() materialized_view = MaterializedView(id = "syn12345") |> synGet() |> synSetProperties(defining_sql = "SELECT column1, column2 FROM syn67890") |> synStore() print("Updated Materialized View defining SQL.") ## Example 3: Delete a materialized view. library(synapser) synLogin() MaterializedView(id = "syn12345") |> synDelete() print("Deleted Materialized View.") ## Example 4: Query data from a materialized view. library(synapser) synLogin() query_result = synQuery(query = "SELECT * FROM syn12345") print(query_result) ## Example 5: Retrieve and update annotations for a materialized view. library(synapser) synLogin() materialized_view = MaterializedView(id = "syn12345") |> synGet() materialized_view = materialized_view |> synSetProperties( annotations = append( materialized_view$annotations, list(key1 = "value1", key2 = "value2") ) ) |> synStore() print("Updated annotations for Materialized View.") ## Example 6: Create a materialized view with a JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Join Materialized View", description = "A materialized view with a JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 7: Create a materialized view with a LEFT JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 LEFT JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Left Join Materialized View", description = "A materialized view with a LEFT JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 8: Create a materialized view with a RIGHT JOIN clause. library(synapser) synLogin() defining_sql = " SELECT t1.column1 AS new_column1, t2.column2 AS new_column2 FROM syn12345 t1 RIGHT JOIN syn67890 t2 ON t1.id = t2.foreign_id " materialized_view = MaterializedView( name = "Right Join Materialized View", description = "A materialized view with a RIGHT JOIN clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## Example 9: Create a materialized view with a UNION clause. library(synapser) synLogin() defining_sql = " SELECT column1 AS new_column1, column2 AS new_column2 FROM syn12345 UNION SELECT column1 AS new_column1, column2 AS new_column2 FROM syn67890 " materialized_view = MaterializedView( name = "Union Materialized View", description = "A materialized view with a UNION clause", parent_id = "syn11111", defining_sql = defining_sql ) |> synStore() print(sprintf("Created Materialized View with ID: %s", materialized_view$id)) ## End(Not run)
Represents an Organization.
Organization(name=NULL, id=NULL, created_on=NULL, created_by=NULL)Organization(name=NULL, id=NULL, created_on=NULL, created_by=NULL)
name |
(Optional[character]) The name of the organization |
id |
(Optional[character]) The ID of the organization |
created_on |
(Optional[character]) The date this organization was created |
created_by |
(Optional[character]) The ID of the user that created this organization |
An S3-style class object.
NULL
Organization(name=NULL, id=NULL, created_on=NULL, created_by=NULL): Constructor for Organization
synGetAcl(instance, synapse_client=NULL): Gets the ACL for this organization
synGetJsonSchemas(instance, synapse_client=NULL): Gets the JSON Schemas that are part of this organization
synUpdateAcl(instance, principal_id, access_type, synapse_client=NULL): Updates the ACL for a principal for this organization
## Not run: ## Creating a JSON schema organization library(synapser) synLogin() org = Organization(name = "myUniqueOrgName") |> synStore() print(org$id) # List the JSON schemas in the organization schemas = org |> synGetJsonSchemas() ## End(Not run)## Not run: ## Creating a JSON schema organization library(synapser) synLogin() org = Organization(name = "myUniqueOrgName") |> synStore() print(org$id) # List the JSON schemas in the organization schemas = org |> synGetJsonSchemas() ## End(Not run)
A Project is a top-level container for organizing data in Synapse.
Project(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, alias=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), create_or_update=TRUE, parent_id=NULL)Project(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, alias=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), create_or_update=TRUE, parent_id=NULL)
id |
(Optional[str]) The unique immutable ID for this project. A new ID will be generated for new Projects. Once issued, this ID is guaranteed to never change or be re-issued |
name |
(Optional[str]) The name of this project. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this entity was created. |
modified_on |
(Optional[str]) The date this entity was last modified. |
created_by |
(Optional[str]) The ID of the user that created this entity. |
modified_by |
(Optional[str]) The ID of the user that last modified this entity. |
alias |
(Optional[str]) The project alias for use in friendly project urls. |
files |
(list[File]) Any files that are at the root directory of the project. |
folders |
(list[Folder]) Any folders that are at the root directory of the project. |
tables |
(list[Table]) Any tables that are at the root directory of the project. |
entityviews |
(list[EntityView]) Any entity views that are at the root directory of the project. |
submissionviews |
(list[SubmissionView]) Any submission views that are at the root directory of the project. |
datasets |
(list[Dataset]) Any datasets that are at the root directory of the project. |
datasetcollections |
(list[DatasetCollection]) Any dataset collections that are at the root directory of the project. |
materializedviews |
(list[MaterializedView]) Any materialized views that are at the root directory of the project. |
virtualtables |
(list[VirtualTable]) Any virtual tables that are at the root directory of the project. |
searchindexes |
(list[SearchIndex]) Any search indexes that are at the root directory of the project. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the project. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
create_or_update |
(bool) (Store only) Indicates whether the method should automatically perform an update if the resource conflicts with an existing Synapse object. When TRUE this means that any changes to the resource will be non-destructive. |
parent_id |
(Optional[str]) The parent ID of the project. In practice projects do not have a parent, but this is required for the inner workings of Synapse. |
An S3-style class object.
NULL
Project(id=NULL, name=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, alias=NULL, files=list(), folders=list(), tables=list(), entityviews=list(), submissionviews=list(), datasets=list(), datasetcollections=list(), materializedviews=list(), virtualtables=list(), searchindexes=list(), annotations=list(), create_or_update=TRUE, parent_id=NULL): Constructor for Project
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL): Bind a JSON schema to the entity.
synCopy(instance, destination_id, copy_annotations=TRUE, copy_wiki=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL): You must have already created the Project you will be copying to. It will have
its own Synapse ID and unique name that you will use as the destination_id.
Copy the project to another Synapse project. This will recursively copy all
Tables, Links, Files, and Folders within the project.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synDeleteProjectSetting(instance, setting_id, synapse_client=NULL): Delete a project setting by its setting ID.
synFlattenFileList(instance): Recursively loop over all of the already retrieved files and folders and return
a list of all files in the container.
synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL): Walk a local directory, mirror its folder hierarchy under this
container in Synapse, and write a CSV manifest ready for
synSyncToSynapse().
The manifest has two columns: path (absolute, symlink-resolved) and
parentId (the Synapse ID of the file's containing folder). Existing
Synapse folders with matching names and parents are reused. Directory
symlinks inside directory_path are not followed; file symlinks record
the symlink path and upload the target's contents. Zero-byte files are
skipped with a warning — Synapse rejects empty files. I/O errors during
walk are logged and skipped; an empty source directory produces a
warning and a header-only manifest.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetInvalidValidation(instance, synapse_client=NULL): Get invalid JSON schema validation results for the child entities of a container entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL): Get the project setting for this entity.
synGetSchema(instance, synapse_client=NULL): Get the JSON schema bound to the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL): Retrieve derived JSON schema keys for the entity.
synGetSchemaValidationStatistics(instance, synapse_client=NULL): Get validation statistics for a container entity.
synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL): Get STS (AWS Security Token Service) credentials for direct access to
the storage location backing this entity. These credentials can be used
with AWS tools such as the AWS CLI.
synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL): Index files in this entity for migration to a new storage location.
This is the first step in migrating files to a new storage location.
After indexing, use synMigrateIndexedFiles() to perform the actual migration.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synMapDirectoryToAllContainedFiles(instance, root_path): Recursively loop over all of the already retrieved files and folders. Then
return back a named list where the key is the path to the directory at each
level. The value is a list of all files in that directory AND all files in
the child directories.
This is used during the creation of the manifest TSV file during the
syncFromSynapse utility function.
synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL): Migrate files that have been indexed with synIndexFilesForMigration().
This is the second step in migrating files to a new storage location.
Files must first be indexed using synIndexFilesForMigration().
Interactive confirmation: When called from an interactive shell and
force=FALSE (the default), this function will print the number of items
queued for migration and prompt for confirmation before proceeding. If
standard output is not connected to an interactive terminal (e.g. a script
or CI environment), migration is aborted unless force=TRUE is set.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL): Set the upload storage location for this entity. This configures where
files uploaded to this entity will be stored.
This is a destructive update. The provided storage_location_id value(s)
will replace any storage locations previously configured on this entity.
To add a storage location without removing existing ones, first retrieve the
current setting with synGetProjectSetting(), then pass its existing
locations together with the new ID as storage_location_id.
The first ID in the list is the default upload destination.
synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL): Sync this container and all possible sub-folders from Synapse. By default this
will download the files that are found and it will populate the
files and folders attributes with the found files and folders, along with
all other entity types (tables, entityviews, etc.) present in the container.
If you only want to retrieve the full tree of metadata about your
container specify download_file as FALSE.
This works similarly to the legacy synapseutils.syncFromSynapse utility function,
and generates a manifest.csv file in each synced directory. The manifest uses CSV format
with parentId and ID columns, interoperable with the Synapse UI download
cart and synDownloadListFiles() output.
Supports syncing Files, Folders, Tables, EntityViews, SubmissionViews, Datasets,
DatasetCollections, MaterializedViews, and VirtualTables from Synapse. The
metadata for these entity types will be populated in their respective
attributes (files, folders, tables, entityviews, submissionviews,
datasets, datasetcollections, materializedviews, virtualtables) if
they are found within the container.
synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL): Upload files to Synapse using a manifest CSV file.
Accepts manifests produced by synSyncFromSynapse(),
synDownloadListFiles(), or the Synapse UI download cart.
The manifest must have at minimum a path and parentId column.
All other columns that are not part of the standard manifest column set
are treated as file annotations.
Standard manifest columns:
ID, name, parentId, contentType, path, synapseStore, activityName,
activityDescription, forceVersion, used, executed
synUnbindSchema(instance, synapse_client=NULL): Unbind the JSON schema bound to the entity.
synValidateSchema(instance, synapse_client=NULL): Validate the entity against the bound JSON schema.
synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL): Traverse through the hierarchy of entities stored under this container.
Mimics os.walk() behavior but yields EntityHeader objects, with optional
ASCII tree display that continues printing as the walk progresses.
## Not run: ## Example 1: Creating a project # This example shows how to create a project library(synapser) synLogin() my_annotations = list( my_single_key_string = "a", my_key_string = list("b", "a", "c") ) project = Project( name = "My unique project name", annotations = my_annotations, description = "This is a project with random data." ) project = project |> synStore() project ## Example 2: Storing several files to a project # This example shows how to store several files to a project file_1 = File( path = path_to_file_1, name = name_of_file_1 ) file_2 = File( path = path_to_file_2, name = name_of_file_2 ) project$files = list(file_1, file_2) project = project |> synStore() ## End(Not run)## Not run: ## Example 1: Creating a project # This example shows how to create a project library(synapser) synLogin() my_annotations = list( my_single_key_string = "a", my_key_string = list("b", "a", "c") ) project = Project( name = "My unique project name", annotations = my_annotations, description = "This is a project with random data." ) project = project |> synStore() project ## Example 2: Storing several files to a project # This example shows how to store several files to a project file_1 = File( path = path_to_file_1, name = name_of_file_1 ) file_2 = File( path = path_to_file_2, name = name_of_file_2 ) project$files = list(file_1, file_2) project = project |> synStore() ## End(Not run)
A storage location setting describes where files are uploaded to and downloaded from via Synapse. Storage location settings may be created for external locations, such as user-owned Amazon S3 buckets, Google Cloud Storage buckets, SFTP servers, or proxy storage.
StorageLocation(storage_location_id=NULL, storage_type=NULL, concrete_type=NULL, banner=NULL, description=NULL, bucket=NULL, base_key=NULL, sts_enabled=FALSE, endpoint_url="https://s3.amazonaws.com", url=NULL, supports_subfolders=FALSE, proxy_url=NULL, secret_key=NULL, benefactor_id=NULL, upload_type=NULL, etag=NULL, created_on=NULL, created_by=NULL)StorageLocation(storage_location_id=NULL, storage_type=NULL, concrete_type=NULL, banner=NULL, description=NULL, bucket=NULL, base_key=NULL, sts_enabled=FALSE, endpoint_url="https://s3.amazonaws.com", url=NULL, supports_subfolders=FALSE, proxy_url=NULL, secret_key=NULL, benefactor_id=NULL, upload_type=NULL, etag=NULL, created_on=NULL, created_by=NULL)
storage_location_id |
(Optional[integer]) (Read Only) The unique ID for this storage location, assigned by the server on creation. |
storage_type |
(Optional[StorageLocationType]) The type of storage location, a |
concrete_type |
(Optional[character]) The concrete type of the storage location indicating which implementation this object represents. |
banner |
(Optional[character]) The banner text to display to a user every time a file is uploaded. This field is optional. |
description |
(Optional[character]) A description of the storage location. This description is shown when a user has to choose which upload destination to use. |
bucket |
(Optional[character]) The name of the S3 or Google Cloud Storage bucket. Applicable to |
base_key |
(Optional[character]) The optional base key (prefix/folder) within the bucket. Applicable to |
sts_enabled |
(Optional[logical]) Whether STS (AWS Security Token Service) is enabled on this storage location. Applicable to |
endpoint_url |
(Optional[character]) The endpoint URL of the S3 service. Applicable to |
url |
(Optional[character]) The base URL for uploading to the external destination. Applicable to |
supports_subfolders |
(Optional[logical]) Whether the destination supports creating subfolders under the base url. Applicable to |
proxy_url |
(Optional[character]) The HTTPS URL of the proxy used for upload and download. Applicable to |
secret_key |
(Optional[character]) The encryption key used to sign all pre-signed URLs used to communicate with the proxy. Applicable to |
benefactor_id |
(Optional[character]) An Entity ID (such as a Project ID). When set, any user with the 'create' permission on the given benefactorId will be allowed to create ProxyFileHandle using its storage location ID. Applicable to |
upload_type |
(Optional[UploadType]) (Read Only) The upload type for this storage location. Automatically derived from |
etag |
(Optional[character]) (Read Only) Synapse employs an Optimistic Concurrency Control (OCC) scheme. The E-Tag changes every time the setting is updated. |
created_on |
(Optional[character]) (Read Only) The date this storage location setting was created. |
created_by |
(Optional[integer]) (Read Only) The ID of the user that created this storage location setting. |
An S3-style class object.
NULL
StorageLocation(storage_location_id=NULL, storage_type=NULL, concrete_type=NULL, banner=NULL, description=NULL, bucket=NULL, base_key=NULL, sts_enabled=FALSE, endpoint_url="https://s3.amazonaws.com", url=NULL, supports_subfolders=FALSE, proxy_url=NULL, secret_key=NULL, benefactor_id=NULL, upload_type=NULL, etag=NULL, created_on=NULL, created_by=NULL): Constructor for StorageLocation
## Not run: ## Example 1: Creating an external S3 storage location # Create a storage location backed by your own S3 bucket: library(synapser) synLogin() storage = StorageLocation( storage_type = StorageLocationType( name = "EXTERNAL_S3", concrete_type = "ExternalS3StorageLocationSetting" ), bucket = "my-external-synapse-bucket", base_key = "path/within/bucket" ) |> synStore() print(sprintf("Storage location ID: %s", storage$storage_location_id)) ## Example 2: Creating a Google Cloud storage location # Create a storage location backed by your own GCS bucket: library(synapser) synLogin() storage = StorageLocation( storage_type = StorageLocationType( name = "EXTERNAL_GOOGLE_CLOUD", concrete_type = "ExternalGoogleCloudStorageLocationSetting" ), bucket = "my-gcs-bucket", base_key = "path/within/bucket" ) |> synStore() ## Example 3: Retrieving a storage location by ID # Only the creator of a storage location can retrieve it by its ID. library(synapser) synLogin() storage = StorageLocation(storage_location_id = 12345L) |> synGet() print(sprintf("Type: %s, Bucket: %s", storage$storage_type$name, storage$bucket)) ## End(Not run)## Not run: ## Example 1: Creating an external S3 storage location # Create a storage location backed by your own S3 bucket: library(synapser) synLogin() storage = StorageLocation( storage_type = StorageLocationType( name = "EXTERNAL_S3", concrete_type = "ExternalS3StorageLocationSetting" ), bucket = "my-external-synapse-bucket", base_key = "path/within/bucket" ) |> synStore() print(sprintf("Storage location ID: %s", storage$storage_location_id)) ## Example 2: Creating a Google Cloud storage location # Create a storage location backed by your own GCS bucket: library(synapser) synLogin() storage = StorageLocation( storage_type = StorageLocationType( name = "EXTERNAL_GOOGLE_CLOUD", concrete_type = "ExternalGoogleCloudStorageLocationSetting" ), bucket = "my-gcs-bucket", base_key = "path/within/bucket" ) |> synStore() ## Example 3: Retrieving a storage location by ID # Only the creator of a storage location can retrieve it by its ID. library(synapser) synLogin() storage = StorageLocation(storage_location_id = 12345L) |> synGet() print(sprintf("Type: %s, Bucket: %s", storage$storage_type$name, storage$bucket)) ## End(Not run)
Describes a Synapse storage location type.
Each instance is a distinct object identified by its name, so SFTP and
HTTPS remain separate even though they share the same backend
concreteType (ExternalStorageLocationSetting).
StorageLocationType(name, concrete_type)StorageLocationType(name, concrete_type)
name |
(character) Human-readable identifier (e.g. |
concrete_type |
(character) The |
An S3-style class object.
NULL
A StorageLocationType is identified by both its name and its
concrete_type, so construct it with one of the following pairs:
| name | concrete_type |
"SYNAPSE_S3" |
"S3StorageLocationSetting" |
"EXTERNAL_S3" |
"ExternalS3StorageLocationSetting" |
"EXTERNAL_GOOGLE_CLOUD" |
"ExternalGoogleCloudStorageLocationSetting" |
"EXTERNAL_SFTP" |
"ExternalStorageLocationSetting" |
"EXTERNAL_HTTPS" |
"ExternalStorageLocationSetting" |
"EXTERNAL_OBJECT_STORE" |
"ExternalObjectStorageLocationSetting" |
"PROXY" |
"ProxyStorageLocationSettings"
|
StorageLocationType(name, concrete_type): Constructor for StorageLocationType
## Not run: ## Use a storage location type when creating a storage location library(synapser) synLogin() external_s3 = StorageLocationType( name = "EXTERNAL_S3", concrete_type = "ExternalS3StorageLocationSetting" ) storage = StorageLocation( storage_type = external_s3, bucket = "my-external-synapse-bucket" ) |> synStore() ## End(Not run)## Not run: ## Use a storage location type when creating a storage location library(synapser) synLogin() external_s3 = StorageLocationType( name = "EXTERNAL_S3", concrete_type = "ExternalS3StorageLocationSetting" ) storage = StorageLocation( storage_type = external_s3, bucket = "my-external-synapse-bucket" ) |> synStore() ## End(Not run)
Options for storing container entities (Project, Folder).
StoreContainerOptions(failure_strategy=NULL)StoreContainerOptions(failure_strategy=NULL)
failure_strategy |
(Optional[str]) Strategy for handling failures when storing child entities. One of |
An S3-style class object.
NULL
StoreContainerOptions(failure_strategy=NULL): Constructor for StoreContainerOptions
## Not run: ## Using this class # Stop storing a folder's children as soon as one of them fails library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() folder = folder |> synStore( container_options = StoreContainerOptions(failure_strategy = "RAISE_EXCEPTION") ) ## End(Not run)## Not run: ## Using this class # Stop storing a folder's children as soon as one of them fails library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() folder = folder |> synStore( container_options = StoreContainerOptions(failure_strategy = "RAISE_EXCEPTION") ) ## End(Not run)
Options for storing File entities.
StoreFileOptions(synapse_store=NULL, content_type=NULL, merge_existing_annotations=NULL, associate_activity_to_new_version=NULL)StoreFileOptions(synapse_store=NULL, content_type=NULL, merge_existing_annotations=NULL, associate_activity_to_new_version=NULL)
synapse_store |
(Optional[bool]) Whether to store the file in Synapse or use an external URL. |
content_type |
(Optional[str]) The content type of the file. |
merge_existing_annotations |
(Optional[bool]) If TRUE, merge existing annotations with new ones. If FALSE, replace all annotations. |
associate_activity_to_new_version |
(Optional[bool]) If TRUE, associate activity with new version. If FALSE, do not associate activity. |
An S3-style class object.
NULL
StoreFileOptions(synapse_store=NULL, content_type=NULL, merge_existing_annotations=NULL, associate_activity_to_new_version=NULL): Constructor for StoreFileOptions
## Not run: ## Using this class library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123") file = file |> synStore( file_options = StoreFileOptions( content_type = "text/plain", merge_existing_annotations = TRUE ) ) ## End(Not run)## Not run: ## Using this class library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123") file = file |> synStore( file_options = StoreFileOptions( content_type = "text/plain", merge_existing_annotations = TRUE ) ) ## End(Not run)
Options for storing Grid entities.
StoreGridOptions(attach_to_previous_session=FALSE, timeout=120L)StoreGridOptions(attach_to_previous_session=FALSE, timeout=120L)
attach_to_previous_session |
(bool) If TRUE and using record_set_id, will attach to an existing active session if one exists. |
timeout |
(int) The number of seconds to wait for the job to complete. |
An S3-style class object.
NULL
StoreGridOptions(attach_to_previous_session=FALSE, timeout=120L): Constructor for StoreGridOptions
## Not run: ## Using this class # Pass to synStore() through the grid_options argument when storing a Grid grid_options = StoreGridOptions(attach_to_previous_session = TRUE, timeout = 300L) ## End(Not run)## Not run: ## Using this class # Pass to synStore() through the grid_options argument when storing a Grid grid_options = StoreGridOptions(attach_to_previous_session = TRUE, timeout = 300L) ## End(Not run)
Options for storing JSONSchema entities.
StoreJSONSchemaOptions(schema_body, version=NULL, dry_run=FALSE)StoreJSONSchemaOptions(schema_body, version=NULL, dry_run=FALSE)
schema_body |
(dict) The body of the JSONSchema to store, provided as a named list. |
version |
(Optional[str]) The version of the JSONSchema body to store. |
dry_run |
(bool) Whether or not to do a dry-run. |
An S3-style class object.
NULL
StoreJSONSchemaOptions(schema_body, version=NULL, dry_run=FALSE): Constructor for StoreJSONSchemaOptions
## Not run: ## Using this class library(synapser) synLogin() schema_definition = list( "$id" = "mySchema", type = "object", properties = list(foo = list(type = "string")), required = list("foo") ) schema = JSONSchema(name = "my.schema", organization_name = "myUniqueOrgName") |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = "0.0.1") ) ## End(Not run)## Not run: ## Using this class library(synapser) synLogin() schema_definition = list( "$id" = "mySchema", type = "object", properties = list(foo = list(type = "string")), required = list("foo") ) schema = JSONSchema(name = "my.schema", organization_name = "myUniqueOrgName") |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = "0.0.1") ) ## End(Not run)
Options for storing Table-like entities.
StoreTableOptions(dry_run=FALSE, job_timeout=600L)StoreTableOptions(dry_run=FALSE, job_timeout=600L)
dry_run |
(bool) If TRUE, will not actually store but will log what would be done. |
job_timeout |
(int) Maximum time to wait for table schema update job to complete. |
An S3-style class object.
NULL
StoreTableOptions(dry_run=FALSE, job_timeout=600L): Constructor for StoreTableOptions
## Not run: ## Using this class # Preview a table schema change without applying it library(synapser) synLogin() table = Table(id = "syn123") |> synGet() table |> synAddColumn(Column(name = "new_column", column_type = "STRING")) table |> synStore(table_options = StoreTableOptions(dry_run = TRUE)) ## End(Not run)## Not run: ## Using this class # Preview a table schema change without applying it library(synapser) synLogin() table = Table(id = "syn123") |> synGet() table |> synAddColumn(Column(name = "new_column", column_type = "STRING")) table |> synStore(table_options = StoreTableOptions(dry_run = TRUE)) ## End(Not run)
A Submission object represents a Synapse Submission, which is created when a user
submits an entity to an evaluation queue.
https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/Submission.html
Submission(id=NULL, user_id=NULL, submitter_alias=NULL, entity_id=NULL, version_number=NULL, evaluation_id=NULL, evaluation_round_id=NULL, name=NULL, created_on=NULL, team_id=NULL, contributors=list(), submission_status=NULL, entity_bundle_json=NULL, docker_repository_name=NULL, docker_digest=NULL, docker_tag=NULL, etag=NULL)Submission(id=NULL, user_id=NULL, submitter_alias=NULL, entity_id=NULL, version_number=NULL, evaluation_id=NULL, evaluation_round_id=NULL, name=NULL, created_on=NULL, team_id=NULL, contributors=list(), submission_status=NULL, entity_bundle_json=NULL, docker_repository_name=NULL, docker_digest=NULL, docker_tag=NULL, etag=NULL)
id |
(Optional[character]) The unique ID of this Submission. |
user_id |
(Optional[character]) The ID of the user that submitted this Submission. |
submitter_alias |
(Optional[character]) The name of the user that submitted this Submission. |
entity_id |
(Optional[character]) The ID of the entity being submitted. |
version_number |
(Optional[integer]) The version number of the entity at submission. |
evaluation_id |
(Optional[character]) The ID of the Evaluation to which this Submission belongs. |
evaluation_round_id |
(Optional[character]) The ID of the EvaluationRound to which this was submitted (auto-filled upon creation). |
name |
(Optional[character]) The name of this Submission. |
created_on |
(Optional[character]) The date this Submission was created. |
team_id |
(Optional[character]) The ID of the team that submitted this submission (if it's a team submission). |
contributors |
(list[character]) User IDs of team members who contributed to this submission (if it's a team submission). |
submission_status |
(Optional[named list]) The status of this Submission. |
entity_bundle_json |
(Optional[character]) The bundled entity information at submission. This includes the entity, annotations, file handles, and other metadata. |
docker_repository_name |
(Optional[character]) For Docker repositories, the repository name. |
docker_digest |
(Optional[character]) For Docker repositories, the digest of the submitted Docker image. |
docker_tag |
(Optional[character]) For Docker repositories, the tag of the submitted Docker image. |
etag |
(Optional[character]) The current eTag of the Entity being submitted. If not provided, it will be automatically retrieved. |
An S3-style class object.
NULL
Submission(id=NULL, user_id=NULL, submitter_alias=NULL, entity_id=NULL, version_number=NULL, evaluation_id=NULL, evaluation_round_id=NULL, name=NULL, created_on=NULL, team_id=NULL, contributors=list(), submission_status=NULL, entity_bundle_json=NULL, docker_repository_name=NULL, docker_digest=NULL, docker_tag=NULL, etag=NULL): Constructor for Submission
synCancel(instance, synapse_client=NULL): Cancel a Submission. Only the user who created the Submission may cancel it.
synGetEvaluationSubmissions(cls, evaluation_id, status=NULL, synapse_client=NULL): Retrieves all Submissions for a specified Evaluation queue.
synGetSubmissionCount(evaluation_id, synapse_client=NULL): Gets the number of Submissions for a specified Evaluation queue.
synGetUserSubmissions(cls, evaluation_id, synapse_client=NULL): Retrieves all user Submissions for a specified Evaluation queue.
## Not run: ## Example 1: Create and store a new Submission. library(synapser) synLogin() # Create a new submission submission = Submission( entity_id = "syn123456", evaluation_id = "9999999", name = "My Submission" ) # Store the submission stored_submission = submission |> synStore() print(sprintf("Created submission with ID: %s", stored_submission$id)) ## Example 2: Retrieve a Submission. library(synapser) synLogin() submission = Submission(id = "9999999") |> synGet() print(submission) ## Example 3: Get all submissions for a user. library(synapser) synLogin() # Get submissions for the current user my_submissions = as.list(Submission() |> synGetUserSubmissions( evaluation_id = "9999999" )) print(sprintf("Found %d of my submissions", length(my_submissions))) ## Example 4: Delete a Submission. library(synapser) synLogin() Submission(id = "9999999") |> synDelete() print("Submission deleted successfully") ## End(Not run)## Not run: ## Example 1: Create and store a new Submission. library(synapser) synLogin() # Create a new submission submission = Submission( entity_id = "syn123456", evaluation_id = "9999999", name = "My Submission" ) # Store the submission stored_submission = submission |> synStore() print(sprintf("Created submission with ID: %s", stored_submission$id)) ## Example 2: Retrieve a Submission. library(synapser) synLogin() submission = Submission(id = "9999999") |> synGet() print(submission) ## Example 3: Get all submissions for a user. library(synapser) synLogin() # Get submissions for the current user my_submissions = as.list(Submission() |> synGetUserSubmissions( evaluation_id = "9999999" )) print(sprintf("Found %d of my submissions", length(my_submissions))) ## Example 4: Delete a Submission. library(synapser) synLogin() Submission(id = "9999999") |> synDelete() print("Submission deleted successfully") ## End(Not run)
A SubmissionBundle object represents a bundle containing a Synapse Submission
and its accompanying SubmissionStatus. This bundle provides convenient access to both
the submission data and its current status in a single object.
https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/SubmissionBundle.html
SubmissionBundle(submission=NULL, submission_status=NULL)SubmissionBundle(submission=NULL, submission_status=NULL)
submission |
(Optional[Submission]) A Submission to a Synapse Evaluation is a pointer to a versioned Entity. Submissions are immutable, so we archive a copy of the EntityBundle at the time of submission. |
submission_status |
(Optional[SubmissionStatus]) A SubmissionStatus is a secondary, mutable object associated with a Submission. This object should be used to contain scoring data about the Submission. |
An S3-style class object.
NULL
SubmissionBundle(submission=NULL, submission_status=NULL): Constructor for SubmissionBundle
synGetEvaluationSubmissionBundles(cls, evaluation_id, status=NULL, synapse_client=NULL): Retrieves bundled Submissions and SubmissionStatuses for a given Evaluation.
synGetUserSubmissionBundles(cls, evaluation_id, synapse_client=NULL): Retrieves all user bundled Submissions and SubmissionStatuses for a specified Evaluation.
## Not run: ## Example 1: Retrieve submission bundles for an evaluation. library(synapser) synLogin() # Get all submission bundles for an evaluation bundles = SubmissionBundle() |> synGetEvaluationSubmissionBundles( evaluation_id = "9999999", status = "SCORED" ) for (bundle in as.list(bundles)) { submission_id = if (is.null(bundle$submission)) "N/A" else bundle$submission$id status = if (is.null(bundle$submission_status)) "N/A" else bundle$submission_status$status print(sprintf("Submission ID: %s", submission_id)) print(sprintf("Status: %s", status)) } ## Example 2: Retrieve user submission bundles for an evaluation. library(synapser) synLogin() # Get current user's submission bundles for an evaluation user_bundles = SubmissionBundle() |> synGetUserSubmissionBundles( evaluation_id = "9999999" ) for (bundle in as.list(user_bundles)) { print(sprintf("Submission ID: %s", bundle$submission$id)) print(sprintf("Status: %s", bundle$submission_status$status)) } ## End(Not run)## Not run: ## Example 1: Retrieve submission bundles for an evaluation. library(synapser) synLogin() # Get all submission bundles for an evaluation bundles = SubmissionBundle() |> synGetEvaluationSubmissionBundles( evaluation_id = "9999999", status = "SCORED" ) for (bundle in as.list(bundles)) { submission_id = if (is.null(bundle$submission)) "N/A" else bundle$submission$id status = if (is.null(bundle$submission_status)) "N/A" else bundle$submission_status$status print(sprintf("Submission ID: %s", submission_id)) print(sprintf("Status: %s", status)) } ## Example 2: Retrieve user submission bundles for an evaluation. library(synapser) synLogin() # Get current user's submission bundles for an evaluation user_bundles = SubmissionBundle() |> synGetUserSubmissionBundles( evaluation_id = "9999999" ) for (bundle in as.list(user_bundles)) { print(sprintf("Submission ID: %s", bundle$submission$id)) print(sprintf("Status: %s", bundle$submission_status$status)) } ## End(Not run)
A SubmissionStatus is a secondary, mutable object associated with a Submission. This object should be used to contain scoring data about the Submission. https://rest-docs.synapse.org/rest/org/sagebionetworks/evaluation/model/SubmissionStatus.html
SubmissionStatus(id=NULL, etag=NULL, modified_on=NULL, status=NULL, score=NULL, report=NULL, annotations=list(), submission_annotations=list(), private_status_annotations=TRUE, entity_id=NULL, version_number=NULL, status_version=NULL, can_cancel=FALSE, cancel_requested=FALSE)SubmissionStatus(id=NULL, etag=NULL, modified_on=NULL, status=NULL, score=NULL, report=NULL, annotations=list(), submission_annotations=list(), private_status_annotations=TRUE, entity_id=NULL, version_number=NULL, status_version=NULL, can_cancel=FALSE, cancel_requested=FALSE)
id |
(Optional[character]) The unique, immutable Synapse ID of the Submission. |
etag |
(Optional[character]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. The eTag changes every time a SubmissionStatus is updated; it is used to detect when a client's copy of a SubmissionStatus is out-of-date. |
modified_on |
(Optional[character]) The date on which this SubmissionStatus was last modified. |
status |
(Optional[character]) The possible states of a Synapse Submission (e.g., RECEIVED, VALIDATED, SCORED). |
score |
(Optional[numeric]) This field is deprecated and should not be used. Use the 'submission_annotations' field instead. |
report |
(Optional[character]) This field is deprecated and should not be used. Use the 'submission_annotations' field instead. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Primary container object for Annotations on a Synapse object. These annotations use the legacy format and do not show up in a submission view. The visibility is controlled by private_status_annotations. |
submission_annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Submission Annotations are additional key-value pair metadata that are associated with an object. These annotations use the modern nested format and show up in a submission view. |
private_status_annotations |
(Optional[logical]) Indicates whether the annotations (not to be confused with submission annotations) are private (TRUE) or public (FALSE). Default is TRUE. This controls the visibility of the 'annotations' field. |
entity_id |
(Optional[character]) The Synapse ID of the Entity in this Submission. |
version_number |
(Optional[integer]) The version number of the Entity in this Submission. |
status_version |
(Optional[integer]) A version of the status, auto-generated and auto-incremented by the system and read-only to the client. |
can_cancel |
(Optional[logical]) Can this submission be cancelled? By default, this will be set to FALSE. Users can read this value. Only the queue's scoring application can change this value. |
cancel_requested |
(Optional[logical]) Has user requested to cancel this submission? By default, this will be set to FALSE. Submission owner can read and request to change this value. |
An S3-style class object.
NULL
SubmissionStatus(id=NULL, etag=NULL, modified_on=NULL, status=NULL, score=NULL, report=NULL, annotations=list(), submission_annotations=list(), private_status_annotations=TRUE, entity_id=NULL, version_number=NULL, status_version=NULL, can_cancel=FALSE, cancel_requested=FALSE): Constructor for SubmissionStatus
synBatchUpdateSubmissionStatuses(evaluation_id, statuses, is_first_batch=TRUE, is_last_batch=TRUE, batch_token=NULL, synapse_client=NULL): Update multiple SubmissionStatuses. The maximum batch size is 500.
synGetAllSubmissionStatuses(evaluation_id, status=NULL, limit=10L, offset=0L, synapse_client=NULL): Gets a collection of SubmissionStatuses to a specified Evaluation.
## Not run: ## Example 1: Retrieve and update a SubmissionStatus. # This example demonstrates the basic workflow of retrieving an existing submission status, updating its fields, and storing the changes back to Synapse. library(synapser) synLogin() # Get a submission status status = SubmissionStatus(id = "9999999") |> synGet() # Update the status status$status = "SCORED" status$submission_annotations = list(score = list(85.5), feedback = list("Good work!")) status = status |> synStore() print(status) ## Example 2: Get all submission statuses for an evaluation. # Retrieve multiple submission statuses for an evaluation queue with optional filtering. library(synapser) synLogin() # Get all RECEIVED statuses for an evaluation statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED", limit = 100L ) print(sprintf("Found %d submission statuses", length(statuses))) for (status in statuses) { print(sprintf("Status ID: %s, Status: %s", status$id, status$status)) } ## Example 3: Batch update multiple submission statuses. # Efficiently update multiple submission statuses in a single operation. library(synapser) synLogin() # Retrieve statuses to update statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED" ) # Update each status for (status in statuses) { status$status = "SCORED" status$submission_annotations = list( validation_score = 95.0, comments = "Passed validation" ) } # Batch update all statuses response = synBatchUpdateSubmissionStatuses( evaluation_id = "9999999", statuses = statuses ) print(response) ## End(Not run)## Not run: ## Example 1: Retrieve and update a SubmissionStatus. # This example demonstrates the basic workflow of retrieving an existing submission status, updating its fields, and storing the changes back to Synapse. library(synapser) synLogin() # Get a submission status status = SubmissionStatus(id = "9999999") |> synGet() # Update the status status$status = "SCORED" status$submission_annotations = list(score = list(85.5), feedback = list("Good work!")) status = status |> synStore() print(status) ## Example 2: Get all submission statuses for an evaluation. # Retrieve multiple submission statuses for an evaluation queue with optional filtering. library(synapser) synLogin() # Get all RECEIVED statuses for an evaluation statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED", limit = 100L ) print(sprintf("Found %d submission statuses", length(statuses))) for (status in statuses) { print(sprintf("Status ID: %s, Status: %s", status$id, status$status)) } ## Example 3: Batch update multiple submission statuses. # Efficiently update multiple submission statuses in a single operation. library(synapser) synLogin() # Retrieve statuses to update statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED" ) # Update each status for (status in statuses) { status$status = "SCORED" status$submission_annotations = list( validation_score = 95.0, comments = "Passed validation" ) } # Batch update all statuses response = synBatchUpdateSubmissionStatuses( evaluation_id = "9999999", statuses = statuses ) print(response) ## End(Not run)
A SubmissionView object represents the metadata of a Synapse Submission View.
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/SubmissionView.html>
SubmissionView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="submissionview", view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), annotations=list(), is_search_enabled=NULL, scope_ids=list())SubmissionView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="submissionview", view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), annotations=list(), is_search_enabled=NULL, scope_ids=list())
id |
(Optional[str]) The unique immutable ID for this entity. A new ID will be generated for new Entities. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this Entity. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analogous to the Activity defined in the W3C Specification on Provenance. |
version_number |
(Optional[int]) The version number issued to this version on the object. |
view_entity_type |
(str) The API model string for the type of view. This is used to determine the default columns that are added to the table. Defaults to |
view_type_mask |
(Optional[int]) Bit mask representing the types to include in the view. This is used to determine the default columns that are added to the table. See <https://rest-docs.synapse.org/rest/GET/column/tableview/defaults.html> for the bit mask values. |
include_default_columns |
(Optional[bool]) When creating a submission view, specifies if default columns should be included. Default columns are columns that are automatically added to the view. These columns are managed by Synapse and cannot be modified. If you attempt to create a column with the same name as a default column, you will receive a warning when you store the view. |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this entity was created. |
modified_on |
(Optional[str]) The date this entity was last modified. |
created_by |
(Optional[str]) The ID of the user that created this entity. |
modified_by |
(Optional[str]) The ID of the user that last modified this entity. |
version_label |
(Optional[str]) The version label for this entity. |
version_comment |
(Optional[str]) The version comment for this entity. |
is_latest_version |
(Optional[bool]) If this is the latest version of the object. |
columns |
(Optional[Union[list[Column], OrderedDict[str, Column], dict[str, Column]]]) The columns of this submission view. This is an ordered named list where the key is the name of the column and the value is the Column object. When creating a new instance of a SubmissionView object you may pass any of the following types as the library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet() view$columns[["my_column"]]$column_type = "DOUBLE" view = view |> synStore() Note that the keys in this named list should match the column names as they are in Synapse. However, know that the name attribute of the Column object is used for all interactions with the Synapse API. The named list key is purely for the usage of this interface. For example, if you wish to rename a column you may do so by changing the name attribute of the Column object. The key in the named list does not need to be changed. The next time you store the view the column will be updated in Synapse with the new name and the key in the named list will be updated. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the submission view. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
is_search_enabled |
(Optional[bool]) When creating or updating a table or view, specifies if full-text search should be enabled. Note that enabling full-text search might slow down the indexing of the table or view. |
scope_ids |
(list[str]) The list of container IDs that define the scope of this view. For submission views, this is the list of evaluation queues that the view is associated with. |
An S3-style class object.
NULL
SubmissionView(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, view_entity_type="submissionview", view_type_mask=NULL, include_default_columns=TRUE, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), annotations=list(), is_search_enabled=NULL, scope_ids=list()): Constructor for SubmissionView
synAddColumn(instance, column, index=NULL): Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this SubmissionView instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the SubmissionView
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synDeleteColumn(instance, name): Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this SubmissionView instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synReorderColumn(instance, name, index): Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this SubmissionView instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in
the table. If you pass in an index that is out of bounds the column will be
added to the end of the list.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
<https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL): Creates a snapshot of the SubmissionView entity.
Synapse handles snapshot creation differently for Table- and View-like
entities. View snapshots are created using the asynchronous job API.
Making a snapshot of a view allows you to create an immutable version of the
view at the time of the snapshot. This is useful to create checkpoints in time
that you may go back and reference, or use in a publication. Snapshots are
immutable and cannot be changed. They may only be deleted.
## Not run: ## Create a new SubmissionView. library(synapser) synLogin() my_submission_view = SubmissionView( name = "My Submission View", parent_id = "syn1234", scope_ids = list("syn5678", "syn6789") # IDs of evaluation queues ) |> synStore() my_submission_view ## End(Not run)## Not run: ## Create a new SubmissionView. library(synapser) synLogin() my_submission_view = SubmissionView( name = "My Submission View", parent_id = "syn1234", scope_ids = list("syn5678", "syn6789") # IDs of evaluation queues ) |> synStore() my_submission_view ## End(Not run)
Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this Dataset instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the Dataset
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddColumn(instance, column, index=NULL)synAddColumn(instance, column, index=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
column |
(Column or list of Column) The column(s) to add, may be a single Column object or a list of Column objects. |
index |
(integer) The index to insert the column at. If not passed in the column will be added to the end of the list. |
NULL
## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) dataset |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) dataset |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # dataset and then store the change back in Synapse. If the index is out of # bounds the column will be added to the end of the list. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) dataset |> synStore() ## End(Not run)## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) dataset |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) dataset |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # dataset and then store the change back in Synapse. If the index is out of # bounds the column will be added to the end of the list. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) dataset |> synStore() ## End(Not run)
Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this DatasetCollection instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the DatasetCollection
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddColumn(instance, column, index=NULL)synAddColumn(instance, column, index=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
column |
(Column or list of Column) The column(s) to add, may be a single Column object or a list of Column objects. |
index |
(integer) The index to insert the column at. If not passed in the column will be added to the end of the list. |
NULL
## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) collection |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) collection |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # dataset collection and then store the change back in Synapse. If the index # is out of bounds the column will be added to the end of the list. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) collection |> synStore() ## End(Not run)## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) collection |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) collection |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # dataset collection and then store the change back in Synapse. If the index # is out of bounds the column will be added to the end of the list. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) collection |> synStore() ## End(Not run)
Add column(s) to the EntityView. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this EntityView instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the EntityView
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddColumn(instance, column, index=NULL)synAddColumn(instance, column, index=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
column |
(Column or list of Column) The column(s) to add, may be a single Column object or a list of Column objects. |
index |
(int) The index to insert the column at. If not passed in the column will be added to the end of the list. |
NULL
## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) entityview |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) entityview |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to an EntityView # and then store the change back in Synapse. If the index is out of bounds the # column will be added to the end of the list. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) entityview |> synStore() ## End(Not run)## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) entityview |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn(list( Column(name = "my_column", column_type = "STRING"), Column(name = "my_column2", column_type = "INTEGER") )) entityview |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to an EntityView # and then store the change back in Synapse. If the index is out of bounds the # column will be added to the end of the list. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synAddColumn( Column(name = "my_column", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) entityview |> synStore() ## End(Not run)
Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this SubmissionView instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the SubmissionView
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddColumn(instance, column, index=NULL)synAddColumn(instance, column, index=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
column |
(Column or list of Column) The column(s) to add, may be a single Column object or a list of Column objects. |
index |
(int) The index to insert the column at. If not passed in the column will be added to the end of the list. |
NULL
## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) view |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn(list( Column(name = "my_column2", column_type = "STRING"), Column(name = "my_column3", column_type = "INTEGER") )) view |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # submission view and then store the change back in Synapse. If the index # is out of bounds the column will be added to the end of the list. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn( Column(name = "my_column4", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) view |> synStore() ## End(Not run)## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) view |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn(list( Column(name = "my_column2", column_type = "STRING"), Column(name = "my_column3", column_type = "INTEGER") )) view |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a # submission view and then store the change back in Synapse. If the index # is out of bounds the column will be added to the end of the list. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synAddColumn( Column(name = "my_column4", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) view |> synStore() ## End(Not run)
Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this Table instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the Table
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synAddColumn(instance, column, index=NULL)synAddColumn(instance, column, index=NULL)
instance |
(Table) The Table instance to operate on. |
column |
(Column or list of Column) The column(s) to add, may be a single Column object or a list of Column objects. |
index |
(int) The index to insert the column at. If not passed in the column will be added to the end of the list. |
NULL
## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) table |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn(list( Column(name = "my_column2", column_type = "STRING"), Column(name = "my_column3", column_type = "INTEGER") )) table |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a table # and then store the change back in Synapse. If the index is out of bounds the # column will be added to the end of the list. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn( Column(name = "my_column4", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) table |> synStore() ## End(Not run)## Not run: ## Example 1: Adding a single column # This example shows how you may add a single column to a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn( Column(name = "my_column", column_type = "STRING") ) table |> synStore() ## Example 2: Adding multiple columns # This example shows how you may add multiple columns to a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn(list( Column(name = "my_column2", column_type = "STRING"), Column(name = "my_column3", column_type = "INTEGER") )) table |> synStore() ## Example 3: Adding a column at a specific index # This example shows how you may add a column at a specific index to a table # and then store the change back in Synapse. If the index is out of bounds the # column will be added to the end of the list. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synAddColumn( Column(name = "my_column4", column_type = "STRING"), # Add the column at the beginning of the list index = 0L ) table |> synStore() ## End(Not run)
Adds an item in the form of an EntityRef to the dataset.
For Folders, children are added recursively. Effect is not seen
until the dataset is stored.
synAddItem(instance, item, synapse_client=NULL)synAddItem(instance, item, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
item |
(EntityRef, File, or Folder) Entity to add to the dataset. Must be an |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
Raises an error if the item is not an EntityRef, File, or Folder.
## Not run: ## Example 1: Add a file to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(File(id = "syn1235")) my_dataset |> synStore() ## Example 2: Add a folder to a dataset. # All child files are recursively added to the dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(Folder(id = "syn1236")) my_dataset |> synStore() ## Example 3: Add an entity reference to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## End(Not run)## Not run: ## Example 1: Add a file to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(File(id = "syn1235")) my_dataset |> synStore() ## Example 2: Add a folder to a dataset. # All child files are recursively added to the dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(Folder(id = "syn1236")) my_dataset |> synStore() ## Example 3: Add an entity reference to a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synAddItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## End(Not run)
Adds a dataset to the dataset collection. Effect is not seen until the dataset collection is stored.
synAddItem(instance, item)synAddItem(instance, item)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
item |
(Dataset or EntityRef) Dataset to add to the collection. Must be a Dataset or an |
NULL
Raises an error if the item is not a Dataset or EntityRef.
## Not run: ## Add a Dataset to a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synAddItem(Dataset(id = "syn1235")) my_collection |> synStore() ## End(Not run)## Not run: ## Add a Dataset to a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synAddItem(Dataset(id = "syn1235")) my_collection |> synStore() ## End(Not run)
Update multiple SubmissionStatuses. The maximum batch size is 500.
synBatchUpdateSubmissionStatuses(evaluation_id, statuses, is_first_batch=TRUE, is_last_batch=TRUE, batch_token=NULL, synapse_client=NULL)synBatchUpdateSubmissionStatuses(evaluation_id, statuses, is_first_batch=TRUE, is_last_batch=TRUE, batch_token=NULL, synapse_client=NULL)
evaluation_id |
(character) The ID of the Evaluation to which the SubmissionStatus objects belong. |
statuses |
(list[SubmissionStatus]) List of SubmissionStatus objects to update. |
is_first_batch |
(logical) Whether this is the first batch in the series. Default TRUE. |
is_last_batch |
(logical) Whether this is the last batch in the series. Default TRUE. |
batch_token |
(Optional[character]) Token from previous batch response (required for all but first batch). |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A BatchUploadResponse as a named list containing the batch token and other response information.
## Not run: ## Batch update submission statuses # Update multiple submission statuses in a single batch operation for efficiency. library(synapser) synLogin() # Retrieve existing statuses to update statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED" ) # Modify statuses as needed for (status in statuses) { status$status = "SCORED" } # Update statuses in batch response = synBatchUpdateSubmissionStatuses( evaluation_id = "9999999", statuses = statuses, is_first_batch = TRUE, is_last_batch = TRUE ) print(response) ## End(Not run)## Not run: ## Batch update submission statuses # Update multiple submission statuses in a single batch operation for efficiency. library(synapser) synLogin() # Retrieve existing statuses to update statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "RECEIVED" ) # Modify statuses as needed for (status in statuses) { status$status = "SCORED" } # Update statuses in batch response = synBatchUpdateSubmissionStatuses( evaluation_id = "9999999", statuses = statuses, is_first_batch = TRUE, is_last_batch = TRUE ) print(response) ## End(Not run)
Bind a JSON schema to the entity.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
json_schema_uri |
(str) The URI of the JSON schema to bind to the entity. |
enable_derived_annotations |
(bool) If TRUE, enable derived annotations. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the JSON schema binding.
## Not run: ## Using this function # Binding JSON schema to an EntityView. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to EntityView:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Binding JSON schema to an EntityView. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to EntityView:\n") bound_schema ## End(Not run)
Bind a JSON schema to the entity.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
json_schema_uri |
(str) The URI of the JSON schema to bind to the entity. |
enable_derived_annotations |
(bool) If TRUE, enable derived annotations. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the JSON schema binding.
## Not run: ## Using this function # Binding JSON schema to a folder or a file. This example expects that you # have a Synapse project to use, and a file to upload. Set the PROJECT_NAME # and FILE_PATH variables to your project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to file:\n") bound_schema_file ## End(Not run)## Not run: ## Using this function # Binding JSON schema to a folder or a file. This example expects that you # have a Synapse project to use, and a file to upload. Set the PROJECT_NAME # and FILE_PATH variables to your project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to file:\n") bound_schema_file ## End(Not run)
Bind a JSON schema to the entity.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
json_schema_uri |
(str) The URI of the JSON schema to bind to the entity. |
enable_derived_annotations |
(bool) If TRUE, enable derived annotations. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the JSON schema binding.
## Not run: ## Using this function # Binding JSON schema to a folder or a file. This example expects that you # have a Synapse project to use, and a file to upload. Set the PROJECT_NAME # and FILE_PATH variables to your project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to file:\n") bound_schema_file ## End(Not run)## Not run: ## Using this function # Binding JSON schema to a folder or a file. This example expects that you # have a Synapse project to use, and a file to upload. Set the PROJECT_NAME # and FILE_PATH variables to your project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to file:\n") bound_schema_file ## End(Not run)
Bind a JSON schema to the entity.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
json_schema_uri |
(str) The URI of the JSON schema to bind to the entity. |
enable_derived_annotations |
(bool) If TRUE, enable derived annotations. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the JSON schema binding.
## Not run: ## Using this function # Binding JSON schema to a project. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to project:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Binding JSON schema to a project. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to project:\n") bound_schema ## End(Not run)
Bind a JSON schema to the entity.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
json_schema_uri |
(str) The URI of the JSON schema to bind to the entity. |
enable_derived_annotations |
(bool) If TRUE, enable derived annotations. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the JSON schema binding.
## Not run: ## Using this function # Binding JSON schema to a table. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to table:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Binding JSON schema to a table. This example expects that you # have a Synapse project to use. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Result from binding schema to table:\n") bound_schema ## End(Not run)
Cancel a Submission. Only the user who created the Submission may cancel it.
synCancel(instance, synapse_client=NULL)synCancel(instance, synapse_client=NULL)
instance |
(Submission) The Submission instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The updated Submission object.
Raises an error if the submission does not have an ID to cancel.
## Not run: ## Cancel a submission library(synapser) synLogin() submission = Submission(id = "syn1234") canceled_submission = submission |> synCancel() print(sprintf("Canceled submission: %s", canceled_submission$id)) ## End(Not run)## Not run: ## Cancel a submission library(synapser) synLogin() submission = Submission(id = "syn1234") canceled_submission = submission |> synCancel() print(sprintf("Canceled submission: %s", canceled_submission$id)) ## End(Not run)
Change File Entity metadata for properties that are immutable after creation through the store method.
synChangeMetadata(instance, name=NULL, download_as=NULL, content_type=NULL, synapse_client=NULL)synChangeMetadata(instance, name=NULL, download_as=NULL, content_type=NULL, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
name |
(Optional[str]) Specify to change the filename of a file as seen on Synapse. |
download_as |
(Optional[str]) Specify filename to change the filename of a filehandle. |
content_type |
(Optional[str]) Specify content type to change the content type of a filehandle. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The file object.
An error is raised if the file does not have an ID to change metadata.
## Not run: ## Using this function # Can be used to change the filename, the filename when the file is # downloaded, or the file content-type without downloading: file_entity = File(id = "syn123", download_file = FALSE) |> synGet() cat(basename(file_entity$path), "\n") # prints, e.g., "my_file.txt" file_entity = file_entity |> synChangeMetadata( name = "my_new_name_file.txt", download_as = "my_new_downloadAs_name_file.txt", content_type = "text/plain" ) cat(basename(file_entity$path), "\n") # prints, "my_new_downloadAs_name_file.txt" cat(file_entity$name, "\n") # prints, "my_new_name_file.txt" ## End(Not run)## Not run: ## Using this function # Can be used to change the filename, the filename when the file is # downloaded, or the file content-type without downloading: file_entity = File(id = "syn123", download_file = FALSE) |> synGet() cat(basename(file_entity$path), "\n") # prints, e.g., "my_file.txt" file_entity = file_entity |> synChangeMetadata( name = "my_new_name_file.txt", download_as = "my_new_downloadAs_name_file.txt", content_type = "text/plain" ) cat(basename(file_entity$path), "\n") # prints, "my_new_downloadAs_name_file.txt" cat(file_entity$name, "\n") # prints, "my_new_name_file.txt" ## End(Not run)
Copy the file to another Synapse location. Defaults to the latest version of the file, or the version_number specified in the instance.
synCopy(instance, parent_id, update_existing=FALSE, copy_annotations=TRUE, copy_activity="traceback", synapse_client=NULL)synCopy(instance, parent_id, update_existing=FALSE, copy_annotations=TRUE, copy_activity="traceback", synapse_client=NULL)
instance |
(File) The File instance to operate on. |
parent_id |
(str) Synapse ID of a folder/project that the copied entity is being copied to |
update_existing |
(bool) When the destination has a file that has the same name, users can choose to update that file. |
copy_annotations |
(bool) TRUE to copy the annotations. |
copy_activity |
(Optional[str]) Has three options to set the activity of the copied file: |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The copied file object.
An error is raised if the file does not have an ID and parent_id to copy.
## Not run: ## Using this function # Assuming you have a file with the ID "syn123" and you want to copy it to a # folder with the ID "syn456": new_file_instance = File(id = "syn123") |> synCopy(parent_id = "syn456") # Copy the file but do not persist annotations or activity: new_file_instance = File(id = "syn123") |> synCopy(parent_id = "syn456", copy_annotations = FALSE, copy_activity = NULL) ## End(Not run)## Not run: ## Using this function # Assuming you have a file with the ID "syn123" and you want to copy it to a # folder with the ID "syn456": new_file_instance = File(id = "syn123") |> synCopy(parent_id = "syn456") # Copy the file but do not persist annotations or activity: new_file_instance = File(id = "syn123") |> synCopy(parent_id = "syn456", copy_annotations = FALSE, copy_activity = NULL) ## End(Not run)
Copy the folder to another Synapse location. This will recursively copy all Tables, Links, Files, and Folders within the folder.
synCopy(instance, parent_id, copy_annotations=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL)synCopy(instance, parent_id, copy_annotations=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
parent_id |
(str) Synapse ID of a folder/project that the copied entity is being copied to |
copy_annotations |
(bool) TRUE to copy the annotations. |
exclude_types |
(Optional[list[str]]) A list of entity types list("file", "table", "link") which determines which entity types to not copy. Defaults to an empty list. |
file_update_existing |
(bool) When the destination has a file that has the same name, users can choose to update that file. |
file_copy_activity |
(Optional[str]) Has three options to set the activity of the copied file: |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The copied folder object.
An error is raised if the folder does not have an ID and parent_id to copy.
## Not run: ## Using this function # Assuming you have a folder with the ID "syn123" and you want to copy it to a # project with the ID "syn456": new_folder_instance = Folder(id = "syn123") |> synCopy(parent_id = "syn456") # Copy the folder but do not persist annotations: new_folder_instance = Folder(id = "syn123") |> synCopy(parent_id = "syn456", copy_annotations = FALSE) ## End(Not run)## Not run: ## Using this function # Assuming you have a folder with the ID "syn123" and you want to copy it to a # project with the ID "syn456": new_folder_instance = Folder(id = "syn123") |> synCopy(parent_id = "syn456") # Copy the folder but do not persist annotations: new_folder_instance = Folder(id = "syn123") |> synCopy(parent_id = "syn456", copy_annotations = FALSE) ## End(Not run)
You must have already created the Project you will be copying to. It will have its own Synapse ID and unique name that you will use as the destination_id.
Copy the project to another Synapse project. This will recursively copy all Tables, Links, Files, and Folders within the project.
synCopy(instance, destination_id, copy_annotations=TRUE, copy_wiki=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL)synCopy(instance, destination_id, copy_annotations=TRUE, copy_wiki=TRUE, exclude_types=NULL, file_update_existing=FALSE, file_copy_activity="traceback", synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
destination_id |
(str) Synapse ID of a project to copy to. |
copy_annotations |
(bool) TRUE to copy the annotations. |
copy_wiki |
(bool) TRUE to copy the wiki pages. |
exclude_types |
(Optional[list[str]]) A list of entity types |
file_update_existing |
(bool) When the destination has a file that has the same name, users can choose to update that file. |
file_copy_activity |
(Optional[str]) Has three options to set the activity of the copied file: |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The copied project object.
An error is raised if the project does not have an ID and destination_id to copy.
## Not run: ## Using this function # Assuming you have a project with the ID "syn123" and you want to copy it to a # project with the ID "syn456": library(synapser) synLogin() new_instance = Project(id = "syn123") |> synCopy(destination_id = "syn456") # Copy the project but do not persist annotations: new_instance = Project(id = "syn123") |> synCopy(destination_id = "syn456", copy_annotations = FALSE) ## End(Not run)## Not run: ## Using this function # Assuming you have a project with the ID "syn123" and you want to copy it to a # project with the ID "syn456": library(synapser) synLogin() new_instance = Project(id = "syn123") |> synCopy(destination_id = "syn456") # Copy the project but do not persist annotations: new_instance = Project(id = "syn123") |> synCopy(destination_id = "syn456", copy_annotations = FALSE) ## End(Not run)
Copy the wiki page tree of the owner entity to another entity and update internal links.
If id is set on this WikiPage, only the sub-tree rooted at that wiki page is copied. Otherwise the entire wiki of the owner entity is copied.
synCopy(instance, destination_owner_id, destination_sub_page_id=NULL, update_links=TRUE, entity_map=NULL, synapse_client=NULL)synCopy(instance, destination_owner_id, destination_sub_page_id=NULL, update_links=TRUE, entity_map=NULL, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
destination_owner_id |
(character) The Synapse ID of the entity that the wiki will be copied to. |
destination_sub_page_id |
(Optional[character]) Optional ID of a wiki page that already exists in the destination. The root of the copied tree is written into that page, replacing its title, markdown, and attachments, and the rest of the copied pages are created beneath it. Required when the destination entity already has a root wiki page. |
update_links |
(logical) Update all the internal links so that they point at the copied wiki pages. For example, syn1234/wiki/34345 becomes syn3345/wiki/49508. Defaults to TRUE. |
entity_map |
(Optional[named list]) A mapping of old Synapse IDs to new Synapse IDs, for example |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of WikiHeader objects for the destination entity.
Raises an error if owner_id is not provided or is not a Synapse ID, if destination_owner_id is not a Synapse ID, if a key or value of entity_map is not a Synapse ID, if id is set but no wiki page with that ID exists in the owner entity, if destination_sub_page_id does not exist in the destination entity, if the destination entity already has a root wiki page and destination_sub_page_id is not provided, or if copying an attachment file handle fails.
## Not run: ## Example 1: Copy the entire wiki of an entity to another entity # This example shows how to copy all wiki pages from one project to another. library(synapser) synLogin() new_wiki_headers = WikiPage(owner_id = "syn123") |> synCopy( destination_owner_id = "syn456" ) print(new_wiki_headers) ## Example 2: Copy a wiki sub-tree and update Synapse ID references # This example shows how to copy a specific wiki page and its sub-pages, # rewriting references to syn1234 so they point at syn2345. new_wiki_headers = WikiPage(owner_id = "syn123", id = "34345") |> synCopy( destination_owner_id = "syn456", entity_map = list(syn1234 = "syn2345") ) print(new_wiki_headers) ## End(Not run)## Not run: ## Example 1: Copy the entire wiki of an entity to another entity # This example shows how to copy all wiki pages from one project to another. library(synapser) synLogin() new_wiki_headers = WikiPage(owner_id = "syn123") |> synCopy( destination_owner_id = "syn456" ) print(new_wiki_headers) ## Example 2: Copy a wiki sub-tree and update Synapse ID references # This example shows how to copy a specific wiki page and its sub-pages, # rewriting references to syn1234 so they point at syn2345. new_wiki_headers = WikiPage(owner_id = "syn123", id = "34345") |> synCopy( destination_owner_id = "syn456", entity_map = list(syn1234 = "syn2345") ) print(new_wiki_headers) ## End(Not run)
Creates a new team on Synapse.
synCreate(instance, synapse_client=NULL)synCreate(instance, synapse_client=NULL)
instance |
(Team) The Team instance to operate on. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
Team: The Team object.
## Not run: ## Create a new team library(synapser) synLogin() team = Team( name = "My Uniquely Named Team", description = "A team for my project collaborators", can_public_join = FALSE ) |> synCreate() ## End(Not run)## Not run: ## Create a new team library(synapser) synLogin() team = Team( name = "My Uniquely Named Team", description = "A team for my project collaborators", can_public_join = FALSE ) |> synCreate() ## End(Not run)
Factory method to delete any Synapse entity.
This method serves as a unified interface for deleting any type of Synapse entity. It automatically applies the appropriate delete logic based on the entity type.
Version Deletion Behavior: The function supports deleting specific versions of entities with the following precedence order:
1. version parameter (highest priority): When provided, this version number will be used for deletion, overriding any version information from the entity object or the entity ID string.
2. Entity's version_number attribute (secondary): If the entity object has
a version_number attribute set and no explicit version parameter is
provided, this version will be used.
3. version_only parameter: When set to TRUE, indicates that only a specific
version should be deleted (not the entire entity). This parameter is only
meaningful when combined with a version number from either the version
parameter or the entity's version_number attribute.
Supported for version-specific deletion:
- String ID with version (e.g., "syn123.4")
- File, RecordSet (use version_only=TRUE)
- Table, Dataset, DatasetCollection, EntityView, MaterializedView,
SubmissionView, VirtualTable (use version_only=TRUE)
Not supported for version-specific deletion:
- Project, Folder, Evaluation, Team, Organization, CurationTask, Grid, SearchIndex
synDelete(entity, version=NULL, version_only=FALSE, synapse_client=NULL)synDelete(entity, version=NULL, version_only=FALSE, synapse_client=NULL)
entity |
(Union[str, CurationTask, Dataset, DatasetCollection, EntityView, Evaluation, File, Folder, Grid, JSONSchema, MaterializedView, Project, RecordSet, Organization, SearchIndex, SubmissionView, Table, Team, VirtualTable, DockerRepository]) The entity instance to delete, or a Synapse ID string (e.g., "syn123456" or "syn123456.4" for a specific version). Must be one of the supported entity types or a valid Synapse ID. |
version |
(Optional[Union[str, int]]) Optional version number to delete. Takes precedence over any version information in the entity object or ID string. When provided with |
version_only |
(bool) If TRUE, only the specified version will be deleted, not the entire entity. Requires a version number from either the |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity is not a supported type or not a valid Synapse ID.
- An error is raised if version_only is TRUE but no version number is available.
## Not run: ## Example 1: Deleting a file by object # Delete a file from Synapse: library(synapser) synLogin() file = File(id = "syn123456") file |> synDelete() print("File deleted successfully") ## Example 2: Deleting a specific version of a file # Delete only version 2 of a file, keeping other versions: library(synapser) synLogin() # Method 1: Using version parameter (highest priority) file = File(id = "syn123456") file |> synDelete(version = 2L, version_only = TRUE) # Method 2: Using entity's version_number attribute file = File(id = "syn123456", version_number = 2L) file |> synDelete(version_only = TRUE) # Method 3: Using synapse ID with version synDelete("syn123456.2", version_only = TRUE) print("File version 2 deleted successfully") ## Example 3: Deleting a file by ID string # Delete a file from Synapse using just its ID: library(synapser) synLogin() synDelete("syn123456") print("Entity deleted successfully") ## Example 4: Deleting a project # Delete a project from Synapse: library(synapser) synLogin() project = Project(id = "syn123456") project |> synDelete() print("Project deleted successfully") ## Example 5: Deleting a table # Delete a table from Synapse: library(synapser) synLogin() table = Table(id = "syn123456") table |> synDelete() print("Table deleted successfully") ## Example 6: Deleting a team # Delete a team from Synapse: library(synapser) synLogin() team = Team(id = "123456") team |> synDelete() print("Team deleted successfully") ## End(Not run)## Not run: ## Example 1: Deleting a file by object # Delete a file from Synapse: library(synapser) synLogin() file = File(id = "syn123456") file |> synDelete() print("File deleted successfully") ## Example 2: Deleting a specific version of a file # Delete only version 2 of a file, keeping other versions: library(synapser) synLogin() # Method 1: Using version parameter (highest priority) file = File(id = "syn123456") file |> synDelete(version = 2L, version_only = TRUE) # Method 2: Using entity's version_number attribute file = File(id = "syn123456", version_number = 2L) file |> synDelete(version_only = TRUE) # Method 3: Using synapse ID with version synDelete("syn123456.2", version_only = TRUE) print("File version 2 deleted successfully") ## Example 3: Deleting a file by ID string # Delete a file from Synapse using just its ID: library(synapser) synLogin() synDelete("syn123456") print("Entity deleted successfully") ## Example 4: Deleting a project # Delete a project from Synapse: library(synapser) synLogin() project = Project(id = "syn123456") project |> synDelete() print("Project deleted successfully") ## Example 5: Deleting a table # Delete a table from Synapse: library(synapser) synLogin() table = Table(id = "syn123456") table |> synDelete() print("Table deleted successfully") ## Example 6: Deleting a team # Delete a team from Synapse: library(synapser) synLogin() team = Team(id = "123456") team |> synDelete() print("Team deleted successfully") ## End(Not run)
Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this Dataset instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeleteColumn(instance, name)synDeleteColumn(instance, name)
instance |
(Dataset) The Dataset instance to operate on. |
name |
(character) The name of the column to delete. |
NULL
## Not run: ## Deleting a column # This example shows how you may delete a column from a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synDeleteColumn(name = "my_column") dataset |> synStore() ## End(Not run)## Not run: ## Deleting a column # This example shows how you may delete a column from a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) dataset |> synDeleteColumn(name = "my_column") dataset |> synStore() ## End(Not run)
Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this DatasetCollection instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeleteColumn(instance, name)synDeleteColumn(instance, name)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
name |
(character) The name of the column to delete. |
NULL
## Not run: ## Deleting a column # This example shows how you may delete a column from a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synDeleteColumn(name = "my_column") collection |> synStore() ## End(Not run)## Not run: ## Deleting a column # This example shows how you may delete a column from a dataset collection # and then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) collection |> synDeleteColumn(name = "my_column") collection |> synStore() ## End(Not run)
Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this EntityView instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeleteColumn(instance, name)synDeleteColumn(instance, name)
instance |
(EntityView) The EntityView instance to operate on. |
name |
(str) The name of the column to delete. |
NULL
## Not run: ## Deleting a column # This example shows how you may delete a column from an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synDeleteColumn(name = "my_column") entityview |> synStore() ## End(Not run)## Not run: ## Deleting a column # This example shows how you may delete a column from an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) entityview |> synDeleteColumn(name = "my_column") entityview |> synStore() ## End(Not run)
Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this SubmissionView instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeleteColumn(instance, name)synDeleteColumn(instance, name)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
name |
(str) The name of the column to delete. |
NULL
## Not run: ## Deleting a column # This example shows how you may delete a column from a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synDeleteColumn(name = "my_column") view |> synStore() ## End(Not run)## Not run: ## Deleting a column # This example shows how you may delete a column from a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) view |> synDeleteColumn(name = "my_column") view |> synStore() ## End(Not run)
Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this Table instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeleteColumn(instance, name)synDeleteColumn(instance, name)
instance |
(Table) The Table instance to operate on. |
name |
(str) The name of the column to delete. |
NULL
## Not run: ## Deleting a column # This example shows how you may delete a column from a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synDeleteColumn(name = "my_column") table |> synStore() ## End(Not run)## Not run: ## Deleting a column # This example shows how you may delete a column from a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) table |> synDeleteColumn(name = "my_column") table |> synStore() ## End(Not run)
Deletes an open invitation to a team. Note: The client must be an administrator of the Team referenced by the invitation, or the invitee, to make this request.
synDeleteInvitation(invitation_id, synapse_client=NULL)synDeleteInvitation(invitation_id, synapse_client=NULL)
invitation_id |
(character) The ID of the invitation to delete. This can be found on the invitations returned by |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Delete an open invitation to a team # Cancel a pending invitation to a team. library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) open_invitations = team |> synGetOpenInvitations() if (length(open_invitations) == 0) { print("No open invitations to delete.") } else { # Delete the first open invitation synDeleteInvitation(invitation_id = open_invitations[[1]][["id"]]) } ## End(Not run)## Not run: ## Delete an open invitation to a team # Cancel a pending invitation to a team. library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) open_invitations = team |> synGetOpenInvitations() if (length(open_invitations) == 0) { print("No open invitations to delete.") } else { # Delete the first open invitation synDeleteInvitation(invitation_id = open_invitations[[1]][["id"]]) } ## End(Not run)
Delete the entire Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permissions are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
include_self |
(logical) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(logical) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(logical) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[character]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(logical) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(logical) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(logical) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Dataset(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Dataset(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
include_self |
(logical) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(logical) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(logical) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[character]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(logical) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(logical) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(logical) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() DatasetCollection(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() DatasetCollection(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() EntityView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() EntityView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() File(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() File(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Folder(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Folder(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(MaterializedView) The MaterializedView instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() MaterializedView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() MaterializedView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Project(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Project(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() SubmissionView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() SubmissionView(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Table(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() Table(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself and not files within its subfolder Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete the entire local Access Control List (ACL) for a given Entity. This is not scoped to a specific user or group, but rather removes all permissions associated with the Entity. After this operation, the Entity will inherit permissions from its benefactor, which is typically its parent entity or the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from their containing Project. For such Entities the Project is the Entity's 'benefactor'. This permission inheritance can be overridden by creating an ACL for the Entity. When this occurs the Entity becomes its own benefactor and all permission are determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you must individually update or revoke the permissions for each user or group.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL)
instance |
(VirtualTable) The VirtualTable instance to operate on. |
include_self |
(bool) If TRUE (default), delete the ACL of the current entity. If FALSE, skip deleting the ACL of the current entity. |
include_container_content |
(bool) If TRUE, delete ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when deleting ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). This does not affect the entity type of the current entity, which is always processed if |
dry_run |
(bool) If TRUE, log the changes that would be made instead of actually performing the deletions. When enabled, all ACL deletion operations are simulated and logged at info level. Defaults to FALSE. |
show_acl_details |
(bool) When dry_run=TRUE, controls whether current ACL details are displayed for entities that will have their permissions changed. If TRUE (default), shows detailed ACL information. If FALSE, hides ACL details for cleaner output. Has no effect when dry_run=FALSE. |
show_files_in_containers |
(bool) When dry_run=TRUE, controls whether files within containers are displayed in the preview. If TRUE (default), shows all files. If FALSE, hides files when their only change is benefactor inheritance (but still shows files with local ACLs being deleted). Has no effect when dry_run=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues or if the entity already inherits permissions.
- An error may also be raised for any other issues that occur during the process.
The caller must be granted CHANGE_PERMISSIONS access on the Entity to call this method.
## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() VirtualTable(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)## Not run: ## Example 1: Delete permissions for a single entity library(synapser) synLogin() VirtualTable(id = "syn123") |> synDeletePermissions() ## Example 2: Delete permissions recursively for a folder and all its children library(synapser) synLogin() # Delete permissions for this folder only (does not affect children) Folder(id = "syn123") |> synDeletePermissions() # Delete permissions for all files and folders directly within this folder, # but not the folder itself Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, include_container_content = TRUE ) # Delete permissions for all items in the entire hierarchy (folders and their files) # Both recursive and include_container_content must be TRUE Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE ) # Delete permissions only for folder entities within this folder recursively # and their contents Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # Delete permissions only for files within this folder and all subfolders Folder(id = "syn123") |> synDeletePermissions( include_self = FALSE, recursive = TRUE, include_container_content = TRUE, target_entity_types = list("file") ) # Delete permissions for specific entity types (e.g., tables and views) Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) # Dry run example: Log what would be deleted without making changes Folder(id = "syn123") |> synDeletePermissions( recursive = TRUE, include_container_content = TRUE, dry_run = TRUE ) ## End(Not run)
Delete a project setting by its setting ID.
synDeleteProjectSetting(instance, setting_id, synapse_client=NULL)synDeleteProjectSetting(instance, setting_id, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
setting_id |
(character) The ID of the project setting to delete. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
Raises an error if the entity does not have an id set.
## Not run: ## Using this function # Delete the upload settings for a folder: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { folder |> synDeleteProjectSetting(setting_id = setting$id) } ## End(Not run)## Not run: ## Using this function # Delete the upload settings for a folder: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { folder |> synDeleteProjectSetting(setting_id = setting$id) } ## End(Not run)
Delete a project setting by its setting ID.
synDeleteProjectSetting(instance, setting_id, synapse_client=NULL)synDeleteProjectSetting(instance, setting_id, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
setting_id |
(character) The ID of the project setting to delete. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
Raises an error if the entity does not have an id set.
## Not run: ## Using this function # Delete the upload settings for a project: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { project |> synDeleteProjectSetting(setting_id = setting$id) } ## End(Not run)## Not run: ## Using this function # Delete the upload settings for a project: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { project |> synDeleteProjectSetting(setting_id = setting$id) } ## End(Not run)
Delete rows from a table given a query or a data frame to select rows.
The query at a minimum must select the ROW_ID and ROW_VERSION columns. If you want to
inspect the data that will be deleted ahead of time you may use the
synQuery() function to get the data.
The data frame must at least contain the ROW_ID and ROW_VERSION columns. And ROW_ETAG column is also required
if the entity is one of the following: EntityView, Dataset, DatasetCollection, or SubmissionView.
If both query and df are provided, the query will be used.
synDeleteRows(instance, query=NULL, df=NULL, job_timeout=600L, synapse_client=NULL)synDeleteRows(instance, query=NULL, df=NULL, job_timeout=600L, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
query |
(Optional[str]) The query to select the rows to delete. The query at a minimum must select the |
df |
(Optional[data.frame]) A data frame that contains the rows to delete. The data frame must at least contain the |
job_timeout |
(int) The amount of time to wait for table updates to complete before a timeout error is thrown. The default is 600 seconds. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of your query or data frame for the rows that were deleted from the table.
## Not run: ## Example 1: Selecting a row to delete # This example shows how you may select a row to delete from a table. library(synapser) synLogin() # Also works with Dataset Table(id = "syn1234") |> synDeleteRows(query = "SELECT ROW_ID, ROW_VERSION FROM syn1234 WHERE foo = 'asdf'") ## Example 2: Selecting all rows that contain a null value # This example shows how you may select a row to delete from a table where # a column has a null value. library(synapser) synLogin() # Also works with Dataset Table(id = "syn1234") |> synDeleteRows(query = "SELECT ROW_ID, ROW_VERSION FROM syn1234 WHERE foo is null") ## Example 3: Selecting rows to delete using a data frame # This example shows how you may select a row to delete from a table based on a data frame. library(synapser) synLogin() # Creating a data frame that contains the rows to delete. # In this example, we create a data frame that specifies the first two rows of the table for deletion. # Assuming no changes have been made to the table so the ROW_VERSION is 1L. df = data.frame(ROW_ID = c(1L, 2L), ROW_VERSION = c(1L, 1L )) Table(id = "syn1234") |> synDeleteRows(df = df) ## End(Not run)## Not run: ## Example 1: Selecting a row to delete # This example shows how you may select a row to delete from a table. library(synapser) synLogin() # Also works with Dataset Table(id = "syn1234") |> synDeleteRows(query = "SELECT ROW_ID, ROW_VERSION FROM syn1234 WHERE foo = 'asdf'") ## Example 2: Selecting all rows that contain a null value # This example shows how you may select a row to delete from a table where # a column has a null value. library(synapser) synLogin() # Also works with Dataset Table(id = "syn1234") |> synDeleteRows(query = "SELECT ROW_ID, ROW_VERSION FROM syn1234 WHERE foo is null") ## Example 3: Selecting rows to delete using a data frame # This example shows how you may select a row to delete from a table based on a data frame. library(synapser) synLogin() # Creating a data frame that contains the rows to delete. # In this example, we create a data frame that specifies the first two rows of the table for deletion. # Assuming no changes have been made to the table so the ROW_VERSION is 1L. df = data.frame(ROW_ID = c(1L, 2L), ROW_VERSION = c(1L, 1L )) Table(id = "syn1234") |> synDeleteRows(df = df) ## End(Not run)
Disassociate the Activity from the parent entity. This is the first step in deleting the Activity. If you have other entities that are associated with this Activity you must disassociate them by calling this method on them as well.
synDisassociateActivityFromEntity(cls, parent, synapse_client=NULL)synDisassociateActivityFromEntity(cls, parent, synapse_client=NULL)
cls |
(Activity) The Activity class (or an existing Activity instance) to dispatch this call to. |
parent |
(Union[Table, File, str]) The parent entity this activity is associated with. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
An error is raised if the parent does not have an ID.
## Not run: ## Using this function # Remove the Activity from the entity it is associated with. The Activity # itself is deleted once it is no longer associated with any entity. library(synapser) synLogin() Activity() |> synDisassociateActivityFromEntity(parent = "syn123") ## End(Not run)## Not run: ## Using this function # Remove the Activity from the entity it is associated with. The Activity # itself is deleted once it is no longer associated with any entity. library(synapser) synLogin() Activity() |> synDisassociateActivityFromEntity(parent = "syn123") ## End(Not run)
Add files to the Synapse download list.
If a file is added with no version specified, the latest version will be downloaded.
synDownloadListAdd(files, synapse_client=NULL)synDownloadListAdd(files, synapse_client=NULL)
files |
(list[DownloadListItem]) List of |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The number of files added.
## Not run: ## Add files to the download list # Add specific file versions to the cart. library(synapser) synLogin() count = synDownloadListAdd(list( DownloadListItem(file_entity_id = "syn123", version_number = 1L), DownloadListItem(file_entity_id = "syn456", version_number = 2L) )) ## End(Not run)## Not run: ## Add files to the download list # Add specific file versions to the cart. library(synapser) synLogin() count = synDownloadListAdd(list( DownloadListItem(file_entity_id = "syn123", version_number = 1L), DownloadListItem(file_entity_id = "syn456", version_number = 2L) )) ## End(Not run)
Clear all files from the Synapse download list (cart).
synDownloadListClear(synapse_client=NULL)synDownloadListClear(synapse_client=NULL)
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Clear the download list # Remove all files from the cart. library(synapser) synLogin() synDownloadListClear() ## End(Not run)## Not run: ## Clear the download list # Remove all files from the cart. library(synapser) synLogin() synDownloadListClear() ## End(Not run)
Download all files in the Synapse download list (cart) to a local directory.
Files are downloaded individually. The cart is not packaged into a zip because download lists can exceed 100 GB. Only successfully downloaded files are removed from the cart after the full pass completes, so interrupted runs are safely resumable.
Files that cannot be accessed or fail to download are left in the cart and recorded with an error value in the result manifest.
synDownloadListFiles(download_location=NULL, parallel=FALSE, max_concurrent=10L, synapse_client=NULL)synDownloadListFiles(download_location=NULL, parallel=FALSE, max_concurrent=10L, synapse_client=NULL)
download_location |
(Optional[character]) Directory to download files to. Defaults to the current working directory. |
parallel |
(logical) If TRUE, files are downloaded concurrently, up to max_concurrent at a time. If FALSE (default), files are downloaded sequentially. |
max_concurrent |
(integer) Maximum number of files to download concurrently when parallel=TRUE. Defaults to 10. Has no effect when parallel=FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
Path to the result manifest CSV, which contains all original manifest columns plus path (local file path) and error (error message or empty string) columns.
- An error is raised if the manifest async job fails or the cart is empty
("No files available for download").
- An error is also raised if the manifest job completes but produces no local file,
or if the downloaded CSV has no headers or contains reserved column
names ("path" or "error").
## Not run: ## Download all files in the cart # Download all files in the user's download list to a local directory. library(synapser) synLogin() manifest_path = synDownloadListFiles(download_location = "./data") ## End(Not run)## Not run: ## Download all files in the cart # Download all files in the user's download list to a local directory. library(synapser) synLogin() manifest_path = synDownloadListFiles(download_location = "./data") ## End(Not run)
Generate and download the manifest CSV for the current cart contents.
Submits an async job to Synapse to generate the manifest, then downloads the resulting CSV. The manifest contains the same columns as the zip manifest downloaded from the Synapse web UI.
synDownloadListManifest(csv_table_descriptor=NULL, destination=".", synapse_client=NULL)synDownloadListManifest(csv_table_descriptor=NULL, destination=".", synapse_client=NULL)
csv_table_descriptor |
(Optional[CsvTableDescriptor]) Optional CsvTableDescriptor controlling the format of the generated CSV (separator, quote character, escape character, line ending, and whether the first line is a header). When omitted the Synapse defaults are used. |
destination |
(character) Directory to download the manifest CSV to. Defaults to the current working directory. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
Path to the downloaded manifest CSV.
Raises an error if the async job completes without producing a manifest.
## Not run: ## Get the download list manifest # Inspect the cart contents before downloading. library(synapser) synLogin() manifest_path = synDownloadListManifest() ## End(Not run)## Not run: ## Get the download list manifest # Inspect the cart contents before downloading. library(synapser) synLogin() manifest_path = synDownloadListManifest() ## End(Not run)
Remove files from the Synapse download list.
If a file was added with a version specified, then that version must be specified to remove it. If a file was added with no version specified, then no version must be specified to remove it.
synDownloadListRemove(files, synapse_client=NULL)synDownloadListRemove(files, synapse_client=NULL)
files |
(list[DownloadListItem]) List of |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The number of files removed.
## Not run: ## Remove files from the download list # Remove specific file versions from the cart. library(synapser) synLogin() count = synDownloadListRemove(list( DownloadListItem(file_entity_id = "syn123", version_number = 1L) )) ## End(Not run)## Not run: ## Remove files from the download list # Remove specific file versions from the cart. library(synapser) synLogin() count = synDownloadListRemove(list( DownloadListItem(file_entity_id = "syn123", version_number = 1L) )) ## End(Not run)
Find an Entity given its name and parent.
synFindEntityId(name, parent=NULL, synapse_client=NULL)synFindEntityId(name, parent=NULL, synapse_client=NULL)
name |
(str) Name of the entity to find. |
parent |
(Optional[Union[str, Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable]]) An Entity object (Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable) or the Id of an entity as a string. Omit if searching for a Project by name. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The Entity ID or NULL if not found.
## Not run: ## Example 1: Finding a project by name # Find a project using only its name: library(synapser) synLogin() project_id = synFindEntityId(name = "My Project") if (!is.null(project_id)) { print(sprintf("Found project: %s", project_id)) } else { print("Project not found") } ## Example 2: Finding an entity within a parent # Find a file within a specific folder: library(synapser) synLogin() file_id = synFindEntityId( name = "my_data.csv", parent = "syn123456" # Parent folder ID ) if (!is.null(file_id)) { print(sprintf("Found file: %s", file_id)) } else { print("File not found in folder") } ## Example 3: Using with entity objects # Find an entity using an entity object as the parent: library(synapser) synLogin() parent_folder = Folder(id = "syn123456") entity_id = synFindEntityId( name = "analysis_results.txt", parent = parent_folder ) print(sprintf("Entity ID: %s", entity_id)) ## End(Not run)## Not run: ## Example 1: Finding a project by name # Find a project using only its name: library(synapser) synLogin() project_id = synFindEntityId(name = "My Project") if (!is.null(project_id)) { print(sprintf("Found project: %s", project_id)) } else { print("Project not found") } ## Example 2: Finding an entity within a parent # Find a file within a specific folder: library(synapser) synLogin() file_id = synFindEntityId( name = "my_data.csv", parent = "syn123456" # Parent folder ID ) if (!is.null(file_id)) { print(sprintf("Found file: %s", file_id)) } else { print("File not found in folder") } ## Example 3: Using with entity objects # Find an entity using an entity object as the parent: library(synapser) synLogin() parent_folder = Folder(id = "syn123456") entity_id = synFindEntityId( name = "analysis_results.txt", parent = parent_folder ) print(sprintf("Entity ID: %s", entity_id)) ## End(Not run)
Recursively loop over all of the already retrieved files and folders and return a list of all files in the container.
synFlattenFileList(instance)synFlattenFileList(instance)
instance |
(Folder) The Folder instance to operate on. |
A list of all files in the container.
## Not run: ## Using this function # synFlattenFileList only looks at files and folders that have already been # retrieved, so sync the folder from Synapse first. library(synapser) synLogin() my_folder = Folder(id = "syn123") |> synSyncFromSynapse(download_file = FALSE) all_files = my_folder |> synFlattenFileList() for (file in all_files) { print(sprintf("%s (%s)", file$name, file$id)) } ## End(Not run)## Not run: ## Using this function # synFlattenFileList only looks at files and folders that have already been # retrieved, so sync the folder from Synapse first. library(synapser) synLogin() my_folder = Folder(id = "syn123") |> synSyncFromSynapse(download_file = FALSE) all_files = my_folder |> synFlattenFileList() for (file in all_files) { print(sprintf("%s (%s)", file$name, file$id)) } ## End(Not run)
Recursively loop over all of the already retrieved files and folders and return a list of all files in the container.
synFlattenFileList(instance)synFlattenFileList(instance)
instance |
(Project) The Project instance to operate on. |
A list of all files in the container.
## Not run: ## Using this function # synFlattenFileList only looks at files and folders that have already been # retrieved, so sync the project from Synapse first. library(synapser) synLogin() my_project = Project(id = "syn123") |> synSyncFromSynapse(download_file = FALSE) all_files = my_project |> synFlattenFileList() for (file in all_files) { print(sprintf("%s (%s)", file$name, file$id)) } ## End(Not run)## Not run: ## Using this function # synFlattenFileList only looks at files and folders that have already been # retrieved, so sync the project from Synapse first. library(synapser) synLogin() my_project = Project(id = "syn123") |> synSyncFromSynapse(download_file = FALSE) all_files = my_project |> synFlattenFileList() for (file in all_files) { print(sprintf("%s (%s)", file$name, file$id)) } ## End(Not run)
Walk a local directory, mirror its folder hierarchy under this
container in Synapse, and write a CSV manifest ready for
synSyncToSynapse().
The manifest has two columns: path (absolute, symlink-resolved) and parentId (the Synapse ID of the file's containing folder). Existing Synapse folders with matching names and parents are reused. Directory symlinks inside directory_path are not followed; file symlinks record the symlink path and upload the target's contents. Zero-byte files are skipped with a warning — Synapse rejects empty files. I/O errors during walk are logged and skipped; an empty source directory produces a warning and a header-only manifest.
synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL)synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
directory_path |
(character) Path to the local directory to be pushed to Synapse. |
manifest_path |
(character) Path where the generated manifest CSV will be written. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if this container's id is NULL, or if directory_path
does not exist or is not a directory, or if this container's
id exists in Synapse but is not a Folder or Project.
- An error is also raised if this container's id does not exist in
Synapse.
## Not run: ## Generate a manifest and upload the files # Mirror ./my_data under a Synapse folder and then upload it. library(synapser) synLogin() folder = Folder(id = "syn12345") folder |> synGenerateSyncManifest( directory_path = "./my_data", manifest_path = "manifest.csv" ) folder |> synSyncToSynapse(manifest_path = "manifest.csv") ## End(Not run)## Not run: ## Generate a manifest and upload the files # Mirror ./my_data under a Synapse folder and then upload it. library(synapser) synLogin() folder = Folder(id = "syn12345") folder |> synGenerateSyncManifest( directory_path = "./my_data", manifest_path = "manifest.csv" ) folder |> synSyncToSynapse(manifest_path = "manifest.csv") ## End(Not run)
Walk a local directory, mirror its folder hierarchy under this
container in Synapse, and write a CSV manifest ready for
synSyncToSynapse().
The manifest has two columns: path (absolute, symlink-resolved) and parentId (the Synapse ID of the file's containing folder). Existing Synapse folders with matching names and parents are reused. Directory symlinks inside directory_path are not followed; file symlinks record the symlink path and upload the target's contents. Zero-byte files are skipped with a warning — Synapse rejects empty files. I/O errors during walk are logged and skipped; an empty source directory produces a warning and a header-only manifest.
synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL)synGenerateSyncManifest(instance, directory_path, manifest_path, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
directory_path |
(character) Path to the local directory to be pushed to Synapse. |
manifest_path |
(character) Path where the generated manifest CSV will be written. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
- An error is raised if this container's id is NULL, or if directory_path
does not exist or is not a directory, or if this container's
id exists in Synapse but is not a Folder or Project.
- An error is also raised if this container's id does not exist in
Synapse.
## Not run: ## Generate a manifest and upload the files # Mirror ./my_data under a Synapse project and then upload it. library(synapser) synLogin() project = Project(id = "syn12345") project |> synGenerateSyncManifest( directory_path = "./my_data", manifest_path = "manifest.csv" ) project |> synSyncToSynapse(manifest_path = "manifest.csv") ## End(Not run)## Not run: ## Generate a manifest and upload the files # Mirror ./my_data under a Synapse project and then upload it. library(synapser) synLogin() project = Project(id = "syn12345") project |> synGenerateSyncManifest( directory_path = "./my_data", manifest_path = "manifest.csv" ) project |> synSyncToSynapse(manifest_path = "manifest.csv") ## End(Not run)
Factory method to retrieve any Synapse entity by its ID or by name and parent ID.
This method serves as a unified interface for retrieving any type of Synapse entity without needing to know the specific entity type beforehand. It automatically determines the entity type and returns the appropriate model instance.
You can retrieve entities in two ways:
1. By providing a synapse_id directly
2. By providing entity_name and optionally parent_id for lookup
synGet(synapse_id=NULL, entity_name=NULL, parent_id=NULL, version_number=NULL, activity_options=NULL, file_options=NULL, table_options=NULL, link_options=NULL, synapse_client=NULL)synGet(synapse_id=NULL, entity_name=NULL, parent_id=NULL, version_number=NULL, activity_options=NULL, file_options=NULL, table_options=NULL, link_options=NULL, synapse_client=NULL)
synapse_id |
(Optional[str]) The Synapse ID of the entity to retrieve (e.g., 'syn123456'). Mutually exclusive with entity_name. |
entity_name |
(Optional[str]) The name of the entity to find. Must be used with this approach instead of synapse_id. When looking up projects, parent_id should be NULL. |
parent_id |
(Optional[str]) The parent entity ID when looking up by name. Set to NULL when looking up projects by name. Only used with entity_name. |
version_number |
(Optional[int]) The specific version number of the entity to retrieve. Only applies to versionable entities (File, Table, Dataset). If not specified, the most recent version will be retrieved. Ignored for other entity types. |
activity_options |
(Optional[ActivityOptions]) |
file_options |
(Optional[FileOptions]) |
table_options |
(Optional[TableOptions]) |
link_options |
(Optional[LinkOptions]) |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The appropriate Synapse entity model instance based on the entity type.
- An error is raised if both synapse_id and entity_name are provided, or if neither is provided.
- An error is raised if entity_name is provided without this being a valid lookup scenario.
- An error is raised if the synapse_id is not a valid Synapse ID format.
When using entity_name lookup:
- For projects: leave parent_id = NULL.
- For all other entities: provide the parent_id of the containing folder/project.
## Not run: ## Example 1: Retrieving entities by ID # Get any entity by Synapse ID: library(synapser) synLogin() # Works for any entity type entity = synGet(synapse_id = "syn123456") # The returned object will be the appropriate type if (inherits(entity, "File")) { print(sprintf("File: %s", entity$name)) } else if (inherits(entity, "Project")) { print(sprintf("Project: %s", entity$name)) } ## Example 2: Retrieving entities by name # Get an entity by name and parent: library(synapser) synLogin() # Get a file by name within a folder entity = synGet( entity_name = "my_file.txt", parent_id = "syn123456" ) # Get a project by name (parent_id = NULL) project = synGet( entity_name = "My Project", parent_id = NULL ) ## Example 3: Retrieving a specific version # Get a specific version of a versionable entity: library(synapser) synLogin() entity = synGet(synapse_id = "syn123456", version_number = 2L) ## Example 4: Retrieving a file with custom options # Get file metadata with specific download options: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), file_options = FileOptions( download_file = FALSE ) ) ## Example 5: Retrieving a table with activity and columns # Get table with activity and column information: library(synapser) synLogin() table_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), table_options = TableOptions(include_columns = TRUE) ) ## Example 6: Following links # Get the target of a link entity: library(synapser) synLogin() target_entity = synGet( synapse_id = "syn123456", link_options = LinkOptions(follow_link = TRUE) ) ## Example 7: Working with Link entities # Get a Link entity without following it: library(synapser) synLogin() # Get the link entity itself link_entity = synGet( synapse_id = "syn123456", # Example link ID link_options = LinkOptions(follow_link = FALSE) ) print(sprintf("Link: %s -> %s", link_entity$name, link_entity$target_id)) # Then follow the link to get the target target_entity = synGet( synapse_id = "syn123456", link_options = LinkOptions(follow_link = TRUE) ) print(sprintf("Target: %s (type: %s)", target_entity$name, class(target_entity)[1])) ## Example 8: Comprehensive File options # Download file with custom location and collision handling: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", file_options = FileOptions( download_file = TRUE, download_location = "/path/to/download/", if_collision = "overwrite.local" ) ) print(sprintf("Downloaded file: %s to %s", file_entity$name, file_entity$path)) ## Example 9: Table options for table-like entities # Get table entities with column information: library(synapser) synLogin() # Works for Table, Dataset, EntityView, MaterializedView, # SubmissionView, VirtualTable, and DatasetCollection table_entity = synGet( synapse_id = "syn123456", # Example table ID table_options = TableOptions(include_columns = TRUE) ) print(sprintf("Table: %s with %d columns", table_entity$name, length(table_entity$columns))) ## Example 10: Combining multiple options # Get a File with both activity and custom download options: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), file_options = FileOptions( download_file = FALSE ) ) print(sprintf("File: %s (activity included: %s)", file_entity$name, !is.null(file_entity$activity))) ## Example 11: Working with entity instances # Pass an existing entity instance to refresh or apply new options: library(synapser) synLogin() # Get an entity first entity = synGet(synapse_id = "syn123456") print(sprintf("Original entity: %s", entity$name)) # Then use the entity instance to get it again with different options refreshed_entity = entity |> synGet(file_options = FileOptions(download_file = FALSE)) print(sprintf("Refreshed entity: %s (download_file: %s)", refreshed_entity$name, refreshed_entity$download_file)) ## End(Not run)## Not run: ## Example 1: Retrieving entities by ID # Get any entity by Synapse ID: library(synapser) synLogin() # Works for any entity type entity = synGet(synapse_id = "syn123456") # The returned object will be the appropriate type if (inherits(entity, "File")) { print(sprintf("File: %s", entity$name)) } else if (inherits(entity, "Project")) { print(sprintf("Project: %s", entity$name)) } ## Example 2: Retrieving entities by name # Get an entity by name and parent: library(synapser) synLogin() # Get a file by name within a folder entity = synGet( entity_name = "my_file.txt", parent_id = "syn123456" ) # Get a project by name (parent_id = NULL) project = synGet( entity_name = "My Project", parent_id = NULL ) ## Example 3: Retrieving a specific version # Get a specific version of a versionable entity: library(synapser) synLogin() entity = synGet(synapse_id = "syn123456", version_number = 2L) ## Example 4: Retrieving a file with custom options # Get file metadata with specific download options: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), file_options = FileOptions( download_file = FALSE ) ) ## Example 5: Retrieving a table with activity and columns # Get table with activity and column information: library(synapser) synLogin() table_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), table_options = TableOptions(include_columns = TRUE) ) ## Example 6: Following links # Get the target of a link entity: library(synapser) synLogin() target_entity = synGet( synapse_id = "syn123456", link_options = LinkOptions(follow_link = TRUE) ) ## Example 7: Working with Link entities # Get a Link entity without following it: library(synapser) synLogin() # Get the link entity itself link_entity = synGet( synapse_id = "syn123456", # Example link ID link_options = LinkOptions(follow_link = FALSE) ) print(sprintf("Link: %s -> %s", link_entity$name, link_entity$target_id)) # Then follow the link to get the target target_entity = synGet( synapse_id = "syn123456", link_options = LinkOptions(follow_link = TRUE) ) print(sprintf("Target: %s (type: %s)", target_entity$name, class(target_entity)[1])) ## Example 8: Comprehensive File options # Download file with custom location and collision handling: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", file_options = FileOptions( download_file = TRUE, download_location = "/path/to/download/", if_collision = "overwrite.local" ) ) print(sprintf("Downloaded file: %s to %s", file_entity$name, file_entity$path)) ## Example 9: Table options for table-like entities # Get table entities with column information: library(synapser) synLogin() # Works for Table, Dataset, EntityView, MaterializedView, # SubmissionView, VirtualTable, and DatasetCollection table_entity = synGet( synapse_id = "syn123456", # Example table ID table_options = TableOptions(include_columns = TRUE) ) print(sprintf("Table: %s with %d columns", table_entity$name, length(table_entity$columns))) ## Example 10: Combining multiple options # Get a File with both activity and custom download options: library(synapser) synLogin() file_entity = synGet( synapse_id = "syn123456", activity_options = ActivityOptions(include_activity = TRUE), file_options = FileOptions( download_file = FALSE ) ) print(sprintf("File: %s (activity included: %s)", file_entity$name, !is.null(file_entity$activity))) ## Example 11: Working with entity instances # Pass an existing entity instance to refresh or apply new options: library(synapser) synLogin() # Get an entity first entity = synGet(synapse_id = "syn123456") print(sprintf("Original entity: %s", entity$name)) # Then use the entity instance to get it again with different options refreshed_entity = entity |> synGet(file_options = FileOptions(download_file = FALSE)) print(sprintf("Refreshed entity: %s (download_file: %s)", refreshed_entity$name, refreshed_entity$download_file)) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
principal_id |
(integer) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(logical) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty list.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Dataset library(synapser) synLogin() acl = Dataset(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Dataset acl = Dataset(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Dataset, not the one it inherits acl = Dataset(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Dataset library(synapser) synLogin() acl = Dataset(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Dataset acl = Dataset(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Dataset, not the one it inherits acl = Dataset(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
principal_id |
(integer) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(logical) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty list.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a DatasetCollection library(synapser) synLogin() acl = DatasetCollection(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the DatasetCollection acl = DatasetCollection(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the DatasetCollection, not the one it inherits acl = DatasetCollection(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a DatasetCollection library(synapser) synLogin() acl = DatasetCollection(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the DatasetCollection acl = DatasetCollection(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the DatasetCollection, not the one it inherits acl = DatasetCollection(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a EntityView library(synapser) synLogin() acl = EntityView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the EntityView acl = EntityView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the EntityView, not the one it inherits acl = EntityView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a EntityView library(synapser) synLogin() acl = EntityView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the EntityView acl = EntityView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the EntityView, not the one it inherits acl = EntityView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the access control list (ACL) governing this evaluation.
synGetAcl(instance, synapse_client=NULL)synGetAcl(instance, synapse_client=NULL)
instance |
(Evaluation) The Evaluation instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The AccessControlList response object as a named list.
- An error is raised if the evaluation's id is not set.
- An error is also raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Get the ACL for an evaluation library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Get the evaluation back from Synapse evaluations = synGetEvaluationsByProject( project_id = PROJECT_ID, evaluation_ids = list(evaluation$id) ) evaluation = evaluations[[1]] # Get the ACL for the evaluation acl = evaluation |> synGetAcl() acl ## End(Not run)## Not run: ## Get the ACL for an evaluation library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Get the evaluation back from Synapse evaluations = synGetEvaluationsByProject( project_id = PROJECT_ID, evaluation_ids = list(evaluation$id) ) evaluation = evaluations[[1]] # Get the ACL for the evaluation acl = evaluation |> synGetAcl() acl ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a File library(synapser) synLogin() acl = File(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the File acl = File(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the File, not the one it inherits acl = File(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a File library(synapser) synLogin() acl = File(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the File acl = File(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the File, not the one it inherits acl = File(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Folder library(synapser) synLogin() acl = Folder(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Folder acl = Folder(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Folder, not the one it inherits acl = Folder(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Folder library(synapser) synLogin() acl = Folder(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Folder acl = Folder(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Folder, not the one it inherits acl = Folder(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(MaterializedView) The MaterializedView instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a MaterializedView library(synapser) synLogin() acl = MaterializedView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the MaterializedView acl = MaterializedView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the MaterializedView, not the one it inherits acl = MaterializedView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a MaterializedView library(synapser) synLogin() acl = MaterializedView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the MaterializedView acl = MaterializedView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the MaterializedView, not the one it inherits acl = MaterializedView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Gets the ACL for this organization
synGetAcl(instance, synapse_client=NULL)synGetAcl(instance, synapse_client=NULL)
instance |
(Organization) The Organization instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A named list in the form of this response: AccessControlList
## Not run: ## Get the ACL for a Organization library(synapser) synLogin() org = Organization(name = "dpetest") acl = org |> synGetAcl() etag = acl[["etag"]] print(etag) resource_access = acl[["resourceAccess"]] for (item in resource_access) { principal_id = item[["principalId"]] print(principal_id) access_types = item[["accessType"]] print(access_types) } ## End(Not run)## Not run: ## Get the ACL for a Organization library(synapser) synLogin() org = Organization(name = "dpetest") acl = org |> synGetAcl() etag = acl[["etag"]] print(etag) resource_access = acl[["resourceAccess"]] for (item in resource_access) { principal_id = item[["principalId"]] print(principal_id) access_types = item[["accessType"]] print(access_types) } ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Project library(synapser) synLogin() acl = Project(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Project acl = Project(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Project, not the one it inherits acl = Project(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Project library(synapser) synLogin() acl = Project(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Project acl = Project(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Project, not the one it inherits acl = Project(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a SubmissionView library(synapser) synLogin() acl = SubmissionView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the SubmissionView acl = SubmissionView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the SubmissionView, not the one it inherits acl = SubmissionView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a SubmissionView library(synapser) synLogin() acl = SubmissionView(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the SubmissionView acl = SubmissionView(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the SubmissionView, not the one it inherits acl = SubmissionView(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Table library(synapser) synLogin() acl = Table(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Table acl = Table(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Table, not the one it inherits acl = Table(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)## Not run: ## Using this function # Get the permissions the PUBLIC group has on a Table library(synapser) synLogin() acl = Table(id = "syn123") |> synGetAcl() print(acl) # Get the permissions a specific user or team has on the Table acl = Table(id = "syn123") |> synGetAcl(principal_id = 273948L) print(acl) # Only look at the ACL set directly on the Table, not the one it inherits acl = Table(id = "syn123") |> synGetAcl(principal_id = 273948L, check_benefactor = FALSE) print(acl) ## End(Not run)
Get the ACL that a user or group has on an Entity.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL)
instance |
(VirtualTable) The VirtualTable instance to operate on. |
principal_id |
(int) Identifier of a user or group (defaults to PUBLIC users) |
check_benefactor |
(bool) If TRUE (default), check the benefactor for the entity to get the ACL. If FALSE, only check the entity itself. This is useful for checking the ACL of an entity that has local sharing settings, but you want to check the ACL of the entity itself and not the benefactor it may inherit from. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An array containing some combination of READ, UPDATE, CREATE, DELETE, DOWNLOAD, MODERATE, CHANGE_PERMISSIONS, CHANGE_SETTINGS, or an empty array.
If the entity does not have local sharing settings, or ACL set directly on it, this will look up the ACL on the benefactor of the entity. The benefactor is the entity that the current entity inherits its permissions from. The benefactor is usually the parent entity, but it can be any ancestor in the hierarchy. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project or Folder. If the entity already has local sharing settings, the benefactor would be itself.
## Not run: ## Using this function # Get the ACL for a specific principal on a VirtualTable acl = VirtualTable(id = "syn123") |> synGetAcl(principal_id = 273948L) ## End(Not run)## Not run: ## Using this function # Get the ACL for a specific principal on a VirtualTable acl = VirtualTable(id = "syn123") |> synGetAcl(principal_id = 273948L) ## End(Not run)
Get a list of all Evaluations, within a given range.
synGetAllEvaluations(access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)synGetAllEvaluations(access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)
access_type |
(Optional[str]) The type of access for the user to filter for, optional and defaults to |
active_only |
(Optional[bool]) If TRUE then return only those evaluations with rounds defined and for which the current time is in one of the rounds. |
evaluation_ids |
(Optional[list[str]]) An optional list of evaluation IDs to which the response is limited. |
offset |
(Optional[int]) The offset index determines where this page will start from. An index of 0 is the first entity. When NULL it will default to 0. |
limit |
(Optional[int]) Limits the number of entities that will be fetched for this page. When NULL it will default to 10. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of all evaluations, as Evaluation objects.
An error is raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Example 1: Get all evaluations the user has at least READ access to # A default call will return evaluations where the user has read access, without needing to specify access type. library(synapser) synLogin() all_evaluations = synGetAllEvaluations() all_evaluations ## Example 2: Get only active evaluations with a limit library(synapser) synLogin() active_evaluations = synGetAllEvaluations( active_only = TRUE, limit = 20L ) active_evaluations ## Example 3: Get specific evaluations by ID library(synapser) synLogin() specific_evaluations = synGetAllEvaluations( evaluation_ids = list("9999991", "9999992") ) specific_evaluations ## End(Not run)## Not run: ## Example 1: Get all evaluations the user has at least READ access to # A default call will return evaluations where the user has read access, without needing to specify access type. library(synapser) synLogin() all_evaluations = synGetAllEvaluations() all_evaluations ## Example 2: Get only active evaluations with a limit library(synapser) synLogin() active_evaluations = synGetAllEvaluations( active_only = TRUE, limit = 20L ) active_evaluations ## Example 3: Get specific evaluations by ID library(synapser) synLogin() specific_evaluations = synGetAllEvaluations( evaluation_ids = list("9999991", "9999992") ) specific_evaluations ## End(Not run)
Gets a collection of SubmissionStatuses to a specified Evaluation.
synGetAllSubmissionStatuses(evaluation_id, status=NULL, limit=10L, offset=0L, synapse_client=NULL)synGetAllSubmissionStatuses(evaluation_id, status=NULL, limit=10L, offset=0L, synapse_client=NULL)
evaluation_id |
(character) The ID of the specified Evaluation. |
status |
(Optional[character]) Optionally filter submission statuses by status. |
limit |
(integer) Limits the number of entities that will be fetched for this page. When NULL it will default to 10, max value 100. Defaults to 10. |
offset |
(integer) The offset index determines where this page will start from. An index of 0 is the first entity. Defaults to 0. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of SubmissionStatus objects for the evaluation queue.
## Not run: ## Getting all submission statuses for an evaluation # Retrieve a list of submission statuses for a specific evaluation, optionally filtered by status. library(synapser) synLogin() statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "SCORED", limit = 50L ) print(sprintf("Found %d submission statuses", length(statuses))) for (status in statuses) { print(sprintf("Status ID: %s, Status: %s", status$id, status$status)) } ## End(Not run)## Not run: ## Getting all submission statuses for an evaluation # Retrieve a list of submission statuses for a specific evaluation, optionally filtered by status. library(synapser) synLogin() statuses = synGetAllSubmissionStatuses( evaluation_id = "9999999", status = "SCORED", limit = 50L ) print(sprintf("Found %d submission statuses", length(statuses))) for (status in statuses) { print(sprintf("Status ID: %s, Status: %s", status$id, status$status)) } ## End(Not run)
Download the wiki page attachment to a local file or return the URL.
synGetAttachment(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL)synGetAttachment(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
file_name |
(str) The name of the file to get. The file name can be in either non-gzipped or gzipped format. |
download_file |
(bool) Whether associated files should be downloaded. Default is TRUE. |
download_location |
(Optional[str]) The directory to download the file to. Required if download_file is TRUE. |
synapse_client |
(Optional[Synapse]) Optionally provide a Synapse client. |
If download_file is TRUE, the attachment file will be downloaded to the download_location. Otherwise, the URL will be returned.
An error is raised if owner_id or id is not provided.
## Not run: ## Example 1: Get the attachment URL for a wiki page # This example shows how to get the attachment file or URL for a wiki page. attachment_file_or_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachment(file_name = "attachment.txt", download_file = FALSE) cat("Attachment URL:", attachment_file_or_url, "\n") ## Example 2: Download the attachment file for a wiki page # This example shows how to download the attachment file for a wiki page. attachment_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachment(file_name = "attachment.txt", download_file = TRUE, download_location = "~/temp") cat("Attachment file path:", attachment_file_path, "\n") ## End(Not run)## Not run: ## Example 1: Get the attachment URL for a wiki page # This example shows how to get the attachment file or URL for a wiki page. attachment_file_or_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachment(file_name = "attachment.txt", download_file = FALSE) cat("Attachment URL:", attachment_file_or_url, "\n") ## Example 2: Download the attachment file for a wiki page # This example shows how to download the attachment file for a wiki page. attachment_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachment(file_name = "attachment.txt", download_file = TRUE, download_location = "~/temp") cat("Attachment file path:", attachment_file_path, "\n") ## End(Not run)
Get the file handles of all attachments on this wiki page.
synGetAttachmentHandles(instance, synapse_client=NULL)synGetAttachmentHandles(instance, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
synapse_client |
(Optional[Synapse]) Optionally provide a Synapse client. |
The list of FileHandles for all file attachments of this WikiPage.
An error is raised if owner_id or id is not provided.
## Not run: ## Get the file handles of all attachments on a wiki page # This example shows how to get the file handles of all attachments on a wiki page. attachment_handles = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentHandles() cat("Attachment handles:\n") attachment_handles$list ## End(Not run)## Not run: ## Get the file handles of all attachments on a wiki page # This example shows how to get the file handles of all attachments on a wiki page. attachment_handles = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentHandles() cat("Attachment handles:\n") attachment_handles$list ## End(Not run)
Download the wiki page attachment preview to a local file or return the URL.
synGetAttachmentPreview(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL)synGetAttachmentPreview(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
file_name |
(str) The name of the file to get. The file name can be in either non-gzipped or gzipped format. |
download_file |
(bool) Whether associated files should be downloaded. Default is TRUE. |
download_location |
(Optional[str]) The directory to download the file to. Required if download_file is TRUE. |
synapse_client |
(Optional[Synapse]) Optionally provide a Synapse client. |
If download_file is TRUE, the attachment preview file will be downloaded to the download_location. Otherwise, the URL will be returned.
An error is raised if owner_id or id is not provided.
## Not run: ## Example 1: Get the attachment preview URL for a wiki page # This example shows how to get the attachment preview URL for a wiki page. # Instead of using the file_name from the attachmenthandle response when isPreview=TRUE, you should use the original file name in the get_attachment_preview request. # The downloaded file will still be named according to the file_name provided in the response when isPreview=TRUE. attachment_preview_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentPreview(file_name = "attachment.txt.gz", download_file = FALSE) cat("Attachment preview URL:", attachment_preview_url, "\n") ## Example 2: Download the attachment preview file for a wiki page # This example shows how to download the attachment preview file for a wiki page. attachment_preview_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentPreview(file_name = "attachment.txt.gz", download_file = TRUE, download_location = "~/temp") cat("Attachment preview file path:", attachment_preview_file_path, "\n") ## End(Not run)## Not run: ## Example 1: Get the attachment preview URL for a wiki page # This example shows how to get the attachment preview URL for a wiki page. # Instead of using the file_name from the attachmenthandle response when isPreview=TRUE, you should use the original file name in the get_attachment_preview request. # The downloaded file will still be named according to the file_name provided in the response when isPreview=TRUE. attachment_preview_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentPreview(file_name = "attachment.txt.gz", download_file = FALSE) cat("Attachment preview URL:", attachment_preview_url, "\n") ## Example 2: Download the attachment preview file for a wiki page # This example shows how to download the attachment preview file for a wiki page. attachment_preview_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetAttachmentPreview(file_name = "attachment.txt.gz", download_file = TRUE, download_location = "~/temp") cat("Attachment preview file path:", attachment_preview_file_path, "\n") ## End(Not run)
Get a list of Evaluations to which the user has SUBMIT permission, within a given range.
synGetAvailableEvaluations(active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)synGetAvailableEvaluations(active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)
active_only |
(Optional[bool]) If TRUE then return only those evaluations with rounds defined and for which the current time is in one of the rounds. |
evaluation_ids |
(Optional[list[str]]) An optional list of evaluation IDs to which the response is limited. |
offset |
(Optional[int]) The offset index determines where this page will start from. An index of 0 is the first entity. When NULL it will default to 0. |
limit |
(Optional[int]) Limits the number of entities that will be fetched for this page. When NULL it will default to 10. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of available evaluations, as Evaluation objects.
An error is raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Example 1: Get all evaluations where the current user has SUBMIT permission # A default call will return evaluations where the user has SUBMIT permission, without needing to specify access type. library(synapser) synLogin() available_evaluations = synGetAvailableEvaluations() available_evaluations ## Example 2: Get only active evaluations where the current user has SUBMIT permission library(synapser) synLogin() active_available_evaluations = synGetAvailableEvaluations( active_only = TRUE ) active_available_evaluations ## Example 3: Get the first 5 evaluations where the current user has SUBMIT permission library(synapser) synLogin() limited_evaluations = synGetAvailableEvaluations( limit = 5L ) limited_evaluations ## End(Not run)## Not run: ## Example 1: Get all evaluations where the current user has SUBMIT permission # A default call will return evaluations where the user has SUBMIT permission, without needing to specify access type. library(synapser) synLogin() available_evaluations = synGetAvailableEvaluations() available_evaluations ## Example 2: Get only active evaluations where the current user has SUBMIT permission library(synapser) synLogin() active_available_evaluations = synGetAvailableEvaluations( active_only = TRUE ) active_available_evaluations ## Example 3: Get the first 5 evaluations where the current user has SUBMIT permission library(synapser) synLogin() limited_evaluations = synGetAvailableEvaluations( limit = 5L ) limited_evaluations ## End(Not run)
Gets the chat history for the current session.
synGetChatHistory(instance)synGetChatHistory(instance)
instance |
(Agent) The Agent instance to operate on. |
NULL
## Not run: ## Get the chat history for the current session. # First, send a prompt to the agent. # Then, retrieve the chat history for the current session by calling synGetChatHistory(). library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) print(my_agent |> synGetChatHistory()) ## End(Not run)## Not run: ## Get the chat history for the current session. # First, send a prompt to the agent. # Then, retrieve the chat history for the current session by calling synGetChatHistory(). library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) print(my_agent |> synGetChatHistory()) ## End(Not run)
Get Evaluations tied to a project.
synGetEvaluationsByProject(project_id, access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)synGetEvaluationsByProject(project_id, access_type=NULL, active_only=NULL, evaluation_ids=NULL, offset=NULL, limit=NULL, synapse_client=NULL)
project_id |
(str) The ID of the project (e.g., "syn123456"). |
access_type |
(Optional[str]) The type of access for the user to filter for, optional and defaults to |
active_only |
(Optional[bool]) If TRUE then return only those evaluations with rounds defined and for which the current time is in one of the rounds. |
evaluation_ids |
(Optional[list[str]]) An optional list of evaluation IDs to which the response is limited. |
offset |
(Optional[int]) The offset index determines where this page will start from. An index of 0 is the first entity. When NULL it will default to 0. |
limit |
(Optional[int]) Limits the number of entities that will be fetched for this page. When NULL it will default to 10. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of Evaluations tied to the project, as Evaluation objects.
An error is raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Example 1: Get all evaluations for a project # The user must have at least READ access to the evaluations to retrieve the evaluations from a given project. library(synapser) synLogin() project_evaluations = synGetEvaluationsByProject( project_id = "syn123456" ) project_evaluations ## Example 2: Get only active evaluations for a project library(synapser) synLogin() active_project_evaluations = synGetEvaluationsByProject( project_id = "syn123456", active_only = TRUE ) active_project_evaluations ## Example 3: Get a limited set of evaluations for a project library(synapser) synLogin() limited_project_evaluations = synGetEvaluationsByProject( project_id = "syn123456", limit = 5L ) limited_project_evaluations ## End(Not run)## Not run: ## Example 1: Get all evaluations for a project # The user must have at least READ access to the evaluations to retrieve the evaluations from a given project. library(synapser) synLogin() project_evaluations = synGetEvaluationsByProject( project_id = "syn123456" ) project_evaluations ## Example 2: Get only active evaluations for a project library(synapser) synLogin() active_project_evaluations = synGetEvaluationsByProject( project_id = "syn123456", active_only = TRUE ) active_project_evaluations ## Example 3: Get a limited set of evaluations for a project library(synapser) synLogin() limited_project_evaluations = synGetEvaluationsByProject( project_id = "syn123456", limit = 5L ) limited_project_evaluations ## End(Not run)
Retrieves bundled Submissions and SubmissionStatuses for a given Evaluation.
synGetEvaluationSubmissionBundles(cls, evaluation_id, status=NULL, synapse_client=NULL)synGetEvaluationSubmissionBundles(cls, evaluation_id, status=NULL, synapse_client=NULL)
cls |
(SubmissionBundle) The SubmissionBundle class (or an existing SubmissionBundle instance) to dispatch this call to. |
evaluation_id |
(character) The ID of the specified Evaluation. |
status |
(Optional[character]) Optionally filter submission bundles by status. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields SubmissionBundle objects as they are retrieved from the API. Use as.list() to materialize all results into a list, or nextElem() to retrieve one SubmissionBundle at a time.
The caller must be granted the READ_PRIVATE_SUBMISSION access type on the specified Evaluation.
## Not run: ## Getting submission bundles for an evaluation library(synapser) synLogin() bundles = as.list(SubmissionBundle() |> synGetEvaluationSubmissionBundles( evaluation_id = "9999999", status = "SCORED" )) print(sprintf("Found %d submission bundles", length(bundles))) for (bundle in bundles) { submission_id = if (is.null(bundle$submission)) "N/A" else bundle$submission$id print(sprintf("Submission ID: %s", submission_id)) } ## End(Not run)## Not run: ## Getting submission bundles for an evaluation library(synapser) synLogin() bundles = as.list(SubmissionBundle() |> synGetEvaluationSubmissionBundles( evaluation_id = "9999999", status = "SCORED" )) print(sprintf("Found %d submission bundles", length(bundles))) for (bundle in bundles) { submission_id = if (is.null(bundle$submission)) "N/A" else bundle$submission$id print(sprintf("Submission ID: %s", submission_id)) } ## End(Not run)
Retrieves all Submissions for a specified Evaluation queue.
synGetEvaluationSubmissions(cls, evaluation_id, status=NULL, synapse_client=NULL)synGetEvaluationSubmissions(cls, evaluation_id, status=NULL, synapse_client=NULL)
cls |
(Submission) The Submission class (or an existing Submission instance) to dispatch this call to. |
evaluation_id |
(character) The ID of the evaluation queue. |
status |
(Optional[character]) Optionally filter submissions by a submission status, such as SCORED, VALID, INVALID, OPEN, CLOSED or EVALUATION_IN_PROGRESS. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields Submission objects as they are retrieved from the API. Use as.list() to materialize all results into a list, or nextElem() to retrieve one Submission at a time.
## Not run: ## Getting submissions for an evaluation # Get SCORED submissions from a specific evaluation. library(synapser) synLogin() submissions = as.list(Submission() |> synGetEvaluationSubmissions( evaluation_id = "9999999", status = "SCORED" )) print(sprintf("Found %d submissions", length(submissions))) ## End(Not run)## Not run: ## Getting submissions for an evaluation # Get SCORED submissions from a specific evaluation. library(synapser) synLogin() submissions = as.list(Submission() |> synGetEvaluationSubmissions( evaluation_id = "9999999", status = "SCORED" )) print(sprintf("Found %d submissions", length(submissions))) ## End(Not run)
Wrapper for synGet.
synGetFromId(cls, synapse_id, synapse_client=NULL)synGetFromId(cls, synapse_id, synapse_client=NULL)
cls |
(File) The File class (or an existing File instance) to dispatch this call to. |
synapse_id |
(str) The ID of the file in Synapse. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The file object.
## Not run: ## Using this function # Assuming you have a file with the ID "syn123": file_instance = File |> synGetFromId(synapse_id = "syn123") ## End(Not run)## Not run: ## Using this function # Assuming you have a file with the ID "syn123": file_instance = File |> synGetFromId(synapse_id = "syn123") ## End(Not run)
Gets Team object using its integer id.
synGetFromId(cls, id, synapse_client=NULL)synGetFromId(cls, id, synapse_client=NULL)
cls |
(Team) The Team class (or an existing Team instance) to dispatch this call to. |
id |
(integer) The id of the team. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
Team: The Team object.
## Not run: ## Get a team by its ID library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) ## End(Not run)## Not run: ## Get a team by its ID library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) ## End(Not run)
Gets UserProfile object using its integer id.
synGetFromId(cls, user_id, synapse_client=NULL)synGetFromId(cls, user_id, synapse_client=NULL)
cls |
(UserProfile) The UserProfile class (or an existing UserProfile instance) to dispatch this call to. |
user_id |
(int) The id of the user. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The UserProfile object.
## Not run: ## Using this function # Assuming you know the integer ID of a Synapse user: user_profile = UserProfile |> synGetFromId(user_id = 273948L) ## End(Not run)## Not run: ## Using this function # Assuming you know the integer ID of a Synapse user: user_profile = UserProfile |> synGetFromId(user_id = 273948L) ## End(Not run)
Gets Team object using its string name.
Note: You will be unable to retrieve a team by name immediately after its creation because the fragment service is eventually consistent. If you need to retrieve a team immediately following creation you should use the synGetFromId() function instead.
synGetFromName(cls, name, synapse_client=NULL)synGetFromName(cls, name, synapse_client=NULL)
cls |
(Team) The Team class (or an existing Team instance) to dispatch this call to. |
name |
(character) The name of the team. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
Team: The Team object.
## Not run: ## Get a team by its name library(synapser) synLogin() team = Team() |> synGetFromName(name = "My Uniquely Named Team") ## End(Not run)## Not run: ## Get a team by its name library(synapser) synLogin() team = Team() |> synGetFromName(name = "My Uniquely Named Team") ## End(Not run)
Get the Activity from Synapse based on the parent entity.
synGetFromParent(cls, parent, parent_version_number=NULL, synapse_client=NULL)synGetFromParent(cls, parent, parent_version_number=NULL, synapse_client=NULL)
cls |
(Activity) The Activity class (or an existing Activity instance) to dispatch this call to. |
parent |
(Union[Table, File, EntityView, Dataset, str]) The parent entity this activity is associated with. The parent may also have a version_number. Gets the most recent version if version is omitted. |
parent_version_number |
(Optional[int]) The version number of the parent entity. When parent is a string with version (e.g., "syn123.4"), the version in the string takes precedence. When parent is an object, this parameter takes precedence over parent$version_number. Gets the most recent version if omitted. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The Activity object, or NULL if it does not exist.
An error is raised if the parent does not have an ID.
## Not run: ## Using this function # Get the Activity associated with the latest version of an entity library(synapser) synLogin() activity = Activity() |> synGetFromParent(parent = "syn123") print(activity$name) # Get the Activity associated with a specific version of an entity activity = Activity() |> synGetFromParent(parent = "syn123", parent_version_number = 2L) # Or include the version in the Synapse ID activity = Activity() |> synGetFromParent(parent = "syn123.2") ## End(Not run)## Not run: ## Using this function # Get the Activity associated with the latest version of an entity library(synapser) synLogin() activity = Activity() |> synGetFromParent(parent = "syn123") print(activity$name) # Get the Activity associated with a specific version of an entity activity = Activity() |> synGetFromParent(parent = "syn123", parent_version_number = 2L) # Or include the version in the Synapse ID activity = Activity() |> synGetFromParent(parent = "syn123.2") ## End(Not run)
Get the file from Synapse. If the path of the file matches multiple files within Synapse the first one found will be returned. The other matching files will be printed to the console.
Wrapper for synGet.
synGetFromPath(cls, path, synapse_client=NULL)synGetFromPath(cls, path, synapse_client=NULL)
cls |
(File) The File class (or an existing File instance) to dispatch this call to. |
path |
(str) The path to the file on disk. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The file object.
## Not run: ## Using this function # Assuming you have a file at the path "path/to/file.txt": file_instance = File |> synGetFromPath(path = "path/to/file.txt") ## End(Not run)## Not run: ## Using this function # Assuming you have a file at the path "path/to/file.txt": file_instance = File |> synGetFromPath(path = "path/to/file.txt") ## End(Not run)
Gets UserProfile object using its string name.
synGetFromUsername(cls, username, synapse_client=NULL)synGetFromUsername(cls, username, synapse_client=NULL)
cls |
(UserProfile) The UserProfile class (or an existing UserProfile instance) to dispatch this call to. |
username |
(str) A name chosen by the user that uniquely identifies them. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The UserProfile object.
## Not run: ## Using this function # Assuming you know the username of a Synapse user: user_profile = UserProfile |> synGetFromUsername(username = "myUsername") ## End(Not run)## Not run: ## Using this function # Assuming you know the username of a Synapse user: user_profile = UserProfile |> synGetFromUsername(username = "myUsername") ## End(Not run)
Get invalid JSON schema validation results for a container entity.
synGetInvalidValidation(instance, synapse_client=NULL)synGetInvalidValidation(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields objects containing the validation response, all validation messages, and the validation exception details. Use as.list() to materialize all results into a list, or nextElem() to retrieve one result at a time.
This only checks the direct children of this entity. It does not check this entity itself, and it does not check grandchildren (entities nested two or more levels below this entity).
## Not run: ## Using this function # Retrieving invalid validation results for a folder. This example demonstrates # how to get detailed invalid validation results for child entities within a container. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create a file within the folder with invalid annotations to generate invalid results invalid_file1 = File( path = FILE_PATH, parent_id = test_folder$id, annotations = list(foo = 123, bar = "not_an_integer") # both invalid ) |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing # Get invalid validation results invalid_results = test_folder |> synGetInvalidValidation() cat("Invalid validation items found:\n") for (child in as.list(invalid_results)) { cat("Invalid validation item:\n") print(child) } ## End(Not run)## Not run: ## Using this function # Retrieving invalid validation results for a folder. This example demonstrates # how to get detailed invalid validation results for child entities within a container. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create a file within the folder with invalid annotations to generate invalid results invalid_file1 = File( path = FILE_PATH, parent_id = test_folder$id, annotations = list(foo = 123, bar = "not_an_integer") # both invalid ) |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing # Get invalid validation results invalid_results = test_folder |> synGetInvalidValidation() cat("Invalid validation items found:\n") for (child in as.list(invalid_results)) { cat("Invalid validation item:\n") print(child) } ## End(Not run)
Get invalid JSON schema validation results for the child entities of a container entity.
synGetInvalidValidation(instance, synapse_client=NULL)synGetInvalidValidation(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the validation response, all validation messages, and the validation exception details.
This only checks the direct children of this entity. It does not check this entity itself, and it does not check grandchildren (entities nested two or more levels below this entity).
## Not run: ## Using this function # Retrieving invalid validation results for a project. This example demonstrates # how to get detailed invalid validation results for child entities within a container. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Create a file within the project with invalid annotations to generate invalid results invalid_file1 = File( path = FILE_PATH, # assumes you have something here or adjust path parent_id = PROJECT_ID ) invalid_file1$annotations = list(foo = 123, bar = "not_an_integer") # both invalid invalid_file1 = invalid_file1 |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing # Get invalid validation results # synGetInvalidValidation() returns a Python generator, wrapped as a # GeneratorWrapper -- materialize it with as.list() before iterating, # since R's for() can't drive a Python generator directly. invalid_results = as.list(test_project |> synGetInvalidValidation()) cat("Invalid validation items found:\n") for (child in invalid_results) { cat(sprintf("Invalid validation item: %s\n", child)) } ## End(Not run)## Not run: ## Using this function # Retrieving invalid validation results for a project. This example demonstrates # how to get detailed invalid validation results for child entities within a container. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Create a file within the project with invalid annotations to generate invalid results invalid_file1 = File( path = FILE_PATH, # assumes you have something here or adjust path parent_id = PROJECT_ID ) invalid_file1$annotations = list(foo = 123, bar = "not_an_integer") # both invalid invalid_file1 = invalid_file1 |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing # Get invalid validation results # synGetInvalidValidation() returns a Python generator, wrapped as a # GeneratorWrapper -- materialize it with as.list() before iterating, # since R's for() can't drive a Python generator directly. invalid_results = as.list(test_project |> synGetInvalidValidation()) cat("Invalid validation items found:\n") for (child in invalid_results) { cat(sprintf("Invalid validation item: %s\n", child)) } ## End(Not run)
Gets the JSON Schemas that are part of this organization
synGetJsonSchemas(instance, synapse_client=NULL)synGetJsonSchemas(instance, synapse_client=NULL)
instance |
(Organization) The Organization instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields the JSONSchema objects that belong to this organization. Use as.list() to materialize all results into a list, or nextElem() to retrieve one JSONSchema at a time.
## Not run: ## Get the JSONSchemas that are part of this Organization library(synapser) synLogin() org = Organization(name = "dpetest") js_generator = org |> synGetJsonSchemas() for (item in as.list(js_generator)) { print(item) } ## End(Not run)## Not run: ## Get the JSONSchemas that are part of this Organization library(synapser) synLogin() org = Organization(name = "dpetest") js_generator = org |> synGetJsonSchemas() for (item in as.list(js_generator)) { print(item) } ## End(Not run)
Get the markdown URL of this wiki page.
synGetMarkdownFile(instance, download_file=TRUE, download_location=NULL, synapse_client=NULL)synGetMarkdownFile(instance, download_file=TRUE, download_location=NULL, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
download_file |
(bool) Whether associated files should be downloaded. Default is TRUE. |
download_location |
(Optional[str]) The directory to download the file to. Required if download_file is TRUE. |
synapse_client |
(Optional[Synapse]) Optionally provide a Synapse client. |
If download_file is TRUE, the markdown file will be downloaded to the download_location. Otherwise, the URL will be returned.
An error is raised if owner_id or id is not provided.
## Not run: ## Example 1: Get the markdown URL for a wiki page # This example shows how to get the markdown URL for a wiki page. markdown_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetMarkdownFile(download_file = FALSE) cat("Markdown URL:", markdown_url, "\n") ## Example 2: Download the markdown file for a wiki page # This example shows how to download the markdown file for a wiki page. markdown_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetMarkdownFile(download_file = TRUE, download_location = "~/temp") cat("Markdown file path:", markdown_file_path, "\n") ## End(Not run)## Not run: ## Example 1: Get the markdown URL for a wiki page # This example shows how to get the markdown URL for a wiki page. markdown_url = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetMarkdownFile(download_file = FALSE) cat("Markdown URL:", markdown_url, "\n") ## Example 2: Download the markdown file for a wiki page # This example shows how to download the markdown file for a wiki page. markdown_file_path = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGetMarkdownFile(download_file = TRUE, download_location = "~/temp") cat("Markdown file path:", markdown_file_path, "\n") ## End(Not run)
Gets all open invitations for a team given the ID field on the Team instance.
synGetOpenInvitations(instance, synapse_client=NULL)synGetOpenInvitations(instance, synapse_client=NULL)
instance |
(Team) The Team instance to operate on. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
List[dict]: A list of invitations.
## Not run: ## List the open invitations for a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) open_invitations = team |> synGetOpenInvitations() ## End(Not run)## Not run: ## List the open invitations for a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) open_invitations = team |> synGetOpenInvitations() ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Dataset(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Dataset(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = DatasetCollection(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = DatasetCollection(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = EntityView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = EntityView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the user permissions for this evaluation.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(Evaluation) The Evaluation instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A named list of the permissions the current user has on this evaluation.
- An error is raised if the evaluation's id is not set.
- An error is also raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Get permissions for the current user library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Get the permissions for the current user my_permissions = evaluation |> synGetPermissions() my_permissions ## End(Not run)## Not run: ## Get permissions for the current user library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Get the permissions for the current user my_permissions = evaluation |> synGetPermissions() my_permissions ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = File(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = File(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Folder(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Folder(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(MaterializedView) The MaterializedView instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = MaterializedView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = MaterializedView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Project(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Project(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = SubmissionView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = SubmissionView(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Table(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = Table(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the permissions that the caller has on an Entity.
synGetPermissions(instance, synapse_client=NULL)synGetPermissions(instance, synapse_client=NULL)
instance |
(VirtualTable) The VirtualTable instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A Permissions object
## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = VirtualTable(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)## Not run: ## Using this function: # Getting permissions for a Synapse Entity library(synapser) synLogin() permissions = VirtualTable(id = "syn123") |> synGetPermissions() # Getting access types list from the Permissions object permissions$access_types ## End(Not run)
Get the project setting for this entity.
synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL)synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
setting_type |
(character) The type of setting to retrieve. Currently only 'upload' is supported. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The ProjectSetting object, or NULL if no setting exists.
Raises an error if the entity does not have an id set.
## Not run: ## Using this function # Get the upload settings for a folder: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { print(sprintf("Storage locations: %s", paste(unlist(setting$locations), collapse = ", "))) } ## End(Not run)## Not run: ## Using this function # Get the upload settings for a folder: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { print(sprintf("Storage locations: %s", paste(unlist(setting$locations), collapse = ", "))) } ## End(Not run)
Get the project setting for this entity.
synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL)synGetProjectSetting(instance, setting_type="upload", synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
setting_type |
(character) The type of setting to retrieve. Currently only 'upload' is supported. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The ProjectSetting object, or NULL if no setting exists.
Raises an error if the entity does not have an id set.
## Not run: ## Using this function # Get the upload settings for a project: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { print(sprintf("Storage locations: %s", paste(unlist(setting$locations), collapse = ", "))) } ## End(Not run)## Not run: ## Using this function # Get the upload settings for a project: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { print(sprintf("Storage locations: %s", paste(unlist(setting$locations), collapse = ", "))) } ## End(Not run)
Get the JSON schema bound to the entity.
synGetSchema(instance, synapse_client=NULL)synGetSchema(instance, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the bound JSON schema.
## Not run: ## Using this function # Retrieving the bound JSON schema from an EntityView. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView first bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Retrieve the bound schema from the EntityView bound_schema = test_view |> synGetSchema() cat("Retrieved schema from EntityView:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Retrieving the bound JSON schema from an EntityView. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView first bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Retrieve the bound schema from the EntityView bound_schema = test_view |> synGetSchema() cat("Retrieved schema from EntityView:\n") bound_schema ## End(Not run)
Get the JSON schema bound to the entity.
synGetSchema(instance, synapse_client=NULL)synGetSchema(instance, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the bound JSON schema.
## Not run: ## Using this function # Retrieving the bound JSON schema from a folder or file. This example demonstrates # how to get existing schema bindings from entities that already have schemas bound. # Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Retrieve the bound schema from the folder bound_schema = test_folder |> synGetSchema() cat("Retrieved schema from folder:\n") bound_schema # Retrieve the bound schema from the file bound_schema_file = example_file |> synGetSchema() cat("Retrieved schema from file:\n") bound_schema_file ## End(Not run)## Not run: ## Using this function # Retrieving the bound JSON schema from a folder or file. This example demonstrates # how to get existing schema bindings from entities that already have schemas bound. # Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Retrieve the bound schema from the folder bound_schema = test_folder |> synGetSchema() cat("Retrieved schema from folder:\n") bound_schema # Retrieve the bound schema from the file bound_schema_file = example_file |> synGetSchema() cat("Retrieved schema from file:\n") bound_schema_file ## End(Not run)
Get the JSON schema bound to the entity.
synGetSchema(instance, synapse_client=NULL)synGetSchema(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the bound JSON schema.
## Not run: ## Using this function # Retrieving the bound JSON schema from a folder or file. This example demonstrates # how to get existing schema bindings from entities that already have schemas bound. # Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Retrieve the bound schema from the folder bound_schema = test_folder |> synGetSchema() cat("Retrieved schema from folder:\n") bound_schema # Retrieve the bound schema from the file bound_schema_file = example_file |> synGetSchema() cat("Retrieved schema from file:\n") bound_schema_file ## End(Not run)## Not run: ## Using this function # Retrieving the bound JSON schema from a folder or file. This example demonstrates # how to get existing schema bindings from entities that already have schemas bound. # Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Retrieve the bound schema from the folder bound_schema = test_folder |> synGetSchema() cat("Retrieved schema from folder:\n") bound_schema # Retrieve the bound schema from the file bound_schema_file = example_file |> synGetSchema() cat("Retrieved schema from file:\n") bound_schema_file ## End(Not run)
Get the JSON schema bound to the entity.
synGetSchema(instance, synapse_client=NULL)synGetSchema(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the bound JSON schema.
## Not run: ## Using this function # Retrieving the bound JSON schema from a project. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project first bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Retrieve the bound schema from the project bound_schema = test_project |> synGetSchema() cat("Retrieved schema from project:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Retrieving the bound JSON schema from a project. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project first bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Retrieve the bound schema from the project bound_schema = test_project |> synGetSchema() cat("Retrieved schema from project:\n") bound_schema ## End(Not run)
Get the JSON schema bound to the entity.
synGetSchema(instance, synapse_client=NULL)synGetSchema(instance, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing details about the bound JSON schema.
## Not run: ## Using this function # Retrieving the bound JSON schema from a table. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table first bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Retrieve the bound schema from the table bound_schema = test_table |> synGetSchema() cat("Retrieved schema from table:\n") bound_schema ## End(Not run)## Not run: ## Using this function # Retrieving the bound JSON schema from a table. This example demonstrates # how to get an existing schema binding from an entity that already has a # schema bound. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table first bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Retrieve the bound schema from the table bound_schema = test_table |> synGetSchema() cat("Retrieved schema from table:\n") bound_schema ## End(Not run)
Retrieve derived JSON schema keys for the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL)synGetSchemaDerivedKeys(instance, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the derived keys for the entity.
## Not run: ## Using this function # Retrieving derived keys from an EntityView. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the EntityView test_view = test_view |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to EntityView and stored\n") derived_keys = test_view |> synGetSchemaDerivedKeys() cat("Derived keys from EntityView:\n") derived_keys ## End(Not run)## Not run: ## Using this function # Retrieving derived keys from an EntityView. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the EntityView test_view = test_view |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to EntityView and stored\n") derived_keys = test_view |> synGetSchemaDerivedKeys() cat("Derived keys from EntityView:\n") derived_keys ## End(Not run)
Retrieve derived JSON schema keys for the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL)synGetSchemaDerivedKeys(instance, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the derived keys for the entity.
## Not run: ## Using this function # Retrieving derived keys from a folder or file. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder with derived annotations:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file with derived annotations:\n") bound_schema_file # Get the derived keys from the bound schema of the folder test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to folder and stored\n") derived_keys = test_folder |> synGetSchemaDerivedKeys() cat("Derived keys from folder:\n") derived_keys # Get the derived keys from the bound schema of the file example_file = example_file |> synSetProperties( annotations = list(foo = "test_value_new", bar = 43L) # Example annotations ) |> synStore() cat("Added annotations to file and stored\n") derived_keys_file = example_file |> synGetSchemaDerivedKeys() cat("Derived keys from file:\n") derived_keys_file ## End(Not run)## Not run: ## Using this function # Retrieving derived keys from a folder or file. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder with derived annotations:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file with derived annotations:\n") bound_schema_file # Get the derived keys from the bound schema of the folder test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to folder and stored\n") derived_keys = test_folder |> synGetSchemaDerivedKeys() cat("Derived keys from folder:\n") derived_keys # Get the derived keys from the bound schema of the file example_file = example_file |> synSetProperties( annotations = list(foo = "test_value_new", bar = 43L) # Example annotations ) |> synStore() cat("Added annotations to file and stored\n") derived_keys_file = example_file |> synGetSchemaDerivedKeys() cat("Derived keys from file:\n") derived_keys_file ## End(Not run)
Retrieve derived JSON schema keys for the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL)synGetSchemaDerivedKeys(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the derived keys for the entity.
## Not run: ## Using this function # Retrieving derived keys from a folder or file. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder with derived annotations:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file with derived annotations:\n") bound_schema_file # Get the derived keys from the bound schema of the folder test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to folder and stored\n") derived_keys = test_folder |> synGetSchemaDerivedKeys() cat("Derived keys from folder:\n") derived_keys # Get the derived keys from the bound schema of the file example_file = example_file |> synSetProperties( annotations = list(foo = "test_value_new", bar = 43L) # Example annotations ) |> synStore() cat("Added annotations to file and stored\n") derived_keys_file = example_file |> synGetSchemaDerivedKeys() cat("Derived keys from file:\n") derived_keys_file ## End(Not run)## Not run: ## Using this function # Retrieving derived keys from a folder or file. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder with derived annotations:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file with derived annotations:\n") bound_schema_file # Get the derived keys from the bound schema of the folder test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to folder and stored\n") derived_keys = test_folder |> synGetSchemaDerivedKeys() cat("Derived keys from folder:\n") derived_keys # Get the derived keys from the bound schema of the file example_file = example_file |> synSetProperties( annotations = list(foo = "test_value_new", bar = 43L) # Example annotations ) |> synStore() cat("Added annotations to file and stored\n") derived_keys_file = example_file |> synGetSchemaDerivedKeys() cat("Derived keys from file:\n") derived_keys_file ## End(Not run)
Retrieve derived JSON schema keys for the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL)synGetSchemaDerivedKeys(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the derived keys for the entity.
## Not run: ## Using this function # Retrieving derived keys from a project. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the project test_project = test_project |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to project and stored\n") derived_keys = test_project |> synGetSchemaDerivedKeys() cat("Derived keys from project:\n") derived_keys ## End(Not run)## Not run: ## Using this function # Retrieving derived keys from a project. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the project test_project = test_project |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42L) # Example annotations ) |> synStore() cat("Added annotations to project and stored\n") derived_keys = test_project |> synGetSchemaDerivedKeys() cat("Derived keys from project:\n") derived_keys ## End(Not run)
Retrieve derived JSON schema keys for the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL)synGetSchemaDerivedKeys(instance, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
An object containing the derived keys for the entity.
## Not run: ## Using this function # Retrieving derived keys from a table. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the table test_table = test_table |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to table and stored\n") derived_keys = test_table |> synGetSchemaDerivedKeys() cat("Derived keys from table:\n") derived_keys ## End(Not run)## Not run: ## Using this function # Retrieving derived keys from a table. This example demonstrates # how to get derived annotation keys from schemas with constant values. # Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name DERIVED_TEST_SCHEMA_NAME = "myTestDerivedSchema" # replace with your derived schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, DERIVED_TEST_SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), # Example constant for derived annotation bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = DERIVED_TEST_SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table with derived annotations:\n") bound_schema # Get the derived keys from the bound schema of the table test_table = test_table |> synSetProperties( annotations = list(foo = "test_value_new", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to table and stored\n") derived_keys = test_table |> synGetSchemaDerivedKeys() cat("Derived keys from table:\n") derived_keys ## End(Not run)
Get validation statistics for a container entity.
synGetSchemaValidationStatistics(instance, synapse_client=NULL)synGetSchemaValidationStatistics(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation statistics.
## Not run: ## Using this function # Retrieving validation statistics for a folder. This example demonstrates # how to get validation statistics for a container entity after creating # entities with various validation states. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create a file within the folder with invalid annotations to generate statistics invalid_file1 = File( path = FILE_PATH, parent_id = test_folder$id, annotations = list(foo = 123, bar = "not_an_integer") # both invalid ) |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing stats = test_folder |> synGetSchemaValidationStatistics() cat("Validation statistics:\n") stats ## End(Not run)## Not run: ## Using this function # Retrieving validation statistics for a folder. This example demonstrates # how to get validation statistics for a container entity after creating # entities with various validation states. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create a file within the folder with invalid annotations to generate statistics invalid_file1 = File( path = FILE_PATH, parent_id = test_folder$id, annotations = list(foo = 123, bar = "not_an_integer") # both invalid ) |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing stats = test_folder |> synGetSchemaValidationStatistics() cat("Validation statistics:\n") stats ## End(Not run)
Get validation statistics for a container entity.
synGetSchemaValidationStatistics(instance, synapse_client=NULL)synGetSchemaValidationStatistics(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation statistics.
## Not run: ## Using this function # Retrieving validation statistics for a project. This example demonstrates # how to get validation statistics for a container entity after creating # entities with various validation states. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Create a file within the project with invalid annotations to generate statistics invalid_file = File( path = FILE_PATH, # assumes you have something here or adjust path parent_id = PROJECT_ID ) invalid_file$annotations = list(foo = 123, bar = "not_an_integer") # both invalid invalid_file = invalid_file |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing stats = test_project |> synGetSchemaValidationStatistics() cat("Validation statistics:\n") stats ## End(Not run)## Not run: ## Using this function # Retrieving validation statistics for a project. This example demonstrates # how to get validation statistics for a container entity after creating # entities with various validation states. Set the PROJECT_NAME variable to your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), baz = list(type = "string", const = "example_value"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Create a file within the project with invalid annotations to generate statistics invalid_file = File( path = FILE_PATH, # assumes you have something here or adjust path parent_id = PROJECT_ID ) invalid_file$annotations = list(foo = 123, bar = "not_an_integer") # both invalid invalid_file = invalid_file |> synStore() cat("Created file with invalid annotations\n") Sys.sleep(2) # Allow time for processing stats = test_project |> synGetSchemaValidationStatistics() cat("Validation statistics:\n") stats ## End(Not run)
Gets an existing agent session. Adds the session to the Agent's sessions named list and sets it as the current session.
synGetSession(instance, session_id, synapse_client=NULL)synGetSession(instance, session_id, synapse_client=NULL)
instance |
(Agent) The Agent instance to operate on. |
session_id |
(str) The ID of the session to get. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The existing AgentSession object.
## Not run: ## Get an existing session and send a prompt. # Retrieve an existing session by providing the session ID and calling synGetSession(). # Then, send a prompt to the agent. library(synapser) synLogin() my_session = Agent() |> synGetSession(session_id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)## Not run: ## Get an existing session and send a prompt. # Retrieve an existing session by providing the session ID and calling synGetSession(). # Then, send a prompt to the agent. library(synapser) synLogin() my_session = Agent() |> synGetSession(session_id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)
Get STS (AWS Security Token Service) credentials for direct access to the storage location backing this entity. These credentials can be used with AWS tools such as the AWS CLI.
synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL)synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
permission |
(character) The permission level for the token. Must be 'read_only' or 'read_write'. |
output_format |
(character) The output format for the credentials. Options: |
min_remaining_life |
(Optional[integer]) The minimum remaining life (in seconds) for a cached token before a new one is fetched. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The STS credentials in the requested format.
Raises an error if the entity does not have an id set.
The entity must use a storage location that has STS enabled.
## Not run: ## Using credentials with AWS tools # Get STS credentials for an STS-enabled folder and make them available to # AWS tools (such as the AWS CLI) through the standard environment variables. library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() credentials = folder |> synGetStsStorageToken( permission = "read_write", output_format = "boto" ) Sys.setenv( AWS_ACCESS_KEY_ID = credentials$aws_access_key_id, AWS_SECRET_ACCESS_KEY = credentials$aws_secret_access_key, AWS_SESSION_TOKEN = credentials$aws_session_token ) ## End(Not run)## Not run: ## Using credentials with AWS tools # Get STS credentials for an STS-enabled folder and make them available to # AWS tools (such as the AWS CLI) through the standard environment variables. library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() credentials = folder |> synGetStsStorageToken( permission = "read_write", output_format = "boto" ) Sys.setenv( AWS_ACCESS_KEY_ID = credentials$aws_access_key_id, AWS_SECRET_ACCESS_KEY = credentials$aws_secret_access_key, AWS_SESSION_TOKEN = credentials$aws_session_token ) ## End(Not run)
Get STS (AWS Security Token Service) credentials for direct access to the storage location backing this entity. These credentials can be used with AWS tools such as the AWS CLI.
synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL)synGetStsStorageToken(instance, permission, output_format="json", min_remaining_life=NULL, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
permission |
(character) The permission level for the token. Must be 'read_only' or 'read_write'. |
output_format |
(character) The output format for the credentials. Options: |
min_remaining_life |
(Optional[integer]) The minimum remaining life (in seconds) for a cached token before a new one is fetched. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The STS credentials in the requested format.
Raises an error if the entity does not have an id set.
The entity must use a storage location that has STS enabled.
## Not run: ## Using credentials with AWS tools # Get STS credentials for an STS-enabled project and make them available to # AWS tools (such as the AWS CLI) through the standard environment variables. library(synapser) synLogin() project = Project(id = "syn123") |> synGet() credentials = project |> synGetStsStorageToken( permission = "read_write", output_format = "boto" ) Sys.setenv( AWS_ACCESS_KEY_ID = credentials$aws_access_key_id, AWS_SECRET_ACCESS_KEY = credentials$aws_secret_access_key, AWS_SESSION_TOKEN = credentials$aws_session_token ) ## End(Not run)## Not run: ## Using credentials with AWS tools # Get STS credentials for an STS-enabled project and make them available to # AWS tools (such as the AWS CLI) through the standard environment variables. library(synapser) synLogin() project = Project(id = "syn123") |> synGet() credentials = project |> synGetStsStorageToken( permission = "read_write", output_format = "boto" ) Sys.setenv( AWS_ACCESS_KEY_ID = credentials$aws_access_key_id, AWS_SECRET_ACCESS_KEY = credentials$aws_secret_access_key, AWS_SESSION_TOKEN = credentials$aws_session_token ) ## End(Not run)
Gets the number of Submissions for a specified Evaluation queue.
synGetSubmissionCount(evaluation_id, synapse_client=NULL)synGetSubmissionCount(evaluation_id, synapse_client=NULL)
evaluation_id |
(character) The ID of the evaluation queue. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The API response containing the submission count.
## Not run: ## Getting submission count # Get the total number of submissions from a specific evaluation. library(synapser) synLogin() response = synGetSubmissionCount(evaluation_id = "9999999") print(response) ## End(Not run)## Not run: ## Getting submission count # Get the total number of submissions from a specific evaluation. library(synapser) synLogin() response = synGetSubmissionCount(evaluation_id = "9999999") print(response) ## End(Not run)
Gets the TeamMembers associated with a team given the ID field on the Team instance.
synGetTeamMembers(instance, synapse_client=NULL)synGetTeamMembers(instance, synapse_client=NULL)
instance |
(Team) The Team instance to operate on. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
List[TeamMember]: A List of TeamMember objects.
## Not run: ## List the members of a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) members = team |> synGetTeamMembers() for (member in members) { cat(sprintf("%s (admin: %s)\n", member$member$user_name, member$is_admin)) } ## End(Not run)## Not run: ## List the members of a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) members = team |> synGetTeamMembers() for (member in members) { cat(sprintf("%s (admin: %s)\n", member$member$user_name, member$is_admin)) } ## End(Not run)
Retrieve a user's Team Membership Status bundle for this team.
synGetUserMembershipStatus(instance, user_id, synapse_client=NULL)synGetUserMembershipStatus(instance, user_id, synapse_client=NULL)
instance |
(Team) The Team instance to operate on. |
user_id |
(character) Synapse user ID |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
TeamMembershipStatus object
## Not run: ## Check if a user is a member of a team # This example shows how to check a user's membership status in a team. library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) # Check membership status for a specific user user_id = "3350396" # Replace with actual user ID status = team |> synGetUserMembershipStatus(user_id = user_id) cat("User ID:", status$user_id, "\n") cat("Is member:", status$is_member, "\n") cat("Can join:", status$can_join, "\n") cat("Has open invitation:", status$has_open_invitation, "\n") cat("Has open request:", status$has_open_request, "\n") cat("Membership approval required:", status$membership_approval_required, "\n") ## End(Not run)## Not run: ## Check if a user is a member of a team # This example shows how to check a user's membership status in a team. library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) # Check membership status for a specific user user_id = "3350396" # Replace with actual user ID status = team |> synGetUserMembershipStatus(user_id = user_id) cat("User ID:", status$user_id, "\n") cat("Is member:", status$is_member, "\n") cat("Can join:", status$can_join, "\n") cat("Has open invitation:", status$has_open_invitation, "\n") cat("Has open request:", status$has_open_request, "\n") cat("Membership approval required:", status$membership_approval_required, "\n") ## End(Not run)
Retrieves all user bundled Submissions and SubmissionStatuses for a specified Evaluation.
synGetUserSubmissionBundles(cls, evaluation_id, synapse_client=NULL)synGetUserSubmissionBundles(cls, evaluation_id, synapse_client=NULL)
cls |
(SubmissionBundle) The SubmissionBundle class (or an existing SubmissionBundle instance) to dispatch this call to. |
evaluation_id |
(character) The ID of the specified Evaluation. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields SubmissionBundle objects as they are retrieved from the API. Use as.list() to materialize all results into a list, or nextElem() to retrieve one SubmissionBundle at a time.
## Not run: ## Getting user submission bundles library(synapser) synLogin() bundles = as.list(SubmissionBundle() |> synGetUserSubmissionBundles( evaluation_id = "9999999" )) print(sprintf("Found %d user submission bundles", length(bundles))) for (bundle in bundles) { print(sprintf("Submission ID: %s", bundle$submission$id)) } ## End(Not run)## Not run: ## Getting user submission bundles library(synapser) synLogin() bundles = as.list(SubmissionBundle() |> synGetUserSubmissionBundles( evaluation_id = "9999999" )) print(sprintf("Found %d user submission bundles", length(bundles))) for (bundle in bundles) { print(sprintf("Submission ID: %s", bundle$submission$id)) } ## End(Not run)
Retrieves all user Submissions for a specified Evaluation queue.
synGetUserSubmissions(cls, evaluation_id, synapse_client=NULL)synGetUserSubmissions(cls, evaluation_id, synapse_client=NULL)
cls |
(Submission) The Submission class (or an existing Submission instance) to dispatch this call to. |
evaluation_id |
(character) The ID of the evaluation queue. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields Submission objects as they are retrieved from the API. Use as.list() to materialize all results into a list, or nextElem() to retrieve one Submission at a time.
## Not run: ## Getting user submissions library(synapser) synLogin() submissions = as.list(Submission() |> synGetUserSubmissions( evaluation_id = "9999999" )) print(sprintf("Found %d user submissions", length(submissions))) ## End(Not run)## Not run: ## Getting user submissions library(synapser) synLogin() submissions = as.list(Submission() |> synGetUserSubmissions( evaluation_id = "9999999" )) print(sprintf("Found %d user submissions", length(submissions))) ## End(Not run)
Index files in this entity for migration to a new storage location.
This is the first step in migrating files to a new storage location.
After indexing, use synMigrateIndexedFiles() to perform the actual migration.
synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL)synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
dest_storage_location_id |
(integer) The destination storage location ID. |
db_path |
(Optional[character]) Path to the SQLite database file for tracking migration state. If not provided, a temporary directory will be used. The path can be retrieved from the |
source_storage_location_ids |
(Optional[list[integer]]) Optional list of source storage location IDs to filter which files to migrate. If NULL, all files are indexed. |
file_version_strategy |
(character) Strategy for handling file versions. Options: 'new' (default) - create new versions, 'all' - migrate all versions, 'latest' - only migrate latest version, 'skip' - skip if file exists. |
include_table_files |
(logical) Whether to include files attached to tables. |
continue_on_error |
(logical) Whether to continue indexing if an error occurs. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A MigrationResult object containing indexing statistics and the database
path (accessible via result$db_path).
## Not run: ## Indexing files for migration # Index files in a folder for migration: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() result = folder |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) print(sprintf("Database path: %s", result$db_path)) print(result$counts_by_status) ## End(Not run)## Not run: ## Indexing files for migration # Index files in a folder for migration: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() result = folder |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) print(sprintf("Database path: %s", result$db_path)) print(result$counts_by_status) ## End(Not run)
Index files in this entity for migration to a new storage location.
This is the first step in migrating files to a new storage location.
After indexing, use synMigrateIndexedFiles() to perform the actual migration.
synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL)synIndexFilesForMigration(instance, dest_storage_location_id, db_path=NULL, source_storage_location_ids=NULL, file_version_strategy="new", include_table_files=FALSE, continue_on_error=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
dest_storage_location_id |
(integer) The destination storage location ID. |
db_path |
(Optional[character]) Path to the SQLite database file for tracking migration state. If not provided, a temporary directory will be used. The path can be retrieved from the |
source_storage_location_ids |
(Optional[list[integer]]) Optional list of source storage location IDs to filter which files to migrate. If NULL, all files are indexed. |
file_version_strategy |
(character) Strategy for handling file versions. Options: 'new' (default) - create new versions, 'all' - migrate all versions, 'latest' - only migrate latest version, 'skip' - skip if file exists. |
include_table_files |
(logical) Whether to include files attached to tables. |
continue_on_error |
(logical) Whether to continue indexing if an error occurs. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A MigrationResult object containing indexing statistics and the database
path (accessible via result$db_path).
## Not run: ## Indexing files for migration # Index files in a project for migration: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() result = project |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) print(sprintf("Database path: %s", result$db_path)) print(result$counts_by_status) ## End(Not run)## Not run: ## Indexing files for migration # Index files in a project for migration: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() result = project |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) print(sprintf("Database path: %s", result$db_path)) print(result$counts_by_status) ## End(Not run)
Invites a user to a team given the ID field on the Team instance.
synInviteToTeam(instance, user, message, force=TRUE, synapse_client=NULL)synInviteToTeam(instance, user, message, force=TRUE, synapse_client=NULL)
instance |
(Team) The Team instance to operate on. |
user |
The username or ID of the user to invite. |
message |
(character) The message to send. |
force |
(logical) If TRUE, will send the invite even if the user is already a member or has an open invitation. If FALSE, will not send the invite if the user is already a member or has an open invitation. Defaults to TRUE. |
synapse_client |
(Optional[Synapse]) If not provided, the last created instance from the Synapse class constructor will be used. |
The invite response or NULL if an invite was not sent.
## Not run: ## Invite a user to a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) team |> synInviteToTeam(user = "my_username", message = "Please join my team!") ## End(Not run)## Not run: ## Invite a user to a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) team |> synInviteToTeam(user = "my_username", message = "Please join my team!") ## End(Not run)
Determine whether a user is certified.
synIsCertified(instance, synapse_client=NULL)synIsCertified(instance, synapse_client=NULL)
instance |
(UserProfile) The UserProfile instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
TRUE if the user is certified, FALSE otherwise.
An error is raised if neither id nor username is specified.
## Not run: ## Using this function # Check whether a user is certified is_certified = UserProfile(username = "myUsername") |> synIsCertified() ## End(Not run)## Not run: ## Using this function # Check whether a user is certified is_certified = UserProfile(username = "myUsername") |> synIsCertified() ## End(Not run)
Check if given synID is valid (attached to actual entity).
synIsSynapseId(syn_id, synapse_client=NULL)synIsSynapseId(syn_id, synapse_client=NULL)
syn_id |
(str) A Synapse ID to validate. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
TRUE if the Synapse ID is valid.
## Not run: ## Example 1: Validating a Synapse ID # Check if a Synapse ID exists: library(synapser) synLogin() if (synIsSynapseId("syn123456")) { print("Valid Synapse ID") } else { print("Invalid or non-existent Synapse ID") } ## Example 2: Validating multiple IDs # Check multiple Synapse IDs in a loop: library(synapser) synLogin() ids_to_check = list("syn123456", "syn999999", "syn789012") for (synapse_id in ids_to_check) { if (synIsSynapseId(synapse_id)) { print(sprintf("%s is valid", synapse_id)) } else { print(sprintf("%s is invalid or does not exist", synapse_id)) } } ## Example 3: Using in conditional logic # Use ID validation before attempting operations: library(synapser) synLogin() user_input = "syn123456" if (synIsSynapseId(user_input)) { entity = synGet(synapse_id = user_input) print(sprintf("Retrieved entity: %s", entity$name)) } else { print("Please provide a valid Synapse ID") } ## End(Not run)## Not run: ## Example 1: Validating a Synapse ID # Check if a Synapse ID exists: library(synapser) synLogin() if (synIsSynapseId("syn123456")) { print("Valid Synapse ID") } else { print("Invalid or non-existent Synapse ID") } ## Example 2: Validating multiple IDs # Check multiple Synapse IDs in a loop: library(synapser) synLogin() ids_to_check = list("syn123456", "syn999999", "syn789012") for (synapse_id in ids_to_check) { if (synIsSynapseId(synapse_id)) { print(sprintf("%s is valid", synapse_id)) } else { print(sprintf("%s is invalid or does not exist", synapse_id)) } } ## Example 3: Using in conditional logic # Use ID validation before attempting operations: library(synapser) synLogin() user_input = "syn123456" if (synIsSynapseId(user_input)) { entity = synGet(synapse_id = user_input) print(sprintf("Retrieved entity: %s", entity$name)) } else { print("Please provide a valid Synapse ID") } ## End(Not run)
List columns with optional prefix filtering.
synList(prefix=NULL, limit=100L, offset=0L, synapse_client=NULL)synList(prefix=NULL, limit=100L, offset=0L, synapse_client=NULL)
prefix |
(Optional[str]) Optional prefix to filter columns by name. |
limit |
(int) Number of columns to retrieve per request to Synapse (pagination parameter). The function will continue retrieving results until all matching columns are returned. |
offset |
(int) The index of the first column to return (pagination parameter). |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields Column instances. Use as.list() to materialize all results into a list, or nextElem() to retrieve one Column instance at a time.
## Not run: ## Example 1: Getting all columns # This example shows how you may list all columns. library(synapser) synLogin() columns = synList() for (column in as.list(columns)) { print(column$name) } ## Example 2: Getting columns with a prefix # This example shows how you may list columns filtered by a name prefix. library(synapser) synLogin() columns = synList(prefix = "my_prefix") for (column in as.list(columns)) { print(column$name) } ## End(Not run)## Not run: ## Example 1: Getting all columns # This example shows how you may list all columns. library(synapser) synLogin() columns = synList() for (column in as.list(columns)) { print(column$name) } ## Example 2: Getting columns with a prefix # This example shows how you may list columns filtered by a name prefix. library(synapser) synLogin() columns = synList(prefix = "my_prefix") for (column in as.list(columns)) { print(column$name) } ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
recursive |
(logical) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(logical) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[character]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(logical) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- all_entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Dataset(id = "syn123") |> synListAcl() print(acl_result) # Access entity ACLs (all_entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { print(sprintf("Principal 273948 has permissions: %s", paste(unlist(acl_entry$permissions), collapse = ", "))) } } } } # I can also access the ACL for the dataset itself print(acl_result$entity_acl) print(acl_result) ## Example 2: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. If the dataset has no local sharing settings, # there are no ACLs to display and no tree is produced. library(synapser) synLogin() acl_result = Dataset(id = "syn123") |> synListAcl( log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree print(acl_result$ascii_tree) ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Dataset(id = "syn123") |> synListAcl() print(acl_result) # Access entity ACLs (all_entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { print(sprintf("Principal 273948 has permissions: %s", paste(unlist(acl_entry$permissions), collapse = ", "))) } } } } # I can also access the ACL for the dataset itself print(acl_result$entity_acl) print(acl_result) ## Example 2: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. If the dataset has no local sharing settings, # there are no ACLs to display and no tree is produced. library(synapser) synLogin() acl_result = Dataset(id = "syn123") |> synListAcl( log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree print(acl_result$ascii_tree) ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
recursive |
(logical) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(logical) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[character]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(logical) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- all_entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = DatasetCollection(id = "syn123") |> synListAcl() print(acl_result) # Access entity ACLs (all_entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { print(sprintf("Principal 273948 has permissions: %s", paste(unlist(acl_entry$permissions), collapse = ", "))) } } } } # I can also access the ACL for the dataset collection itself print(acl_result$entity_acl) print(acl_result) ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (all_entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { print(sprintf("Entity %s has ACL with %d principals", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself print(acl_result$entity_acl) # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree print(acl_result$ascii_tree) ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = DatasetCollection(id = "syn123") |> synListAcl() print(acl_result) # Access entity ACLs (all_entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { print(sprintf("Principal 273948 has permissions: %s", paste(unlist(acl_entry$permissions), collapse = ", "))) } } } } # I can also access the ACL for the dataset collection itself print(acl_result$entity_acl) print(acl_result) ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (all_entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { print(sprintf("Entity %s has ACL with %d principals", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself print(acl_result$entity_acl) # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree print(acl_result$ascii_tree) ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = EntityView(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the EntityView itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (all_entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = EntityView(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the EntityView itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (all_entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = File(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = File(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the folder itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the folder itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(MaterializedView) The MaterializedView instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = MaterializedView(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = MaterializedView(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Project(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Project(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = SubmissionView(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = SubmissionView(id = "syn123") |> synListAcl() acl_result # Access entity ACLs (entity_acls is a list, not a named list) for (entity_acl in acl_result$all_entity_acls) { if (entity_acl$entity_id == "syn123") { # Access individual ACL entries for (acl_entry in entity_acl$acl_entries) { if (acl_entry$principal_id == "273948") { cat(sprintf("Principal 273948 has permissions: %s\n", acl_entry$permissions)) } } } } # I can also access the ACL for the file itself acl_result$entity_acl acl_result ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Table(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = Table(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not the effective permissions that each Synapse User ID/Team has on the entities. More permissive permissions could be granted via a Team that the user has access to that has permissions on the entity, or through inheritance from parent entities.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL)
instance |
(VirtualTable) The VirtualTable instance to operate on. |
recursive |
(bool) If TRUE and the entity is a container (e.g., Project or Folder), recursively process child containers. Note that this must be used with include_container_content=TRUE to have any effect. Setting recursive=TRUE with include_container_content=FALSE will raise an error. Only works on classes that support the |
include_container_content |
(bool) If TRUE, include ACLs from contents directly within containers (files and folders inside self). This must be set to TRUE for recursive to have any effect. Defaults to FALSE. |
target_entity_types |
(Optional[list[str]]) Specify which entity types to process when listing ACLs. Allowed values are "folder", "file", "project", "table", "entityview", "materializedview", "virtualtable", "dataset", "datasetcollection", "submissionview" (case-insensitive). If NULL, defaults to list("folder", "file"). |
log_tree |
(bool) If TRUE, logs the ACL results to console in ASCII tree format showing entity hierarchies and their ACL permissions in a tree-like structure. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An AclListResult object containing a structured representation of ACLs where:
- entity_acls: A list of EntityAcl objects, each representing one entity's ACL
- Each EntityAcl contains acl_entries (a list of AclEntry objects)
- Each AclEntry contains the principal_id and their list of permissions
- An error is raised if the entity does not have an ID or if an invalid entity type is provided.
- An error is also raised if there are permission issues accessing ACLs.
- An error may also be raised for any other issues that occur during the process.
## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = VirtualTable(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)## Not run: ## Example 1: List ACLs for a single entity library(synapser) synLogin() acl_result = VirtualTable(id = "syn123") |> synListAcl() acl_result # I can also access the ACL for the file itself acl_result$entity_acl ## Example 2: List ACLs recursively for a folder and all its children library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE ) # Access each entity's ACL (entity_acls is a list) for (entity_acl in acl_result$all_entity_acls) { cat(sprintf("Entity %s has ACL with %d principals\n", entity_acl$entity_id, length(entity_acl$acl_entries))) } # I can also access the ACL for the folder itself acl_result$entity_acl # List ACLs for only folder entities folder_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("folder") ) # List ACLs for specific entity types (e.g., tables and views) table_view_acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, target_entity_types = list("table", "entityview", "materializedview") ) ## Example 3: List ACLs with ASCII tree visualization # When log_tree = TRUE, the ACLs will be logged in a tree format. Additionally, # the ascii_tree attribute of the AclListResult will contain the ASCII tree # representation of the ACLs. library(synapser) synLogin() acl_result = Folder(id = "syn123") |> synListAcl( recursive = TRUE, include_container_content = TRUE, log_tree = TRUE # Enable ASCII tree logging ) # The ASCII tree representation of the ACLs will also be available # in acl_result$ascii_tree acl_result$ascii_tree ## End(Not run)
Valid combinations of synLogin() arguments:
- authToken
- Profile-based authentication (from .synapseConfig)
If no login arguments are provided or only username is provided, synLogin() will attempt to log in using information from these sources (in order of preference):
1. .synapseConfig file (supports multiple profiles)(in user home folder unless configured otherwise)
2. User defined arguments during a CLI session
3. User's Personal Access Token (aka: Synapse Auth Token)
from the environment variable: SYNAPSE_AUTH_TOKEN
4. Retrieves user's authentication token from AWS SSM Parameter store (if configured)
synLogin(email=NULL, silent=FALSE, authToken=NULL, profile="default")synLogin(email=NULL, silent=FALSE, authToken=NULL, profile="default")
email |
(str) Synapse user name (or an email address associated with a Synapse account) |
silent |
(bool) Defaults to FALSE. Suppresses the "Welcome ...!" message. |
authToken |
(str) A bearer authorization token, e.g. a personal access token. |
profile |
(str) Profile to use from .synapseConfig (default: "default"). |
NULL
## Not run: ## Logging in library(synapser) # Logging in using a specific profile: synLogin(profile = "user1") # Prints: Welcome, username! You are using the user1 profile # Logging in with an authentication token: synLogin(authToken = "your_auth_token") # Prints: Welcome, username! ## End(Not run)## Not run: ## Logging in library(synapser) # Logging in using a specific profile: synLogin(profile = "user1") # Prints: Welcome, username! You are using the user1 profile # Logging in with an authentication token: synLogin(authToken = "your_auth_token") # Prints: Welcome, username! ## End(Not run)
Removes authentication information from the Synapse client.
synLogout()synLogout()
NULL
## Not run: ## Logging out library(synapser) synLogin() # ... work with Synapse ... synLogout() ## End(Not run)## Not run: ## Logging out library(synapser) synLogin() # ... work with Synapse ... synLogout() ## End(Not run)
Recursively loop over all of the already retrieved files and folders. Then return back a named list where the key is the path to the directory at each level. The value is a list of all files in that directory AND all files in the child directories.
This is used during the creation of the manifest TSV file during the syncFromSynapse utility function.
synMapDirectoryToAllContainedFiles(instance, root_path)synMapDirectoryToAllContainedFiles(instance, root_path)
instance |
(Folder) The Folder instance to operate on. |
root_path |
(str) The root path where the top level files are stored. |
A named list where the key is the path to the directory at each level. The value is a list of all files in that directory AND all files in the child directories.
## Not run: ## Using this function # Returning back a named list with 2 keys: # # Given: # root_folder # |-- sub_folder # | |-- file1.txt # | `-- file2.txt # # Returns: # list( # "root_folder" = list(file1, file2), # "root_folder/sub_folder" = list(file1, file2) # ) # Returning back a named list with 3 keys: # # Given: # root_folder # |-- sub_folder_1 # | |-- file1.txt # |-- sub_folder_2 # | `-- file2.txt # # Returns: # list( # "root_folder" = list(file1, file2), # "root_folder/sub_folder_1" = list(file1), # "root_folder/sub_folder_2" = list(file2) # ) ## End(Not run)## Not run: ## Using this function # Returning back a named list with 2 keys: # # Given: # root_folder # |-- sub_folder # | |-- file1.txt # | `-- file2.txt # # Returns: # list( # "root_folder" = list(file1, file2), # "root_folder/sub_folder" = list(file1, file2) # ) # Returning back a named list with 3 keys: # # Given: # root_folder # |-- sub_folder_1 # | |-- file1.txt # |-- sub_folder_2 # | `-- file2.txt # # Returns: # list( # "root_folder" = list(file1, file2), # "root_folder/sub_folder_1" = list(file1), # "root_folder/sub_folder_2" = list(file2) # ) ## End(Not run)
Recursively loop over all of the already retrieved files and folders. Then return back a named list where the key is the path to the directory at each level. The value is a list of all files in that directory AND all files in the child directories.
This is used during the creation of the manifest TSV file during the syncFromSynapse utility function.
synMapDirectoryToAllContainedFiles(instance, root_path)synMapDirectoryToAllContainedFiles(instance, root_path)
instance |
(Project) The Project instance to operate on. |
root_path |
(str) The root path where the top level files are stored. |
A named list where the key is the path to the directory at each level. The value is a list of all files in that directory AND all files in the child directories.
## Not run: ## Using this function # Returning back a named list with 2 keys: # # Given: # root_folder # |-- sub_folder # | |-- file1.txt # | `-- file2.txt # # Returns: # list( # root_folder = list(file1, file2), # "root_folder/sub_folder" = list(file1, file2) # ) # # # Returning back a named list with 3 keys: # # Given: # root_folder # |-- sub_folder_1 # | |-- file1.txt # |-- sub_folder_2 # | `-- file2.txt # # Returns: # list( # root_folder = list(file1, file2), # "root_folder/sub_folder_1" = list(file1), # "root_folder/sub_folder_2" = list(file2) # ) ## End(Not run)## Not run: ## Using this function # Returning back a named list with 2 keys: # # Given: # root_folder # |-- sub_folder # | |-- file1.txt # | `-- file2.txt # # Returns: # list( # root_folder = list(file1, file2), # "root_folder/sub_folder" = list(file1, file2) # ) # # # Returning back a named list with 3 keys: # # Given: # root_folder # |-- sub_folder_1 # | |-- file1.txt # |-- sub_folder_2 # | `-- file2.txt # # Returns: # list( # root_folder = list(file1, file2), # "root_folder/sub_folder_1" = list(file1), # "root_folder/sub_folder_2" = list(file2) # ) ## End(Not run)
Find the Entities which have attached file(s) which have the given MD5 hash.
synMd5Query(md5, synapse_client=NULL)synMd5Query(md5, synapse_client=NULL)
md5 |
(str) The MD5 hash to query for (hexadecimal string). |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of Entity headers matching the MD5 hash.
## Not run: ## Example 1: Finding entities by MD5 hash # Search for entities with a specific MD5 hash: library(synapser) synLogin() md5_hash = "1234567890abcdef1234567890abcdef" results = synMd5Query(md5_hash) print(sprintf("Found %d entities with MD5: %s", length(results), md5_hash)) for (entity in results) { print(sprintf("- %s: %s", entity$id, entity$name)) } ## Example 2: Checking for duplicate files # Use MD5 query to find duplicate files before uploading: library(synapser) synLogin() # Calculate MD5 of a local file file_path = "/path/to/file.txt" file_md5 = unname(tools::md5sum(file_path)) # Check if file already exists in Synapse existing_entities = synMd5Query(file_md5) if (length(existing_entities) > 0) { print("File already exists in Synapse:") for (entity in existing_entities) { print(sprintf("- %s: %s", entity$id, entity$name)) } } else { print("File is unique, safe to upload") } ## Example 3: Finding all versions of a file # Find all entities that share the same content (MD5): library(synapser) synLogin() # Get MD5 from a known file file = synGet(synapse_id = "syn123456") if (!is.null(file$file_handle)) { file_md5 = file$file_handle$content_md5 # Find all entities with the same MD5 matching_entities = synMd5Query(file_md5) print(sprintf("Found %d entities with same content:", length(matching_entities))) for (entity in matching_entities) { parent_id = if (!is.null(entity$parentId)) entity$parentId else "unknown" print(sprintf("- %s: %s in %s", entity$id, entity$name, parent_id)) } } ## End(Not run)## Not run: ## Example 1: Finding entities by MD5 hash # Search for entities with a specific MD5 hash: library(synapser) synLogin() md5_hash = "1234567890abcdef1234567890abcdef" results = synMd5Query(md5_hash) print(sprintf("Found %d entities with MD5: %s", length(results), md5_hash)) for (entity in results) { print(sprintf("- %s: %s", entity$id, entity$name)) } ## Example 2: Checking for duplicate files # Use MD5 query to find duplicate files before uploading: library(synapser) synLogin() # Calculate MD5 of a local file file_path = "/path/to/file.txt" file_md5 = unname(tools::md5sum(file_path)) # Check if file already exists in Synapse existing_entities = synMd5Query(file_md5) if (length(existing_entities) > 0) { print("File already exists in Synapse:") for (entity in existing_entities) { print(sprintf("- %s: %s", entity$id, entity$name)) } } else { print("File is unique, safe to upload") } ## Example 3: Finding all versions of a file # Find all entities that share the same content (MD5): library(synapser) synLogin() # Get MD5 from a known file file = synGet(synapse_id = "syn123456") if (!is.null(file$file_handle)) { file_md5 = file$file_handle$content_md5 # Find all entities with the same MD5 matching_entities = synMd5Query(file_md5) print(sprintf("Found %d entities with same content:", length(matching_entities))) for (entity in matching_entities) { parent_id = if (!is.null(entity$parentId)) entity$parentId else "unknown" print(sprintf("- %s: %s in %s", entity$id, entity$name, parent_id)) } } ## End(Not run)
Migrate files that have been indexed with synIndexFilesForMigration().
This is the second step in migrating files to a new storage location.
Files must first be indexed using synIndexFilesForMigration().
Interactive confirmation: When called from an interactive shell and
force=FALSE (the default), this function will print the number of items
queued for migration and prompt for confirmation before proceeding. If
standard output is not connected to an interactive terminal (e.g. a script
or CI environment), migration is aborted unless force=TRUE is set.
synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL)synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
db_path |
(character) Path to the SQLite database file created by |
create_table_snapshots |
(logical) Whether to create table snapshots before migrating table files. |
continue_on_error |
(logical) Whether to continue migration if an error occurs. |
force |
(logical) Skip the interactive confirmation prompt and proceed with migration automatically. Set to |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A MigrationResult object containing migration statistics, or NULL
if migration was aborted (user declined the confirmation prompt, or
the session is non-interactive and force=FALSE).
## Not run: ## Migrating indexed files # Migrate previously indexed files: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() # Index first index_result = folder |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) # Then migrate using the db_path from the index result result = folder |> synMigrateIndexedFiles( db_path = index_result$db_path, force = TRUE # Skip interactive confirmation ) print(result$counts_by_status) ## End(Not run)## Not run: ## Migrating indexed files # Migrate previously indexed files: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() # Index first index_result = folder |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) # Then migrate using the db_path from the index result result = folder |> synMigrateIndexedFiles( db_path = index_result$db_path, force = TRUE # Skip interactive confirmation ) print(result$counts_by_status) ## End(Not run)
Migrate files that have been indexed with synIndexFilesForMigration().
This is the second step in migrating files to a new storage location.
Files must first be indexed using synIndexFilesForMigration().
Interactive confirmation: When called from an interactive shell and
force=FALSE (the default), this function will print the number of items
queued for migration and prompt for confirmation before proceeding. If
standard output is not connected to an interactive terminal (e.g. a script
or CI environment), migration is aborted unless force=TRUE is set.
synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL)synMigrateIndexedFiles(instance, db_path, create_table_snapshots=TRUE, continue_on_error=FALSE, force=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
db_path |
(character) Path to the SQLite database file created by |
create_table_snapshots |
(logical) Whether to create table snapshots before migrating table files. |
continue_on_error |
(logical) Whether to continue migration if an error occurs. |
force |
(logical) Skip the interactive confirmation prompt and proceed with migration automatically. Set to |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A MigrationResult object containing migration statistics, or NULL
if migration was aborted (user declined the confirmation prompt, or
the session is non-interactive and force=FALSE).
## Not run: ## Migrating indexed files # Migrate previously indexed files: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() # Index first index_result = project |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) # Then migrate using the db_path from the index result result = project |> synMigrateIndexedFiles( db_path = index_result$db_path, force = TRUE # Skip interactive confirmation ) print(result$counts_by_status) ## End(Not run)## Not run: ## Migrating indexed files # Migrate previously indexed files: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() # Index first index_result = project |> synIndexFilesForMigration( dest_storage_location_id = 12345L ) # Then migrate using the db_path from the index result result = project |> synMigrateIndexedFiles( db_path = index_result$db_path, force = TRUE # Skip interactive confirmation ) print(result$counts_by_status) ## End(Not run)
Open up a browser window to the entity page or wiki-subpage.
synOnweb(entity, subpage_id=NULL, synapse_client=NULL)synOnweb(entity, subpage_id=NULL, synapse_client=NULL)
entity |
(Union[str, Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable]) Either an Entity object (Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable) or a Synapse ID string. |
subpage_id |
(Optional[str]) (Optional) ID of one of the wiki's sub-pages. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The URL that was opened in the browser.
## Not run: ## Example 1: Opening an entity in browser # Open an entity's page in the default web browser: library(synapser) synLogin() # Open by Synapse ID url = synOnweb("syn123456") print(sprintf("Opened: %s", url)) ## Example 2: Opening with an entity object # Open an entity using an entity object: library(synapser) synLogin() file = synGet(synapse_id = "syn123456") url = synOnweb(file) print(sprintf("Opened file: %s", url)) ## Example 3: Opening a wiki subpage # Open a specific wiki subpage: library(synapser) synLogin() # Open a specific wiki subpage url = synOnweb("syn123456", subpage_id = "12345") print(sprintf("Opened wiki subpage: %s", url)) ## End(Not run)## Not run: ## Example 1: Opening an entity in browser # Open an entity's page in the default web browser: library(synapser) synLogin() # Open by Synapse ID url = synOnweb("syn123456") print(sprintf("Opened: %s", url)) ## Example 2: Opening with an entity object # Open an entity using an entity object: library(synapser) synLogin() file = synGet(synapse_id = "syn123456") url = synOnweb(file) print(sprintf("Opened file: %s", url)) ## Example 3: Opening a wiki subpage # Open a specific wiki subpage: library(synapser) synLogin() # Open a specific wiki subpage url = synOnweb("syn123456", subpage_id = "12345") print(sprintf("Opened wiki subpage: %s", url)) ## End(Not run)
Pretty print an Entity as JSON.
synPrintEntity(entity, ensure_ascii=TRUE, synapse_client=NULL)synPrintEntity(entity, ensure_ascii=TRUE, synapse_client=NULL)
entity |
(Union[str, dict, Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable]) Either an Entity object (Dataset, DatasetCollection, EntityView, File, Folder, Link, MaterializedView, Project, RecordSet, SearchIndex, SubmissionView, Table, VirtualTable), a Synapse ID string, or a named list representation of an entity. |
ensure_ascii |
(bool) If TRUE, escapes all non-ASCII characters in the output. Defaults to TRUE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL. Prints the entity to the logger.
## Not run: ## Example 1: Printing an entity by ID # Print an entity using its Synapse ID: library(synapser) synLogin() # Print entity by Synapse ID synPrintEntity("syn123456") ## Example 2: Printing an entity object # Print an entity object: library(synapser) synLogin() # Get and print a file entity file = synGet(synapse_id = "syn123456") synPrintEntity(file) ## Example 3: Controlling ASCII output # Print an entity with non-ASCII characters: library(synapser) synLogin() # Print with unicode characters preserved synPrintEntity("syn123456", ensure_ascii = FALSE) ## End(Not run)## Not run: ## Example 1: Printing an entity by ID # Print an entity using its Synapse ID: library(synapser) synLogin() # Print entity by Synapse ID synPrintEntity("syn123456") ## Example 2: Printing an entity object # Print an entity object: library(synapser) synLogin() # Get and print a file entity file = synGet(synapse_id = "syn123456") synPrintEntity(file) ## Example 3: Controlling ASCII output # Print an entity with non-ASCII characters: library(synapser) synLogin() # Print with unicode characters preserved synPrintEntity("syn123456", ensure_ascii = FALSE) ## End(Not run)
Sends a prompt to the agent for the current session. If no session is currently active, a new session will be started.
synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, session=NULL, newer_than=NULL, timeout=120L, synapse_client=NULL)synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, session=NULL, newer_than=NULL, timeout=120L, synapse_client=NULL)
instance |
(Agent) The Agent instance to operate on. |
prompt |
(str) The prompt to send to the agent. |
enable_trace |
(bool) Whether to enable trace for the prompt. |
print_response |
(bool) Whether to print the response to the console. |
session |
(Optional[AgentSession]) The session to send the prompt to. If not provided, the current session will be used. |
newer_than |
(Optional[int]) The timestamp to get trace results newer than. Defaults to NULL (all results). |
timeout |
(int) The number of seconds to wait for the job to complete or progress before raising a SynapseTimeoutError. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Example 1: Prompt the baseline Synapse Agent. # The baseline Synapse Agent is equivalent to the Agent available in the Synapse UI. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Prompt a custom agent. # If you have already registered a custom agent, you can prompt it by # providing the agent's registration ID. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Advanced Example: Start and prompt multiple sessions # Here, we connect to a custom agent and start one session with the prompt "Hello". # In the background, this first session is being set as the current session # and future prompts will be sent to this session by default. If we want to send a # prompt to a different session, we can do so by starting it and calling synPrompt again, # but with our new session as an argument. We now have two sessions, both stored in the # my_agent$sessions named list. After the second prompt, my_second_session is now # the current session. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) my_second_session = my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello again", enable_trace = TRUE, print_response = TRUE, session = my_second_session ) ## End(Not run)## Not run: ## Example 1: Prompt the baseline Synapse Agent. # The baseline Synapse Agent is equivalent to the Agent available in the Synapse UI. library(synapser) synLogin() my_agent = Agent() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Prompt a custom agent. # If you have already registered a custom agent, you can prompt it by # providing the agent's registration ID. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## Advanced Example: Start and prompt multiple sessions # Here, we connect to a custom agent and start one session with the prompt "Hello". # In the background, this first session is being set as the current session # and future prompts will be sent to this session by default. If we want to send a # prompt to a different session, we can do so by starting it and calling synPrompt again, # but with our new session as an argument. We now have two sessions, both stored in the # my_agent$sessions named list. After the second prompt, my_second_session is now # the current session. library(synapser) synLogin() my_agent = Agent(registration_id = "foo") my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) my_second_session = my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello again", enable_trace = TRUE, print_response = TRUE, session = my_second_session ) ## End(Not run)
Sends a prompt to the agent and adds the response to the AgentSession's chat history. A session must be started before sending a prompt.
synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, newer_than=NULL, timeout=120L, synapse_client=NULL)synPrompt(instance, prompt, enable_trace=FALSE, print_response=FALSE, newer_than=NULL, timeout=120L, synapse_client=NULL)
instance |
(AgentSession) The AgentSession instance to operate on. |
prompt |
(str) The prompt to send to the agent. |
enable_trace |
(bool) Whether to enable trace for the prompt. |
print_response |
(bool) Whether to print the response to the console. |
newer_than |
(Optional[int]) The timestamp to get trace results newer than. Defaults to NULL (all results). |
timeout |
(int) The number of seconds to wait for the job to complete or progress before raising a SynapseTimeoutError. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Send a prompt within an existing session. # If you already have an existing session, you can send it a prompt by # constructing an AgentSession with its session ID. library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)## Not run: ## Send a prompt within an existing session. # If you already have an existing session, you can send it a prompt by # constructing an AgentSession with its session ID. library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(character) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
include_row_id_and_row_version |
(logical) If TRUE the |
convert_to_datetime |
(logical) (data frame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a data frame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(integer) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a dataset and print out # the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") print(results) ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a dataset and print out # the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") print(results) ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(character) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
include_row_id_and_row_version |
(logical) If TRUE the |
convert_to_datetime |
(logical) (data frame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a data frame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(integer) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a dataset collection and # print out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") print(results) ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a dataset collection and # print out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") print(results) ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
include_row_id_and_row_version |
(bool) If TRUE the |
convert_to_datetime |
(bool) (data frame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a data frame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(int) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in an EntityView and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in an EntityView and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
include_row_id_and_row_version |
(bool) If TRUE the |
convert_to_datetime |
(bool) (DataFrame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a DataFrame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a materialized view and print # out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a materialized view and print # out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
include_row_id_and_row_version |
(bool) If TRUE the |
convert_to_datetime |
(bool) (DataFrame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a DataFrame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a submission view and print # out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a submission view and print # out the results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
include_row_id_and_row_version |
(bool) If TRUE the |
convert_to_datetime |
(bool) (data frame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a data frame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(int) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a table and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a table and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)
Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
include_row_id_and_row_version |
(bool) If TRUE the |
convert_to_datetime |
(bool) (DataFrame only) If set to TRUE, will convert all Synapse DATE columns from UNIX timestamp integers into UTC datetime objects |
download_location |
(CSV Only) If set to a path the results will be downloaded to that directory. The results will be downloaded as a CSV file. A path to the downloaded file will be returned instead of a DataFrame. |
quote_character |
(CSV Only) The character to use to quote fields. The default is a double quote. |
escape_character |
(CSV Only) The character to use to escape special characters. The default is a backslash. |
line_end |
(CSV Only) The character to use to end a line. The default is the system's line separator. |
separator |
(CSV Only) The character to use to separate fields. The default is a comma. |
header |
(CSV Only) If set to TRUE the first row will be used as the header row. The default is TRUE. |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a data frame or a path to the downloaded
query results if download_location is set.
## Not run: ## Querying for data # This example shows how you may query for data in a table and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)## Not run: ## Querying for data # This example shows how you may query for data in a table and print out the # results. library(synapser) synLogin() results = synQuery(query = "SELECT * FROM syn1234") results ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(character) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
part_mask |
(integer) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(integer) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a dataset # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) print(result) ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a dataset # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) print(result) ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(character) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
part_mask |
(integer) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(integer) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a dataset collection # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) print(result) ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a dataset collection # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) print(result) ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
part_mask |
(int) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(int) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in an EntityView and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the EntityView. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in an EntityView and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the EntityView. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: <https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
part_mask |
(int) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a materialized view # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a materialized view # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: <https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
part_mask |
(int) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a submission view # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a submission view # and print out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html |
part_mask |
(int) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(int) The number of seconds to wait for the query job to complete or progress before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a table and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a table and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)
Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API: <https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL)
query |
(str) The query to run. The query must be valid syntax that Synapse can understand. See this document that describes the expected syntax of the query: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/web/controller/TableExamples.html> |
part_mask |
(int) The bitwise OR of the part mask values you want to return in the results. The following list of part masks are implemented to be returned in the results: |
timeout |
(int) The number of seconds to wait for the query job to complete before raising a timeout error. Defaults to 250. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The results of the query as a QueryResultOutput object.
## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a table and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)## Not run: ## Querying for data with a part mask # This example shows how to use the bitwise OR to combine the # part mask values and then use that to query for data in a table and print # out the results. # In this case we are getting the results of the query, the count of rows, and # the last updated on date of the table. library(synapser) synLogin() QUERY_RESULTS = 0x1 QUERY_COUNT = 0x2 LAST_UPDATED_ON = 0x80 # Combine the part mask values using bitwise OR part_mask = bitwOr(bitwOr(QUERY_RESULTS, QUERY_COUNT), LAST_UPDATED_ON) result = synQueryPartMask(query = "SELECT * FROM syn1234", part_mask = part_mask) result ## End(Not run)
Reformat the attachment file name to be a valid attachment path.
synReformatAttachmentFileName(attachment_file_name)synReformatAttachmentFileName(attachment_file_name)
attachment_file_name |
(str) The name of the attachment file. |
The reformatted attachment file name.
## Not run: ## Reformat the attachment file name attachment_file_name = "file.txt" attachment_file_name_reformatted = synReformatAttachmentFileName(attachment_file_name) cat("Reformatted attachment file name:", attachment_file_name_reformatted, "\n") ## End(Not run)## Not run: ## Reformat the attachment file name attachment_file_name = "file.txt" attachment_file_name_reformatted = synReformatAttachmentFileName(attachment_file_name) cat("Reformatted attachment file name:", attachment_file_name_reformatted, "\n") ## End(Not run)
Registers an agent with the Synapse API. If agent already exists, it will be retrieved.
synRegister(instance, synapse_client=NULL)synRegister(instance, synapse_client=NULL)
instance |
(Agent) The Agent instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The registered or existing Agent object.
## Not run: ## Register and chat with a custom agent # Only available for internal users (Sage Bionetworks employees). # # Alternatively, you can register a custom agent and chat with it provided # you have already created it. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") |> synRegister() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)## Not run: ## Register and chat with a custom agent # Only available for internal users (Sage Bionetworks employees). # # Alternatively, you can register a custom agent and chat with it provided # you have already created it. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") |> synRegister() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)
Removes an item from the dataset. For Folders, all children of the folder are removed recursively. Effect is not seen until the dataset is stored.
synRemoveItem(instance, item, synapse_client=NULL)synRemoveItem(instance, item, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
item |
(EntityRef, File, or Folder) The entity to remove from the dataset. Must be an |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
Raises an error if the item is not an EntityRef, File, or Folder.
## Not run: ## Example 1: Remove a file from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(File(id = "syn1235")) my_dataset |> synStore() ## Example 2: Remove a folder from a dataset. # All child files are recursively removed from the dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(Folder(id = "syn1236")) my_dataset |> synStore() ## Example 3: Remove an entity reference from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## End(Not run)## Not run: ## Example 1: Remove a file from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(File(id = "syn1235")) my_dataset |> synStore() ## Example 2: Remove a folder from a dataset. # All child files are recursively removed from the dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(Folder(id = "syn1236")) my_dataset |> synStore() ## Example 3: Remove an entity reference from a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synRemoveItem(EntityRef(id = "syn1237", version = 1L)) my_dataset |> synStore() ## End(Not run)
Removes an entity from the dataset collection. Must be a Dataset or EntityRef. Effect is not seen until the dataset collection is stored. Unless the version is specified, all entities with the same ID will be removed.
synRemoveItem(instance, item)synRemoveItem(instance, item)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
item |
(Dataset or EntityRef) The Dataset, or an |
NULL
Raises an error if the item is not a Dataset or EntityRef.
## Not run: ## Example 1: Remove a Dataset from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synRemoveItem(Dataset(id = "syn1235", version_number = 1L)) my_collection |> synStore() ## Example 2: Remove all versions of a Dataset from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synRemoveItem(Dataset(id = "syn1235")) my_collection |> synStore() ## End(Not run)## Not run: ## Example 1: Remove a Dataset from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synRemoveItem(Dataset(id = "syn1235", version_number = 1L)) my_collection |> synStore() ## Example 2: Remove all versions of a Dataset from a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synRemoveItem(Dataset(id = "syn1235")) my_collection |> synStore() ## End(Not run)
Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this Dataset instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in the table. If you pass in an index that is out of bounds the column will be added to the end of the list.
synReorderColumn(instance, name, index)synReorderColumn(instance, name, index)
instance |
(Dataset) The Dataset instance to operate on. |
name |
(character) The name of the column to reorder. |
index |
(integer) The index to move the column to starting with 0. |
NULL
## Not run: ## Reordering a column # This example shows how you may reorder a column in a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list dataset |> synReorderColumn(name = "my_column", index = 0L) dataset |> synStore() ## End(Not run)## Not run: ## Reordering a column # This example shows how you may reorder a column in a dataset and then # store the change back in Synapse. library(synapser) synLogin() dataset = Dataset(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list dataset |> synReorderColumn(name = "my_column", index = 0L) dataset |> synStore() ## End(Not run)
Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this DatasetCollection instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in the table. If you pass in an index that is out of bounds the column will be added to the end of the list.
synReorderColumn(instance, name, index)synReorderColumn(instance, name, index)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
name |
(character) The name of the column to reorder. |
index |
(integer) The index to move the column to starting with 0. |
NULL
## Not run: ## Reordering a column # This example shows how you may reorder a column in a dataset collection and # then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list collection |> synReorderColumn(name = "my_column", index = 0L) collection |> synStore() ## End(Not run)## Not run: ## Reordering a column # This example shows how you may reorder a column in a dataset collection and # then store the change back in Synapse. library(synapser) synLogin() collection = DatasetCollection(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list collection |> synReorderColumn(name = "my_column", index = 0L) collection |> synStore() ## End(Not run)
Reorder a column in the EntityView. Note that this does not store the column in
Synapse. You must call the synStore() function on this EntityView instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in the EntityView. If you pass in an index that is out of bounds the column will be added to the end of the list.
synReorderColumn(instance, name, index)synReorderColumn(instance, name, index)
instance |
(EntityView) The EntityView instance to operate on. |
name |
(str) The name of the column to reorder. |
index |
(int) The index to move the column to starting with 0. |
NULL
## Not run: ## Reordering a column # This example shows how you may reorder a column in an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list entityview |> synReorderColumn(name = "my_column", index = 0L) entityview |> synStore() ## End(Not run)## Not run: ## Reordering a column # This example shows how you may reorder a column in an EntityView and then store # the change back in Synapse. library(synapser) synLogin() entityview = EntityView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list entityview |> synReorderColumn(name = "my_column", index = 0L) entityview |> synStore() ## End(Not run)
Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this SubmissionView instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in the table. If you pass in an index that is out of bounds the column will be added to the end of the list.
synReorderColumn(instance, name, index)synReorderColumn(instance, name, index)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
name |
(str) The name of the column to reorder. |
index |
(int) The index to move the column to starting with 0. |
NULL
## Not run: ## Reordering a column # This example shows how you may reorder a column in a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list view |> synReorderColumn(name = "my_column", index = 0L) view |> synStore() ## End(Not run)## Not run: ## Reordering a column # This example shows how you may reorder a column in a submission view and # then store the change back in Synapse. library(synapser) synLogin() view = SubmissionView(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list view |> synReorderColumn(name = "my_column", index = 0L) view |> synStore() ## End(Not run)
Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this Table instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in the table. If you pass in an index that is out of bounds the column will be added to the end of the list.
synReorderColumn(instance, name, index)synReorderColumn(instance, name, index)
instance |
(Table) The Table instance to operate on. |
name |
(str) The name of the column to reorder. |
index |
(int) The index to move the column to starting with 0. |
NULL
## Not run: ## Reordering a column # This example shows how you may reorder a column in a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list table |> synReorderColumn(name = "my_column", index = 0L) table |> synStore() ## End(Not run)## Not run: ## Reordering a column # This example shows how you may reorder a column in a table and then store # the change back in Synapse. library(synapser) synLogin() table = Table(id = "syn1234") |> synGet(table_options = TableOptions(include_columns = TRUE)) # Move the column to the beginning of the list table |> synReorderColumn(name = "my_column", index = 0L) table |> synStore() ## End(Not run)
Sends an HTTP DELETE request to the Synapse server.
synRestDelete(uri, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)synRestDelete(uri, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)
uri |
(str) URI of resource to be deleted |
endpoint |
(str) Server endpoint, defaults to the client's configured repository endpoint (see |
headers |
(Headers) Named list of headers to use. |
retry_policy |
(dict[str, Any]) A retry policy (named list) whose keys should match the parameters of with_retry_time_based_async, the underlying Python client's retry mechanism. |
requests_session_async_synapse |
(AsyncClient) The async client to use when making this specific call |
kwargs |
optional named parameter: Any other arguments taken by a request method |
NULL
This wraps synapseclient's rest_delete_async(), which is a Python
async coroutine method. Calling synRestDelete() does not run
that coroutine – it returns an unresolved Python coroutine object, since
reticulate does not automatically await coroutines. To get the actual
result, resolve the returned coroutine yourself with Python's
asyncio.run() via reticulate, as shown in the example below.
## Not run: ## Using this function # For ordinary entity deletion, prefer the higher-level synDelete() # function instead -- e.g. synDelete("syn123456"). Reach for # synRestDelete() only for REST endpoints that don't have a # higher-level model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") coro = synRestDelete(uri = "/entity/syn123456") response = asyncio$run(coro) response ## End(Not run)## Not run: ## Using this function # For ordinary entity deletion, prefer the higher-level synDelete() # function instead -- e.g. synDelete("syn123456"). Reach for # synRestDelete() only for REST endpoints that don't have a # higher-level model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") coro = synRestDelete(uri = "/entity/syn123456") response = asyncio$run(coro) response ## End(Not run)
Sends an HTTP GET request to the Synapse server.
synRestGet(uri, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)synRestGet(uri, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)
uri |
(str) URI on which get is performed |
endpoint |
(str) Server endpoint, defaults to the client's configured repository endpoint (see |
headers |
(Headers) Named list of headers to use. |
retry_policy |
(dict[str, Any]) A retry policy (named list) whose keys should match the parameters of with_retry_time_based_async, the underlying Python client's retry mechanism. |
requests_session_async_synapse |
(AsyncClient) The async client to use when making this specific call. |
kwargs |
optional named parameter: Any other arguments taken by a request method |
JSON encoding of response
This wraps synapseclient's rest_get_async(), which is a Python
async coroutine method. Calling synRestGet() does not run
that coroutine – it returns an unresolved Python coroutine object, since
reticulate does not automatically await coroutines. To get the actual
response, resolve the returned coroutine yourself with Python's
asyncio.run() via reticulate, as shown in the example below.
## Not run: ## Using this function library(synapser) synLogin() asyncio = reticulate::import("asyncio") # Low-level REST access to an entity's raw JSON, bypassing the synGet() model wrapper coro = synRestGet(uri = "/entity/syn123456") response = asyncio$run(coro) response ## End(Not run)## Not run: ## Using this function library(synapser) synLogin() asyncio = reticulate::import("asyncio") # Low-level REST access to an entity's raw JSON, bypassing the synGet() model wrapper coro = synRestGet(uri = "/entity/syn123456") response = asyncio$run(coro) response ## End(Not run)
Restore a specific version of a wiki page.
synRestore(instance, synapse_client=NULL)synRestore(instance, synapse_client=NULL)
instance |
(WikiPage) The WikiPage instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The restored wiki page.
## Not run: ## Restore a specific version of a wiki page # This example shows how to restore a specific version of a wiki page. wiki_page_restored = WikiPage(owner_id = project$id, id = wiki_page$id, wiki_version = "0") |> synRestore() wiki_page_restored ## End(Not run)## Not run: ## Restore a specific version of a wiki page # This example shows how to restore a specific version of a wiki page. wiki_page_restored = WikiPage(owner_id = project$id, id = wiki_page$id, wiki_version = "0") |> synRestore() wiki_page_restored ## End(Not run)
Sends an HTTP POST request to the Synapse server.
synRestPost(uri, body=NULL, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)synRestPost(uri, body=NULL, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)
uri |
(str) URI on which the request is performed |
body |
(Any) The payload to be delivered, as a JSON-encoded string (e.g. via |
endpoint |
(str) Server endpoint, defaults to the client's configured repository endpoint (see |
headers |
(Headers) Named list of headers to use. |
retry_policy |
(dict[str, Any]) A retry policy (named list) whose keys should match the parameters of with_retry_time_based_async, the underlying Python client's retry mechanism. |
requests_session_async_synapse |
(AsyncClient) The async client to use when making this specific call. |
kwargs |
optional named parameter: Any other arguments taken by a request method |
JSON encoding of response
This wraps synapseclient's rest_post_async(), which is a Python
async coroutine method. Calling synRestPost() does not run
that coroutine – it returns an unresolved Python coroutine object, since
reticulate does not automatically await coroutines. To get the actual
response, resolve the returned coroutine yourself with Python's
asyncio.run() via reticulate, as shown in the example below.
## Not run: ## Using this function # For ordinary entity creation, prefer the higher-level constructors # and synStore() instead -- e.g. Folder(...) |> synStore(). Reach for # synRestPost() only for REST endpoints that don't have a higher-level # model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") new_folder_properties = list( name = "My New Folder", parentId = "syn123456", concreteType = "org.sagebionetworks.repo.model.Folder" ) post_coro = synRestPost(uri = "/entity", body = rjson::toJSON(new_folder_properties)) response = asyncio$run(post_coro) response ## End(Not run)## Not run: ## Using this function # For ordinary entity creation, prefer the higher-level constructors # and synStore() instead -- e.g. Folder(...) |> synStore(). Reach for # synRestPost() only for REST endpoints that don't have a higher-level # model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") new_folder_properties = list( name = "My New Folder", parentId = "syn123456", concreteType = "org.sagebionetworks.repo.model.Folder" ) post_coro = synRestPost(uri = "/entity", body = rjson::toJSON(new_folder_properties)) response = asyncio$run(post_coro) response ## End(Not run)
Sends an HTTP PUT request to the Synapse server.
synRestPut(uri, body=NULL, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)synRestPut(uri, body=NULL, endpoint=NULL, headers=NULL, retry_policy=list(), requests_session_async_synapse=NULL, kwargs=NULL)
uri |
(str) URI on which the request is performed |
body |
(Any) The payload to be delivered, as a JSON-encoded string (e.g. via |
endpoint |
(str) Server endpoint, defaults to the client's configured repository endpoint (see |
headers |
(Headers) Named list of headers to use. |
retry_policy |
(dict[str, Any]) A retry policy (named list) whose keys should match the parameters of with_retry_time_based_async, the underlying Python client's retry mechanism. |
requests_session_async_synapse |
(AsyncClient) The async client to use when making this specific call. |
kwargs |
optional named parameter: Any other arguments taken by a request method |
JSON encoding of response
This wraps synapseclient's rest_put_async(), which is a Python
async coroutine method. Calling synRestPut() does not run
that coroutine – it returns an unresolved Python coroutine object, since
reticulate does not automatically await coroutines. To get the actual
response, resolve the returned coroutine yourself with Python's
asyncio.run() via reticulate, as shown in the example below.
## Not run: ## Using this function # For ordinary entity updates, prefer the higher-level synSetProperties() # / synStore() functions instead -- they handle this fetch-modify-store # cycle for you. Reach for synRestPut() only for REST endpoints that # don't have a higher-level model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") # Fetch the entity's current properties first get_coro = synRestGet(uri = "/entity/syn123456") entity_properties = asyncio$run(get_coro) # Modify the field(s) you want to change entity_properties$name = "New Name" # The body must be a JSON-encoded string, not a named list -- it is passed # straight through to the underlying HTTP client's `content` argument, # which only accepts a string or raw bytes. put_coro = synRestPut(uri = "/entity/syn123456", body = rjson::toJSON(entity_properties)) response = asyncio$run(put_coro) response ## End(Not run)## Not run: ## Using this function # For ordinary entity updates, prefer the higher-level synSetProperties() # / synStore() functions instead -- they handle this fetch-modify-store # cycle for you. Reach for synRestPut() only for REST endpoints that # don't have a higher-level model wrapper. library(synapser) synLogin() asyncio = reticulate::import("asyncio") # Fetch the entity's current properties first get_coro = synRestGet(uri = "/entity/syn123456") entity_properties = asyncio$run(get_coro) # Modify the field(s) you want to change entity_properties$name = "New Name" # The body must be a JSON-encoded string, not a named list -- it is passed # straight through to the underlying HTTP client's `content` argument, # which only accepts a string or raw bytes. put_coro = synRestPut(uri = "/entity/syn123456", body = rjson::toJSON(entity_properties)) response = asyncio$run(put_coro) response ## End(Not run)
Send a message via Synapse.
synSendMessage(userIds, messageSubject, messageBody, contentType="text/plain")synSendMessage(userIds, messageSubject, messageBody, contentType="text/plain")
userIds |
A list of user IDs to which the message is to be sent |
messageSubject |
The subject for the message |
messageBody |
The body of the message |
contentType |
optional contentType of message body (default="text/plain") Should be one of "text/plain" or "text/html" |
The metadata of the created message
## Not run: ## Sending a message library(synapser) synLogin() message = synSendMessage( userIds = list(273948L), messageSubject = "Data is ready", messageBody = "The analysis results have been uploaded to syn123." ) # Send an HTML message message = synSendMessage( userIds = list(273948L), messageSubject = "Data is ready", messageBody = "<p>The results are in <b>syn123</b>.</p>", contentType = "text/html" ) ## End(Not run)## Not run: ## Sending a message library(synapser) synLogin() message = synSendMessage( userIds = list(273948L), messageSubject = "Data is ready", messageBody = "The analysis results have been uploaded to syn123." ) # Send an HTML message message = synSendMessage( userIds = list(273948L), messageSubject = "Data is ready", messageBody = "<p>The results are in <b>syn123</b>.</p>", contentType = "text/html" ) ## End(Not run)
Sets the locations for each of the Synapse services (mostly useful for testing).
synSetEndpoints(repoEndpoint=NULL, authEndpoint=NULL, fileHandleEndpoint=NULL, portalEndpoint=NULL, skip_checks=FALSE)synSetEndpoints(repoEndpoint=NULL, authEndpoint=NULL, fileHandleEndpoint=NULL, portalEndpoint=NULL, skip_checks=FALSE)
repoEndpoint |
(str) Location of synapse repository |
authEndpoint |
(str) Location of authentication service |
fileHandleEndpoint |
(str) Location of file service |
portalEndpoint |
(str) Location of the website |
skip_checks |
(bool) Skip version and endpoint checks |
NULL
## Not run: ## Switching endpoints # To switch between staging and production endpoints library(synapser) synSetEndpoints( repoEndpoint = "https://repo-staging.prod.sagebase.org/repo/v1", authEndpoint = "https://auth-staging.prod.sagebase.org/auth/v1", fileHandleEndpoint = "https://file-staging.prod.sagebase.org/file/v1", portalEndpoint = "https://staging.synapse.org/" ) synSetEndpoints( repoEndpoint = "https://repo-prod.prod.sagebase.org/repo/v1", authEndpoint = "https://auth-prod.prod.sagebase.org/auth/v1", fileHandleEndpoint = "https://file-prod.prod.sagebase.org/file/v1", portalEndpoint = "https://www.synapse.org/" ) ## End(Not run)## Not run: ## Switching endpoints # To switch between staging and production endpoints library(synapser) synSetEndpoints( repoEndpoint = "https://repo-staging.prod.sagebase.org/repo/v1", authEndpoint = "https://auth-staging.prod.sagebase.org/auth/v1", fileHandleEndpoint = "https://file-staging.prod.sagebase.org/file/v1", portalEndpoint = "https://staging.synapse.org/" ) synSetEndpoints( repoEndpoint = "https://repo-prod.prod.sagebase.org/repo/v1", authEndpoint = "https://auth-prod.prod.sagebase.org/auth/v1", fileHandleEndpoint = "https://file-prod.prod.sagebase.org/file/v1", portalEndpoint = "https://www.synapse.org/" ) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
principal_id |
(integer) Identifier of a user or group. |
access_type |
(list[character]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(logical) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(logical) When |
overwrite |
(logical) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Dataset(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Dataset(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Dataset(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Dataset(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
principal_id |
(integer) Identifier of a user or group. |
access_type |
(list[character]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(logical) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(logical) When |
overwrite |
(logical) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() DatasetCollection(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access DatasetCollection(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() DatasetCollection(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access DatasetCollection(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() EntityView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access EntityView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() EntityView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access EntityView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() File(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access File(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() File(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access File(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Folder(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Folder(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Folder(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Folder(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(MaterializedView) The MaterializedView instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html>.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() MaterializedView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access MaterializedView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() MaterializedView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access MaterializedView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html>.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Project(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Project(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Project(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Project(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html>.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() SubmissionView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access SubmissionView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() SubmissionView(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access SubmissionView(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html>.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Table(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Table(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() Table(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access Table(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Sets permission that a user or group has on an Entity. An Entity may have its own ACL or inherit its ACL from a benefactor.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL)
instance |
(VirtualTable) The VirtualTable instance to operate on. |
principal_id |
(int) Identifier of a user or group. |
access_type |
(list[str]) Type of permission to be granted. One or more of CREATE, READ, DOWNLOAD, UPDATE, DELETE, CHANGE_PERMISSIONS. |
modify_benefactor |
(bool) Set as TRUE when modifying a benefactor's ACL. The term 'benefactor' is used to indicate which Entity an Entity inherits its ACL from. For example, a newly created Project will be its own benefactor, while a new FileEntity's benefactor will start off as its containing Project. If the entity already has local sharing settings the benefactor would be itself. It may also be the immediate parent, somewhere in the parent tree, or the project itself. |
warn_if_inherits |
(bool) When |
overwrite |
(bool) By default this function overwrites existing permissions for the specified user. Set this flag to FALSE to add new permissions non-destructively. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
An Access Control List object matching <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/AccessControlList.html>.
## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() VirtualTable(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access VirtualTable(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)## Not run: ## Setting permissions # Grant all registered users download access library(synapser) synLogin() VirtualTable(id = "syn123") |> synSetPermissions(principal_id = 273948L, access_type = list("READ", "DOWNLOAD")) # Grant the public view access VirtualTable(id = "syn123") |> synSetPermissions(principal_id = 273949L, access_type = list("READ")) ## End(Not run)
Set one or more properties of a Synapse entity object, such as
its name, description, version_label, activity,
or annotations, and return the entity so it can be piped into
synStore().
The changes are only made to the local entity object; call
synStore() to save them to Synapse.
Each argument must be named, and every name must be an attribute of the
entity's model class (for example a field of File or
Folder); otherwise an error is raised listing the names that are
not valid. When duplicate properties are provided, the first one will be used.
Calling synSetProperties() with no properties returns the entity
unchanged.
Setting annotations replaces all of the entity's annotations. To add
to the existing annotations, combine them first, e.g.
annotations = append(entity$annotations, list(key = "value")); to
remove all annotations, set annotations = list().
synSetProperties(entity, ...)synSetProperties(entity, ...)
entity |
A Synapse entity object, for example one created with
|
... |
Named properties to set, e.g. |
The entity with the properties set.
## Not run: synSetProperties(entity, annotations = list(key = "value")) synSetProperties(entity, name = "new name", annotations = list(key = "value", key2 = "value2")) ## End(Not run)## Not run: synSetProperties(entity, annotations = list(key = "value")) synSetProperties(entity, name = "new name", annotations = list(key = "value", key2 = "value2")) ## End(Not run)
Set the upload storage location for this entity. This configures where files uploaded to this entity will be stored.
This is a destructive update. The provided storage_location_id value(s)
will replace any storage locations previously configured on this entity.
To add a storage location without removing existing ones, first retrieve the
current setting with synGetProjectSetting(), then pass its existing
locations together with the new ID as storage_location_id.
The first ID in the list is the default upload destination.
synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL)synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
storage_location_id |
(Optional[integer or list of integer]) The storage location ID(s) to set. Can be a single ID, a list of IDs (first is default, max 10). By default, the default Synapse S3 storage location is used. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The ProjectSetting object reflecting the current state after the operation.
Raises an error if the entity does not have an id set.
## Not run: ## Example 1: Replace all storage locations # Fully replace the storage location on a folder with a single location: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synSetStorageLocation(storage_location_id = 12345L) print(setting) ## Example 2: Partial update — add a storage location without removing existing ones # Retrieve the current setting and set the existing locations plus a new one: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { locations = c(unlist(setting$locations), 67890L) folder |> synSetStorageLocation(storage_location_id = as.list(locations)) } ## End(Not run)## Not run: ## Example 1: Replace all storage locations # Fully replace the storage location on a folder with a single location: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synSetStorageLocation(storage_location_id = 12345L) print(setting) ## Example 2: Partial update — add a storage location without removing existing ones # Retrieve the current setting and set the existing locations plus a new one: library(synapser) synLogin() folder = Folder(id = "syn123") |> synGet() setting = folder |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { locations = c(unlist(setting$locations), 67890L) folder |> synSetStorageLocation(storage_location_id = as.list(locations)) } ## End(Not run)
Set the upload storage location for this entity. This configures where files uploaded to this entity will be stored.
This is a destructive update. The provided storage_location_id value(s)
will replace any storage locations previously configured on this entity.
To add a storage location without removing existing ones, first retrieve the
current setting with synGetProjectSetting(), then pass its existing
locations together with the new ID as storage_location_id.
The first ID in the list is the default upload destination.
synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL)synSetStorageLocation(instance, storage_location_id=1L, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
storage_location_id |
(Optional[integer or list of integer]) The storage location ID(s) to set. Can be a single ID, a list of IDs (first is default, max 10). By default, the default Synapse S3 storage location is used. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The ProjectSetting object reflecting the current state after the operation.
Raises an error if the entity does not have an id set.
## Not run: ## Example 1: Replace all storage locations # Fully replace the storage location on a project with a single location: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synSetStorageLocation(storage_location_id = 12345L) print(setting) ## Example 2: Partial update — add a storage location without removing existing ones # Retrieve the current setting and set the existing locations plus a new one: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { locations = c(unlist(setting$locations), 67890L) project |> synSetStorageLocation(storage_location_id = as.list(locations)) } ## End(Not run)## Not run: ## Example 1: Replace all storage locations # Fully replace the storage location on a project with a single location: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synSetStorageLocation(storage_location_id = 12345L) print(setting) ## Example 2: Partial update — add a storage location without removing existing ones # Retrieve the current setting and set the existing locations plus a new one: library(synapser) synLogin() project = Project(id = "syn123") |> synGet() setting = project |> synGetProjectSetting(setting_type = "upload") if (!is.null(setting)) { locations = c(unlist(setting$locations), 67890L) project |> synSetStorageLocation(storage_location_id = as.list(locations)) } ## End(Not run)
Creates a snapshot of the dataset. A snapshot is a saved, read-only version of the dataset at the time it was created. Dataset snapshots are created using the asynchronous job API.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
comment |
(Optional[character]) A unique comment to associate with the snapshot. |
label |
(Optional[character]) A unique label to associate with the snapshot. |
include_activity |
(logical) If TRUE the activity will be included in snapshot if it exists. In order to include the activity, the activity must have already been stored in Synapse by using the |
associate_activity_to_new_version |
(logical) If TRUE the activity will be associated with the new version of the dataset. If FALSE the activity will not be associated with the new version of the dataset. Defaults to TRUE. |
timeout |
(integer) The number of seconds to wait for the async job to complete. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A TableUpdateTransaction object which includes the version number of the snapshot.
## Not run: ## Save a snapshot of a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## End(Not run)## Not run: ## Save a snapshot of a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() my_dataset |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## End(Not run)
Creates a snapshot of the dataset collection. A snapshot is a saved, read-only version of the dataset collection at the time it was created. Dataset collection snapshots are created using the asynchronous job API.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
comment |
(Optional[character]) A unique comment to associate with the snapshot. |
label |
(Optional[character]) A unique label to associate with the snapshot. |
include_activity |
(logical) If TRUE the activity will be included in snapshot if it exists. In order to include the activity, the activity must have already been stored in Synapse by using the |
associate_activity_to_new_version |
(logical) If TRUE the activity will be associated with the new version of the dataset collection. If FALSE the activity will not be associated with the new version of the dataset collection. Defaults to TRUE. |
timeout |
(integer) The number of seconds to wait for the async job to complete. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A TableUpdateTransaction object which includes the version number of the snapshot.
## Not run: ## Save a snapshot of a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## End(Not run)## Not run: ## Save a snapshot of a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() my_collection |> synSnapshot(comment = "My first snapshot", label = "My first snapshot") ## End(Not run)
Creates a snapshot of the EntityView entity.
Synapse handles snapshot creation differently for Table- and View-like
entities. View snapshots are created using the asynchronous job API.
Making a snapshot of a view allows you to create an immutable version of the view at the time of the snapshot. This is useful to create checkpoints in time that you may go back and reference, or use in a publication. Snapshots are immutable and cannot be changed. They may only be deleted.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
comment |
(Optional[str]) A unique comment to associate with the snapshot. |
label |
(Optional[str]) A unique label to associate with the snapshot. If this is not a unique label an error will be raised when you store this to Synapse. |
include_activity |
(bool) If TRUE the activity will be included in snapshot if it exists. In order to include the activity, the activity must have already been stored in Synapse by using the |
associate_activity_to_new_version |
(bool) If TRUE the activity will be associated with the new version of the view. If FALSE the activity will not be associated with the new version of the view. Defaults to TRUE. |
timeout |
(int) The number of seconds to wait for the job to complete or progress before raising a timeout error. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A TableUpdateTransaction object which includes the version number of the snapshot.
## Not run: ## Example 1: Creating a snapshot of a view with an activity # Create a snapshot of a view and include the activity. The activity must # have been stored in Synapse by using the $activity attribute on the EntityView # and calling the synStore() function on the EntityView instance. Adding an activity # to a snapshot of an EntityView is meant to capture the provenance of the data at # the time of the snapshot. library(synapser) synLogin() view = EntityView(id = "syn4567") snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Results collected in Lab A", include_activity = TRUE, associate_activity_to_new_version = TRUE ) snapshot ## Example 2: Creating a snapshot of a view without an activity # Create a snapshot of a view without including the activity. This is used in # cases where we do not have any Provenance to associate with the snapshot and # we do not want to persist any activity that may be present on the view to # the new version of the view. library(synapser) synLogin() view = EntityView(id = "syn4567") snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Results collected in Lab A", include_activity = FALSE, associate_activity_to_new_version = FALSE ) snapshot ## End(Not run)## Not run: ## Example 1: Creating a snapshot of a view with an activity # Create a snapshot of a view and include the activity. The activity must # have been stored in Synapse by using the $activity attribute on the EntityView # and calling the synStore() function on the EntityView instance. Adding an activity # to a snapshot of an EntityView is meant to capture the provenance of the data at # the time of the snapshot. library(synapser) synLogin() view = EntityView(id = "syn4567") snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Results collected in Lab A", include_activity = TRUE, associate_activity_to_new_version = TRUE ) snapshot ## Example 2: Creating a snapshot of a view without an activity # Create a snapshot of a view without including the activity. This is used in # cases where we do not have any Provenance to associate with the snapshot and # we do not want to persist any activity that may be present on the view to # the new version of the view. library(synapser) synLogin() view = EntityView(id = "syn4567") snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Results collected in Lab A", include_activity = FALSE, associate_activity_to_new_version = FALSE ) snapshot ## End(Not run)
Creates a snapshot of the SubmissionView entity.
Synapse handles snapshot creation differently for Table- and View-like
entities. View snapshots are created using the asynchronous job API.
Making a snapshot of a view allows you to create an immutable version of the view at the time of the snapshot. This is useful to create checkpoints in time that you may go back and reference, or use in a publication. Snapshots are immutable and cannot be changed. They may only be deleted.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, timeout=120L, synapse_client=NULL)
instance |
(SubmissionView) The SubmissionView instance to operate on. |
comment |
(Optional[str]) A unique comment to associate with the snapshot. |
label |
(Optional[str]) A unique label to associate with the snapshot. If this is not a unique label an error will be raised when you store this to Synapse. |
include_activity |
(bool) If TRUE the activity will be included in snapshot if it exists. In order to include the activity, the activity must have already been stored in Synapse by using the |
associate_activity_to_new_version |
(bool) If TRUE the activity will be associated with the new version of the table. If FALSE the activity will not be associated with the new version of the table. Defaults to TRUE. |
timeout |
(int) The number of seconds to wait for the async job to complete. Defaults to 120. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A TableUpdateTransaction object which includes the version number of the snapshot.
## Not run: ## Example 1: Creating a snapshot of a view with an activity # Create a snapshot of a view and include the activity. The activity must have # been stored in Synapse by using the $activity attribute on the SubmissionView # and calling the synStore() function on the SubmissionView instance. Adding an # activity to a snapshot of a view is meant to capture the provenance of the # data at the time of the snapshot. library(synapser) synLogin() view = SubmissionView(id = "syn4567") |> synGet() view$activity = Activity(name = "Activity for snapshot") view |> synStore() # Store the activity snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Submissions reviewed in Lab A", include_activity = TRUE, associate_activity_to_new_version = TRUE ) snapshot ## Example 2: Creating a snapshot of a view without an activity # Create a snapshot of a view without including the activity. This is used in # cases where we do not have any Provenance to associate with the snapshot and # we do not want to persist any activity that may be present on the view to # the new version of the view. library(synapser) synLogin() view = SubmissionView(id = "syn4567") |> synGet() snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Submissions reviewed in Lab A", include_activity = FALSE, associate_activity_to_new_version = FALSE ) snapshot ## End(Not run)## Not run: ## Example 1: Creating a snapshot of a view with an activity # Create a snapshot of a view and include the activity. The activity must have # been stored in Synapse by using the $activity attribute on the SubmissionView # and calling the synStore() function on the SubmissionView instance. Adding an # activity to a snapshot of a view is meant to capture the provenance of the # data at the time of the snapshot. library(synapser) synLogin() view = SubmissionView(id = "syn4567") |> synGet() view$activity = Activity(name = "Activity for snapshot") view |> synStore() # Store the activity snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Submissions reviewed in Lab A", include_activity = TRUE, associate_activity_to_new_version = TRUE ) snapshot ## Example 2: Creating a snapshot of a view without an activity # Create a snapshot of a view without including the activity. This is used in # cases where we do not have any Provenance to associate with the snapshot and # we do not want to persist any activity that may be present on the view to # the new version of the view. library(synapser) synLogin() view = SubmissionView(id = "syn4567") |> synGet() snapshot = view |> synSnapshot( label = "Q1 2025", comment = "Submissions reviewed in Lab A", include_activity = FALSE, associate_activity_to_new_version = FALSE ) snapshot ## End(Not run)
Request to create a new snapshot of a table. The provided comment, label, and activity will be applied to the current version thereby creating a snapshot and locking the current version. After the snapshot is created a new version will be started with an 'in-progress' label.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, synapse_client=NULL)synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
comment |
(str) Comment to add to this snapshot to the table. |
label |
(str) Label to add to this snapshot to the table. The label must be unique, if a label is not provided a unique label will be generated. |
include_activity |
(bool) If TRUE the activity will be included in snapshot if it exists. In order to include the activity, the activity must have already been stored in Synapse by using the |
associate_activity_to_new_version |
(bool) If TRUE the activity will be associated with the new version of the table. If FALSE the activity will not be associated with the new version of the table. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A named list that matches: <https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/SnapshotResponse.html>
## Not run: ## Example 1: Creating a snapshot of a table # Comment and label are optional, but filled in for this example. library(synapser) synLogin() my_table = Table(id = "syn1234") my_table |> synSnapshot( comment = "This is a new snapshot comment", label = "This is a unique label" ) ## Example 2: Including the activity (Provenance) in the snapshot and not pulling it forward to the new in-progress version of the table. # By default this method is set up to include the activity in the snapshot and # then pull the activity forward to the new version. If you do not want to # include the activity in the snapshot you can set include_activity to # FALSE. If you do not want to pull the activity forward to the new version # you can set associate_activity_to_new_version to FALSE. # See the $activity attribute on the Table class for more information on how # to interact with the activity. library(synapser) synLogin() my_table = Table(id = "syn1234") my_table |> synSnapshot( comment = "This is a new snapshot comment", label = "This is a unique label", include_activity = TRUE, associate_activity_to_new_version = FALSE ) ## End(Not run)## Not run: ## Example 1: Creating a snapshot of a table # Comment and label are optional, but filled in for this example. library(synapser) synLogin() my_table = Table(id = "syn1234") my_table |> synSnapshot( comment = "This is a new snapshot comment", label = "This is a unique label" ) ## Example 2: Including the activity (Provenance) in the snapshot and not pulling it forward to the new in-progress version of the table. # By default this method is set up to include the activity in the snapshot and # then pull the activity forward to the new version. If you do not want to # include the activity in the snapshot you can set include_activity to # FALSE. If you do not want to pull the activity forward to the new version # you can set associate_activity_to_new_version to FALSE. # See the $activity attribute on the Table class for more information on how # to interact with the activity. library(synapser) synLogin() my_table = Table(id = "syn1234") my_table |> synSnapshot( comment = "This is a new snapshot comment", label = "This is a unique label", include_activity = TRUE, associate_activity_to_new_version = FALSE ) ## End(Not run)
Starts an agent session.
synStart(instance, synapse_client=NULL)synStart(instance, synapse_client=NULL)
instance |
(AgentSession) The AgentSession instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The new AgentSession object.
## Not run: ## Start a session and send a prompt. # Start a session with a custom agent by providing the agent's registration ID # and calling synStart(). Then, send a prompt to the agent. library(synapser) synLogin() my_session = AgentSession(agent_registration_id = "foo") |> synStart() my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)## Not run: ## Start a session and send a prompt. # Start a session with a custom agent by providing the agent's registration ID # and calling synStart(). Then, send a prompt to the agent. library(synapser) synLogin() my_session = AgentSession(agent_registration_id = "foo") |> synStart() my_session |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)
Starts an agent session. Adds the session to the Agent's sessions named list and sets it as the current session.
synStartSession(instance, access_level="PUBLICLY_ACCESSIBLE", synapse_client=NULL)synStartSession(instance, access_level="PUBLICLY_ACCESSIBLE", synapse_client=NULL)
instance |
(Agent) The Agent instance to operate on. |
access_level |
(Optional[AgentSessionAccessLevel]) The access level of the agent session. Must be one of PUBLICLY_ACCESSIBLE, READ_YOUR_PRIVATE_DATA, or WRITE_YOUR_PRIVATE_DATA. Defaults to PUBLICLY_ACCESSIBLE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The new AgentSession object.
## Not run: ## Example 1: Start a session and send a prompt with the baseline Synapse Agent. # The baseline Synapse Agent is the default agent used when a registration ID is not provided. library(synapser) synLogin() my_agent = Agent() my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Start a session and send a prompt with a custom agent. # If you have already registered a custom agent, you can start a session # with it by providing its cloud agent ID. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)## Not run: ## Example 1: Start a session and send a prompt with the baseline Synapse Agent. # The baseline Synapse Agent is the default agent used when a registration ID is not provided. library(synapser) synLogin() my_agent = Agent() my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Can you tell me about the AD Knowledge Portal dataset?", enable_trace = TRUE, print_response = TRUE ) ## Example 2: Start a session and send a prompt with a custom agent. # If you have already registered a custom agent, you can start a session # with it by providing its cloud agent ID. library(synapser) synLogin() my_agent = Agent(cloud_agent_id = "foo") my_agent |> synStartSession() my_agent |> synPrompt( prompt = "Hello", enable_trace = TRUE, print_response = TRUE ) ## End(Not run)
Factory method to store any Synapse entity.
This method serves as a unified interface for storing any type of Synapse entity. It automatically applies the appropriate store logic based on the entity type and the options provided.
synStore(entity, parent=NULL, file_options=NULL, container_options=NULL, table_options=NULL, json_schema_options=NULL, grid_options=NULL, synapse_client=NULL)synStore(entity, parent=NULL, file_options=NULL, container_options=NULL, table_options=NULL, json_schema_options=NULL, grid_options=NULL, synapse_client=NULL)
entity |
(Union[AgentSession, CurationTask, Dataset, DatasetCollection, EntityView, Evaluation, File, Folder, FormData, FormGroup, Grid, JSONSchema, Link, MaterializedView, Project, RecordSet, Organization, SearchIndex, SubmissionView, Table, Team, VirtualTable]) The entity instance to store. Must be one of the supported entity types. |
parent |
(Optional[Union[Folder, Project]]) The parent folder or project to store the entity in. Only applicable for File, Folder, Link, and RecordSet entities. Ignored for other entity types. |
file_options |
(Optional[StoreFileOptions]) |
container_options |
(Optional[StoreContainerOptions]) |
table_options |
(Optional[StoreTableOptions]) |
json_schema_options |
(Optional[StoreJSONSchemaOptions]) |
grid_options |
(Optional[StoreGridOptions]) |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The stored Synapse entity model instance.
- An error is raised if the entity is not a supported type.
## Not run: ## Example 1: Storing a file # Store a file to Synapse: library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123456") stored_file = file |> synStore() print(sprintf("Stored file: %s (ID: %s)", stored_file$name, stored_file$id)) ## Example 2: Storing a file with custom options # Store a file with custom options: library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123456") stored_file = file |> synStore( file_options = StoreFileOptions( synapse_store = TRUE, content_type = "text/plain", merge_existing_annotations = TRUE ) ) print(sprintf("Stored file: %s", stored_file$name)) ## Example 3: Storing a folder # Store a folder to Synapse: library(synapser) synLogin() folder = Folder(name = "My Folder", parent_id = "syn123456") stored_folder = folder |> synStore() print(sprintf("Stored folder: %s (ID: %s)", stored_folder$name, stored_folder$id)) ## Example 4: Storing a project # Store a project to Synapse: library(synapser) synLogin() project = Project(name = "My Project") stored_project = project |> synStore() print(sprintf("Stored project: %s (ID: %s)", stored_project$name, stored_project$id)) ## Example 5: Storing a table # Store a table to Synapse: library(synapser) synLogin() table = Table( name = "My Table", parent_id = "syn123456", columns = list(Column(name = "col1", column_type = "STRING", maximum_size = 50L)) ) stored_table = table |> synStore( table_options = StoreTableOptions(dry_run = FALSE, job_timeout = 600L) ) print(sprintf("Stored table: %s (ID: %s)", stored_table$name, stored_table$id)) ## Example 6: Storing a link # Store a link to Synapse: library(synapser) synLogin() link = Link(name = "My Link", parent_id = "syn123456", target_id = "syn789") stored_link = link |> synStore() print(sprintf("Stored link: %s (ID: %s)", stored_link$name, stored_link$id)) ## Example 7: Storing with parent parameter # Store an entity by passing the parent as a parameter: library(synapser) synLogin() parent_folder = Folder(id = "syn123456") file = File(path = "/path/to/file.txt") stored_file = file |> synStore(parent = parent_folder) print(sprintf("Stored file: %s in folder %s", stored_file$name, parent_folder$id)) ## Example 8: Storing an Evaluation # Store an evaluation (challenge queue): library(synapser) synLogin() evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = "syn123456" ) stored_evaluation = evaluation |> synStore() print(sprintf("Stored evaluation: %s (ID: %s)", stored_evaluation$name, stored_evaluation$id)) ## Example 9: Creating a Team # Create a new team (note: Teams use create, not update): library(synapser) synLogin() team = Team( name = "My Research Team", description = "A team for collaborative research" ) created_team = team |> synStore() print(sprintf("Created team: %s (ID: %s)", created_team$name, created_team$id)) ## End(Not run)## Not run: ## Example 1: Storing a file # Store a file to Synapse: library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123456") stored_file = file |> synStore() print(sprintf("Stored file: %s (ID: %s)", stored_file$name, stored_file$id)) ## Example 2: Storing a file with custom options # Store a file with custom options: library(synapser) synLogin() file = File(path = "/path/to/file.txt", parent_id = "syn123456") stored_file = file |> synStore( file_options = StoreFileOptions( synapse_store = TRUE, content_type = "text/plain", merge_existing_annotations = TRUE ) ) print(sprintf("Stored file: %s", stored_file$name)) ## Example 3: Storing a folder # Store a folder to Synapse: library(synapser) synLogin() folder = Folder(name = "My Folder", parent_id = "syn123456") stored_folder = folder |> synStore() print(sprintf("Stored folder: %s (ID: %s)", stored_folder$name, stored_folder$id)) ## Example 4: Storing a project # Store a project to Synapse: library(synapser) synLogin() project = Project(name = "My Project") stored_project = project |> synStore() print(sprintf("Stored project: %s (ID: %s)", stored_project$name, stored_project$id)) ## Example 5: Storing a table # Store a table to Synapse: library(synapser) synLogin() table = Table( name = "My Table", parent_id = "syn123456", columns = list(Column(name = "col1", column_type = "STRING", maximum_size = 50L)) ) stored_table = table |> synStore( table_options = StoreTableOptions(dry_run = FALSE, job_timeout = 600L) ) print(sprintf("Stored table: %s (ID: %s)", stored_table$name, stored_table$id)) ## Example 6: Storing a link # Store a link to Synapse: library(synapser) synLogin() link = Link(name = "My Link", parent_id = "syn123456", target_id = "syn789") stored_link = link |> synStore() print(sprintf("Stored link: %s (ID: %s)", stored_link$name, stored_link$id)) ## Example 7: Storing with parent parameter # Store an entity by passing the parent as a parameter: library(synapser) synLogin() parent_folder = Folder(id = "syn123456") file = File(path = "/path/to/file.txt") stored_file = file |> synStore(parent = parent_folder) print(sprintf("Stored file: %s in folder %s", stored_file$name, parent_folder$id)) ## Example 8: Storing an Evaluation # Store an evaluation (challenge queue): library(synapser) synLogin() evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = "syn123456" ) stored_evaluation = evaluation |> synStore() print(sprintf("Stored evaluation: %s (ID: %s)", stored_evaluation$name, stored_evaluation$id)) ## Example 9: Creating a Team # Create a new team (note: Teams use create, not update): library(synapser) synLogin() team = Team( name = "My Research Team", description = "A team for collaborative research" ) created_team = team |> synStore() print(sprintf("Created team: %s (ID: %s)", created_team$name, created_team$id)) ## End(Not run)
Add or update rows in Synapse from the sources defined below. In most cases the result of this function call will append rows to the table. In the case of an update this method works on a full row replacement. What this means is that you may not do a partial update of a row. If you want to update a row you must pass in all the data for that row, or the data for the columns not provided will be set to null.
If you'd like to update a row see the example Updating rows in a table below.
If you'd like to perform an upsert or partial update of a row you may use
the synUpsertRows() function. See that function for more information.
Note the following behavior for the order of columns:
- If a column is added via the synAddColumn() function it will be added at the
index you specify, or at the end of the columns list.
- If column(s) are added during the construction of your Table instance, ie.
Table(columns = list(Column(name = "foo"))), they will be added at the beginning
of the columns list.
- If you use the synStoreRows() function and the schema_storage_strategy is set to
INFER_FROM_DATA the columns will be added at the end of the columns list.
How datetime values are interpreted:
Synapse DATE columns store an exact moment in time, represented as the
number of milliseconds since 1970-01-01 00:00:00 UTC. Before upload,
datetime values are converted to that representation as follows:
- Timezone-aware datetimes (POSIXct values created with a tz, e.g.
as.POSIXct("2017-02-14 11:23", tz = "America/Los_Angeles")) are converted
to UTC exactly. This is the recommended way to pass datetime data: the stored
value does not depend on the timezone settings of the machine performing the
upload or on the date the upload is run.
- Naive datetimes (POSIXct values without a tz) are assumed to be in the
local timezone of the machine at the time of upload. That single UTC offset is
applied to every value, including values whose dates fall in a
different daylight saving period, which will be stored shifted by one
hour. For example, uploading 2017-02-14 11:23 (a PST date, UTC-8)
from a machine currently on PDT (UTC-7) stores 2017-02-14 18:23 UTC
instead of the correct 19:23 UTC. To avoid this, create your datetimes with
a timezone, e.g. as.POSIXct(x, tz = "America/Los_Angeles").
- Plain R Date values (as opposed to datetimes) are treated
as midnight of that date and converted the same way naive
datetimes are: using the local timezone of the machine at the
time of upload, with the same daylight-saving-shift risk
described above.
- Midnight values deserve extra care: the one-hour daylight saving
shift described above can move a naive midnight datetime — or a
Date, which is treated as midnight — to 11 PM of the
previous day, changing the calendar date the value displays as.
Why timezone-aware values are recommended:
A naive datetime such as 2017-02-14 11:23 is only "what a clock on the
wall said." Before it can be stored as an exact moment in time, something
has to answer: a clock where? Timezone-aware values answer that
question in the data itself; naive values leave the client to guess, and
it guesses the uploading machine's current timezone.
A zone name like "America/Los_Angeles" does not mean a fixed offset
such as UTC-8. It means "a Los Angeles wall clock" — and those clocks
move twice a year: UTC-7 in summer (PDT), UTC-8 in winter (PST). When you
create datetimes with as.POSIXct(x, tz = "America/Los_Angeles"), R looks up
what LA clocks were set to on each value's own date:
- 2017-02-14 → winter → interpreted using UTC-8
- 2018-10-01 → summer → interpreted using UTC-7
When the data is queried back with synQuery(..., convert_to_datetime = TRUE),
DATE columns are returned as datetimes in UTC. See
vignette("tables", package = "synapser") for how to work with the returned
values and view them in another timezone.
Limitations:
- Synapse limits the number of rows that may be stored in a single request to
a CSV file that is 1GB. If you are storing a CSV file that is larger than
this limit the data will be chunked into smaller requests. This process is
done by reading the file once to determine what the row and byte boundries
are and calculating the MD5 hash of that portion, then reading the file
again to send the data to Synapse. This process is done to ensure that the
data is not corrupted during the upload process, in addition Synapse
requires the MD5 hash of the data to be sent in the request along with the
number of bytes that are being sent.
- The limit of 1GB is also enforced when storing a named list or a data frame.
The data will be converted to a CSV format using the to_csv() pandas
function. If you are storing more than a 1GB file it is recommended that
you store the data as a CSV and use the file path to upload the data. This
is due to the fact that the data frame chunking process is slower than
reading portions of a file on disk and calculating the MD5 hash of that
portion.
The following is a Sequence Diagram that describes the process noted in the limitation above. It shows how the data is chunked into smaller requests when the data exceeds the limit of 1GB, and how portions of the data are read from the CSV file on disk while being uploaded to Synapse.
sequenceDiagram
participant User
participant Table
participant FileSystem
participant Synapse
User->>Table: store_rows(values)
alt CSV size > 1GB
Table->>Synapse: Apply schema changes before uploading
note over Table, FileSystem: Read CSV twice
Table->>FileSystem: Read entire CSV (First Pass)
FileSystem-->>Table: Compute chunk sizes & MD5 hashes
loop Read and Upload CSV chunks (Second Pass)
Table->>FileSystem: Read next chunk from CSV
FileSystem-->>Table: Return bytes
Table->>Synapse: Upload CSV chunk
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
else
Table->>Synapse: Upload CSV without splitting & Any additional schema changes
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
Table-->>User: Upload complete
The following is a Sequence Diagram that describes the process noted in the limitation above for data frames. It shows how the data is chunked into smaller requests when the data exceeds the limit of 1GB, and how portions of the data are read from the data frame while being uploaded to Synapse.
sequenceDiagram
participant User
participant Table
participant MemoryBuffer
participant Synapse
User->>Table: store_rows(DataFrame)
loop For all rows in DataFrame in 100 row increments
Table->>MemoryBuffer: Convert DataFrame rows to CSV in-memory
MemoryBuffer-->>Table: Compute chunk sizes & MD5 hashes
end
alt Multiple chunks detected
Table->>Synapse: Apply schema changes before uploading
end
loop For all chunks found in first loop
loop for all parts in chunk byte boundry
Table->>MemoryBuffer: Read small (< 8MB) part of the chunk
MemoryBuffer-->>Table: Return bytes (with correct offset)
Table->>Synapse: Upload part
Synapse-->>Table: Upload response
end
Table->>Synapse: Complete upload
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
Table-->>User: Upload complete
synStoreRows(instance, values, schema_storage_strategy=NULL, column_expansion_strategy=NULL, dry_run=FALSE, additional_changes=NULL, insert_size_bytes=943718400L, csv_table_descriptor=NULL, date_columns=NULL, date_format=NULL, read_csv_kwargs=NULL, to_csv_kwargs=NULL, job_timeout=600L, synapse_client=NULL)synStoreRows(instance, values, schema_storage_strategy=NULL, column_expansion_strategy=NULL, dry_run=FALSE, additional_changes=NULL, insert_size_bytes=943718400L, csv_table_descriptor=NULL, date_columns=NULL, date_format=NULL, read_csv_kwargs=NULL, to_csv_kwargs=NULL, job_timeout=600L, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
values |
(Union[str, dict[str, Any], object]) Supports storing data from the following sources: |
schema_storage_strategy |
(SchemaStorageStrategy) Determines how to automate the creation of columns based on the data that is being stored. If you want to have full control over the schema you may set this to |
column_expansion_strategy |
(ColumnExpansionStrategy) Determines how to automate the expansion of columns based on the data that is being stored. The options given allow cells with a limit on the length of content (Such as strings) to be expanded to a larger size if the data being stored exceeds the limit. If you want to have full control over the schema you may set this to |
dry_run |
(bool) Log the actions that would be taken, but do not actually perform the actions. This will not print out the data that would be stored or modified as a result of this action. It will print out the actions that would be taken, such as creating a new column, updating a column, or updating table metadata. This is useful for debugging and understanding what actions would be taken without actually performing them. |
additional_changes |
(list[Union[TableSchemaChangeRequest, UploadToTableRequest, AppendableRowSetRequest]]) Additional changes to the table that should execute within the same transaction as appending or updating rows. This is used as a part of the |
insert_size_bytes |
(int) The maximum size of data that will be stored to Synapse within a single transaction. The API has a limit of 1GB, but the default is set to 900 MB to allow for some overhead in the request. The implication of this limit is that when you are storing a CSV that is larger than this limit the data will be chunked into smaller requests by reading the file once to determine what the row and byte boundries are and calculating the MD5 hash of that portion, then reading the file again to send the data to Synapse. This process is done to ensure that the data is not corrupted during the upload process, in addition Synapse requires the MD5 hash of the data to be sent in the request along with the number of bytes that are being sent. This argument is also used when storing a named list or a data frame. The data will be converted to a CSV format using the |
csv_table_descriptor |
(Optional[CsvTableDescriptor]) When passing in a CSV file this will allow you to specify the format of the CSV file. This is only used when the |
date_columns |
(Optional[list[character]]) (CSV file only) The names of columns in your CSV file that contain dates or datetimes stored as formatted strings (e.g. |
date_format |
(Optional[character or named list]) (CSV file only) How the strings in |
read_csv_kwargs |
(Optional[dict[str, Any]]) Additional arguments to pass to the |
to_csv_kwargs |
(Optional[dict[str, Any]]) Additional arguments to pass to the |
job_timeout |
(int) The maximum amount of time to wait for a job to complete. This is used when inserting, and updating rows of data. Each individual request to Synapse will be sent as an independent job. If the timeout is reached a timeout error will be raised. The default is 600 seconds |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Example 1: Inserting rows into a table that already has columns # This example shows how you may insert rows into a table. # Suppose we have a table with the following columns: # | col1 | col2 | col3 | # |------|------| -----| # The following code will insert rows into the table: library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows(values = data_to_insert) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | ## Example 2: Inserting rows into a table that does not have columns # This example shows how you may insert rows into a table that does not have # columns. The columns will be inferred from the data that is being stored. library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows( values = data_to_insert, schema_storage_strategy = "INFER_FROM_DATA" ) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | ## Example 3: Using the dry_run option with a SchemaStorageStrategy of INFER_FROM_DATA # This example shows how you may use the dry_run option with the # SchemaStorageStrategy set to INFER_FROM_DATA. This will show you the # actions that would be taken, but not actually perform the actions. library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows( values = data_to_insert, dry_run = TRUE, schema_storage_strategy = "INFER_FROM_DATA" ) # The result of running this action will print to the console the actions that # would be taken, but not actually perform the actions. ## Example 4: Updating rows in a table # This example shows how you may query for data in a table, update the data, # and then store the updated rows back in Synapse. # Suppose we have a table that has the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | # Behind the scenes the table also has ROW_ID and ROW_VERSION columns # which are used to identify the row that is being updated. These columns # are not shown in the table above, but are included in the data that is # returned when querying the table. If you add data that does not have these # columns the data will be treated as new rows to be inserted. library(synapser) synLogin() # Also works with Dataset query_results = synQuery(query = "select * from syn1234 where col1 in ('A', 'B')") # Update col2 of the row where col1 is A to 22 query_results[query_results$col1 == "A", "col2"] = 22 # Update col3 of the row where col1 is B to 33 query_results[query_results$col1 == "B", "col3"] = 33 Table(id = "syn1234") |> synStoreRows(values = query_results) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 22 | 1 | # | B | 2 | 33 | # | C | 3 | 3 | ## Example 5: Inserting rows from a CSV file that contains date columns # This example shows how you may insert rows from a CSV file that contains # date columns. The date columns are converted # to epoch time in milliseconds before the data is uploaded so that Synapse # can store them in DATE columns. # Suppose we have a CSV file with the following data: # | col1 | date_col1 | date_col2 | # |------|------------|------------| # | A | 01/15/2024 | 2024-01-20 | # | B | 02/20/2024 | 2024-02-25 | library(synapser) synLogin() Table(id = "syn1234") |> synStoreRows( values = "path/to/file.csv", schema_storage_strategy = "INFER_FROM_DATA", date_columns = list("date_col1", "date_col2"), date_format = list(date_col1 = "%m/%d/%Y", date_col2 = "%Y-%m-%d") ) ## End(Not run)## Not run: ## Example 1: Inserting rows into a table that already has columns # This example shows how you may insert rows into a table. # Suppose we have a table with the following columns: # | col1 | col2 | col3 | # |------|------| -----| # The following code will insert rows into the table: library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows(values = data_to_insert) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | ## Example 2: Inserting rows into a table that does not have columns # This example shows how you may insert rows into a table that does not have # columns. The columns will be inferred from the data that is being stored. library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows( values = data_to_insert, schema_storage_strategy = "INFER_FROM_DATA" ) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | ## Example 3: Using the dry_run option with a SchemaStorageStrategy of INFER_FROM_DATA # This example shows how you may use the dry_run option with the # SchemaStorageStrategy set to INFER_FROM_DATA. This will show you the # actions that would be taken, but not actually perform the actions. library(synapser) synLogin() # Also works with Dataset data_to_insert = data.frame( col1 = c("A", "B", "C"), col2 = c(1, 2, 3), col3 = c(1, 2, 3) ) Table(id = "syn1234") |> synStoreRows( values = data_to_insert, dry_run = TRUE, schema_storage_strategy = "INFER_FROM_DATA" ) # The result of running this action will print to the console the actions that # would be taken, but not actually perform the actions. ## Example 4: Updating rows in a table # This example shows how you may query for data in a table, update the data, # and then store the updated rows back in Synapse. # Suppose we have a table that has the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # | C | 3 | 3 | # Behind the scenes the table also has ROW_ID and ROW_VERSION columns # which are used to identify the row that is being updated. These columns # are not shown in the table above, but are included in the data that is # returned when querying the table. If you add data that does not have these # columns the data will be treated as new rows to be inserted. library(synapser) synLogin() # Also works with Dataset query_results = synQuery(query = "select * from syn1234 where col1 in ('A', 'B')") # Update col2 of the row where col1 is A to 22 query_results[query_results$col1 == "A", "col2"] = 22 # Update col3 of the row where col1 is B to 33 query_results[query_results$col1 == "B", "col3"] = 33 Table(id = "syn1234") |> synStoreRows(values = query_results) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 22 | 1 | # | B | 2 | 33 | # | C | 3 | 3 | ## Example 5: Inserting rows from a CSV file that contains date columns # This example shows how you may insert rows from a CSV file that contains # date columns. The date columns are converted # to epoch time in milliseconds before the data is uploaded so that Synapse # can store them in DATE columns. # Suppose we have a CSV file with the following data: # | col1 | date_col1 | date_col2 | # |------|------------|------------| # | A | 01/15/2024 | 2024-01-20 | # | B | 02/20/2024 | 2024-02-25 | library(synapser) synLogin() Table(id = "syn1234") |> synStoreRows( values = "path/to/file.csv", schema_storage_strategy = "INFER_FROM_DATA", date_columns = list("date_col1", "date_col2"), date_format = list(date_col1 = "%m/%d/%Y", date_col2 = "%Y-%m-%d") ) ## End(Not run)
Sync this container and all possible sub-folders from Synapse. By default this
will download the files that are found and it will populate the
files and folders attributes with the found files and folders, along with
all other entity types (tables, entityviews, etc.) present in the container.
If you only want to retrieve the full tree of metadata about your
container specify download_file as FALSE.
This works similar to the Python synapseutils.syncFromSynapse utility function,
and generates a manifest.csv file in each synced directory. The manifest uses CSV format
with parentId and ID columns, interoperable with the Synapse UI download
cart and synDownloadListFiles() output.
Supports syncing Files, Folders, Tables, EntityViews, SubmissionViews, Datasets,
DatasetCollections, MaterializedViews, and VirtualTables from Synapse. The
metadata for these entity types will be populated in their respective
attributes (files, folders, tables, entityviews, submissionviews,
datasets, datasetcollections, materializedviews, virtualtables) if
they are found within the container.
synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL)synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
path |
(Optional[str]) An optional path where the file hierarchy will be reproduced. If not specified the files will by default be placed in the synapseCache. |
recursive |
(bool) Whether or not to recursively get the entire hierarchy of the folder and sub-folders. |
download_file |
(bool) Whether to download the files found or not. |
if_collision |
(str) Determines how to handle file collisions. May be |
failure_strategy |
(str) Determines how to handle failures when retrieving children under this Folder and an exception occurs. One of |
include_activity |
(bool) Whether to include the activity of the files. |
follow_link |
(bool) Whether to follow a link entity or not. Links can be used to point at other Synapse entities. |
link_hops |
(int) The number of hops to follow the link. A number of 1 is used to prevent circular references. There is nothing in place to prevent infinite loops. Be careful if setting this above 1. |
queue |
(Queue) An optional queue to use to download files in parallel. |
include_types |
(Optional[list[str]]) Must be a list of entity types (ie. list("folder", "file")) which can be found here. Defaults to |
manifest |
(character) Determines whether to generate a manifest CSV file. Options are: |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The object that was called on. This will be the same object that was called on to start the sync.
An error is raised if the folder does not have an id set.
A sequence diagram for this method is as follows:
sequenceDiagram
autonumber
participant project_or_folder
activate project_or_folder
project_or_folder->>sync_from_synapse: Recursive search and download files
activate sync_from_synapse
opt Current instance not retrieved from Synapse
sync_from_synapse->>project_or_folder: Call .get() method
project_or_folder-->>sync_from_synapse: .
end
loop For each return of the generator
sync_from_synapse->>client: call .getChildren() method
client-->>sync_from_synapse: .
note over sync_from_synapse: Append to a running list
end
loop For each child
note over sync_from_synapse: Create all pending_tasks at current depth
alt Child is File
note over sync_from_synapse: Append file.get() method
else Child is Folder
note over sync_from_synapse: Append folder.get() method
alt Recursive is True
note over sync_from_synapse: Append folder.sync_from_synapse() method
end
else Child is Link and hops > 0
note over sync_from_synapse: Append task to follow link
end
end
loop For each task in pending_tasks
par file.get()
sync_from_synapse->>File: Retrieve File metadata and Optionally download
File->>client: .get()
client-->>File: .
File-->>sync_from_synapse: .
and folder.get()
sync_from_synapse->>Folder: Retrieve Folder metadata
Folder->>client: .get()
client-->>Folder: .
Folder-->>sync_from_synapse: .
and folder.sync_from_synapse_async()
note over sync_from_synapse: This is a recursive call to sync_from_synapse
sync_from_synapse->>sync_from_synapse: Recursive call to .sync_from_synapse_async()
and _follow_link
sync_from_synapse ->>client: call get_entity_id_bundle2 function
client-->sync_from_synapse: .
note over sync_from_synapse: Do nothing if not link
note over sync_from_synapse: call _create_task_for_child and execute
end
end
opt manifest != "suppress" and path is set
alt manifest == "all"
loop For each directory path
sync_from_synapse->>manifest: call generate_manifest_csv(files, dir_path, syn)
manifest-->>sync_from_synapse: manifest.csv written to dir_path
end
else manifest == "root"
sync_from_synapse->>manifest: call generate_manifest_csv(all_files, root_path, syn)
manifest-->>sync_from_synapse: manifest.csv written to root_path
end
end
deactivate sync_from_synapse
deactivate project_or_folder
## Not run: ## Using this function # Suppose I want to walk the immediate children of a folder without downloading the files: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (folder in my_folder$folders) { print(folder$name) } for (file in my_folder$files) { print(file$name) } for (table in my_folder$tables) { print(table$name) } for (dataset in my_folder$datasets) { print(dataset$name) } # Suppose I want to download the immediate children of a folder: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", recursive = FALSE) for (folder in my_folder$folders) { print(folder$name) } for (file in my_folder$files) { print(file$name) } # Suppose I want to sync only specific entity types from a Project: library(synapser) synLogin() my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse( path = "/path/to/folder", include_types = list("folder", "file", "table", "dataset") ) # Access different entity types for (table in my_project$tables) { cat(sprintf("Table: %s\n", table$name)) } for (dataset in my_project$datasets) { cat(sprintf("Dataset: %s\n", dataset$name)) } # Suppose I want to download all the children of a Project and all sub-folders and files: library(synapser) synLogin() my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder") # Suppose I want to download all the children of a Folder and all sub-folders and files and generate a manifest file: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", manifest = "all") # Suppose I want to download a manifest file at the root path: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", manifest = "root", download_file = FALSE) ## End(Not run)## Not run: ## Using this function # Suppose I want to walk the immediate children of a folder without downloading the files: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (folder in my_folder$folders) { print(folder$name) } for (file in my_folder$files) { print(file$name) } for (table in my_folder$tables) { print(table$name) } for (dataset in my_folder$datasets) { print(dataset$name) } # Suppose I want to download the immediate children of a folder: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", recursive = FALSE) for (folder in my_folder$folders) { print(folder$name) } for (file in my_folder$files) { print(file$name) } # Suppose I want to sync only specific entity types from a Project: library(synapser) synLogin() my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse( path = "/path/to/folder", include_types = list("folder", "file", "table", "dataset") ) # Access different entity types for (table in my_project$tables) { cat(sprintf("Table: %s\n", table$name)) } for (dataset in my_project$datasets) { cat(sprintf("Dataset: %s\n", dataset$name)) } # Suppose I want to download all the children of a Project and all sub-folders and files: library(synapser) synLogin() my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder") # Suppose I want to download all the children of a Folder and all sub-folders and files and generate a manifest file: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", manifest = "all") # Suppose I want to download a manifest file at the root path: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", manifest = "root", download_file = FALSE) ## End(Not run)
Sync this container and all possible sub-folders from Synapse. By default this
will download the files that are found and it will populate the
files and folders attributes with the found files and folders, along with
all other entity types (tables, entityviews, etc.) present in the container.
If you only want to retrieve the full tree of metadata about your
container specify download_file as FALSE.
This works similarly to the legacy synapseutils.syncFromSynapse utility function,
and generates a manifest.csv file in each synced directory. The manifest uses CSV format
with parentId and ID columns, interoperable with the Synapse UI download
cart and synDownloadListFiles() output.
Supports syncing Files, Folders, Tables, EntityViews, SubmissionViews, Datasets,
DatasetCollections, MaterializedViews, and VirtualTables from Synapse. The
metadata for these entity types will be populated in their respective
attributes (files, folders, tables, entityviews, submissionviews,
datasets, datasetcollections, materializedviews, virtualtables) if
they are found within the container.
synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL)synSyncFromSynapse(instance, path=NULL, recursive=TRUE, download_file=TRUE, if_collision="overwrite.local", failure_strategy="LOG_EXCEPTION", include_activity=TRUE, follow_link=FALSE, link_hops=1L, queue=NULL, include_types=NULL, manifest="all", synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
path |
(Optional[str]) An optional path where the file hierarchy will be reproduced. If not specified the files will by default be placed in the synapseCache. |
recursive |
(bool) Whether or not to recursively get the entire hierarchy of the folder and sub-folders. |
download_file |
(bool) Whether to download the files found or not. |
if_collision |
(str) Determines how to handle file collisions. May be: |
failure_strategy |
(str) Determines how to handle failures when retrieving children under this Folder and an exception occurs. One of |
include_activity |
(bool) Whether to include the activity of the files. |
follow_link |
(bool) Whether to follow a link entity or not. Links can be used to point at other Synapse entities. |
link_hops |
(int) The number of hops to follow the link. A number of 1 is used to prevent circular references. There is nothing in place to prevent infinite loops. Be careful if setting this above 1. |
queue |
(Queue) An optional queue to use to download files in parallel. |
include_types |
(Optional[list[str]]) Must be a list of entity types (ie. list("folder", "file")) which can be found here. Defaults to |
manifest |
(character) Determines whether to generate a manifest CSV file. Options are: |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The object that was called on. This will be the same object that was called on to start the sync.
An error is raised if the folder does not have an id set.
A sequence diagram for this method is as follows:
sequenceDiagram
autonumber
participant project_or_folder
activate project_or_folder
project_or_folder->>sync_from_synapse: Recursive search and download files
activate sync_from_synapse
opt Current instance not retrieved from Synapse
sync_from_synapse->>project_or_folder: Call .get() method
project_or_folder-->>sync_from_synapse: .
end
loop For each return of the generator
sync_from_synapse->>client: call .getChildren() method
client-->>sync_from_synapse: .
note over sync_from_synapse: Append to a running list
end
loop For each child
note over sync_from_synapse: Create all pending_tasks at current depth
alt Child is File
note over sync_from_synapse: Append file.get() method
else Child is Folder
note over sync_from_synapse: Append folder.get() method
alt Recursive is True
note over sync_from_synapse: Append folder.sync_from_synapse() method
end
else Child is Link and hops > 0
note over sync_from_synapse: Append task to follow link
end
end
loop For each task in pending_tasks
par file.get()
sync_from_synapse->>File: Retrieve File metadata and Optionally download
File->>client: .get()
client-->>File: .
File-->>sync_from_synapse: .
and folder.get()
sync_from_synapse->>Folder: Retrieve Folder metadata
Folder->>client: .get()
client-->>Folder: .
Folder-->>sync_from_synapse: .
and folder.sync_from_synapse_async()
note over sync_from_synapse: This is a recursive call to sync_from_synapse
sync_from_synapse->>sync_from_synapse: Recursive call to .sync_from_synapse_async()
and _follow_link
sync_from_synapse ->>client: call get_entity_id_bundle2 function
client-->sync_from_synapse: .
note over sync_from_synapse: Do nothing if not link
note over sync_from_synapse: call _create_task_for_child and execute
end
end
opt manifest != "suppress" and path is set
alt manifest == "all"
loop For each directory path
sync_from_synapse->>manifest: call generate_manifest_csv(files, dir_path, syn)
manifest-->>sync_from_synapse: manifest.csv written to dir_path
end
else manifest == "root"
sync_from_synapse->>manifest: call generate_manifest_csv(all_files, root_path, syn)
manifest-->>sync_from_synapse: manifest.csv written to root_path
end
end
deactivate sync_from_synapse
deactivate project_or_folder
## Not run: ## Using this function # Suppose I want to walk the immediate children of a folder without downloading the files: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (folder in my_folder$folders) { cat(folder$name, "\n") } for (file in my_folder$files) { cat(file$name, "\n") } for (table in my_folder$tables) { cat(table$name, "\n") } for (dataset in my_folder$datasets) { cat(dataset$name, "\n") } # Suppose I want to download the immediate children of a folder: my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", recursive = FALSE) for (folder in my_folder$folders) { cat(folder$name, "\n") } for (file in my_folder$files) { cat(file$name, "\n") } # Suppose I want to sync only specific entity types from a Project: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse( path = "/path/to/folder", include_types = list("folder", "file", "table", "dataset") ) # Access different entity types for (table in my_project$tables) { cat(sprintf("Table: %s\n", table$name)) } for (dataset in my_project$datasets) { cat(sprintf("Dataset: %s\n", dataset$name)) } # Suppose I want to download all the children of a Project and all sub-folders and files: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder") # Suppose I want to download all the children of a Project and all sub-folders and files and generate a manifest file: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder", manifest = "all") # Suppose I want to download a manifest file at the root path: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder", manifest = "root", download_file = FALSE) ## End(Not run)## Not run: ## Using this function # Suppose I want to walk the immediate children of a folder without downloading the files: library(synapser) synLogin() my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(download_file = FALSE, recursive = FALSE) for (folder in my_folder$folders) { cat(folder$name, "\n") } for (file in my_folder$files) { cat(file$name, "\n") } for (table in my_folder$tables) { cat(table$name, "\n") } for (dataset in my_folder$datasets) { cat(dataset$name, "\n") } # Suppose I want to download the immediate children of a folder: my_folder = Folder(id = "syn12345") my_folder = my_folder |> synSyncFromSynapse(path = "/path/to/folder", recursive = FALSE) for (folder in my_folder$folders) { cat(folder$name, "\n") } for (file in my_folder$files) { cat(file$name, "\n") } # Suppose I want to sync only specific entity types from a Project: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse( path = "/path/to/folder", include_types = list("folder", "file", "table", "dataset") ) # Access different entity types for (table in my_project$tables) { cat(sprintf("Table: %s\n", table$name)) } for (dataset in my_project$datasets) { cat(sprintf("Dataset: %s\n", dataset$name)) } # Suppose I want to download all the children of a Project and all sub-folders and files: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder") # Suppose I want to download all the children of a Project and all sub-folders and files and generate a manifest file: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder", manifest = "all") # Suppose I want to download a manifest file at the root path: my_project = Project(id = "syn12345") my_project = my_project |> synSyncFromSynapse(path = "/path/to/folder", manifest = "root", download_file = FALSE) ## End(Not run)
Upload files to Synapse using a manifest CSV file.
Accepts manifests produced by synSyncFromSynapse(),
synDownloadListFiles(), or the Synapse UI download cart.
The manifest must have at minimum a path and parentId column.
All other columns that are not part of the standard manifest column set
are treated as file annotations.
Standard manifest columns: ID, name, parentId, contentType, path, synapseStore, activityName, activityDescription, forceVersion, used, executed
synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL)synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
manifest_path |
(character) Path to the CSV manifest file. |
dry_run |
(logical) If TRUE, perform full validation of the manifest (including verifying that all parent containers exist in Synapse) but skip the actual file upload. |
send_messages |
(logical) If TRUE, send a Synapse notification message on completion. |
retries |
(integer) Number of notification retries (only relevant when send_messages=TRUE). |
merge_existing_annotations |
(logical) If TRUE, merge manifest annotations with existing annotations on Synapse. If FALSE, overwrite them. |
associate_activity_to_new_version |
(logical) If TRUE and a version update occurs, the existing Synapse activity is associated with the new version. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
List of File entities that were created or updated. Returns an empty list if dry_run=TRUE or if no rows were eligible for upload.
## Not run: ## Using this function library(synapser) synLogin() folder = Folder(id = "syn12345") uploaded = folder |> synSyncToSynapse(manifest_path = "/path/to/manifest.csv") ## End(Not run)## Not run: ## Using this function library(synapser) synLogin() folder = Folder(id = "syn12345") uploaded = folder |> synSyncToSynapse(manifest_path = "/path/to/manifest.csv") ## End(Not run)
Upload files to Synapse using a manifest CSV file.
Accepts manifests produced by synSyncFromSynapse(),
synDownloadListFiles(), or the Synapse UI download cart.
The manifest must have at minimum a path and parentId column.
All other columns that are not part of the standard manifest column set
are treated as file annotations.
Standard manifest columns: ID, name, parentId, contentType, path, synapseStore, activityName, activityDescription, forceVersion, used, executed
synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL)synSyncToSynapse(instance, manifest_path, dry_run=FALSE, send_messages=TRUE, retries=4L, merge_existing_annotations=TRUE, associate_activity_to_new_version=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
manifest_path |
(character) Path to the CSV manifest file. |
dry_run |
(logical) If TRUE, perform full validation of the manifest (including verifying that all parent containers exist in Synapse) but skip the actual file upload. |
send_messages |
(logical) If TRUE, send a Synapse notification message on completion. |
retries |
(integer) Number of notification retries (only relevant when send_messages=TRUE). |
merge_existing_annotations |
(logical) If TRUE, merge manifest annotations with existing annotations on Synapse. If FALSE, overwrite them. |
associate_activity_to_new_version |
(logical) If TRUE and a version update occurs, the existing Synapse activity is associated with the new version. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
List of File entities that were created or updated. Returns an empty list if dry_run=TRUE or if no rows were eligible for upload.
## Not run: ## Using this function library(synapser) synLogin() project = Project(id = "syn12345") uploaded = project |> synSyncToSynapse(manifest_path = "/path/to/manifest.csv") ## End(Not run)## Not run: ## Using this function library(synapser) synLogin() project = Project(id = "syn12345") uploaded = project |> synSyncToSynapse(manifest_path = "/path/to/manifest.csv") ## End(Not run)
Unbind the JSON schema bound to the entity.
synUnbindSchema(instance, synapse_client=NULL)synUnbindSchema(instance, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Using this function # Unbinding a JSON schema from an EntityView. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView first bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Unbind the schema from the EntityView test_view |> synUnbindSchema() cat("Successfully unbound schema from EntityView\n") ## End(Not run)## Not run: ## Using this function # Unbinding a JSON schema from an EntityView. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView first bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Unbind the schema from the EntityView test_view |> synUnbindSchema() cat("Successfully unbound schema from EntityView\n") ## End(Not run)
Unbind the JSON schema bound to the entity.
synUnbindSchema(instance, synapse_client=NULL)synUnbindSchema(instance, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Using this function # Unbinding a JSON schema from a folder or file. This example demonstrates # how to remove schema bindings from entities. Assumes entities already have # schemas bound. Set the PROJECT_NAME and FILE_PATH variables to your # project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() cat("Created test file:", FILE_PATH, "\n") bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Unbind the schema from the folder test_folder |> synUnbindSchema() cat("Successfully unbound schema from folder\n") # Unbind the schema from the file example_file |> synUnbindSchema() cat("Successfully unbound schema from file\n") ## End(Not run)## Not run: ## Using this function # Unbinding a JSON schema from a folder or file. This example demonstrates # how to remove schema bindings from entities. Assumes entities already have # schemas bound. Set the PROJECT_NAME and FILE_PATH variables to your # project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() cat("Created test file:", FILE_PATH, "\n") bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Unbind the schema from the folder test_folder |> synUnbindSchema() cat("Successfully unbound schema from folder\n") # Unbind the schema from the file example_file |> synUnbindSchema() cat("Successfully unbound schema from file\n") ## End(Not run)
Unbind the JSON schema bound to the entity.
synUnbindSchema(instance, synapse_client=NULL)synUnbindSchema(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Using this function # Unbinding a JSON schema from a folder or file. This example demonstrates # how to remove schema bindings from entities. Assumes entities already have # schemas bound. Set the PROJECT_NAME and FILE_PATH variables to your # project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() cat("Created test file:", FILE_PATH, "\n") bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Unbind the schema from the folder test_folder |> synUnbindSchema() cat("Successfully unbound schema from folder\n") # Unbind the schema from the file example_file |> synUnbindSchema() cat("Successfully unbound schema from file\n") ## End(Not run)## Not run: ## Using this function # Unbinding a JSON schema from a folder or file. This example demonstrates # how to remove schema bindings from entities. Assumes entities already have # schemas bound. Set the PROJECT_NAME and FILE_PATH variables to your # project name and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder first bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() cat("Created test file:", FILE_PATH, "\n") bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Unbind the schema from the folder test_folder |> synUnbindSchema() cat("Successfully unbound schema from folder\n") # Unbind the schema from the file example_file |> synUnbindSchema() cat("Successfully unbound schema from file\n") ## End(Not run)
Unbind the JSON schema bound to the entity.
synUnbindSchema(instance, synapse_client=NULL)synUnbindSchema(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Using this function # Unbinding a JSON schema from a project. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project first bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Unbind the schema from the project test_project |> synUnbindSchema() cat("Successfully unbound schema from project\n") ## End(Not run)## Not run: ## Using this function # Unbinding a JSON schema from a project. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project first bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Unbind the schema from the project test_project |> synUnbindSchema() cat("Successfully unbound schema from project\n") ## End(Not run)
Unbind the JSON schema bound to the entity.
synUnbindSchema(instance, synapse_client=NULL)synUnbindSchema(instance, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
synapse_client |
(Optional[Synapse]) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Using this function # Unbinding a JSON schema from a table. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table first bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Unbind the schema from the table test_table |> synUnbindSchema() cat("Successfully unbound schema from table\n") ## End(Not run)## Not run: ## Using this function # Unbinding a JSON schema from a table. This example demonstrates # how to remove a schema binding from an entity. Assumes the entity # already has a schema bound. Set the PROJECT_NAME variable to your # project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table first bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Unbind the schema from the table test_table |> synUnbindSchema() cat("Successfully unbound schema from table\n") ## End(Not run)
Unzip the gzipped file and return the file path to the unzipped file. If the file is a markdown file, the content will be printed.
synUnzipGzippedFile(file_path)synUnzipGzippedFile(file_path)
file_path |
(str) The path to the gzipped file. |
The file path to the unzipped file.
## Not run: ## Unzip a gzipped file file_path = "path/to/file.md.gz" unzipped_file_path = synUnzipGzippedFile(file_path) ## End(Not run)## Not run: ## Unzip a gzipped file file_path = "path/to/file.md.gz" unzipped_file_path = synUnzipGzippedFile(file_path) ## End(Not run)
Updates an agent session. Only updates to the access level are currently supported.
synUpdate(instance, synapse_client=NULL)synUpdate(instance, synapse_client=NULL)
instance |
(AgentSession) The AgentSession instance to operate on. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The updated AgentSession object.
## Not run: ## Update the access level of an existing session. # Construct an AgentSession with its session ID, set the access level you # want, and call synUpdate(). library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session$access_level = "READ_YOUR_PRIVATE_DATA" my_session = my_session |> synUpdate() ## End(Not run)## Not run: ## Update the access level of an existing session. # Construct an AgentSession with its session ID, set the access level you # want, and call synUpdate(). library(synapser) synLogin() my_session = AgentSession(id = "foo") my_session$access_level = "READ_YOUR_PRIVATE_DATA" my_session = my_session |> synUpdate() ## End(Not run)
Update the access control list (ACL) for this evaluation.
You can either:
1. Provide a principal_id and access_type list to update permissions for a specific user/team
2. Provide a complete ACL named list to update all permissions at once
To remove a principal from the ACL completely, provide an empty list for access_type.
The available access types are:
- "CREATE"
- "SUBMIT"
- "READ_PRIVATE_SUBMISSION"
- "DELETE_SUBMISSION"
- "UPDATE_SUBMISSION"
- "CHANGE_PERMISSIONS"
- "READ"
- "DELETE"
- "UPDATE"
synUpdateAcl(instance, principal_id=NULL, access_type=NULL, acl=NULL, synapse_client=NULL)synUpdateAcl(instance, principal_id=NULL, access_type=NULL, acl=NULL, synapse_client=NULL)
instance |
(Evaluation) The Evaluation instance to operate on. |
principal_id |
(Optional[Union[str, int]]) The Synapse user or team ID to update permissions for. |
access_type |
(Optional[list[str]]) List of permission strings to grant to the principal. If empty, the principal will be removed from the ACL. |
acl |
(Optional[named list]) A named list containing the complete ACL data to update. You can retrieve the current ACL using |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
The updated AccessControlList response object as a named list.
- An error is raised if neither (principal_id and access_type) nor acl is provided, or if the ACL object is invalid.
- An error is also raised if the service rejects the request or an HTTP error occurs.
## Not run: ## Example 1: Update permissions for a specific principal (user/team) library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Update permissions for user with ID 12345 updated_acl = evaluation |> synUpdateAcl( principal_id = "12345", access_type = list("READ", "SUBMIT") ) updated_acl ## Example 2: Remove a principal (user/team) from the ACL # Using the evaluation stored in Example 1 # Remove user with ID 12345 from the ACL by providing an empty list updated_acl = evaluation |> synUpdateAcl( principal_id = "12345", access_type = list() ) updated_acl ## Example 3: Update the entire ACL manually # Using the evaluation stored in Example 1 # Get the current ACL acl = evaluation |> synGetAcl() # Modify the ACL manually acl$resourceAccess = c(acl$resourceAccess, list(list( principalId = 12345L, accessType = list("READ", "SUBMIT") ))) # Update with the modified ACL updated_acl = evaluation |> synUpdateAcl(acl = acl) updated_acl ## End(Not run)## Not run: ## Example 1: Update permissions for a specific principal (user/team) library(synapser) synLogin() PROJECT_ID = "syn123456" # replace with your project ID # Store a new evaluation in the project first evaluation = Evaluation( name = "My Challenge Evaluation", description = "Evaluation for my data challenge", content_source = PROJECT_ID, submission_instructions_message = "Submit CSV files only", submission_receipt_message = "Thank you for your submission!" ) |> synStore() # Update permissions for user with ID 12345 updated_acl = evaluation |> synUpdateAcl( principal_id = "12345", access_type = list("READ", "SUBMIT") ) updated_acl ## Example 2: Remove a principal (user/team) from the ACL # Using the evaluation stored in Example 1 # Remove user with ID 12345 from the ACL by providing an empty list updated_acl = evaluation |> synUpdateAcl( principal_id = "12345", access_type = list() ) updated_acl ## Example 3: Update the entire ACL manually # Using the evaluation stored in Example 1 # Get the current ACL acl = evaluation |> synGetAcl() # Modify the ACL manually acl$resourceAccess = c(acl$resourceAccess, list(list( principalId = 12345L, accessType = list("READ", "SUBMIT") ))) # Update with the modified ACL updated_acl = evaluation |> synUpdateAcl(acl = acl) updated_acl ## End(Not run)
Updates the ACL for a principal for this organization
synUpdateAcl(instance, principal_id, access_type, synapse_client=NULL)synUpdateAcl(instance, principal_id, access_type, synapse_client=NULL)
instance |
(Organization) The Organization instance to operate on. |
principal_id |
(integer) the id of the principal whose permissions are to be updated |
access_type |
(list[character]) List of permission types (e.g., list("READ", "CREATE", "DELETE")) see: ACCESS_TYPE |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Update the ACL for a Organization library(synapser) synLogin() org = Organization(name = "dpetest") org |> synUpdateAcl( principal_id = 1L, access_type = list("READ") ) ## End(Not run)## Not run: ## Update the ACL for a Organization library(synapser) synLogin() org = Organization(name = "dpetest") org |> synUpdateAcl( principal_id = 1L, access_type = list("READ") ) ## End(Not run)
Update the values of rows in the dataset. This method can only be used to update values in custom columns. Default columns cannot be updated, but may be used as primary keys.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)
instance |
(Dataset) The Dataset instance to operate on. |
values |
(object) Supports storing data from the following sources: |
primary_keys |
(list[character]) The columns to use to determine if a row already exists. If a row exists with the same values in the columns specified in this list the row will be updated. If a row does not exist nothing will be done. |
dry_run |
(logical) If set to TRUE the data will not be updated in Synapse. A message will be printed to the console with the number of rows that would have been updated and inserted. |
rows_per_query |
(integer) The number of rows that will be queried from Synapse per request. Since we need to query for the data that is being updated this will determine the number of rows that are queried at a time. The default is 50,000 rows. |
update_size_bytes |
(integer) The maximum size of the request that will be sent to Synapse when updating rows of data. The default is 1.9MB. |
insert_size_bytes |
(integer) The maximum size of the request that will be sent to Synapse when inserting rows of data. The default is 900MB. |
job_timeout |
(integer) The maximum amount of time to wait for a job to complete. This is used when inserting, and updating rows of data. Each individual request to Synapse will be sent as an independent job. If the timeout is reached a timeout error will be raised. The default is 600 seconds |
date_columns |
(Optional[list[character]]) (CSV file only) The names of columns in your CSV file that contain dates or datetimes stored as formatted strings (e.g. |
date_format |
(Optional[character or named list]) (CSV file only) How the strings in |
wait_for_eventually_consistent_view |
(logical) Only used if the table is a view. If set to TRUE this will wait for the view to reflect any changes that you've made to the view. This is useful if you need to query the view after making changes to the data. |
wait_for_eventually_consistent_view_timeout |
(integer) The maximum amount of time to wait for a view to be eventually consistent. The default is 600 seconds. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
## Not run: ## Update custom column values in a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_dataset |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_dataset |> synStore() ## End(Not run)## Not run: ## Update custom column values in a dataset. library(synapser) synLogin() my_dataset = Dataset(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_dataset |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_dataset |> synStore() ## End(Not run)
Update the values of rows in the dataset collection. This method can only be used to update values in custom columns. Default columns cannot be updated, but may be used as primary keys.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)
instance |
(DatasetCollection) The DatasetCollection instance to operate on. |
values |
(object) Supports storing data from the following sources: |
primary_keys |
(list[character]) The columns to use to determine if a row already exists. If a row exists with the same values in the columns specified in this list the row will be updated. If a row does not exist nothing will be done. |
dry_run |
(logical) If set to TRUE the data will not be updated in Synapse. A message will be printed to the console with the number of rows that would have been updated and inserted. If you would like to see the data that would be updated and inserted you may set the |
rows_per_query |
(integer) The number of rows that will be queried from Synapse per request. Since we need to query for the data that is being updated this will determine the number of rows that are queried at a time. The default is 50,000 rows. |
update_size_bytes |
(integer) The maximum size of the request that will be sent to Synapse when updating rows of data. The default is 1.9MB. |
insert_size_bytes |
(integer) The maximum size of the request that will be sent to Synapse when inserting rows of data. The default is 900MB. |
job_timeout |
(integer) The maximum amount of time to wait for a job to complete. This is used when inserting, and updating rows of data. Each individual request to Synapse will be sent as an independent job. If the timeout is reached a timeout error will be raised. The default is 600 seconds |
date_columns |
(Optional[list[character]]) (CSV file only) The names of columns in your CSV file that contain dates or datetimes stored as formatted strings (e.g. |
date_format |
(Optional[character or named list]) (CSV file only) How the strings in |
wait_for_eventually_consistent_view |
(logical) Only used if the table is a view. If set to TRUE this will wait for the view to reflect any changes that you've made to the view. This is useful if you need to query the view after making changes to the data. |
wait_for_eventually_consistent_view_timeout |
(integer) The maximum amount of time to wait for a view to be eventually consistent. The default is 600 seconds. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
When values is a path to a CSV file, you may pass additional keyword arguments to the
csv_to_pandas_df
function by adding them as extra named arguments to synUpdateRows(),
e.g. separator = ";" or lines_to_skip = 1L.
## Not run: ## Update custom column values in a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset collection as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_collection |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_collection |> synStore() ## End(Not run)## Not run: ## Update custom column values in a Dataset Collection. library(synapser) synLogin() my_collection = DatasetCollection(id = "syn1234") |> synGet() # my_annotation must already exist in the dataset collection as a custom column modified_data = data.frame( id = c("syn1234"), my_annotation = c("good data") ) my_collection |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_collection |> synStore() ## End(Not run)
This method leverages the logic provided by synUpsertRows() to provide
an interface for updating rows in a View-like entity. Update functionality will only work for
values in custom columns within a View-like entity.
Limitations:
- When updating many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to update.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The primary_keys columns must be present in the data being updated. An
error is raised if a primary key column is missing.
- The values in the primary_keys columns cannot be null. A null value
cannot be used to match an existing row, so an error is raised if any row
has a null value in a primary key column.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an error will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)synUpdateRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, wait_for_eventually_consistent_view=FALSE, wait_for_eventually_consistent_view_timeout=600L, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
values |
(Union[str, dict[str, Any], object]) Supports storing data from the following sources: |
primary_keys |
(list[str]) The columns to use to determine if a row already exists. If a row exists with the same values in the columns specified in this list the row will be updated. If a row does not exist nothing will be done. |
dry_run |
(bool) If set to TRUE the data will not be updated in Synapse. A message will be printed to the console with the number of rows that would have been updated and inserted. If you would like to see the data that would be updated and inserted you may set the |
rows_per_query |
(int) The number of rows that will be queried from Synapse per request. Since we need to query for the data that is being updated this will determine the number of rows that are queried at a time. The default is 50,000 rows. |
update_size_bytes |
(int) The maximum size of the request that will be sent to Synapse when updating rows of data. The default is 1.9MB. |
insert_size_bytes |
(int) The maximum size of the request that will be sent to Synapse when inserting rows of data. The default is 900MB. |
job_timeout |
(int) The maximum amount of time to wait for a job to complete. This is used when inserting, and updating rows of data. Each individual request to Synapse will be sent as an independent job. If the timeout is reached a timeout error will be raised. The default is 600 seconds. |
date_columns |
(Optional[list[character]]) (CSV file only) The names of columns in your CSV file that contain dates or datetimes stored as formatted strings (e.g. |
date_format |
(Optional[character or named list]) (CSV file only) How the strings in |
wait_for_eventually_consistent_view |
(bool) Only used if the table is a view. If set to TRUE this will wait for the view to reflect any changes that you've made to the view. This is useful if you need to query the view after making changes to the data. If you set this value to |
wait_for_eventually_consistent_view_timeout |
(int) The maximum amount of time to wait for a view to be eventually consistent. The default is 600 seconds. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
When values is a path to a CSV file, you may pass additional keyword arguments to the
csv_to_pandas_df
function by adding them as extra named arguments to synUpdateRows(),
e.g. separator = ";" or lines_to_skip = 1L.
## Not run: ## Updating custom annotation columns in a view # Rows are matched on the `id` column, and the values in `species` are updated. library(synapser) synLogin() my_view = EntityView(id = "syn123") |> synGet() modified_data = data.frame( id = c("syn456", "syn789"), species = c("Homo sapiens", "Mus musculus") ) my_view |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_view |> synStore() ## End(Not run)## Not run: ## Updating custom annotation columns in a view # Rows are matched on the `id` column, and the values in `species` are updated. library(synapser) synLogin() my_view = EntityView(id = "syn123") |> synGet() modified_data = data.frame( id = c("syn456", "syn789"), species = c("Homo sapiens", "Mus musculus") ) my_view |> synUpdateRows(values = modified_data, primary_keys = list("id"), dry_run = FALSE) my_view |> synStore() ## End(Not run)
This method allows you to perform an upsert (Update and Insert) for row(s).
This means that you may update a row with only the data that you want to change.
When supplied with a row that does not match the given primary_keys a new
row will be inserted.
Using the primary_keys argument you may specify which columns to use to
determine if a row already exists. If a row exists with the same values in the
columns specified in this list the row will be updated. If a row does not exist
it will be inserted.
Limitations:
- The request to update, and the request to insert data does not occur in a
single transaction. This means that the update of data may succeed, but the
insert of data may fail. Additionally, as noted in the limitation below, if
data is chunked up into multiple requests you may find that a portion of
your data is updated, but another portion is not.
- The number of rows that may be upserted in a single call should be
kept to a minimum (< 50,000). There is significant overhead in the request
to Synapse for each row that is upserted. If you are upserting a large
number of rows a better approach may be to query for the data you want
to update, update the data, then use the synStoreRows() function to
update the data in Synapse. Any rows you want to insert may be added
to the data frame that is passed to the synStoreRows() function.
- When upserting many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to upsert, or note the above limitation.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The primary_keys columns must be present in the data being upserted. An
error is raised if a primary key column is missing.
- The values in the primary_keys columns cannot be null. A null value
cannot be used to match an existing row, so an error is raised if any row
has a null value in a primary key column.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an exception will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
The following is a Sequence Diagram that describes the upsert process at a high level:
sequenceDiagram
participant User
participant Table
participant Synapse
User->>Table: upsert_rows()
loop Query and Process Updates in Chunks (rows_per_query)
Table->>Synapse: Query existing rows using primary keys
Synapse-->>Table: Return matching rows
Note Over Table: Create partial row updates
loop For results from query
Note Over Table: Sum row/chunk size
alt Chunk size exceeds update_size_bytes
Table->>Synapse: Push update chunk
Synapse-->>Table: Acknowledge update
end
Table->>Table: Add row to chunk
end
alt Remaining updates exist
Table->>Synapse: Push final update chunk
Synapse-->>Table: Acknowledge update
end
end
alt New rows exist
Table->>Table: Identify new rows for insertion
Table->>Table: Call synStoreRows() function
end
Table-->>User: Upsert complete
synUpsertRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, synapse_client=NULL)synUpsertRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
values |
(Union[str, dict[str, Any], object]) Supports storing data from the following sources: |
primary_keys |
(list[str]) The columns to use to determine if a row already exists. If a row exists with the same values in the columns specified in this list the row will be updated. If a row does not exist it will be inserted. |
dry_run |
(bool) If set to TRUE the data will not be updated in Synapse. A message will be printed to the console with the number of rows that would have been updated and inserted. If you would like to see the data that would be updated and inserted you may set the |
rows_per_query |
(int) The number of rows that will be queried from Synapse per request. Since we need to query for the data that is being updated this will determine the number of rows that are queried at a time. The default is 50,000 rows. |
update_size_bytes |
(int) The maximum size of the request that will be sent to Synapse when updating rows of data. The default is 1.9MB. |
insert_size_bytes |
(int) The maximum size of the request that will be sent to Synapse when inserting rows of data. The default is 900MB. |
job_timeout |
(int) The maximum amount of time to wait for a job to complete. This is used when inserting, and updating rows of data. Each individual request to Synapse will be sent as an independent job. If the timeout is reached a timeout error will be raised. The default is 600 seconds |
date_columns |
(Optional[list[character]]) (CSV file only) The names of columns in your CSV file that contain dates or datetimes stored as formatted strings (e.g. |
date_format |
(Optional[character or named list]) (CSV file only) How the strings in |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
NULL
When values is a path to a CSV file, you may pass additional keyword arguments to the
csv_to_pandas_df
function by adding them as extra named arguments to synUpsertRows(),
e.g. separator = ";" or lines_to_skip = 1L.
## Not run: ## Example 1: Updating 2 rows and inserting 1 row # In this given example we have a table with the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # The following code will update the first row's col2 to 22, update the # second row's col3 to 33, and insert a new row: library(synapser) synLogin() # Also works with Dataset table = Table(id = "syn123") |> synGet(table_options = TableOptions(include_columns = TRUE)) df = data.frame( col1 = c("A", "B", "C"), col2 = c(22, 2, 3), col3 = c(1, 33, 3) ) table |> synUpsertRows(values = df, primary_keys = list("col1")) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 22 | 1 | # | B | 2 | 33 | # | C | 3 | 3 | ## Example 2: Deleting data from a specific cell # In this given example we have a table with the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # The following code will clear the value in the first row's col2, and the # second row's col3: library(synapser) synLogin() # Also works with Dataset table = Table(id = "syn123") |> synGet(table_options = TableOptions(include_columns = TRUE)) data_to_upsert = data.frame( col1 = c("A", "B"), col2 = c(NA, 2), col3 = c(1, NA) ) table |> synUpsertRows(values = data_to_upsert, primary_keys = list("col1")) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | | 1 | # | B | 2 | | ## Example 3: Upserting data with date columns # In this given example we have a table with the following data: # | col1 | date_col | # |------|------------| # | A | 2024-01-15 | # | B | 2024-02-20 | # Suppose we have a CSV file with the following data that we want to upsert: # | col1 | date_col | # |------|------------| # | A | 03/10/2024 | # | C | 04/01/2024 | # The date_columns/date_format arguments tell the client how to parse # the formatted date strings in the CSV file so that they can be compared # against, and stored in, the table's DATE column. The following code # will update row A's date_col and insert a new row for C: library(synapser) synLogin() # Also works with Dataset Table(id = "syn123") |> synUpsertRows( values = "path/to/file.csv", primary_keys = list("col1"), date_columns = list("date_col"), date_format = "%m/%d/%Y" ) # The resulting table will look like this: # | col1 | date_col | # |------|------------| # | A | 2024-03-10 | # | B | 2024-02-20 | # | C | 2024-04-01 | ## End(Not run)## Not run: ## Example 1: Updating 2 rows and inserting 1 row # In this given example we have a table with the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # The following code will update the first row's col2 to 22, update the # second row's col3 to 33, and insert a new row: library(synapser) synLogin() # Also works with Dataset table = Table(id = "syn123") |> synGet(table_options = TableOptions(include_columns = TRUE)) df = data.frame( col1 = c("A", "B", "C"), col2 = c(22, 2, 3), col3 = c(1, 33, 3) ) table |> synUpsertRows(values = df, primary_keys = list("col1")) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | 22 | 1 | # | B | 2 | 33 | # | C | 3 | 3 | ## Example 2: Deleting data from a specific cell # In this given example we have a table with the following data: # | col1 | col2 | col3 | # |------|------| -----| # | A | 1 | 1 | # | B | 2 | 2 | # The following code will clear the value in the first row's col2, and the # second row's col3: library(synapser) synLogin() # Also works with Dataset table = Table(id = "syn123") |> synGet(table_options = TableOptions(include_columns = TRUE)) data_to_upsert = data.frame( col1 = c("A", "B"), col2 = c(NA, 2), col3 = c(1, NA) ) table |> synUpsertRows(values = data_to_upsert, primary_keys = list("col1")) # The resulting table will look like this: # | col1 | col2 | col3 | # |------|------| -----| # | A | | 1 | # | B | 2 | | ## Example 3: Upserting data with date columns # In this given example we have a table with the following data: # | col1 | date_col | # |------|------------| # | A | 2024-01-15 | # | B | 2024-02-20 | # Suppose we have a CSV file with the following data that we want to upsert: # | col1 | date_col | # |------|------------| # | A | 03/10/2024 | # | C | 04/01/2024 | # The date_columns/date_format arguments tell the client how to parse # the formatted date strings in the CSV file so that they can be compared # against, and stored in, the table's DATE column. The following code # will update row A's date_col and insert a new row for C: library(synapser) synLogin() # Also works with Dataset Table(id = "syn123") |> synUpsertRows( values = "path/to/file.csv", primary_keys = list("col1"), date_columns = list("date_col"), date_format = "%m/%d/%Y" ) # The resulting table will look like this: # | col1 | date_col | # |------|------------| # | A | 2024-03-10 | # | B | 2024-02-20 | # | C | 2024-04-01 | ## End(Not run)
Validate the entity against the bound JSON schema.
synValidateSchema(instance, synapse_client=NULL)synValidateSchema(instance, synapse_client=NULL)
instance |
(EntityView) The EntityView instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation results.
## Not run: ## Using this function # Validating an EntityView against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Validate the EntityView against the bound schema test_view = test_view |> synSetProperties( annotations = list(foo = "test_value", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to EntityView and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_view |> synValidateSchema() cat("EntityView validation response:\n") validation_response ## End(Not run)## Not run: ## Using this function # Validating an EntityView against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VIEW_NAME = "test_script_entityview" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test EntityView of the files in the project test_view = EntityView( name = VIEW_NAME, parent_id = PROJECT_ID, scope_ids = list(PROJECT_ID), view_type_mask = 1L # 1 = files ) |> synStore() cat("Created test EntityView:", VIEW_NAME, "\n") # Bind JSON schema to the EntityView bound_schema = test_view |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to EntityView:\n") bound_schema # Validate the EntityView against the bound schema test_view = test_view |> synSetProperties( annotations = list(foo = "test_value", bar = 42) # Example annotations ) |> synStore() cat("Added annotations to EntityView and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_view |> synValidateSchema() cat("EntityView validation response:\n") validation_response ## End(Not run)
Validate the entity against the bound JSON schema.
synValidateSchema(instance, synapse_client=NULL)synValidateSchema(instance, synapse_client=NULL)
instance |
(File) The File instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation results.
## Not run: ## Using this function # Validating a folder or file against the bound JSON schema. This example demonstrates # how to validate entities with annotations against their bound schemas. Requires entities # to have schemas already bound. Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Validate the folder entity against the bound schema test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to folder and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_folder |> synValidateSchema() cat("Folder validation response:\n") validation_response # Validate the file entity against the bound schema example_file = example_file |> synSetProperties( annotations = list(foo = "test_value", bar = 43) ) |> synStore() cat("Added annotations to file and stored\n") Sys.sleep(2) # Allow time for processing validation_response_file = example_file |> synValidateSchema() cat("File validation response:\n") validation_response_file ## End(Not run)## Not run: ## Using this function # Validating a folder or file against the bound JSON schema. This example demonstrates # how to validate entities with annotations against their bound schemas. Requires entities # to have schemas already bound. Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Validate the folder entity against the bound schema test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to folder and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_folder |> synValidateSchema() cat("Folder validation response:\n") validation_response # Validate the file entity against the bound schema example_file = example_file |> synSetProperties( annotations = list(foo = "test_value", bar = 43) ) |> synStore() cat("Added annotations to file and stored\n") Sys.sleep(2) # Allow time for processing validation_response_file = example_file |> synValidateSchema() cat("File validation response:\n") validation_response_file ## End(Not run)
Validate the entity against the bound JSON schema.
synValidateSchema(instance, synapse_client=NULL)synValidateSchema(instance, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation results.
## Not run: ## Using this function # Validating a folder or file against the bound JSON schema. This example demonstrates # how to validate entities with annotations against their bound schemas. Requires entities # to have schemas already bound. Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Validate the folder entity against the bound schema test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to folder and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_folder |> synValidateSchema() cat("Folder validation response:\n") validation_response # Validate the file entity against the bound schema example_file = example_file |> synSetProperties( annotations = list(foo = "test_value", bar = 43) ) |> synStore() cat("Added annotations to file and stored\n") Sys.sleep(2) # Allow time for processing validation_response_file = example_file |> synValidateSchema() cat("File validation response:\n") validation_response_file ## End(Not run)## Not run: ## Using this function # Validating a folder or file against the bound JSON schema. This example demonstrates # how to validate entities with annotations against their bound schemas. Requires entities # to have schemas already bound. Set the PROJECT_NAME and FILE_PATH variables to your project name # and file path respectively. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name FILE_PATH = "~/Sample.txt" # replace with your test file path PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name FOLDER_NAME = "test_script_folder" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test folder test_folder = Folder(name = FOLDER_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test folder:", FOLDER_NAME, "\n") # Bind JSON schema to the folder bound_schema = test_folder |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to folder:\n") bound_schema # Create and bind schema to a file example_file = File(path = FILE_PATH, parent_id = test_folder$id) |> synStore() bound_schema_file = example_file |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to file:\n") bound_schema_file # Validate the folder entity against the bound schema test_folder = test_folder |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to folder and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_folder |> synValidateSchema() cat("Folder validation response:\n") validation_response # Validate the file entity against the bound schema example_file = example_file |> synSetProperties( annotations = list(foo = "test_value", bar = 43) ) |> synStore() cat("Added annotations to file and stored\n") Sys.sleep(2) # Allow time for processing validation_response_file = example_file |> synValidateSchema() cat("File validation response:\n") validation_response_file ## End(Not run)
Validate the entity against the bound JSON schema.
synValidateSchema(instance, synapse_client=NULL)synValidateSchema(instance, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation results.
## Not run: ## Using this function # Validating a project against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Validate the project entity against the bound schema test_project = test_project |> synSetProperties( annotations = list(foo = "test_value", bar = 42L) ) |> synStore() cat("Added annotations to project and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_project |> synValidateSchema() cat("Project validation response:\n") validation_response ## End(Not run)## Not run: ## Using this function # Validating a project against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Get the test project test_project = Project(id = PROJECT_ID) # Bind JSON schema to the project bound_schema = test_project |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to project:\n") bound_schema # Validate the project entity against the bound schema test_project = test_project |> synSetProperties( annotations = list(foo = "test_value", bar = 42L) ) |> synStore() cat("Added annotations to project and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_project |> synValidateSchema() cat("Project validation response:\n") validation_response ## End(Not run)
Validate the entity against the bound JSON schema.
synValidateSchema(instance, synapse_client=NULL)synValidateSchema(instance, synapse_client=NULL)
instance |
(Table) The Table instance to operate on. |
synapse_client |
(Optional[Synapse], optional) The Synapse client instance. If not provided, the last created instance from the Synapse class constructor will be used. |
The validation results.
## Not run: ## Using this function # Validating a table against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Validate the table entity against the bound schema test_table = test_table |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to table and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_table |> synValidateSchema() cat("Table validation response:\n") validation_response ## End(Not run)## Not run: ## Using this function # Validating a table against the bound JSON schema. This example demonstrates # how to validate an entity with annotations against its bound schema. Requires # the entity to have a schema already bound. Set the PROJECT_NAME variable to # your project name. library(synapser) synLogin() # Define Project and JSON schema info PROJECT_NAME = "test_json_schema_project" # replace with your project name PROJECT_ID = synFindEntityId(name = PROJECT_NAME) ORG_NAME = "UniqueOrg" # replace with your organization name SCHEMA_NAME = "myTestSchema" # replace with your schema name TABLE_NAME = "test_script_table" VERSION = "0.0.1" SCHEMA_URI = sprintf("%s-%s-%s", ORG_NAME, SCHEMA_NAME, VERSION) # Create the organization and JSON schema used in this example. my_test_org = SchemaOrganization(name = ORG_NAME) |> synStore() schema_definition = list( "$id" = "mySchema", type = "object", properties = list( foo = list(type = "string"), bar = list(type = "integer") ), required = list("foo") ) test_schema = JSONSchema(name = SCHEMA_NAME, organization_name = ORG_NAME) |> synStore( json_schema_options = StoreJSONSchemaOptions(schema_body = schema_definition, version = VERSION) ) # Create a test table test_table = Table(name = TABLE_NAME, parent_id = PROJECT_ID) |> synStore() cat("Created test table:", TABLE_NAME, "\n") # Bind JSON schema to the table bound_schema = test_table |> synBindSchema( json_schema_uri = SCHEMA_URI, enable_derived_annotations = TRUE ) cat("Bound schema to table:\n") bound_schema # Validate the table entity against the bound schema test_table = test_table |> synSetProperties( annotations = list(foo = "test_value", bar = 42) ) |> synStore() cat("Added annotations to table and stored\n") Sys.sleep(2) # Allow time for processing validation_response = test_table |> synValidateSchema() cat("Table validation response:\n") validation_response ## End(Not run)
Traverse through the hierarchy of entities stored under this container.
Mimics os.walk() behavior but yields EntityHeader objects, with optional
ASCII tree display that continues printing as the walk progresses.
synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL)synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL)
instance |
(Folder) The Folder instance to operate on. |
follow_link |
(bool) Whether to follow a link entity or not. Links can be used to point at other Synapse entities. |
include_types |
(Optional[list[str]]) Must be a list of entity types (ie. list("folder", "file")) which can be found here. Defaults to |
recursive |
(bool) Whether to recursively traverse subdirectories. Defaults to TRUE. |
display_ascii_tree |
(bool) If TRUE, display an ASCII tree representation as the container structure is traversed. Tree lines are printed incrementally as each container is visited. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A GeneratorWrapper object that yields a list of (dirpath, dirs, nondirs) where:
- dirpath: A vector of (directory_name, synapse_id) representing the current directory
- dirs: A list of EntityHeader objects for subdirectories (folders)
- nondirs: A list of EntityHeader objects for non-directory entities (files, tables, etc.)
Use as.list() to materialize all results into a list, or nextElem() to retrieve one result at a time.
Each EntityHeader contains complete metadata including id, name, type,
creation/modification dates, version information, and other Synapse properties.
The directory path is built using os.path.join() to create hierarchical paths,
like:
my-container-name/bulk-upload/file_script_folder/file_script_sub_folder
When display_ascii_tree=TRUE, the ASCII tree structure is displayed in proper hierarchical order as the entire structure is traversed sequentially. The tree will be printed in the correct parent-child relationships, but results will still be yielded as expected during the traversal process. The tree is printed progressively as each container is visited during the walk, making it suitable for very large and deeply nested structures.
## Not run: ## Example 1: Traverse all entities in a container # Basic usage - traverse all entities in a container library(synapser) synLogin() container = Folder(id = "syn12345") for (entry in as.list(container |> synWalk())) { dirpath = entry[[1]] dirs = entry[[2]] nondirs = entry[[3]] cat(sprintf("Directory: %s (%s)\n", dirpath[[1]], dirpath[[2]])) # Print folders for (folder_entity in dirs) { cat(sprintf(" Folder: %s\n", folder_entity)) } # Print files and other entities for (entity in nondirs) { cat(sprintf(" File: %s\n", entity)) } } ## Example 2: Display progressive ASCII tree as walk proceeds library(synapser) synLogin() container = Folder(id = "syn12345") # Display tree structure progressively as walk proceeds for (entry in as.list(container |> synWalk(display_ascii_tree = TRUE))) { dirpath = entry[[1]] nondirs = entry[[3]] # Process each directory as usual cat(sprintf("Processing: %s\n", dirpath[[1]])) for (file_entity in nondirs) { cat(sprintf(" Found file: %s\n", file_entity$name)) } } # Example output: # # === Container Structure === # my-container-name (syn52948289) [Project] # |-- bulk-upload (syn68884548) [Folder] # | `-- file_script_folder (syn68884547) [Folder] # | `-- file_script_sub_folder (syn68884549) [Folder] # | `-- file_in_a_sub_folder.txt (syn68884556) [File] # |-- root (syn67590143) [Folder] # | `-- subdir1 (syn67590144) [Folder] # | |-- file1.txt (syn67590261) [File] # | `-- file2.txt (syn67590287) [File] # `-- temp-files (syn68884954) [Folder] # `-- root (syn68884955) [Folder] # `-- subdir1 (syn68884956) [Folder] # |-- file1.txt (syn68884959) [File] # `-- file2.txt (syn68884999) [File] # # Directory: My uniquely named project about Alzheimer's Disease (syn53185532) # File: EntityHeader(name = "Gene Expression Data", id = "syn66227753", # type = "org.sagebionetworks.repo.model.table.TableEntity", version_number = 1, # version_label = "in progress", is_latest_version = TRUE, benefactor_id = 53185532, # created_on = "2025-04-11T21:24:28.913Z", modified_on = "2025-04-11T21:24:34.996Z", # created_by = "3481671", modified_by = "3481671") # Folder: EntityHeader(name = "Research Data", id = "syn68327923", # type = "org.sagebionetworks.repo.model.Folder", version_number = 1, # version_label = "1", is_latest_version = TRUE, benefactor_id = 68327923, # created_on = "2025-06-16T21:51:50.460Z", modified_on = "2025-06-16T22:19:41.481Z", # created_by = "3481671", modified_by = "3481671") ## End(Not run)## Not run: ## Example 1: Traverse all entities in a container # Basic usage - traverse all entities in a container library(synapser) synLogin() container = Folder(id = "syn12345") for (entry in as.list(container |> synWalk())) { dirpath = entry[[1]] dirs = entry[[2]] nondirs = entry[[3]] cat(sprintf("Directory: %s (%s)\n", dirpath[[1]], dirpath[[2]])) # Print folders for (folder_entity in dirs) { cat(sprintf(" Folder: %s\n", folder_entity)) } # Print files and other entities for (entity in nondirs) { cat(sprintf(" File: %s\n", entity)) } } ## Example 2: Display progressive ASCII tree as walk proceeds library(synapser) synLogin() container = Folder(id = "syn12345") # Display tree structure progressively as walk proceeds for (entry in as.list(container |> synWalk(display_ascii_tree = TRUE))) { dirpath = entry[[1]] nondirs = entry[[3]] # Process each directory as usual cat(sprintf("Processing: %s\n", dirpath[[1]])) for (file_entity in nondirs) { cat(sprintf(" Found file: %s\n", file_entity$name)) } } # Example output: # # === Container Structure === # my-container-name (syn52948289) [Project] # |-- bulk-upload (syn68884548) [Folder] # | `-- file_script_folder (syn68884547) [Folder] # | `-- file_script_sub_folder (syn68884549) [Folder] # | `-- file_in_a_sub_folder.txt (syn68884556) [File] # |-- root (syn67590143) [Folder] # | `-- subdir1 (syn67590144) [Folder] # | |-- file1.txt (syn67590261) [File] # | `-- file2.txt (syn67590287) [File] # `-- temp-files (syn68884954) [Folder] # `-- root (syn68884955) [Folder] # `-- subdir1 (syn68884956) [Folder] # |-- file1.txt (syn68884959) [File] # `-- file2.txt (syn68884999) [File] # # Directory: My uniquely named project about Alzheimer's Disease (syn53185532) # File: EntityHeader(name = "Gene Expression Data", id = "syn66227753", # type = "org.sagebionetworks.repo.model.table.TableEntity", version_number = 1, # version_label = "in progress", is_latest_version = TRUE, benefactor_id = 53185532, # created_on = "2025-04-11T21:24:28.913Z", modified_on = "2025-04-11T21:24:34.996Z", # created_by = "3481671", modified_by = "3481671") # Folder: EntityHeader(name = "Research Data", id = "syn68327923", # type = "org.sagebionetworks.repo.model.Folder", version_number = 1, # version_label = "1", is_latest_version = TRUE, benefactor_id = 68327923, # created_on = "2025-06-16T21:51:50.460Z", modified_on = "2025-06-16T22:19:41.481Z", # created_by = "3481671", modified_by = "3481671") ## End(Not run)
Traverse through the hierarchy of entities stored under this container. Mimics os.walk() behavior but yields EntityHeader objects, with optional ASCII tree display that continues printing as the walk progresses.
synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL)synWalk(instance, follow_link=FALSE, include_types=NULL, recursive=TRUE, display_ascii_tree=FALSE, synapse_client=NULL)
instance |
(Project) The Project instance to operate on. |
follow_link |
(bool) Whether to follow a link entity or not. Links can be used to point at other Synapse entities. |
include_types |
(Optional[list[str]]) Must be a list of entity types (ie. list("folder", "file")) which can be found here. Defaults to |
recursive |
(bool) Whether to recursively traverse subdirectories. Defaults to TRUE. |
display_ascii_tree |
(bool) If TRUE, display an ASCII tree representation as the container structure is traversed. Tree lines are printed incrementally as each container is visited. Defaults to FALSE. |
synapse_client |
(Optional[Synapse]) If not passed in, the last created instance from the Synapse class constructor will be used. |
A list of (dirpath, dirs, nondirs) where:
- dirpath: A vector of (directory_name, synapse_id) representing the current directory
- dirs: A list of EntityHeader objects for subdirectories (folders)
- nondirs: A list of EntityHeader objects for non-directory entities (files, tables, etc.)
Each EntityHeader contains complete metadata including id, name, type, creation/modification dates, version information, and other Synapse properties. The directory path is built using os.path.join() to create hierarchical paths, like "my-container-name/bulk-upload/file_script_folder/file_script_sub_folder".
When display_ascii_tree=TRUE, the ASCII tree structure is displayed in proper hierarchical order as the entire structure is traversed sequentially. The tree will be printed in the correct parent-child relationships, but results will still be yielded as expected during the traversal process. When display_ascii_tree=TRUE, the tree is printed progressively as each container is visited during the walk, making it suitable for very large and deeply nested structures.
## Not run: ## Example 1: Traverse all entities in a container # Basic usage - traverse all entities in a container library(synapser) synLogin() container = Project(id = "syn12345") for (item in as.list(container |> synWalk())) { dirpath = item[[1]] dirs = item[[2]] nondirs = item[[3]] cat(sprintf("Directory: %s (%s)\n", dirpath[1], dirpath[2])) # Print folders for (folder_entity in dirs) { cat(sprintf(" Folder: %s\n", folder_entity)) } # Print files and other entities for (entity in nondirs) { cat(sprintf(" Non-directory entity: %s\n", entity)) } } ## Example 2: Display progressive ASCII tree as walk proceeds library(synapser) synLogin() container = Project(id = "syn12345") # Display tree structure progressively as walk proceeds for (item in as.list(container |> synWalk(display_ascii_tree = TRUE))) { dirpath = item[[1]] nondirs = item[[3]] # Process each directory as usual cat(sprintf("Processing: %s\n", dirpath[1])) for (file_entity in nondirs) { cat(sprintf(" Found non-directory entity: %s\n", file_entity$name)) } } # Example output: # # === Container Structure === # my-container-name (syn52948289) [Project] # |-- bulk-upload (syn68884548) [Folder] # | `-- file_script_folder (syn68884547) [Folder] # | `-- file_script_sub_folder (syn68884549) [Folder] # | `-- file_in_a_sub_folder.txt (syn68884556) [File] # |-- root (syn67590143) [Folder] # | `-- subdir1 (syn67590144) [Folder] # | |-- file1.txt (syn67590261) [File] # | `-- file2.txt (syn67590287) [File] # `-- temp-files (syn68884954) [Folder] # `-- root (syn68884955) [Folder] # `-- subdir1 (syn68884956) [Folder] # |-- file1.txt (syn68884959) [File] # `-- file2.txt (syn68884999) [File] # # Directory: My uniquely named project about Alzheimer's Disease (syn53185532) # File: EntityHeader(name='Gene Expression Data', id='syn66227753', # type='org.sagebionetworks.repo.model.table.TableEntity', version_number=1, # version_label='in progress', is_latest_version=True, benefactor_id=53185532, # created_on='2025-04-11T21:24:28.913Z', modified_on='2025-04-11T21:24:34.996Z', # created_by='3481671', modified_by='3481671') # Folder: EntityHeader(name='Research Data', id='syn68327923', # type='org.sagebionetworks.repo.model.Folder', version_number=1, # version_label='1', is_latest_version=True, benefactor_id=68327923, # created_on='2025-06-16T21:51:50.460Z', modified_on='2025-06-16T22:19:41.481Z', # created_by='3481671', modified_by='3481671') ## End(Not run)## Not run: ## Example 1: Traverse all entities in a container # Basic usage - traverse all entities in a container library(synapser) synLogin() container = Project(id = "syn12345") for (item in as.list(container |> synWalk())) { dirpath = item[[1]] dirs = item[[2]] nondirs = item[[3]] cat(sprintf("Directory: %s (%s)\n", dirpath[1], dirpath[2])) # Print folders for (folder_entity in dirs) { cat(sprintf(" Folder: %s\n", folder_entity)) } # Print files and other entities for (entity in nondirs) { cat(sprintf(" Non-directory entity: %s\n", entity)) } } ## Example 2: Display progressive ASCII tree as walk proceeds library(synapser) synLogin() container = Project(id = "syn12345") # Display tree structure progressively as walk proceeds for (item in as.list(container |> synWalk(display_ascii_tree = TRUE))) { dirpath = item[[1]] nondirs = item[[3]] # Process each directory as usual cat(sprintf("Processing: %s\n", dirpath[1])) for (file_entity in nondirs) { cat(sprintf(" Found non-directory entity: %s\n", file_entity$name)) } } # Example output: # # === Container Structure === # my-container-name (syn52948289) [Project] # |-- bulk-upload (syn68884548) [Folder] # | `-- file_script_folder (syn68884547) [Folder] # | `-- file_script_sub_folder (syn68884549) [Folder] # | `-- file_in_a_sub_folder.txt (syn68884556) [File] # |-- root (syn67590143) [Folder] # | `-- subdir1 (syn67590144) [Folder] # | |-- file1.txt (syn67590261) [File] # | `-- file2.txt (syn67590287) [File] # `-- temp-files (syn68884954) [Folder] # `-- root (syn68884955) [Folder] # `-- subdir1 (syn68884956) [Folder] # |-- file1.txt (syn68884959) [File] # `-- file2.txt (syn68884999) [File] # # Directory: My uniquely named project about Alzheimer's Disease (syn53185532) # File: EntityHeader(name='Gene Expression Data', id='syn66227753', # type='org.sagebionetworks.repo.model.table.TableEntity', version_number=1, # version_label='in progress', is_latest_version=True, benefactor_id=53185532, # created_on='2025-04-11T21:24:28.913Z', modified_on='2025-04-11T21:24:34.996Z', # created_by='3481671', modified_by='3481671') # Folder: EntityHeader(name='Research Data', id='syn68327923', # type='org.sagebionetworks.repo.model.Folder', version_number=1, # version_label='1', is_latest_version=True, benefactor_id=68327923, # created_on='2025-06-16T21:51:50.460Z', modified_on='2025-06-16T22:19:41.481Z', # created_by='3481671', modified_by='3481671') ## End(Not run)
A Table represents the metadata of a table.
Table(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, columns=list(), etag=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, annotations=list())Table(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, columns=list(), etag=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, annotations=list())
id |
(Optional[str]) The unique immutable ID for this table. A new ID will be generated for new Tables. Once issued, this ID is guaranteed to never change or be re-issued |
name |
(Optional[str]) The name of this table. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this table. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. It is analygous to the Activity defined in the W3C Specification on Provenance. Activity cannot be removed during a store operation by setting it to None. You must use: |
version_number |
(Optional[int]) (Read Only) The version number issued to this version on the object. Use this |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
columns |
(Optional[Union[list[Column], OrderedDict[str, Column], dict[str, Column]]]) The columns of this table. This is an ordered named list where the key is the name of the column and the value is the Column object. When creating a new instance of a Table object you may pass any of the following types as the library(synapser) synLogin() table = Table(id = "syn1234") |> synGet() table$columns[["my_column"]]$column_type = "DOUBLE" table = table |> synStore() Note that the keys in this named list should match the column names as they are in Synapse. However, know that the name attribute of the Column object is used for all interactions with the Synapse API. The named list key is purely for the usage of this interface. For example, if you wish to rename a column you may do so by changing the name attribute of the Column object. The key in the named list does not need to be changed. The next time you store the table the column will be updated in Synapse with the new name and the key in the named list will be updated. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this table was created. |
created_by |
(Optional[str]) The ID of the user that created this table. |
modified_on |
(Optional[str]) The date this table was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format |
modified_by |
(Optional[str]) The ID of the user that last modified this table. |
version_label |
(Optional[str]) (Read Only) The version label for this table. Use the |
version_comment |
(Optional[str]) (Read Only) The version comment for this table. Use the |
is_latest_version |
(Optional[bool]) (Read Only) If this is the latest version of the object. |
is_search_enabled |
(Optional[bool]) When creating or updating a table or view specifies if full text search should be enabled. Note that enabling full text search might slow down the indexing of the table or view. |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the table. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
An S3-style class object.
NULL
Table(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, columns=list(), etag=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, is_search_enabled=NULL, annotations=list()): Constructor for Table
synAddColumn(instance, column, index=NULL): Add column(s) to the table. Note that this does not store the column(s) in
Synapse. You must call the synStore() function on this Table instance to
store the column(s) in Synapse. This is a convenience function to eliminate
the need to manually add the column(s) to the $columns list.
This function will add an item to the $columns attribute of the Table
instance. $columns is a named list where the key is the name of the column
and the value is the Column object.
synBindSchema(instance, json_schema_uri, enable_derived_annotations=FALSE, synapse_client=NULL): Bind a JSON schema to the entity.
synDeleteColumn(instance, name): Mark a column for deletion. Note that this does not delete the column from
Synapse. You must call the synStore() function on this Table instance to
delete the column from Synapse. This is a convenience function to eliminate
the need to manually delete the column from the named list and add it to the
$_columns_to_delete attribute.
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synDeleteRows(instance, query=NULL, df=NULL, job_timeout=600L, synapse_client=NULL): Delete rows from a table given a query or a data frame to select rows.
The query at a minimum must select the ROW_ID and ROW_VERSION columns. If you want to
inspect the data that will be deleted ahead of time you may use the
synQuery() function to get the data.
The data frame must at least contain the ROW_ID and ROW_VERSION columns. And ROW_ETAG column is also required
if the entity is one of the following: EntityView, Dataset, DatasetCollection, or SubmissionView.
If both query and df are provided, the query will be used.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synGetSchema(instance, synapse_client=NULL): Get the JSON schema bound to the entity.
synGetSchemaDerivedKeys(instance, synapse_client=NULL): Retrieve derived JSON schema keys for the entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a data frame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html
synReorderColumn(instance, name, index): Reorder a column in the table. Note that this does not store the column in
Synapse. You must call the synStore() function on this Table instance to
store the column in Synapse. This is a convenience function to eliminate
the need to manually reorder the named list stored in the $columns attribute.
You must ensure that the index is within the bounds of the number of columns in
the table. If you pass in an index that is out of bounds the column will be
added to the end of the list.
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
synSnapshot(instance, comment=NULL, label=NULL, include_activity=TRUE, associate_activity_to_new_version=TRUE, synapse_client=NULL): Request to create a new snapshot of a table. The provided comment, label, and
activity will be applied to the current version thereby creating a snapshot
and locking the current version. After the snapshot is created a new version
will be started with an 'in-progress' label.
synStoreRows(instance, values, schema_storage_strategy=NULL, column_expansion_strategy=NULL, dry_run=FALSE, additional_changes=NULL, insert_size_bytes=943718400L, csv_table_descriptor=NULL, date_columns=NULL, date_format=NULL, read_csv_kwargs=NULL, to_csv_kwargs=NULL, job_timeout=600L, synapse_client=NULL): Add or update rows in Synapse from the sources defined below. In most cases the
result of this function call will append rows to the table. In the case of an
update this method works on a full row replacement. What this means is
that you may not do a partial update of a row. If you want to update a row
you must pass in all the data for that row, or the data for the columns not
provided will be set to null.
If you'd like to update a row see the example Updating rows in a table below.
If you'd like to perform an upsert or partial update of a row you may use
the synUpsertRows() function. See that function for more information.
Note the following behavior for the order of columns:
- If a column is added via the synAddColumn() function it will be added at the
index you specify, or at the end of the columns list.
- If column(s) are added during the construction of your Table instance, ie.
Table(columns = list(Column(name = "foo"))), they will be added at the beginning
of the columns list.
- If you use the synStoreRows() function and the schema_storage_strategy is set to
INFER_FROM_DATA the columns will be added at the end of the columns list.
How datetime values are interpreted:
Synapse DATE columns store an exact moment in time, represented as the
number of milliseconds since 1970-01-01 00:00:00 UTC. Before upload,
datetime values are converted to that representation as follows:
- Timezone-aware datetimes (POSIXct values created with a tz, e.g.
as.POSIXct("2017-02-14 11:23", tz = "America/Los_Angeles")) are converted
to UTC exactly. This is the recommended way to pass datetime data: the stored
value does not depend on the timezone settings of the machine performing the
upload or on the date the upload is run.
- Naive datetimes (POSIXct values without a tz) are assumed to be in the
local timezone of the machine at the time of upload. That single UTC offset is
applied to every value, including values whose dates fall in a
different daylight saving period, which will be stored shifted by one
hour. For example, uploading 2017-02-14 11:23 (a PST date, UTC-8)
from a machine currently on PDT (UTC-7) stores 2017-02-14 18:23 UTC
instead of the correct 19:23 UTC. To avoid this, create your datetimes with
a timezone, e.g. as.POSIXct(x, tz = "America/Los_Angeles").
- Plain R Date values (as opposed to datetimes) are treated
as midnight of that date and converted the same way naive
datetimes are: using the local timezone of the machine at the
time of upload, with the same daylight-saving-shift risk
described above.
- Midnight values deserve extra care: the one-hour daylight saving
shift described above can move a naive midnight datetime — or a
Date, which is treated as midnight — to 11 PM of the
previous day, changing the calendar date the value displays as.
Why timezone-aware values are recommended:
A naive datetime such as 2017-02-14 11:23 is only "what a clock on the
wall said." Before it can be stored as an exact moment in time, something
has to answer: a clock where? Timezone-aware values answer that
question in the data itself; naive values leave the client to guess, and
it guesses the uploading machine's current timezone.
A zone name like "America/Los_Angeles" does not mean a fixed offset
such as UTC-8. It means "a Los Angeles wall clock" — and those clocks
move twice a year: UTC-7 in summer (PDT), UTC-8 in winter (PST). When you
create datetimes with as.POSIXct(x, tz = "America/Los_Angeles"), R looks up
what LA clocks were set to on each value's own date:
- 2017-02-14 → winter → interpreted using UTC-8
- 2018-10-01 → summer → interpreted using UTC-7
When the data is queried back with synQuery(..., convert_to_datetime = TRUE),
DATE columns are returned as datetimes in UTC. See
vignette("tables", package = "synapser") for how to work with the returned
values and view them in another timezone.
Limitations:
- Synapse limits the number of rows that may be stored in a single request to
a CSV file that is 1GB. If you are storing a CSV file that is larger than
this limit the data will be chunked into smaller requests. This process is
done by reading the file once to determine what the row and byte boundries
are and calculating the MD5 hash of that portion, then reading the file
again to send the data to Synapse. This process is done to ensure that the
data is not corrupted during the upload process, in addition Synapse
requires the MD5 hash of the data to be sent in the request along with the
number of bytes that are being sent.
- The limit of 1GB is also enforced when storing a named list or a data frame.
The data will be converted to a CSV format using the to_csv() pandas
function. If you are storing more than a 1GB file it is recommended that
you store the data as a CSV and use the file path to upload the data. This
is due to the fact that the data frame chunking process is slower than
reading portions of a file on disk and calculating the MD5 hash of that
portion.
The following is a Sequence Diagram that describes the process noted in the limitation above. It shows how the data is chunked into smaller requests when the data exceeds the limit of 1GB, and how portions of the data are read from the CSV file on disk while being uploaded to Synapse.
sequenceDiagram
participant User
participant Table
participant FileSystem
participant Synapse
User->>Table: store_rows(values)
alt CSV size > 1GB
Table->>Synapse: Apply schema changes before uploading
note over Table, FileSystem: Read CSV twice
Table->>FileSystem: Read entire CSV (First Pass)
FileSystem-->>Table: Compute chunk sizes & MD5 hashes
loop Read and Upload CSV chunks (Second Pass)
Table->>FileSystem: Read next chunk from CSV
FileSystem-->>Table: Return bytes
Table->>Synapse: Upload CSV chunk
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
else
Table->>Synapse: Upload CSV without splitting & Any additional schema changes
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
Table-->>User: Upload complete
The following is a Sequence Diagram that describes the process noted in the limitation above for data frames. It shows how the data is chunked into smaller requests when the data exceeds the limit of 1GB, and how portions of the data are read from the data frame while being uploaded to Synapse.
sequenceDiagram
participant User
participant Table
participant MemoryBuffer
participant Synapse
User->>Table: store_rows(DataFrame)
loop For all rows in DataFrame in 100 row increments
Table->>MemoryBuffer: Convert DataFrame rows to CSV in-memory
MemoryBuffer-->>Table: Compute chunk sizes & MD5 hashes
end
alt Multiple chunks detected
Table->>Synapse: Apply schema changes before uploading
end
loop For all chunks found in first loop
loop for all parts in chunk byte boundry
Table->>MemoryBuffer: Read small (< 8MB) part of the chunk
MemoryBuffer-->>Table: Return bytes (with correct offset)
Table->>Synapse: Upload part
Synapse-->>Table: Upload response
end
Table->>Synapse: Complete upload
Synapse-->>Table: Return file_handle_id
Table->>Synapse: Send 'TableUpdateTransaction' to append/update rows
Synapse-->>Table: Transaction result
end
Table-->>User: Upload complete
synUnbindSchema(instance, synapse_client=NULL): Unbind the JSON schema bound to the entity.
synUpsertRows(instance, values, primary_keys, dry_run=FALSE, rows_per_query=50000L, update_size_bytes=1992294.4, insert_size_bytes=943718400L, job_timeout=600L, date_columns=NULL, date_format=NULL, synapse_client=NULL): This method allows you to perform an upsert (Update and Insert) for row(s).
This means that you may update a row with only the data that you want to change.
When supplied with a row that does not match the given primary_keys a new
row will be inserted.
Using the primary_keys argument you may specify which columns to use to
determine if a row already exists. If a row exists with the same values in the
columns specified in this list the row will be updated. If a row does not exist
it will be inserted.
Limitations:
- The request to update, and the request to insert data does not occur in a
single transaction. This means that the update of data may succeed, but the
insert of data may fail. Additionally, as noted in the limitation below, if
data is chunked up into multiple requests you may find that a portion of
your data is updated, but another portion is not.
- The number of rows that may be upserted in a single call should be
kept to a minimum (< 50,000). There is significant overhead in the request
to Synapse for each row that is upserted. If you are upserting a large
number of rows a better approach may be to query for the data you want
to update, update the data, then use the synStoreRows() function to
update the data in Synapse. Any rows you want to insert may be added
to the data frame that is passed to the synStoreRows() function.
- When upserting many rows the requests to Synapse will be chunked into smaller
requests. The limit is 2MB per request. This chunking will happen
automatically and should not be a concern for most users. If you are
having issues with the request being too large you may lower the
number of rows you are trying to upsert, or note the above limitation.
- The primary_keys argument must contain at least one column.
- The primary_keys argument cannot contain columns that are a LIST type.
- The primary_keys argument cannot contain columns that are a JSON type.
- The primary_keys columns must be present in the data being upserted. An
error is raised if a primary key column is missing.
- The values in the primary_keys columns cannot be null. A null value
cannot be used to match an existing row, so an error is raised if any row
has a null value in a primary key column.
- The values used as the primary_keys must be unique in the table. If there
are multiple rows with the same values in the primary_keys the behavior
is that an exception will be raised.
- The columns used in primary_keys cannot contain updated values. Since
the values in these columns are used to determine if a row exists, they
cannot be updated in the same transaction.
The following is a Sequence Diagram that describes the upsert process at a high level:
sequenceDiagram
participant User
participant Table
participant Synapse
User->>Table: upsert_rows()
loop Query and Process Updates in Chunks (rows_per_query)
Table->>Synapse: Query existing rows using primary keys
Synapse-->>Table: Return matching rows
Note Over Table: Create partial row updates
loop For results from query
Note Over Table: Sum row/chunk size
alt Chunk size exceeds update_size_bytes
Table->>Synapse: Push update chunk
Synapse-->>Table: Acknowledge update
end
Table->>Table: Add row to chunk
end
alt Remaining updates exist
Table->>Synapse: Push final update chunk
Synapse-->>Table: Acknowledge update
end
end
alt New rows exist
Table->>Table: Identify new rows for insertion
Table->>Table: Call synStoreRows() function
end
Table-->>User: Upsert complete
synValidateSchema(instance, synapse_client=NULL): Validate the entity against the bound JSON schema.
## Not run: ## Example 1: Create a table with data without specifying columns # This API is setup to allow the data to define which columns are created on the # Synapse table automatically. The limitation with this behavior is that the # columns created will only be of the following types: # - STRING # - LARGETEXT # - INTEGER # - DOUBLE # - BOOLEAN # - DATE # The determination of the column type is based on the data that is passed in # using the pandas function # infer_dtype (https://pandas.pydata.org/docs/reference/api/pandas.api.types.infer_dtype.html). # If you need a more specific column type, or need to add options to the columns # follow the examples below. library(synapser) synLogin() my_data = data.frame( my_string_column = c("a", "b", "c", "d"), my_integer_column = c(1, 2, 3, 4), my_double_column = c(1.0, 2.0, 3.0, 4.0), my_boolean_column = c(TRUE, FALSE, TRUE, FALSE) ) table = Table( name = "my_table", parent_id = "syn1234" ) |> synStore() table |> synStoreRows(values = my_data, schema_storage_strategy = "INFER_FROM_DATA") # Prints out the stored data about this specific column table$columns[["my_string_column"]] ## Example 2: Rename an existing column # This examples shows how you may retrieve a table from synapse, rename a column, # and then store the table back in synapse. library(synapser) synLogin() table = Table( name = "my_table", parent_id = "syn1234" ) |> synGet() # You may also get the table by id: table = Table(id = "syn4567") |> synGet() table$columns[["my_old_column"]]$name = "my_new_column" # Before the data is stored in synapse you'll still be able to use the old key to access the column entry table$columns[["my_old_column"]] table = table |> synStore() # After the data is stored in synapse you'll be able to use the new key to access the column entry table$columns[["my_new_column"]] ## Example 3: Create a table with a list of columns # A list of columns may be passed in when creating a new table. The order of the # columns in the list will be the order they are stored in Synapse. If the table # already exists and you create the Table instance in this way the columns will # be appended to the end of the existing columns. library(synapser) synLogin() columns = list( Column(name = "my_string_column", column_type = "STRING"), Column(name = "my_integer_column", column_type = "INTEGER"), Column(name = "my_double_column", column_type = "DOUBLE"), Column(name = "my_boolean_column", column_type = "BOOLEAN") ) table = Table( name = "my_table", parent_id = "syn1234", columns = columns ) table |> synStore() ## Example 4: Creating a table with a named list of columns # When specifying a number of columns via a named list setting the name attribute # on the Column object is optional. When it is not specified it will be # pulled from the key of the named list. library(synapser) synLogin() columns = list( my_string_column = Column(column_type = "STRING"), my_integer_column = Column(column_type = "INTEGER"), my_double_column = Column(column_type = "DOUBLE"), my_boolean_column = Column(column_type = "BOOLEAN") ) table = Table( name = "my_table", parent_id = "syn1234", columns = columns ) table |> synStore() ## End(Not run)## Not run: ## Example 1: Create a table with data without specifying columns # This API is setup to allow the data to define which columns are created on the # Synapse table automatically. The limitation with this behavior is that the # columns created will only be of the following types: # - STRING # - LARGETEXT # - INTEGER # - DOUBLE # - BOOLEAN # - DATE # The determination of the column type is based on the data that is passed in # using the pandas function # infer_dtype (https://pandas.pydata.org/docs/reference/api/pandas.api.types.infer_dtype.html). # If you need a more specific column type, or need to add options to the columns # follow the examples below. library(synapser) synLogin() my_data = data.frame( my_string_column = c("a", "b", "c", "d"), my_integer_column = c(1, 2, 3, 4), my_double_column = c(1.0, 2.0, 3.0, 4.0), my_boolean_column = c(TRUE, FALSE, TRUE, FALSE) ) table = Table( name = "my_table", parent_id = "syn1234" ) |> synStore() table |> synStoreRows(values = my_data, schema_storage_strategy = "INFER_FROM_DATA") # Prints out the stored data about this specific column table$columns[["my_string_column"]] ## Example 2: Rename an existing column # This examples shows how you may retrieve a table from synapse, rename a column, # and then store the table back in synapse. library(synapser) synLogin() table = Table( name = "my_table", parent_id = "syn1234" ) |> synGet() # You may also get the table by id: table = Table(id = "syn4567") |> synGet() table$columns[["my_old_column"]]$name = "my_new_column" # Before the data is stored in synapse you'll still be able to use the old key to access the column entry table$columns[["my_old_column"]] table = table |> synStore() # After the data is stored in synapse you'll be able to use the new key to access the column entry table$columns[["my_new_column"]] ## Example 3: Create a table with a list of columns # A list of columns may be passed in when creating a new table. The order of the # columns in the list will be the order they are stored in Synapse. If the table # already exists and you create the Table instance in this way the columns will # be appended to the end of the existing columns. library(synapser) synLogin() columns = list( Column(name = "my_string_column", column_type = "STRING"), Column(name = "my_integer_column", column_type = "INTEGER"), Column(name = "my_double_column", column_type = "DOUBLE"), Column(name = "my_boolean_column", column_type = "BOOLEAN") ) table = Table( name = "my_table", parent_id = "syn1234", columns = columns ) table |> synStore() ## Example 4: Creating a table with a named list of columns # When specifying a number of columns via a named list setting the name attribute # on the Column object is optional. When it is not specified it will be # pulled from the key of the named list. library(synapser) synLogin() columns = list( my_string_column = Column(column_type = "STRING"), my_integer_column = Column(column_type = "INTEGER"), my_double_column = Column(column_type = "DOUBLE"), my_boolean_column = Column(column_type = "BOOLEAN") ) table = Table( name = "my_table", parent_id = "syn1234", columns = columns ) table |> synStore() ## End(Not run)
Configuration options for table-like entities when using the factory methods.
This dataclass controls how table-like entities (Table, Dataset, EntityView, MaterializedView, SubmissionView, VirtualTable, and DatasetCollection) are retrieved, particularly whether column schema information should be included.
TableOptions(include_columns=TRUE)TableOptions(include_columns=TRUE)
include_columns |
(bool) Whether to include column schema information when retrieving table-like entities. If TRUE, the returned entity will have its columns attribute populated with Column objects containing schema information (name, column_type, etc.). If FALSE, the columns attribute will be an empty named list. Including columns may result in additional API calls but provides complete table structure information. Default is TRUE. |
An S3-style class object.
NULL
TableOptions(include_columns=TRUE): Constructor for TableOptions
## Not run: # Configure table column inclusion: library(synapser) # Include column schema information with_columns = TableOptions(include_columns = TRUE) # Skip column information (faster retrieval) without_columns = TableOptions(include_columns = FALSE) ## End(Not run)## Not run: # Configure table column inclusion: library(synapser) # Include column schema information with_columns = TableOptions(include_columns = TRUE) # Skip column information (faster retrieval) without_columns = TableOptions(include_columns = FALSE) ## End(Not run)
Represents a Synapse Team. The user-definable fields are documented in the arguments below.
Team(id=NULL, name=NULL, description=NULL, icon=NULL, can_public_join=FALSE, can_request_membership=TRUE, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL)Team(id=NULL, name=NULL, description=NULL, icon=NULL, can_public_join=FALSE, can_request_membership=TRUE, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL)
id |
(Optional[int]) The ID of the team |
name |
(Optional[str]) The name of the team |
description |
(Optional[str]) A short description of the team |
icon |
(Optional[str]) A file handle ID for the icon image of the team |
can_public_join |
(Optional[bool]) TRUE if members can join without an invitation or approval |
can_request_membership |
(Optional[bool]) TRUE if users can create a membership request to join |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this team was created |
modified_on |
(Optional[str]) The date this team was last modified |
created_by |
(Optional[str]) The ID of the user that created this team |
modified_by |
(Optional[str]) The ID of the user that last modified this team |
An S3-style class object.
NULL
Team(id=NULL, name=NULL, description=NULL, icon=NULL, can_public_join=FALSE, can_request_membership=TRUE, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL): Constructor for Team
synCreate(instance, synapse_client=NULL): Creates a new team on Synapse.
synGetFromId(cls, id, synapse_client=NULL): Gets Team object using its integer id.
synGetFromName(cls, name, synapse_client=NULL): Gets Team object using its string name.
Note: You will be unable to retrieve a team by name immediately after its creation because the fragment service is eventually consistent. If you need to retrieve a team immediately following creation you should use the synGetFromId() function instead.
synGetUserMembershipStatus(instance, user_id, synapse_client=NULL): Retrieve a user's Team Membership Status bundle for this team.
synInviteToTeam(instance, user, message, force=TRUE, synapse_client=NULL): Invites a user to a team given the ID field on the Team instance.
synGetTeamMembers(instance, synapse_client=NULL): Gets the TeamMembers associated with a team given the ID field on the Team instance.
synGetOpenInvitations(instance, synapse_client=NULL): Gets all open invitations for a team given the ID field on the Team instance.
synDeleteInvitation(invitation_id, synapse_client=NULL): Deletes an open invitation to a team. Note: The client must be an administrator of the Team referenced by the invitation, or the invitee, to make this request.
## Not run: ## Example 1: Create a new team library(synapser) synLogin() team = Team( name = "My Uniquely Named Team", description = "A team for my project collaborators" ) |> synCreate() ## Example 2: Get a team by ID or name library(synapser) synLogin() team_by_id = Team() |> synGetFromId(id = 123456L) team_by_name = Team() |> synGetFromName(name = "My Uniquely Named Team") # Or fill in a Team that already has an id or a name. If both are set, the id is used. team_by_id = Team(id = 123456L) |> synGet() team_by_name = Team(name = "My Uniquely Named Team") |> synGet() ## Example 3: List the members of a team and invite a new one library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) members = team |> synGetTeamMembers() for (member in members) { cat(sprintf("%s (admin: %s)\n", member$member$user_name, member$is_admin)) } team |> synInviteToTeam(user = "my_username", message = "Please join my team!") ## Example 4: Delete a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) team |> synDelete() ## End(Not run)## Not run: ## Example 1: Create a new team library(synapser) synLogin() team = Team( name = "My Uniquely Named Team", description = "A team for my project collaborators" ) |> synCreate() ## Example 2: Get a team by ID or name library(synapser) synLogin() team_by_id = Team() |> synGetFromId(id = 123456L) team_by_name = Team() |> synGetFromName(name = "My Uniquely Named Team") # Or fill in a Team that already has an id or a name. If both are set, the id is used. team_by_id = Team(id = 123456L) |> synGet() team_by_name = Team(name = "My Uniquely Named Team") |> synGet() ## Example 3: List the members of a team and invite a new one library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) members = team |> synGetTeamMembers() for (member in members) { cat(sprintf("%s (admin: %s)\n", member$member$user_name, member$is_admin)) } team |> synInviteToTeam(user = "my_username", message = "Please join my team!") ## Example 4: Delete a team library(synapser) synLogin() team = Team() |> synGetFromId(id = 123456L) team |> synDelete() ## End(Not run)
Reference to a Synapse entity that was used or executed by an Activity.
UsedEntity(target_id=NULL, target_version_number=NULL)UsedEntity(target_id=NULL, target_version_number=NULL)
target_id |
(Optional[str]) The ID of the entity to which this reference refers. |
target_version_number |
(Optional[int]) The version number of the entity to which this reference refers. |
An S3-style class object.
NULL
UsedEntity(target_id=NULL, target_version_number=NULL): Constructor for UsedEntity
## Not run: ## Recording an entity used to produce a file library(synapser) synLogin() activity = Activity( name = "Analysis", used = list(UsedEntity(target_id = "syn456", target_version_number = 1L)) ) activity = activity |> synStore(parent = "syn123") ## End(Not run)## Not run: ## Recording an entity used to produce a file library(synapser) synLogin() activity = Activity( name = "Analysis", used = list(UsedEntity(target_id = "syn456", target_version_number = 1L)) ) activity = activity |> synStore(parent = "syn123") ## End(Not run)
URL that was used or executed by an Activity such as a link to a GitHub commit or a link to a specific version of a software tool.
UsedURL(name=NULL, url=NULL)UsedURL(name=NULL, url=NULL)
name |
(Optional[str]) The name of the URL. |
url |
(Optional[str]) The external URL of the file that was used such as a link to a GitHub commit or a link to a specific version of a software tool. |
An S3-style class object.
NULL
UsedURL(name=NULL, url=NULL): Constructor for UsedURL
## Not run: ## Recording a URL used to produce a file library(synapser) synLogin() activity = Activity( name = "Analysis", used = list(UsedURL(name = "Reference genome", url = "https://www.ncbi.nlm.nih.gov/grc/human")), executed = list(UsedURL(name = "Analysis code", url = "https://github.com/my-org/my-analysis")) ) activity = activity |> synStore(parent = "syn123") ## End(Not run)## Not run: ## Recording a URL used to produce a file library(synapser) synLogin() activity = Activity( name = "Analysis", used = list(UsedURL(name = "Reference genome", url = "https://www.ncbi.nlm.nih.gov/grc/human")), executed = list(UsedURL(name = "Analysis code", url = "https://github.com/my-org/my-analysis")) ) activity = activity |> synStore(parent = "syn123") ## End(Not run)
A UserPreference represents a user preference in the system.
UserPreference(name=NULL, value=NULL)UserPreference(name=NULL, value=NULL)
name |
(Optional[str]) The name of the user preference. |
value |
(Optional[bool]) The value of the user preference. |
An S3-style class object.
NULL
UserPreference(name=NULL, value=NULL): Constructor for UserPreference
## Not run: ## Inspecting a user's preferences # UserPreference objects are found in the `preferences` field of a UserProfile library(synapser) synLogin() profile = UserProfile |> synGetFromUsername(username = "myUsername") for (preference in profile$preferences) { print(sprintf("%s: %s", preference$name, preference$value)) } ## End(Not run)## Not run: ## Inspecting a user's preferences # UserPreference objects are found in the `preferences` field of a UserProfile library(synapser) synLogin() profile = UserProfile |> synGetFromUsername(username = "myUsername") for (preference in profile$preferences) { print(sprintf("%s: %s", preference$name, preference$value)) } ## End(Not run)
UserProfile represents a user's profile in the system.
UserProfile(id=NULL, username=NULL, etag=NULL, first_name=NULL, last_name=NULL, emails=list(), open_ids=list(), r_studio_url=NULL, summary=NULL, position=NULL, location=NULL, industry=NULL, company=NULL, profile_picure_file_handle_id=NULL, url=NULL, team_name=NULL, send_email_notifications=TRUE, mark_emailed_messages_as_read=FALSE, preferences=list(), created_on=NULL, display_name=NULL, notification_settings=NULL)UserProfile(id=NULL, username=NULL, etag=NULL, first_name=NULL, last_name=NULL, emails=list(), open_ids=list(), r_studio_url=NULL, summary=NULL, position=NULL, location=NULL, industry=NULL, company=NULL, profile_picure_file_handle_id=NULL, url=NULL, team_name=NULL, send_email_notifications=TRUE, mark_emailed_messages_as_read=FALSE, preferences=list(), created_on=NULL, display_name=NULL, notification_settings=NULL)
id |
(Optional[int]) A foreign key to the ID of the 'principal' object for the user. |
username |
(Optional[str]) A name chosen by the user that uniquely identifies them. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
first_name |
(Optional[str]) This person's given name (forename) |
last_name |
(Optional[str]) This person's family name (surname) |
emails |
(list[str]) The list of user email addresses registered to this user. |
open_ids |
(list[str]) The list of OpenIds bound to this user's account. |
r_studio_url |
(Optional[str]) URL for RStudio server assigned to the user. |
summary |
(Optional[str]) A summary description about this person. |
position |
(Optional[str]) This person's current position title. |
location |
(Optional[str]) This person's location. |
industry |
(Optional[str]) The industry/discipline that this person is associated with. |
company |
(Optional[str]) This person's current affiliation. |
profile_picure_file_handle_id |
(Optional[str]) The File Handle id of the user's profile picture. |
url |
(Optional[str]) A link to more information about this person. |
team_name |
(Optional[str]) This person's default team name. |
send_email_notifications |
(Optional[bool]) Should the user receive email notifications? Default TRUE. |
mark_emailed_messages_as_read |
(Optional[bool]) Should messages that are emailed to the user be marked as READ in Synapse? Default FALSE. |
preferences |
(Optional[list[UserPreference]]) A list of |
created_on |
(Optional[str]) The date this profile was created. |
display_name |
This field is deprecated and will always be NULL. |
notification_settings |
Contains a user's notification settings. |
An S3-style class object.
NULL
UserProfile(id=NULL, username=NULL, etag=NULL, first_name=NULL, last_name=NULL, emails=list(), open_ids=list(), r_studio_url=NULL, summary=NULL, position=NULL, location=NULL, industry=NULL, company=NULL, profile_picure_file_handle_id=NULL, url=NULL, team_name=NULL, send_email_notifications=TRUE, mark_emailed_messages_as_read=FALSE, preferences=list(), created_on=NULL, display_name=NULL, notification_settings=NULL): Constructor for UserProfile
synGetFromId(cls, user_id, synapse_client=NULL): Gets UserProfile object using its integer id.
synGetFromUsername(cls, username, synapse_client=NULL): Gets UserProfile object using its string name.
synIsCertified(instance, synapse_client=NULL): Determine whether a user is certified.
## Not run: ## Getting a user's profile library(synapser) synLogin() profile = UserProfile |> synGetFromUsername(username = "myUsername") print(profile$id) profile = UserProfile |> synGetFromId(user_id = 273948L) print(profile$username) # Check whether the user is certified print(profile |> synIsCertified()) ## End(Not run)## Not run: ## Getting a user's profile library(synapser) synLogin() profile = UserProfile |> synGetFromUsername(username = "myUsername") print(profile$id) profile = UserProfile |> synGetFromId(user_id = 273948L) print(profile$username) # Check whether the user is certified print(profile |> synIsCertified()) ## End(Not run)
A virtual table is a type of table that is dynamically built from a Synapse
SQL query. Its content is read only and based off the defining_sql attribute.
The SQL of the virtual table may NOT contain JOIN or UNION clauses and must
reference a table that has a non-empty schema.
A VirtualTable object represents this VirtualTable API model in Synapse:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/VirtualTable.html>
VirtualTable(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list())VirtualTable(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list())
id |
(Optional[str]) The unique immutable ID for this entity. Once issued, this ID is guaranteed to never change or be re-issued. |
name |
(Optional[str]) The name of this entity. Must be 256 characters or less. Names may only contain: letters, numbers, spaces, underscores, hyphens, periods, plus signs, apostrophes, and parentheses. |
parent_id |
(Optional[str]) The ID of the Entity that is the parent of this entity. |
activity |
(Optional[Activity]) The Activity model represents the main record of Provenance in Synapse. |
version_number |
(Optional[int]) The version number issued to this version on the object. |
description |
(Optional[str]) The description of this entity. Must be 1000 characters or less. |
etag |
(Optional[str]) Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
created_on |
(Optional[str]) The date this entity was created. |
modified_on |
(Optional[str]) The date this entity was last modified. In YYYY-MM-DD-Thh:mm:ss.sssZ format. |
created_by |
(Optional[str]) The ID of the user that created this entity. |
modified_by |
(Optional[str]) The ID of the user that last modified this entity. |
version_label |
(Optional[str]) The version label for this entity. |
version_comment |
(Optional[str]) The version comment for this entity. |
is_latest_version |
(Optional[bool]) If this is the latest version of the object. |
columns |
(Optional[OrderedDict[str, Column]]) (Read Only) The columns of a virtual table are dynamic based on the select statement of the definingSQL. This list of columnIds is for read-only purposes. |
is_search_enabled |
(Optional[bool]) When creating or updating a table or view specifies if full text search should be enabled. |
defining_sql |
(Optional[str]) The synapse SQL statement that defines the data in the virtual table. This field may NOT contain JOIN or UNION clauses. If a JOIN or UNION clause is present, a |
annotations |
(Optional[dict[str, Union[list[str], list[bool], list[float], list[int], list[date], list[datetime]]]]) Additional metadata associated with the virtual table. The key is the name of your desired annotations. The value is an object containing a list of values (use empty list to represent no values for key) and the value type associated with all values in the list. To remove all annotations set this to an empty named list |
An S3-style class object.
NULL
VirtualTable(id=NULL, name=NULL, parent_id=NULL, activity=NULL, version_number=NULL, description=NULL, etag=NULL, created_on=NULL, modified_on=NULL, created_by=NULL, modified_by=NULL, version_label=NULL, version_comment=NULL, is_latest_version=NULL, columns=list(), is_search_enabled=NULL, defining_sql=NULL, annotations=list()): Constructor for VirtualTable
synDeletePermissions(instance, include_self=TRUE, include_container_content=FALSE, recursive=FALSE, target_entity_types=NULL, dry_run=FALSE, show_acl_details=TRUE, show_files_in_containers=TRUE, synapse_client=NULL): Delete the entire local Access Control List (ACL) for a given Entity. This is not
scoped to a specific user or group, but rather removes all permissions
associated with the Entity. After this operation, the Entity will inherit
permissions from its benefactor, which is typically its parent entity or
the Project it belongs to.
In order to remove permissions for a specific user or group, you
should use the synSetPermissions() function with the access_type set to
an empty list.
By default, Entities such as FileEntity and Folder inherit their permission from
their containing Project. For such Entities the Project is the Entity's 'benefactor'.
This permission inheritance can be overridden by creating an ACL for the Entity.
When this occurs the Entity becomes its own benefactor and all permission are
determined by its own ACL.
If the ACL of an Entity is deleted, then its benefactor will automatically be set
to its parent's benefactor.
Special notice for Projects: The ACL for a Project cannot be deleted, you
must individually update or revoke the permissions for each user or group.
synGetAcl(instance, principal_id=NULL, check_benefactor=TRUE, synapse_client=NULL): Get the ACL
that a user or group has on an Entity.
synGetPermissions(instance, synapse_client=NULL): Get the permissions
that the caller has on an Entity.
synListAcl(instance, recursive=FALSE, include_container_content=FALSE, target_entity_types=NULL, log_tree=FALSE, synapse_client=NULL): List the Access Control Lists (ACLs) for this entity and optionally its children.
This function returns the local sharing settings for the entity and optionally
its children. It provides a mapping of all ACLs for the given container/entity.
Important Note: This function returns the LOCAL sharing settings only, not
the effective permissions that each Synapse User ID/Team has on the entities.
More permissive permissions could be granted via a Team that the user has access
to that has permissions on the entity, or through inheritance from parent entities.
synQuery(query, include_row_id_and_row_version=TRUE, convert_to_datetime=FALSE, download_location=NULL, quote_character="\"", escape_character=r"(\)", line_end="\n", separator=",", header=TRUE, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. The results will always be
returned as a data frame unless you specify a download_location in which
case the results will be downloaded to that location. There are a number of
arguments that you may pass to this function depending on if you are getting
the results back as a DataFrame or downloading the results to a file.
synQueryPartMask(query, part_mask, timeout=250L, synapse_client=NULL): Query for data on a table stored in Synapse. This is a more advanced use case
of the synQuery() function that allows you to determine what additional metadata
about the table or query should also be returned. If you do not need this
additional information then you are better off using the synQuery() function.
The query for this method uses this Rest API:
<https://rest-docs.synapse.org/rest/POST/entity/id/table/query/async/start.html>
synSetPermissions(instance, principal_id=NULL, access_type=NULL, modify_benefactor=FALSE, warn_if_inherits=TRUE, overwrite=TRUE, synapse_client=NULL): Sets permission that a user or group has on an Entity.
An Entity may have its own ACL or inherit its ACL from a benefactor.
## Not run: ## Example 1: Create a new virtual table with a defining SQL query. library(synapser) synLogin() virtual_table = VirtualTable( name = "My Virtual Table", description = "A test virtual table", parent_id = "syn12345", defining_sql = "SELECT * FROM syn67890" ) |> synStore() cat("Created Virtual Table with ID:", virtual_table$id, "\n") ## Example 2: Update the defining SQL of an existing virtual table. library(synapser) synLogin() virtual_table = VirtualTable(id = "syn12345") |> synGet() virtual_table$defining_sql = "SELECT column1, column2 FROM syn67890" virtual_table = virtual_table |> synStore() cat("Updated Virtual Table defining SQL.\n") ## Example 3: Delete a virtual table. library(synapser) synLogin() virtual_table = VirtualTable(id = "syn12345") synDelete(virtual_table) cat("Deleted Virtual Table.\n") ## Example 4: Query data from a virtual table. library(synapser) synLogin() query_result = synQuery(query = "SELECT * FROM syn66080386") query_result ## End(Not run)## Not run: ## Example 1: Create a new virtual table with a defining SQL query. library(synapser) synLogin() virtual_table = VirtualTable( name = "My Virtual Table", description = "A test virtual table", parent_id = "syn12345", defining_sql = "SELECT * FROM syn67890" ) |> synStore() cat("Created Virtual Table with ID:", virtual_table$id, "\n") ## Example 2: Update the defining SQL of an existing virtual table. library(synapser) synLogin() virtual_table = VirtualTable(id = "syn12345") |> synGet() virtual_table$defining_sql = "SELECT column1, column2 FROM syn67890" virtual_table = virtual_table |> synStore() cat("Updated Virtual Table defining SQL.\n") ## Example 3: Delete a virtual table. library(synapser) synLogin() virtual_table = VirtualTable(id = "syn12345") synDelete(virtual_table) cat("Deleted Virtual Table.\n") ## Example 4: Query data from a virtual table. library(synapser) synLogin() query_result = synQuery(query = "SELECT * FROM syn66080386") query_result ## End(Not run)
A WikiHeader contains basic metadata about a WikiPage.
WikiHeader(id=NULL, title=NULL, parent_id=NULL)WikiHeader(id=NULL, title=NULL, parent_id=NULL)
id |
(Optional[str]) The unique identifier for this wiki page. |
title |
(Optional[str]) The title of this page. |
parent_id |
(Optional[str]) When set, the WikiPage is a sub-page of the indicated parent WikiPage. |
An S3-style class object.
NULL
WikiHeader(id=NULL, title=NULL, parent_id=NULL): Constructor for WikiHeader
## Not run: ## Get the header tree (hierarchy) of wiki pages for an entity library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() for (header in as.list(WikiHeader() |> synGet(owner_id = project$id))) { print(header) } ## End(Not run)## Not run: ## Get the header tree (hierarchy) of wiki pages for an entity library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() for (header in as.list(WikiHeader() |> synGet(owner_id = project$id))) { print(header) } ## End(Not run)
A WikiHistorySnapshot contains basic information about an update to a WikiPage.
WikiHistorySnapshot(version=NULL, modified_on=NULL, modified_by=NULL)WikiHistorySnapshot(version=NULL, modified_on=NULL, modified_by=NULL)
version |
(Optional[str]) The version number of the wiki page. |
modified_on |
(Optional[str]) The timestamp when this version was created. |
modified_by |
(Optional[str]) The ID of the user that created this version. |
An S3-style class object.
NULL
WikiHistorySnapshot(version=NULL, modified_on=NULL, modified_by=NULL): Constructor for WikiHistorySnapshot
## Not run: ## Get the history of a wiki page library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_page_id = "123456" # Replace with the ID of a wiki page in the project for (history in as.list(WikiHistorySnapshot() |> synGet(owner_id = project$id, id = wiki_page_id))) { print(history) } ## End(Not run)## Not run: ## Get the history of a wiki page library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_page_id = "123456" # Replace with the ID of a wiki page in the project for (history in as.list(WikiHistorySnapshot() |> synGet(owner_id = project$id, id = wiki_page_id))) { print(history) } ## End(Not run)
A WikiOrderHint contains the order hint for the root wiki that corresponds to the given owner ID and type.
WikiOrderHint(owner_id=NULL, owner_object_type=NULL, id_list=list(), etag=NULL)WikiOrderHint(owner_id=NULL, owner_object_type=NULL, id_list=list(), etag=NULL)
owner_id |
(Optional[str]) The Synapse ID of the owner object (e.g., entity, evaluation, etc.). |
owner_object_type |
(Optional[str]) The type of the owner object. |
id_list |
(list[str]) The list of sub wiki ids that in the order that they should be placed relative to their siblings. |
etag |
(Optional[str]) The etag of this object. |
An S3-style class object.
NULL
WikiOrderHint(owner_id=NULL, owner_object_type=NULL, id_list=list(), etag=NULL): Constructor for WikiOrderHint
## Not run: ## Example 1: Get the WikiOrderHint for a project # This example shows how to get a WikiOrderHint for existing wiki pages in a project. library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_order_hint = WikiOrderHint(owner_id = project$id) |> synGet() print(wiki_order_hint) ## Example 2: Set the WikiOrderHint for a project # This example shows how to set a WikiOrderHint for existing wiki pages in a project. # The WikiOrderHint is not set by default, so you need to set it explicitly. # root_wiki_page and wiki_page_1 to wiki_page_4 are WikiPage objects that # already exist in the project. wiki_order_hint = WikiOrderHint(owner_id = project$id) |> synGet() wiki_order_hint$id_list = list( root_wiki_page$id, wiki_page_1$id, wiki_page_3$id, wiki_page_2$id, wiki_page_4$id ) wiki_order_hint = wiki_order_hint |> synStore() print(wiki_order_hint) ## Example 3: Update the WikiOrderHint for a project # This example shows how to update a WikiOrderHint for existing wiki pages in a project. wiki_order_hint$id_list = list( root_wiki_page$id, wiki_page_1$id, wiki_page_2$id, wiki_page_3$id, wiki_page_4$id ) wiki_order_hint = wiki_order_hint |> synStore() print(wiki_order_hint) ## End(Not run)## Not run: ## Example 1: Get the WikiOrderHint for a project # This example shows how to get a WikiOrderHint for existing wiki pages in a project. library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_order_hint = WikiOrderHint(owner_id = project$id) |> synGet() print(wiki_order_hint) ## Example 2: Set the WikiOrderHint for a project # This example shows how to set a WikiOrderHint for existing wiki pages in a project. # The WikiOrderHint is not set by default, so you need to set it explicitly. # root_wiki_page and wiki_page_1 to wiki_page_4 are WikiPage objects that # already exist in the project. wiki_order_hint = WikiOrderHint(owner_id = project$id) |> synGet() wiki_order_hint$id_list = list( root_wiki_page$id, wiki_page_1$id, wiki_page_3$id, wiki_page_2$id, wiki_page_4$id ) wiki_order_hint = wiki_order_hint |> synStore() print(wiki_order_hint) ## Example 3: Update the WikiOrderHint for a project # This example shows how to update a WikiOrderHint for existing wiki pages in a project. wiki_order_hint$id_list = list( root_wiki_page$id, wiki_page_1$id, wiki_page_2$id, wiki_page_3$id, wiki_page_4$id ) wiki_order_hint = wiki_order_hint |> synStore() print(wiki_order_hint) ## End(Not run)
Represents a Wiki Page.
WikiPage(id=NULL, etag=NULL, title=NULL, parent_id=NULL, markdown=NULL, attachments=list(), owner_id=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, wiki_version=NULL, markdown_file_handle_id=NULL, attachment_file_handle_ids=list())WikiPage(id=NULL, etag=NULL, title=NULL, parent_id=NULL, markdown=NULL, attachments=list(), owner_id=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, wiki_version=NULL, markdown_file_handle_id=NULL, attachment_file_handle_ids=list())
id |
(Optional[str]) The unique identifier for this wiki page. |
etag |
(Optional[str]) The etag of this object. Synapse employs an Optimistic Concurrency Control (OCC) scheme to handle concurrent updates. Since the E-Tag changes every time an entity is updated it is used to detect when a client's current representation of an entity is out-of-date. |
title |
(Optional[str]) The title of this page. |
parent_id |
(Optional[str]) When set, the WikiPage is a sub-page of the indicated parent WikiPage. |
markdown |
(Optional[str]) The markdown content of the wiki page. |
attachments |
(list[dict[str, Any]]) A list of file attachments associated with the wiki page. |
owner_id |
(Optional[str]) The Synapse ID of the owning object (e.g., entity, evaluation, etc.). |
created_on |
(Optional[str]) The timestamp when this page was created. |
created_by |
(Optional[str]) The ID of the user that created this page. |
modified_on |
(Optional[str]) The timestamp when this page was last modified. |
modified_by |
(Optional[str]) The ID of the user that last modified this page. |
wiki_version |
(Optional[str]) The version number of this wiki page. |
markdown_file_handle_id |
(Optional[str]) The ID of the file handle containing the markdown content. |
attachment_file_handle_ids |
(list[str]) The list of attachment file handle ids of this page. |
An S3-style class object.
NULL
WikiPage(id=NULL, etag=NULL, title=NULL, parent_id=NULL, markdown=NULL, attachments=list(), owner_id=NULL, created_on=NULL, created_by=NULL, modified_on=NULL, modified_by=NULL, wiki_version=NULL, markdown_file_handle_id=NULL, attachment_file_handle_ids=list()): Constructor for WikiPage
synCopy(instance, destination_owner_id, destination_sub_page_id=NULL, update_links=TRUE, entity_map=NULL, synapse_client=NULL): Copy the wiki page tree of the owner entity to another entity and update internal links.
If id is set on this WikiPage, only the sub-tree rooted at that wiki page is copied. Otherwise the entire wiki of the owner entity is copied.
synGetAttachment(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL): Download the wiki page attachment to a local file or return the URL.
synGetAttachmentHandles(instance, synapse_client=NULL): Get the file handles of all attachments on this wiki page.
synGetAttachmentPreview(instance, file_name, download_file=TRUE, download_location=NULL, synapse_client=NULL): Download the wiki page attachment preview to a local file or return the URL.
synGetMarkdownFile(instance, download_file=TRUE, download_location=NULL, synapse_client=NULL): Get the markdown URL of this wiki page.
synReformatAttachmentFileName(attachment_file_name): Reformat the attachment file name to be a valid attachment path.
synRestore(instance, synapse_client=NULL): Restore a specific version of a wiki page.
synUnzipGzippedFile(file_path): Unzip the gzipped file and return the file path to the unzipped file. If the file is a markdown file, the content will be printed.
## Not run: ## Example 1: Store a wiki page # This example shows how to store a wiki page. library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_page = WikiPage(owner_id = project$id, title = "My wiki page") |> synStore() print(wiki_page) ## Example 2: Get a wiki page from Synapse # This example shows how to get a wiki page from Synapse. # It uses the project and wiki_page from Example 1. wiki_page = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGet() print(wiki_page) ## Example 3: Delete a wiki page # This example shows how to delete a wiki page. # It uses the project and wiki_page from Example 1. WikiPage(owner_id = project$id, id = wiki_page$id) |> synDelete() print("Wiki page deleted successfully.") ## End(Not run)## Not run: ## Example 1: Store a wiki page # This example shows how to store a wiki page. library(synapser) synLogin() project = Project(name = "My uniquely named project about Alzheimer's Disease") |> synGet() wiki_page = WikiPage(owner_id = project$id, title = "My wiki page") |> synStore() print(wiki_page) ## Example 2: Get a wiki page from Synapse # This example shows how to get a wiki page from Synapse. # It uses the project and wiki_page from Example 1. wiki_page = WikiPage(owner_id = project$id, id = wiki_page$id) |> synGet() print(wiki_page) ## Example 3: Delete a wiki page # This example shows how to delete a wiki page. # It uses the project and wiki_page from Example 1. WikiPage(owner_id = project$id, id = wiki_page$id) |> synDelete() print("Wiki page deleted successfully.") ## End(Not run)