Skip to content

Commit 2f03eca

Browse files
committed
Exit cleanly even if HICV and HIV present in equal amount
1 parent a1c2a47 commit 2f03eca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/minvar/prepare.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,14 @@ def find_subtype(reads_file, sampled_reads=1000, recomb=False):
152152
freqs[m] += 1. / (queries * len(matching))
153153
support[org_dict[m.split('.')[0]]] += 1. / len(matching)
154154

155-
if support['HIV'] and support['HCV']:
155+
if support['HIV'] and support['HCV'] and support['HIV'] != support['HCV']:
156156
logging.warning('Found both HIV and HCV reads (support %f and %f)', support['HIV'], support['HCV'])
157157
warnings.warn('Both HIV and HCV reads were found.')
158+
elif support['HIV'] and support['HCV'] and support['HIV'] == support['HCV']:
159+
logging.error('Found both HIV and HCV reads (support %f and %f)', support['HIV'], support['HCV'])
160+
logging.error('HIV and HCV in similar amount, impossible to continue, exiting')
161+
sys.exit()
162+
158163
max_freq = max(freqs.values())
159164
organism_here = max(support, key=support.get)
160165
freq2 = {}

0 commit comments

Comments
 (0)