/usr/lib/python2.7/dist-packages/biotools/analysis/run.py is in python-biotools 1.2.12-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #!/usr/bin/env python
import biotools.analysis.predict as genepredict
import biotools.analysis.options as options
import threading
from os import sep
try:
import Queue as queue
except ImportError:
import queue
def run(infile, strains):
'''
Run several instances of `genepredict.run` at once.
'''
q = queue.Queue()
filenames = []
def run_predict():
while 1:
try:
strainf = q.get(False)
except queue.Empty:
break
strain = strainf.split(sep)[-1]
pos = strain.rfind('.')
if pos > 1 or (pos == 1 and strain[0] != '.'):
strain = strain[:pos]
options.debug("Predicting for %s." % strain)
try:
genepredict.run(infile, strainf, strain, filenames)
except RuntimeError:
pass
q.task_done()
for strain in strains:
q.put(strain)
for i in range(options.NUM_PROCESSES - 1):
curr = threading.Thread(target=run_predict)
curr.start()
run_predict()
q.join()
return filenames
if __name__ == "__main__":
import sys
try:
run(sys.argv[1:])
except IndexError:
pass
|