From 26a6592dab535ce9574ea5ab70f6daa68c2484a9 Mon Sep 17 00:00:00 2001
From: thomasyu888 Docker
Bruce Hoff
- 2023-02-01
+ 2023-09-09
Source: vignettes/docker.Rmd
docker.Rmd
Manage Synapse Credentials
KimYen
Ladia
- 2023-02-01
+ 2023-09-09
Source: vignettes/manageSynapseCredentials.Rmd
manageSynapseCredentials.Rmd
Synapse R Client Overview
Bruce Hoff
- 2023-02-01
+ 2023-09-09
Source: vignettes/synapser.Rmd
synapser.Rmd
Accessing DataView the entity’s metadata in the R console:
print(fileEntity)
-## File(parentId='syn51038312', path='/var/folders/zl/j6z0kpys2gl7pwc1x63w0gwr001lqt/T/RtmpG52o0s/file156f930cb36ad', name='file156f930cb36ad', files=['file156f930cb36ad'], cacheDir='/var/folders/zl/j6z0kpys2gl7pwc1x63w0gwr001lqt/T/RtmpG52o0s', etag='c22c30c1-ccb7-493b-a665-e5edeefa6fe1', concreteType='org.sagebionetworks.repo.model.FileEntity', createdOn='2023-02-02T02:15:24.818Z', dataFileHandleId='121216962', versionNumber=1, createdBy='3324230', modifiedOn='2023-02-02T02:15:24.974Z', modifiedBy='3324230', versionLabel='1', _file_handle={'id': '121216962', 'etag': 'db05364c-205e-460f-a79c-a679ca016da6', 'createdBy': '3324230', 'createdOn': '2023-02-02T02:15:25.000Z', 'modifiedOn': '2023-02-02T02:15:25.000Z', 'concreteType': 'org.sagebionetworks.repo.model.file.S3FileHandle', 'contentType': 'application/octet-stream', 'contentMd5': '8465d33d9f407ef250ce519e92f300fb', 'fileName': 'file156f930cb36ad', 'storageLocationId': 1, 'contentSize': 23, 'status': 'AVAILABLE', 'bucketName': 'proddata.sagebase.org', 'key': '3324230/1c78e027-8a1a-49fc-832e-b927417b9e1f/file156f930cb36ad', 'isPreview': False, 'externalURL': None}, isLatestVersion=True, id='syn51038314', synapseStore=True)
This is one simple way to read in a small matrix (we load just the first few rows):
@@ -286,7 +286,7 @@Organizing Data in a Project## [1] "Data" ## ## [[1]]$id -## [1] "syn51038316" +## [1] "syn52417541" ## ## [[1]]$type ## [1] "org.sagebionetworks.repo.model.Folder" @@ -301,13 +301,13 @@
Organizing Data in a Project## [1] TRUE ## ## [[1]]$benefactorId -## [1] 51038312 +## [1] 52417539 ## ## [[1]]$createdOn -## [1] "2023-02-02T02:15:25.912Z" +## [1] "2023-09-10T05:47:57.793Z" ## ## [[1]]$modifiedOn -## [1] "2023-02-02T02:15:26.070Z" +## [1] "2023-09-10T05:47:57.958Z" ## ## [[1]]$createdBy ## [1] "3324230" @@ -318,10 +318,10 @@
Organizing Data in a Project## ## [[2]] ## [[2]]$name -## [1] "file156f930cb36ad" +## [1] "filec7f2483a1da5" ## ## [[2]]$id -## [1] "syn51038314" +## [1] "syn52417540" ## ## [[2]]$type ## [1] "org.sagebionetworks.repo.model.FileEntity" @@ -336,13 +336,13 @@
Organizing Data in a Project## [1] TRUE ## ## [[2]]$benefactorId -## [1] 51038312 +## [1] 52417539 ## ## [[2]]$createdOn -## [1] "2023-02-02T02:15:24.818Z" +## [1] "2023-09-10T05:47:56.272Z" ## ## [[2]]$modifiedOn -## [1] "2023-02-02T02:15:24.974Z" +## [1] "2023-09-10T05:47:56.465Z" ## ## [[2]]$createdBy ## [1] "3324230" @@ -358,7 +358,7 @@
Organizing Data in a Project## [1] "Data" ## ## [[1]]$id -## [1] "syn51038316" +## [1] "syn52417541" ## ## [[1]]$type ## [1] "org.sagebionetworks.repo.model.Folder" @@ -373,13 +373,13 @@
Organizing Data in a Project## [1] TRUE ## ## [[1]]$benefactorId -## [1] 51038312 +## [1] 52417539 ## ## [[1]]$createdOn -## [1] "2023-02-02T02:15:25.912Z" +## [1] "2023-09-10T05:47:57.793Z" ## ## [[1]]$modifiedOn -## [1] "2023-02-02T02:15:26.070Z" +## [1] "2023-09-10T05:47:57.958Z" ## ## [[1]]$createdBy ## [1] "3324230" @@ -390,10 +390,10 @@
Organizing Data in a Project## ## [[2]] ## [[2]]$name -## [1] "file156f930cb36ad" +## [1] "filec7f2483a1da5" ## ## [[2]]$id -## [1] "syn51038314" +## [1] "syn52417540" ## ## [[2]]$type ## [1] "org.sagebionetworks.repo.model.FileEntity" @@ -408,13 +408,13 @@
Organizing Data in a Project## [1] TRUE ## ## [[2]]$benefactorId -## [1] 51038312 +## [1] 52417539 ## ## [[2]]$createdOn -## [1] "2023-02-02T02:15:24.818Z" +## [1] "2023-09-10T05:47:56.272Z" ## ## [[2]]$modifiedOn -## [1] "2023-02-02T02:15:24.974Z" +## [1] "2023-09-10T05:47:56.465Z" ## ## [[2]]$createdBy ## [1] "3324230" @@ -437,7 +437,7 @@
Organizing Data in a Project## [1] "Data" ## ## $id -## [1] "syn51038316" +## [1] "syn52417541" ## ## $type ## [1] "org.sagebionetworks.repo.model.Folder" @@ -452,13 +452,13 @@
Organizing Data in a Project## [1] TRUE ## ## $benefactorId -## [1] 51038312 +## [1] 52417539 ## ## $createdOn -## [1] "2023-02-02T02:15:25.912Z" +## [1] "2023-09-10T05:47:57.793Z" ## ## $modifiedOn -## [1] "2023-02-02T02:15:26.070Z" +## [1] "2023-09-10T05:47:57.958Z" ## ## $createdBy ## [1] "3324230" @@ -467,10 +467,10 @@
Organizing Data in a Project## [1] "3324230" ## ## $name -## [1] "file156f930cb36ad" +## [1] "filec7f2483a1da5" ## ## $id -## [1] "syn51038314" +## [1] "syn52417540" ## ## $type ## [1] "org.sagebionetworks.repo.model.FileEntity" @@ -485,13 +485,13 @@
Organizing Data in a Project## [1] TRUE ## ## $benefactorId -## [1] 51038312 +## [1] 52417539 ## ## $createdOn -## [1] "2023-02-02T02:15:24.818Z" +## [1] "2023-09-10T05:47:56.272Z" ## ## $modifiedOn -## [1] "2023-02-02T02:15:24.974Z" +## [1] "2023-09-10T05:47:56.465Z" ## ## $createdBy ## [1] "3324230" @@ -524,7 +524,7 @@
Organizing Data in a Project= TRUE ) ## Retrieving a deleted folder causes: Error in value[[3L]](cond): 404 Client Error: -## Entity syn51038316 is in trash can.
In addition to simple data storage, Synapse entities can be annotated with key/value metadata, described in markdown documents (wikis), and linked together in provenance graphs to create a reproducible record of @@ -574,91 +574,6 @@
The core of the Synapser library is the python client. Reticulate is used to -translate R to Python and back.
-These are the documented conversions from R to Python: Reticulate -Type Conversions
-NA
values in R do not have a direct equivalent in
-Python. This has been a topic of great discussion. Synapser is not
-trying to solve this. NA
values in R are handled by
-Reticulate per the implementation defined in Reticulate.
When working with R and Reticulate, NA values in types tables are -converted by Reticulate depending on the data type.
-For numeric data types, NA values are converted to the corresponding
-R value NA_real_
. For integer data types, NA values are
-converted to NA_integer_
. For logical data types, NA values
-are converted to NA_logical_
. For character data types, NA
-values are converted to NA_character_
.
In addition, Reticulate also converts any values that cannot be
-coerced to the specified data type to NA_character_
.
Reticulate performs these conversions automatically.
-When Reticulate converts R objects to Python objects, the NA values
-in R types tables are converted to Python’s None
.
R’s NA
is a logical constant of length 1 which is used
-to represent the absence of a value. In Python, the equivalent of
-NA
is None
, which is a special constant used
-to indicate the absence of a value.
Reticulate automatically converts NA
values in R types
-tables to None
when converting R objects to Python. This
-ensures that the data types and values remain consistent between the two
-languages.
Examples:
-NA
s to Python
-True
, which convert back to TRUE
in R
-na_logical = NA
-class(na_logical)
-## [1] "logical"
-na_py <- reticulate::r_to_py(na_logical)
-na_py
-## True
-na_r <- reticulate::py_to_r(na_py)
-na_r
-## [1] TRUE
-na_logical = c(T, F, NA)
-class(na_logical)
-## [1] "logical"
-na_py <- reticulate::r_to_py(na_logical)
-na_py
-## [True, False, True]
-na_r <- reticulate::py_to_r(na_py)
-na_r
-## [1] TRUE FALSE TRUE
NA
s to Python strings,
-which convert back to characters in R
-na_char = c("T", "F", NA)
-class(na_char)
-## [1] "character"
-na_py <- reticulate::r_to_py(na_char)
-na_py
-## ['T', 'F', 'NA']
-na_r <- reticulate::py_to_r(na_py)
-na_r
-## [1] "T" "F" "NA"
NA
s to Python
-np.nan
, which convert back to NA
in RSynapse provides tools for tracking ‘provenance’, or the @@ -672,7 +587,7 @@
+diff --git a/docs/news/index.html b/docs/news/index.html index 69138517..93b59ff6 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@act <- Activity( name = "clustering", description = "whizzy clustering", @@ -682,18 +597,18 @@
Creating an activity object:
+act <- Activity(name = "clustering", description = "whizzy clustering") act$used(c("syn12345", "syn12346")) act$executed("syn4567")
The used and executed can reference entities in Synapse or URLs.
Entity examples:
-@@ -205,29 +205,29 @@+act$used("syn12345") act$used(project) act$used(target = "syn12345", targetVersion = 2)
URL examples:
-++@@ -703,7 +618,7 @@act$used("http://mydomain.com/my/awesome/data.RData") act$used(url = "http://mydomain.com/my/awesome/data.RData", name = "Awesome Data") act$used(url = "https://github.com/joe_hacker/code_repo", name = "Gnarly hacks", wasExecuted = TRUE)
Storing entities with provenance
The activity can be passed in when storing an Entity to set the Entity’s provenance:
-@@ -174,7 +174,7 @@+We’ve now recorded that ‘project’ is the output of syn4567 applied to @@ -715,14 +630,14 @@
Recording data sourceThe synStore() has shortcuts for specifying the used and executed lists directly. For example, when storing a data entity, it’s a good idea to record its source: -
+project <- synStore( project, activityName = "data-r-us", activityDescription = "downloaded from data-r-us", used = "http://data-r-us.com/excellent/data.xyz")
For more information:
-@@ -741,7 +656,7 @@+?Activity ?synDeleteProvenance
Wikis folder, file, etc). Text and graphics can be composed in markdown and rendered in the web view of the object.
Creating a Wiki
-+project <- synGet(project$properties$id) content <- " # My Wiki Page @@ -760,7 +675,7 @@
Wikis attachments = list(filePath)) wiki <- synStore(wiki)
Updating a Wiki
-+## <synapseclient.table.CsvFileTable object at 0x115009390>+project <- synGet(project$properties$id) wiki <- synGetWiki(project) wiki.markdown <- " @@ -772,7 +687,7 @@
Wikis wiki <- synStore(wiki)
For more information:
-@@ -783,7 +698,7 @@+?Wiki ?synGetWiki
Evaluations
+eval <- Evaluation( name = sprintf("My unique evaluation created on %s", format(Sys.time(), "%a %b %d %H%M%OS4 %Y")), description = "testing", @@ -792,22 +707,22 @@
Evaluations= "This evaluation only accepts files.") eval <- synStore(eval)
Retrieving the created Evaluation:
-@@ -246,7 +246,7 @@+eval <- synGetEvaluation(eval$id) eval ## { -## "contentSource": "syn51038321", -## "createdOn": "2023-02-02T02:15:38.350Z", +## "contentSource": "syn52417544", +## "createdOn": "2023-09-10T05:48:12.566Z", ## "description": "testing", -## "etag": "ba59943c-7633-41b0-b1c7-cf395a2d2690", -## "id": "9615299", -## "name": "My unique evaluation created on Wed Feb 01 181538.1668 2023", +## "etag": "1da8272d-5b79-4e7b-930d-457d33e5bc25", +## "id": "9615411", +## "name": "My unique evaluation created on Sat Sep 09 224812.3255 2023", ## "ownerId": "3324230", ## "submissionInstructionsMessage": "This evaluation only accepts files.", ## "submissionReceiptMessage": "Thank you for your submission!" ## }
Submitting a file to an existing Evaluation:
-@@ -103,7 +103,7 @@+# first create a file to submit filePath <- tempfile() connection <- file(filePath) @@ -818,7 +733,7 @@
Evaluations# submit the created file submission <- synSubmit(eval, file)
List submissions:
-@@ -103,7 +103,7 @@+submissions <- synGetSubmissionBundles(eval) as.list(submissions) ## [[1]] @@ -826,60 +741,60 @@
Evaluations## { ## "contributors": [ ## { -## "createdOn": "2023-02-02T02:15:40.563Z", +## "createdOn": "2023-09-10T05:48:15.051Z", ## "principalId": "3324230" ## } ## ], -## "createdOn": "2023-02-02T02:15:40.563Z", -## "entityBundleJSON": "{\"entity\":{\"name\":\"file156f93dd15047\",\"id\":\"syn51038326\",\"etag\":\"144a593a-46fa-4cf9-80e7-a9eb272b462f\",\"createdOn\":\"2023-02-02T02:15:40.020Z\",\"modifiedOn\":\"2023-02-02T02:15:40.169Z\",\"createdBy\":\"3324230\",\"modifiedBy\":\"3324230\",\"parentId\":\"syn51038321\",\"concreteType\":\"org.sagebionetworks.repo.model.FileEntity\",\"versionNumber\":1,\"versionLabel\":\"1\",\"isLatestVersion\":true,\"dataFileHandleId\":\"121216980\"},\"entityType\":\"file\",\"annotations\":{\"id\":\"syn51038326\",\"etag\":\"00000000-0000-0000-0000-000000000000\",\"annotations\":{}},\"fileHandles\":[{\"id\":\"121216980\",\"etag\":\"ed105c86-869d-4acf-a84c-2adadb1d15b4\",\"createdBy\":\"3324230\",\"createdOn\":\"2023-02-02T02:15:40.000Z\",\"modifiedOn\":\"2023-02-02T02:15:40.000Z\",\"concreteType\":\"org.sagebionetworks.repo.model.file.S3FileHandle\",\"contentType\":\"application/octet-stream\",\"contentMd5\":\"3f466b7f85d184292a68cea1c4f7cfc2\",\"fileName\":\"file156f93dd15047\",\"storageLocationId\":1,\"contentSize\":27,\"status\":\"AVAILABLE\",\"bucketName\":\"proddata.sagebase.org\",\"key\":\"3324230/3e54a923-1a7a-426f-b298-40fd6b05fd5a/file156f93dd15047\",\"isPreview\":false}]}", -## "entityId": "syn51038326", -## "evaluationId": "9615299", -## "id": "9731868", -## "name": "file156f93dd15047", +## "createdOn": "2023-09-10T05:48:15.051Z", +## "entityBundleJSON": "{\"entity\":{\"name\":\"filec7f27aac4a73\",\"id\":\"syn52417545\",\"etag\":\"71bc491e-27d6-46be-b8be-9fbe54d58147\",\"createdOn\":\"2023-09-10T05:48:14.427Z\",\"modifiedOn\":\"2023-09-10T05:48:14.608Z\",\"createdBy\":\"3324230\",\"modifiedBy\":\"3324230\",\"parentId\":\"syn52417544\",\"concreteType\":\"org.sagebionetworks.repo.model.FileEntity\",\"versionNumber\":1,\"versionLabel\":\"1\",\"isLatestVersion\":true,\"dataFileHandleId\":\"128471088\"},\"entityType\":\"file\",\"annotations\":{\"id\":\"syn52417545\",\"etag\":\"00000000-0000-0000-0000-000000000000\",\"annotations\":{}},\"fileHandles\":[{\"id\":\"128471088\",\"etag\":\"6cfb8c95-5ea1-45b8-876d-5706031f82a2\",\"createdBy\":\"3324230\",\"createdOn\":\"2023-09-10T05:48:14.000Z\",\"modifiedOn\":\"2023-09-10T05:48:14.000Z\",\"concreteType\":\"org.sagebionetworks.repo.model.file.S3FileHandle\",\"contentType\":\"application/octet-stream\",\"contentMd5\":\"3f466b7f85d184292a68cea1c4f7cfc2\",\"fileName\":\"filec7f27aac4a73\",\"storageLocationId\":1,\"contentSize\":27,\"status\":\"AVAILABLE\",\"bucketName\":\"proddata.sagebase.org\",\"key\":\"3324230/4463b495-99fe-4e36-be89-c93ac80f7536/filec7f27aac4a73\",\"isPreview\":false}]}", +## "entityId": "syn52417545", +## "evaluationId": "9615411", +## "id": "9740522", +## "name": "filec7f27aac4a73", ## "userId": "3324230", ## "versionNumber": 1 ## } ## ## [[1]][[2]] ## { -## "entityId": "syn51038326", -## "etag": "0df85dea-16a7-41f1-8402-3ba8fc5df2d6", -## "id": "9731868", -## "modifiedOn": "2023-02-02T02:15:40.563Z", +## "entityId": "syn52417545", +## "etag": "afcbbcc4-c338-47bd-b8b9-60ba6de89ae8", +## "id": "9740522", +## "modifiedOn": "2023-09-10T05:48:15.051Z", ## "status": "RECEIVED", ## "statusVersion": 0, ## "submissionAnnotations": {}, ## "versionNumber": 1 ## }
Retrieving submission by id:
-diff --git a/docs/articles/upload.html b/docs/articles/upload.html index 2405c00f..8892254a 100644 --- a/docs/articles/upload.html +++ b/docs/articles/upload.html @@ -33,7 +33,7 @@+# Not evaluating this section because of SYNPY-235 submission <- synGetSubmission(submission$id) submission
Retrieving the submission status:
-+submissionStatus <- synGetSubmissionStatus(submission) submissionStatus ## { -## "entityId": "syn51038326", -## "etag": "0df85dea-16a7-41f1-8402-3ba8fc5df2d6", -## "id": "9731868", -## "modifiedOn": "2023-02-02T02:15:40.563Z", +## "entityId": "syn52417545", +## "etag": "afcbbcc4-c338-47bd-b8b9-60ba6de89ae8", +## "id": "9740522", +## "modifiedOn": "2023-09-10T05:48:15.051Z", ## "status": "RECEIVED", ## "statusVersion": 0, ## "submissionAnnotations": {}, ## "versionNumber": 1 ## }
To view the annotations:
-++submissionStatus$submissionAnnotations ## {}
To update an annotation:
-@@ -103,7 +103,7 @@+Query an evaluation:
-diff --git a/docs/articles/troubleshooting.html b/docs/articles/troubleshooting.html index 7409bc0e..a00185eb 100644 --- a/docs/articles/troubleshooting.html +++ b/docs/articles/troubleshooting.html @@ -33,7 +33,7 @@+queryString <- sprintf("query=select * from evaluation_%s LIMIT %s OFFSET %s'", eval$id, 10, 0) synRestGET(paste("/evaluation/submission/query?", URLencode(queryString), sep = "")) ## $headers @@ -892,7 +807,7 @@
Evaluations## [1] 0
To learn more about writing an evaluation query, please see: http://docs.synapse.org/rest/GET/evaluation/submission/query.html
For more information, please see:
-+?synGetEvaluation ?synSubmit ?synGetSubmissionBundles @@ -906,48 +821,48 @@
Sharing Access to Content
Retrieve the sharing setting on an entity:
-+synGetPermissions(project, principalId = 273950) ## list()
The first time an entity is shared, an ACL object is created for that entity. Let’s make project public:
-++## [1] "READ"acl <- synSetPermissions(project, principalId = 273949, accessType = list("READ")) acl ## $id -## [1] "syn51038321" +## [1] "syn52417544" ## ## $creationDate -## [1] "2023-02-02T02:15:31.181Z" +## [1] "2023-09-10T05:48:04.799Z" ## ## $etag -## [1] "45bf1411-d081-4b88-a89c-7378d27f7ca7" +## [1] "683b80f2-d8e1-4d08-b0e3-3363b1bc1eec" ## ## $resourceAccess ## $resourceAccess[[1]] ## $resourceAccess[[1]]$principalId -## [1] 273949 +## [1] 3324230 ## ## $resourceAccess[[1]]$accessType -## [1] "READ" +## [1] "CREATE" "UPDATE" "MODERATE" +## [4] "CHANGE_PERMISSIONS" "DOWNLOAD" "DELETE" +## [7] "CHANGE_SETTINGS" "READ" ## ## ## $resourceAccess[[2]] ## $resourceAccess[[2]]$principalId -## [1] 3324230 +## [1] 273949 ## ## $resourceAccess[[2]]$accessType -## [1] "DELETE" "CHANGE_PERMISSIONS" "CREATE" -## [4] "MODERATE" "UPDATE" "DOWNLOAD" -## [7] "CHANGE_SETTINGS" "READ"
Now public can read:
-+-synGetPermissions(project, principalId = 273950) ## list()
+-?synGetPermissions ?synSetPermissions
@@ -962,7 +877,7 @@+synDelete(project) ## NULL
Accessing the API Directly
These methods enable access to the Synapse REST(ish) API taking care of details like endpoints and authentication. See the REST API documentation.
-@@ -102,7 +102,7 @@+@@ -103,7 +103,7 @@?synRestGET ?synRestPOST ?synRestPUT diff --git a/docs/articles/systemDependencies.html b/docs/articles/systemDependencies.html index 2a199d33..f1cda30f 100644 --- a/docs/articles/systemDependencies.html +++ b/docs/articles/systemDependencies.html @@ -33,7 +33,7 @@
System Dependencies
KimYen Ladia
-2023-02-01
+2023-09-09
Source:vignettes/systemDependencies.Rmd
diff --git a/docs/articles/tables.html b/docs/articles/tables.html index a69b933d..75f96292 100644 --- a/docs/articles/tables.html +++ b/docs/articles/tables.html @@ -33,7 +33,7 @@systemDependencies.Rmd
Tables
Bruce Hoff
-2023-02-01
+2023-09-09
Source:vignettes/tables.Rmd
@@ -154,7 +154,7 @@tables.Rmd
Tables
+## Schema(name='My Favorite Genes', parentId='syn52417546', columnIds=[], concreteType='org.sagebionetworks.repo.model.table.TableEntity', columns_to_store=[{'name': 'Name', 'columnType': 'STRING', 'maximumSize': 30, 'defaultValue': '', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Chromosome', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Start', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'End', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Strand', 'columnType': 'STRING', 'maximumSize': 30, 'defaultValue': '', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'TranscriptionFactor', 'columnType': 'BOOLEAN', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Time', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}])table <- synBuildTable("My Favorite Genes", project, genes) table$schema -## Schema(concreteType='org.sagebionetworks.repo.model.table.TableEntity', columnIds=[], columns_to_store=[{'name': 'Name', 'columnType': 'STRING', 'maximumSize': 30, 'defaultValue': '', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Chromosome', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Start', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'End', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Strand', 'columnType': 'STRING', 'maximumSize': 30, 'defaultValue': '', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'TranscriptionFactor', 'columnType': 'BOOLEAN', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}, {'name': 'Time', 'columnType': 'INTEGER', 'concreteType': 'org.sagebionetworks.repo.model.table.ColumnModel'}], parentId='syn51038332', name='My Favorite Genes')
synBuildTable
creates a Table Schema based on the data and returns a Table object that can be stored in Synapse usingsynStore()
. To create a custom Table Schema, defines the @@ -186,7 +186,7 @@Tables
We now have a table populated with data. Let’s try to query:
+-results <- synTableQuery(sprintf("select * from %s where Chromosome='1' and Start < 41000 and End > 20000", tableId))
results <- synTableQuery(sprintf('select * from %s where Chromosome=1 and Start < 41000 and "End" > 20000', tableId))
synTableQuery()
downloads the data and saves it to a csv file at location:+## <synapseclient.table.CsvFileTable object at 0x11fef9cf0>@@ -225,7 +225,7 @@Changing Data= c(F, F), Time = as.POSIXlt(c("2070-01-12 03:53:12.169", "2018-05-03 12:03:33.464"), tz = "UTC", format = "%Y-%m-%d %H:%M:%OS")) synStore(Table(tableId, moreGenes)) -## <synapseclient.table.CsvFileTable object at 0x12babe740>
For example, let’s update the names of some of our favorite genes:
+## <synapseclient.table.CsvFileTable object at 0x11ff40d90>@@ -367,14 +367,14 @@Notes on Dates and Timesdf <- as.data.frame(results) df$Time <- as.POSIXlt("2015-07-04 05:22", tz = "UTC", format = "%Y-%m-%d %H:%M") synStore(Table(tableId, moreGenes)) -## <synapseclient.table.CsvFileTable object at 0x12bb405b0>
Dates may also be submitted in timestamp milliseconds:
+## <synapseclient.table.CsvFileTable object at 0x11fefb7f0>results <- synTableQuery(sprintf("select * from %s where Name='zap'", tableId)) df <- as.data.frame(results) df$Time <- timestamp synStore(Table(tableId, moreGenes)) -## <synapseclient.table.CsvFileTable object at 0x12bb42140>
Note that using
POSIXlt
is strongly preferred overPOSIXct
, becausePOSIXct
does not store values with enough precision to reliably recover milliseconds. For more @@ -419,7 +419,7 @@Table Attached Files# get the filehandle ids fileHandleIds <- lapply(files, function(f) f$id) newData["covers"] <- fileHandleIds -## Warning in `[<-.data.frame`(`*tmp*`, "covers", value = list("121215793", : +## Warning in `[<-.data.frame`(`*tmp*`, "covers", value = list("128470754", : ## provided 4 variables to replace 1 variables newTable <- synStore(Table(newSchema$properties$id, newData))
Troubleshooting
KimYen Ladia
-2023-02-01
+2023-09-09
Source:vignettes/troubleshooting.Rmd
@@ -152,6 +152,91 @@troubleshooting.Rmd
Using Synapser with reticulateSynapse Python client through reticulate.
+Type Conversions +
+The core of the Synapser library is the python client. Reticulate is used to +translate R to Python and back.
+These are the documented conversions from R to Python: Reticulate +Type Conversions
++
NA
values in R do not have a direct equivalent in +Python. This has been a topic of great discussion. Synapser is not +trying to solve this.NA
values in R are handled by +Reticulate per the implementation defined in Reticulate.When working with R and Reticulate, NA values in types tables are +converted by Reticulate depending on the data type.
+For numeric data types, NA values are converted to the corresponding +R value
+NA_real_
. For integer data types, NA values are +converted toNA_integer_
. For logical data types, NA values +are converted toNA_logical_
. For character data types, NA +values are converted toNA_character_
.In addition, Reticulate also converts any values that cannot be +coerced to the specified data type to
+NA_character_
.Reticulate performs these conversions automatically.
+When Reticulate converts R objects to Python objects, the NA values +in R types tables are converted to Python’s
+None
.R’s
+NA
is a logical constant of length 1 which is used +to represent the absence of a value. In Python, the equivalent of +NA
isNone
, which is a special constant used +to indicate the absence of a value.Reticulate automatically converts
+NA
values in R types +tables toNone
when converting R objects to Python. This +ensures that the data types and values remain consistent between the two +languages.Examples:
++
+- Reticulate converts logical
+NA
s to Python +True
, which convert back toTRUE
in R++na_logical = NA +class(na_logical) +## [1] "logical" +na_py <- reticulate::r_to_py(na_logical) +na_py +## True +na_r <- reticulate::py_to_r(na_py) +na_r +## [1] TRUE
++na_logical = c(T, F, NA) +class(na_logical) +## [1] "logical" +na_py <- reticulate::r_to_py(na_logical) +na_py +## [True, False, True] +na_r <- reticulate::py_to_r(na_py) +na_r +## [1] TRUE FALSE TRUE
+
+- Reticulate converts character
+NA
s to Python strings, +which convert back to characters in R++na_char = c("T", "F", NA) +class(na_char) +## [1] "character" +na_py <- reticulate::r_to_py(na_char) +na_py +## ['T', 'F', 'NA'] +na_r <- reticulate::py_to_r(na_py) +na_r +## [1] "T" "F" "NA"
+
+ +- Reticulate converts numeric
+NA
s to Python +np.nan
, which convert back toNA
in RFile Upload
KimYen Ladia
-2023-02-01
+2023-09-09
Source:vignettes/upload.Rmd
diff --git a/docs/articles/views.html b/docs/articles/views.html index f9bdd3ce..e076efa1 100644 --- a/docs/articles/views.html +++ b/docs/articles/views.html @@ -33,7 +33,7 @@upload.Rmd
Views
KimYen Ladia
-2023-02-01
+2023-09-09
Source:vignettes/views.Rmd
@@ -200,26 +200,26 @@views.Rmd
Views data <- as.data.frame(queryResults) data ## ROW_ID ROW_VERSION ROW_ETAG id -## 1 51038357 1 31ff56cb-b476-4d8d-bb74-4a14d7ace68f syn51038357 -## 2 51038358 1 56d0f16e-e8ef-4293-9eb0-ba65001f0fdc syn51038358 -## name description createdOn createdBy -## 1 file1583932d4a572 NA 2023-02-01 18:17:17 3324230 -## 2 file1583926b9f970 NA 2023-02-01 18:17:19 3324230 +## 1 52417553 1 2c0d0dde-f636-400e-b2d6-5a580f067d7b syn52417553 +## 2 52417554 1 7780b686-11cf-4710-b10d-a133dc52eb17 syn52417554 +## name description createdOn createdBy +## 1 fileca573a99ef5 NA 2023-09-09 22:50:02 3324230 +## 2 fileca577502e8b3 NA 2023-09-09 22:50:04 3324230 ## etag modifiedOn modifiedBy type -## 1 31ff56cb-b476-4d8d-bb74-4a14d7ace68f 2023-02-01 18:17:19 3324230 file -## 2 56d0f16e-e8ef-4293-9eb0-ba65001f0fdc 2023-02-01 18:17:20 3324230 file +## 1 2c0d0dde-f636-400e-b2d6-5a580f067d7b 2023-09-09 22:50:04 3324230 file +## 2 7780b686-11cf-4710-b10d-a133dc52eb17 2023-09-09 22:50:05 3324230 file ## currentVersion parentId benefactorId projectId dataFileHandleId -## 1 1 syn51038356 syn51038356 syn51038356 121217064 -## 2 1 syn51038356 syn51038356 syn51038356 121217065 +## 1 1 syn52417552 syn52417552 syn52417552 128471119 +## 2 1 syn52417552 syn52417552 syn52417552 128471120 ## dataFileSizeBytes dataFileMD5Hex ## 1 37 47dfe7f5eaa49a5413c7b79b67ab9c43 ## 2 38 ba01e01b9e3ffea3ebef95efa62998b0 ## dataFileConcreteType dataFileBucket ## 1 org.sagebionetworks.repo.model.file.S3FileHandle proddata.sagebase.org ## 2 org.sagebionetworks.repo.model.file.S3FileHandle proddata.sagebase.org -## dataFileKey contributor -## 1 3324230/094122c1-804d-4d5b-84dd-301746556a10/file1583932d4a572 Sage -## 2 3324230/600e1433-6618-43ae-8970-cfc24033608a/file1583926b9f970 UW +## dataFileKey contributor +## 1 3324230/cce86a31-47f3-43f3-b666-3d6c0be4094c/fileca573a99ef5 Sage +## 2 3324230/de3ad42c-f235-4bae-b294-0a23e91799dc/fileca577502e8b3 UW ## class rank ## 1 V NA ## 2 NA X
Updating Annotations using View
data$contributor[1] <- c("Sage Bionetworks") synStore(Table(view$properties$id, data[1,])) -## <synapseclient.table.CsvFileTable object at 0x1134a1270>
@@ -98,13 +98,13 @@Update View’s Content diff --git a/docs/authors.html b/docs/authors.html index daaac20b..d63da6f2 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@
Citation
Hoff B (2023). synapser: R Language Bindings for Synapse API. -R package version 1.0.0, https://www.synapse.org. +R package version 1.2.0, https://www.synapse.org.
@Manual{, title = {synapser: R Language Bindings for Synapse API}, author = {Bruce Hoff}, year = {2023}, - note = {R package version 1.0.0}, + note = {R package version 1.2.0}, url = {https://www.synapse.org}, }diff --git a/docs/index.html b/docs/index.html index 48844361..68b99a3b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@On Windows
python --version
@@ -185,17 +185,17 @@
Note
If it still shows the old version, you may restart your system. Or uninstall the old version from the control panel.On macOS
Both python 2x and 3x can stay installed in a MAC. Mac comes with python 2x version. To check the default python version in your MAC, open the terminal and type
-+python --version -python3 --version
If you don’t then go ahead and install it with the installer. Go the the python’s official site here.
Now restart the terminal and check again with both commands python —version
-+python3 --version
-
Or
use toinstall last version
+brew install python3 && cp /usr/local/bin/python3 /usr/local/bin/python
On Linux
Add the repository and update
-+sudo add-apt-repository ppa:deadsnakes/ppa -sudo apt-get update
Update the package list
-+apt-get update
Verify the updated Python packages list
-+apt list | grep python3.10
Install the Python 3.10 package using apt-get
-+sudo apt-get install python3.10
Add Python 3.8 & Python 3.10 to update-alternatives
-+sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 -sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
Update Python 3 for point to Python 3.10
-+sudo update-alternatives --config python3
NEWS.md
as.list()
as.list
Generate R wrappers for Python classes and functions