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
b967a86c
Commit
b967a86c
authored
Nov 16, 2023
by
Mustafa Tekpinar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted the tranposed escott output to ranksorted format.
parent
885b6e63
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
escott.py
prescott/escott.py
+29
-5
No files found.
prescott/escott.py
View file @
b967a86c
...
@@ -1415,10 +1415,34 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
...
@@ -1415,10 +1415,34 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
colorMap
=
colormap
,
offSet
=
offset
,
pixelType
=
'square'
,
\
colorMap
=
colormap
,
offSet
=
offset
,
pixelType
=
'square'
,
\
sequence
=
prot
+
".fasta"
,
interactive
=
False
,
isColorBarOn
=
True
)
sequence
=
prot
+
".fasta"
,
interactive
=
False
,
isColorBarOn
=
True
)
#Convert standard combined output to
a
transposed format to increase
#Convert standard combined output to
(1 minus) ranksorted
transposed format to increase
#legibility.
#legibility
and interpretibility
.
gemmeDF
=
pd
.
read_table
(
prot
+
"_normPred_evolCombi.txt"
,
sep
=
"
\
s+"
)
gemmeDF
=
pd
.
read_table
(
prot
+
"_normPred_evolCombi.txt"
,
sep
=
"
\
s+"
)
gemmeDFtrans
=
gemmeDF
.
T
# print(gemmeDF)
######################################################################
# Convert the DataFrame to a NumPy matrix
from
scipy.stats
import
rankdata
import
numpy
as
np
#matrix = gemmeDF.to_numpy()
maxValue
=
np
.
nanmax
(
gemmeDF
.
to_numpy
())
# print(maxValue)
matrix
=
gemmeDF
.
to_numpy
(
na_value
=
maxValue
)
# Use rankdata to get the ranks for all values in the matrix
ranks
=
1.0
-
rankdata
(
matrix
,
method
=
'average'
)
/
len
(
matrix
.
flatten
())
# Reshape the ranks back to the original matrix shape
ranks_matrix
=
ranks
.
reshape
(
matrix
.
shape
)
# Convert the ranks matrix back to a DataFrame
df_ranks
=
pd
.
DataFrame
(
ranks_matrix
,
columns
=
gemmeDF
.
columns
,
index
=
gemmeDF
.
index
)
# df_ranks.set_index(gemmeDF.index.tolist(), inplace=True)
# print(df_ranks)
gemmeDFtrans
=
df_ranks
.
T
######################################################################
# gemmeDFtrans = gemmeDF.T
# print(gemmeDF)
# print(gemmeDF)
gemmeDFtrans
.
columns
=
gemmeDFtrans
.
columns
.
str
.
upper
()
gemmeDFtrans
.
columns
=
gemmeDFtrans
.
columns
.
str
.
upper
()
aaAndPosition
=
[]
aaAndPosition
=
[]
...
@@ -1431,7 +1455,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
...
@@ -1431,7 +1455,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
# gemmeDFtrans.rename(index=aaAndPosition, inplace=True)
# gemmeDFtrans.rename(index=aaAndPosition, inplace=True)
# gemmeDFtrans['pos'] = aaAndPosition
# gemmeDFtrans['pos'] = aaAndPosition
#print(df['pos'])
#print(df['pos'])
gemmeDFtrans
.
to_csv
(
prot
+
"_normPred_evolCombiTransposed.txt"
,
sep
=
'
\t
'
,
float_format
=
'
%.2
f'
,
na_rep
=
'NaN'
)
gemmeDFtrans
.
to_csv
(
prot
+
"_normPred_evolCombiTransposed
Ranksorted
.txt"
,
sep
=
'
\t
'
,
float_format
=
'
%.2
f'
,
na_rep
=
'NaN'
)
#sys.exit(-1)
#sys.exit(-1)
else
:
else
:
...
@@ -1443,7 +1467,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
...
@@ -1443,7 +1467,7 @@ def doit(inAli,mutFile,retMet,bFile,fFile,n,N, jetfile, pdbfile, normWeightMode,
def
main
():
def
main
():
"""
"""
Main function (and yes, I know. The name and the documentation are ingenious :).
Main function (and yes, I know. The name and the
function
documentation are ingenious :).
"""
"""
tic
=
time
.
perf_counter
()
tic
=
time
.
perf_counter
()
...
...
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