Skip to content

Commit

Permalink
re-enabled multiprocessing module for 1 cpu case
Browse files Browse the repository at this point in the history
  • Loading branch information
umahsn committed Aug 3, 2021
1 parent 1b95a41 commit 217427d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
10 changes: 3 additions & 7 deletions scripts/NanoCaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
def run(args):
import snpCaller, indelCaller

if args.cpu==1:
pool=None
else:
pool = mp.Pool(processes=args.cpu)
pool = mp.Pool(processes=args.cpu)

if not args.output:
args.output=os.getcwd()
Expand Down Expand Up @@ -136,9 +133,8 @@ def run(args):
final_path=os.path.join(args.output,'%s.final.vcf.gz' %args.prefix)
run_cmd('bcftools concat %s.phased.vcf.gz %s.vcf.gz -a -d all |bgziptabix %s' %(snp_vcf, indel_vcf, final_path))

if pool:
pool.close()
pool.join()
pool.close()
pool.join()

if __name__ == '__main__':

Expand Down
6 changes: 1 addition & 5 deletions scripts/indelCaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ def test_model(params,pool):
d['end']=min(end,mbase+50000)
in_dict_list.append(d)

if params['cpu']==1:
result=map(get_indel_testing_candidates, in_dict_list)

else:
result=pool.imap_unordered(get_indel_testing_candidates, in_dict_list)
result=pool.imap_unordered(get_indel_testing_candidates, in_dict_list)

total_regions=len(in_dict_list)
completed=0
Expand Down
6 changes: 1 addition & 5 deletions scripts/snpCaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,7 @@ def test_model(params,pool):
d['end']=min(end,mbase+200000)
in_dict_list.append(d)

if params['cpu']==1:
result=map(get_snp_testing_candidates, in_dict_list)

else:
result=pool.imap_unordered(get_snp_testing_candidates, in_dict_list)
result=pool.imap_unordered(get_snp_testing_candidates, in_dict_list)

total_regions=len(in_dict_list)
completed=0
Expand Down

0 comments on commit 217427d

Please sign in to comment.