run_bedtools: Run the Bedtools program

View source: R/run_bedtools.R

run_bedtoolsR Documentation

Run the Bedtools program

Description

Runs the bedtools program

Usage

run_bedtools(
  command = NULL,
  input = NULL,
  reference = NULL,
  out.dir = NULL,
  sample.names = NULL,
  counts = NULL,
  name = NULL,
  strand = NULL,
  parallel = FALSE,
  cores = 4,
  execute = TRUE,
  bedtools = NULL,
  version = FALSE
)

Arguments

command

Bedtools command to run, at present can only choose from 'coverage' or 'bamtobed'or "getfasta", required

input

List of aligned files in bam format, required

reference

GTF/GFF3 file for calculating the depth of coverage intervals

out.dir

Name of the directory from the Bedtools output

sample.names

List of sample names, required

counts

Only report the count of overlaps, default set to FALSE

name

Use the name field and coordinates for the FASTA header

strand

Force strandedness

parallel

Run in parallel, default set to FALSE

cores

Number of cores/threads to use for parallel processing, default set to 4

execute

Whether to execute the commands or not, default set to TRUE

bedtools

Path to the bedtools program, required

version

Returns the version number

Value

A list with the bedtools commands

Examples

## Not run: 
# Version
bedtools.path <- "/software/bedtools2/bin/bedtools"
bedtools.version <- run_bedtools(bedtools = bedtools.path,
                                 version = TRUE)

# Bedtools coverage
command = "coverage"
outputDirectory <- "coverage"
sam.files <- list.files(path = alignments.path, pattern = "sam$",
                        full.names = TRUE,
                        recursive = TRUE)
sorted.bam.files <- gsub(sam.files,
                         pattern = ".sam",
                         replacement = "_sorted.bam")
sample_names <- unlist(lapply(strsplit(list.files(path = reads_path,
                       pattern = "*_R1_001.fastq$",
                       full.names = FALSE),"_"), `[[`, 1))
gtfFile <- "mirBase/hsa.ensembl.gff3"

bedtools.cmds <- run_bedtools(command = command,
                              input = sorted.bam.files,
                              reference = gtfFile,
                              out.dir = outputDirectory,
                              sample.names = sample.names,
                              counts = TRUE,
                              bedtools = bedtools.path)
bedtools.cmds

## End(Not run)


GrahamHamilton/pipelineTools documentation built on Dec. 8, 2024, 3:53 p.m.