readBam: Read bam file into a curated GRanges object

View source: R/readBam.R

readBamR Documentation

Read bam file into a curated GRanges object

Description

Read bam file into a curated GRanges object

Usage

readBam(
  bamfile,
  curate_start_and_end = TRUE,
  use_names = TRUE,
  chromosome_to_keep = paste("chr", 1:22, sep = ""),
  strand_mode = 1,
  genome_label = "hg19",
  outdir = FALSE,
  galp_flag = Rsamtools::scanBamFlag(isPaired = TRUE, isDuplicate = FALSE,
    isSecondaryAlignment = FALSE, isUnmappedQuery = FALSE, isSupplementaryAlignment =
    FALSE),
  galp_what = c("cigar", "mapq", "isize"),
  galp_tag = c("NM", "MD"),
  galp_mapqFilter = 30,
  ...
)

Arguments

bamfile

The bam file name.

curate_start_and_end

Whether curate the alignment start and end coordinates. Default to TRUE.

use_names
chromosome_to_keep

Should be a character vector containing the seqnames to be kept in the GRanges object or boolean FALSE. FALSE means not filtering. Default is paste0("chr", 1:22).

strand_mode

Usually the strand_mode = 1 means the First read is aligned to positive strand. Details please see GenomicAlignments docs.

genome_label

The Genome you used in the alignment. Should be "hg19" or "hg38" or "hg38-NCBI". Default is "hg19". Note: "hg19" will load BSgenome.Hsapiens.UCSC.hg19 package, which is Full genome sequences for Homo sapiens (Human) as provided by UCSC (hg19, based on GRCh37.p13) and stored in Biostrings objects; "hg38" will load BSgenome.Hsapiens.UCSC.hg38 package, which is Full genome sequences for Homo sapiens (Human) as provided by UCSC (hg38, based on GRCh38.p13) and stored in Biostrings objects. "hg38-NCBI" will load BSgenome.Hsapiens.NCBI.GRCh38 package, which is full genome sequences for Homo sapiens (Human) as provided by NCBI (GRCh38, 2013-12-17) and stored in Biostrings objects.

outdir

The path for saving rds file. Default is NA, i.e. not saving.

galp_flag
galp_what

A character vector naming the fields to return Rsamtools::scanBamWhat() returns a vector of available fields. Fields are described on the Rsamtools::scanBam help page.

galp_tag
galp_mapqFilter
...

Further arguments passed to or from other methods.

Value

This function returns curated GRanges object.

Author(s)

Haichao Wang

Examples

## Not run: 

object <- readGALP(bamfile = "/path/to/bamfile.bam", 
                   outdir = "./",
                   chromosome_to_keep = c("chr1", "chr2", "chr3"))

## End(Not run)


hw538/cfDNAPro documentation built on Nov. 28, 2024, 12:13 p.m.