importPEBamFiles: A function to import paired end bam files as GRanges

View source: R/bamutils.R

importPEBamFilesR Documentation

A function to import paired end bam files as GRanges

Description

This function takes bam file paths and read them into GRanges objects. Note: Can be quite lengthy for .bam files with 5+ millions fragments.

Usage

importPEBamFiles(
  files,
  genome = NULL,
  where = NULL,
  max_insert_size = 1000,
  shift_ATAC_fragments = FALSE,
  cores = 10,
  verbose = TRUE
)

Arguments

files

character vector, each element of the vector is the path of an individual .bam file.

genome

character, genome ID (e.g. "sacCer3", "ce11", "dm6", "mm10" or "hg38").

where

GRanges, only import the fragments mapping to the input GRanges (can fasten the import process a lot).

max_insert_size

Integer, filter out fragments larger than this size.

shift_ATAC_fragments

Boolean, if the fragments come from ATAC-seq, one might want to shift the extremities by +5 / -4 bp.

cores

Integer, number of cores to use when indexing bam files

verbose

Boolean

Value

A GRanges object containing fragments from the input .bam file.

Examples

bamfile <- system.file("extdata", "ex1.bam", package = "Rsamtools")
fragments <- importPEBamFiles(
    bamfile, 
    shift_ATAC_fragments = TRUE
)
fragments

js2264/VplotR documentation built on Jan. 4, 2024, 7:49 p.m.