filterBamByReadNames {FilterFFPE}R Documentation

Filter reads from BAM file by read names

Description

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

Usage

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

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)

[Package FilterFFPE version 1.2.0 Index]