get_bam_bed: Get bam file directories, sample names, and whole genomic...

Description Usage Arguments Value Author(s) Examples

View source: R/get_bam_bed.R

Description

Get bam file directories, sample names, and whole genomic bins from .bed file

Usage

1
2
get_bam_bed(bamdir, sampname, hgref = "hg19", resolution = 500, 
            sex = FALSE)

Arguments

bamdir

vector of the directory of a bam file. Should be in the same order as sample names in sampname.

sampname

vector of sample names. Should be in the same order as bam directories in bamdir.

hgref

reference genome. This should be 'hg19', 'hg38' or 'mm10'. Default is human genome hg19.

resolution

numeric value of fixed bin-length. Default is 500. Unit is "kb".

sex

logical, whether to include sex chromosomes. Default is FALSE.

Value

A list with components

bamdir

A vector of bam directories

sampname

A vector of sample names

ref

A GRanges object specifying whole genomic bin positions

Author(s)

Rujin Wang rujin@email.unc.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(WGSmapp)
library(BSgenome.Hsapiens.UCSC.hg38)
bamfolder <- system.file('extdata', package = 'WGSmapp')
bamFile <- list.files(bamfolder, pattern = '*.dedup.bam$')
bamdir <- file.path(bamfolder, bamFile)
sampname_raw <- sapply(strsplit(bamFile, '.', fixed = TRUE), '[', 1)
bambedObj <- get_bam_bed(bamdir = bamdir, sampname = sampname_raw, 
                        hgref = "hg38")
bamdir <- bambedObj$bamdir
sampname_raw <- bambedObj$sampname
ref_raw <- bambedObj$ref

SCOPE documentation built on Nov. 8, 2020, 5:27 p.m.