Skip to content

Commit

Permalink
Merge pull request jeromekelleher#336 from jeromekelleher/generalise-…
Browse files Browse the repository at this point in the history
…mutation-plot

Add abililty to plot classes of mutation along genome
  • Loading branch information
jeromekelleher authored Oct 7, 2024
2 parents 0195a10 + d9a5dfd commit 88baf9a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sc2ts/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,8 +1326,12 @@ def plot_ts_tv_per_site(self, annotate_threshold=0.9, xlim=None):
if xlim is not None:
plt.xlim(xlim)

def plot_mutations_per_site(self, annotate_threshold=0.9):
count = self.sites_num_mutations
def plot_mutations_per_site(self, annotate_threshold=0.9, select=None):
if select is None:
count = self.sites_num_mutations
else:
count = np.bincount(self.ts.mutations_site[select], minlength=self.ts.num_sites)

pos = self.ts.sites_position
zero_fraction = np.sum(count == 0) / self.ts.num_sites

Expand Down

0 comments on commit 88baf9a

Please sign in to comment.