@@ -21,7 +21,13 @@ def cleanup():
21
21
for f in glob .glob (files_prefix + "*" ):
22
22
os .remove (f )
23
23
import traceback
24
- with open (args .prefix + ".errlog" , "w" ) as O :
24
+
25
+ if "prefix" in vars (args ):
26
+ outfile = "%s.errlog" % args .prefix
27
+ elif "vcf" in vars (args ):
28
+ outfile = "%s.errlog" % args .vcf .split ("/" )[- 1 ]
29
+
30
+ with open (outfile , "w" ) as O :
25
31
O .write ("# tb-profiler error report\n \n " )
26
32
O .write ("* OS: %s\n " % sys .platform )
27
33
O .write ("* Program version: %s\n " % tbp ._VERSION )
@@ -49,7 +55,7 @@ https://github.com/jodyphelan/TBProfiler/issues/new and paste or attach the
49
55
contents of the error log (%s)
50
56
51
57
###############################################################################
52
- """ % (args . prefix + ".errlog" ))
58
+ """ % (outfile ))
53
59
54
60
55
61
try :
@@ -340,6 +346,12 @@ def main_vcf_profile(args):
340
346
if pp .nofolder (args .dir + "/" + x ):
341
347
os .mkdir (args .dir + "/" + x )
342
348
349
+ global conf
350
+ if args .external_db :
351
+ conf = get_conf_dict (args .external_db )
352
+ else :
353
+ conf = get_conf_dict (sys .base_prefix + "/share/tbprofiler/%s" % args .db )
354
+
343
355
if args .lofreq_sample_name :
344
356
import re
345
357
modified_vcf = "%s.lofreq_modified.vcf" % pp .vcf (args .vcf ).prefix
@@ -372,10 +384,7 @@ def main_vcf_profile(args):
372
384
if args .db == "tbdb" and not args .external_db and pp .nofile (sys .base_prefix + "/share/tbprofiler/tbdb.fasta" ):
373
385
pp .log ("Can't find the tbdb file at %s. Please run 'tb-profiler update_tbdb' to load the default library or specify another using the '--external_db' flag" % sys .base_prefix ,ext = True )
374
386
375
- if args .external_db :
376
- conf = get_conf_dict (args .external_db )
377
- else :
378
- conf = get_conf_dict (sys .base_prefix + "/share/tbprofiler/%s" % args .db )
387
+
379
388
for sample_name in vcf_obj .samples :
380
389
args .sample_name = sample_name
381
390
files_prefix = args .dir + "/" + sample_name
0 commit comments