comparison tools/mira4_0/mira4.py @ 35:259891fce7fd draft

planemo upload for repository https://github.com/peterjc/galaxy_mira/tree/master/tools/mira4_0 commit e4c56df75150c82d3e9c4ac487c4209108e52412
author peterjc
date Wed, 09 Aug 2017 13:32:11 -0400
parents 0785a6537f3e
children cee8f9005e43
comparison
equal deleted inserted replaced
34:0785a6537f3e 35:259891fce7fd
14 from optparse import OptionParser 14 from optparse import OptionParser
15 15
16 # Do we need any PYTHONPATH magic? 16 # Do we need any PYTHONPATH magic?
17 from mira4_make_bam import make_bam 17 from mira4_make_bam import make_bam
18 18
19 WRAPPER_VER = "0.0.10" # Keep in sync with the XML file 19 WRAPPER_VER = "0.0.11" # Keep in sync with the XML file
20 20
21 21
22 def get_version(mira_binary): 22 def get_version(mira_binary):
23 """Run MIRA to find its version number.""" 23 """Run MIRA to find its version number."""
24 # At the commend line I would use: mira -v | head -n 1 24 # At the commend line I would use: mira -v | head -n 1
67 out_maf = options.maf 67 out_maf = options.maf
68 out_bam = options.bam 68 out_bam = options.bam
69 out_fasta = options.fasta 69 out_fasta = options.fasta
70 out_log = options.log 70 out_log = options.log
71 71
72 try: 72 if "MIRA4" in os.environ:
73 mira_path = os.environ["MIRA4"] 73 mira_path = os.environ["MIRA4"]
74 except KeyError: 74 mira_binary = os.path.join(mira_path, "mira")
75 sys.exit("Environment variable $MIRA4 not set") 75 if not os.path.isfile(mira_binary):
76 mira_binary = os.path.join(mira_path, "mira") 76 sys.exit("Missing mira under $MIRA4, %r\nFolder contained: %s"
77 if not os.path.isfile(mira_binary): 77 % (mira_binary, ", ".join(os.listdir(mira_path))))
78 sys.exit("Missing mira under $MIRA4, %r\nFolder contained: %s" 78 mira_convert = os.path.join(mira_path, "miraconvert")
79 % (mira_binary, ", ".join(os.listdir(mira_path)))) 79 if not os.path.isfile(mira_convert):
80 mira_convert = os.path.join(mira_path, "miraconvert") 80 sys.exit("Missing miraconvert under $MIRA4, %r\nFolder contained: %s"
81 if not os.path.isfile(mira_convert): 81 % (mira_convert, ", ".join(os.listdir(mira_path))))
82 sys.exit("Missing miraconvert under $MIRA4, %r\nFolder contained: %s" 82 else:
83 % (mira_convert, ", ".join(os.listdir(mira_path)))) 83 sys.stderr.write("DEBUG: Since $MIRA4 is not set, assuming mira binaries are on $PATH.\n")
84 mira_path = None
85 mira_binary = "mira"
86 mira_convert = "miraconvert"
84 87
85 mira_ver = get_version(mira_binary) 88 mira_ver = get_version(mira_binary)
86 if not mira_ver.strip().startswith("4.0"): 89 if not mira_ver.strip().startswith("4.0"):
87 sys.exit("This wrapper is for MIRA V4.0, not:\n%s\n%s" % (mira_ver, mira_binary)) 90 sys.exit("This wrapper is for MIRA V4.0, not:\n%s\n%s" % (mira_ver, mira_binary))
88 mira_convert_ver = get_version(mira_convert) 91 mira_convert_ver = get_version(mira_convert)