Changes between Version 8 and Version 9 of Modules/Compute/UsingRscripts


Ignore:
Timestamp:
2011-02-24T18:43:48+01:00 (14 years ago)
Author:
Morris Swertz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Modules/Compute/UsingRscripts

    v8 v9  
    8080
    8181        //define what other 'compute protocol' MOLGENIS should call (obviously the one we defined above)
    82         submitJob(command="OneTraitQtlMapping", genotypes_name=genotypes_name, phenotypes_name=phenotypes_name, traitnames=selectedNames);
     82        submitJob(protocol="OneTraitQtlMapping", genotypes_name=genotypes_name, phenotypes_name=phenotypes_name, traitnames=selectedNames);
    8383
    8484        //Note: all parameters you pass to submitJob will be automatically passed to the other protocol
     
    9797||number_of_jobs ||Integer ||This will determine how the phenotype dataset will be split in jobs; should be 1 or larger. ||
    9898
     99== user story: using the job submission API to create 'anonymous' compute applications ==
    99100
    100 >>Discussion: we could even decide here to generate a whole R script and pass that as the command. How cool would that be? Than the other protocol doesn't even have to exist in the database.
     101How to demo:
    101102
     103In the above use story we used the job submission API to start pre-existing compute protocols (in this case, !OneTraitQtlMapping).
     104However, we can also create a variant where the job is a script instead of a protocol (aka, an 'anonymous protocol'):
     105
     106{{{
     107
     108//here our script will use the job submission API so you can run many R scripts
     109for(i in 1:number_of_jobs)
     110{
     111        //cut out a subset of the phenotypes
     112        selectedNames <- sliceList(i,number_of_jobs)
     113
     114        //define what other 'compute protocol' MOLGENIS should call (obviously the one we defined above)
     115        script <- paste("genotypes <- getFromDb(genotypes_name)",
     116                             "phenotypes <- getFromDb(phenotype_name)",
     117                             "onetraitqtlmapping(trait_names, genotypes, phenotypes)", sep="\n")
     118        submitJob(script=script, genotypes_name=genotypes_name, phenotypes_name=phenotypes_name, traitnames=selectedNames);
     119
     120        //Note: all parameters you pass to submitJob will be automatically passed to the other protocol
     121        //result is that a new "computeapplication" will be created programmatically instead of via the UI to be sent to the cluster
     122}
     123
     124}}}
     125