Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
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
aliby-mirror
Commits
05843ad2
Commit
05843ad2
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
adjust parameters and bugfixes
Former-commit-id: 0669c9f294dcb76451ce6700f3f946cfcfae3d33
parent
2747ac37
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
core/processes/picker.py
+25
-18
25 additions, 18 deletions
core/processes/picker.py
with
25 additions
and
18 deletions
core/processes/picker.py
+
25
−
18
View file @
05843ad2
import
seaborn
as
sns
from
matplotlib
import
pyplot
as
plt
# TODO DELETE THIS
from
typing
import
Tuple
,
Union
,
List
from
typing
import
Tuple
,
Union
,
List
from
abc
import
ABC
,
abstractmethod
from
abc
import
ABC
,
abstractmethod
...
@@ -27,9 +30,9 @@ class pickerParameters(ParametersABC):
...
@@ -27,9 +30,9 @@ class pickerParameters(ParametersABC):
"
sequence
"
:
[
"
sequence
"
:
[
# ("lineage", "intersection", "families"),
# ("lineage", "intersection", "families"),
(
"
condition
"
,
"
intersection
"
,
"
any_present
"
,
0.8
),
(
"
condition
"
,
"
intersection
"
,
"
any_present
"
,
0.8
),
(
"
condition
"
,
"
intersection
"
,
"
growing
"
,
5
0
),
(
"
condition
"
,
"
intersection
"
,
"
growing
"
,
4
0
),
(
"
condition
"
,
"
intersection
"
,
"
present
"
,
5
),
(
"
condition
"
,
"
intersection
"
,
"
present
"
,
8
),
(
"
condition
"
,
"
intersection
"
,
"
mother_buds
"
,
5
,
0.
5
),
(
"
condition
"
,
"
intersection
"
,
"
mother_buds
"
,
5
,
0.
8
),
# ("lineage", "full_families", "intersection"),
# ("lineage", "full_families", "intersection"),
],
],
}
}
...
@@ -162,9 +165,6 @@ class picker(ProcessABC):
...
@@ -162,9 +165,6 @@ class picker(ProcessABC):
return
idx
return
idx
def
pick_by_custom
(
self
,
signals
,
condition
,
thresh
):
pass
def
pick_by_condition
(
self
,
signals
,
condition
,
thresh
):
def
pick_by_condition
(
self
,
signals
,
condition
,
thresh
):
idx
=
self
.
switch_case
(
signals
,
condition
,
thresh
)
idx
=
self
.
switch_case
(
signals
,
condition
,
thresh
)
return
idx
return
idx
...
@@ -201,14 +201,18 @@ class picker(ProcessABC):
...
@@ -201,14 +201,18 @@ class picker(ProcessABC):
for
alg
,
op
,
*
params
in
self
.
sequence
:
for
alg
,
op
,
*
params
in
self
.
sequence
:
if
alg
is
"
lineage
"
:
if
alg
is
"
lineage
"
:
param1
=
params
[
0
]
param1
=
params
[
0
]
new_indices
=
getattr
(
self
,
"
pick_by_
"
+
alg
)(
signals
,
param1
)
new_indices
=
getattr
(
self
,
"
pick_by_
"
+
alg
)(
signals
.
loc
[
list
(
indices
)],
param1
)
else
:
else
:
param1
,
*
param2
=
params
param1
,
*
param2
=
params
new_indices
=
getattr
(
self
,
"
pick_by_
"
+
alg
)(
signals
,
param1
,
param2
)
new_indices
=
getattr
(
self
,
"
pick_by_
"
+
alg
)(
signals
.
loc
[
list
(
indices
)],
param1
,
param2
)
if
op
is
"
union
"
:
if
op
is
"
union
"
:
new_indices
=
new_indices
.
intersection
(
set
(
signals
.
index
))
#
new_indices = new_indices.intersection(set(signals.index))
new_indices
=
indices
.
union
(
set
(
new_indices
)
)
new_indices
=
indices
.
union
(
new_indices
)
indices
=
indices
.
intersection
(
new_indices
)
indices
=
indices
.
intersection
(
new_indices
)
...
@@ -224,12 +228,9 @@ class picker(ProcessABC):
...
@@ -224,12 +228,9 @@ class picker(ProcessABC):
threshold
=
[
_as_int
(
*
threshold
,
signals
.
shape
[
1
])]
threshold
=
[
_as_int
(
*
threshold
,
signals
.
shape
[
1
])]
case_mgr
=
{
case_mgr
=
{
"
any_present
"
:
lambda
s
,
thresh
:
any_present
(
s
,
thresh
),
"
any_present
"
:
lambda
s
,
thresh
:
any_present
(
s
,
thresh
),
"
present
"
:
lambda
s
,
thresh
:
signals
.
notna
().
sum
(
axis
=
1
)
>
thresh
,
"
present
"
:
lambda
s
,
thresh
:
s
.
notna
().
sum
(
axis
=
1
)
>
thresh
,
"
nonstoply_present
"
:
lambda
s
,
thresh
:
signals
.
apply
(
"
nonstoply_present
"
:
lambda
s
,
thresh
:
s
.
apply
(
thresh
,
axis
=
1
)
>
thresh
,
max_nonstop_ntps
,
axis
=
1
"
growing
"
:
lambda
s
,
thresh
:
s
.
diff
(
axis
=
1
).
sum
(
axis
=
1
)
>
thresh
,
)
>
thresh_asint
,
"
growing
"
:
lambda
s
,
thresh
:
signals
.
diff
(
axis
=
1
).
sum
(
axis
=
1
)
>
thresh
,
"
mother_buds
"
:
lambda
s
,
p1
,
p2
:
mother_buds_wrap
(
s
,
p1
,
p2
)
"
mother_buds
"
:
lambda
s
,
p1
,
p2
:
mother_buds_wrap
(
s
,
p1
,
p2
)
# "quantile": [np.quantile(signals.values[signals.notna()], threshold)],
# "quantile": [np.quantile(signals.values[signals.notna()], threshold)],
}
}
...
@@ -306,10 +307,16 @@ def mother_buds(df, min_budgrowth_t, min_mobud_ratio):
...
@@ -306,10 +307,16 @@ def mother_buds(df, min_budgrowth_t, min_mobud_ratio):
size_filter
=
d_to_mother
[
size_filter
=
d_to_mother
[
d_to_mother
.
apply
(
lambda
x
:
x
.
dropna
().
iloc
[
0
],
axis
=
1
)
<
0
d_to_mother
.
apply
(
lambda
x
:
x
.
dropna
().
iloc
[
0
],
axis
=
1
)
<
0
]
]
cols_sorted
=
size_filter
.
sort_index
(
axis
=
1
)
cols_sorted
=
(
size_filter
.
sort_index
(
axis
=
1
)
.
apply
(
pd
.
Series
.
first_valid_index
,
axis
=
1
)
.
sort_values
()
)
if
not
len
(
cols_sorted
):
if
not
len
(
cols_sorted
):
return
[]
return
[]
bud_candidates
=
start
[[
True
,
*
(
np
.
diff
(
cols_sorted
.
columns
)
>
min_budgrowth_t
)]]
bud_candidates
=
cols_sorted
.
loc
[
[
True
,
*
(
np
.
diff
(
cols_sorted
.
values
)
>
min_budgrowth_t
)]
]
return
[
mother_id
]
+
[
int
(
i
)
for
i
in
bud_candidates
.
index
.
tolist
()]
return
[
mother_id
]
+
[
int
(
i
)
for
i
in
bud_candidates
.
index
.
tolist
()]
...
...
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