# HG changeset patch # User kellrott # Date 1343165591 14400 # Node ID 83173eca36b7f15ec05a6369bfaa634194ff6145 Uploaded diff -r 000000000000 -r 83173eca36b7 synapse_create.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/synapse_create.xml Tue Jul 24 17:33:11 2012 -0400 @@ -0,0 +1,92 @@ + + Create Synapse + $script_file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 && nchar("$pass") > 0) { + synapseLogin(username="$user", password="$pass") +} + +ent <- ${etype}( list(name="${name}") ) + +#for $a in $annotations: +annotValue(ent, "${a.name}") <- "${a.value}" +#end for + +#for a in $properties: +propertyValue(ent, "${a.name}") <- "${a.value}" +#end for + +ent <- createEntity(ent) + +#if $attachment != 'None' +#if $attachment_name == '': +ent <- addFile(ent, "${attachment}") +#else +ent <- addFile(ent, "${attachment}", "${attachment_name}") +#end if +#end if + +ent <- storeEntity(ent) + +write(properties(ent)\$id, file="${outfile}"); + +""" + + +import tempfile +import os +import sys +import subprocess + +h, path = tempfile.mkstemp() +os.write(h,rcode) +os.close(h) + +proc = subprocess.Popen( ["Rscript", path] + sys.argv[1:], stderr=subprocess.PIPE, stdout=subprocess.PIPE ) +(stdoutdata, stderrdata) = proc.communicate() +if proc.returncode: + sys.stderr.write(stderrdata) +sys.stdout.write(stdoutdata) +os.unlink(path) + +]]> + +