Skip to content

Commit

Permalink
v2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
guoweilong committed Jun 6, 2017
1 parent 611ed59 commit ca54c22
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 230 deletions.
339 changes: 169 additions & 170 deletions README.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,8 @@ V2.1.0 - Dec 9, 2016
V2.1.1 - Apr. 13th, 2017
1. [bs_seeker2-call_methylation.py] : fixed bug related with pysam version
2. [bs_seeker2-call_methylation.py] : modified output strategies

------------------------------------------

V2.1.2 - Apr. 13th, 2017
1. [bs_seeker2-align.py] : Add option "--XSteve", alternative filtering method proposed by Prof.ß Steve Jacobson
36 changes: 25 additions & 11 deletions bs_align/bs_pair_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def bs_pair_end(main_read_file_1,
aligner_command,
db_path,
tmp_path,
outfile, XS_pct, XS_count, adapter_mismatch,
outfile, XS_pct, XS_count, XSteve, adapter_mismatch,
show_multiple_hit, show_unmapped_hit):

logm("----------------------------------------------" )
Expand Down Expand Up @@ -933,17 +933,31 @@ def bs_pair_end(main_read_file_1,
#---XS FILTER----------------
#XS = 1 if "ZZZ" in methy.replace('-', '') else 0
XS_1 = 0
nCH_1 = methy_1.count('y') + methy_1.count('z')
nmCH_1 = methy_1.count('Y') + methy_1.count('Z')
if( (nmCH_1>XS_count) and nmCH_1/float(nCH_1+nmCH_1)>XS_pct ) :
XS_1 = 1
#XS = 1 if "ZZZ" in methy.replace('-', '') else 0
if XSteve:
if ('ZZZ' in methy_1.translate(None, "-XxYy")):
XS_1 = 1
#
#
else:
nCH_1 = methy_1.count('y') + methy_1.count('z')
nmCH_1 = methy_1.count('Y') + methy_1.count('Z')
if( (nmCH_1>XS_count) and nmCH_1/float(nCH_1+nmCH_1)>XS_pct ) :
XS_1 = 1
#
#
XS_2 = 0
nCH_2 = methy_2.count('y') + methy_2.count('z')
nmCH_2 = methy_2.count('Y') + methy_2.count('Z')
if( (nmCH_2>XS_count) and nmCH_2/float(nCH_2+nmCH_2)>XS_pct ) :
XS_2 = 1

if XSteve:
if ('ZZZ' in methy_2.translate(None, "-XxYy")):
XS_2 = 1
#
#
else:
nCH_2 = methy_2.count('y') + methy_2.count('z')
nmCH_2 = methy_2.count('Y') + methy_2.count('Z')
if ((nmCH_2 > XS_count) and nmCH_2 / float(nCH_2 + nmCH_2) > XS_pct):
XS_2 = 1
#
#
if mapped_strand_1 == '+' :
flag_1 = 67 # 1000011 : 1st read, + strand
flag_2 = 131 # 10000011 : 2nd read, + strand
Expand Down
17 changes: 12 additions & 5 deletions bs_align/bs_rrbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def my_mappable_region(chr_regions, mapped_location, FR): # start_position (firs
#----------------------------------------------------------------

def bs_rrbs(main_read_file, asktag, adapter_file, cut_s, cut_e, no_small_lines, max_mismatch_no,
aligner_command, db_path, tmp_path, outfile, XS_pct, XS_count, adapter_mismatch,
aligner_command, db_path, tmp_path, outfile, XS_pct, XS_count, XSteve, adapter_mismatch,
show_multiple_hit, show_unmapped_hit, cut_format="C-CGG"
):
#----------------------------------------------------------------
Expand Down Expand Up @@ -492,10 +492,17 @@ def bs_rrbs(main_read_file, asktag, adapter_file, cut_s, cut_e, no_small_lines,
mC_lst, uC_lst = mcounts(methy, mC_lst, uC_lst)
#---XS FILTER----------------
XS = 0
nCH = methy.count('y') + methy.count('z')
nmCH = methy.count('Y') + methy.count('Z')
if( (nmCH>XS_count) and nmCH/float(nCH+nmCH)>XS_pct ) :
XS = 1
if XSteve :
if ('ZZZ' in methy.translate(None, "-XxYy")):
XS = 1
#
else :
nCH = methy.count('y') + methy.count('z')
nmCH = methy.count('Y') + methy.count('Z')
if( (nmCH>XS_count) and nmCH/float(nCH+nmCH)>XS_pct ) :
XS = 1
#
#
num_mapped_RC_C2T += 1
outfile.store(header, N_mismatch, FR, mapped_chr, mapped_strand,
mapped_location, cigar, original_BS, methy, XS,
Expand Down
18 changes: 12 additions & 6 deletions bs_align/bs_single_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def extract_mapping(ali_file):

def bs_single_end(main_read_file, asktag, adapter_file, cut1, cut2, no_small_lines,
max_mismatch_no, aligner_command, db_path, tmp_path, outfile,
XS_pct, XS_count, adapter_mismatch, show_multiple_hit, show_unmapped_hit):
XS_pct, XS_count, XSteve, adapter_mismatch, show_multiple_hit, show_unmapped_hit):
logm("----------------------------------------------" )
logm("Read filename: %s" % main_read_file)
logm("The first base (for mapping): %d" % cut1 )
Expand Down Expand Up @@ -697,11 +697,17 @@ def bs_single_end(main_read_file, asktag, adapter_file, cut1, cut2, no_small_lin

#---XS FILTER----------------
XS = 0
nCH = methy.count('y') + methy.count('z')
nmCH = methy.count('Y') + methy.count('Z')
if( (nmCH>XS_count) and nmCH/float(nCH+nmCH)>XS_pct ) :
XS = 1

if XSteve :
if ('ZZZ' in methy.translate(None, "-XxYy") ) :
XS=1
#
else :
nCH = methy.count('y') + methy.count('z')
nmCH = methy.count('Y') + methy.count('Z')
if( (nmCH>XS_count) and nmCH/float(nCH+nmCH)>XS_pct ) :
XS = 1
#
#
outfile.store(header, N_mismatch, FR, mapped_chr, mapped_strand, mapped_location, cigar, original_BS, methy, XS, output_genome = output_genome)
all_base_mapped += len(original_BS)

Expand Down
Loading

0 comments on commit ca54c22

Please sign in to comment.