Skip to content

Commit

Permalink
update to v2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Sugihara (TSL) committed Feb 27, 2022
1 parent 486a1b8 commit 8c3349c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MutMap User Guide
#### version 2.3.2
#### version 2.3.3

## Table of contents
- [What is MutMap?](#What-is-MutMap)
Expand Down Expand Up @@ -71,16 +71,15 @@ trimmomatic --help

## Usage

Current version can not plot too contiguous reference genome.
**We highly recommend you to run MutMap without spcifying '--species' for multiple testing correction, initially.**
If your reference genome has more than 50 contigs (or chromosomes), only significant contigs will be plotted.

```
mutmap -h
usage: mutmap -r <FASTA> -c <BAM|FASTQ> -b <BAM|FASTQ>
-n <INT> -o <OUT_DIR> [-T] [-e <DATABASE>]
MutMap version 2.3.2
MutMap version 2.3.3
optional arguments:
-h, --help show this help message and exit
Expand Down Expand Up @@ -229,7 +228,7 @@ usage: mutplot -v <VCF> -o <OUT_DIR> -n <INT> [-w <INT>] [-s <INT>]
[-D <INT>] [-d <INT>] [-N <INT>] [-m <FLOAT>]
[-S <INT>] [-e <DATABASE>] [--igv] [--indel]
MutPlot version 2.3.2
MutPlot version 2.3.3
optional arguments:
-h, --help show this help message and exit
Expand Down
2 changes: 1 addition & 1 deletion mutmap/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.3.2"
__version__ = "2.3.3"
25 changes: 23 additions & 2 deletions mutmap/plot.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import os
import sys
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from mutmap.utils import time_stamp


class Plot(object):
Expand Down Expand Up @@ -63,6 +62,22 @@ def read_files(self):

return snp_index, sliding_window

def get_significant_contigs(self, N_chr, snp_index, sliding_window):

print(('!!WARNING!! Your reference genome has too many contigs (>50). '
'Therefore, only significant contigs will be plotted.'), file=sys.stderr)

significant_windows = sliding_window[abs(sliding_window['mean_p95']) <= \
abs(sliding_window['mean_SNPindex'])]

significant_contigs = list(significant_windows['CHROM'].drop_duplicates())

N_chr = len(significant_contigs)
snp_index = snp_index[snp_index['CHROM'].isin(significant_contigs)]
sliding_window = sliding_window[sliding_window['CHROM'].isin(significant_contigs)]

return N_chr, snp_index, sliding_window

def set_plot_style(self, N_chr):
if N_chr == 1:
style = (1, 1)
Expand All @@ -79,6 +94,12 @@ def run(self):
snp_index, sliding_window = self.read_files()

N_chr = len(sliding_window['CHROM'].unique())

if N_chr > 50:
N_chr, self.snp_index, self.sliding_window = self.get_significant_contigs(N_chr,
snp_index,
sliding_window)

N_col, N_raw = self.set_plot_style(N_chr)

fig = plt.figure(figsize=(self.fig_width*N_col, self.fig_height*N_raw))
Expand Down

0 comments on commit 8c3349c

Please sign in to comment.