msreport 0.0.24__tar.gz → 0.0.25__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.24 → msreport-0.0.25}/PKG-INFO +1 -1
- {msreport-0.0.24 → msreport-0.0.25}/msreport/__init__.py +1 -1
- {msreport-0.0.24 → msreport-0.0.25}/msreport/plot.py +6 -3
- {msreport-0.0.24 → msreport-0.0.25}/msreport/qtable.py +25 -9
- {msreport-0.0.24 → msreport-0.0.25}/msreport/reader.py +5 -3
- {msreport-0.0.24 → msreport-0.0.25}/msreport.egg-info/PKG-INFO +1 -1
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_qtable.py +18 -9
- {msreport-0.0.24 → msreport-0.0.25}/LICENSE.txt +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/README.md +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/aggregate/__init__.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/aggregate/condense.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/aggregate/pivot.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/aggregate/summarize.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/analyze.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/errors.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/export.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/fasta.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/helper/__init__.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/helper/calc.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/helper/maxlfq.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/helper/table.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/helper/temp.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/impute.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/isobar.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/normalize.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/peptidoform.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/rinterface/__init__.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/rinterface/limma.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/rinterface/rinstaller.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport/rinterface/rscripts/limma.R +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport.egg-info/SOURCES.txt +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport.egg-info/dependency_links.txt +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport.egg-info/requires.txt +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/msreport.egg-info/top_level.txt +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/pyproject.toml +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/setup.cfg +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/setup.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_analyze.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_export.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_helper.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_impute.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_isobar.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_maxlfq.py +0 -0
- {msreport-0.0.24 → msreport-0.0.25}/tests/test_peptidoform.py +0 -0
|
@@ -718,7 +718,10 @@ def volcano_ma(
|
|
|
718
718
|
)
|
|
719
719
|
|
|
720
720
|
ax.set_xlabel(x_variable)
|
|
721
|
-
|
|
721
|
+
if y_variable == pvalue_tag:
|
|
722
|
+
ax.set_ylabel(f"{y_variable} [-log10]")
|
|
723
|
+
else:
|
|
724
|
+
ax.set_ylabel(f"{y_variable} [log2]")
|
|
722
725
|
|
|
723
726
|
fig.tight_layout()
|
|
724
727
|
return fig, axes
|
|
@@ -1075,13 +1078,13 @@ def pvalue_histogram(
|
|
|
1075
1078
|
)
|
|
1076
1079
|
|
|
1077
1080
|
# Adjust x- and y-axis
|
|
1078
|
-
ax.set_xlabel(None)
|
|
1079
1081
|
ax.set_xticks(np.arange(0, 1.01, 0.5))
|
|
1080
1082
|
ax.tick_params(labelsize=9)
|
|
1081
1083
|
if plot_number > 0:
|
|
1082
1084
|
ax.tick_params(axis="y", color="none")
|
|
1083
1085
|
|
|
1084
|
-
# Add second label
|
|
1086
|
+
# Add x-label and second y-label
|
|
1087
|
+
ax.set_xlabel(pvalue_tag, fontsize=9)
|
|
1085
1088
|
ax2 = ax.twinx()
|
|
1086
1089
|
ax2.set_yticks([])
|
|
1087
1090
|
ax2.set_ylabel(comparison_group, fontsize=9)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import Any, Optional
|
|
2
|
+
from typing import Any, Iterable, Optional
|
|
3
3
|
import os
|
|
4
4
|
import warnings
|
|
5
5
|
|
|
@@ -196,8 +196,9 @@ class Qtable:
|
|
|
196
196
|
columns = helper.find_sample_columns(self.data, tag, samples)
|
|
197
197
|
table = self.get_data(exclude_invalid=exclude_invalid)[columns]
|
|
198
198
|
if samples_as_columns:
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
sample_to_columns = _match_samples_to_tag_columns(samples, columns, tag)
|
|
200
|
+
columns_to_samples = {v: k for k, v in sample_to_columns.items()}
|
|
201
|
+
table.rename(columns=columns_to_samples, inplace=True)
|
|
201
202
|
return table
|
|
202
203
|
|
|
203
204
|
def make_expression_table(
|
|
@@ -502,15 +503,30 @@ def _exclude_invalid(df: pd.DataFrame) -> pd.DataFrame:
|
|
|
502
503
|
return df[df["Valid"]].copy()
|
|
503
504
|
|
|
504
505
|
|
|
505
|
-
def
|
|
506
|
-
|
|
506
|
+
def _match_samples_to_tag_columns(
|
|
507
|
+
samples: Iterable[str],
|
|
508
|
+
columns: Iterable[str],
|
|
509
|
+
tag: str,
|
|
510
|
+
) -> dict:
|
|
511
|
+
"""Mapping of samples to columns which contain the sample and the tag.
|
|
507
512
|
|
|
508
|
-
|
|
509
|
-
|
|
513
|
+
Args:
|
|
514
|
+
samples: A list of sample names.
|
|
515
|
+
columns: A list of column names.
|
|
516
|
+
tag: A string that must be present in the column names.
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
A dictionary that maps sample names to column names that contain the sample
|
|
520
|
+
name and the tag.
|
|
510
521
|
"""
|
|
522
|
+
WHITESPACE_CHARS = " ."
|
|
523
|
+
|
|
511
524
|
mapping = dict()
|
|
512
|
-
for
|
|
513
|
-
|
|
525
|
+
for sample in samples:
|
|
526
|
+
for col in columns:
|
|
527
|
+
if col.replace(tag, "").replace(sample, "").strip(WHITESPACE_CHARS) == "":
|
|
528
|
+
mapping[sample] = col
|
|
529
|
+
break
|
|
514
530
|
return mapping
|
|
515
531
|
|
|
516
532
|
|
|
@@ -2196,9 +2196,11 @@ def extract_fragpipe_localization_probabilities(localization_entry: str) -> dict
|
|
|
2196
2196
|
_, probabilities = msreport.peptidoform.parse_modified_sequence(
|
|
2197
2197
|
probability_sequence, "(", ")"
|
|
2198
2198
|
)
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2199
|
+
if modification not in modification_probabilities:
|
|
2200
|
+
modification_probabilities[modification] = {}
|
|
2201
|
+
modification_probabilities[modification].update(
|
|
2202
|
+
{site: float(probability) for site, probability in probabilities}
|
|
2203
|
+
)
|
|
2202
2204
|
return modification_probabilities
|
|
2203
2205
|
|
|
2204
2206
|
|
|
@@ -84,15 +84,24 @@ class TestExcludeInvalid:
|
|
|
84
84
|
msreport.qtable._exclude_invalid(df)
|
|
85
85
|
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
87
|
+
class TestMatchSamplesToTagColumns:
|
|
88
|
+
def test_match_samples_to_tag_columns(self):
|
|
89
|
+
samples = ["SampleA_1", "SampleA_2", "SampleB_1"]
|
|
90
|
+
columns = ["Tag SampleA_1", "Tag SampleA_2", "Tag SampleB_1"]
|
|
91
|
+
true_mapping = {
|
|
92
|
+
"SampleA_1": "Tag SampleA_1",
|
|
93
|
+
"SampleA_2": "Tag SampleA_2",
|
|
94
|
+
"SampleB_1": "Tag SampleB_1",
|
|
95
|
+
}
|
|
96
|
+
observed_mapping = msreport.qtable._match_samples_to_tag_columns(samples, columns, "Tag") # fmt:skip
|
|
97
|
+
assert observed_mapping == true_mapping
|
|
98
|
+
|
|
99
|
+
def test_correct_mapping_with_samples_that_are_substrings(self):
|
|
100
|
+
samples = ["B_1", "SampleB_1"]
|
|
101
|
+
columns = ["Tag B_1", "Tag SampleB_1"]
|
|
102
|
+
true_mapping = {"B_1": "Tag B_1", "SampleB_1": "Tag SampleB_1"}
|
|
103
|
+
observed_mapping = msreport.qtable._match_samples_to_tag_columns(samples, columns, "Tag") # fmt:skip
|
|
104
|
+
assert observed_mapping == true_mapping
|
|
96
105
|
|
|
97
106
|
|
|
98
107
|
def test_qtable_setup():
|
|
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
|