Skip to content

Instantly share code, notes, and snippets.

@thomaskelder
Last active December 21, 2015 18:58
Show Gist options
  • Select an option

  • Save thomaskelder/6350586 to your computer and use it in GitHub Desktop.

Select an option

Save thomaskelder/6350586 to your computer and use it in GitHub Desktop.
## Test script to get NutriTech data from dbNP
## Crashes with:
## > source('~/projects/nutritech/code/dbnp.test.R')
## Clinical Chemistry
## Questionnaire Physical Activity
## Error in x$name : $ operator is invalid for atomic vectors
require(GSCFClient)
require(GSCFRUtils)
## Fill out your own dbNP user / pass here
user = "XXXX"
pass = "****"
token = "YYYY"
authenticate(user, pass, token)
studies = getStudies()
studyName = "NutriTechHIS"
study = studies[[grep(studyName, sapply(studies, function(x) x$code))]]
studyToken = study['token']
studyAssays = namedListToDataFrame(getAssaysForStudy(studyToken),"name")
assayData = list()
for(assayName in names(studyAssays)) {
message(assayName)
assayToken = studyAssays[[assayName]][2]
assayData[[assayName]] = assayDataAsMatrix(assayToken)$data
}
subjects = getSubjectsForStudy(studyToken)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment