Skip to content

Commit

Permalink
Merge pull request #10 from Takadonet/log_enchantment
Browse files Browse the repository at this point in the history
added ability to redirect build and run log to a specific file
  • Loading branch information
anujg30 authored Sep 26, 2016
2 parents 213b2ed + 3d4c09a commit aa1f672
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions stringMLST.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
[-s][--single]
[-c][--config]
[-P][--prefix]
[-a]
[-k]
[-o output_filename][--output output_filename]
[-x][--overwrite]
Expand Down Expand Up @@ -830,6 +831,8 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
if the quality of reads is not very good.
-P,--prefix = <prefix>
Prefix for db and log files to be created(Default = kmer). Also you can specify folder where you want the dbb to be created.
-a
File location to write build log
-h,--help
Prints the help manual for this application
Expand Down Expand Up @@ -1002,6 +1005,8 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
-x,--overwrite
By default stringMLST appends the results to the output_filename if same name is used.
This argument overwrites the previously specified output file.
-a
File location to write run log
-t
Time for each analysis will also be reported.
-r
Expand Down Expand Up @@ -1032,12 +1037,13 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
timeDisp = False
reads = False
dbPrefix = 'kmer'
log =''
k = 35

#print 'ARGV :', sys.argv[1:]
#exit(0)
"""Input arguments"""
options, remainder = getopt.getopt(sys.argv[1:], 'o:x1:2:k:l:bd:pshP:c:trv', [
options, remainder = getopt.getopt(sys.argv[1:], 'o:x1:2:k:l:bd:pshP:c:trva:', [
'buildDB',
'predict',
'output=',
Expand Down Expand Up @@ -1093,6 +1099,8 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
paired = False
elif opt in ('-t'):
timeDisp = True
elif opt in ('-a'):
log = arg
elif opt in ('-r'):
reads = True
elif opt in ('-v'):
Expand All @@ -1105,21 +1113,24 @@ def checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,p
checkParams(buildDB,predict,config,k,listMode,list,batch,dir,fastq1,fastq2,paired,dbPrefix)
if buildDB == True:
try:
log = dbPrefix+'.log'
if not log:
log = dbPrefix+'.log'
except TypeError:
log = 'kmer.log'
logging.basicConfig(filename=log,level=logging.DEBUG,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')

if os.path.isfile(config):
print "Info: Making DB for k = ",k
print "Info: Making DB with prefix =",dbPrefix
print "Info: Log file written to ",log
makeCustomDB(config,k,dbPrefix)
else:
print "Error: The input config file "+config +" does not exist."

elif predict == True:
try:
log = dbPrefix+'.log'
if not log:
log = dbPrefix+'.log'
except TypeError:
log = 'kmer.log'
logging.basicConfig(filename=log,level=logging.DEBUG,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
Expand Down

0 comments on commit aa1f672

Please sign in to comment.