#NEWLINE# def runMACS( infile , outfile ) : #NEWLINE# #INDENT# 'run MACS for peak detection.\n\n    The output bed files contain the P-value as their score field.\n    ' #NEWLINE# to_cluster = True #NEWLINE# if infile . endswith ( '.norm.bam' ) : #NEWLINE# #INDENT# track = infile [ : ( - len ( '.norm.bam' ) ) ] #NEWLINE# if track . startswith ( 'control' ) : #NEWLINE# #INDENT# P . touch ( outfile ) #NEWLINE# return #NEWLINE# #UNINDENT# format = 'bam' #NEWLINE# suffix = '.norm.bam' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if infile . endswith ( '.bam' ) : #NEWLINE# #INDENT# track = infile [ : ( - len ( '.bam' ) ) ] #NEWLINE# if track . startswith ( 'control' ) : #NEWLINE# #INDENT# P . touch ( outfile ) #NEWLINE# return #NEWLINE# #UNINDENT# format = 'bam' #NEWLINE# suffix = '.norm.bam' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if infile . endswith ( '.bed.gz' ) : #NEWLINE# #INDENT# track = infile [ : ( - len ( '.bed.gz' ) ) ] #NEWLINE# if track . startswith ( 'control' ) : #NEWLINE# #INDENT# outs = open ( outfile , 'w' ) #NEWLINE# outs . close ( ) #NEWLINE# return #NEWLINE# #UNINDENT# format = 'bed' #NEWLINE# suffix = '.bed.gz' #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# control = getControl ( track ) #NEWLINE# if ( control != None ) : #NEWLINE# #INDENT# control += suffix #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# E . info ( ( '%s: no control for track %s' % ( outfile , track ) ) ) #NEWLINE# control = None #NEWLINE# #UNINDENT# if control : #NEWLINE# #INDENT# control = ( '-c %s' % control ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# control = '' #NEWLINE# #UNINDENT# statement = '\n    macs -t %(infile)s %(control)s     --diag     --name=%(outfile)s     --format=%(format)s     %(macs_options)s >& %(outfile)s' #NEWLINE# P . run ( ** dict ( ( locals ( ) . items ( ) + PARAMS . items ( ) ) ) )