Skip to content

Commit

Permalink
v2.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
guoweilong committed Dec 21, 2017
1 parent 56e5dee commit 5df7c75
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
10 changes: 10 additions & 0 deletions RELEASE_NOTES
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,15 @@ V2.1.2 - Jun. 23rd, 2017
1. [bs_seeker2-align.py] : Add option "--XSteve", alternative filtering method proposed by Prof. Steve Jacobson


------------------------------------------
V2.1.3 - Oct. 25th, 2017
1. [bs_seeker2-call_methylation.py] : Add option "-d", allow user-defined highest coverage.


------------------------------------------
V2.1.4 - Nov. 13rd, 2017
1. [bs_align/bs_align_util.py] : fix bug in function of getting methylation levels for one read

------------------------------------------
V2.1.4 - Nov. 21st, 2017
1. [bs_seeker2-build.py] : fix bug in finding genome file
53 changes: 29 additions & 24 deletions bs_seeker2-build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@


if __name__ == '__main__':

#
parser = OptionParser()

#
parser.add_option("-f", "--file", dest="filename", help="Input your reference genome file (fasta)", metavar="FILE")
parser.add_option("--aligner", dest="aligner", help="Aligner program to perform the analysis: " + ', '.join(supported_aligners) + " [Default: %default]", metavar="ALIGNER", default = BOWTIE)
parser.add_option("-p", "--path", dest="aligner_path", help="Path to the aligner program. Detected: " +' '*70+ '\t'.join(('%s: %s '+' '*70) % (al, aligner_path[al]) for al in sorted(supported_aligners)),
metavar="PATH")
parser.add_option("-d", "--db", type="string", dest="dbpath", help="Path to the reference genome library (generated in preprocessing genome) [Default: %default]", metavar="DBPATH", default = reference_genome_path)

parser.add_option("-v", "--version", action="store_true", dest="version", help="show version of BS-Seeker2", default=False)

#
# RRBS options
rrbs_opts = OptionGroup(parser, "Reduced Representation Bisulfite Sequencing Options",
"Use this options with conjuction of -r [--rrbs]")
Expand All @@ -27,74 +27,79 @@
rrbs_opts.add_option("-u", "--up", type= "int", dest="up_bound", help="upper bound of fragment length (excluding recognition sequence such as C-CGG ends) [Default: %default]", default = 500)
rrbs_opts.add_option("-c", "--cut-site", type= "string", dest="cut_format", help="Cut sites of restriction enzyme. Ex: MspI(C-CGG), Mael:(C-TAG), double-enzyme MspI&Mael:(C-CGG,C-TAG). [Default: %default]", default = "C-CGG")
parser.add_option_group(rrbs_opts)


#
#
(options, args) = parser.parse_args()

#
# if no options were given by the user, print help and exit
if len(sys.argv) == 1:
parser.print_help()
exit(0)

#
if options.version :
show_version()
exit (-1)
else :
show_version()

#
rrbs = options.rrbs

#
if options.filename is not None :
fasta_file=os.path.expanduser(options.filename)
else :
error("Please specify the genome file (Fasta) using \"-f\"")

#
if fasta_file is None:
error('Fasta file for the reference genome must be supported')

#
if not os.path.isfile(fasta_file):
if os.path.isfile(os.path.join(os.dbpath, fasta_file)):
# Search for os.dbpath to check if the genome file is stored there.
fasta_file = os.path.join(os.dbpath, fasta_file)
if os.path.isfile(os.path.join(options.dbpath, fasta_file)):
# Search for options.dbpath to check if the genome file is stored there.
fasta_file = os.path.join(options.dbpath, fasta_file)
else:
error('%s cannot be found' % fasta_file)

#
#
#
if options.aligner not in supported_aligners:
error('-a option should be: %s' % ' ,'.join(supported_aligners)+'.')

#
builder_exec = os.path.join(options.aligner_path or aligner_path[options.aligner],
{BOWTIE : 'bowtie-build',
BOWTIE2 : 'bowtie2-build',
SOAP : '2bwt-builder',
RMAP : '' # do nothing
}[options.aligner])

#
build_command = builder_exec + { BOWTIE : ' -f %(fname)s.fa %(fname)s',
BOWTIE2 : ' -f %(fname)s.fa %(fname)s',
SOAP : ' %(fname)s.fa'
}[options.aligner]


#
#
print "Reference genome file: %s" % fasta_file
print "Reduced Representation Bisulfite Sequencing: %s" % rrbs
print "Short reads aligner you are using: %s" % options.aligner
print "Builder path: %s" % builder_exec

#
#---------------------------------------------------------------

#
if not os.path.isfile( builder_exec ) :
error("Cannot file program %s for execution." % builder_exec)

#
ref_path = options.dbpath

#
if os.path.exists(ref_path):
if not os.path.isdir(ref_path):
error("%s must be a directory. Please, delete it or change the -d option." % ref_path)
#
else:
os.mkdir(ref_path)

#
if rrbs: # RRBS preprocessing
rrbs_build(fasta_file, build_command, ref_path, options.low_bound, options.up_bound, options.aligner, options.cut_format)
else: # Whole genome preprocessing
wg_build(fasta_file, build_command, ref_path, options.aligner)
#
#

2 changes: 1 addition & 1 deletion bs_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def reverse_compl_seq(strseq):

def show_version() :
print ""
print " BS-Seeker2 v2.1.3 - Oct. 25, 2017"
print " BS-Seeker2 v2.1.5 - Dec. 21, 2017"
print ""


Expand Down

0 comments on commit 5df7c75

Please sign in to comment.