Lines Matching refs:options

35 def opt_validate ( options ):  argument
42 options.gsize = efgsize[options.gsize]
45 options.gsize = float(options.gsize)
47 logging.error("Error when interpreting --gsize option: %s" % options.gsize)
52 options.gzip_flag = False # if the input is gzip file
54 options.format = options.format.upper()
55 if options.format == "ELAND":
56 options.parser = ELANDResultParser
57 elif options.format == "BED":
58 options.parser = BEDParser
59 elif options.format == "ELANDMULTI":
60 options.parser = ELANDMultiParser
61 elif options.format == "ELANDEXPORT":
62 options.parser = ELANDExportParser
63 elif options.format == "SAM":
64 options.parser = SAMParser
65 elif options.format == "BAM":
66 options.parser = BAMParser
67 options.gzip_flag = True
68 elif options.format == "BAMPE":
69 options.parser = BAMPEParser
70 options.gzip_flag = True
71 options.nomodel = True
72 elif options.format == "BEDPE":
73 options.parser = BEDPEParser
74 options.nomodel = True
75 elif options.format == "BOWTIE":
76 options.parser = BowtieParser
77 elif options.format == "AUTO":
78 options.parser = guess_parser
80 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
84 if options.keepduplicates != "auto" and options.keepduplicates != "all":
85 if not options.keepduplicates.isdigit():
94 if options.extsize < 1 :
103 if options.broad and options.call_summits:
107 if options.pvalue:
109 options.log_qvalue = None
110 options.log_pvalue = log(options.pvalue,10)*-1
112 options.log_qvalue = log(options.qvalue,10)*-1
113 options.log_pvalue = None
114 if options.broad:
115 options.log_broadcutoff = log(options.broadcutoff,10)*-1
118 options.format = options.format.upper()
121 if options.d_min < 0:
122 logging.error("Minimum fragment size shouldn't be negative!" % options.d_min)
126 options.lmfold = options.mfold[0]
127 options.umfold = options.mfold[1]
128 if options.lmfold > options.umfold:
129 logging.error("Upper limit of mfold should be greater than lower limit!" % options.mfold)
133 options.peakxls = os.path.join( options.outdir, options.name+"_peaks.xls" )
134 options.peakbed = os.path.join( options.outdir, options.name+"_peaks.bed" )
135 options.peakNarrowPeak = os.path.join( options.outdir, options.name+"_peaks.narrowPeak" )
136 options.peakBroadPeak = os.path.join( options.outdir, options.name+"_peaks.broadPeak" )
137 options.peakGappedPeak = os.path.join( options.outdir, options.name+"_peaks.gappedPeak" )
138 options.summitbed = os.path.join( options.outdir, options.name+"_summits.bed" )
139 options.bdg_treat = os.path.join( options.outdir, options.name+"_treat_pileup.bdg" )
140 options.bdg_control= os.path.join( options.outdir, options.name+"_control_lambda.bdg" )
141 if options.cutoff_analysis:
142options.cutoff_analysis_file = os.path.join( options.outdir, options.name+"_cutoff_analysis.txt" )
144 options.cutoff_analysis_file = "None"
147 options.modelR = os.path.join( options.outdir, options.name+"_model.r" )
151 logging.basicConfig(level=(4-options.verbose)*10,
158 options.error = logging.critical # function alias
159 options.warn = logging.warning
160 options.debug = logging.debug
161 options.info = logging.info
163 options.argtxt = "\n".join((
166 "# name = %s" % (options.name),\
167 "# format = %s" % (options.format),\
168 "# ChIP-seq file = %s" % (options.tfile),\
169 "# control file = %s" % (options.cfile),\
170 "# effective genome size = %.2e" % (options.gsize),\
172 "# band width = %d" % (options.bw),\
173 "# model fold = %s\n" % (options.mfold),\
176 if options.pvalue:
177 if options.broad:
178options.argtxt += "# pvalue cutoff for narrow/strong regions = %.2e\n" % (options.pvalue)
179options.argtxt += "# pvalue cutoff for broad/weak regions = %.2e\n" % (options.broadcutoff)
180options.argtxt += "# qvalue will not be calculated and reported as -1 in the final output.\n"
182 options.argtxt += "# pvalue cutoff = %.2e\n" % (options.pvalue)
183options.argtxt += "# qvalue will not be calculated and reported as -1 in the final output.\n"
185 if options.broad:
186options.argtxt += "# qvalue cutoff for narrow/strong regions = %.2e\n" % (options.qvalue)
187options.argtxt += "# qvalue cutoff for broad/weak regions = %.2e\n" % (options.broadcutoff)
189 options.argtxt += "# qvalue cutoff = %.2e\n" % (options.qvalue)
191 if options.maxgap:
192 options.argtxt += "# The maximum gap between significant sites = %d\n" % options.maxgap
194options.argtxt += "# The maximum gap between significant sites is assigned as the read length/tag …
195 if options.minlen:
196 options.argtxt += "# The minimum length of peaks = %d\n" % options.minlen
198options.argtxt += "# The minimum length of peaks is assigned as the predicted fragment length \"d\…
200 if options.downsample:
201 options.argtxt += "# Larger dataset will be randomly sampled towards smaller dataset.\n"
202 if options.seed >= 0:
203 options.argtxt += "# Random seed has been set as: %d\n" % options.seed
205 if options.scaleto == "large":
206 options.argtxt += "# Smaller dataset will be scaled towards larger dataset.\n"
208 options.argtxt += "# Larger dataset will be scaled towards smaller dataset.\n"
210 if options.ratio != 1.0:
211 options.argtxt += "# Using a custom scaling factor: %.2e\n" % (options.ratio)
213 if options.cfile:
214options.argtxt += "# Range for calculating regional lambda is: %d bps and %d bps\n" % (options.sma…
216options.argtxt += "# Range for calculating regional lambda is: %d bps\n" % (options.largelocal)
218 if options.broad:
219 options.argtxt += "# Broad region calling is on\n"
221 options.argtxt += "# Broad region calling is off\n"
223 if options.fecutoff != 1.0:
224 options.argtxt += "# Additional cutoff on fold-enrichment is: %.2f\n" % (options.fecutoff)
226 if options.format in ["BAMPE", "BEDPE"]:
228 options.shift = 0
229 options.argtxt += "# Paired-End mode is on\n"
231 options.argtxt += "# Paired-End mode is off\n"
235 if options.call_summits:
236 options.argtxt += "# Searching for subpeak summits is on\n"
238 if options.do_SPMR and options.store_bdg:
239 options.argtxt += "# MACS will save fragment pileup signal per million reads\n"
241 return options
243 def diff_opt_validate ( options ): argument
249 options.gzip_flag = False # if the input is gzip file
260 if options.peaks_pvalue:
262 options.peaks_log_qvalue = None
263 options.peaks_log_pvalue = log(options.peaks_pvalue,10)*-1
264 options.track_score_method = 'p'
266 options.peaks_log_qvalue = log(options.peaks_qvalue,10)*-1
267 options.peaks_log_pvalue = None
268 options.track_score_method = 'q'
270 if options.diff_pvalue:
272 options.log_qvalue = None
273 options.log_pvalue = log(options.diff_pvalue,10)*-1
274 options.score_method = 'p'
276 options.log_qvalue = log(options.diff_qvalue,10)*-1
277 options.log_pvalue = None
278 options.score_method = 'q'
281 options.peakxls = options.name+"_diffpeaks.xls"
282 options.peakbed = options.name+"_diffpeaks.bed"
283 options.peak1xls = options.name+"_diffpeaks_by_peaks1.xls"
284 options.peak2xls = options.name+"_diffpeaks_by_peaks2.xls"
285 options.bdglogLR = options.name+"_logLR.bdg"
286 options.bdgpvalue = options.name+"_logLR.bdg"
287 options.bdglogFC = options.name+"_logLR.bdg"
289 options.call_peaks = True
290 if not (options.peaks1 == '' or options.peaks2 == ''):
291 if options.peaks1 == '':
293 elif options.peaks2 == '':
295 options.call_peaks = False
296 options.argtxt = "\n".join((
298 "# name = %s" % (options.name),\
300 "# ChIP-seq file 1 = %s" % (options.t1bdg),\
301 "# control file 1 = %s" % (options.c1bdg),\
302 "# ChIP-seq file 2 = %s" % (options.t2bdg),\
303 "# control file 2 = %s" % (options.c2bdg),\
304 "# Peaks, condition 1 = %s" % (options.peaks1),\
305 "# Peaks, condition 2 = %s" % (options.peaks2),\
309 options.argtxt = "\n".join((
311 "# name = %s" % (options.name),\
313 "# ChIP-seq file 1 = %s" % (options.t1bdg),\
314 "# control file 1 = %s" % (options.c1bdg),\
315 "# ChIP-seq file 2 = %s" % (options.t2bdg),\
316 "# control file 2 = %s" % (options.c2bdg),\
320 if options.peaks_pvalue:
321options.argtxt += "# treat/control -log10(pvalue) cutoff = %.2e\n" % (options.peaks_log_pvalue)
322options.argtxt += "# treat/control -log10(qvalue) will not be calculated and reported as -1 in th…
324options.argtxt += "# treat/control -log10(qvalue) cutoff = %.2e\n" % (options.peaks_log_qvalue)
326 if options.diff_pvalue:
327 options.argtxt += "# differential pvalue cutoff = %.2e\n" % (options.log_pvalue)
328options.argtxt += "# differential qvalue will not be calculated and reported as -1 in the final o…
330 options.argtxt += "# differential qvalue cutoff = %.2e\n" % (options.log_qvalue)
333 logging.basicConfig(level=(4-options.verbose)*10,
340 options.error = logging.critical # function alias
341 options.warn = logging.warning
342 options.debug = logging.debug
343 options.info = logging.info
345 return options
347 def opt_validate_filterdup ( options ): argument
354 options.gsize = efgsize[options.gsize]
357 options.gsize = float(options.gsize)
359 logging.error("Error when interpreting --gsize option: %s" % options.gsize)
365 options.gzip_flag = False # if the input is gzip file
367 options.format = options.format.upper()
368 if options.format == "ELAND":
369 options.parser = ELANDResultParser
370 elif options.format == "BED":
371 options.parser = BEDParser
372 elif options.format == "BEDPE":
373 options.parser = BEDPEParser
374 elif options.format == "ELANDMULTI":
375 options.parser = ELANDMultiParser
376 elif options.format == "ELANDEXPORT":
377 options.parser = ELANDExportParser
378 elif options.format == "SAM":
379 options.parser = SAMParser
380 elif options.format == "BAM":
381 options.parser = BAMParser
382 options.gzip_flag = True
383 elif options.format == "BOWTIE":
384 options.parser = BowtieParser
385 elif options.format == "BAMPE":
386 options.parser = BAMPEParser
387 options.gzip_flag = True
388 elif options.format == "BEDPE":
389 options.parser = BEDPEParser
390 elif options.format == "AUTO":
391 options.parser = guess_parser
393 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
397 if options.keepduplicates != "auto" and options.keepduplicates != "all":
398 if not options.keepduplicates.isdigit():
403 options.format = options.format.upper()
406 logging.basicConfig(level=(4-options.verbose)*10,
413 options.error = logging.critical # function alias
414 options.warn = logging.warning
415 options.debug = logging.debug
416 options.info = logging.info
418 return options
420 def opt_validate_randsample ( options ): argument
427 options.gzip_flag = False # if the input is gzip file
429 options.format = options.format.upper()
430 if options.format == "ELAND":
431 options.parser = ELANDResultParser
432 elif options.format == "BED":
433 options.parser = BEDParser
434 elif options.format == "ELANDMULTI":
435 options.parser = ELANDMultiParser
436 elif options.format == "ELANDEXPORT":
437 options.parser = ELANDExportParser
438 elif options.format == "SAM":
439 options.parser = SAMParser
440 elif options.format == "BAM":
441 options.parser = BAMParser
442 options.gzip_flag = True
443 elif options.format == "BOWTIE":
444 options.parser = BowtieParser
445 elif options.format == "BAMPE":
446 options.parser = BAMPEParser
447 options.gzip_flag = True
448 elif options.format == "BEDPE":
449 options.parser = BEDPEParser
450 elif options.format == "AUTO":
451 options.parser = guess_parser
453 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
457 options.format = options.format.upper()
460 if options.percentage:
461 if options.percentage > 100.0:
464 elif options.number:
465 if options.number <= 0:
470 logging.basicConfig(level=(4-options.verbose)*10,
477 options.error = logging.critical # function alias
478 options.warn = logging.warning
479 options.debug = logging.debug
480 options.info = logging.info
482 return options
484 def opt_validate_refinepeak ( options ): argument
491 options.gzip_flag = False # if the input is gzip file
493 options.format = options.format.upper()
494 if options.format == "ELAND":
495 options.parser = ELANDResultParser
496 elif options.format == "BED":
497 options.parser = BEDParser
498 elif options.format == "ELANDMULTI":
499 options.parser = ELANDMultiParser
500 elif options.format == "ELANDEXPORT":
501 options.parser = ELANDExportParser
502 elif options.format == "SAM":
503 options.parser = SAMParser
504 elif options.format == "BAM":
505 options.parser = BAMParser
506 options.gzip_flag = True
507 elif options.format == "BOWTIE":
508 options.parser = BowtieParser
509 elif options.format == "AUTO":
510 options.parser = guess_parser
512 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
516 options.format = options.format.upper()
519 logging.basicConfig(level=(4-options.verbose)*10,
526 options.error = logging.critical # function alias
527 options.warn = logging.warning
528 options.debug = logging.debug
529 options.info = logging.info
531 return options
533 def opt_validate_predictd ( options ): argument
540 options.gsize = efgsize[options.gsize]
543 options.gsize = float(options.gsize)
545 logging.error("Error when interpreting --gsize option: %s" % options.gsize)
550 options.gzip_flag = False # if the input is gzip file
552 options.format = options.format.upper()
553 if options.format == "ELAND":
554 options.parser = ELANDResultParser
555 elif options.format == "BED":
556 options.parser = BEDParser
557 elif options.format == "ELANDMULTI":
558 options.parser = ELANDMultiParser
559 elif options.format == "ELANDEXPORT":
560 options.parser = ELANDExportParser
561 elif options.format == "SAM":
562 options.parser = SAMParser
563 elif options.format == "BAM":
564 options.parser = BAMParser
565 options.gzip_flag = True
566 elif options.format == "BAMPE":
567 options.parser = BAMPEParser
568 options.gzip_flag = True
569 options.nomodel = True
570 elif options.format == "BEDPE":
571 options.parser = BEDPEParser
572 options.nomodel = True
573 elif options.format == "BOWTIE":
574 options.parser = BowtieParser
575 elif options.format == "AUTO":
576 options.parser = guess_parser
578 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
582 options.format = options.format.upper()
585 if options.d_min < 0:
586 logging.error("Minimum fragment size shouldn't be negative!" % options.d_min)
590 options.lmfold = options.mfold[0]
591 options.umfold = options.mfold[1]
592 if options.lmfold > options.umfold:
593 logging.error("Upper limit of mfold should be greater than lower limit!" % options.mfold)
596 options.modelR = os.path.join( options.outdir, options.rfile )
599 logging.basicConfig(level=(4-options.verbose)*10,
606 options.error = logging.critical # function alias
607 options.warn = logging.warning
608 options.debug = logging.debug
609 options.info = logging.info
611 return options
614 def opt_validate_pileup ( options ): argument
621 options.gzip_flag = False # if the input is gzip file
623 options.format = options.format.upper()
624 if options.format == "ELAND":
625 options.parser = ELANDResultParser
626 elif options.format == "BED":
627 options.parser = BEDParser
628 elif options.format == "ELANDMULTI":
629 options.parser = ELANDMultiParser
630 elif options.format == "ELANDEXPORT":
631 options.parser = ELANDExportParser
632 elif options.format == "SAM":
633 options.parser = SAMParser
634 elif options.format == "BAM":
635 options.parser = BAMParser
636 options.gzip_flag = True
637 elif options.format == "BOWTIE":
638 options.parser = BowtieParser
639 elif options.format == "BAMPE":
640 options.parser = BAMPEParser
641 options.gzip_flag = True
642 elif options.format == "BEDPE":
643 options.parser = BEDPEParser
645 logging.error("Format \"%s\" cannot be recognized!" % (options.format))
649 options.format = options.format.upper()
652 logging.basicConfig(level=(4-options.verbose)*10,
659 options.error = logging.critical # function alias
660 options.warn = logging.warning
661 options.debug = logging.debug
662 options.info = logging.info
665 if options.extsize <= 0 :
669 return options
671 def opt_validate_bdgcmp ( options ): argument
684 options.error = logging.critical # function alias
685 options.warn = logging.warning
686 options.debug = logging.debug
687 options.info = logging.info
691 for method in set(options.method):
698 if options.ofile:
699 if len(options.method) != len(options.ofile):
703 return options
706 def opt_validate_cmbreps ( options ): argument
719 options.error = logging.critical # function alias
720 options.warn = logging.warning
721 options.debug = logging.debug
722 options.info = logging.info
727 if options.method not in [ 'fisher', 'max', 'mean']:
728 logging.error( "Invalid method: %s" % options.method )
731 if len( options.ifile ) < 2:
748 return options
751 def opt_validate_bdgopt ( options ): argument
764 options.error = logging.critical # function alias
765 options.warn = logging.warning
766 options.debug = logging.debug
767 options.info = logging.info
771 if options.method.lower() not in [ 'multiply', 'add', 'p2q', 'max', 'min']:
772 logging.error( "Invalid method: %s" % options.method )
775 if options.method.lower() in [ 'multiply', 'add' ] and not options.extraparam:
779 return options