Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
platy-browser-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Christian Tischer
platy-browser-data
Commits
649e08a0
Commit
649e08a0
authored
5 years ago
by
Constantin Pape
Browse files
Options
Downloads
Patches
Plain Diff
Implement preliminary cilia analysis
parent
b8ad90b5
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
analysis/cilia/analyse_cilia.py
+88
-0
88 additions, 0 deletions
analysis/cilia/analyse_cilia.py
with
88 additions
and
0 deletions
analysis/cilia/analyse_cilia.py
0 → 100644
+
88
−
0
View file @
649e08a0
import
numpy
as
np
import
pandas
as
pd
from
make_cell_table
import
right_nephr_ids
,
left_nephr_ids
from
matplotlib
import
pyplot
as
plt
TABLE_PATH
=
'
../../data/0.6.2/tables/sbem-6dpf-1-whole-segmented-cilia-labels/cell_mapping.csv
'
def
check_cell_ids
():
table
=
pd
.
read_csv
(
TABLE_PATH
,
sep
=
'
\t
'
)
cell_ids
=
table
[
'
cell_id
'
].
values
matched_right
=
[]
matched_left
=
[]
for
cell_id
in
cell_ids
:
if
cell_id
in
right_nephr_ids
:
matched_right
.
append
(
cell_id
)
elif
cell_id
in
left_nephr_ids
:
matched_left
.
append
(
cell_id
)
else
:
assert
cell_id
==
0
or
np
.
isnan
(
cell_id
),
str
(
cell_id
)
matched_right
=
set
(
matched_right
)
matched_left
=
set
(
matched_left
)
# unmatched_right = set(right_nephr_ids) - matched_right
# unmatched_left = set(left_nephr_ids) - matched_left
print
(
"
Number of cells right:
"
)
print
(
"
Total:
"
,
len
(
right_nephr_ids
))
print
(
"
With cilia:
"
,
len
(
matched_right
))
print
(
"
Number of cells left:
"
)
print
(
"
Total:
"
,
len
(
left_nephr_ids
))
print
(
"
With cilia:
"
,
len
(
matched_left
))
def
plot_cilia_per_cell
():
counts_left
=
[]
counts_right
=
[]
table
=
pd
.
read_csv
(
TABLE_PATH
,
sep
=
'
\t
'
)
cell_ids
=
table
[
'
cell_id
'
]
cell_ids
=
cell_ids
[
cell_ids
!=
0
]
cell_ids
=
cell_ids
[
~
np
.
isnan
(
cell_ids
)]
cell_ids
=
cell_ids
.
astype
(
'
uint32
'
)
unique_cell_ids
=
np
.
unique
(
cell_ids
)
total_count
=
0
for
cell_id
in
unique_cell_ids
:
n_cilia
=
np
.
sum
(
cell_ids
==
cell_id
)
total_count
+=
n_cilia
if
cell_id
in
right_nephr_ids
:
counts_right
.
append
(
n_cilia
)
elif
cell_id
in
left_nephr_ids
:
counts_left
.
append
(
n_cilia
)
else
:
print
(
cell_id
)
counts_right
.
sort
(
reverse
=
True
)
counts_left
.
sort
(
reverse
=
True
)
assert
len
(
counts_right
)
==
len
(
counts_left
)
print
(
"
Total number of cilia:
"
,
total_count
)
print
(
"
Right counts:
"
)
print
(
sum
(
counts_right
))
print
(
"
Left counts:
"
)
print
(
sum
(
counts_left
))
fig
,
axes
=
plt
.
subplots
(
2
)
x
=
np
.
arange
(
7
)
ax
=
axes
[
0
]
ax
.
set_title
(
'
Right nephridium
'
)
ax
.
bar
(
x
,
height
=
counts_right
)
ax
.
set_ylabel
(
'
Cilia per cell
'
)
ax
=
axes
[
1
]
ax
.
set_title
(
'
Left nephridium
'
)
ax
.
bar
(
x
,
height
=
counts_left
)
ax
.
set_ylabel
(
'
Cilia per cell
'
)
plt
.
show
()
if
__name__
==
'
__main__
'
:
check_cell_ids
()
plot_cilia_per_cell
()
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