Commit 4e82cee0 by Mustafa Tekpinar

Changed editConfJET to editConfJETpython to reduce bash dependency.

parent aabe1568
...@@ -19,6 +19,7 @@ import glob ...@@ -19,6 +19,7 @@ import glob
from prody import * from prody import *
from scipy.stats import rankdata from scipy.stats import rankdata
from Bio import AlignIO
#from gemmeAnal import * #from gemmeAnal import *
...@@ -50,18 +51,30 @@ def extractQuerySeq(filename): ...@@ -50,18 +51,30 @@ def extractQuerySeq(filename):
fOUT.close() fOUT.close()
return prot,seq,i-1 return prot,seq,i-1
def getNbSeq(filename): # def getNbSeq(filename):
#TODO: Remove bash dependency and count the sequences within Python! # #TODO: Remove bash dependency and count the sequences within Python!
""" # """
# Get the number of sequences in a multi-fasta file # # Get the number of sequences in a multi-fasta file
""" # """
if filename!='': # if filename!='':
proc=subprocess.Popen("grep -c '^>' "+filename,stdout=subprocess.PIPE,shell=True) # proc=subprocess.Popen("grep -c '^>' "+filename,stdout=subprocess.PIPE,shell=True)
return int(proc.stdout.read()) # return int(proc.stdout.read())
else: # else:
return 0 # return 0
# def getNbSeqPython(filename):
# #TODO: Remove bash dependency and count the sequences within Python!
# """
# Get the number of sequences in a multi-fasta file using only Python functions.
# """
# if ((filename != '') or (filename != None)):
# alignment = AlignIO.read(filename, "fasta")
# return int(len(alignment))
# else:
# print("ERROR: Could not find MSA file!")
# return 0
def createPDB(prot,seq): def createPDB(prot,seq):
""" """
If there is not a real PDB file for a given sequence, If there is not a real PDB file for a given sequence,
...@@ -80,12 +93,27 @@ def createPDB(prot,seq): ...@@ -80,12 +93,27 @@ def createPDB(prot,seq):
i += 1 i += 1
fOUT.close() fOUT.close()
def editConfJET(N): # def editConfJET(N):
""" # """
# Edit JET configuration file with correct number of Seqs & MSA # # Edit JET configuration file with correct number of Seqs & MSA
""" # """
reCode=subprocess.call("sed -i 's/results\t\t5000/results\t\t"+str(N)+"/' default.conf",shell=True) # reCode=subprocess.call("sed -i 's/results\t\t5000/results\t\t"+str(N)+"/' default.conf",shell=True)
return(reCode) # return(reCode)
def editConfJETpython(N):
"""
# Edit JET configuration file with correct number of Seqs & MSA
"""
with open("default.conf", "r+" ) as file:
fileContents = file.read()
textPattern = re.compile( re.escape("results\t\t5000"))
fileContents = textPattern.sub("results\t\t"+str(N), fileContents)
file.seek( 0 )
file.truncate()
file.write(fileContents)
#reCode=subprocess.call("sed -i 's/results\t\t5000/results\t\t"+str(N)+"/' default.conf",shell=True)
return 0
def minMaxNormalization(data): def minMaxNormalization(data):
""" """
...@@ -147,7 +175,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl): ...@@ -147,7 +175,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
if bFile!='': if bFile!='':
#TODO: I think these two lines must be here as well but I am not sure. #TODO: I think these two lines must be here as well but I am not sure.
# print(N) # print(N)
# editConfJET(N) # editConfJETpython(N)
if(bFile == prot+"_"+chainID+".psiblast"): if(bFile == prot+"_"+chainID+".psiblast"):
shutil.copy2(bFile, bFile+".orig") shutil.copy2(bFile, bFile+".orig")
...@@ -166,7 +194,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl): ...@@ -166,7 +194,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
else: else:
print(N) print(N)
editConfJET(N) editConfJETpython(N)
if(fFile == prot+"_"+chainID+".fasta"): if(fFile == prot+"_"+chainID+".fasta"):
shutil.copy2(fFile, fFile+".orig") shutil.copy2(fFile, fFile+".orig")
......
...@@ -15,34 +15,38 @@ elif [ "$1" == "jetoff" ] ...@@ -15,34 +15,38 @@ elif [ "$1" == "jetoff" ]
then then
# If you have your own JET2 score file, you can turn off JET2 as follows: # If you have your own JET2 score file, you can turn off JET2 as follows:
# In ../tests folder, you can find a sample JET2 file called BLAT_jet.res # In ../tests folder, you can find a sample JET2 file called BLAT_jet.res
echo "Running SGEMME with a user-provided alignment file." echo "Running ESGEMME with a user-provided alignment file."
echo "Using a previously produced prot_jet.res file to check reproducibility!" echo "Using a previously produced prot_jet.res file to check reproducibility!"
cp ../tests/BLAT_jet.res . cp ../tests/BLAT_jet.res .
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --jetfile BLAT_jet.res python $ESGEMME_PATH/esgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --jetfile BLAT_jet.res
elif [ "$1" == "withpdb" ] elif [ "$1" == "withpdb" ]
then then
#Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file. #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
echo "Using blat-af2.pdb for the structural feature calculations!" echo "Using blat-af2.pdb for the structural feature calculations!"
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode maxhalftracepchalftracecvhalfcvpc echo "Entire mutational map of the protein will be calculated!"
python $ESGEMME_PATH/esgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode maxhalftracepchalftracecvhalfcvpc
elif [ "$1" == "withpdb-withmutfile" ] elif [ "$1" == "withpdb-withmutfile" ]
then then
#Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file. #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
echo "Using blat-af2.pdb for the structural feature calculations!" echo "Using blat-af2.pdb for the structural feature calculations!"
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode maxhalftracepchalftracecvhalfcvpc -m Stiffler_2015_BLAT_ECOLX.mut echo "Only effects of mutations specified in the Stiffler_2015_BLAT_ECOLX.mut file will be calculated!"
python $ESGEMME_PATH/esgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode maxhalftracepchalftracecvhalfcvpc -m Stiffler_2015_BLAT_ECOLX.mut
elif [ "$1" == "ssjetormax" ] elif [ "$1" == "ssjetormax" ]
then then
#Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file. #Please note that CV isa structural feature and it can not be calculated if you don't specify a pdb file.
echo "Using blat-af2.pdb for the secondary structure based calculations!" echo "Using blat-af2.pdb for the secondary structure based calculations!"
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode ssjetormax -m Stiffler_2015_BLAT_ECOLX.mut echo "Only effects of mutations specified in the Stiffler_2015_BLAT_ECOLX.mut file will be calculated!"
python $ESGEMME_PATH/esgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta --pdbfile blat-af2.pdb --normweightmode ssjetormax -m Stiffler_2015_BLAT_ECOLX.mut
else else
echo "Running SGEMME with a user-provided alignment file." echo "Running EGEMME with a user-provided alignment file."
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta echo "Since a pdb file is not provided, only evolutionary information will be used!"
python $ESGEMME_PATH/esgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta
fi fi
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