Skip to content

Commit

Permalink
Update sbatch working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
yiming-kang committed May 7, 2020
1 parent 43fee73 commit f8cb003
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Code/summarizeFinalResults.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

def parse_args(argv):
parser = argparse.ArgumentParser(description="")
parser.add_argument("-i","--input_dirpath", required=True,
parser.add_argument("-i", "--input_dirpath", required=True,
help="Directory of DTO results including both authentic model and randomized models.")
parser.add_argument("-l","--tfs_filepath", default=None,
parser.add_argument("-l", "--tfs_filepath", default=None,
help="File of TF list, for which will be analyzed, e.g. if a particular family of TFs are of interest.")
parser.add_argument("-e","--user_email", default=None,
parser.add_argument("-e", "--user_email", default=None,
help="Email address for SLURM notification")
parser.add_argument("--run_local", action='store_true', default=False,
help="Flag for running DTO in serial fashion on local machine.")
Expand All @@ -18,14 +18,19 @@ def parse_args(argv):


def generateSbatch(input_dirpath, tfs_filepath):
input_name = os.path.basename(input_dirpath.strip("/"))
sbatch_filepath = "tmp/summarize_{}.sh".format(input_name)
code_dirpath = os.getcwd()
output_dirpath = "{}/summary".format(input_dirpath)
if not os.path.exists(output_dirpath):
os.makedirs(output_dirpath)
os.makedirs("{}/log".format(output_dirpath))

sbatch_filepath = "{}/summarize.sh".format(output_dirpath)
if tfs_filepath is None:
tf_list = ""
else:
tf_list = " -l {}".format(tfs_filepath)
with open(sbatch_filepath, "w") as f:
f.write("#!/bin/bash\n#SBATCH --mem=4G\n#SBATCH -J sumDTO\n#SBATCH -o tmp/log_{0}.out\n#SBATCH -e tmp/log_{0}.err\n".format(input_name))
f.write("#!/bin/bash\n#SBATCH -D {0}\n#SBATCH --mem=4G\n#SBATCH -J sumDTO\n#SBATCH -o {1}/log/summarize_DTO.out\n#SBATCH -e {1}/log/summarize_DTO.err\n\n".format(code_dirpath, output_dirpath))
f.write("python -u compileResults.py -i {0}/authentic_model/ -o {0}/authentic_model.csv\npython -u compileResults.py -i {0}/random_models/ -o {0}/random_models.csv -r split\npython computeAcceptableTFs.py -d {0}/authentic_model.csv -r {0}/random_models.csv -o {0}/summary/{1}\ncat {0}/summary/summary.txt\n".format(input_dirpath, tf_list))
return sbatch_filepath

Expand Down

0 comments on commit f8cb003

Please sign in to comment.