Changes between Version 1 and Version 2 of xQTLBioinformaticianScript


Ignore:
Timestamp:
2011-09-06T11:51:52+02:00 (13 years ago)
Author:
jvelde
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • xQTLBioinformaticianScript

    v1 v2  
    88* upload through file or CSV box
    99
    10 == format ==
     10== Example script ==
    1111
    12 ???
     12{{{
     13map <- getparameter("map",jobparams)
     14method <- getparameter("method",jobparams)
     15model <- getparameter("model",jobparams)
     16stepsize <- getparameter("stepsize",jobparams)
     17 
     18report(2,"LoadingCrossobject")
     19load(paste("./run",jobid,"/cross.RData",sep=""))
     20report(2,"FinishedLoading")
     21if(stepsize!=0){
     22        cross <- calc.genoprob(cross, step=stepsize)
     23        report(2,"FinishedMarkerImputation")
     24}
     25 
     26report(2,"Starting%20QTL")
     27if(map=="scanone"){
     28        results <- scanone(cross,pheno.col=item,method=method,model=model,verbose=TRUE)
     29}else{
     30        results <- mqmscan(cross,pheno.col=item,verbose=TRUE)
     31}
     32 
     33report(2,"Starting%20QTL%20profile%20plot")
     34imagefilename <- paste("P",jobid,"_",item,".fig",sep="")
     35xfig(file = imagefilename)
     36plot(results)
     37dev.off()
     38
     39report(2,"PlotInTemp.fig")
     40postForm(paste(dbpath,"/uploadfile",sep=""),investigation_name=investigationname, name=imagefilename, type='InvestigationFile', file=fileUpload(filename=imagefilename), style='HTTPPOST')
     41
     42report(2,"UploadedFIGtoDatabase")
     43
     44ResultsToMolgenis(result=results,resultname=outname, Trait_num=(item-1),investigationname=investigationname)
     45report(3,"Job%20Finished")
     46}}}
     47
     48
     49=== Adding new / additional analysis (R scripts) ===
     50
     51New R scripts can be easily added as a new analysis. To get started, take a look at Add new R script. This shows the basic example (template) of such a script. This is a most minimal job.
     52
     53The script is written in R, but the execution of your code does not happen here. Instead, it will produce a file that is ran by the job execution framework.
     54
     55=== Structure of the user function ===
     56All options defined in the parameter set and dataset configuration screens are passed to the custom script. From then on, you are in controll and can do what you want. Parameters can be retrieved by using:
     57
     58{{{
     59message <- getparameter("message",jobparams)
     60}}}
     61
     62The user supplied data and parameter sets are not the only parameters passed to the userscript.
     63The most important one is the myanalysisfile in which code need to be generated specific for the subjob and item
     64
     65{{{
     66dbpath - database URL
     67subjob - Which subjob are we
     68item - whihc item does this job need to do
     69jobid - which analysis run do we belong to
     70outname - output name for file or database
     71jobparams - User supplied parameters
     72investigationname - Not used yet, but will be when we have multiple instances running
     73libraryloc - Location of the R libraries
     74}}}
     75
     76There is one special object you can use: a pre builded R/qtl cross. This is available when one passes a 'genotype' and a 'phenotype' matrix to a certain analysis.
     77
     78{{{
     79load(paste("./run",jobid,"/cross.RData"),"\n",sep="");
     80}}}
     81
     82We can thus use R as an high level esperanto language. This enables us to execute for example Beagle or Plink one
     83could create a statement like:
     84
     85{{{
     86shell.exec("plink -job=", paste("myjob"+item));
     87shell.exec("beagle -job=", paste("myjob"+item));
     88}}}
     89
     90=== Points of attention ===
     91
     92The progression of the job should be reported to the database. Use 'report' to do this, this reports a statuscode and a short text describing what happened to the subjob:
     93
     94{{{
     95report(3,\"JobFinished\")
     96}}}
     97
     98Data produced during your custom analysis can be written back directly to the database, please look at some existing scripts to see how this is done.
     99However we recommend using XGAP standard functions like: {{{find.<your_xgap_datatype>}}} or {{{add.<your_xgap_datatype>}}}