diff BSseeker2/bs_seeker2-build.py @ 1:8b26adf64adc draft default tip

V2.0.5
author weilong-guo
date Tue, 05 Nov 2013 01:55:39 -0500
parents e6df770c0e58
children
line wrap: on
line diff
--- a/BSseeker2/bs_seeker2-build.py	Fri Jul 12 18:47:28 2013 -0400
+++ b/BSseeker2/bs_seeker2-build.py	Tue Nov 05 01:55:39 2013 -0500
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 
 import os
 from optparse import OptionParser, OptionGroup
@@ -12,8 +12,8 @@
     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 = BOWTIE2)
-    parser.add_option("-p", "--path", dest="aligner_path", help="Path to the aligner program. Defaults: " +' '*70+ '\t'.join(('%s: %s '+' '*70) % (al, aligner_path[al]) for al in sorted(supported_aligners)),
+    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)
 
@@ -23,7 +23,7 @@
     rrbs_opts = OptionGroup(parser, "Reduced Representation Bisulfite Sequencing Options",
                                 "Use this options with conjuction of -r [--rrbs]")
     rrbs_opts.add_option("-r", "--rrbs", action="store_true", dest="rrbs", help = 'Build index specially for Reduced Representation Bisulfite Sequencing experiments. Genome other than certain fragments will be masked. [Default: %default]', default = False)
-    rrbs_opts.add_option("-l", "--low",type= "int", dest="low_bound", help="lower bound of fragment length (excluding recognition sequence such as C-CGG) [Default: %default]", default = 40)
+    rrbs_opts.add_option("-l", "--low",type= "int", dest="low_bound", help="lower bound of fragment length (excluding recognition sequence such as C-CGG) [Default: %default]", default = 20)
     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)
@@ -33,7 +33,7 @@
 
     # if no options were given by the user, print help and exit
     if len(sys.argv) == 1:
-        print parser.print_help()
+        parser.print_help()
         exit(0)
 
     if options.version :
@@ -44,7 +44,11 @@
 
     rrbs = options.rrbs
 
-    fasta_file=os.path.expanduser(options.filename)
+    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')
 
@@ -69,9 +73,14 @@
 
     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):