R/Peak_Calling.R

Defines functions call_MACS2

# ---------------------------------------------------------------------------- #
call_MACS2 = function(chipfile=NULL, contfile=NULL, outpath, name, genome='hs'){
    
    outdir = file.path(outpath, name)
        dir.create(outdir, showWarnings=FALSE)
        
    if(is.null(chipfile))
        stop('Please specify the ChIP file')
    
    command = paste('macs2 callpeak',
                    '-t', chipfile,
                    '-g', genome,
                    '-n', name,
                    '-f', 'BAM',
                    '--call-summits',
                    '--outdir', outdir)
    if(!is.null(contfile))
        command = paste(command, '-t', contfile)
    system(command)
}

# ---------------------------------------------------------------------------- #
frenkiboy/MyLib documentation built on Oct. 24, 2020, 11:01 a.m.