Skip to content

Commit 4095522

Browse files
author
Yutaka Saito
committed
update for bsf-call
1 parent 0f0eda2 commit 4095522

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

bsf-call/bsf-call

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Un
88
http://creativecommons.org/licenses/by-nc-sa/3.0/
99
"""
1010

11-
__version__= "1.2"
11+
__version__= "1.3"
1212

1313
from optparse import OptionParser
1414
import os
@@ -28,7 +28,7 @@ op.add_option("-c", "--coverage", type="int", default=5, metavar="C",
2828
# op.add_option("-d", "--pe-direction", type="string", default="ff",
2929
# help="direction of paired-end probes: ff, fr, rf, rr (default: %default)")
3030
#
31-
op.add_option("-l", "--lower-bound", type="float", default=0.005, metavar="L",
31+
op.add_option("-l", "--lower-bound", type="float", default=0.05, metavar="L",
3232
help="threshold of mC ratio (default: %default)")
3333

3434
op.add_option("-p", "--multi-thread", type="int", default=1, metavar="P",

bsf-call/bsf-call.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ OPTIONS
1111
Specifies the threshold for valid read coverage for mC detection (default: 5).
1212

1313
-l <float>, --lover-bound=<float>
14-
Specifies the threshold for valid mC rate (default: 0.01).
14+
Specifies the threshold for valid mC rate (default: 0.05).
1515

1616
-s <integer>
1717
Specifies the threshold for valid alignment score (default: 150)

bsf-call/bsfcall.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
http://creativecommons.org/licenses/by-nc-sa/3.0/
99
"""
1010

11-
__version__= "1.2"
11+
__version__= "1.3"
1212

1313
import sys
1414
import os
@@ -1450,13 +1450,19 @@ def processMafFile(self, resultFile):
14501450
read_seq = block[2].split()[-1]
14511451
read_len = len(read_seq)
14521452
read_qual = block[3].split()[-1]
1453-
# strand = self.findStrandFromAlignment(chr, ref_start, read_seq, read_len)
1454-
strand = block[2].split()[4]
1453+
strand = self.findStrandFromAlignment(chr, ref_start, read_seq, read_len)
1454+
# strand = block[2].split()[4]
14551455
if strand == '+' or strand == '-':
14561456
lines = self.extractMcContextsByOneRead(chr, strand, mismap_prob, ref_seq, ref_start, read_seq, read_qual, read_len)
14571457
for line in lines:
14581458
fout.write(line)
1459-
logging.debug("processMafFile: a maf block is successfully captured.")
1459+
logging.debug("processMafFile: a maf block(%s) is successfully captured." % strand)
1460+
elif strand == '+-':
1461+
for st in ('+', '-'):
1462+
lines = self.extractMcContextsByOneRead(chr, st, mismap_prob, ref_seq, ref_start, read_seq, read_qual, read_len)
1463+
for line in lines:
1464+
fout.write(line)
1465+
logging.debug("processMafFile: a maf block(%s) is successfully captured." % strand)
14601466
else:
14611467
logging.debug("processMafFile: a maf block does not show strand-specific info.")
14621468
else:
@@ -1592,10 +1598,10 @@ def findStrandFromAlignment(self, chr, ref_start, read_seq, read_len):
15921598
ref_seq = self.refGenomeBuf[chr]
15931599
for i in range(read_len):
15941600
j = ref_start + i
1595-
if ref_seq[j]=='C' and (read_seq[i]=='C' or read_seq[i]=='T'):
1601+
if ref_seq[j]=='C' and read_seq[i]=='T':
15961602
plus_sup += 1
15971603
base_size += 1
1598-
elif ref_seq[j]=='G' and (read_seq[i]=='G' or read_seq[i]=='A'):
1604+
elif ref_seq[j]=='G' and read_seq[i]=='A':
15991605
minus_sup += 1
16001606
base_size += 1
16011607
elif (ref_seq[j]!='-' and read_seq[i]!='-') and ref_seq[j]!=read_seq[i]:
@@ -1612,6 +1618,8 @@ def findStrandFromAlignment(self, chr, ref_start, read_seq, read_len):
16121618
# if minus_sup > plus_sup and mismatch_rate < 0.05:
16131619
if minus_sup > plus_sup:
16141620
return '-'
1621+
if plus_sup == minus_sup:
1622+
return '+-'
16151623
return '.'
16161624

16171625

0 commit comments

Comments
 (0)