Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PyFastANI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Martin Larralde
PyFastANI
Commits
5dea6475
Commit
5dea6475
authored
3 years ago
by
Martin Larralde
Browse files
Options
Downloads
Patches
Plain Diff
Relax the GIL in `Mapper._query_contigs` to allow multithreaded querying
parent
77122ddc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyfastani/_fastani.pyx
+24
-23
24 additions, 23 deletions
pyfastani/_fastani.pyx
with
24 additions
and
23 deletions
pyfastani/_fastani.pyx
+
24
−
23
View file @
5dea6475
...
...
@@ -230,15 +230,15 @@ cdef class Mapper:
# check the sequence is large enough to compute minimizers
if
seq
.
shape
[
0
]
>=
param
.
windowSize
and
seq
.
shape
[
0
]
>=
param
.
kmerSize
:
# WARNING: Normally kseq_t owns the buffer, but here we just give
# a view to avoid reallocation if possible. However,
# `addMinimizers` will always attempt to make the
# sequence uppercase, so it should be checked in
# advance that the sequence is already uppercase.
kseq
.
seq
.
l
=
kseq
.
seq
.
m
=
seq
.
shape
[
0
]
kseq
.
seq
.
s
=
<
char
*>
<
const
unsigned
char
*>
&
seq
[
0
]
# compute the minimizers
with
nogil
:
# WARNING: Normally kseq_t owns the buffer, but here we just give
# a view to avoid reallocation if possible. However,
# `addMinimizers` will always attempt to make the
# sequence uppercase, so it should be checked in
# advance that the sequence is already uppercase.
kseq
.
seq
.
l
=
kseq
.
seq
.
m
=
seq
.
shape
[
0
]
kseq
.
seq
.
s
=
<
char
*>
<
const
unsigned
char
*>
&
seq
[
0
]
# compute the minimizers
addMinimizers
(
self
.
_sk
.
minimizerIndex
,
&
kseq
,
...
...
@@ -336,8 +336,8 @@ cdef class Mapper:
# --- Methods (querying) -------------------------------------------------
@staticmethod
cdef
void
_query_fragment
(
self
,
int
i
,
seqno_t
seq_counter
,
...
...
@@ -406,20 +406,21 @@ cdef class Mapper:
# query if the sequence is large enough
if
seql
>=
p
.
windowSize
and
seql
>=
p
.
kmerSize
and
seql
>=
p
.
minReadLength
:
# compute the expected number of blocks
fragment_count
=
seql
//
p
.
minReadLength
# map the blocks
for
i
in
range
(
fragment_count
):
self
.
_query_fragment
(
i
,
total_fragments
,
seq
,
p
.
minReadLength
,
map
,
&
kseq
,
&
out
,
&
final_mappings
)
with
nogil
:
# compute the expected number of blocks
fragment_count
=
seql
//
p
.
minReadLength
# map the blocks
for
i
in
range
(
fragment_count
):
Mapper
.
_query_fragment
(
i
,
total_fragments
,
seq
,
p
.
minReadLength
,
map
,
&
kseq
,
&
out
,
&
final_mappings
)
# record the number of fragments
total_fragments
+=
fragment_count
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment