Commit 90e5f3e6 by Mustafa Tekpinar

Added ssjetormax normalization weight mode.

parent fcd3b21b
......@@ -253,6 +253,17 @@ if((normWeightMode=="maxtracepc") | (normWeightMode=="maxpctrace")){
for (row in 1:nrow(jet)) {
trace<-append(trace, jet[row, "bfactor"])
}
}else if (normWeightMode=="ssjetormax"){
print("Using only ssjetormax")
for (row in 1:nrow(jet)) {
if(sum(colnames(jet)=="ssjetormax")==1){
trace<-append(trace, jet[row, "ssjetormax"])
}else{
print("No field called ssjetormax in the JET output!")
quit(status=-1)
}
}
}else{
print("ERROR: Unknown --normWeightMode selected!")
print("It can only be 'trace', 'tracemovingaverage', 'pc', 'cv', 'dfi', 'bfactor',")
......
......@@ -235,17 +235,19 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
# Run Rscript to compute predictions
def launchPred(prot,inAli,mutFile, normWeightMode, alphabet):
SGEMME_DEV_PATH="/home/tekpinar/research/lcqb/SGEMME-dev-ss-based-jetormax"
if (mutFile!=''):
rcmd="Rscript --save "+SGEMME_DEV_PATH+"/computePred.R "+prot+" "+inAli+" FALSE "+mutFile+" "+normWeightMode+" "+alphabet
#TODO: remember that there is a problem here!!!!
else:
rcmd="Rscript --save "+SGEMME_DEV_PATH+"/computePred.R "+prot+" "+inAli+" TRUE none "+normWeightMode+" "+alphabet
if mutFile!='':
rcmd="Rscript --save $SGEMME_PATH/computePred.R "+prot+" "+inAli+" FALSE "+mutFile+" "+normWeightMode+" "+alphabet
else:
rcmd="Rscript --save $SGEMME_PATH/computePred.R "+prot+" "+inAli+" TRUE none "+normWeightMode+" "+alphabet
print("\nRunning: \n"+rcmd)
reCode=subprocess.call(rcmd,shell=True)
print("\nRunning: \n"+rcmd)
reCode=subprocess.call(rcmd,shell=True)
#Add plots here with gemmemore
return(reCode)
return(reCode)
# Remove temporary files
def cleanTheMess(prot,bFile,fFile, chainID):
......@@ -784,6 +786,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
(normWeightMode != 'maxtracehalftracecvhalfcvpc') and \
(normWeightMode != 'maxhalftracepchalftracecvhalfcvpc') and \
(normWeightMode != 'jetormax') and \
(normWeightMode != 'ssjetormax') and \
(normWeightMode != 'tracemovingaverage') and \
(normWeightMode != 'maxtracehalfpccv')):
print("ERROR: normWeightMode can only be 'trace', 'tracemovingaverage', 'cv', 'pc', 'dfi', bfactor,\n"+\
......@@ -835,6 +838,39 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
df.to_csv(prot+"_jet.res", header=True, index=None, sep='\t', mode='w')
print(df)
if((normWeightMode=='ssjetormax')):
if (pdbfile == None):
print("ERROR: There is not any pdb file to calculate DFI.")
sys.exit(-1)
else:
#proc=subprocess.Popen("python /home/tekpinar/software/scripts/python_scripts/biotite-secondary-structure.py "+pdbfile+" "+pdbfile+".dssp",stdout=subprocess.PIPE,shell=True)
os.system("python /home/tekpinar/software/scripts/python_scripts/biotite-secondary-structure.py "+pdbfile+" "+pdbfile+".dssp")
os.system("python /home/tekpinar/software/scripts/python_scripts/count-coil-segments-v2.py "+pdbfile+".dssp >"+pdbfile+".dssp.new")
df = pd.read_table(prot+"_jet.res", sep="\s+")
print(df['pos'])
print(pdbfile+".dssp")
print(os.getcwd())
df2 = pd.read_table(pdbfile+".dssp.new", header=None, sep=",")
df2.columns = ['pos', 'ss', 'length']
print(df2)
mergedRes = pd.merge(df, df2, on ='pos', right_index=False)
print(mergedRes)
ssjetormaxList = []
maxCoilLength = 5
print("WARNING: Max. coil length = {}".format(maxCoilLength))
for index, row in mergedRes.iterrows():
if(row['ss']=='C') and (row['length']>maxCoilLength):
ssjetormaxList.append(row['trace'])
else:
maxVal = max([((row['trace']+row['pc'])/2.0), ((row['trace']+row['cv'])/2.0), ((row['cv']+row['pc'])/2.0)])
ssjetormaxList.append(maxVal)
#ssjetormaxList=rankSortProteinData(ssjetormaxList, inverted=False)
df['ssjetormax'] = ssjetormaxList
df['ssjetormax'] = df['ssjetormax'].round(decimals = 4)
df.to_csv(prot+"_jet.res", header=True, index=None, sep='\t', mode='w')
#sys.exit(-1)
#If a real pdb file is given, calculate dfi for the residues.
if(((normWeightMode=='tracemovingaverage'))):
......
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