seer-pas-sdk 0.1.3__py3-none-any.whl → 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seer_pas_sdk/auth/auth.py +23 -1
- seer_pas_sdk/common/__init__.py +370 -72
- seer_pas_sdk/common/errors.py +5 -0
- seer_pas_sdk/common/groupanalysis.py +55 -0
- seer_pas_sdk/core/sdk.py +1580 -198
- seer_pas_sdk/core/unsupported.py +1634 -0
- seer_pas_sdk/objects/__init__.py +2 -0
- seer_pas_sdk/objects/groupanalysis.py +30 -0
- seer_pas_sdk/objects/platemap.py +67 -22
- seer_pas_sdk/objects/volcanoplot.py +290 -0
- seer_pas_sdk-0.2.1.dist-info/METADATA +230 -0
- seer_pas_sdk-0.2.1.dist-info/RECORD +18 -0
- {seer_pas_sdk-0.1.3.dist-info → seer_pas_sdk-0.2.1.dist-info}/WHEEL +1 -1
- {seer_pas_sdk-0.1.3.dist-info → seer_pas_sdk-0.2.1.dist-info}/top_level.txt +0 -1
- seer_pas_sdk-0.1.3.dist-info/METADATA +0 -50
- seer_pas_sdk-0.1.3.dist-info/RECORD +0 -19
- tests/__init__.py +0 -0
- tests/conftest.py +0 -17
- tests/test_auth.py +0 -48
- tests/test_common.py +0 -99
- tests/test_objects.py +0 -91
- tests/test_sdk.py +0 -11
- {seer_pas_sdk-0.1.3.dist-info → seer_pas_sdk-0.2.1.dist-info/licenses}/LICENSE.txt +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
def validate_contrast(contrast, ngroups):
|
|
2
|
+
"""
|
|
3
|
+
Validate the contrast.
|
|
4
|
+
|
|
5
|
+
Parameters
|
|
6
|
+
----------
|
|
7
|
+
contrast : list or tuple
|
|
8
|
+
The contrast to validate.
|
|
9
|
+
|
|
10
|
+
ngroups : int
|
|
11
|
+
The number of groups in the contrast.
|
|
12
|
+
|
|
13
|
+
Returns
|
|
14
|
+
-------
|
|
15
|
+
list
|
|
16
|
+
The validated contrast.
|
|
17
|
+
|
|
18
|
+
Raises
|
|
19
|
+
------
|
|
20
|
+
TypeError
|
|
21
|
+
If contrast is not a list or tuple.
|
|
22
|
+
If contrast is not a collection of integers.
|
|
23
|
+
ValueError
|
|
24
|
+
If contrast has less than 2 elements.
|
|
25
|
+
If contrast does not have the same number of elements as ngroups.
|
|
26
|
+
If contrast is not a list of -1, 0, or 1.
|
|
27
|
+
If contrast does not have exactly one 1.
|
|
28
|
+
If contrast does not have exactly one -1.
|
|
29
|
+
"""
|
|
30
|
+
if not isinstance(contrast, (list, tuple)):
|
|
31
|
+
raise TypeError("contrast must be a list or tuple")
|
|
32
|
+
if len(contrast) < 2:
|
|
33
|
+
raise ValueError("contrast must have at least 2 elements")
|
|
34
|
+
if not all(isinstance(i, int) for i in contrast):
|
|
35
|
+
raise TypeError("contrast must be a list of integers")
|
|
36
|
+
if not len(contrast) == ngroups:
|
|
37
|
+
raise ValueError(f"contrast {contrast} must have {ngroups} elements")
|
|
38
|
+
if not all([i in range(-1, 2) for i in contrast]):
|
|
39
|
+
raise ValueError(f"contrast {contrast} must be a list of -1, 0, or 1")
|
|
40
|
+
|
|
41
|
+
# Check that the contrast has exactly one 1 and one -1
|
|
42
|
+
count_1 = 0
|
|
43
|
+
count_neg1 = 0
|
|
44
|
+
|
|
45
|
+
for item in contrast:
|
|
46
|
+
if item == 1:
|
|
47
|
+
count_1 += 1
|
|
48
|
+
elif item == -1:
|
|
49
|
+
count_neg1 += 1
|
|
50
|
+
|
|
51
|
+
if count_1 != 1:
|
|
52
|
+
raise ValueError(f"contrast {contrast} must have exactly one 1")
|
|
53
|
+
if count_neg1 != 1:
|
|
54
|
+
raise ValueError(f"contrast {contrast} must have exactly one -1")
|
|
55
|
+
return contrast
|