Skip to content

Commit

Permalink
fixed multiprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
afust committed Jan 30, 2019
1 parent bf90121 commit 3623cbe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.4 (2019-01-30)
- fixed split command line call: should now work on different linux versions

## 2.0.3 (2019-01-10)
- fixed critical features bug, now empty or multiple features in config are possible

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def readme():
return f.read()

setup(name='uropa',
version='2.0.3',
version='2.0.4',
description='UROPA is a command line based tool, intended for genomic region annotation',
long_description=readme(),
url='https://github.molgen.mpg.de/loosolab/UROPA',
Expand Down
20 changes: 13 additions & 7 deletions uropa/uropa.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def main():
"--version",
help="prints the version and exits",
action="version",
version="%(prog)s 2.0.3")
version="%(prog)s 2.0.4")
args = parser.parse_args()

config = args.input
Expand Down Expand Up @@ -278,13 +278,19 @@ def main():
logger.info("Multiprocessing: Peak file will be split in %s smaller files.", args.threads)
if not os.path.exists(spl_dir):
os.makedirs(spl_dir)
cmd = ['split',
'-n l/' + str(args.threads),
peaks_bed,
spl_dir + 'spl_peak_']

chunks = args.threads - 1
#cmd = ['split',
# '-n l/' + str(args.threads),
# peaks_bed,
# spl_dir + 'spl_peak_']

cmd = ["split", "-l $(expr `wc", peaks_bed,
"| cut -d ' ' -f3` /", str(chunks), ")", peaks_bed, spl_dir + 'spl_peak_'
]

try:
sp.check_call(cmd, stderr=open(os.devnull, 'w'))
#sp.check_call(cmd, stderr=open(os.devnull, 'w'))
os.system(str(" ".join(cmd)))
except sp.CalledProcessError:
args.threads = 1
logger.warning(
Expand Down

0 comments on commit 3623cbe

Please sign in to comment.