From 0a8fa575b9a0da6256c19b09f029d8fbb2ce7d51 Mon Sep 17 00:00:00 2001 From: daler Date: Wed, 16 Sep 2015 17:24:05 -0400 Subject: [PATCH] add option to specify tempdir from commandline --- MACS2/callpeak_cmd.py | 5 ++++- bin/macs2 | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/MACS2/callpeak_cmd.py b/MACS2/callpeak_cmd.py index 7f8d2459..830b99fb 100644 --- a/MACS2/callpeak_cmd.py +++ b/MACS2/callpeak_cmd.py @@ -23,6 +23,7 @@ import sys import logging from time import strftime +import tempfile # ------------------------------------ # own python modules @@ -63,7 +64,9 @@ def run( args ): options.PE_MODE = options.format in ('BAMPE',) if options.PE_MODE: tag = 'fragment' # call things fragments not tags else: tag = 'tag' - + + tempfile.tempdir = options.tempdir + #1 Read tag files info("#1 read %s files...", tag) if options.PE_MODE: (treat, control) = load_frag_files_options (options) diff --git a/bin/macs2 b/bin/macs2 index 615a0747..998f5d7a 100644 --- a/bin/macs2 +++ b/bin/macs2 @@ -23,6 +23,7 @@ the distribution). import os import sys import argparse as ap +import tempfile # ------------------------------------ # own python modules @@ -252,6 +253,8 @@ def add_callpeak_parser( subparsers ): help = "When set, random sampling method will scale down the bigger sample. By default, MACS uses linear scaling. Warning: This option will make your result unstable and irreproducible since each time, random reads would be selected. Consider to use 'randsample' script instead. If used together with --SPMR, 1 million unique reads will be randomly picked. Caution: due to the implementation, the final number of selected reads may not be as you expected! DEFAULT: False" ) group_callpeak.add_argument( "--seed", dest = "seed", type = int, default = -1, help = "Set the random seed while down sampling data. Must be a non-negative integer in order to be effective. DEFAULT: not set" ) + group_callpeak.add_argument( "--tempdir", dest="tempdir", default=tempfile.gettempdir(), + help = "Optional directory to store temp files. DEFAULT: %(default)s") group_callpeak.add_argument( "--nolambda", dest = "nolambda", action = "store_true", help = "If True, MACS will use fixed background lambda as local lambda for every peak region. Normally, MACS calculates a dynamic local lambda to reflect the local bias due to potential chromatin structure. ", default = False )