filterBamByReadNames: Filter reads from BAM file by read names

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Main.R

Description

Generate filtered BAM file that does not contain reads with the input read names.

Usage

1
2
filterBamByReadNames(file, readsToFilter, index=file,
destination=sub("\\.bam(\\.gz)?", ".FilterFFPE.bam", file), overwrite=FALSE)

Arguments

file

Path to the input BAM file.

readsToFilter

A character vector of read names to filter.

index

Path of the index file of the input BAM file.

destination

Path of the output filtered BAM file.

overwrite

Boolean value indicating whether the destination can be over-written if it already exists.

Details

Generate filtered BAM file that does not contain reads with the input read names, index file is also created.

Value

The file name of the created destination file.

Author(s)

Lanying Wei <lanying.wei@uni-muenster.de>

See Also

FilterFFPE, findArtifactChimericReads, FFPEReadFilter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
file <- system.file("extdata", "example.bam", package = "FilterFFPE")
outFolder <- tempdir()
FFPEReadsFile <- paste0(outFolder, "/example.FFPEReads.txt")
dupChimFile <- paste0(outFolder, "/example.dupChim.txt")
destination <- paste0(outFolder, "/example.FilterFFPE.bam")
artifactReads <- findArtifactChimericReads(file = file, threads = 2,
                                           FFPEReadsFile = FFPEReadsFile,
                                           dupChimFile = dupChimFile)
dupChim <- readLines(dupChimFile)
readsToFilter <- c(artifactReads, dupChim)
filterBamByReadNames(file = file, readsToFilter = readsToFilter,
                     destination = destination, overwrite=TRUE)

LanyingWei/FilterFFPE documentation built on Nov. 13, 2020, 3:58 a.m.