Skip to content

Commit cacfbfc

Browse files
committed
fixed issues report in #8
1 parent bb50af9 commit cacfbfc

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

src/crackling/Crackling.py

+22-13
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ def processSequence(sequence):
253253

254254
duplicatePercent = round(numDuplicateGuides / numIdentifiedGuides * 100.0, 3)
255255
printer(f'\tIdentified {numIdentifiedGuides:,} possible target sites in this file.')
256-
printer(f'\tOf these, {len(duplicateGuides):,} are not unique. These sites occur a total of {numDuplicateGuides} times.')
256+
printer(f'\tOf these, {len(duplicateGuides):,} are not unique. These sites occur a total of {numDuplicateGuides:,} times.')
257257
printer(f'\tRemoving {numDuplicateGuides:,} of {numIdentifiedGuides:,} ({duplicatePercent}%) guides.')
258258
printer(f'\t{len(candidateGuides):,} distinct guides have been discovered so far.')
259259

@@ -277,7 +277,7 @@ def processSequence(sequence):
277277
for batchFile in guideBatchinator:
278278
batchStartTime = time.time()
279279

280-
printer(f'Processing batch file {(batchFileId+1):,} of {len(guideBatchinator)}')
280+
printer(f'Processing batch file {(batchFileId+1):,} of {len(guideBatchinator):,}')
281281

282282
# Create new candidate guide dictionary
283283
candidateGuides = {}
@@ -401,14 +401,17 @@ def processSequence(sequence):
401401
errorCount = 0
402402
notFoundCount = 0
403403

404-
pgLength = int(configMngr['rnafold']['page-length'])
404+
pgLength = min(
405+
int(configMngr['input']['batch-size']),
406+
int(configMngr['rnafold']['page-length'])
407+
)
405408

406409
for pgIdx, pageCandidateGuides in Paginator(
407410
filterCandidateGuides(candidateGuides, MODULE_MM10DB),
408411
pgLength
409412
):
410413
if pgLength > 0:
411-
printer(f'\tProcessing page {(pgIdx+1)} ({pgLength:,} per page).')
414+
printer(f'\tProcessing page {(pgIdx+1):,} (max {pgLength:,} per page).')
412415

413416
if os.path.exists(configMngr['rnafold']['output']):
414417
os.remove(configMngr['rnafold']['output'])
@@ -501,10 +504,10 @@ def processSequence(sequence):
501504
printer(f'\t{failedCount:,} of {testedCount:,} failed here.')
502505

503506
if errorCount > 0:
504-
printer(f'\t{errorCount} of {testedCount} erred here.')
507+
printer(f'\t{errorCount:,} of {testedCount:,} erred here.')
505508

506509
if notFoundCount > 0:
507-
printer(f'\t{notFoundCount} of {testedCount} not found in RNAfold output.')
510+
printer(f'\t{notFoundCount:,} of {testedCount:,} not found in RNAfold output.')
508511

509512
#########################################
510513
## Calc mm10db result ##
@@ -529,9 +532,9 @@ def processSequence(sequence):
529532
candidateGuides[target23]['acceptedByMm10db'] = CODE_ACCEPTED
530533
acceptedCount += 1
531534

532-
printer(f'\t{acceptedCount} accepted.')
535+
printer(f'\t{acceptedCount:,} accepted.')
533536

534-
printer(f'\t{failedCount} failed.')
537+
printer(f'\t{failedCount:,} failed.')
535538

536539
del acceptedCount
537540

@@ -606,15 +609,18 @@ def processSequence(sequence):
606609
testedCount = 0
607610
failedCount = 0
608611

609-
pgLength = int(configMngr['bowtie2']['page-length'])
612+
pgLength = min(
613+
int(configMngr['input']['batch-size']),
614+
int(configMngr['bowtie2']['page-length'])
615+
)
610616

611617
for pgIdx, pageCandidateGuides in Paginator(
612618
filterCandidateGuides(candidateGuides, MODULE_SPECIFICITY),
613619
pgLength
614620
):
615621

616622
if pgLength > 0:
617-
printer(f'\tProcessing page {(pgIdx+1)} ({pgLength:,} per page).')
623+
printer(f'\tProcessing page {(pgIdx+1):,} (max {pgLength:,} per page).')
618624

619625
if os.path.exists(configMngr['bowtie2']['output']):
620626
os.remove(configMngr['bowtie2']['output'])
@@ -732,15 +738,18 @@ def processSequence(sequence):
732738
testedCount = 0
733739
failedCount = 0
734740

735-
pgLength = int(configMngr['offtargetscore']['page-length'])
741+
pgLength = min(
742+
int(configMngr['input']['batch-size']),
743+
int(configMngr['offtargetscore']['page-length'])
744+
)
736745

737746
for pgIdx, pageCandidateGuides in Paginator(
738747
filterCandidateGuides(candidateGuides, MODULE_SPECIFICITY),
739748
pgLength
740749
):
741750

742751
if pgLength > 0:
743-
printer(f'\tProcessing page {(pgIdx+1)} ({pgLength:,} per page).')
752+
printer(f'\tProcessing page {(pgIdx+1):,} (max {pgLength:,} per page).')
744753

745754
# prepare the list of candidate guides to score
746755
guidesInPage = 0
@@ -873,7 +882,7 @@ def processSequence(sequence):
873882
#########################################
874883
printer('Done.')
875884

876-
printer(f'{len(candidateGuides)} guides evaluated.')
885+
printer(f'{len(candidateGuides):,} guides evaluated.')
877886

878887
printer('This batch ran in {} (dd hh:mm:ss) or {} seconds'.format(
879888
time.strftime('%d %H:%M:%S', time.gmtime((time.time() - batchStartTime))),

0 commit comments

Comments
 (0)