Skip to content

Commit

Permalink
disable multiprocessing for read recruitment
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrdadbakhtiari committed Nov 6, 2019
1 parent 2609062 commit 55ee8cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion advntr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def main():
help='working directory for creating temporary files needed for computation')
genotype_others_group.add_argument('-m', '--models', type=str, metavar='<file>', default=None,
help='VNTR models file [%s]' % settings.ILLUMINA_DEFAULT_MODELS_FILE)
genotype_others_group.add_argument('-t', '--threads', type=int, metavar='<int>', default=4,
genotype_others_group.add_argument('-t', '--threads', type=int, metavar='<int>', default=1,
help='number of threads [%(default)s]')
genotype_others_group.add_argument('-u', '--update', action='store_true', default=False,
help='set this flag to iteratively update the model')
Expand Down
15 changes: 3 additions & 12 deletions advntr/vntr_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,16 +536,12 @@ def iteratively_update_model(self, alignment_file, unmapped_filtered_reads, sele
@time_usage
def select_illumina_reads(self, alignment_file, unmapped_filtered_reads, update=False, hmm=None):
recruitment_score = None
sema = Semaphore(settings.CORES)
manager = Manager()
selected_reads = manager.list()
selected_reads = []
vntr_bp_in_unmapped_reads = Value('d', 0.0)

number_of_reads = 0
read_length = 150

process_list = []

for read_segment in unmapped_filtered_reads:
if number_of_reads == 0:
read_length = len(str(read_segment.seq))
Expand All @@ -558,13 +554,8 @@ def select_illumina_reads(self, alignment_file, unmapped_filtered_reads, update=
if len(read_segment.seq) < read_length:
continue

sema.acquire()
p = Process(target=self.process_unmapped_read, args=(sema, str(read_segment.seq), hmm, recruitment_score,
vntr_bp_in_unmapped_reads, selected_reads))
process_list.append(p)
p.start()
for p in process_list:
p.join()
self.process_unmapped_read(None, str(read_segment.seq), hmm, recruitment_score, vntr_bp_in_unmapped_reads,
selected_reads)

logging.debug('vntr base pairs in unmapped reads: %s' % vntr_bp_in_unmapped_reads.value)

Expand Down

0 comments on commit 55ee8cd

Please sign in to comment.