Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wela
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
wela
Commits
b905961b
Commit
b905961b
authored
10 months ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
change: updated plot_kymograph for new sorting
parent
977ffc4c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/plot_kymograph.py
+25
-8
25 additions, 8 deletions
examples/plot_kymograph.py
src/wela/sorting.py
+6
-4
6 additions, 4 deletions
src/wela/sorting.py
with
31 additions
and
12 deletions
examples/plot_kymograph.py
+
25
−
8
View file @
b905961b
import
matplotlib.cm
import
numpy
as
np
from
wela.figs2pdf
import
figs2pdf
from
wela.dataloader
import
dataloader
,
sort_df
from
wela.dataloader
import
dataloader
from
wela.sorting
import
sort_by_maximum
from
wela.plotting
import
kymograph
,
plot_lineage
datasets
=
[
"
Pdr5_3_11_22
"
,
"
Pdr5_flc_10ugml_1676
"
]
datasets
=
[
"
Pdr5_3_11_22
"
]
for
dataname
in
datasets
:
# load data
dl
=
dataloader
(
"
.
"
,
"
/Users/pswain/wip/tsv_data/pdr_with_gr/
"
)
dl
.
load
(
dataname
,
use_tsv
=
True
)
sdf
=
sort_df
(
dl
.
df
,
"
median_GFP
"
)
dl
.
load
(
dataname
,
use_tsv
=
True
,
hours
=
False
)
dl
.
df
.
time
=
dl
.
df
.
time
/
60
title
=
dataname
.
split
(
"
.
"
)[
0
]
kymograph
(
sdf
,
hue
=
"
buddings
"
,
title
=
title
)
kymograph
(
sdf
,
hue
=
"
median_GFP
"
,
title
=
title
)
# although only one group for this data
groups
=
dl
.
df
.
group
.
unique
()
# standard kymographs
kymograph
(
dl
.
df
,
hue
=
"
buddings
"
,
title
=
title
)
kymograph
(
dl
.
df
,
hue
=
"
median_GFP
"
,
title
=
title
,
buddings
=
True
)
kymograph
(
s
df
,
dl
.
df
,
hue
=
"
bud_growth_rate
"
,
title
=
title
,
vmin
=-
50
,
vmax
=
50
,
cmap
=
matplotlib
.
cm
.
Spectral
,
)
# sorted kymograph
t
,
data
=
dl
.
get_time_series
(
"
median_GFP
"
,
group
=
groups
[
0
])
sort_order
=
sort_by_maximum
(
data
[:,
t
<
5
],
np
.
nanmean
)
kymograph
(
dl
.
df
,
"
median_GFP
"
,
group
=
groups
[
0
],
buddings
=
True
,
sort_order
=
sort_order
,
title
=
title
,
)
if
False
:
...
...
This diff is collapsed.
Click to expand it.
src/wela/sorting.py
+
6
−
4
View file @
b905961b
...
...
@@ -4,14 +4,16 @@ import numpy as np
def
sort_by_budding
(
buddings
,
bud_number
=
0
):
"""
Return indices for each cell when a particular budding occurs.
"""
bud_indices
=
np
.
transpose
(
np
.
nonzero
(
buddings
))
sort_order
=
[]
particular_bud_indices
=
[]
for
cell_i
in
range
(
buddings
.
shape
[
0
]):
# find particular bud for this cell
cell_buds
=
bud_indices
[
bud_indices
[:,
0
]
==
cell_i
,
:]
if
bud_number
<
cell_buds
.
shape
[
0
]:
sort_order
.
append
(
cell_buds
[
bud_number
][
1
])
particular_bud_indices
.
append
(
cell_buds
[
bud_number
][
1
])
else
:
sort_order
.
append
(
np
.
nan
)
sort_order
=
np
.
argsort
(
sort_order
)
particular_bud_indices
.
append
(
np
.
nan
)
# arrange by earliest bud
sort_order
=
np
.
argsort
(
particular_bud_indices
)
return
sort_order
...
...
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