knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

synapserutils

The synapserutils package provides a set of utility functions, built on top of the synapser package.

Installation

synapserutils is available as a ready-built package for Microsoft Windows and Mac OSX. For Linux systems, it is available to install from source. It can be installed or upgraded using the standard install.packages() command, adding the Sage Bionetworks R Archive Network (RAN) to the repository list, e.g.:

install.packages("synapserutils", repos=c("http://ran.synapse.org", "http://cran.fhcrc.org"))

Alternatively, edit your ~/.Rprofile and configure your default repositories:

options(repos=c("http://ran.synapse.org", "http://cran.fhcrc.org"))

after which you may run install.packages without specifying the repositories:

install.packages("synapserutils")

If you have been asked to validate a release candidate, please replace the URL https://sage-bionetworks.github.io/ran with https://sage-bionetworks.github.io/staging-ran, that is:

install.packages("synapserutils", repos=c("http://staging-ran.synapse.org", "http://cran.fhcrc.org"))

Usage

To get started, try logging into Synapse. If you don't already have a Synapse account, register here:

library(synapserutils)
synLogin()

Available Utilities

Copy

Copy Entity (File, Folder, Table, Link, and Project)

The example below copies File ID syn123 to Project ID syn456:

copy("syn123", "syn456")

The first parameter in copy() can be a File ID, a Table ID, or a Link ID. The second parameter must be a Folder ID or a Project ID.

For more information on copy(), please see:

?copy

Copy Wiki and Wiki Subpage

To copy a wiki page that is associated with an Entity (Project/ File/ Folder/ Table) syn123 to another Entity syn789:

copyWiki("syn123", "syn789")

For more information on copyWiki(), please see:

?copyWiki

Batch Process

Upload Data in Bulk

syncToSynapse() takes a manifest file and uploads the files listed in the manifest file to Synapse:

syncToSynapse("/path/to/manifest.tsv")

The manifest file format and instructions on how to create one can be found here and by:

?syncToSynapse

Download Data in Bulk

To recursively download all files within a container (Folder/ Project) syn123:

syncFromSynapse("syn123")

More information on downloading data in bulk is available here and by:

?syncFromSynapse

Other Utilites

To recursively getting Entity (File/ Folder/ Table/ Link/ Project) metadata from a container (Folder/ Project):

walk("syn123")

For more information about walk(), please see:

?walk


Sage-Bionetworks/synapserutils documentation built on Feb. 12, 2024, 10:31 a.m.