Commit 898d9ad2 by Mustafa Tekpinar

Added --verbose option to the esgemme.py arguments.

--verbose option controls if epistatic and independent
results files will be written or not. It is False by
default and therefore, the files are not written.
parent 3509620e
...@@ -317,7 +317,7 @@ def launchPred(prot,inAli,mutFile, normWeightMode, alphabet): ...@@ -317,7 +317,7 @@ def launchPred(prot,inAli,mutFile, normWeightMode, alphabet):
return(reCode) return(reCode)
# Remove temporary files # Remove temporary files
def cleanTheMess(prot,bFile,fFile, chainID): def cleanTheMess(prot,bFile,fFile, chainID, verbosity=False):
if bFile!='': if bFile!='':
if bFile!=prot+"_"+chainID+".psiblast": if bFile!=prot+"_"+chainID+".psiblast":
...@@ -360,6 +360,13 @@ def cleanTheMess(prot,bFile,fFile, chainID): ...@@ -360,6 +360,13 @@ def cleanTheMess(prot,bFile,fFile, chainID):
if os.path.isfile("default.conf"): if os.path.isfile("default.conf"):
os.remove("default.conf") os.remove("default.conf")
if verbosity == False:
if os.path.isfile(prot+"_normPred_evolInd.txt"):
os.remove(prot+"_normPred_evolInd.txt")
if os.path.isfile(prot+"_normPred_evolEpi.txt"):
os.remove(prot+"_normPred_evolEpi.txt")
############################################################################### ###############################################################################
def rankSortProteinData(dataArray, inverted=True): def rankSortProteinData(dataArray, inverted=True):
...@@ -777,7 +784,7 @@ def countCoilSegments(inputfile): ...@@ -777,7 +784,7 @@ def countCoilSegments(inputfile):
def parse_command_line(): def parse_command_line():
""" """
Parse command line. Parse command line.
It uses argparse to parse esgemme' command line arguments and returns the It uses argparse to parse 'esgemme' command line arguments and returns the
argparse parser. argparse parser.
""" """
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
...@@ -802,7 +809,10 @@ def parse_command_line(): ...@@ -802,7 +809,10 @@ def parse_command_line():
parser.add_argument( parser.add_argument(
'-m', '--mutations', '-m', '--mutations',
help='text file containing the mutations of interest. Each line of the file should contain a mutation (e.g. D136R) or combination of mutations separated by commas and ordered according to their positions in the sequence (e.g. D136R,V271A)', help='text file containing the mutations of interest. Each line of the '+\
'file should contain a mutation (e.g. D136R) or combination of '+\
'mutations separated by colons and ordered according to their '+\
'positions in the sequence (e.g. D136R:V271A)',
default='' default=''
) )
...@@ -844,19 +854,25 @@ def parse_command_line(): ...@@ -844,19 +854,25 @@ def parse_command_line():
help="If a jet file is provided, it will skip JET2 calculation and use the precalculated JET2 data in that file. Default is None", help="If a jet file is provided, it will skip JET2 calculation and use the precalculated JET2 data in that file. Default is None",
required=False, default=None) required=False, default=None)
retMet_args.add_argument('--alphabet', dest='alphabet', type=str, \ parser.add_argument('--alphabet', dest='alphabet', type=str, \
help="Which alphabet to use. Default is lw-i.7", help="Which alphabet to use. Default is lw-i.7",
required=False, default="lw-i.7") required=False, default="lw-i.7")
retMet_args.add_argument('-p', '--pdbfile', dest='pdbfile', type=str, \ parser.add_argument('-p', '--pdbfile', dest='pdbfile', type=str, \
help="If a pdb file is provided, it will skip fake pdb file production step and use that file. Default is None", help="If a pdb file is provided, it will skip fake pdb file production step and use that file. Default is None",
required=False, default=None) required=False, default=None)
retMet_args.add_argument('--normweightmode', dest='normweightmode', type=str, \ parser.add_argument('--normweightmode', dest='normweightmode', type=str, \
help="It can be one of these: 'tjet', 'cv', 'pc',"+\ help="It can be one of these: 'tjet', 'cv', 'pc',"+\
"max, tjetormax or sstjetormax. Default is 'tjet'.", "max, tjetormax or sstjetormax. Default is 'tjet'.",
required=False, default="tjet") required=False, default="tjet")
parser.add_argument('--verbose', dest='verbose', type=bool, \
help="This argument controls amount of the output. Default is 'False'."+\
"If it is set to 'True', it will print independent and epistatic"+\
"score files as well combined combined score file.",
required=False, default=False)
args = parser.parse_args() args = parser.parse_args()
arg_dict = vars(args) arg_dict = vars(args)
...@@ -870,7 +886,7 @@ def parse_command_line(): ...@@ -870,7 +886,7 @@ def parse_command_line():
return args return args
def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode, alphabet): def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode, alphabet, verbosity):
""" """
Perfect explanation for a function: typing the function call exactly! Perfect explanation for a function: typing the function call exactly!
doit is basically the main function in disguise! doit is basically the main function in disguise!
...@@ -1032,22 +1048,16 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode, ...@@ -1032,22 +1048,16 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
if(simple): if(simple):
print("generating the plots...") print("generating the plots...")
#Check if the normalized data files were created. #Check if the normalized data files were created.
if(os.path.exists(prot+"_normPred_evolEpi.txt")): if(os.path.exists(prot+"_normPred_evolEpi.txt") and args.verbose==True):
gemmeData = parseGEMMEoutput(prot+"_normPred_evolEpi.txt", verbose=False) gemmeData = parseGEMMEoutput(prot+"_normPred_evolEpi.txt", verbose=False)
plotGEMMEmatrix(gemmeData, prot+"_normPred_evolEpi.png", 1, None,\ plotGEMMEmatrix(gemmeData, prot+"_normPred_evolEpi.png", 1, None,\
colorMap='Blues_r', offSet=0, pixelType='square') colorMap='Blues_r', offSet=0, pixelType='square')
else:
print("ERROR: "+prot+"_normPred_evolEpi.txt file does not exist!")
print(" Can not generate "+prot+"_normPred_evolEpi.png file!")
#Check if the normalized data files were created. #Check if the normalized data files were created.
if(os.path.exists(prot+"_normPred_evolInd.txt")): if(os.path.exists(prot+"_normPred_evolInd.txt") and args.verbose==True):
gemmeData = parseGEMMEoutput(prot+"_normPred_evolInd.txt", verbose=False) gemmeData = parseGEMMEoutput(prot+"_normPred_evolInd.txt", verbose=False)
plotGEMMEmatrix(gemmeData, prot+"_normPred_evolInd.png", 1, None,\ plotGEMMEmatrix(gemmeData, prot+"_normPred_evolInd.png", 1, None,\
colorMap='Greens_r', offSet=0, pixelType='square') colorMap='Greens_r', offSet=0, pixelType='square')
else:
print("ERROR: "+prot+"_normPred_evolInd.txt file does not exist!")
print(" Can not generate "+prot+"_normPred_evolInd.png file!")
#Check if the normalized data files were created. #Check if the normalized data files were created.
if(os.path.exists(prot+"_normPred_evolCombi.txt")): if(os.path.exists(prot+"_normPred_evolCombi.txt")):
...@@ -1073,14 +1083,13 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode, ...@@ -1073,14 +1083,13 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
#print(df['pos']) #print(df['pos'])
gemmeDFtrans.to_csv(prot+"_normPred_evolCombiTransposed.txt", sep='\t', float_format='%.2f', na_rep='NaN') gemmeDFtrans.to_csv(prot+"_normPred_evolCombiTransposed.txt", sep='\t', float_format='%.2f', na_rep='NaN')
#sys.exit(-1) #sys.exit(-1)
else: else:
print("ERROR: "+prot+"_normPred_evolCombi.txt file does not exist!") print("ERROR: "+prot+"_normPred_evolCombi.txt file does not exist!")
print(" Can not generate "+prot+"_normPred_evolCombi.png file!") print(" Can not generate "+prot+"_normPred_evolCombi.png file!")
print("done") print("done")
cleanTheMess(prot,bFile,fFile, chainID=chains[0]) cleanTheMess(prot,bFile,fFile, chainID=chains[0], verbosity=verbosity)
if (__name__ == '__main__'): if (__name__ == '__main__'):
tic = time.perf_counter() tic = time.perf_counter()
...@@ -1088,7 +1097,7 @@ if (__name__ == '__main__'): ...@@ -1088,7 +1097,7 @@ if (__name__ == '__main__'):
args = parse_command_line() args = parse_command_line()
doit(args.input, args.mutations, args.retrievingMethod, args.blastFile,\ doit(args.input, args.mutations, args.retrievingMethod, args.blastFile,\
args.fastaFile, args.nIter,args.NSeqs, args.jetfile, args.pdbfile,\ args.fastaFile, args.nIter,args.NSeqs, args.jetfile, args.pdbfile,\
args.normweightmode, args.alphabet) args.normweightmode, args.alphabet, args.verbose)
toc = time.perf_counter() toc = time.perf_counter()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment