Coder Social home page Coder Social logo

r2gscf's Introduction

R2GSCF

An R client to connect to GSCF.

How to install

Download the package file from github: https://github.com/thomaskelder/R2GSCF/blob/master/GSCFClient_latest.tar.gz

And install it in R:

install.packages('/path/to/GSCFClient_1.0.tar.gz', repo=NULL)

How to use

Below is a simple manual on how to use this R client. For a more complete example, please see this script.

Load the R client package:

library(GSCFClient)

Or. if you prefer to load the library without installing, you can also run it directly from source:

library(devtools)
source_url("https://raw.github.com/PhenotypeFoundation/GSCF-RClient/master/dbnp.functions.R")

Specify to which instance of GSCF you wish to connect:

setGscfBaseUrl("http://old.studies.dbnp.org/api/")

Specify your authentication information and login to GSCF. You can lookup your shared key on the GSCF website, under user -> profile. Do not forget to ask an admin to give you ROLE_CLIENT privileges.

user = "yourUsername"
pass = "yourPass"
skey = "yourSharedKey"
authenticate(user, pass, skey)

Now you can call the GSCF API functions in your R script, e.g.:

## Get available studies
studies = getStudies()

## Look for the NuGO PPS2 study
study = studies[[grep("PPS2", sapply(studies, function(x) x$title))]]
studyToken = study['token']

## Get the subject information for the study
subjects = getSubjectsForStudy(studyToken)

## Get some assay data for the study
assays = getAssaysForStudy(studyToken)
assayNames = sapply(assays, function(x) x$name)
samAssay = names(assayNames[grep("chemistry", assayNames)])
samData = assayDataAsMatrix(samAssay)

print(samData$data[1:3,c("sampleToken", "measurement", "value")])
## This will give:
##                           sampleToken measurement value
## 1 a9756533-108c-43d4-b1e0-d82d6a7d0781 adiponectin  8.64
## 2 a9756533-108c-43d4-b1e0-d82d6a7d0781 Cholesterol 3.182
## 3 8ac44d05-8203-4171-85f4-f81e78399d6a Cholesterol  4.49

r2gscf's People

Contributors

thomaskelder avatar keesvanbochove avatar

Watchers

James Cloos avatar Jordy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.