findUniqueMap: Filter a BAM file to preserve unique mappings with samtools

View source: R/scAPAtrap_funlib.R

findUniqueMapR Documentation

Filter a BAM file to preserve unique mappings with samtools

Description

findUniqueMap filters a BAM file to preserve unique mappings with samtools. This function will generate .bam (<input>.uniq.bam or UniqSorted.bam if sort=TRUE) and .bai (if index=TRUE). Suffix .Uniq or .UniqSorted will be added to the input BAM file. This function is the same as call samtools in Shell.

Usage

findUniqueMap(
  samtools.path,
  input,
  thread = 12,
  sort = TRUE,
  index = TRUE,
  ...
)

Arguments

samtools.path

The path of the samtools.

input

BAM file name.

thread

Number of CPU threads, default is 12.

sort

Logical value, TRUE to sort the BAM file.

index

Logical value, TRUE to build the index.

...

Arguments passed to other methods and/or advanced arguments. Advanced arguments:

verbose

If 'TRUE' basic status updates will be printed along the way.

logf

If not NULL, then it should be a character string denoting a file name. Then message will be written to 'logf'.

notRun

Default is FALSE. If 'TRUE', the Shell commands inside this function will not run but output the commad line.

Value

Output path of the new BAM file name with only unique mapped reads (<input>.uniq.bam or UniqSorted.bam if sort=TRUE).

Examples

samtools.path <- '/home/aa/miniconda2/envs/nar_env/bin/samtools'
input <- './data/demo.bam'
## Not run: 
findUniqueMap(samtools.path, input, 24)

## End(Not run)
## only output command lines
findUniqueMap(samtools.path, input, 24, notRun=TRUE)

BMILAB/scAPAtrap documentation built on Oct. 13, 2023, 2:36 a.m.