Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
alibylite
Commits
20d85934
Commit
20d85934
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
change(indexing): validate_lineage always warns if lineage misassigned
parent
b97331da
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/agora/io/signal.py
+2
-2
2 additions, 2 deletions
src/agora/io/signal.py
src/agora/utils/indexing.py
+21
-19
21 additions, 19 deletions
src/agora/utils/indexing.py
with
23 additions
and
21 deletions
src/agora/io/signal.py
+
2
−
2
View file @
20d85934
...
@@ -249,7 +249,7 @@ class Signal(BridgeH5):
...
@@ -249,7 +249,7 @@ class Signal(BridgeH5):
dataset
:
str
or
t
.
List
[
str
],
dataset
:
str
or
t
.
List
[
str
],
in_minutes
:
bool
=
True
,
in_minutes
:
bool
=
True
,
lineage
:
bool
=
False
,
lineage
:
bool
=
False
,
ru
n_lineage_check
:
bool
=
True
,
stop_o
n_lineage_check
:
bool
=
True
,
**
kwargs
,
**
kwargs
,
)
->
pd
.
DataFrame
or
t
.
List
[
pd
.
DataFrame
]:
)
->
pd
.
DataFrame
or
t
.
List
[
pd
.
DataFrame
]:
"""
"""
...
@@ -282,7 +282,7 @@ class Signal(BridgeH5):
...
@@ -282,7 +282,7 @@ class Signal(BridgeH5):
lineage
,
lineage
,
indices
=
np
.
array
(
df
.
index
.
to_list
()),
indices
=
np
.
array
(
df
.
index
.
to_list
()),
how
=
"
daughters
"
,
how
=
"
daughters
"
,
ru
n_lineage_check
=
ru
n_lineage_check
,
stop_o
n_lineage_check
=
stop_o
n_lineage_check
,
)
)
mother_label
[
valid_indices
]
=
lineage
[
mother_label
[
valid_indices
]
=
lineage
[
valid_lineage
,
1
valid_lineage
,
1
...
...
This diff is collapsed.
Click to expand it.
src/agora/utils/indexing.py
+
21
−
19
View file @
20d85934
...
@@ -8,7 +8,7 @@ def validate_lineage(
...
@@ -8,7 +8,7 @@ def validate_lineage(
lineage
:
np
.
ndarray
,
lineage
:
np
.
ndarray
,
indices
:
np
.
ndarray
,
indices
:
np
.
ndarray
,
how
:
str
=
"
families
"
,
how
:
str
=
"
families
"
,
ru
n_lineage_check
:
bool
=
True
,
stop_o
n_lineage_check
:
bool
=
True
,
):
):
"""
"""
Identify mother-bud pairs both in lineage and a Signal
'
s indices.
Identify mother-bud pairs both in lineage and a Signal
'
s indices.
...
@@ -31,9 +31,9 @@ def validate_lineage(
...
@@ -31,9 +31,9 @@ def validate_lineage(
If
"
mothers
"
, matches indicate mothers from mother-bud pairs;
If
"
mothers
"
, matches indicate mothers from mother-bud pairs;
If
"
daughters
"
, matches indicate daughters from mother-bud pairs;
If
"
daughters
"
, matches indicate daughters from mother-bud pairs;
If
"
families
"
, matches indicate mothers and daughters in mother-bud pairs.
If
"
families
"
, matches indicate mothers and daughters in mother-bud pairs.
ru
n_lineage_check: bool
stop_o
n_lineage_check: bool
If True,
check for
errors in the lineage assignment such
as a daughter
If True,
raise an Exception for any
errors in the lineage assignment such
being assigned two mothers.
as a daughter
being assigned two mothers.
Returns
Returns
-------
-------
...
@@ -91,25 +91,27 @@ def validate_lineage(
...
@@ -91,25 +91,27 @@ def validate_lineage(
valid_indices
=
index_isin
(
indices
,
selected_lineages
[:,
c_index
,
:])
valid_indices
=
index_isin
(
indices
,
selected_lineages
[:,
c_index
,
:])
flat_valid_indices
=
valid_indices
.
flatten
()
flat_valid_indices
=
valid_indices
.
flatten
()
# test for mismatch
# test for mismatch
if
run_lineage_check
:
if
how
==
"
families
"
:
if
how
==
"
families
"
:
test_mismatch
=
(
test_mismatch
=
(
indices
[
flat_valid_indices
,
:].
size
indices
[
flat_valid_indices
,
:].
size
!=
np
.
unique
(
!=
np
.
unique
(
lineage
[
flat_valid_lineage
,
:].
reshape
(
-
1
,
2
),
axis
=
0
lineage
[
flat_valid_lineage
,
:].
reshape
(
-
1
,
2
),
axis
=
0
).
size
)
.
size
)
)
else
:
else
:
test_mismatch
=
(
test_mismatch
=
(
indices
[
flat_valid_indices
,
:].
size
indices
[
flat_valid_in
dices
,
:].
size
!=
lineage
[
flat_valid_
l
in
eage
,
c_index
,
:].
size
!=
lineage
[
flat_valid_lineage
,
c_index
,
:].
size
)
)
if
test_mismatch
:
if
test_mismatch
:
# all unique indices in valid_lineages should be in valid_indices
# all unique indices in valid_lineages should be in valid_indices
if
stop_on_lineage_check
:
raise
Exception
(
raise
Exception
(
"
Error in validate_lineage:
"
"
Error in validate_lineage:
"
"
lineage information is likely not unique.
"
"
lineage information is likely not unique.
"
)
)
else
:
print
(
"
Warning: error in validate_lineage.
"
)
return
flat_valid_lineage
,
flat_valid_indices
return
flat_valid_lineage
,
flat_valid_indices
...
...
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