stcrpy 1.0.0__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.
Files changed (68) hide show
  1. examples/__init__.py +0 -0
  2. examples/egnn.py +425 -0
  3. stcrpy/__init__.py +5 -0
  4. stcrpy/tcr_datasets/__init__.py +0 -0
  5. stcrpy/tcr_datasets/tcr_graph_dataset.py +499 -0
  6. stcrpy/tcr_datasets/tcr_selector.py +0 -0
  7. stcrpy/tcr_datasets/tcr_structure_dataset.py +0 -0
  8. stcrpy/tcr_datasets/utils.py +350 -0
  9. stcrpy/tcr_formats/__init__.py +0 -0
  10. stcrpy/tcr_formats/tcr_formats.py +114 -0
  11. stcrpy/tcr_formats/tcr_haddock.py +556 -0
  12. stcrpy/tcr_geometry/TCRCoM.py +350 -0
  13. stcrpy/tcr_geometry/TCRCoM_LICENCE +168 -0
  14. stcrpy/tcr_geometry/TCRDock.py +261 -0
  15. stcrpy/tcr_geometry/TCRGeom.py +450 -0
  16. stcrpy/tcr_geometry/TCRGeomFiltering.py +273 -0
  17. stcrpy/tcr_geometry/__init__.py +0 -0
  18. stcrpy/tcr_geometry/reference_data/__init__.py +0 -0
  19. stcrpy/tcr_geometry/reference_data/dock_reference_1_imgt_numbered.pdb +6549 -0
  20. stcrpy/tcr_geometry/reference_data/dock_reference_2_imgt_numbered.pdb +6495 -0
  21. stcrpy/tcr_geometry/reference_data/reference_A.pdb +31 -0
  22. stcrpy/tcr_geometry/reference_data/reference_B.pdb +31 -0
  23. stcrpy/tcr_geometry/reference_data/reference_D.pdb +31 -0
  24. stcrpy/tcr_geometry/reference_data/reference_G.pdb +31 -0
  25. stcrpy/tcr_geometry/reference_data/reference_data.py +104 -0
  26. stcrpy/tcr_interactions/PLIPParser.py +147 -0
  27. stcrpy/tcr_interactions/TCRInteractionProfiler.py +433 -0
  28. stcrpy/tcr_interactions/TCRpMHC_PLIP_Model_Parser.py +133 -0
  29. stcrpy/tcr_interactions/__init__.py +0 -0
  30. stcrpy/tcr_interactions/utils.py +170 -0
  31. stcrpy/tcr_methods/__init__.py +0 -0
  32. stcrpy/tcr_methods/tcr_batch_operations.py +223 -0
  33. stcrpy/tcr_methods/tcr_methods.py +150 -0
  34. stcrpy/tcr_methods/tcr_reformatting.py +18 -0
  35. stcrpy/tcr_metrics/__init__.py +2 -0
  36. stcrpy/tcr_metrics/constants.py +39 -0
  37. stcrpy/tcr_metrics/tcr_interface_rmsd.py +237 -0
  38. stcrpy/tcr_metrics/tcr_rmsd.py +179 -0
  39. stcrpy/tcr_ml/__init__.py +0 -0
  40. stcrpy/tcr_ml/geometry_predictor.py +3 -0
  41. stcrpy/tcr_processing/AGchain.py +89 -0
  42. stcrpy/tcr_processing/Chemical_components.py +48915 -0
  43. stcrpy/tcr_processing/Entity.py +301 -0
  44. stcrpy/tcr_processing/Fragment.py +58 -0
  45. stcrpy/tcr_processing/Holder.py +24 -0
  46. stcrpy/tcr_processing/MHC.py +449 -0
  47. stcrpy/tcr_processing/MHCchain.py +149 -0
  48. stcrpy/tcr_processing/Model.py +37 -0
  49. stcrpy/tcr_processing/Select.py +145 -0
  50. stcrpy/tcr_processing/TCR.py +532 -0
  51. stcrpy/tcr_processing/TCRIO.py +47 -0
  52. stcrpy/tcr_processing/TCRParser.py +1230 -0
  53. stcrpy/tcr_processing/TCRStructure.py +148 -0
  54. stcrpy/tcr_processing/TCRchain.py +160 -0
  55. stcrpy/tcr_processing/__init__.py +3 -0
  56. stcrpy/tcr_processing/annotate.py +480 -0
  57. stcrpy/tcr_processing/utils/__init__.py +0 -0
  58. stcrpy/tcr_processing/utils/common.py +67 -0
  59. stcrpy/tcr_processing/utils/constants.py +367 -0
  60. stcrpy/tcr_processing/utils/region_definitions.py +782 -0
  61. stcrpy/utils/__init__.py +0 -0
  62. stcrpy/utils/error_stream.py +12 -0
  63. stcrpy-1.0.0.dist-info/METADATA +173 -0
  64. stcrpy-1.0.0.dist-info/RECORD +68 -0
  65. stcrpy-1.0.0.dist-info/WHEEL +5 -0
  66. stcrpy-1.0.0.dist-info/licenses/LICENCE +28 -0
  67. stcrpy-1.0.0.dist-info/licenses/stcrpy/tcr_geometry/TCRCoM_LICENCE +168 -0
  68. stcrpy-1.0.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,350 @@
1
+ import os
2
+ import Bio
3
+ from typing import Union
4
+ import warnings
5
+ import numpy as np
6
+
7
+ from ..tcr_processing.TCRParser import TCRParser
8
+ from ..tcr_processing.TCRIO import TCRIO
9
+ from ..tcr_processing import abTCR, MHCchain
10
+
11
+
12
+ # Some of this code is adapted and refactored from https://github.com/EsamTolba/TCR-CoM/
13
+ # Please see the TCRCoM_LICENSE for the license that applies to those code sections.
14
+
15
+ class TCRCoM:
16
+ def __init__(self):
17
+ """Abstract class for calculating TCR centre of mass after aligning TCR:pMHC complex to reference MHC structure."""
18
+ self.set_reffile()
19
+
20
+ tcr_parser = TCRParser()
21
+ self.ref_model = list(
22
+ tcr_parser.get_tcr_structure("reference", self.reffile).get_TCRs()
23
+ )[0]
24
+ self.set_reference_residues()
25
+
26
+ def set_reffile(self):
27
+ """Super method for setting MHC reference file.
28
+
29
+ Raises:
30
+ NotImplementedError
31
+ """
32
+ raise NotImplementedError(
33
+ "TCRCom cannot be insantiated directly, instantiate its subclass"
34
+ )
35
+
36
+ def set_reference_residues(self):
37
+ """Set TCR and MHC reference residues."""
38
+ self.set_tcr_reference()
39
+ self.set_mhc_reference()
40
+
41
+ def set_tcr_reference(self):
42
+ """Set TCR variable domain residues in reference model as residues numbered 1 to 121 for VA and 1 to 126 for VB."""
43
+ self.reference_VA_residues = [
44
+ r
45
+ for r in self.ref_model.get_VA().get_residues()
46
+ if r.get_id()[1] >= 1 and r.get_id()[1] <= 121
47
+ ]
48
+ self.reference_VB_residues = [
49
+ r
50
+ for r in self.ref_model.get_VB().get_residues()
51
+ if r.get_id()[1] >= 1 and r.get_id()[1] <= 126
52
+ ]
53
+
54
+ def set_mhc_reference(self):
55
+ """Super method for setting MHC reference residues for superposition. Overwritten by MHC class sepcific methods.
56
+
57
+ Raises:
58
+ NotImplementedError
59
+ """
60
+ raise NotImplementedError(
61
+ "TCRCom cannot be insantiated directly, instantiate its subclass"
62
+ )
63
+
64
+ def get_filtered_TCR_residues(self, tcr: "TCR") -> "tuple[list[Bio.PDB.Residue]]":
65
+ """Get variable domain residues of query TCR and filter out those without a counterpart in the reference TCR.
66
+
67
+ Args:
68
+ tcr (TCR): TCR structure object
69
+
70
+ Returns:
71
+ tuple[list[Bio.PDB.Residue]]: VA_residues, VB_residues.
72
+ """
73
+ tcr_A_residues = [
74
+ tcr.get_VA()[r.get_id()]
75
+ for r in self.reference_VA_residues
76
+ if r.get_id() in tcr.get_VA()
77
+ ]
78
+ tcr_B_residues = [
79
+ tcr.get_VB()[r.get_id()]
80
+ for r in self.reference_VB_residues
81
+ if r.get_id() in tcr.get_VB()
82
+ ]
83
+ return tcr_A_residues, tcr_B_residues
84
+
85
+ def center_of_mass(
86
+ self,
87
+ entity: "Union[Bio.PDB.Entity.Entity, list[Bio.PDB.Atom.Atom]]",
88
+ geometric: bool = False,
89
+ ) -> np.array:
90
+ """Calculate the mass weighted or purely geometric centre of mass of an entity or a list of atoms.
91
+
92
+ Args:
93
+ entity (Union[Bio.PDB.Entity.Entity, list[Bio.PDB.Atom.Atom]]): Structure entity whose centre of mass will be calculated
94
+ geometric (bool, optional): Whether to calculate geometric mean. Defaults to False.
95
+
96
+ Raises:
97
+ ValueError: Checks input type to ensure atoms can be retrieved.
98
+ ValueError: Unknown atoms.
99
+
100
+ Returns:
101
+ np.array: centre of mass
102
+ """
103
+ # Structure, Model, Chain, Residue
104
+ if isinstance(entity, Bio.PDB.Entity.Entity):
105
+ atom_list = entity.get_atoms()
106
+ # List of Atoms
107
+ elif hasattr(entity, "__iter__") and [x for x in entity if x.level == "A"]:
108
+ atom_list = entity
109
+ else:
110
+ raise ValueError(
111
+ "Center of Mass can only be calculated from the following objects:\n"
112
+ "Structure, Model, Chain, Residue, list of Atoms."
113
+ )
114
+
115
+ masses, positions = zip(*[(atom.mass, atom.coord) for atom in atom_list])
116
+ positions = np.asarray(positions)
117
+ if "ukn" in set(masses) and not geometric:
118
+ raise ValueError(
119
+ "Some Atoms don't have an element assigned.\n"
120
+ "Try adding them manually or calculate the geometrical center of mass instead"
121
+ )
122
+
123
+ if geometric:
124
+ return positions.sum(axis=0) / len(atom_list)
125
+ else:
126
+ return np.matmul(np.asarray(masses), positions) / len(atom_list)
127
+
128
+ def add_com(
129
+ self,
130
+ mhc_com: np.array,
131
+ tcr_com: np.array,
132
+ VA_com: np.array,
133
+ VB_com: np.array,
134
+ tcr: "TCR",
135
+ ) -> "TCR":
136
+ """
137
+ Function to add pseudoatoms at MHC-CoM, TCR-CoM, and XYZ axis to the output PDB file
138
+
139
+ Args:
140
+ mhc_com (np.array): MHC centre of mass
141
+ tcr_com (np.array): TCR centre of mass
142
+ VA_com (np.array): Alpha chain centre of mass
143
+ VB_com (np.array): Beta chain entre of mass
144
+ tcr (TCR): TCR structure object
145
+
146
+ Returns:
147
+ TCR: Copy of the original TCR strucutre object with added pseudo-atoms.
148
+ """
149
+ new_structure = tcr.copy()
150
+
151
+ # mhc com
152
+ mhc_com_chain = "X"
153
+ new_structure.add(Bio.PDB.Chain.Chain(mhc_com_chain))
154
+ res_id = (" ", 1, " ")
155
+ new_residue = Bio.PDB.Residue.Residue(res_id, "MCM", " ")
156
+ new_atom = Bio.PDB.Atom.Atom("C", mhc_com, 0, 0.0, " ", "C", 1, "C")
157
+ new_residue.add(new_atom)
158
+ new_structure.child_dict[mhc_com_chain].add(new_residue)
159
+
160
+ # tcr com
161
+ tcr_com_chain = "Y"
162
+ new_structure.add(Bio.PDB.Chain.Chain(tcr_com_chain))
163
+ pseudo_atom_ids = ["TCM", "ACM", "BCM"]
164
+ tcr_com_list = [tcr_com, VA_com, VB_com]
165
+ for i in range(3):
166
+ res_id = (" ", i + 1, " ")
167
+ new_residue = Bio.PDB.Residue.Residue(res_id, pseudo_atom_ids[i], " ")
168
+ new_atom = Bio.PDB.Atom.Atom("C", tcr_com_list[i], 0, 0.0, " ", "C", 1, "C")
169
+ new_residue.add(new_atom)
170
+ new_structure.child_dict[tcr_com_chain].add(new_residue)
171
+
172
+ # X,Y,Z atoms
173
+ pos = [[50, 0, 0], [0, 50, 0], [0, 0, 50]]
174
+ resn = ["X", "Y", "Z"]
175
+ xyz_chain = "Z"
176
+ new_structure.add(Bio.PDB.Chain.Chain(xyz_chain))
177
+ for i in [0, 1, 2]:
178
+ res_id = (" ", i + 1, " ")
179
+ new_residue = Bio.PDB.Residue.Residue(res_id, resn[i], " ")
180
+ new_atom = Bio.PDB.Atom.Atom("O", pos[i], 0, 0.0, " ", "O", 1, "O")
181
+ new_residue.add(new_atom)
182
+ new_structure.child_dict[xyz_chain].add(new_residue)
183
+
184
+ return new_structure
185
+
186
+ def calculate_centres_of_mass(
187
+ self,
188
+ tcr: abTCR,
189
+ save_aligned_as: str = None,
190
+ ) -> tuple[np.array]:
191
+ """Calculate the TCR and MHC centres of mass of an stcrpy TCR structure object.
192
+
193
+ Args:
194
+ tcr (abTCR): TCR structure object
195
+ save_aligned_as (str): Path to same alignment to. If None or False alignment is not saved. Defaults to None.
196
+
197
+ Raises:
198
+ NotImplementedError: Alpha Beta TCR compatible only, Gamma Delta TCRs not implemented.
199
+
200
+ Returns:
201
+ tuple[np.array]: tcr_com, mhc_com, tcr_VA_com, tcr_VB_com
202
+ """
203
+
204
+ assert len(tcr.get_MHC()) > 0, "No MHC associated with TCR"
205
+ if not isinstance(tcr, abTCR):
206
+ raise NotImplementedError(
207
+ f"TCR MHC geometry only implemented for abTCR types, not {type(tcr)}"
208
+ )
209
+
210
+ mhc_atoms = [res["CA"] for res in self.get_filtered_MHC_residues(tcr)]
211
+ ref_mhc_atoms = [
212
+ res["CA"]
213
+ for res in self.reference_MHC_residues
214
+ if (res.parent.chain_type, res.get_id())
215
+ in [(a.parent.parent.chain_type, a.parent.get_id()) for a in mhc_atoms]
216
+ ]
217
+
218
+ superimposer = Bio.PDB.Superimposer()
219
+ superimposer.set_atoms(ref_mhc_atoms, mhc_atoms)
220
+ self.mhc_alignment_transform = (x.astype("f") for x in superimposer.rotran)
221
+ superimposer.apply(tcr.parent.get_atoms())
222
+
223
+ mhc_com = self.center_of_mass(mhc_atoms, geometric=True)
224
+
225
+ tcr_VA_residues, tcr_VB_residues = self.get_filtered_TCR_residues(tcr)
226
+ tcr_VA_atoms = [res["CA"] for res in tcr_VA_residues]
227
+ tcr_VA_com = self.center_of_mass(tcr_VA_atoms, geometric=True)
228
+
229
+ tcr_VB_atoms = [res["CA"] for res in tcr_VB_residues]
230
+ tcr_VB_com = self.center_of_mass(tcr_VB_atoms, geometric=True)
231
+
232
+ tcr_com = self.center_of_mass(tcr_VA_atoms + tcr_VB_atoms, geometric=True)
233
+
234
+ if save_aligned_as:
235
+ if not isinstance(save_aligned_as, str):
236
+ save_aligned_as = os.path.join(
237
+ os.getcwd(), f"{tcr.parent.parent.id}_{tcr.id}.pdb"
238
+ )
239
+ aligned_tcr = self.add_com(mhc_com, tcr_com, tcr_VA_com, tcr_VB_com, tcr)
240
+ io = TCRIO()
241
+ io.save(aligned_tcr, save_as=save_aligned_as)
242
+
243
+ # com_distance = tcr_com - mhc_com
244
+ # r = np.sqrt(np.sum(np.square(com_distance)))
245
+ # theta = np.degrees(np.arctan2(com_distance[1], com_distance[0]))
246
+ # phi = np.degrees(np.arccos(com_distance[2] / r))
247
+
248
+ # return r, theta, phi
249
+
250
+ return tcr_com, mhc_com, tcr_VA_com, tcr_VB_com
251
+
252
+
253
+ class MHCI_TCRCoM(TCRCoM):
254
+ def __init__(self):
255
+ """TCRCoM module for MHC Class I complexes."""
256
+ super().__init__()
257
+
258
+ def set_reffile(self):
259
+ """Sets reference file for MHC class I structures"""
260
+ self.reffile = os.path.join(
261
+ os.path.dirname(__file__),
262
+ "reference_data/dock_reference_1_imgt_numbered.pdb",
263
+ )
264
+
265
+ def set_mhc_reference(self):
266
+ """Set class I reference MHC residues"""
267
+ mhc = self.ref_model.get_MHC()[0].get_MH1()
268
+ self.reference_MHC_residues = [
269
+ r for r in mhc.get_residues() if r.get_id()[1] >= 1 and r.get_id()[1] <= 179
270
+ ]
271
+
272
+ def get_filtered_MHC_residues(self, tcr: "TCR") -> list[Bio.PDB.Residue]:
273
+ """Retrieve MHC residues from query TCR and filter out those whose counterpart is not found in reference.
274
+
275
+ Args:
276
+ tcr (TCR): TCR structure object associated with MHC Class I.
277
+
278
+ Returns:
279
+ list[Bio.PDB.Residue]: filtered_MHC_residues
280
+ """
281
+ mhc = tcr.get_MHC()[0]
282
+ if not isinstance(mhc, MHCchain): # handle single MHC chain case
283
+ mhc = mhc.get_MH1()
284
+ filtered_MHC_residues = [
285
+ mhc[ref_res.get_id()]
286
+ for ref_res in self.reference_MHC_residues
287
+ if ref_res.get_id() in mhc
288
+ ]
289
+ return filtered_MHC_residues
290
+
291
+
292
+ class MHCII_TCRCoM(TCRCoM):
293
+ def __init__(self):
294
+ """TCRCoM module for MHC Class II complexes."""
295
+ super().__init__()
296
+
297
+ def set_reffile(self):
298
+ """Sets reference file for MHC class II structures"""
299
+ self.reffile = os.path.join(
300
+ os.path.dirname(__file__),
301
+ "reference_data/dock_reference_2_imgt_numbered.pdb",
302
+ )
303
+
304
+ def set_mhc_reference(self):
305
+ """Set class II reference MHC residues"""
306
+ mhc = self.ref_model.get_MHC()[0]
307
+ self.reference_MHC_residues = [
308
+ r
309
+ for r in mhc.get_GA().get_residues()
310
+ if r.get_id()[1] >= 1 and r.get_id()[1] <= 88
311
+ ]
312
+ self.reference_MHC_residues.extend(
313
+ [
314
+ r
315
+ for r in mhc.get_GB().get_residues()
316
+ if r.get_id()[1] >= 1 and r.get_id()[1] <= 87
317
+ ]
318
+ )
319
+
320
+ def get_filtered_MHC_residues(self, tcr: "TCR") -> list[Bio.PDB.Residue]:
321
+ """Retrieve MHC residues from query TCR and filter out those whose counterpart is not found in reference.
322
+
323
+ Args:
324
+ tcr (TCR): TCR structure object associated with MHC Class II.
325
+
326
+ Returns:
327
+ list[Bio.PDB.Residue]: filtered_MHC_residues
328
+ """
329
+ mhc = tcr.get_MHC()[0]
330
+ if hasattr(mhc, "get_GA"):
331
+ filtered_MHC_residues = [
332
+ mhc.get_GA()[ref_res.get_id()]
333
+ for ref_res in self.reference_MHC_residues
334
+ if ref_res.parent.chain_type == "GA"
335
+ and ref_res.get_id() in mhc.get_GA()
336
+ ]
337
+ else:
338
+ warnings.warn(f"No GA chain found for MHC class II: {mhc}")
339
+ if hasattr(mhc, "get_GA"):
340
+ filtered_MHC_residues.extend(
341
+ [
342
+ mhc.get_GB()[ref_res.get_id()]
343
+ for ref_res in self.reference_MHC_residues
344
+ if ref_res.parent.chain_type == "GB"
345
+ and ref_res.get_id() in mhc.get_GB()
346
+ ]
347
+ )
348
+ else:
349
+ warnings.warn(f"No GB chain found for MHC class II: {mhc}")
350
+ return filtered_MHC_residues
@@ -0,0 +1,168 @@
1
+ This license applies to the modified TCRCoM code located in TCRCoM.py within the stcrpy package. Original license can be found here: https://github.com/EsamTolba/TCR-CoM/blob/master/LICENSE
2
+
3
+
4
+ GNU LESSER GENERAL PUBLIC LICENSE
5
+ Version 3, 29 June 2007
6
+
7
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
8
+ Everyone is permitted to copy and distribute verbatim copies
9
+ of this license document, but changing it is not allowed.
10
+
11
+
12
+ This version of the GNU Lesser General Public License incorporates
13
+ the terms and conditions of version 3 of the GNU General Public
14
+ License, supplemented by the additional permissions listed below.
15
+
16
+ 0. Additional Definitions.
17
+
18
+ As used herein, "this License" refers to version 3 of the GNU Lesser
19
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
20
+ General Public License.
21
+
22
+ "The Library" refers to a covered work governed by this License,
23
+ other than an Application or a Combined Work as defined below.
24
+
25
+ An "Application" is any work that makes use of an interface provided
26
+ by the Library, but which is not otherwise based on the Library.
27
+ Defining a subclass of a class defined by the Library is deemed a mode
28
+ of using an interface provided by the Library.
29
+
30
+ A "Combined Work" is a work produced by combining or linking an
31
+ Application with the Library. The particular version of the Library
32
+ with which the Combined Work was made is also called the "Linked
33
+ Version".
34
+
35
+ The "Minimal Corresponding Source" for a Combined Work means the
36
+ Corresponding Source for the Combined Work, excluding any source code
37
+ for portions of the Combined Work that, considered in isolation, are
38
+ based on the Application, and not on the Linked Version.
39
+
40
+ The "Corresponding Application Code" for a Combined Work means the
41
+ object code and/or source code for the Application, including any data
42
+ and utility programs needed for reproducing the Combined Work from the
43
+ Application, but excluding the System Libraries of the Combined Work.
44
+
45
+ 1. Exception to Section 3 of the GNU GPL.
46
+
47
+ You may convey a covered work under sections 3 and 4 of this License
48
+ without being bound by section 3 of the GNU GPL.
49
+
50
+ 2. Conveying Modified Versions.
51
+
52
+ If you modify a copy of the Library, and, in your modifications, a
53
+ facility refers to a function or data to be supplied by an Application
54
+ that uses the facility (other than as an argument passed when the
55
+ facility is invoked), then you may convey a copy of the modified
56
+ version:
57
+
58
+ a) under this License, provided that you make a good faith effort to
59
+ ensure that, in the event an Application does not supply the
60
+ function or data, the facility still operates, and performs
61
+ whatever part of its purpose remains meaningful, or
62
+
63
+ b) under the GNU GPL, with none of the additional permissions of
64
+ this License applicable to that copy.
65
+
66
+ 3. Object Code Incorporating Material from Library Header Files.
67
+
68
+ The object code form of an Application may incorporate material from
69
+ a header file that is part of the Library. You may convey such object
70
+ code under terms of your choice, provided that, if the incorporated
71
+ material is not limited to numerical parameters, data structure
72
+ layouts and accessors, or small macros, inline functions and templates
73
+ (ten or fewer lines in length), you do both of the following:
74
+
75
+ a) Give prominent notice with each copy of the object code that the
76
+ Library is used in it and that the Library and its use are
77
+ covered by this License.
78
+
79
+ b) Accompany the object code with a copy of the GNU GPL and this license
80
+ document.
81
+
82
+ 4. Combined Works.
83
+
84
+ You may convey a Combined Work under terms of your choice that,
85
+ taken together, effectively do not restrict modification of the
86
+ portions of the Library contained in the Combined Work and reverse
87
+ engineering for debugging such modifications, if you also do each of
88
+ the following:
89
+
90
+ a) Give prominent notice with each copy of the Combined Work that
91
+ the Library is used in it and that the Library and its use are
92
+ covered by this License.
93
+
94
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
95
+ document.
96
+
97
+ c) For a Combined Work that displays copyright notices during
98
+ execution, include the copyright notice for the Library among
99
+ these notices, as well as a reference directing the user to the
100
+ copies of the GNU GPL and this license document.
101
+
102
+ d) Do one of the following:
103
+
104
+ 0) Convey the Minimal Corresponding Source under the terms of this
105
+ License, and the Corresponding Application Code in a form
106
+ suitable for, and under terms that permit, the user to
107
+ recombine or relink the Application with a modified version of
108
+ the Linked Version to produce a modified Combined Work, in the
109
+ manner specified by section 6 of the GNU GPL for conveying
110
+ Corresponding Source.
111
+
112
+ 1) Use a suitable shared library mechanism for linking with the
113
+ Library. A suitable mechanism is one that (a) uses at run time
114
+ a copy of the Library already present on the user's computer
115
+ system, and (b) will operate properly with a modified version
116
+ of the Library that is interface-compatible with the Linked
117
+ Version.
118
+
119
+ e) Provide Installation Information, but only if you would otherwise
120
+ be required to provide such information under section 6 of the
121
+ GNU GPL, and only to the extent that such information is
122
+ necessary to install and execute a modified version of the
123
+ Combined Work produced by recombining or relinking the
124
+ Application with a modified version of the Linked Version. (If
125
+ you use option 4d0, the Installation Information must accompany
126
+ the Minimal Corresponding Source and Corresponding Application
127
+ Code. If you use option 4d1, you must provide the Installation
128
+ Information in the manner specified by section 6 of the GNU GPL
129
+ for conveying Corresponding Source.)
130
+
131
+ 5. Combined Libraries.
132
+
133
+ You may place library facilities that are a work based on the
134
+ Library side by side in a single library together with other library
135
+ facilities that are not Applications and are not covered by this
136
+ License, and convey such a combined library under terms of your
137
+ choice, if you do both of the following:
138
+
139
+ a) Accompany the combined library with a copy of the same work based
140
+ on the Library, uncombined with any other library facilities,
141
+ conveyed under the terms of this License.
142
+
143
+ b) Give prominent notice with the combined library that part of it
144
+ is a work based on the Library, and explaining where to find the
145
+ accompanying uncombined form of the same work.
146
+
147
+ 6. Revised Versions of the GNU Lesser General Public License.
148
+
149
+ The Free Software Foundation may publish revised and/or new versions
150
+ of the GNU Lesser General Public License from time to time. Such new
151
+ versions will be similar in spirit to the present version, but may
152
+ differ in detail to address new problems or concerns.
153
+
154
+ Each version is given a distinguishing version number. If the
155
+ Library as you received it specifies that a certain numbered version
156
+ of the GNU Lesser General Public License "or any later version"
157
+ applies to it, you have the option of following the terms and
158
+ conditions either of that published version or of any later version
159
+ published by the Free Software Foundation. If the Library as you
160
+ received it does not specify a version number of the GNU Lesser
161
+ General Public License, you may choose any version of the GNU Lesser
162
+ General Public License ever published by the Free Software Foundation.
163
+
164
+ If the Library as you received it specifies that a proxy can decide
165
+ whether future versions of the GNU Lesser General Public License shall
166
+ apply, that proxy's public statement of acceptance of any version is
167
+ permanent authorization for you to choose that version for the
168
+ Library.