msreport 0.0.25__tar.gz → 0.0.26__tar.gz
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.
- {msreport-0.0.25 → msreport-0.0.26}/PKG-INFO +1 -1
- {msreport-0.0.25 → msreport-0.0.26}/msreport/__init__.py +1 -1
- {msreport-0.0.25 → msreport-0.0.26}/msreport/helper/table.py +14 -4
- {msreport-0.0.25 → msreport-0.0.26}/msreport.egg-info/PKG-INFO +1 -1
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_helper.py +29 -14
- {msreport-0.0.25 → msreport-0.0.26}/LICENSE.txt +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/README.md +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/aggregate/__init__.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/aggregate/condense.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/aggregate/pivot.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/aggregate/summarize.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/analyze.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/errors.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/export.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/fasta.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/helper/__init__.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/helper/calc.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/helper/maxlfq.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/helper/temp.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/impute.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/isobar.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/normalize.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/peptidoform.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/plot.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/qtable.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/reader.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/rinterface/__init__.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/rinterface/limma.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/rinterface/rinstaller.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport/rinterface/rscripts/limma.R +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport.egg-info/SOURCES.txt +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport.egg-info/dependency_links.txt +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport.egg-info/requires.txt +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/msreport.egg-info/top_level.txt +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/pyproject.toml +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/setup.cfg +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/setup.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_analyze.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_export.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_impute.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_isobar.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_maxlfq.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_peptidoform.py +0 -0
- {msreport-0.0.25 → msreport-0.0.26}/tests/test_qtable.py +0 -0
|
@@ -176,12 +176,22 @@ def find_sample_columns(
|
|
|
176
176
|
columns.
|
|
177
177
|
|
|
178
178
|
Returns:
|
|
179
|
-
A list of
|
|
179
|
+
A list of column names containing the substring and any entry of 'samples'.
|
|
180
|
+
Columns are returned in the order of entries in 'samples'.
|
|
180
181
|
"""
|
|
182
|
+
WHITESPACE_CHARS = " ."
|
|
183
|
+
|
|
181
184
|
matched_columns = []
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
+
substring_columns = find_columns(table, substring)
|
|
186
|
+
for sample in samples:
|
|
187
|
+
sample_columns = [c for c in substring_columns if sample in c]
|
|
188
|
+
for col in sample_columns:
|
|
189
|
+
column_remainder = (
|
|
190
|
+
col.replace(substring, "").replace(sample, "").strip(WHITESPACE_CHARS)
|
|
191
|
+
)
|
|
192
|
+
if column_remainder == "":
|
|
193
|
+
matched_columns.append(col)
|
|
194
|
+
break
|
|
185
195
|
return matched_columns
|
|
186
196
|
|
|
187
197
|
|
|
@@ -19,20 +19,35 @@ class TestFindColumns:
|
|
|
19
19
|
assert columns == ["Test A", "Test B"]
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
class TestFindSampleColumns:
|
|
23
|
+
def test_find_sample_columns(self):
|
|
24
|
+
df = pd.DataFrame(
|
|
25
|
+
columns=[
|
|
26
|
+
"Tag",
|
|
27
|
+
"Tag Not_a_sample",
|
|
28
|
+
"Tag Sample_A",
|
|
29
|
+
"Tag Sample_B",
|
|
30
|
+
"Something else",
|
|
31
|
+
]
|
|
32
|
+
)
|
|
33
|
+
samples = ["Sample_A", "Sample_B"]
|
|
34
|
+
tag = "Tag"
|
|
35
|
+
columns = msreport.helper.find_sample_columns(df, tag, samples)
|
|
36
|
+
assert columns == ["Tag Sample_A", "Tag Sample_B"]
|
|
37
|
+
|
|
38
|
+
def test_columns_are_returned_in_order_of_samples(self):
|
|
39
|
+
df = pd.DataFrame(columns=["Tag Sample_B", "Tag Sample_A"])
|
|
40
|
+
samples = ["Sample_A", "Sample_B"]
|
|
41
|
+
tag = "Tag"
|
|
42
|
+
columns = msreport.helper.find_sample_columns(df, tag, samples)
|
|
43
|
+
assert columns == ["Tag Sample_A", "Tag Sample_B"]
|
|
44
|
+
|
|
45
|
+
def test_correct_mapping_with_samples_that_are_substrings(self):
|
|
46
|
+
df = pd.DataFrame(columns=["Tag SampleB_1", "Tag B_1"])
|
|
47
|
+
samples = ["B_1"]
|
|
48
|
+
tag = "Tag"
|
|
49
|
+
columns = msreport.helper.find_sample_columns(df, tag, samples)
|
|
50
|
+
assert columns == ["Tag B_1"]
|
|
36
51
|
|
|
37
52
|
|
|
38
53
|
class TestKeepRowsByPartialMatch:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|