Skip to content

Commit

Permalink
Install synapser and rebuild documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasyu888 committed Feb 4, 2024
1 parent 943bb43 commit 83e45d1
Show file tree
Hide file tree
Showing 131 changed files with 2,212 additions and 1,092 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Improvements

* Python synapsePythonClient dependency updated to 4.0.0
* You can only login via a Synapse Personal Access token now. All other forms of authentication have been disabled for security purposes.
* `synSetAnnotations` removed as it is not working as expected due to implementation in the Python API.

## synapser 1.3.0

Expand Down
1 change: 0 additions & 1 deletion R/PythonPkgWrapperUtils.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ getFunctionInfo <- function(pyPkg,
}
# scrub the nulls
functionInfo <- removeNulls(functionInfo)

functionContainerName <- module
if (!is.null(pySingletonName)) {
functionContainerName <- pySingletonName
Expand Down
3 changes: 1 addition & 2 deletions R/shared.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
"putACLURI",
"keys",
"has_key",
"set_annotations",
"get_annotations"
"set_annotations"
)

.synapseClientClassFilter <- function(x) {
Expand Down
2 changes: 1 addition & 1 deletion R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
)

reticulate::py_run_string(sprintf("synapserVersion = 'synapser/%s' ", utils::packageVersion("synapser")))
reticulate::py_run_string("synapseclient.USER_AGENT['User-Agent'] = synapserVersion + synapseclient.USER_AGENT['User-Agent']")
reticulate::py_run_string("synapseclient.USER_AGENT['User-Agent'] = synapserVersion + ' '+ synapseclient.USER_AGENT['User-Agent']")
reticulate::py_run_string("synapseclient.core.config.single_threaded = True")
reticulate::py_run_string("syn=synapseclient.Synapse(skip_checks=True)")
# make syn available in the global environment
Expand Down
23 changes: 18 additions & 5 deletions auto-man/Activity-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ Activity
\format{An R6 class object.}
\description{
Represents the provenance of a Synapse Entity.

Parameters:
name: Name of the Activity
description: A short text description of the Activity
used: Either a list of:

- [reference objects](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Reference.html) (e.g. [{'targetId':'syn123456', 'targetVersionNumber':1}])
- a list of Synapse Entities or Entity IDs
- a list of URL's
executed: A code resource that was executed to generate the Entity.
data: A dictionary representation of an Activity, with fields 'name', 'description' and 'used' (a list of reference objects)
See also: The [W3C's provenance ontology](http://www.w3.org/TR/prov-o/)
}
\section{Methods}{
\itemize{
\item \code{Activity(name=NULL, description=NULL, used=NULL, executed=NULL, data=list())}: Constructor for \code{\link{Activity}}
\item \code{executed(target=NULL, targetVersion=NULL, url=NULL, name=NULL)}: Add a code resource that was executed during the activity.\cr
See synapseclient.activity.Activity.used
See [synapseclient.activity.Activity.used][]
\item \code{used(target=NULL, targetVersion=NULL, wasExecuted=NULL, url=NULL, name=NULL)}: Add a resource used by the activity.\cr
\cr
This method tries to be as permissive as possible. It accepts a string which might be a synapse ID or a URL,\cr
Expand All @@ -31,26 +44,26 @@ It is an error to specify both target/targetVersion parameters and url/name para
To add multiple UsedEntities and UsedURLs, make a separate call for each or pass in a list.\cr
\cr
In case of conflicting settings for wasExecuted both inside an object and with a parameter, the parameter wins.\cr
For example, this UsedURL will have wasExecuted set to False::\cr
For example, this UsedURL will have wasExecuted set to False:\cr
\cr
activity.used({'url':'http://google.com', 'name':'Goog', 'wasExecuted':True}, wasExecuted=False)\cr
\cr
Entity examples::\cr
Entity examples:\cr
\cr
activity.used('syn12345')\cr
activity.used(entity)\cr
activity.used(target=entity, targetVersion=2)\cr
activity.used(codeEntity, wasExecuted=True)\cr
activity.used({'reference':{'target':'syn12345', 'targetVersion':1}, 'wasExecuted':False})\cr
\cr
URL examples::\cr
URL examples:\cr
\cr
activity.used('http://mydomain.com/my/awesome/data.RData')\cr
activity.used(url='http://mydomain.com/my/awesome/data.RData', name='Awesome Data')\cr
activity.used(url='https://github.com/joe_hacker/code_repo', name='Gnarly hacks', wasExecuted=True)\cr
activity.used({'url':'https://github.com/joe_hacker/code_repo', 'name':'Gnarly hacks'}, wasExecuted=True)\cr
\cr
List example::\cr
List example:\cr
\cr
activity.used(['syn12345', 'syn23456', entity, {'reference':{'target':'syn100009', 'targetVersion':2}, 'wasExecuted':True}, 'http://mydomain.com/my/awesome/data.RData'])
}
Expand Down
27 changes: 18 additions & 9 deletions auto-man/Activity.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ Constructor for objects of type Activity
}
\description{
Represents the provenance of a Synapse Entity.

Parameters:
name: Name of the Activity
description: A short text description of the Activity
used: Either a list of:

- [reference objects](https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/Reference.html) (e.g. [{'targetId':'syn123456', 'targetVersionNumber':1}])
- a list of Synapse Entities or Entity IDs
- a list of URL's
executed: A code resource that was executed to generate the Entity.
data: A dictionary representation of an Activity, with fields 'name', 'description' and 'used' (a list of reference objects)
See also: The [W3C's provenance ontology](http://www.w3.org/TR/prov-o/)
}
\usage{
Activity(name=NULL, description=NULL, used=NULL, executed=NULL, data=list())
}
\arguments{
\item{name}{ name of the Activity\cr
}
\item{description}{ a short text description of the Activity\cr
}
\item{used}{ Either a list of:}
\item{executed}{ A code resource that was executed to generate the Entity.\cr
}
\item{data}{ A dictionary representation of an Activity, with fields 'name', 'description' and 'used'\cr
(a list of reference objects)}
\item{name}{}
\item{description}{}
\item{used}{}
\item{executed}{}
\item{data}{}
}
\value{
An object of type Activity
Expand Down
34 changes: 31 additions & 3 deletions auto-man/Column-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,40 @@ Column
}
\format{An R6 class object.}
\description{
Defines a column to be used in a table Schema
EntityViewSchema.
Defines a column to be used in a table [Schema][synapseclient.table.Schema]
[EntityViewSchema][synapseclient.table.EntityViewSchema].

Attributes:
id: An immutable ID issued by the platform
columnType: The column type determines the type of data that can be stored in a column. It can be any
of:

- `STRING`
- `DOUBLE`
- `INTEGER`
- `BOOLEAN`
- `DATE`
- `FILEHANDLEID`
- `ENTITYID`
- `LINK`
- `LARGETEXT`
- `USERID`

For more information, please see:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html>
maximumSize: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a
default maximum size of 50 characters, but can be set to a `maximumSize` of 1 to 1000
characters.
maximumListLength: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of
values that will appear in that list. Value range 1-100 inclusive. Default 100
name: The display name of the column
enumValues: Columns type of STRING can be constrained to an enumeration values set on this list.
defaultValue: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not
allowed to have default values.
}
\section{Methods}{
\itemize{
\item \code{Column(id=NULL, columnType=NULL, maximumSize=NULL, maximumListLength=NULL, name=NULL, enumValues=NULL, defaultValue=NULL)}: Constructor for \code{\link{Column}}
\item \code{Column()}: Constructor for \code{\link{Column}}
}
}

55 changes: 32 additions & 23 deletions auto-man/Column.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,42 @@
Constructor for objects of type Column
}
\description{
Defines a column to be used in a table Schema
EntityViewSchema.
Defines a column to be used in a table [Schema][synapseclient.table.Schema]
[EntityViewSchema][synapseclient.table.EntityViewSchema].

Attributes:
id: An immutable ID issued by the platform
columnType: The column type determines the type of data that can be stored in a column. It can be any
of:

- `STRING`
- `DOUBLE`
- `INTEGER`
- `BOOLEAN`
- `DATE`
- `FILEHANDLEID`
- `ENTITYID`
- `LINK`
- `LARGETEXT`
- `USERID`

For more information, please see:
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html>
maximumSize: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a
default maximum size of 50 characters, but can be set to a `maximumSize` of 1 to 1000
characters.
maximumListLength: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of
values that will appear in that list. Value range 1-100 inclusive. Default 100
name: The display name of the column
enumValues: Columns type of STRING can be constrained to an enumeration values set on this list.
defaultValue: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not
allowed to have default values.
}
\usage{
Column(id=NULL, columnType=NULL, maximumSize=NULL, maximumListLength=NULL, name=NULL, enumValues=NULL, defaultValue=NULL)
Column()
}
\arguments{
\item{id}{optional named parameter: An immutable ID issued by the platform\cr
}
\item{columnType}{optional named parameter: The column type determines the type of data that can be stored in a column. It can be any\cr
of: "STRING", "DOUBLE", "INTEGER", "BOOLEAN", "DATE", "FILEHANDLEID", "ENTITYID", "LINK",\cr
"LARGETEXT", "USERID". For more information, please see:\cr
https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/table/ColumnType.html\cr
}
\item{maximumSize}{optional named parameter: A parameter for columnTypes with a maximum size. For example, ColumnType.STRINGs have a\cr
default maximum size of 50 characters, but can be set to a maximumSize of 1 to 1000\cr
characters.\cr
}
\item{maximumListLength}{optional named parameter: Required if using a columnType with a "_LIST" suffix. Describes the maximum number of\cr
values that will appear in that list. Value range 1-100 inclusive. Default 100\cr
}
\item{name}{optional named parameter: The display name of the column\cr
}
\item{enumValues}{optional named parameter: Columns type of STRING can be constrained to an enumeration values set on this list.\cr
}
\item{defaultValue}{optional named parameter: The default value for this column. Columns of type FILEHANDLEID and ENTITYID are not\cr
allowed to have default values.}

}
\value{
An object of type Column
Expand Down
80 changes: 68 additions & 12 deletions auto-man/Dataset-class.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,80 @@ Dataset
}
\format{An R6 class object.}
\description{
A Dataset is an Entity that defines a
A Dataset is an [Entity][synapseclient.entity.Entity] that defines a
flat list of entities as a tableview (a.k.a. a "dataset").

Attributes:
name: The name for the Dataset object
description: User readable description of the schema
columns: A list of [Column][synapseclient.table.Column] objects or their IDs
parent: The Synapse Project to which this Dataset belongs
properties: A map of Synapse properties
annotations: A map of user defined annotations
dataset_items: A list of items characterized by entityId and versionNumber
folder: A list of Folder IDs
local_state: Internal use only
}
\section{Methods}{
\itemize{
\item \code{Dataset(name=NULL, columns=NULL, parent=NULL, properties=NULL, addDefaultViewColumns=TRUE, addAnnotationColumns=TRUE, ignoredAnnotationColumnNames=list(), annotations=NULL, local_state=NULL, dataset_items=NULL, folders=NULL, force=FALSE, description=NULL, folder=NULL)}: Constructor for \code{\link{Dataset}}
\item \code{addColumn(column)}:
\item \code{addColumns(columns)}:
\item \code{add_folder(folder, force=TRUE)}:
\item \code{add_folders(folders, force=TRUE)}:
\item \code{add_item(dataset_item, force=TRUE)}:
\item \code{add_items(dataset_items, force=TRUE)}:
\item \code{add_scope(entities)}:
\item \code{Dataset(name=NULL, columns=NULL, parent=NULL, properties=NULL, addDefaultViewColumns=TRUE, addAnnotationColumns=TRUE, ignoredAnnotationColumnNames=list(), annotations=NULL, local_state=NULL, dataset_items=NULL, folders=NULL, force=FALSE)}: Constructor for \code{\link{Dataset}}
\item \code{addColumn(column)}: Store the column\cr
\cr
Arguments:\cr
column: A column object or its ID\cr
\cr
Raises:\cr
ValueError: If the given column is not a string, integer or [Column][synapseclient.table.Column] object
\item \code{addColumns(columns)}: Add columns\cr
\cr
Arguments:\cr
columns: A list of column objects or their ID
\item \code{add_folder(folder, force=TRUE)}: Add a folder\cr
\cr
Arguments:\cr
folder: A single Synapse Folder ID\cr
force: Force add items from folder
\item \code{add_folders(folders, force=TRUE)}: Add folders\cr
\cr
Arguments:\cr
folders: A list of Synapse Folder IDs\cr
force: Force add items from folders
\item \code{add_item(dataset_item, force=TRUE)}: Add a dataset item\cr
\cr
Arguments:\cr
dataset_item: A single dataset item\cr
force: Force add item\cr
\cr
Raises:\cr
ValueError: If duplicate item is found\cr
ValueError: The item is not a DatasetItem
\item \code{add_items(dataset_items, force=TRUE)}: Add items\cr
\cr
Arguments:\cr
dataset_items: A list of dataset items\cr
force: Force add items
\item \code{add_scope(entities)}: Add scope\cr
\cr
Arguments:\cr
entities: A [Project][synapseclient.entity.Project], [Folder][synapseclient.entity.Folder],\cr
[Evaluation][synapseclient.evaluation.Evaluation] object or its ID, can also be a list of them
\item \code{empty()}:
\item \code{has_columns()}: Does this schema have columns specified?
\item \code{has_item(item_id)}:
\item \code{removeColumn(column)}:
\item \code{remove_item(item_id)}:
\item \code{has_item(item_id)}: Check if has dataset item\cr
\cr
Arguments:\cr
item_id: A single dataset item Synapse ID
\item \code{removeColumn(column)}: Remove column\cr
\cr
Arguments:\cr
column: A column object or its ID\cr
\cr
Raises:\cr
ValueError: If the given column is not a string, integer or [Column][synapseclient.table.Column] object
\item \code{remove_item(item_id)}: Remove item\cr
\cr
Arguments:\cr
item_id: A single dataset item Synapse ID
}
}

Loading

0 comments on commit 83e45d1

Please sign in to comment.