Mercurial > repos > iuc > data_manager_interproscan
comparison data_manager/interproscan.py @ 3:0df47f8552f6 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_interproscan commit 01e8e726d711c0685f46d3146e4fe0f2a1306036
author | iuc |
---|---|
date | Wed, 07 Dec 2022 13:41:38 +0000 |
parents | 0db4f153d86d |
children |
comparison
equal
deleted
inserted
replaced
2:7776cb18fdf8 | 3:0df47f8552f6 |
---|---|
77 raise RuntimeError("Version '%s' is not valid" % args.version) | 77 raise RuntimeError("Version '%s' is not valid" % args.version) |
78 tag = args.version | 78 tag = args.version |
79 else: | 79 else: |
80 tag = all_tags[-1] | 80 tag = all_tags[-1] |
81 | 81 |
82 setup_script = 'initial_setup.py' | |
83 sub_version = re.match(r"^[0-9]\.([0-9]{2})-[0-9]{2}\.[0-9]$", tag) | |
84 if sub_version and len(sub_version.groups()) == 1 and int(sub_version.group(1)) >= 58: | |
85 # The setup script was renamed in 5.58 | |
86 setup_script = 'setup.py' | |
87 else: | |
88 raise RuntimeError("Sorry, this data manager can only download data for InterProScan >= 5.58-91.0. Use the 0.0.2 version for older versions of InterProScan.") | |
89 | |
82 print("Will download data for InterProScan version: %s" % tag) | 90 print("Will download data for InterProScan version: %s" % tag) |
83 | 91 |
84 print("Getting MD5 checksum:") | 92 print("Getting MD5 checksum:") |
85 md5 = requests.get(url=MD5_URL.format(version=tag)).text | 93 md5 = requests.get(url=MD5_URL.format(version=tag)).text |
86 if not re.match(r"^([a-fA-F\d]{32}) interproscan-[0-9]\.[0-9]{2}-[0-9]{2}\.[0-9]-64-bit.tar.gz$", md5): | 94 if not re.match(r"^([a-fA-F\d]{32}) interproscan-[0-9]\.[0-9]{2}-[0-9]{2}\.[0-9]-64-bit.tar.gz$", md5): |
123 | 131 |
124 print("Done, removing tarball and unneeded files...") | 132 print("Done, removing tarball and unneeded files...") |
125 os.remove(dest_tar) | 133 os.remove(dest_tar) |
126 shutil.rmtree(os.path.join(output_directory, 'interproscan-%s' % tag)) | 134 shutil.rmtree(os.path.join(output_directory, 'interproscan-%s' % tag)) |
127 | 135 |
128 print("Running initial_setup.py (index hmm models)...") | 136 print("Running {} (index hmm models)...".format(setup_script)) |
129 # Write a temp properties file in work dir | 137 # Write a temp properties file in work dir |
130 prop_file_src = os.path.join(os.path.dirname(os.path.realpath(shutil.which("interproscan.sh"))), 'interproscan.properties') | 138 prop_file_src = os.path.join(os.path.dirname(os.path.realpath(shutil.which("interproscan.sh"))), 'interproscan.properties') |
131 with open(prop_file_src, 'r') as prop: | 139 with open(prop_file_src, 'r') as prop: |
132 prop_content = prop.read() | 140 prop_content = prop.read() |
133 prop_content = re.sub(r'^data\.directory=.*$', 'data.directory=%s' % os.path.join(output_directory, 'data'), prop_content, flags=re.M) | 141 prop_content = re.sub(r'^data\.directory=.*$', 'data.directory=%s' % os.path.join(output_directory, 'data'), prop_content, flags=re.M) |
134 with open('interproscan.properties', 'w') as prop: | 142 with open('interproscan.properties', 'w') as prop: |
135 prop.write(prop_content) | 143 prop.write(prop_content) |
136 # Run the index command | 144 # Run the index command |
137 cmd_args = [os.path.join(os.path.dirname(os.path.realpath(shutil.which("interproscan.sh"))), 'initial_setup.py')] | 145 cmd_args = [os.path.join(os.path.dirname(os.path.realpath(shutil.which("interproscan.sh"))), setup_script), 'interproscan.properties'] |
138 proc = subprocess.Popen(args=cmd_args, shell=False) | 146 proc = subprocess.Popen(args=cmd_args, shell=False) |
139 out, err = proc.communicate() | 147 out, err = proc.communicate() |
140 print(out) | 148 print(out) |
141 print(err, file=sys.stderr) | 149 print(err, file=sys.stderr) |
142 return_code = proc.wait() | 150 return_code = proc.wait() |
143 if return_code: | 151 if return_code: |
144 print("Error running initial_setup.py.", file=sys.stderr) | 152 print("Error running {}.".format(setup_script), file=sys.stderr) |
145 sys.exit(return_code) | 153 sys.exit(return_code) |
146 | 154 |
147 data_manager_dict["data_tables"][args.datatable_name].append( | 155 data_manager_dict["data_tables"][args.datatable_name].append( |
148 dict( | 156 dict( |
149 value=tag, | 157 value=tag, |