-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathannowarpcohort.py
56 lines (46 loc) · 1.9 KB
/
annowarpcohort.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from ...shared.cohort import DbloadCohort, MaskCohort, SelectRectanglesCohort, WorkflowCohort, ZoomFolderCohort
from .annowarpsample import AnnoWarpArgumentParserBase, AnnoWarpArgumentParserTissueMask, AnnoWarpSampleAstroPathTissueMask, AnnoWarpSampleInformTissueMask
class AnnoWarpCohortBase(DbloadCohort, SelectRectanglesCohort, WorkflowCohort, ZoomFolderCohort, AnnoWarpArgumentParserBase):
"""
Cohort for running annowarp over a whole folder of samples.
"""
def __init__(self, *args, tilepixels=None, **kwargs):
self.__initiatesamplekwargs = {
"tilepixels": tilepixels,
}
for k, v in list(self.__initiatesamplekwargs.items()):
if v is None:
del self.__initiatesamplekwargs[k]
super().__init__(*args, **kwargs)
@property
def initiatesamplekwargs(self):
return {
**super().initiatesamplekwargs,
**self.__initiatesamplekwargs,
}
@property
def workflowkwargs(self):
return {"layers": [1], "tifflayers": None, **super().workflowkwargs}
class AnnoWarpCohortMask(AnnoWarpCohortBase, MaskCohort, SelectRectanglesCohort, WorkflowCohort, AnnoWarpArgumentParserTissueMask):
def __init__(self, *args, mintissuefraction=None, **kwargs):
self.__initiatesamplekwargs = {
"mintissuefraction": mintissuefraction,
}
for k, v in list(self.__initiatesamplekwargs.items()):
if v is None:
del self.__initiatesamplekwargs[k]
super().__init__(*args, **kwargs)
@property
def initiatesamplekwargs(self):
return {
**super().initiatesamplekwargs,
**self.__initiatesamplekwargs,
}
class AnnoWarpCohortInformTissueMask(AnnoWarpCohortMask):
sampleclass = AnnoWarpSampleInformTissueMask
class AnnoWarpCohortAstroPathTissueMask(AnnoWarpCohortMask):
sampleclass = AnnoWarpSampleAstroPathTissueMask
def main(args=None):
AnnoWarpCohortAstroPathTissueMask.runfromargumentparser(args)
if __name__ == "__main__":
main()