#!/usr/bin/env python import birchenv import birchscript import os import os.path import shutil import subprocess import sys # For each name in INFILE, call a SeqHound method, and return # the result (a list). Results for each name are converted into # a GDE flat file. Flat files are concatenated into a single # flatfile to be read back into GDE. # Make sure that the user has a $HOME/.shoundremrc file if not os.path.exists(os.path.join(birchenv.HOME, ".shoundremrc")): shutil.copyfile(os.path.join(birchenv.BIRCH, "java", "Leash", "shoundremrc"), os.path.join(os.getcwd(), os.path.join(birchenv.HOME, ".shoundremrc"))) h_INFILE = open(sys.argv[1], "r") OUTFILE = sys.argv[2] TYPE = sys.argv[3] TEMPFILE = "leash." + os.getpid() for name in h_INFILE: namefile = name + "." + TYPE command = ["java", "-jar", os.path.join(birchenv.BIRCH, "java", "Leash", "Leash.jar"), "-mpi", name] command[5:] = sys.argv[3:] command[-1:] = [command[-1][0], "-of", namefile] subprocess.call(command) subprocess.call([os.path.join(birchenv.BIRCH, "script", "list2flat.py"), namefile, TEMPFILE]) birchscript.cat_to(TEMPFILE, h_OUTFILE) os.remove(namefile) os.remove(TEMPFILE)