Skip to contents

Function that filters out the following reads: 1) aligned no non-cannonical chromosomes, 2) not aligned, 3) aligned to ENCODE blacklisted regions and 3) duplicated reads.

Usage

filtOutBAM(
  file,
  path_logs,
  type = "SE",
  remove = c("chrM", "chrUn", "_random", "_hap", "_gl", "EBV"),
  blacklist = "~/data/consensusBlacklist.bed",
  cores = 6
)

Arguments

file

Filenme and path for the BAM file to be filtered out.

path_logs

Character indicating the output directory for the logs.

type

Sequence type, one of "SE" (single end) or "PE" (paired end).

remove

Character vector with chr that will be filtered out. Any chromosome name containing matches for these characters will be removed.

blacklist

Character indicating the file containing blacklist regions in bed format. Any reads overlapping these regions will be discarded.

cores

Number of cores to use for the analysis.

Value

File without the ".raw" preffix containing the final reads, along with its index (.bai). Also returns invisibly the name of the output file.

Examples

if (FALSE) {
file <- filtOutBAM(file=file,
                   path_logs=path_logs,
                   cores=8)
}