# HG changeset patch
# User kellrott
# Date 1351147146 14400
# Node ID 2925d82b84fcd9881e5da042737f78f251a2c92c
# Parent a104cc98359c55e6f4933d1614605f79aa30f2eb
Uploaded
diff -r a104cc98359c -r 2925d82b84fc synapse_create.xml
--- a/synapse_create.xml Tue Jul 24 17:34:37 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-
- 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)
-
-]]>
-
-
diff -r a104cc98359c -r 2925d82b84fc synapse_download.xml
--- a/synapse_download.xml Tue Jul 24 17:34:37 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-
- Download Synapse Entity
- $script_file
-#if str( $user ) != '':
- -u "$user"
-#end if
-#if str( $pass ) != '':
- -p "$pass"
-#end if
--s $synid
-$data_type
--o $outfile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/._synapse_create.xml
Binary file synapse_interface/._synapse_create.xml has changed
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/._synapse_download.xml
Binary file synapse_interface/._synapse_download.xml has changed
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/._synapse_query.xml
Binary file synapse_interface/._synapse_query.xml has changed
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/synapse_create.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/synapse_interface/synapse_create.xml Thu Oct 25 02:39:06 2012 -0400
@@ -0,0 +1,138 @@
+
+ Create Synapse
+ $script_file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ", x);
+y = gsub("__lt__", "<", y );
+y = gsub("__sq__", "'", y);
+y = gsub("__dq__", "\\"",y);
+y = gsub("__ob__", "[", y);
+y = gsub("__cb__", "]", y);
+y = gsub("__oc__", "{", y);
+y = gsub("__cc__", "}", y);
+y = gsub("__at__", "@", y);
+y = gsub("__cn__", "\\n", y);
+y = gsub("__cr__", "\\r", y);
+y = gsub("__tc__", "\\t", y);
+y = gsub("__pd__", "#", y);
+y = gsub("__at__", "@", y);
+return(y);
+}
+
+if (nchar("$user") && nchar("$pass")) {
+ synapseLogin(username=galaxyClean("$user"), password=galaxyClean("$pass"))
+}
+
+
+ent <- ${etype}( list(name=galaxyClean("${name}")) )
+
+#for $a in $annotations:
+annotValue(ent, galaxyClean("${a.name}")) <- galaxyClean("${a.value}")
+#end for
+
+#for a in $properties:
+propertyValue(ent, galaxyClean("${a.name}")) <- galaxyClean("${a.value}")
+#end for
+
+ent <- createEntity(ent)
+
+#if $attachment != 'None'
+#if $attachment_name == '':
+ent <- addFile(ent, galaxyClean("${attachment}"))
+#else
+ent <- addFile(ent, galaxyClean("${attachment}"), galaxyClean("${attachment_name}"))
+#end if
+#end if
+
+ent <- storeEntity(ent)
+
+write(properties(ent)\$id, file=galaxyClean("${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)
+
+]]>
+
+
+
+Install R SynapseClient:
+ source('http://depot.sagebase.org/CRAN.R')
+ pkgInstall("synapseClient")
+
+`To setup auto login (so you don't have to type in your password) <https://sagebionetworks.jira.com/wiki/display/SYNR/How+to+configure+automatic+login>`_
+
+
+
+
\ No newline at end of file
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/synapse_download.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/synapse_interface/synapse_download.xml Thu Oct 25 02:39:06 2012 -0400
@@ -0,0 +1,92 @@
+
+ Download Synapse Entity
+ $script_file
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ", x);
+y = gsub("__lt__", "<", y );
+y = gsub("__sq__", "'", y);
+y = gsub("__dq__", "\\"",y);
+y = gsub("__ob__", "[", y);
+y = gsub("__cb__", "]", y);
+y = gsub("__oc__", "{", y);
+y = gsub("__cc__", "}", y);
+y = gsub("__at__", "@", y);
+y = gsub("__cn__", "\\n", y);
+y = gsub("__cr__", "\\r", y);
+y = gsub("__tc__", "\\t", y);
+y = gsub("__pd__", "#", y);
+y = gsub("__at__", "@", y);
+return(y);
+}
+
+if (nchar("$user") && nchar("$pass")) {
+ synapseLogin(username=galaxyClean("$user"), password=galaxyClean("$pass"))
+}
+
+
+cat("Loading...")
+ent <- loadEntity("$synid");
+cat("Done\n")
+
+if ("e" == "$data_type") {
+ eset <- exprs(ent\$objects\$eset);
+ write(paste(c("PROBE", colnames(eset)), collapse="\\t"), file="$outfile")
+ write.table(eset, "$outfile", col.names=FALSE, sep="\\t", quote=FALSE, append=TRUE);
+}
+if ("a" == "$data_type") {
+ fpath <- file.path(ent\$cacheDir, ent\$files[[1]]);
+ file.copy(fpath, "$outfile", overwrite=T);
+}
+
+"""
+
+import tempfile
+import os
+import sys
+import subprocess
+
+h, path = tempfile.mkstemp()
+os.write(h,rcode)
+os.close(h)
+
+cmd_args = ["R", "CMD", "BATCH", path ]
+proc = subprocess.Popen(cmd_args, stderr=subprocess.PIPE)
+stdout, stderr = proc.communicate()
+if proc.poll() != 0:
+ sys.stderr.write(stderr)
+os.unlink(path)
+]]>
+
+
+
+This tool current supports two types of data from Synapse: Affy eset data and attachment files.
+For Affy eset data, it will attempt to turn the eset into a table and write a tab separated file. For attachment files, it will
+save the first attached file as the output.
+
+Install R SynapseClient::
+
+ source('http://depot.sagebase.org/CRAN.R')
+ pkgInstall("synapseClient")
+
+`To setup auto login (so you don't have to type in your password) <https://sagebionetworks.jira.com/wiki/display/SYNR/How+to+configure+automatic+login>`_
+
+
+
\ No newline at end of file
diff -r a104cc98359c -r 2925d82b84fc synapse_interface/synapse_query.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/synapse_interface/synapse_query.xml Thu Oct 25 02:39:06 2012 -0400
@@ -0,0 +1,94 @@
+
+ Query Synapse
+ $script_file
+
+
+
+
+
+
+
+
+
+
+
+ ", x);
+y = gsub("__lt__", "<", y );
+y = gsub("__sq__", "'", y);
+y = gsub("__dq__", "\\"",y);
+y = gsub("__ob__", "[", y);
+y = gsub("__cb__", "]", y);
+y = gsub("__oc__", "{", y);
+y = gsub("__cc__", "}", y);
+y = gsub("__at__", "@", y);
+y = gsub("__cn__", "\\n", y);
+y = gsub("__cr__", "\\r", y);
+y = gsub("__tc__", "\\t", y);
+y = gsub("__pd__", "#", y);
+y = gsub("__at__", "@", y);
+return(y);
+}
+
+if (nchar("$user") && nchar("$pass")) {
+ synapseLogin(username=galaxyClean("$user"), password=galaxyClean("$pass"))
+}
+
+
+
+query <- galaxyClean("${query}");
+cat(query)
+
+query.out <- synapseQuery(query);
+write.table(query.out, quote=F, file="$outfile", row.name=F, sep="\\t")
+
+"""
+import tempfile
+import os
+import sys
+import subprocess
+
+h, path = tempfile.mkstemp(dir="/tmp")
+os.write(h,rcode)
+os.close(h)
+
+proc = subprocess.Popen( ["Rscript", path], stderr=subprocess.PIPE, stdout=subprocess.PIPE )
+(stdoutdata, stderrdata) = proc.communicate()
+if proc.returncode:
+ sys.stderr.write(stderrdata)
+sys.stdout.write(stdoutdata)
+os.unlink(path)
+
+]]>
+
+
+
+Install R SynapseClient::
+
+ source('http://depot.sagebase.org/CRAN.R')
+ pkgInstall("synapseClient")
+
+`To setup auto login (so you don't have to type in your password) <https://sagebionetworks.jira.com/wiki/display/SYNR/How+to+configure+automatic+login>`_
+
+Example Query:
+
+select * from entity where parentId=="syn300013"
+
+
+
+
\ No newline at end of file
diff -r a104cc98359c -r 2925d82b84fc synapse_query.xml
--- a/synapse_query.xml Tue Jul 24 17:34:37 2012 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-
- Query Synapse
- $script_file
-#if str( $user ) != '':
- -u "$user"
-#end if
-
-#if str( $pass ) != '':
- -p "$pass"
-#end if
--o $outfile
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-