Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ability to redirect build and run log to a specific file #10

Merged
merged 1 commit into from
Sep 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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