Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cnvCallerGPU
Project
Project
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
gad-public
cnvCallerGPU
Commits
773d7dc8
Commit
773d7dc8
authored
May 16, 2024
by
Theo Serralta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize function calcul_mappability
parent
6ed38039
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
test_gpu_mean_depth.py
CNV/test_gpu_mean_depth.py
+14
-7
No files found.
CNV/test_gpu_mean_depth.py
View file @
773d7dc8
...
...
@@ -8,7 +8,6 @@ import pycuda.autoinit
from
pycuda.compiler
import
SourceModule
import
pycuda.gpuarray
as
gpuarray
from
pycuda.autoinit
import
context
from
bisect
import
bisect_right
# Options
try
:
...
...
@@ -157,16 +156,24 @@ def dico_mappabilite(mappability_file):
return
mappability_dico
#Dictionnaire avec les bornes de mappabilité en fonction des positions pour chaque chromosome.
def
calcul_mappability
(
seq_length
,
mappability
,
chr
):
map_data
=
np
.
zeros
(
seq_length
,
dtype
=
np
.
float32
)
map_data
=
np
.
zeros
(
seq_length
,
dtype
=
np
.
float32
)
sys
.
stderr
.
write
(
"
\t
map_data =
\n
"
)
sorted_keys
=
sorted
(
mappability
[
chr
]
.
keys
())
sys
.
stderr
.
write
(
"
\t
sorted_keys =
\n
"
)
for
i
in
range
(
seq_length
):
bound_index
=
bisect_right
(
sorted_keys
,
i
)
-
1
nearest_bound
=
sorted_keys
[
bound_index
]
if
bound_index
>=
0
else
0
map_data
[
i
]
=
mappability
[
chr
][
nearest_bound
]
#print(f" i : {i}\t sorted_keys[i] : {sorted_keys[i]}\tbound_index : {bound_index}\t nearest_bound : {nearest_bound}\t map_data[i] : {map_data[i]}\t sorted_keys[bound_index] : {sorted_keys[bound_index]}")
prev_bound
=
0
prev_mappability
=
0
for
bound
in
sorted_keys
:
for
i
in
range
(
prev_bound
,
min
(
seq_length
,
bound
)):
map_data
[
i
]
=
prev_mappability
prev_bound
=
bound
prev_mappability
=
mappability
[
chr
][
bound
]
# Fill remaining positions if sequence length exceeds last bound
for
i
in
range
(
prev_bound
,
seq_length
):
map_data
[
i
]
=
prev_mappability
return
map_data
#############################################
...
...
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