scAPAtrap: Wrapper function for one-step running of scAPAtrap

View source: R/scAPAtrap_funlib.R

scAPAtrapR Documentation

Wrapper function for one-step running of scAPAtrap

Description

Wrapper function for one-step running of scAPAtrap

Usage

scAPAtrap(tools, trap.params, inputBam, outputDir, ...)

Arguments

tools

A list contains four tools used in scAPAtrap.

trap.params

Parameters of running scAPAtrap, see global variable TRAP.PARAMS.

inputBam

Input bam file name. If trap.params$chr is NULL, will try to get chrs from inputBam.

outputDir

Output dir for storing scAPAtrap's final output – peaks and counts files. If only dirname is given (e.g., APAres but not ./APAres), then will add path of inputBam to the dir name. If outputDir already exists, an error will be raised to avoid overwritting. However, many temporary files are generated during running scAPAtrap, which could be seen from global variable TRAPFILES. Those files marked with * could be savely deleted.

...

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. If logf is a character string, then message will be written to 'logf'. But if logf already exists, this function will quit to avoid overwriting an existing log file. The logf will log full information during scAPAtrap, including time, command, and output files.

Value

A file name storing scAPAtrapData object, which is <outputDir>/scAPAtrapData.rda

Examples

## Not run: 
tools=list(samtools='/home/dell/miniconda3/envs/scAPA/bin/samtools',
           umitools='/home/dell/miniconda3/envs/scAPA/bin/umi_tools',
           featureCounts="/home/dell/miniconda3/envs/scAPA/bin/featureCounts",
           star='/home/dell/miniconda3/envs/scAPA/bin/STAR')
trap.params=TRAP.PARAMS()
trap.params$chrs=c('2L','2R','3L','3R','4','X','Y')

## input BAM
dir0='/mnt/64cf3476-350c-46ad-bc48-574fa64a0334/test/xwu/dataFly/'
inputBam=paste0(dir0, "filterCB.bam")

## log file
logf=gsub('.bam', '.scAPAtrap.log', inputBam, fixed=TRUE)
unlink(logf)

## barcode (if have)
barcodefile <- paste0(dir0, 'barcode.17.txt')
barcode <- utils::read.delim2(barcodefile, header = FALSE)
barcode <- gsub('-[0-9]','',barcode$V1)
## add barcode to trap.params
trap.params$barcode=barcode

## output dir (will be under inputBam's dir)
outputDir="APA.result"

## one step scAPAtrap
scAPAtrap(tools=tools, trap.params=trap.params,
         inputBam=inputBam, outputDir=outputDir, logf=logf)

## End(Not run)

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