Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PRESCOTT
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mustafa Tekpinar
PRESCOTT
Commits
f469ecb8
Commit
f469ecb8
authored
Mar 15, 2023
by
Mustafa Tekpinar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed default.conf file copy process from bash to more Pythonic way.
parent
b20bee53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
77 deletions
+82
-77
esgemme.py
esgemme.py
+82
-77
No files found.
esgemme.py
View file @
f469ecb8
...
...
@@ -127,7 +127,7 @@ def minMaxNormalization(data):
# Run JET to compute TJET values
def
launchJET
(
prot
,
retMet
,
bFile
,
fFile
,
pdbfile
,
chains
,
n
,
N
,
nl
):
"""
"""
Call JET2 and produce prot+"_jet.res" file.
prot+"_jet.res" will be used in the following steps (in launchPred)
...
...
@@ -168,102 +168,107 @@ def launchJET(prot, retMet, bFile, fFile, pdbfile, chains, n, N, nl):
Returns
-------
Nothing
"""
"""
chainID
=
chains
[
0
]
chainID
=
chains
[
0
]
#TODO: Remove Bash dependency here. Make the copying process in Python
subprocess
.
call
(
"cp $ESGEMME_PATH/default.conf ."
,
shell
=
True
)
#subprocess.call("cp $ESGEMME_PATH/default.conf .",shell=True)
esgemme_path
=
os
.
path
.
expandvars
(
'$ESGEMME_PATH'
)
shutil
.
copy2
(
os
.
path
.
join
(
esgemme_path
,
"default.conf"
),
os
.
getcwd
())
if
retMet
==
"input"
:
if
bFile
!=
''
:
if
retMet
==
"input"
:
if
bFile
!=
''
:
#TODO: I think these two lines must be here as well but I am not sure.
# print(N)
# editConfJETpython(N)
if
(
bFile
==
prot
+
"_"
+
chainID
+
".psiblast"
):
shutil
.
copy2
(
bFile
,
bFile
+
".orig"
)
shutil
.
copy2
(
bFile
+
".orig "
,
prot
+
"_"
+
chainID
+
".psiblast"
)
else
:
shutil
.
copy2
(
bFile
+
" "
,
prot
+
"_"
+
chainID
+
".psiblast"
)
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
if
(
bFile
==
prot
+
"_"
+
chainID
+
".psiblast"
):
shutil
.
copy2
(
bFile
,
bFile
+
".orig"
)
shutil
.
copy2
(
bFile
+
".orig "
,
prot
+
"_"
+
chainID
+
".psiblast"
)
else
:
shutil
.
copy2
(
bFile
+
" "
,
prot
+
"_"
+
chainID
+
".psiblast"
)
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p J -r input -b "
+
prot
+
"_"
+
chainID
+
".psiblast -d chain -n "
+
n
+
" > "
+
prot
+
".out"
else
:
else
:
# jetcmd = "java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "+\
# prot+".pdb -o `pwd` -p AVJ -r input -b "+prot+"_"+chainID+".psiblast -d chain -n "+n+" > "+prot+".out"
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p AVJCG -r input -f "
+
prot
+
"_"
+
chainID
+
".psiblast -d chain -n "
+
n
+
" -a 5"
+
" > "
+
prot
+
".out"
#One can also add: -g 'trace,pc,cv,clusters,axs'
else
:
print
(
N
)
editConfJETpython
(
N
)
if
(
fFile
==
prot
+
"_"
+
chainID
+
".fasta"
):
shutil
.
copy2
(
fFile
,
fFile
+
".orig"
)
#I think this subprocess call causes overwriting of the fasta file.
#subprocess.call("cp "+fFile+" "+prot+"_"+chainID+".fasta",shell=True)
grpcmd
=
"grep -m "
+
str
(
int
(
N
)
+
1
)
+
" -A "
+
str
(
nl
)
+
" '^>' "
+
fFile
+
".orig > "
+
prot
+
"_"
+
chainID
+
".fasta"
else
:
#subprocess.call("cp "+fFile+" "+prot+"_"+chainID+".fasta",shell=True)
grpcmd
=
"grep -m "
+
str
(
int
(
N
)
+
1
)
+
" -A "
+
str
(
nl
)
+
" '^>' "
+
fFile
+
" > "
+
prot
+
"_"
+
chainID
+
".fasta"
else
:
print
(
N
)
editConfJETpython
(
N
)
if
(
fFile
==
prot
+
"_"
+
chainID
+
".fasta"
):
shutil
.
copy2
(
fFile
,
fFile
+
".orig"
)
#I think this subprocess call causes overwriting of the fasta file.
#subprocess.call("cp "+fFile+" "+prot+"_"+chainID+".fasta",shell=True)
grpcmd
=
"grep -m "
+
str
(
int
(
N
)
+
1
)
+
" -A "
+
str
(
nl
)
+
" '^>' "
+
fFile
+
".orig > "
+
prot
+
"_"
+
chainID
+
".fasta"
else
:
#subprocess.call("cp "+fFile+" "+prot+"_"+chainID+".fasta",shell=True)
grpcmd
=
"grep -m "
+
str
(
int
(
N
)
+
1
)
+
" -A "
+
str
(
nl
)
+
" '^>' "
+
fFile
+
" > "
+
prot
+
"_"
+
chainID
+
".fasta"
print
(
"
\n
Running:
\n
"
+
grpcmd
)
subprocess
.
call
(
grpcmd
,
shell
=
True
)
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p J -r input -f "
+
prot
+
"_"
+
chainID
+
".fasta -d chain -n "
+
n
+
" > "
+
prot
+
".out"
print
(
"
\n
Running command:
\n
"
+
jetcmd
)
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
else
:
# Calculate SC1
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p AVJCG -r input -f "
+
prot
+
"_"
+
chainID
+
".fasta -d chain -n "
+
n
+
" -a 3"
+
" > "
+
prot
+
".out"
#One can also add: -g 'trace,pc,cv,clusters,axs'
print
(
"
\n
Running for SC1:
\n
"
+
jetcmd
)
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
dir_name
=
prot
+
"/"
if
os
.
path
.
isdir
(
dir_name
):
for
f
in
os
.
listdir
(
dir_name
):
f_path
=
os
.
path
.
join
(
dir_name
,
f
)
if
os
.
path
.
isfile
(
f_path
):
os
.
remove
(
f_path
)
os
.
rmdir
(
dir_name
)
print
(
"
\n
Running:
\n
"
+
grpcmd
)
subprocess
.
call
(
grpcmd
,
shell
=
True
)
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p J -r input -f "
+
prot
+
"_"
+
chainID
+
".fasta -d chain -n "
+
n
+
" > "
+
prot
+
".out"
print
(
"
\n
Running command:
\n
"
+
jetcmd
)
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
else
:
# Calculate SC1
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p AVJCG -r input -f "
+
prot
+
"_"
+
chainID
+
".fasta -d chain -n "
+
n
+
" -a 3"
+
" > "
+
prot
+
".out"
#One can also add: -g 'trace,pc,cv,clusters,axs'
print
(
"
\n
Running for SC1:
\n
"
+
jetcmd
)
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
dir_name
=
prot
+
"/"
if
os
.
path
.
isdir
(
dir_name
):
for
f
in
os
.
listdir
(
dir_name
):
f_path
=
os
.
path
.
join
(
dir_name
,
f
)
if
os
.
path
.
isfile
(
f_path
):
os
.
remove
(
f_path
)
os
.
rmdir
(
dir_name
)
else
:
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p J -r "
+
retMet
+
" -d chain -n "
+
n
+
" > "
+
prot
+
".out"
else
:
# jetcmd = "java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "+\
# prot+".pdb -o `pwd` -p AVJ -r "+retMet+" -d chain -n "+n+" > "+prot+".out"
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p AVJCG -r "
+
retMet
+
" -d chain -n "
+
n
+
" -a 5"
+
" > "
+
prot
+
".out"
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
dir_name
=
prot
+
"/"
if
os
.
path
.
isdir
(
dir_name
):
for
f
in
os
.
listdir
(
dir_name
):
f_path
=
os
.
path
.
join
(
dir_name
,
f
)
if
os
.
path
.
isfile
(
f_path
):
os
.
remove
(
f_path
)
os
.
rmdir
(
dir_name
)
else
:
if
(
pdbfile
==
None
):
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p J -r "
+
retMet
+
" -d chain -n "
+
n
+
" > "
+
prot
+
".out"
else
:
# jetcmd = "java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "+\
# prot+".pdb -o `pwd` -p AVJ -r "+retMet+" -d chain -n "+n+" > "+prot+".out"
jetcmd
=
"java -Xmx4096m -cp $JET2_PATH:$JET2_PATH/jet/extLibs/vecmath.jar jet.JET -c default.conf -i "
+
\
prot
+
".pdb -o `pwd` -p AVJCG -r "
+
retMet
+
" -d chain -n "
+
n
+
" -a 5"
+
" > "
+
prot
+
".out"
reCode
=
subprocess
.
call
(
jetcmd
,
shell
=
True
)
if
os
.
path
.
isfile
(
prot
+
"/"
+
prot
+
"_jet.res"
):
os
.
rename
(
prot
+
"/"
+
prot
+
"_jet.res"
,
prot
+
"_jet.res"
)
dir_name
=
prot
+
"/"
if
os
.
path
.
isdir
(
dir_name
):
for
f
in
os
.
listdir
(
dir_name
):
f_path
=
os
.
path
.
join
(
dir_name
,
f
)
if
os
.
path
.
isfile
(
f_path
):
os
.
remove
(
f_path
)
os
.
rmdir
(
dir_name
)
# print("\nRunning:\n"+jetcmd)
# reCode=subprocess.call(jetcmd,shell=True)
# if os.path.isfile(prot+"/"+prot+"_jet.res"):
# os.rename(prot+"/"+prot+"_jet.res",prot+"_jet.res")
return
(
reCode
)
return
(
reCode
)
# Run Rscript to compute predictions
def
launchPred
(
prot
,
inAli
,
mutFile
,
normWeightMode
,
alphabet
):
...
...
@@ -654,7 +659,7 @@ def check_argument_groups(parser, arg_dict, group, argument):
group_name
=
group
.
replace
(
"-"
,
""
)
if
arg_dict
[
group_name
]
==
"input"
:
if
c
!=
1
:
parser
.
error
(
"esgemme requires "
+
str
(
argument
)
+
\
parser
.
error
(
"esgemme requires "
+
str
(
argument
)
+
\
" if "
+
group
+
" is set to input."
)
else
:
if
c
>
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment