import_bams: Import BAMs

View source: R/bam_processing.R

import_bamsR Documentation

Import BAMs

Description

Import and process BAM files.

Usage

import_bams(
  experiment,
  paired,
  sample_sheet = NULL,
  soft_remove = 3,
  proper_pair = NULL,
  remove_secondary = TRUE,
  remove_duplicate = FALSE
)

Arguments

experiment

TSRexploreR object.

paired

Whether the BAMs are paired (TRUE) or unpaired (FALSE).

sample_sheet

A sample sheet data.frame or tab delimited file. Must have the columns 'sample_name', 'file_1', and 'file_2'. Additional meta-data columns can be added with sample information such as condition and batch.

soft_remove

Remove read if greater than this number of soft-clipped bases is present at its 5' most end.

proper_pair

Remove reads flagged as improperly paired. TRUE by default when data is paired-end.

remove_secondary

Remove secondary alignments (TRUE).

remove_duplicate

Remove duplicate reads (paired-end only) (TRUE).

Details

Import BAMs using the information from the sample sheet. If the BAMs are from paired-end data, 'proper_pair' allows removal of reads without a proper-pair SAM flag. Additionally 'remove_secondary' and 'remove_duplicate' will remove reads with the secondary alignment and duplicate flags set.

Most TSS mapping methodologies tend to add at least one non-templated base at the 5' end of the read. Furthermore, template switching reverse transcription (TSRT)-based methods such as STRIPE-seq or nanoCAGE can have up to 3 or 4 non-templated 5' bases. We recommend setting 'soft_remove' to at minimum 3 because of this, which removes the read if the given number of soft-clip bases is exceeded.

Value

TSRexploreR object with BAM GRanges and soft-clipped base information.

Examples

bam_file <- system.file("extdata", "S288C.bam", package="TSRexploreR")
assembly <- system.file("extdata", "S288C_Assembly.fasta", package="TSRexploreR")
samples <- data.frame(sample_name="S288C", file_1=bam_file, file_2=NA)

exp <- tsr_explorer(sample_sheet=samples, genome_assembly=assembly)
import_bams(exp, paired=TRUE)


zentnerlab/TSRexploreR documentation built on Dec. 30, 2022, 10:27 p.m.