pyXLMS 0.0.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.
pyXLMS/__init__.py ADDED
File without changes
pyXLMS/data.py ADDED
@@ -0,0 +1,126 @@
1
+ #!/usr/bin/env python3
2
+
3
+ # 2024 (c) Micha Johannes Birklbauer
4
+ # https://github.com/michabirklbauer/
5
+ # micha.birklbauer@gmail.com
6
+
7
+ from typing import List
8
+ from typing import Dict
9
+ from typing import Any
10
+
11
+ def check_input(parameter: Any,
12
+ parameter_name: str,
13
+ supported_class: Any,
14
+ supported_subclass: Any = None) -> bool:
15
+ """Checks if the given parameter is of the specified type.
16
+
17
+ Parameters
18
+ ----------
19
+ parameter : any
20
+ Parameter to check class of.
21
+ parameter_name : str
22
+ Name of the parameter.
23
+ supported_class : any
24
+ Class the parameter has to be of.
25
+ supported_subclass : any
26
+ Class of the values in case the parameter is a list.
27
+
28
+ Returns
29
+ -------
30
+ bool
31
+ If the given input is okay.
32
+
33
+ Raises
34
+ ------
35
+ TypeError
36
+ If the parameter is not of the given class.
37
+ """
38
+ if type(parameter) != supported_class:
39
+ raise TypeError(f"{parameter_name} must be {supported_class}!")
40
+ if type(parameter) == list and supported_subclass is not None:
41
+ for value in parameter:
42
+ if type(value) != supported_subclass:
43
+ raise TypeError(f"List values of {parameter_name} must be {supported_subclass}")
44
+ return True
45
+
46
+ def create_crosslink(peptide_a: str,
47
+ xl_position_peptide_a: int,
48
+ proteins_a: List[str],
49
+ xl_position_proteins_a: List[int],
50
+ peptide_b: str,
51
+ xl_position_peptide_b: int,
52
+ proteins_b: List[str],
53
+ xl_position_proteins_b: List[int],
54
+ score: float) -> Dict[str, Any]:
55
+ """Returns a crosslink dictionary.
56
+
57
+ Parameters
58
+ ----------
59
+ peptide_a : str
60
+ The unmodified amino acid sequence of the first peptide.
61
+ xl_position_peptide_a : int
62
+ The position of the crosslinker in the sequence of the first peptide (1-based).
63
+ proteins_a: list of str
64
+ The accessions of proteins that the first peptide is associated with.
65
+ xl_position_proteins_a: list of int
66
+ Positions of the crosslink in the proteins of the first peptide (1-based).
67
+ peptide_b : str
68
+ The unmodified amino acid sequence of the second peptide.
69
+ xl_position_peptide_b : int
70
+ The position of the crosslinker in the sequence of the second peptide (1-based).
71
+ proteins_b: list of str
72
+ The accessions of proteins that the second peptide is associated with.
73
+ xl_position_proteins_b: list of int
74
+ Positions of the crosslink in the proteins of the second peptide (1-based).
75
+ score: float
76
+ Score of the crosslink.
77
+
78
+ Returns
79
+ -------
80
+ dict
81
+ The dictionary representing the crosslink with keys data_type, alpha_peptide, alpha_peptide_crosslink_position,
82
+ alpha_proteins, alpha_proteins_crosslink_positions, beta_peptide, beta_peptide_crosslink_position, beta_proteins,
83
+ beta_proteins_crosslink_positions, and score.
84
+ Alpha and beta are assigned based on peptide sequence, the peptide that alphabetically comes first is assigned to alpha.
85
+ """
86
+ ## input checks
87
+ check_input(peptide_a, "peptide_a", str)
88
+ check_input(peptide_b, "peptide_b", str)
89
+ check_input(xl_position_peptide_a, "xl_position_peptide_a", int)
90
+ check_input(xl_position_peptide_b, "xl_position_peptide_b", int)
91
+ check_input(proteins_a, "proteins_a", list, str)
92
+ check_input(proteins_b, "proteins_b", list, str)
93
+ check_input(xl_position_proteins_a, "xl_position_proteins_a", list, int)
94
+ check_input(xl_position_proteins_b, "xl_position_proteins_b", list, int)
95
+ check_input(score, "score", float)
96
+ if len(proteins_a) != len(xl_position_proteins_a):
97
+ raise ValueError("Crosslink position has to be given for every protein! Length of proteins_a and xl_position_proteins_a has to match!")
98
+ if len(proteins_b) != len(xl_position_proteins_b):
99
+ raise ValueError("Crosslink position has to be given for every protein! Length of proteins_b and xl_position_proteins_b has to match!")
100
+ ## processing
101
+ crosslink = {f"{peptide_a.strip()}{xl_position_peptide_a}":
102
+ {
103
+ "peptide": peptide_a,
104
+ "xl_position_peptide": xl_position_peptide_a,
105
+ "proteins": proteins_a,
106
+ "xl_position_proteins": xl_position_proteins_a
107
+ },
108
+ f"{peptide_b.strip()}{xl_position_peptide_b}":
109
+ {
110
+ "peptide": peptide_b,
111
+ "xl_position_peptide": xl_position_peptide_b,
112
+ "proteins": proteins_b,
113
+ "xl_position_proteins": xl_position_proteins_b
114
+ }
115
+ }
116
+ keys = sorted(list(crosslink.keys()))
117
+ return {"data_type": "crosslink",
118
+ "alpha_peptide": crosslink[keys[0]]["peptide"].strip(),
119
+ "alpha_peptide_crosslink_position": crosslink[keys[0]]["xl_position_peptide"],
120
+ "alpha_proteins": [protein.strip() for protein in crosslink[keys[0]]["proteins"]],
121
+ "alpha_proteins_crosslink_positions": crosslink[keys[0]]["xl_position_proteins"],
122
+ "beta_peptide": crosslink[keys[1]]["peptide"].strip(),
123
+ "beta_peptide_crosslink_position": crosslink[keys[1]]["xl_position_peptide"],
124
+ "beta_proteins": [protein.strip() for protein in crosslink[keys[1]]["proteins"]],
125
+ "beta_proteins_crosslink_positions": crosslink[keys[1]]["xl_position_proteins"],
126
+ "score": score}
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Micha Johannes Birklbauer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.1
2
+ Name: pyXLMS
3
+ Version: 0.0.1
4
+ Summary: A python package to process protein cross-linking data.
5
+ Author-email: Micha Johannes Birklbauer <micha.birklbauer@fh-hagenberg.at>
6
+ Maintainer-email: Micha Johannes Birklbauer <micha.birklbauer@fh-hagenberg.at>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 Micha Johannes Birklbauer
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Project-URL: Homepage, https://github.com/hgb-bin-proteomics/pyXLMS
30
+ Project-URL: Documentation, https://hgb-bin-proteomics.github.io/pyXLMS
31
+ Project-URL: Issues, https://github.com/hgb-bin-proteomics/pyXLMS/issues
32
+ Keywords: crosslink,crosslinker,crosslinking,mass spectrometry,proteomics
33
+ Classifier: Programming Language :: Python :: 3
34
+ Classifier: License :: OSI Approved :: MIT License
35
+ Classifier: Operating System :: OS Independent
36
+ Requires-Python: >=3.7
37
+ Description-Content-Type: text/markdown
38
+ License-File: LICENSE
39
+ Requires-Dist: pandas
40
+ Provides-Extra: gui
41
+ Requires-Dist: streamlit ; extra == 'gui'
42
+
43
+ # pyXLMS
44
+
45
+ Supported search engines:
46
+ - MS Annika
47
+ - xiSearch / xiFDR
48
+ - MaxLynx
49
+ - ?
50
+
51
+ General interface with csv input
52
+
53
+ Packages to include:
54
+ - Export to xiNET
55
+ - Req:
56
+ - fasta file
57
+ - Crosslink:
58
+ - Sequence
59
+ - XL position in peptide
60
+ - protein accession
61
+ - XL position in protein
62
+ - Score
63
+ - Export to xiVIEW
64
+ - Req: cover by xiNET Req
65
+ - Export to xiFDR
66
+ - Req:
67
+ - CSM:
68
+ - Spectrum File
69
+ - Scan Nr
70
+ - Sequence
71
+ - XL position in peptide
72
+ - Precursor charge
73
+ - Score CSM
74
+ - Score peptide
75
+ - protein accession
76
+ - position of peptide in protein
77
+ - decoy peptide
78
+ - Export to pyXlinkViewer
79
+ - Req: all covered
80
+ - Export to XMAS
81
+ - Req: all covered
82
+ - Export to Spectral Library
83
+ - Req:
84
+ - MGF
85
+ - CSM:
86
+ - Modification
87
+ - RT
88
+ - Ion Mobility / Compensation Voltage
89
+ - MS Annika FDR
90
+ - Req: all covered
91
+ - MS Annika Combine Results
92
+ - Req: all covered
93
+ - CSM Annotation
94
+ - Req: this is probably MS Annika only, as it requires doublet information
@@ -0,0 +1,7 @@
1
+ pyXLMS/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ pyXLMS/data.py,sha256=a8dtzLAAaKemmoERc8DfY-38Q8sWS3320DP8nTLmPRM,5627
3
+ pyXLMS-0.0.1.dist-info/LICENSE,sha256=N_5mStWCiIu4tlY6BGEE-LP5Ak_E_TukpIB-xyeHbEk,1082
4
+ pyXLMS-0.0.1.dist-info/METADATA,sha256=tRd4cnsamsOOh8bPk3uG4bvD_cCkjqdHbyWlOzMEs3g,3128
5
+ pyXLMS-0.0.1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
6
+ pyXLMS-0.0.1.dist-info/top_level.txt,sha256=PSI-LSbSAP8H1vK38x0D4s8PejAinkrL2Dclm3-G35I,7
7
+ pyXLMS-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (73.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ pyXLMS