Commit 4e82cee0 by Mustafa Tekpinar

Changed editConfJET to editConfJETpython to reduce bash dependency.

parent aabe1568
......@@ -19,6 +19,7 @@ import glob
from prody import *
from scipy.stats import rankdata
from Bio import AlignIO
#from gemmeAnal import *
......@@ -50,18 +51,30 @@ def extractQuerySeq(filename):
fOUT.close()
return prot,seq,i-1
def getNbSeq(filename):
#TODO: Remove bash dependency and count the sequences within Python!
"""
# Get the number of sequences in a multi-fasta file
# def getNbSeq(filename):
# #TODO: Remove bash dependency and count the sequences within Python!
# """
# # Get the number of sequences in a multi-fasta file
"""
if filename!='':
proc=subprocess.Popen("grep -c '^>' "+filename,stdout=subprocess.PIPE,shell=True)
return int(proc.stdout.read())
else:
return 0
# """
# if filename!='':
# proc=subprocess.Popen("grep -c '^>' "+filename,stdout=subprocess.PIPE,shell=True)
# return int(proc.stdout.read())
# else:
# 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):
"""
If there is not a real PDB file for a given sequence,
......@@ -80,12 +93,27 @@ def createPDB(prot,seq):
i += 1
fOUT.close()
def editConfJET(N):
"""
# 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)
return(reCode)
# def editConfJET(N):
# """
# # 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)
# 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):
"""
......@@ -147,7 +175,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
if bFile!='':
#TODO: I think these two lines must be here as well but I am not sure.
# print(N)
# editConfJET(N)
# editConfJETpython(N)
if(bFile == prot+"_"+chainID+".psiblast"):
shutil.copy2(bFile, bFile+".orig")
......@@ -166,7 +194,7 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
else:
print(N)
editConfJET(N)
editConfJETpython(N)
if(fFile == prot+"_"+chainID+".fasta"):
shutil.copy2(fFile, fFile+".orig")
......
......@@ -15,34 +15,38 @@ elif [ "$1" == "jetoff" ]
then
# 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
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!"
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" ]
then
#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!"
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" ]
then
#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!"
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" ]
then
#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!"
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
echo "Running SGEMME with a user-provided alignment file."
python $SGEMME_PATH/sgemme.py aliBLAT.fasta -r input -f aliBLAT.fasta
echo "Running EGEMME with a user-provided alignment file."
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
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