Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Louis BECQUEY
/
RNANet
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Louis BECQUEY
2020-03-20 16:01:32 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a6ac991b27fc17220a3bee6f6744588015880127
a6ac991b
1 parent
ee5f1256
parallel computation of distance matrices
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
statistics.py
statistics.py
View file @
a6ac991
...
...
@@ -3,10 +3,8 @@ import os
import
numpy
as
np
import
pandas
as
pd
import
threading
as
th
import
seaborn
as
sb
import
scipy.stats
as
st
import
matplotlib.pyplot
as
plt
import
pylab
import
scipy.cluster.hierarchy
as
sch
from
scipy.spatial.distance
import
squareform
from
mpl_toolkits.mplot3d
import
axes3d
...
...
@@ -186,6 +184,8 @@ def stats_len(mappings_list, points):
plt
.
savefig
(
"results/full_length_distribs.png"
)
def
to_dist_matrix
(
f
):
if
path
.
isfile
(
"data/"
+
f
+
".npy"
):
return
0
print
(
f
)
dm
=
DistanceCalculator
(
'identity'
)
with
open
(
path_to_seq_data
+
"realigned/"
+
f
+
"++.afa"
)
as
al_file
:
...
...
@@ -198,13 +198,21 @@ def to_dist_matrix(f):
return
0
def
seq_idty
(
mappings_list
):
# compute distance matrices
p
=
Pool
(
processes
=
8
)
pbar
=
tqdm
(
total
=
len
(
mappings_list
.
keys
()),
desc
=
"RNA families"
,
position
=
0
,
leave
=
True
)
for
i
,
_
in
enumerate
(
p
.
imap_unordered
(
to_dist_matrix
,
sorted
(
mappings_list
.
keys
()))):
pbar
.
update
(
1
)
pbar
.
close
()
p
.
close
()
p
.
join
()
# load them
fam_arrays
=
[]
for
f
in
sorted
(
mappings_list
.
keys
()):
if
path
.
isfile
(
"data/"
+
f
+
".npy"
):
fam_arrays
.
append
(
np
.
load
(
"data/"
+
f
+
".npy"
))
else
:
# to_dist_matrix(f)
# fam_arrays.append(np.load("data/"+f+".npy"))
fam_arrays
.
append
([])
fig
,
axs
=
plt
.
subplots
(
11
,
7
,
figsize
=
(
25
,
25
))
...
...
@@ -289,4 +297,4 @@ if __name__ == "__main__":
seq_idty
(
mappings_list
)
# stats_len(mappings_list, rna_points)
\ No newline at end of file
...
...
Please
register
or
login
to post a comment