Skip to content

Commit

Permalink
Update pymaf.MafFrame.plot_mutated_matched:
Browse files Browse the repository at this point in the history
* Add new optional argument ``count`` to 
:meth:`pymaf.MafFrame.plot_mutated_matched` method.
  • Loading branch information
sbslee committed Aug 10, 2022
1 parent dd92ed8 commit c4b6a42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog
* Add new method :meth:`pyvcf.VcfFrame.filter_gsa`.
* Add new method :meth:`pyvcf.VcfFrame.duplicated`.
* Add new optional argument ``to_csv`` to :meth:`pymaf.MafFrame.plot_regplot_tmb` method.
* Add new optional argument ``count`` to :meth:`pymaf.MafFrame.plot_mutated_matched` method.

0.35.0 (2022-07-12)
-------------------
Expand Down
8 changes: 5 additions & 3 deletions fuc/api/pymaf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1811,8 +1811,8 @@ def plot_mutated(
return ax

def plot_mutated_matched(
self, af, patient_col, group_col, group_order, ax=None, figsize=None,
**kwargs
self, af, patient_col, group_col, group_order, count=10, ax=None,
figsize=None, **kwargs
):
"""
Create a bar plot visualizing the mutation prevalence of top
Expand All @@ -1828,6 +1828,8 @@ def plot_mutated_matched(
AnnFrame column containing sample group information.
group_order : list
List of sample group names.
count : int, defualt: 10
Number of top mutated genes to display.
ax : matplotlib.axes.Axes, optional
Pre-existing axes for the plot. Otherwise, crete a new one.
figsize : tuple, optional
Expand All @@ -1841,7 +1843,7 @@ def plot_mutated_matched(
matplotlib.axes.Axes
The matplotlib axes containing the plot.
"""
df = self.matrix_waterfall_matched(af, patient_col, group_col, group_order)
df = self.matrix_waterfall_matched(af, patient_col, group_col, group_order, count=count)
df = df.applymap(lambda x: 0 if x == 'None' else 1)
s = df.sum(axis=1) / len(df.columns) * 100
s.name = 'Count'
Expand Down

0 comments on commit c4b6a42

Please sign in to comment.