Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fexi_splitter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LBMC
RMI2
fexi_splitter
Commits
ec4abf5c
Commit
ec4abf5c
authored
May 3, 2019
by
elabaron
Browse files
Options
Downloads
Patches
Plain Diff
suffic_tree.py: change missmatch to mismatch
parent
88f4e9c0
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/rmi_splitter/suffix_tree.py
+17
-17
17 additions, 17 deletions
src/rmi_splitter/suffix_tree.py
with
17 additions
and
17 deletions
src/rmi_splitter/suffix_tree.py
+
17
−
17
View file @
ec4abf5c
...
...
@@ -98,13 +98,13 @@ class Tree:
General suffixtree
"""
def
__init__
(
self
,
mis
s
match
=
None
):
def
__init__
(
self
,
mismatch
=
None
):
"""
Initialisation of a General suffixtree
"""
self
.
size
=
0
self
.
root
=
Node
()
self
.
mis
s
match
=
mis
s
match
self
.
mismatch
=
mismatch
def
__del__
(
self
):
self
.
root
.
__del__
()
...
...
@@ -141,7 +141,7 @@ class Tree:
qual
=
qual
,
tree
=
self
,
cache
=
cache
,
mis
s
match
=
self
.
mis
s
match
,
mismatch
=
self
.
mismatch
,
verbose
=
verbose
,
)
if
verbose
:
...
...
@@ -160,7 +160,7 @@ class TreeCrawler:
Helper Class to search suffixtree
"""
def
__init__
(
self
,
seq
,
qual
,
tree
,
cache
=
True
,
mis
s
match
=
None
,
def
__init__
(
self
,
seq
,
qual
,
tree
,
cache
=
True
,
mismatch
=
None
,
verbose
=
False
):
"""
Initialisation of a General suffixtree
...
...
@@ -171,7 +171,7 @@ class TreeCrawler:
self
.
qual
=
qual
self
.
tree
=
tree
self
.
barcode
=
None
self
.
mis
s
match
=
mis
s
match
self
.
mismatch
=
mismatch
if
verbose
:
print
(
self
.
seq
)
for
i
in
range
(
len
(
self
.
qual
)):
...
...
@@ -183,13 +183,13 @@ class TreeCrawler:
def
split_search
(
self
,
curr_node
,
pos
,
dist
=
0
,
verbose
=
False
):
"""
Multiply the barcode search in case of mis
s
match
Multiply the barcode search in case of mismatch
"""
if
verbose
:
print
((
pos
,
self
.
seq
[
pos
],
curr_node
.
base
,
list
(
curr_node
.
childs
.
keys
()),
dist
,
curr_node
.
barcode
))
if
len
(
self
.
seq
)
>
pos
+
1
:
# we search with n mis
s
match
# we search with n mismatch
for
base
in
curr_node
.
childs
.
keys
():
curr_dist
=
dist
search_result
=
curr_node
[
base
].
get_barcode
(
...
...
@@ -202,9 +202,9 @@ class TreeCrawler:
self
.
barcodes
.
append
(
search_result
[
0
])
else
:
# if no results with one missmath we search with n+1
# mis
s
match
if
self
.
mis
s
match
is
not
None
:
self
.
mis
s
match
-=
1
# mismatch
if
self
.
mismatch
is
not
None
:
self
.
mismatch
-=
1
curr_dist
+=
distance
(
qual
=
self
.
qual
,
pos
=
pos
+
1
)
self
.
split_search
(
curr_node
=
curr_node
[
base
],
...
...
@@ -243,8 +243,8 @@ class TreeCrawler:
pos
=
0
)
if
self
.
barcode
is
None
:
if
self
.
mis
s
match
is
not
None
:
self
.
mis
s
match
-=
1
if
self
.
mismatch
is
not
None
:
self
.
mismatch
-=
1
dist
=
distance
(
qual
=
self
.
qual
,
pos
=
pos
)
+
pos
self
.
split_search
(
curr_node
=
curr_node
,
...
...
@@ -256,8 +256,8 @@ class TreeCrawler:
print
((
self
.
barcodes
,
self
.
dists
))
if
self
.
barcodes
:
min_dist
=
max
(
self
.
dists
)
if
self
.
mis
s
match
is
not
None
:
if
self
.
mis
s
match
<
0
:
if
self
.
mismatch
is
not
None
:
if
self
.
mismatch
<
0
:
return
None
min_dist_index
=
self
.
dists
.
index
(
min_dist
)
self
.
barcode
=
self
.
barcodes
[
min_dist_index
]
...
...
@@ -272,12 +272,12 @@ class Forest:
"""
Forest of suffixtree
"""
def
__init__
(
self
,
mis
s
match
=
None
):
def
__init__
(
self
,
mismatch
=
None
):
"""
Initialisation of a Forest
"""
self
.
adaptators
=
dict
()
self
.
mis
s
match
=
mis
s
match
self
.
mismatch
=
mismatch
def
__del__
(
self
):
for
adaptator
in
self
.
adaptators
:
...
...
@@ -292,7 +292,7 @@ class Forest:
params: barcode str()
"""
if
adaptator
not
in
self
.
adaptators
:
self
.
adaptators
[
adaptator
]
=
Tree
(
mis
s
match
=
self
.
mis
s
match
)
self
.
adaptators
[
adaptator
]
=
Tree
(
mismatch
=
self
.
mismatch
)
self
.
adaptators
[
adaptator
].
add_sequence
(
sequence
=
sequence
,
barcode
=
barcode
...
...
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