[[TracNav(xQTL)]] = [wiki:xQTL xQTL workbench] - Cheat sheet for R scripting = Start off by connecting R to your application database. Click '''R api''' in the top right corner and copy-paste the content into an R terminal. The R API is usually available under !http://{myhost}/{myapplication}/api/R/. You can now use the following commands: == > Downloading == === Annotations, all attributes === `find.marker()`[[BR]] `find.individual()`[[BR]] `find.investigation()` === Annotations, specific attributes === `find.marker()[,c("name")]`[[BR]] `find.individual()[,c("name","investigation_name")]`[[BR]] `find.investigation()[,c("id","name")]` === Overview of data matrices === `find.data()[,c("id","name","investigation","investigation_name")]` === Data matrix values === `dataId <- 0`[[BR]] `data <- downloadmatrixascsvCURL(dataId)` == > Uploading == === Annotations === `invId <- 0`[[BR]] `add.individual(name="testIndv", investigation_id=invId)`[[BR]] `add.marker(name="testMarker2", cm="11.3", bpstart="456237", investigation_id=invId)` === New data matrix, plus annotations === `invId <- 0`[[BR]] `data <- NULL`[[BR]] `data <- rbind(data, c("A", "B"))`[[BR]] `data <- rbind(data, c("B", "A"))`[[BR]] `marker1 = add.marker(name="myMarker1", cm="10.0", investigation_id=invId)`[[BR]] `marker2 = add.marker(name="myMarker2", cm="20.0", investigation_id=invId)`[[BR]] `ind1 = add.individual(name="myInd1", investigation_id=invId)`[[BR]] `ind2 = add.individual(name="myInd2", investigation_id=invId)`[[BR]] `colnames(data) <- c("myInd1", "myInd2")`[[BR]] `rownames(data) <- c("myMarker1", "myMarker2")`[[BR]] `add.datamatrix(data, name="myResults", investigation_id=invId, rowtype="Marker", coltype="Individual", valuetype="Text")` === File === `uri <- paste(serverpath,"/uploadfile",sep="")`[[BR]] `postForm(uri,`[[BR]] ` name = "celegan.jpg",`[[BR]] ` Investigation_name = "Studie9_10",`[[BR]] ` type = "InvestigationFile",`[[BR]] ` file = fileUpload(filename = "~/celegan.jpg"),`[[BR]] ` style = "HTTPPOST"`[[BR]] `)` == > Automized xQTL analysis == === Get a parameter from server === `size <- getparameter("size",jobparams)` === Do a status update === `report(2,"Loading 5%...")`