[Swift-commit] r8360 - SwiftApps/ematter/galaxy

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Tue Jan 13 13:31:05 CST 2015


Author: ketan
Date: 2015-01-13 13:31:05 -0600 (Tue, 13 Jan 2015)
New Revision: 8360

Added:
   SwiftApps/ematter/galaxy/lastlammpsdump2xyz.py
   SwiftApps/ematter/galaxy/pizza.swift
   SwiftApps/ematter/galaxy/pizzawrap
   SwiftApps/ematter/galaxy/swiftpizza.py
Modified:
   SwiftApps/ematter/galaxy/pizza.xml
Log:
galaxification of pizza

Added: SwiftApps/ematter/galaxy/lastlammpsdump2xyz.py
===================================================================
--- SwiftApps/ematter/galaxy/lastlammpsdump2xyz.py	                        (rev 0)
+++ SwiftApps/ematter/galaxy/lastlammpsdump2xyz.py	2015-01-13 19:31:05 UTC (rev 8360)
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+# Set the import path to find the Pizza tools.
+# Warning! Nonportable.
+
+import sys
+sys.path.append('/home/ketan/pizza-2Jul14/src')
+import dump, xyz
+
+if __name__ == '__main__':
+	# read the dump file (the first cl arg)
+	d = dump.dump(sys.argv[1])
+	# Get array of times
+	t = d.time()
+	# Convert the list of dumped states to xyz (in memory)
+	x = xyz.xyz(d)
+	# Dump just the last time instance to a file (the second cl arg)
+	# This can be easily changed to use any other time slice between 0 
+	# and len(t)-1 inclusive.  This will require additional validation
+	# of the additional input parameter, though.
+	x.single(t[-1],sys.argv[2])	
+


Property changes on: SwiftApps/ematter/galaxy/lastlammpsdump2xyz.py
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/ematter/galaxy/pizza.swift
===================================================================
--- SwiftApps/ematter/galaxy/pizza.swift	                        (rev 0)
+++ SwiftApps/ematter/galaxy/pizza.swift	2015-01-13 19:31:05 UTC (rev 8360)
@@ -0,0 +1,21 @@
+type file;
+
+
+/* == App function definitions == */
+
+/* == Lammps app definition == */
+app (file _xyz) pizza_app (file _src, file _dump)
+{
+   
+   //python @_src @_dump @_xyz; 
+   pizzawrap @_src @_dump @_xyz
+}
+
+file src <single_file_mapper; file=arg("src")>;
+file dump <single_file_mapper; file=arg("dump")>;
+
+file xyz <single_file_mapper; file=arg("xyz")>;
+
+
+(xyz) = pizza_app (src, dump);
+

Modified: SwiftApps/ematter/galaxy/pizza.xml
===================================================================
--- SwiftApps/ematter/galaxy/pizza.xml	2015-01-13 19:29:54 UTC (rev 8359)
+++ SwiftApps/ematter/galaxy/pizza.xml	2015-01-13 19:31:05 UTC (rev 8360)
@@ -1,51 +1,39 @@
-<tool id="swiftjumpdsp" name="dsp swift">
+<tool id="swiftpizza" name="pizza swift">
+    
     <!--
          ToDo:
-         1. Option if the counter should be an argument, first one or last one.
-         2. Option to add files (in Galaxy dataset format) as arguments. These files then be added to Swift app as arguments.
-         3. Allow the tool to select another tool and run it.
-         4. Allow user to add more than one resource to run a job for load balancing.
-         5. Add ability to run Swift/T.
-         6. Let the localhost option be selected by default        
+         1. 
     -->
-    <description>A Galaxy tool to run Dsp parameter sweeps via Swift foreach parallel construct</description>
 
+    <description>A Galaxy tool to run the pizza tool via Swift</description>
+
     <command interpreter="python">
-        swiftjumpdsp.py
-        "${inlocation}"
-        "${a}" 
-        "${n}"
-        "${p}"
-        "${I}"
+        swiftpizza.py
+        "${_src}"
+        "${_dump}"
+        "${_xyz}" 
         "${local_or_compute}"
-        "${resloc}"
-        "${outlist}"
-        "${outlogfile}"
     </command>
     <inputs>
-        <param name="inlocation" size="60" type="text" label="inlocation" value="/home/ketan/SwiftApps/dsp-swift/dcap" help="Enter the path of the directory containing input data, eg. /home/ketan/farmer" />
-        <param name="a" size="30" type="text" label="aval" value="1" help="Enter the value of a" />
-        <param name="n" size="30" type="text" label="nval" value="1" help="Enter the value of n" />
-        <param name="p" size="30" type="text" label="pval" value="1" help="Enter the value of p" />
-        <param name="I" size="30" type="text" label="Ival" value="10" help="Enter the value of I" />
+        <param name="_src" size="30" type="data" label="in.lammps" help="Select data for lammps in" />
+        <param name="_dump" size="30" type="data" label="geo" help="Select data for geo" />
         <param name="local_or_compute" type="select" display="radio" label="choose target execution location">
            <option value="local" selected="true">local</option>
            <option value="compute">compute</option>
         </param>
-        <param name="resloc" size="60" type="text" label="Location for results" value="/tmp/outdir"  help="Enter the path to a directory to put results in, eg. /tmp/outdir"/>
     </inputs>
     <outputs>
-        <data format="txt" name="outlist" type="data" label="Output List" />
-        <data format="txt" name="outlogfile" type="data" label="Swift Progress" />
+        <data format="txt" name="_xyz" type="data" label="pizza output" />
     </outputs>
-<help>
+    
+    <help>
 **What is this?**
 
-A tool to run dsp in parallel parameter sweeps.
+A tool to run the pizza tool. 
 
 **What it does?**
 
-Runs dsp in parallel over a user provided input dataset and parameters.
+Runs the pizza tool. 
 
 **How does it do?**
 
@@ -58,12 +46,11 @@
 </help>
 </tool>
 
-
-type file;
-
+<!--
 /* == Pizza app definition == */
 app (file _xyz) pizza_app (file _pizza_src, file _dump)
 {
    python @_pizza_src @_dump @_xyz; 
 }
+-->
 

Added: SwiftApps/ematter/galaxy/pizzawrap
===================================================================
--- SwiftApps/ematter/galaxy/pizzawrap	                        (rev 0)
+++ SwiftApps/ematter/galaxy/pizzawrap	2015-01-13 19:31:05 UTC (rev 8360)
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+src=$1
+dump=$2
+xyz=$3
+
+ln -s $src pizzasrc.py
+ln -s $dump dump.lammps 
+
+python pizzasrc.py dump.lammps xyz.xyz
+
+mv xyz.xyz $xyz
+


Property changes on: SwiftApps/ematter/galaxy/pizzawrap
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/ematter/galaxy/swiftpizza.py
===================================================================
--- SwiftApps/ematter/galaxy/swiftpizza.py	                        (rev 0)
+++ SwiftApps/ematter/galaxy/swiftpizza.py	2015-01-13 19:31:05 UTC (rev 8360)
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+"""
+This is the Swift driver for Galaxy. It receives inputs from the Swift
+Galaxy tool and depending on the options specified, builds a
+canonical Swift/K or Swift/T script and runs over specified computational
+environment.
+
+  swiftpizza.py
+  "${_src}"
+  "${_dump}"
+  "${_xyz}" 
+  "${local_or_compute}"
+
+"""
+
+import subprocess
+import sys
+import os
+import distutils.spawn
+import traceback
+import fnmatch
+import re
+from os.path import expanduser
+
+
+def genargs(args):
+    for a in args:
+        yield a
+
+def main():
+    myargs = genargs(sys.argv)
+    try:
+        this=next(myargs)
+        src = next(myargs)
+        dump = next(myargs)
+        xyz = next(myargs)
+        local_or_compute = next(myargs)
+    except:
+        traceback.print_exc()
+        sys.exit(1)
+
+    homedir = expanduser("~")
+        
+    baseloc = homedir+"/SwiftApps/ematter/galaxy"
+    #which swift
+    swift = homedir+"/swift-0.95/cog/modules/swift/dist/swift-svn/bin/swift"
+    swiftargs="-src="+src+" -dump="+dump+" -xyz="+xyz
+    siteval=baseloc+"/sites.local.xml"
+
+    if local_or_compute == "compute":
+        siteval=baseloc+"/sites.blues.xml"
+
+    #Invocation
+    exitcode=subprocess.check_call([swift, "-sites.file", siteval, "-tc.file", baseloc+"/apps", "-config", baseloc+"/cf", baseloc+"/pizza.swift", swiftargs])
+    #print exitcode
+
+if __name__=='__main__':
+    main()


Property changes on: SwiftApps/ematter/galaxy/swiftpizza.py
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list