R Client Bootstrap

R Client Bootstrap

R Client Development

Install the R Client

  1. Follow the instructions to install the current production version of the R client, this will automatically install most dependencies 

  2. Install any additional required dependences, from the R prompt

    • install.packages(c("RUnit","rJava"))

  3. Install the developer tools needed for R Developer Tools#R

  4. Make sure your maven settings file is pointing to the 64bit version of R

    • Mac OSX

      <properties> <local.r.path>/usr/bin/r</local.r.path> ... </properties>
    • Windows

      <properties> <local.r.path>C:\Program Files\R\R-2.13.0\bin\x64\R.exe</local.r.path> ... </properties>
  5. You now need to checkout and build the entire Synapse code tree since the R client now depends upon the Java client, Get the Maven Build working

  6. Build the Sage Bionetworks R package, from the shell

    • Rcmd INSTALL rSynapseClient

  7. If you see a loading error for rJava, include $JAVA_HOME$/jre/bin/server in your PATH.

  8. Now you are ready to use it, from the R prompt

    • library (synapseClient)

Note that every time you change the Java Synapse Client and want to pick up those changes in the R client, you'll need to do an mvn install in each.

How to run the R client against staging

synSetEndpoints('https://repo-staging.prod.sagebase.org/repo/v1', 'https://auth-staging.prod.sagebase.org/auth/v1', 'https://file-staging.prod.sagebase.org/file/v1', 'https://staging.synapse.org/')

 

How to run the R unit tests

How to run the installed R unit tests

> synapseAuthServiceEndpoint("https://auth-staging.sagebase.org/auth/v1") > synapseRepoServiceEndpoint("https://repo-staging.sagebase.org/repo/v1") > synapseClient:::.test() RUNIT TEST PROTOCOL -- Wed May 25 15:24:15 2011 *********************************************** Number of test functions: 1 Number of errors: 0 Number of failures: 0 1 Test Suite : synapseClient RUnit Tests - 1 test function, 0 errors, 0 failures Number of test functions: 1 Number of errors: 0 Number of failures: 0

How to run your local copy of the R unit tests

> synapseAuthServiceEndpoint("https://auth-staging.sagebase.org/auth/v1") > synapseRepoServiceEndpoint("https://repo-staging.sagebase.org/repo/v1") > synapseClient:::.test('/Users/deflaux/platform/trunk/client/rSynapseClient/inst/unitTests') Error: object '*tmp*' not found Timing stopped at: 0 0 0 Error in func() : could not find function "synapseQuery" RUNIT TEST PROTOCOL -- Wed May 25 15:16:24 2011 *********************************************** Number of test functions: 5 Number of errors: 1 Number of failures: 0 1 Test Suite : synapseClient RUnit Tests - 5 test functions, 1 error, 0 failures ERROR in unitTestJsonCorretlyParsed: Error in func() : could not find function "synapseQuery" Test files with failing tests test_synapseQuery.R unitTestJsonCorretlyParsed Error in synapseClient:::.test("/Users/deflaux/platform/trunk/client/rSynapseClient/inst/unitTests") : unit tests failed for package synapseClient >

How to run the R integration tests

How to run the installed integration tests

> synapseAuthServiceEndpoint("https://auth-staging.sagebase.org/auth/v1") > synapseRepoServiceEndpoint("https://repo-staging.sagebase.org/repo/v1") > synapseLogin("YourUsername", "YourPassword") > synapseClient:::.integrationTest() Error: attempt to apply non-function Error: attempt to apply non-function Error: attempt to apply non-function Error: attempt to apply non-function RUNIT TEST PROTOCOL -- Wed May 25 15:25:52 2011 *********************************************** Number of test functions: 4 Number of errors: 0 Number of failures: 0 1 Test Suite : synapseClient RUnit Tests - 4 test functions, 0 errors, 0 failures Number of test functions: 4 Number of errors: 0 Number of failures: 0 >

How to run your local copy of the R integration tests

> synapseAuthServiceEndpoint("https://auth-staging.sagebase.org/auth/v1") > synapseRepoServiceEndpoint("https://repo-staging.sagebase.org/repo/v1") > synapseLogin("YourUsername", "YourPassword") > synapseClient:::.integrationTest('/Users/deflaux/platform/trunk/client/rSynapseClient/inst/integrationTests') Error: attempt to apply non-function Error: attempt to apply non-function Error in parse(n = -1, file = file) : 27:84: unexpected ')' 26: integrationTestPaging <- function() { 27: firstPagePackets <- synapseQuery('select * from dataset where limit=20 offset=1')) ^ RUNIT TEST PROTOCOL -- Wed May 25 15:27:38 2011 *********************************************** Number of test functions: 5 Number of errors: 1 Number of failures: 0 1 Test Suite : synapseClient RUnit Tests - 5 test functions, 1 error, 0 failures ERROR in /Users/deflaux/platform/trunk/client/rSynapseClient/inst/integrationTests/test_synapseQuery.R: Error while sourcing /Users/deflaux/platform/trunk/client/rSynapseClient/inst/integrationTests/test_synapseQuery.R : Error in parse(n = -1, file = file) : 27:84: unexpected ')' 26: integrationTestPaging <- function() { 27: firstPagePackets <- synapseQuery('select * from dataset where limit=20 offset=1')) ^ Test files with failing tests test_synapseQuery.R /Users/deflaux/platform/trunk/client/rSynapseClient/inst/integrationTests/test_synapseQuery.R Error in synapseClient:::.integrationTest("/Users/deflaux/platform/trunk/client/rSynapseClient/inst/integrationTests") : integration tests failed for package synapseClient >

How to run the R integration tests against your local stack

  1. Run the R unit and/or integration tests interactively. Remember to tell R to hit your local stack and use the integration test user account:

    library(synapseClient) synapseAuthServiceEndpoint(endpoint='http://localhost:8080/services-authentication-0.10-SNAPSHOT/auth/v1') synapseRepoServiceEndpoint(endpoint='http://localhost:8080/services-repository-0.10-SNAPSHOT/repo/v1') synapseLogin(username='devUser1@sagebase.org', password='password')

How to enable verbose mode

Some what verbose:

synapseClient:::.setCache("debug", TRUE)

Really, really verbose:

synapseClient:::.setCache("debug", TRUE) synapseClient:::.setCache("curlOpts", list(ssl.verifypeer = FALSE, verbose = TRUE))

How to import the project into Eclipse

  1. Install StatET: http://www.walware.de/goto/statet

  2. In Eclipse: Window > Open Perspective > Other... > StatET

  3. File > New > R-Project

  4. Type project name: "rSynapseClient"

  5. Unclick 'use default location'

  6. Enter name of folder where you checked out the project from SVN, e.g. ...\eclipse projects\trunk\SynapseClient\

  7. Click 'finish'

You will then have the project in Eclipse.