diff --git a/chipathlon/jobs/params/music_punctate.yaml b/chipathlon/jobs/params/music_punctate.yaml index 6b12172aeee599abda296b3154abec3d08f48f72..4e0bf45c828a93f1e959ec5aa3f1d2f091ae1b60 100644 --- a/chipathlon/jobs/params/music_punctate.yaml +++ b/chipathlon/jobs/params/music_punctate.yaml @@ -46,7 +46,7 @@ music_punctate: - name: scale_2216.bed type: file file_type: bed - command: run_music.py + command: music arguments: - "--prefix": type: string diff --git a/chipathlon/jobs/scripts/run_music.py b/chipathlon/jobs/scripts/run_music.py index 9180af18ca394b2798eed1c198a6e3744617937b..67c7603cb1d18928b3cccb1031738fd1efbbe687 100755 --- a/chipathlon/jobs/scripts/run_music.py +++ b/chipathlon/jobs/scripts/run_music.py @@ -22,8 +22,8 @@ peak_type_dict = { "broad": "-get_multiscale_broad_ERs" } -subprocess.call(["/util/opt/lmod/lmod/init/profile"]) -subprocess.call(["module", "load", "music"]) +#subprocess.call(["/util/opt/lmod/lmod/init/profile"]) +#subprocess.call(["module", "load", "music"]) if not os.path.isdir(args.prefix): # Create unqiue subdirectories for processing input @@ -91,8 +91,17 @@ if not os.path.isdir(args.prefix): ], stdout=wh, stdin=sort.stdout) sort.wait() - shutil.copyfile("sorted_scale_%s_all.bed" % (scale,), - "../%s_sorted_scale_%s_all.bed" % (args.prefix, scale)) + with open("sorted_scale_%s_all.bed" % (scale,), "r") as rh: + with open("../%s_sorted_scale_%s_all.bed" % (args.prefix, scale), "w") as wh: + for line in rh: + info = line.split() + # Score value shouldn't be negative + info[4] = -1 * int(info[4]) + # pad columsn so there are actually 9 + for i in range(0, 3): + info.append(0) + # Write! + wh.write(info.join("\t") + "\n") else: print "Directory %s already exists." % (args.prefix,) diff --git a/chipathlon/jobs/wrappers/music_wrapper.sh b/chipathlon/jobs/wrappers/music_wrapper.sh new file mode 100755 index 0000000000000000000000000000000000000000..279e98e31ce7e241b2de3e9ecb11f04a3abee72c --- /dev/null +++ b/chipathlon/jobs/wrappers/music_wrapper.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +. /util/opt/lmod/lmod/init/profile +module load music + +run_music.py "$@" diff --git a/chipathlon/workflow.py b/chipathlon/workflow.py index de47b7d4188ba303e407dee218e983624e510b49..1f95757a1c11d6f5104309960c91c6f7f25c0c42 100644 --- a/chipathlon/workflow.py +++ b/chipathlon/workflow.py @@ -334,7 +334,10 @@ class Workflow(object): if "profile" in self.config: for namespace in self.config["profile"]: for key in self.config["profile"][namespace]: - sites += """\n\t<profile namespace="%s" key="%s">%s</profile> """ % (namespace, key, self.config["profile"][namespace][key]) + value = self.config["profile"][namespace][key] + if key == "PATH": + value = value + ":%s/jobs/scripts/" % (os.path.dirname(os.path.abspath(__file__)),) + sites += """\n\t<profile namespace="%s" key="%s">%s</profile> """ % (namespace, key, value) sites += """</site> <site handle="dummylocal" arch="x86_64" os="LINUX">