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
048d4c47
Commit
048d4c47
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
update to latest format and document
Former-commit-id: 7704b4f09669e8610b9a7ca49e3d200c4ec9bcca
parent
38dd18be
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
core/processes/aggregate.py
+22
-6
22 additions, 6 deletions
core/processes/aggregate.py
core/processes/births.py
+29
-0
29 additions, 0 deletions
core/processes/births.py
core/processes/dsignal.py
+1
-1
1 addition, 1 deletion
core/processes/dsignal.py
core/processor.py
+2
-5
2 additions, 5 deletions
core/processor.py
with
54 additions
and
12 deletions
core/processes/aggregate.py
+
22
−
6
View file @
048d4c47
...
...
@@ -12,18 +12,22 @@ class aggregateParameters(ParametersABC):
reduction: str to be passed to a dataframe for collapsing across columns
"""
def
__init__
(
self
,
reductions
):
def
__init__
(
self
,
reductions
,
axis
,
ranges
):
super
().
__init__
()
self
.
reductions
=
reductions
self
.
axis
=
axis
self
.
ranges
=
ranges
@classmethod
def
default
(
cls
):
return
cls
.
from_dict
({
"
reductions
"
:
[
"
mean
"
,
"
median
"
,
"
max
"
]})
return
cls
.
from_dict
(
{
"
reductions
"
:
[
"
mean
"
,
"
median
"
,
"
max
"
],
"
axis
"
:
1
,
"
ranges
"
:
None
}
)
class
aggregate
(
ProcessABC
):
"""
a
ggregate multiple datasets
A
ggregate multiple datasets
for cell-to-cell feature comparison.
"""
def
__init__
(
self
,
parameters
:
aggregateParameters
):
...
...
@@ -62,13 +66,25 @@ class aggregate(ProcessABC):
]
concat
=
pd
.
concat
(
[
getattr
(
signal
,
red
)(
axis
=
1
)
getattr
(
signal
,
red
)(
axis
=
self
.
parameters
.
axis
)
for
signal
in
signals
for
red
in
self
.
parameters
.
reductions
],
names
=
signals
[
0
].
index
.
names
,
axis
=
1
,
axis
=
self
.
parameters
.
axis
,
)
concat
.
columns
=
colnames
if
self
.
parameters
.
axis
:
concat
.
columns
=
colnames
else
:
concat
.
columns
=
pd
.
MultiIndex
.
from_product
(
(
colnames
,
[
"
_
"
.
join
((
str
(
start
),
str
(
stop
)))
for
x
in
self
.
parameters
.
ranges
for
start
,
stop
in
x
],
)
)
return
concat
This diff is collapsed.
Click to expand it.
core/processes/births.py
+
29
−
0
View file @
048d4c47
#!/usr/bin/env python3
import
pandas
as
pd
from
agora.io.base
import
ParametersABC
,
ProcessABC
class
birthsParameters
(
ParametersABC
):
"""
:window: Number of timepoints to consider for signal.
"""
def
__init__
(
self
):
pass
@classmethod
def
default
(
cls
):
return
cls
.
from_dict
({})
class
births
(
ProcessABC
):
"""
Calculate the change in a signal depending on a window
"""
def
__init__
(
self
,
parameters
:
birthsParameters
):
super
().
__init__
(
parameters
)
def
run
(
self
,
signal
:
pd
.
DataFrame
):
pass
This diff is collapsed.
Click to expand it.
core/processes/dsignal.py
+
1
−
1
View file @
048d4c47
import
pandas
as
pd
from
postprocessor.core.processes
.base
import
ParametersABC
,
ProcessABC
from
agora
.base
import
ParametersABC
,
ProcessABC
class
dsignalParameters
(
ParametersABC
):
...
...
This diff is collapsed.
Click to expand it.
core/processor.py
+
2
−
5
View file @
048d4c47
...
...
@@ -123,9 +123,6 @@ class PostProcessorParameters(ParametersABC):
return
cls
(
targets
=
targets
,
parameters
=
parameters
,
outpaths
=
outpaths
)
def
to_dict
(
self
):
return
{
k
:
_if_dict
(
v
)
for
k
,
v
in
self
.
__dict__
.
items
()}
class
PostProcessor
:
def
__init__
(
self
,
filename
,
parameters
):
...
...
@@ -162,8 +159,8 @@ class PostProcessor:
@staticmethod
def
get_parameters
(
process
):
"""
Dynamically import
a process clas
s from the
'
processes
'
folder.
Assumes p
rocess filename and class name are
the
same
Dynamically import
parameter
s from the
'
processes
'
folder.
Assumes p
arameter is the same name as the file with
'
Parameters
'
added at
the
end.
"""
return
locate
(
"
postprocessor.core.processes.
"
+
process
+
"
.
"
+
process
+
"
Parameters
"
...
...
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