Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linked reads molecule ordering
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
Container registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann DUFRESNE
linked reads molecule ordering
Commits
afe8cbe7
Commit
afe8cbe7
authored
5 years ago
by
Yoann Dufresne
Browse files
Options
Downloads
Patches
Plain Diff
remove bg analysis
parent
5b114601
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
deconvolution/main/evaluate.py
+6
-40
6 additions, 40 deletions
deconvolution/main/evaluate.py
with
6 additions
and
40 deletions
deconvolution/main/evaluate.py
+
6
−
40
View file @
afe8cbe7
...
@@ -12,7 +12,7 @@ def parse_args():
...
@@ -12,7 +12,7 @@ def parse_args():
parser
=
argparse
.
ArgumentParser
(
description
=
'
Process a d2 graph (complete graph or path) to evaluate its quality.
'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'
Process a d2 graph (complete graph or path) to evaluate its quality.
'
)
parser
.
add_argument
(
'
filename
'
,
type
=
str
,
parser
.
add_argument
(
'
filename
'
,
type
=
str
,
help
=
'
The file to evalute
'
)
help
=
'
The file to evalute
'
)
parser
.
add_argument
(
'
--type
'
,
'
-t
'
,
choices
=
[
"
d2
"
,
"
path
"
,
"
bg
"
,
"
d2-2annotate
"
,
"
dgraphs
"
],
default
=
"
path
"
,
required
=
True
,
parser
.
add_argument
(
'
--type
'
,
'
-t
'
,
choices
=
[
"
d2
"
,
"
path
"
,
"
d2-2annotate
"
,
"
dgraphs
"
],
default
=
"
path
"
,
required
=
True
,
help
=
"
Define the data type to evaluate. Must be
'
d2
'
or
'
path
'
or
'
d2-2annotate
'
(Rayan
'
s hack).
"
)
help
=
"
Define the data type to evaluate. Must be
'
d2
'
or
'
path
'
or
'
d2-2annotate
'
(Rayan
'
s hack).
"
)
parser
.
add_argument
(
'
--light-print
'
,
'
-l
'
,
action
=
'
store_true
'
,
parser
.
add_argument
(
'
--light-print
'
,
'
-l
'
,
action
=
'
store_true
'
,
help
=
'
Print only wrong nodes and paths
'
)
help
=
'
Print only wrong nodes and paths
'
)
...
@@ -259,8 +259,9 @@ def print_d2_summary(connected_components, longest_path, coverage_vars=(0, 0), l
...
@@ -259,8 +259,9 @@ def print_d2_summary(connected_components, longest_path, coverage_vars=(0, 0), l
print
(
"
Longest path for increasing molecule number:
"
)
print
(
"
Longest path for increasing molecule number:
"
)
print
(
path_dg_idx
)
print
(
path_dg_idx
)
print
(
f
"
Size of the longest path:
{
len
(
longest_path
)
}
"
)
print
(
f
"
Size of the longest path:
{
len
(
longest_path
)
}
"
)
print
(
"
Jumps in central nodes:
"
)
if
not
light_print
:
print
(
path_to_jumps
(
longest_path
))
print
(
"
Jumps in central nodes:
"
)
print
(
path_to_jumps
(
longest_path
))
print
(
f
"
Number of usable coverage variables:
{
len
(
coverage_vars
[
1
])
}
"
)
print
(
f
"
Number of usable coverage variables:
{
len
(
coverage_vars
[
1
])
}
"
)
print
(
f
"
Coverage:
{
len
(
coverage_vars
[
0
])
}
/
{
len
(
coverage_vars
[
1
])
}
"
)
print
(
f
"
Coverage:
{
len
(
coverage_vars
[
0
])
}
/
{
len
(
coverage_vars
[
1
])
}
"
)
...
@@ -324,6 +325,7 @@ def compute_next_nodes(d2_component, max_jumps=0):
...
@@ -324,6 +325,7 @@ def compute_next_nodes(d2_component, max_jumps=0):
def
compute_longest_increasing_paths
(
d2_component
,
max_gap
=
0
):
def
compute_longest_increasing_paths
(
d2_component
,
max_gap
=
0
):
next_nodes
=
compute_next_nodes
(
d2_component
,
max_jumps
=
max_gap
)
next_nodes
=
compute_next_nodes
(
d2_component
,
max_jumps
=
max_gap
)
sys
.
setrecursionlimit
(
len
(
d2_component
.
nodes
)
*
2
)
# Compute the longest path for each node
# Compute the longest path for each node
longest_paths
=
{}
longest_paths
=
{}
...
@@ -489,39 +491,6 @@ def recursive_longest_path(current_node, current_molecule, next_nodes, longest_p
...
@@ -489,39 +491,6 @@ def recursive_longest_path(current_node, current_molecule, next_nodes, longest_p
return
longest_paths
[
current_node
][
current_molecule
]
return
longest_paths
[
current_node
][
current_molecule
]
# def longest_common_subsequence(barcode_true_path, barcoded_graph):
# """ Assume that the two graphs have an attribute barcode for each node and a unique node name"""
# path_nodes = []
# path_nodes_barcodes = []
# for node, data in barcode_true_path.nodes(data=True):
# path_nodes.append(node)
# path_nodes_barcodes.append(data["barcode"])
# path_nodes_to_idx = {n: idx for idx, n in enumerate(path_nodes)}
#
# graph_nodes = []
# graph_nodes_barcodes = []
# for node, data in barcoded_graph.nodes(data=True):
# graph_nodes.append(node)
# graph_nodes_barcodes.append(data["barcode"])
# graph_nodes_to_idx = {n: idx for idx, n in enumerate(graph_nodes)}
#
# dynamic_array = [[0 for _ in range(len(graph_nodes)+1)] for _ in range(len(path_nodes)+1)]
# for row in range(1, len(path_nodes)+1):
# path_node = path_nodes[row-1]
# path_barcode = path_nodes_barcodes[row-1]
#
# for column in range(1, len(graph_nodes)):
# graph_node = graph_nodes[column-1]
# graph_barcode = graph_nodes_barcodes[column-1]
#
# prev_scores = [dynamic_array[row-1][column]]
# for neighbor_node in barcoded_graph[graph_node]:
# neighbor_idx = graph_nodes_to_idx[neighbor_node]
# prev_scores.append(dynamic_array[row-1][neighbor_idx])
#
# match_point = 1 if path_barcode == graph_barcode else 0
# dynamic_array[row][column] = max(prev_scores) + match_point
def
compute_covered_variables
(
graph
,
path
):
def
compute_covered_variables
(
graph
,
path
):
path_nodes
=
set
()
path_nodes
=
set
()
...
@@ -669,10 +638,7 @@ def main():
...
@@ -669,10 +638,7 @@ def main():
elif
args
.
type
==
"
dgraphs
"
:
elif
args
.
type
==
"
dgraphs
"
:
udg_per_node
=
parse_udg_qualities
(
graph
)
udg_per_node
=
parse_udg_qualities
(
graph
)
# print(udg_per_node)
# print(udg_per_node)
elif
args
.
type
==
"
bg
"
or
args
.
type
==
"
d2
"
:
elif
args
.
type
==
"
d2
"
:
if
args
.
type
==
"
bg
"
:
graph
=
transform_bg
(
graph
)
components
=
list
(
nx
.
connected_components
(
graph
))
components
=
list
(
nx
.
connected_components
(
graph
))
components
.
sort
(
key
=
lambda
x
:
-
len
(
x
))
components
.
sort
(
key
=
lambda
x
:
-
len
(
x
))
...
...
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