Skip to content

Commit

Permalink
'--corr' option was modified.
Browse files Browse the repository at this point in the history
  • Loading branch information
YuSugihara committed Feb 26, 2020
1 parent 78aa792 commit d6ee0c1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# MutMap User Guide
#### version 2.1.4
#### version 2.1.5

## Table of contents
- [What is MutMap?](#What-is-MutMap)
Expand Down Expand Up @@ -74,7 +74,7 @@ $ mutmap -h
usage: mutmap -r <FASTA> -c <BAM|FASTQ> -b <BAM|FASTQ>
-n <INT> -o <OUT_DIR> [-T] [-e <DATABASE>]
MutMap version 2.1.4
MutMap version 2.1.5
optional arguments:
-h, --help show this help message and exit
Expand Down Expand Up @@ -218,7 +218,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] [--corr] [--indel]
MutPlot version 2.1.4
MutPlot version 2.1.5
optional arguments:
-h, --help show this help message and exit
Expand All @@ -244,9 +244,10 @@ optional arguments:
-e , --snpEff Predict causal variant using SnpEff. Please
check available databases in SnpEff.
--igv Output IGV format file to check results on IGV.
--corr Use corrected threshold in Huang et al. (2019).
If you specify this option, the options related to
the simulation ("-N" and "-F") will be ignored.
--corr Use the corrected threshold in Huang et al. (2019).
Please spesify mu_alpha_2 in Huang et al. (2019).
When you specify this option, p99 and p95 has the
same value.
--indel Plot SNP-index with INDEL.
--fig-width Width allocated in chromosome figure. [7.5]
--fig-height Height allocated in chromosome figure. [4.0]
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.1.4"
__version__ = "2.1.5"
12 changes: 7 additions & 5 deletions mutmap/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,13 @@ def mutplot_options(self):
help='Output IGV format file to check results on IGV.')

parser.add_argument('--corr',
action='store_true',
default=False,
help=('Use corrected threshold in Huang et al. (2019).\n'
'If you specify this option, the options related to\n'
'the simulation ("-N" and "-F") will be ignored.'))
action='store',
type=float,
help=('Use the corrected threshold in Huang et al. (2019).\n'
'Please spesify mu_alpha_2 in Huang et al. (2019).\n'
'When you specify this option, p99 and p95 has the\n'
'same value.'),
metavar='')

parser.add_argument('--indel',
action='store_true',
Expand Down
15 changes: 6 additions & 9 deletions mutmap/vcf2index.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def __init__(self, args):
if self.snpEff is not None:
self.ANN_re = re.compile(';ANN=(.*);*')

if self.corr is not None:
var_fix = 0.25/(2*self.N_bulk)
self.threshold = self.corr*(var_fix**(1/2)) + 0.5

def get_field(self):
root, ext = os.path.splitext(self.vcf)
if ext == '.gz':
Expand Down Expand Up @@ -101,13 +105,6 @@ def F2_simulation(self, depth):
p95 = replicates[int(0.95*self.N_replicates) - 1]
return p99, p95

def calculate_corrected_threshold(self, depth):
var_AF = (2*self.N_bulk + depth)/(8*self.N_bulk*depth)

p99 = 2.576*(var_AF**(1/2)) + 0.5
p95 = 1.960*(var_AF**(1/2)) + 0.5
return p99, p95

def calc_SNPindex(self, field_pos):
root, ext = os.path.splitext(self.vcf)
if ext == '.gz':
Expand Down Expand Up @@ -145,8 +142,8 @@ def calc_SNPindex(self, field_pos):
if record['type'] == 'keep':
variant = self.check_variant_type(REF, ALT)

if self.corr:
p99, p95 = self.calculate_corrected_threshold(record['bulk_depth'])
if self.corr is not None:
p99, p95 = self.threshold, self.threshold
else:
p99, p95 = self.F2_simulation(record['bulk_depth'])

Expand Down

0 comments on commit d6ee0c1

Please sign in to comment.