run_bedtools: Run the Bedtools program

Description Usage Arguments Value Examples

View source: R/run_bedtools.R

Description

Runs the bedtools program, currently only supports coverage

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
run_bedtools(
  command = NULL,
  input = NULL,
  reference = NULL,
  out.dir = NULL,
  sample.names = NULL,
  counts = FALSE,
  bedtools = NULL,
  version = FALSE
)

Arguments

command

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

input

List of aligned files in bam format, required

reference

GTF file fro 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

bedtools

Path to the bedtools program, required

version

Returns the version number

Value

A list with the bedtools commands

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## 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 June 19, 2021, 1:08 p.m.