Permalink
Browse files

Adjust -o as --ofile instead of '--o-prefix'.

  • Loading branch information...
1 parent 9cdcd3a commit 061f7eece6cf787875ad95793d92a4ad1467ab8b @taoliu committed Oct 28, 2013
Showing with 73 additions and 34 deletions.
  1. +35 −0 ChangeLog
  2. +6 −5 MACS2/OptValidator.py
  3. +9 −3 MACS2/bdgcmp.py
  4. +13 −15 bin/macs2
  5. +10 −11 test/test.sh
View
35 ChangeLog
@@ -1,3 +1,38 @@
+2013-10-28 Tao Liu <vladimir.liu@gmail.com>
+ MACS version 2.0.10 20131028 (tag:alpha)
+
+ * callpeak --call-summits improvement
+
+ The smoothing window length has been fixed as fragment length
+ instead of short read length. The larger smoothing window will
+ grant better smoothing results and better sub-peak summits
+ detection.
+
+ * --outdir and --ofile options for almost all commands
+
+ Thank Björn Grüning for initially implementing these options!
+ Now, MACS2 will save results into a specified
+ directory by '--outdir' option, and/or save result into a
+ specified file by '--ofile' option. Note, in case '--ofile' is
+ available for a subcommand, '-o' now has been adjusted to be the
+ same as '--ofile' instead of '--o-prefix'.
+
+ Here is the list of changes. For more detail, use 'macs2 xxx -h'
+ for each subcommand:
+
+ ** callpeak: --outdir
+ ** diffpeak: Not implemented
+ ** bdgpeakcall: --outdir and --ofile
+ ** bdgbroadcall: --outdir and --ofile
+ ** bdgcmp: --outdir and --ofile. While --ofile is used, the number
+ and the order of arguments for --ofile must be the same as for -m.
+ ** bdgdiff: --outdir and --ofile
+ ** filterdup: --outdir
+ ** pileup: --outdir
+ ** randsample: --outdir
+ ** refinepeak: --outdir and --ofile
+
+
2013-09-15 Tao Liu <vladimir.liu@gmail.com>
MACS version 2.0.10 20130915 (tag:alpha)
View
11 MACS2/OptValidator.py
@@ -1,4 +1,4 @@
-# Time-stamp: <2013-10-28 01:31:34 Tao Liu>
+# Time-stamp: <2013-10-28 12:21:24 Tao Liu>
"""Module Description
@@ -792,11 +792,12 @@ def opt_validate_bdgcmp ( options ):
logging.error( "Invalid method: %s" % method )
sys.exit( 1 )
- # --ofile not compatible with multiple method
+ # # of --ofile must == # of -m
- if len( options.method ) > 1 and options.ofile:
- logging.error("--ofile is not compatible with multiple arguments by -m! Please specify only one method.")
- sys.exit(1)
+ if options.ofile:
+ if len(options.method) != len(options.ofile):
+ logging.error("The number and the order of arguments for --ofile must be the same as for -m.")
+ sys.exit(1)
return options
View
12 MACS2/bdgcmp.py
@@ -1,4 +1,4 @@
-# Time-stamp: <2013-10-27 22:39:45 Tao Liu>
+# Time-stamp: <2013-10-28 12:17:33 Tao Liu>
import sys
import os
@@ -51,10 +51,16 @@ def run( options ):
sbtrack.change_normalization_method( ord('M') ) # a hack to override SPMR
sbtrack.set_pseudocount( options.pseudocount )
- for method in set(options.method):
+ already_processed_method_list = []
+ for (i, method) in enumerate(options.method):
+ if method in already_processed_method_list:
+ continue
+ else:
+ already_processed_method_list.append( method )
+
info("Calculate scores comparing treatment and control by '%s'..." % method)
if options.ofile:
- ofile = os.path.join( options.outdir, options.ofile )
+ ofile = os.path.join( options.outdir, options.ofile[ i ] )
else:
ofile = os.path.join( options.outdir, options.oprefix + "_" + method + ".bdg" )
# build score track
View
28 bin/macs2
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Time-stamp: <2013-10-28 02:00:22 Tao Liu>
+# Time-stamp: <2013-10-28 13:11:14 Tao Liu>
"""Description: MACS v2 main executable.
@@ -150,10 +150,10 @@ def add_outdir_option ( parser ):
def add_output_group ( parser, required = True ):
output_group = parser.add_mutually_exclusive_group( required = required )
- output_group.add_argument( "--ofile", dest = "ofile", type = str,
- help = "output path, it set --o-prefix will be ignored. Mutually exclusive with -o/--o-prefix." )
- output_group.add_argument( "-o", "--o-prefix", dest = "oprefix", type = str,
- help = "output file prefix. Mutually exclusive with --ofile." )
+ output_group.add_argument( "-o", "--ofile", dest = "ofile", type = str,
+ help = "Output file name. Mutually exclusive with --o-prefix." )
+ output_group.add_argument( "--o-prefix", dest = "oprefix", type = str,
+ help = "Output file prefix. Mutually exclusive with -o/--ofile." )
def add_callpeak_parser( subparsers ):
"""Add main function 'peak calling' argument parsers.
@@ -287,8 +287,6 @@ def add_diffpeak_parser( subparsers ):
# group for output files
group_output = argparser_diffpeak.add_argument_group( "Output arguments" )
-# argparser_diffpeak.add_argument( "-o", "--o-prefix", dest = "oprefix", default = "diffpeak", type = str,
-# help = "output file prefix, DEFAULT: diffpeak" )
add_outdir_option( group_output )
group_output.add_argument( "-n", "--name", dest = "name", type = str,
help = "Experiment name, which will be used to generate output file names. DEFAULT: \"diffpeak\"",
@@ -413,10 +411,10 @@ def add_bdgcmp_parser( subparsers ):
add_outdir_option( argparser_bdgcmp )
output_group = argparser_bdgcmp.add_mutually_exclusive_group( required = True )
- output_group.add_argument( "-o", "--o-prefix", dest = "oprefix", type = str,
- help = "The PREFIX of output bedGraph file to write scores. If it is given as A, and method is 'ppois', output file will be A_ppois.bdg. Mutually exclusive with --ofile." )
- output_group.add_argument( "--ofile", dest = "ofile", type = str,
- help = "output filename. Mutually exclusive with -o/--o-prefix. Note: --ofile is not compatible with multiple methods through -m!" )
+ output_group.add_argument( "--o-prefix", dest = "oprefix", type = str,
+ help = "The PREFIX of output bedGraph file to write scores. If it is given as A, and method is 'ppois', output file will be A_ppois.bdg. Mutually exclusive with -o/--ofile." )
+ output_group.add_argument( "-o", "--ofile", dest = "ofile", type = str, nargs = "+",
+ help = "Output filename. Mutually exclusive with --o-prefix. The number and the order of arguments for --ofile must be the same as for -m." )
return
def add_randsample_parser( subparsers ):
@@ -469,10 +467,10 @@ def add_bdgdiff_parser( subparsers ):
add_outdir_option( argparser_bdgdiff )
output_group = argparser_bdgdiff.add_mutually_exclusive_group( required = True )
- output_group.add_argument( "-o", "--o-prefix", dest = "oprefix", type = str,
- help = "Output file prefix. Actual files will be named as PREFIX_cond1.bed, PREFIX_cond2.bed and PREFIX_common.bed. Mutually exclusive with --ofile." )
- output_group.add_argument( "--ofile", dest = "ofile", type = str, nargs = 3,
- help = "Output filenames. Must give three arguments in order: 1. file for unique regions in condition 1; 2. file for unique regions in condition 2; 3. file for common regions in both conditions. Note: mutually exclusive with -o/--o-prefix." )
+ output_group.add_argument( "--o-prefix", dest = "oprefix", type = str,
+ help = "Output file prefix. Actual files will be named as PREFIX_cond1.bed, PREFIX_cond2.bed and PREFIX_common.bed. Mutually exclusive with -o/--ofile." )
+ output_group.add_argument( "-o", "--ofile", dest = "ofile", type = str, nargs = 3,
+ help = "Output filenames. Must give three arguments in order: 1. file for unique regions in condition 1; 2. file for unique regions in condition 2; 3. file for common regions in both conditions. Note: mutually exclusive with --o-prefix." )
return
View
21 test/test.sh
@@ -19,21 +19,21 @@ macs2 callpeak -t $CHIP -c $CTRL -n run_callpeak_broad -B --outdir run_callpeak_
# bdgcmp
-macs2 bdgcmp -t run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg -c run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg -m ppois FE --outdir run_bdgcmp_multiple -o run_bdgcmp_myMulti
+macs2 bdgcmp -t run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg -c run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg -m ppois FE --outdir run_bdgcmp_oprefix --o-prefix run_bdgcmp_oprefix
-macs2 bdgcmp -t run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg -c run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg -m FE --outdir run_bdgcmp_single --ofile run_bdgcmp_single_myFE.bdg
+macs2 bdgcmp -t run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg -c run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg -m ppois FE --outdir run_bdgcmp_ofile -o run_bdgcmp_ofile_ppois.bdg run_bdgcmp_ofile_FE.bdg
# bdgpeakcall
-macs2 bdgpeakcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 2 --outdir run_bdgpeakcall -o run_bdgpeakcall_w_prefix
+macs2 bdgpeakcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 2 --outdir run_bdgpeakcall --o-prefix run_bdgpeakcall_w_prefix
-macs2 bdgpeakcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 2 --outdir run_bdgpeakcall --ofile run_bdgpeakcall_w_ofile.narrowPeak
+macs2 bdgpeakcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 2 --outdir run_bdgpeakcall -o run_bdgpeakcall_w_ofile.narrowPeak
# bdgbroadcall
-macs2 bdgbroadcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 4 -C 2 --outdir run_bdgbroadcall -o run_bdgbroadcall_w_prefix
+macs2 bdgbroadcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 4 -C 2 --outdir run_bdgbroadcall --o-prefix run_bdgbroadcall_w_prefix
-macs2 bdgbroadcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 4 -C 2 --outdir run_bdgbroadcall --ofile run_bdgbroadcall_w_ofile.gappedPeak
+macs2 bdgbroadcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 4 -C 2 --outdir run_bdgbroadcall -o run_bdgbroadcall_w_ofile.gappedPeak
# diffpeak
@@ -43,9 +43,9 @@ macs2 bdgbroadcall -i run_bdgcmp_single/run_bdgcmp_single_myFE.bdg -c 4 -C 2 --o
macs2 callpeak -c $CHIP -t $CTRL -n run_callpeak_narrow_revert -B --outdir run_callpeak_narrow_revert
-macs2 bdgdiff --t1 run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg --c1 run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg --t2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_treat_pileup.bdg --c2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_control_lambda.bdg -o run_bdgdiff_prefix --outdir run_bdgdiff
+macs2 bdgdiff --t1 run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg --c1 run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg --t2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_treat_pileup.bdg --c2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_control_lambda.bdg --o-prefix run_bdgdiff_prefix --outdir run_bdgdiff
-macs2 bdgdiff --t1 run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg --c1 run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg --t2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_treat_pileup.bdg --c2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_control_lambda.bdg --ofile cond1.bed cond2.bed common.bed --outdir run_bdgdiff
+macs2 bdgdiff --t1 run_callpeak_narrow/run_callpeak_narrow_treat_pileup.bdg --c1 run_callpeak_narrow/run_callpeak_narrow_control_lambda.bdg --t2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_treat_pileup.bdg --c2 run_callpeak_narrow_revert/run_callpeak_narrow_revert_control_lambda.bdg -o cond1.bed cond2.bed common.bed --outdir run_bdgdiff
# filterdup
@@ -65,8 +65,7 @@ macs2 randsample -t $CHIP -n 100000 --seed 31415926 --outdir run_randsample -o r
# refinepeak
-macs2 refinepeak -b run_callpeak_narrow/run_callpeak_narrow_peaks.narrowPeak -i $CHIP --outdir run_refinepeak -o run_refinepeak_w_prefix
-
-macs2 refinepeak -b run_callpeak_narrow/run_callpeak_narrow_peaks.narrowPeak -i $CHIP --outdir run_refinepeak --ofile run_refinepeak_w_ofile.bed
+macs2 refinepeak -b run_callpeak_narrow/run_callpeak_narrow_peaks.narrowPeak -i $CHIP --outdir run_refinepeak --o-prefix run_refinepeak_w_prefix
+macs2 refinepeak -b run_callpeak_narrow/run_callpeak_narrow_peaks.narrowPeak -i $CHIP --outdir run_refinepeak -o run_refinepeak_w_ofile.bed

0 comments on commit 061f7ee

Please sign in to comment.