marsilea 0.4.2__py3-none-any.whl → 0.4.3__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.
oncoprinter/core.py ADDED
@@ -0,0 +1,360 @@
1
+ import warnings
2
+ from collections import Counter
3
+ from copy import deepcopy
4
+ from dataclasses import dataclass
5
+ from itertools import count
6
+ from typing import Any
7
+
8
+ import numpy as np
9
+ import pandas as pd
10
+ from marsilea import ClusterBoard
11
+ from marsilea.layers import LayersMesh, FrameRect, Piece
12
+ from marsilea.plotter import Labels, StackBar, Numbers, ColorMesh
13
+ from marsilea.utils import get_canvas_size_by_data
14
+
15
+ from .preset import SHAPE_BANK, MATCH_POOL, Alteration
16
+
17
+
18
+ def guess_alteration(event: str):
19
+ for alt, rule in MATCH_POOL.items():
20
+ if rule.is_match(event):
21
+ return alt
22
+ return Alteration.OTHER
23
+
24
+
25
+ @dataclass(repr=False)
26
+ class LayerData:
27
+ matrix: np.ndarray
28
+ piece: Piece
29
+ color: Any
30
+ event: Any
31
+
32
+ def __repr__(self):
33
+ return f"{self.piece.label} ({self.color})"
34
+
35
+
36
+ class GenomicData:
37
+ """Handle class for genomics data
38
+
39
+ Parameters
40
+ ----------
41
+ data : pd.DataFrame
42
+ Each column is:
43
+ 1) Sample ID
44
+ 2) Track name
45
+ 3) Alteration
46
+ samples_order : list, optional
47
+ The order of samples, by default None
48
+ tracks_order : list, optional
49
+ The order of tracks, by default None
50
+ custom_pieces : dict, optional
51
+ Custom pieces for each alteration, by default None
52
+
53
+ """
54
+
55
+ def __repr__(self):
56
+ ntrack, nsample = self.shape
57
+ return (
58
+ f"{ntrack} Tracks, {nsample} Samples with "
59
+ f"{len(self.events)} Alterations"
60
+ )
61
+
62
+ def __init__(
63
+ self,
64
+ data,
65
+ samples_order=None,
66
+ tracks_order=None,
67
+ custom_pieces=None,
68
+ ):
69
+ self.data = data.copy()
70
+ self.data.columns = ["sample", "track", "event"]
71
+
72
+ if samples_order is None:
73
+ samples_order = self.data["sample"].unique()
74
+
75
+ self.samples = samples_order
76
+ self._patients_ix = dict(zip(samples_order, count(0, 1)))
77
+
78
+ if tracks_order is None:
79
+ tracks_order = self.data["track"].unique()
80
+ self.tracks = tracks_order
81
+ self._tracks_ix = dict(zip(tracks_order, count(0, 1)))
82
+
83
+ self._shape = (len(self.tracks), len(self.samples))
84
+
85
+ if custom_pieces is None:
86
+ custom_pieces = {}
87
+ self.custom_pieces = custom_pieces
88
+
89
+ self._process_alterations()
90
+
91
+ layers = {}
92
+ for e in self.events:
93
+ layers[e] = np.zeros(self._shape, dtype=bool)
94
+
95
+ for _, row in self.data.iterrows():
96
+ patient, track, event = row
97
+ row_ix = self._tracks_ix[track]
98
+ col_ix = self._patients_ix[patient]
99
+ layers[event][row_ix, col_ix] = True
100
+
101
+ self.layers = layers
102
+
103
+ def _process_alterations(self):
104
+ events_alt = dict()
105
+ custom_events = list(self.custom_pieces.keys())
106
+ raw_events = self.data["event"].unique()
107
+
108
+ unknown_alterations = []
109
+ for e in raw_events:
110
+ alt = guess_alteration(e)
111
+ if alt == Alteration.OTHER:
112
+ alt = e
113
+ if e not in custom_events:
114
+ unknown_alterations.append(e)
115
+ events_alt[e] = alt
116
+ self.data["event"] = [events_alt[e] for e in self.data["event"]]
117
+ self.events = self.data["event"].unique()
118
+ if len(unknown_alterations) > 0:
119
+ msg = (
120
+ f"Found unknown alterations: {unknown_alterations}, "
121
+ f"please specify a piece for this alteration."
122
+ )
123
+ warnings.warn(msg)
124
+
125
+ @property
126
+ def shape(self):
127
+ return self._shape
128
+
129
+ def get_layers_data(self, background_color="#BEBEBE"):
130
+ # explicitly make copy
131
+ bg_pieces = deepcopy(SHAPE_BANK[Alteration.BACKGROUND])
132
+ bg_pieces.background_color = background_color
133
+
134
+ # Add background layer
135
+ layers_data = [
136
+ LayerData(
137
+ np.ones(self._shape), bg_pieces, background_color, Alteration.BACKGROUND
138
+ )
139
+ ]
140
+ for alt in self.events:
141
+ layer = self.layers[alt]
142
+ if not isinstance(alt, Alteration):
143
+ piece = self.custom_pieces.get(alt)
144
+ if piece is None:
145
+ # The default style for OTHER
146
+ piece = FrameRect(color="pink", label=alt)
147
+ else:
148
+ piece = deepcopy(piece)
149
+ else:
150
+ piece = deepcopy(SHAPE_BANK[alt])
151
+ color = piece.color
152
+ piece.background_color = background_color
153
+
154
+ layers_data.append(LayerData(layer, piece, color, alt))
155
+
156
+ return layers_data
157
+
158
+ def get_track_mutation_rate(self):
159
+ gb = self.data.groupby("track", sort=False, observed=True)
160
+ ts = {}
161
+ for track, df in gb:
162
+ ts[track] = len(df["sample"].unique())
163
+ counts = np.array([ts[t] for t in self.tracks])
164
+ return counts / len(self.samples)
165
+
166
+ def get_track_mutation_types(self):
167
+ gb = self.data.groupby("track", sort=False, observed=True)
168
+ cs = {}
169
+ for track, df in gb:
170
+ cs[track] = Counter(df["event"])
171
+ return pd.DataFrame(cs).fillna(0.0)
172
+
173
+ def get_sample_mutation_types(self):
174
+ gb = self.data.groupby("sample", sort=False, observed=True)
175
+ cs = {}
176
+ for track, df in gb:
177
+ cs[track] = Counter(df["event"])
178
+ return pd.DataFrame(cs).fillna(0.0)
179
+
180
+
181
+ class OncoPrint(ClusterBoard):
182
+ """OncoPrint plot
183
+
184
+ The oncoprint plot is a visualization for genomics data in cancer research.
185
+ It's first introduced by the cBioPortal project.
186
+ See https://www.cbioportal.org/oncoprinter for more details.
187
+
188
+ To use this class, import from oncoprinter
189
+
190
+ >>> from oncoprinter import OncoPrint
191
+
192
+ Parameters
193
+ ----------
194
+ genomic_data : pd.DataFrame
195
+ Genomics data, each column is:
196
+ 1) Sample ID
197
+ 2) Track name
198
+ 3) Alteration
199
+
200
+ patients_order : list, optional
201
+ The order of samples, by default None
202
+ tracks_order : list, optional
203
+ The order of tracks, by default None
204
+ pieces : dict, optional
205
+ Custom pieces for each alteration, by default None
206
+ See :class:`Piece <marsilea.layers.Piece>` for details
207
+ background_color : str, optional, default: "#BEBEBE"
208
+ The background color
209
+ shrink : tuple, optional, default: (0.8, 0.8)
210
+ The shrink ratio for each layer
211
+ width, height : float, optional
212
+ The size in inches to define the size of main canvas
213
+ aspect : float, optional, default: 2.5
214
+ The aspect ratio of the main canvas
215
+ legend_kws : dict, optional
216
+ The options for legend, by default None
217
+ See :class:`cat_legend <legendkit.cat_legend>` for details
218
+ name : str, optional
219
+ The name of this OncoPrint
220
+ add_tracks_names : str, optional, default: "left"
221
+ The position to add tracks names
222
+ If None, will not add tracks names
223
+ add_samples_names : str, optional, default: "bottom"
224
+ The position to add samples names
225
+ If None, will not add samples names
226
+ add_mut_perc : str, optional, default: "right"
227
+ The position to add mutation percentage
228
+ If None, will not add mutation percentage
229
+ add_tracks_counts : str, optional, default: "right"
230
+ The position to add tracks mutation counts
231
+ If None, will not add tracks mutation counts
232
+ add_mut_counts : str, optional, default: "top"
233
+ The position to add mutation counts
234
+ If None, will not add mutation counts
235
+ add_tracks_counts_size : float, optional, default: 0.2
236
+ The size of tracks mutation counts
237
+ add_tracks_counts_pad : float, optional, default: 0
238
+ The padding of tracks mutation counts
239
+ add_mut_counts_size : float, optional, default: 0.2
240
+ The size of mutation counts
241
+ add_mut_counts_pad : float, optional, default: 0.1
242
+ The padding of mutation counts
243
+
244
+ """
245
+
246
+ def __init__(
247
+ self,
248
+ genomic_data=None,
249
+ patients_order=None,
250
+ tracks_order=None,
251
+ pieces=None,
252
+ background_color="#BEBEBE",
253
+ shrink=(0.8, 0.8),
254
+ width=None,
255
+ height=None,
256
+ aspect=2.5,
257
+ legend_kws=None,
258
+ name=None,
259
+ add_tracks_names="left",
260
+ add_samples_names="bottom",
261
+ add_mut_perc="right",
262
+ add_tracks_counts="right",
263
+ add_mut_counts="top",
264
+ add_tracks_counts_size=0.2,
265
+ add_tracks_counts_pad=0,
266
+ add_mut_counts_size=0.2,
267
+ add_mut_counts_pad=0.1,
268
+ ):
269
+ data = GenomicData(
270
+ genomic_data,
271
+ samples_order=patients_order,
272
+ tracks_order=tracks_order,
273
+ custom_pieces=pieces,
274
+ )
275
+ self.genomic_data = data
276
+ width, height = get_canvas_size_by_data(
277
+ data.shape, width=width, height=height, scale=0.2, aspect=aspect
278
+ )
279
+
280
+ self.canvas = super().__init__(
281
+ name=name, cluster_data=np.zeros(data.shape), width=width, height=height
282
+ )
283
+
284
+ legend_options = dict(title="Alterations", handleheight=aspect, handlelength=1)
285
+ legend_kws = {} if legend_kws is None else legend_kws
286
+ legend_options.update(legend_kws)
287
+
288
+ layers, pieces, colors_mapper = [], [], {}
289
+ for layer in data.get_layers_data(background_color):
290
+ layers.append(layer.matrix)
291
+ pieces.append(layer.piece)
292
+ colors_mapper[layer.event] = layer.color
293
+ mesh = LayersMesh(
294
+ layers=layers, pieces=pieces, shrink=shrink, legend_kws=legend_options
295
+ )
296
+ self.add_layer(mesh)
297
+
298
+ if add_tracks_names:
299
+ self.add_plot(add_tracks_names, Labels(data.tracks))
300
+
301
+ # Add other statistics
302
+ track_mut_rate = data.get_track_mutation_rate()
303
+ # Convert to percentage string
304
+ if add_mut_perc:
305
+ rates = [_format_percentage(t) for t in track_mut_rate]
306
+ self.add_plot(add_mut_perc, Labels(rates))
307
+ if add_samples_names:
308
+ self.add_plot(add_samples_names, Labels(data.samples))
309
+
310
+ if add_tracks_counts:
311
+ track_counter = data.get_track_mutation_types()
312
+ colors = [colors_mapper[e] for e in track_counter.index]
313
+ track_bar = StackBar(track_counter, colors=colors, show_value=False)
314
+ self.add_plot(
315
+ add_tracks_counts,
316
+ track_bar,
317
+ legend=False,
318
+ size=add_tracks_counts_size,
319
+ pad=add_tracks_counts_pad,
320
+ )
321
+
322
+ if add_mut_counts:
323
+ patients_counter = data.get_sample_mutation_types()
324
+ colors = [colors_mapper[e] for e in patients_counter.index]
325
+ patients_bar = StackBar(patients_counter, colors=colors, show_value=False)
326
+ self.add_plot(
327
+ add_mut_counts,
328
+ patients_bar,
329
+ legend=False,
330
+ size=add_mut_counts_size,
331
+ pad=add_mut_counts_pad,
332
+ )
333
+ self.add_legends()
334
+
335
+ clinical_plots = {
336
+ "bar": Numbers,
337
+ "stack_bar": StackBar,
338
+ }
339
+
340
+ def add_clinical_data(self, data, plot="bar", size=None, pad=0.1, **kwargs):
341
+ data = data.loc[self.samples_order]
342
+ plotter = self.clinical_plots[plot]
343
+ self.add_bottom(plotter(data, **kwargs), size=size, pad=pad)
344
+
345
+ def add_heatmap_data(self, data, size=0.2, pad=0.1, **kwargs):
346
+ data = data.loc[self.samples_order]
347
+ options = {"cmap": "Blues", "label_loc": "left", **kwargs}
348
+ self.add_bottom(ColorMesh(data, **options), size=size, pad=pad)
349
+
350
+ @property
351
+ def samples_order(self):
352
+ return self.genomic_data.samples
353
+
354
+ @property
355
+ def tracks_order(self):
356
+ return self.genomic_data.tracks
357
+
358
+
359
+ def _format_percentage(t):
360
+ return f"{float(t) * 100:.2f}".rstrip("0").rstrip(".") + "%"
oncoprinter/preset.py ADDED
@@ -0,0 +1,258 @@
1
+ from dataclasses import dataclass, field
2
+ from enum import Enum, auto
3
+ from typing import List
4
+
5
+ import marsilea.layers as mlayers
6
+ import numpy as np
7
+ from matplotlib.collections import PatchCollection
8
+ from matplotlib.patches import Rectangle
9
+
10
+ # The preset follows the style of cBioPortal as much as possible
11
+ # https://github.com/cBioPortal/cbioportal-frontend/blob/master/src/shared/components/oncoprint/geneticrules.ts
12
+ MUT_COLOR_MISSENSE = "#008000"
13
+ MUT_COLOR_MISSENSE_PASSENGER = "#53D400"
14
+ MUT_COLOR_INFRAME = "#993404"
15
+ MUT_COLOR_INFRAME_PASSENGER = "#a68028"
16
+ MUT_COLOR_TRUNC = "#000000"
17
+ MUT_COLOR_TRUNC_PASSENGER = "#708090"
18
+ MUT_COLOR_SPLICE = "#e5802b"
19
+ MUT_COLOR_SPLICE_PASSENGER = "#f0b87b"
20
+ MUT_COLOR_PROMOTER = "#00B7CE"
21
+ MUT_COLOR_OTHER = "#cf58bc"
22
+
23
+ MUT_DRIVER = "#000000"
24
+ MUT_VUS = "#696969"
25
+ MUT_COLOR_GERMLINE = "#FFFFFF"
26
+
27
+ MRNA_COLOR_HIGH = "#ff9999"
28
+ MRNA_COLOR_LOW = "#6699cc"
29
+
30
+ PROT_COLOR_HIGH = "#ff3df8"
31
+ PROT_COLOR_LOW = "#00E1FF"
32
+
33
+ CNA_COLOR_AMP = "#ff0000"
34
+ CNA_COLOR_GAIN = "#ffb6c1"
35
+ CNA_COLOR_HETLOSS = "#8fd8d8"
36
+ CNA_COLOR_HOMDEL = "#0000ff"
37
+
38
+ MUT_COLOR_FUSION = "#C900A1"
39
+ STRUCTURAL_VARIANT_COLOR = "#8B00C9"
40
+ STRUCTURAL_VARIANT_PASSENGER_COLOR = "#ce92e8"
41
+
42
+ DEFAULT_GREY = "#BEBEBE"
43
+
44
+
45
+ class Alteration(Enum):
46
+ BACKGROUND = auto()
47
+ AMP = auto()
48
+ GAIN = auto()
49
+ HOMDEL = auto()
50
+ HETLOSS = auto()
51
+ MRNA_HIGH = auto()
52
+ MRNA_LOW = auto()
53
+ PROTEIN_HIGH = auto()
54
+ PROTEIN_LOW = auto()
55
+ FUSION = auto()
56
+ GERMLINE = auto()
57
+ SPLICE = auto()
58
+ SPLICE_PASSENGER = auto()
59
+ MISSENSE = auto()
60
+ MISSENSE_PASSENGER = auto()
61
+ PROMOTER = auto()
62
+ TRUNC = auto()
63
+ TRUNC_PASSENGER = auto()
64
+ INFRAME = auto()
65
+ INFRAME_PASSENGER = auto()
66
+ STRUCTURAL_VARIANT = auto()
67
+ STRUCTURAL_VARIANT_PASSENGER = auto()
68
+ # STRUCTURE_VARIANT
69
+
70
+ OTHER = 10000
71
+
72
+
73
+ # Overwrite the default legend
74
+ # So that the legend entry will add a background
75
+ class _AltPiece:
76
+ background_color = None
77
+
78
+ def legend(self, x, y, w, h):
79
+ arts = []
80
+ if self.background_color is not None:
81
+ arts.append(Rectangle((x, y), w, h, facecolor=self.background_color))
82
+ arts.append(self.draw(x, y, w, h, None))
83
+ return PatchCollection(arts, match_original=True)
84
+
85
+
86
+ class Rect(_AltPiece, mlayers.Rect):
87
+ pass
88
+
89
+
90
+ class FrameRect(_AltPiece, mlayers.FrameRect):
91
+ pass
92
+
93
+
94
+ class FracRect(_AltPiece, mlayers.FracRect):
95
+ pass
96
+
97
+
98
+ @dataclass(repr=False)
99
+ class MatchRule:
100
+ startswith: str = None
101
+ endswith: str = None
102
+ contains: List[str] = field(default_factory=list)
103
+ flexible: bool = False
104
+
105
+ def is_match(self, text: str):
106
+ text = text.lower()
107
+
108
+ match_start = not self.flexible
109
+ if self.startswith is not None:
110
+ match_start = text.startswith(self.startswith)
111
+
112
+ match_end = not self.flexible
113
+ if self.endswith is not None:
114
+ match_end = text.endswith(self.endswith)
115
+
116
+ match_contains = True
117
+ if len(self.contains) > 0:
118
+ match_contains = np.sum([i in text for i in self.contains])
119
+
120
+ if self.flexible:
121
+ return match_start | match_end | match_contains
122
+ else:
123
+ return match_start & match_end & match_contains
124
+
125
+
126
+ MATCH_POOL = {
127
+ Alteration.AMP: MatchRule(startswith="amp"),
128
+ Alteration.GAIN: MatchRule(startswith="gain"),
129
+ Alteration.HOMDEL: MatchRule(
130
+ startswith="homdel", contains=["deep", "deletion"], flexible=True
131
+ ),
132
+ Alteration.HETLOSS: MatchRule(
133
+ startswith="hetloss", contains=["shallow", "deletion"], flexible=True
134
+ ),
135
+ Alteration.MRNA_HIGH: MatchRule(contains=["mrna", "high"]),
136
+ Alteration.MRNA_LOW: MatchRule(contains=["mrna", "low"]),
137
+ Alteration.PROTEIN_HIGH: MatchRule(contains=["protein", "high"]),
138
+ Alteration.PROTEIN_LOW: MatchRule(contains=["protein", "low"]),
139
+ Alteration.FUSION: MatchRule(startswith="fusion"),
140
+ Alteration.GERMLINE: MatchRule(startswith="germline"),
141
+ Alteration.MISSENSE_PASSENGER: MatchRule(
142
+ startswith="missense", contains=["passenger"]
143
+ ),
144
+ Alteration.MISSENSE: MatchRule(
145
+ startswith="missense", contains=["driver"], flexible=True
146
+ ),
147
+ Alteration.PROMOTER: MatchRule(startswith="promoter"),
148
+ Alteration.TRUNC_PASSENGER: MatchRule(startswith="trunc", contains=["passenger"]),
149
+ Alteration.TRUNC: MatchRule(startswith="trunc"),
150
+ Alteration.INFRAME_PASSENGER: MatchRule(
151
+ startswith="inframe", contains=["passenger"]
152
+ ),
153
+ Alteration.INFRAME: MatchRule(startswith="inframe"),
154
+ Alteration.STRUCTURAL_VARIANT_PASSENGER: MatchRule(
155
+ startswith="sv", contains=["structural", "variant", "passenger"], flexible=True
156
+ ),
157
+ Alteration.STRUCTURAL_VARIANT: MatchRule(
158
+ startswith="sv", contains=["structural", "variant"], flexible=True
159
+ ),
160
+ Alteration.SPLICE_PASSENGER: MatchRule(startswith="splice", contains=["passenger"]),
161
+ Alteration.SPLICE: MatchRule(startswith="splice"),
162
+ }
163
+
164
+ SHAPE_BANK = {
165
+ Alteration.BACKGROUND: Rect(
166
+ color=DEFAULT_GREY, label="No alterations", zorder=-10000
167
+ ),
168
+ # CNA
169
+ Alteration.AMP: Rect(color=CNA_COLOR_AMP, label="Amplification"),
170
+ # ShapeId.ampRectangle
171
+ Alteration.GAIN: Rect(color=CNA_COLOR_GAIN, label="Gain"),
172
+ # ShapeId.gainRectangle
173
+ Alteration.HOMDEL: Rect(color=CNA_COLOR_HOMDEL, label="Deep Deletion"),
174
+ Alteration.HETLOSS: Rect(color=CNA_COLOR_HETLOSS, label="Shallow Deletion"),
175
+ # mRNA Regulation
176
+ Alteration.MRNA_HIGH: FrameRect(
177
+ color=MRNA_COLOR_HIGH, width=1.5, label="mRNA High", zorder=1000
178
+ ),
179
+ Alteration.MRNA_LOW: FrameRect(
180
+ color=MRNA_COLOR_LOW, width=1.5, label="mRNA Low", zorder=1000
181
+ ),
182
+ # Protein Expression Regulation
183
+ Alteration.PROTEIN_HIGH: FracRect(
184
+ color=PROT_COLOR_HIGH, frac=(1.0, 0.2), label="Protein High", zorder=100
185
+ ),
186
+ Alteration.PROTEIN_LOW: FracRect(
187
+ color=PROT_COLOR_LOW, frac=(1.0, 0.2), label="Protein Low", zorder=100
188
+ ),
189
+ # Structural variant
190
+ Alteration.STRUCTURAL_VARIANT: FracRect(
191
+ color=STRUCTURAL_VARIANT_COLOR,
192
+ frac=(1.0, 0.6),
193
+ label="Structural variant",
194
+ zorder=200,
195
+ ),
196
+ Alteration.STRUCTURAL_VARIANT_PASSENGER: FracRect(
197
+ color=STRUCTURAL_VARIANT_PASSENGER_COLOR,
198
+ frac=(1.0, 0.6),
199
+ label="Structural variant (putative passenger)",
200
+ zorder=200,
201
+ ),
202
+ Alteration.FUSION: FracRect(
203
+ color=MUT_COLOR_FUSION, frac=(1.0, 0.6), label="Fusion", zorder=200
204
+ ),
205
+ # Splice
206
+ Alteration.SPLICE: FracRect(
207
+ color=MUT_COLOR_SPLICE, frac=(1.0, 0.3), label="Splice Mutation", zorder=400
208
+ ),
209
+ Alteration.SPLICE_PASSENGER: FracRect(
210
+ color=MUT_COLOR_SPLICE_PASSENGER,
211
+ frac=(1.0, 0.3),
212
+ label="Splice Mutation (putative passenger)",
213
+ zorder=400,
214
+ ),
215
+ Alteration.MISSENSE: FracRect(
216
+ color=MUT_COLOR_MISSENSE,
217
+ frac=(1.0, 0.3),
218
+ label="Mutation (putative driver)",
219
+ zorder=400,
220
+ ),
221
+ Alteration.MISSENSE_PASSENGER: FracRect(
222
+ color=MUT_COLOR_MISSENSE_PASSENGER,
223
+ frac=(1.0, 0.3),
224
+ label="Missense Mutation (putative passenger)",
225
+ zorder=400,
226
+ ),
227
+ Alteration.OTHER: FracRect(
228
+ color=MUT_COLOR_OTHER, frac=(1.0, 0.3), label="Other Mutation", zorder=400
229
+ ),
230
+ Alteration.PROMOTER: FracRect(
231
+ color=MUT_COLOR_PROMOTER, frac=(1.0, 0.3), label="Promoter Mutation", zorder=400
232
+ ),
233
+ Alteration.TRUNC: FracRect(
234
+ color=MUT_COLOR_TRUNC, frac=(1.0, 0.3), label="Truncating Mutation", zorder=400
235
+ ),
236
+ Alteration.TRUNC_PASSENGER: FracRect(
237
+ color=MUT_COLOR_TRUNC_PASSENGER,
238
+ frac=(1.0, 0.3),
239
+ label="Truncating Mutation (putative passenger)",
240
+ zorder=400,
241
+ ),
242
+ Alteration.INFRAME: FracRect(
243
+ color=MUT_COLOR_INFRAME,
244
+ frac=(1.0, 0.3),
245
+ label="Inframe Mutation (putative driver)",
246
+ zorder=400,
247
+ ),
248
+ Alteration.INFRAME_PASSENGER: FracRect(
249
+ color=MUT_COLOR_INFRAME_PASSENGER,
250
+ frac=(1.0, 0.3),
251
+ label="Inframe Mutation (putative passenger)",
252
+ zorder=400,
253
+ ),
254
+ # Germline
255
+ Alteration.GERMLINE: FracRect(
256
+ color=MUT_COLOR_GERMLINE, frac=(1.0, 0.1), label="Germline Mutation", zorder=600
257
+ ),
258
+ }
@@ -1,76 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: marsilea
3
- Version: 0.4.2
4
- Summary: Declarative creation of composable visualization
5
- Author: Zhihang Zheng
6
- Author-email: Mr-Milk <yzheng@cemm.at>
7
- Requires-Python: >=3.8
8
- Description-Content-Type: text/markdown
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Framework :: Matplotlib
12
- Requires-Dist: numpy
13
- Requires-Dist: pandas
14
- Requires-Dist: matplotlib>=3.6
15
- Requires-Dist: seaborn
16
- Requires-Dist: scipy
17
- Requires-Dist: legendkit
18
- Requires-Dist: platformdirs
19
- Requires-Dist: ruff ; extra == "dev"
20
- Requires-Dist: icecream ; extra == "dev"
21
- Requires-Dist: python-hmr ; extra == "dev"
22
- Requires-Dist: pytest ; extra == "dev"
23
- Requires-Dist: scikit-learn ; extra == "dev"
24
- Requires-Dist: sphinx ; extra == "dev"
25
- Requires-Dist: numpydoc ; extra == "dev"
26
- Requires-Dist: sphinx_design ; extra == "dev"
27
- Requires-Dist: pydata-sphinx-theme ; extra == "dev"
28
- Requires-Dist: sphinx-copybutton ; extra == "dev"
29
- Requires-Dist: sphinx_gallery ; extra == "dev"
30
- Requires-Dist: mpl_fontkit ; extra == "dev"
31
- Project-URL: Home, https://github.com/Marsilea-viz/marsilea
32
- Provides-Extra: dev
33
-
34
- <p align="center">
35
- <picture align="center">
36
- <source media="(prefers-color-scheme: dark)" srcset="https://github.com/Marsilea-viz/marsilea/raw/main/img/banner-dark.jpg">
37
- <source media="(prefers-color-scheme: light)" srcset="https://github.com/Marsilea-viz/marsilea/raw/main/img/banner-blue.jpg">
38
- <img alt="Shows a bar chart with benchmark results." src="https://github.com/Marsilea-viz/marsilea/raw/main/img/banner-dark.jpg" width="400">
39
- </picture>
40
- </p>
41
-
42
- [![Documentation Status](https://img.shields.io/readthedocs/marsilea?color=57B77E&logo=readthedocs&logoColor=white&style=flat-square)](https://marsilea.readthedocs.io/en/stable)
43
- ![pypi version](https://img.shields.io/pypi/v/marsilea?color=0098FF&logo=python&logoColor=white&style=flat-square)
44
-
45
- ❗We are in beta, API may change and bugs expected
46
-
47
- ### Declarative creation of composable visualization!
48
-
49
- [Read Documentation](https://marsilea.readthedocs.io/)
50
-
51
-
52
- ### Installation
53
-
54
- ```shell
55
- pip install marsilea
56
- ```
57
-
58
- [//]: # (### Examples)
59
-
60
- [//]: # ()
61
- [//]: # (| | |)
62
-
63
- [//]: # (|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|)
64
-
65
- [//]: # (| Heatmap | Oncoprint |)
66
-
67
- [//]: # (| <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_pbmc3k_001_2_00x.png" width=400> | <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_oncoprint_005_2_00x.png" width=400> |)
68
-
69
- [//]: # (| Upsetplot | Composition Stacked Bar |)
70
-
71
- [//]: # (| <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_upset_001_2_00x.png" width=400> | <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_oil_well_001_2_00x.png" width=400> |)
72
-
73
- [//]: # (| Arc Diagram | Protein sequence alignment |)
74
-
75
- [//]: # (| <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_arc_diagram_001_2_00x.png" width=400> | <img src="https://marsilea.readthedocs.io/en/latest/_images/sphx_glr_plot_seqalign_001_2_00x.png" width=400> |)
76
-