Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
linked reads molecule ordering
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yoann DUFRESNE
linked reads molecule ordering
Commits
5baf420d
Commit
5baf420d
authored
May 12, 2020
by
Yoann Dufresne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
local score computation
parent
01d8b380
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
+40
-2
deconvolution/barcodes/partialorder.py
deconvolution/barcodes/partialorder.py
+40
-2
No files found.
deconvolution/barcodes/partialorder.py
View file @
5baf420d
...
...
@@ -22,7 +22,8 @@ class PartialOrder:
self
.
len_sets
=
0
# The number of successive udg. Same as len(udg_order)
self
.
len_udgs
=
0
# TODO: score
# This score must be updated when the order is modified
self
.
score
=
0
def
_get_right_overlaps
(
self
,
udg
):
"""" Get the overlap of an udg with the right part of the multiset partial order.
...
...
@@ -78,11 +79,48 @@ class PartialOrder:
self
.
len_barcodes
+=
sum
(
new_multiset
.
values
())
# Step 4 - Add the udg as covering the right multisets
for
idx
in
range
(
max
(
0
,
leftmost_idx
),
len
(
self
.
udg_per_set
)
):
for
idx
in
range
(
max
(
0
,
leftmost_idx
),
self
.
len_sets
):
self
.
udg_per_set
[
idx
].
add
(
udg
)
# TODO: Step 5 - Modify score
def
get_add_score
(
self
,
udg
):
score
=
0
leftmost_idx
,
left_non_overlap
,
remaining_right
=
self
.
_get_right_overlaps
(
udg
)
# 1 point for the rightmost future multiset
if
len
(
remaining_right
)
>
0
:
score
+=
1
# x points if the leftmost multiset is split in 2 (x = covering udg number)
if
len
(
left_non_overlap
)
>
0
:
score
+=
len
(
self
.
udg_per_set
[
leftmost_idx
])
# covering number points for the new udg
score
+=
self
.
len_sets
-
leftmost_idx
# Negative points for redundant elements
# shift one left
remaining_size
=
sum
(
remaining_right
.
values
())
-
sum
(
left_non_overlap
.
values
())
leftmost_idx
-=
1
# Search for non overlapped common barcodes
while
remaining_size
>
0
and
leftmost_idx
>=
0
:
ms
=
self
.
barcode_order
[
leftmost_idx
]
# Compute intersection
common
=
ms
&
remaining_right
candidate_negative
=
sum
(
common
.
values
())
score
-=
min
(
candidate_negative
,
remaining_size
)
# Update structures
remaining_right
-=
common
remaining_size
-=
sum
(
ms
.
values
())
leftmost_idx
-=
1
return
score
def
__len__
(
self
):
return
self
.
len_barcodes
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