pileupCounts {TarSeqQC} | R Documentation

## Function to obtain the pileup counts for a bam file.

### Description

`pileupCounts` waits for a TargetExperiment object containing the bed file information in order to obtain pileup counts only for the specified genomic regions. The resulting object is a data.frame instance, in which each row represents one position of the specified features across the bed file. The first three columns called 'pos', 'seqnames' and 'which_label,' represent the position in the seqnames (e.g. pos=10183795 and seqnames=chr3) and the associated feature. According to the 'pileupP' parameters set before, the number of next columns could change. If 'distinguish_nucleotide' was set to TRUE, then one column per ntd will appear containing the counts obtained for each of them. Same will occur when 'distinguish_strands' is set to TRUE. The last column, called 'counts', contains the total counts obtained for the corresponding position.

### Usage

    pileupCounts(bed, bamFile, fastaFile, scanBamP = NULL, pileupP = NULL,
        BPPARAM = bpparam())

### Arguments

`bed` | a Granges object containing the bed file information.
`bamFile` | Character indicating the alignment and index bam files full path.
`fastaFile` | Character indicating the full path to the genome reference and index files.
`scanBamP` | ScanBamParam indicating the parameters the BAM file read.
`pileupP` | PileupParam indicating the parameters for the pileup build.
`BPPARAM` | An optional BiocParallelParam instance defining the parallel back-end to be used during evaluation.

### Value

data.frame object.

### Author(s)

Gabriela A. Merino gmerino@bdmg.com.ar, Cristobal Fresno cfresno@bdmg.com.ar, Yanina Murua ymurua@leloir.org.ar, Andrea S. Llera allera@leloir.org.ar and Elmer A. Fernandez efernandez@bdmg.com.ar

### References

1. Morgan M, Pages H, Obenchain V and Hayden N. Rsamtools: Binary alignment (BAM), FASTA, variant call (BCF), and tabix file import. R package version 1.20.1

### See Also

`Rsamtools-pileup`

### Examples

    ##Obtain the pileup matrix for the first amplicon
    data(ampliPanel, package="TarSeqQC")
    bed<-getBedFile(ampliPanel)[1]
    ## Defining bam file and fasta file names and paths
    bamFile<-system.file("extdata", "mybam.bam", package="TarSeqQC", mustWork=TRUE)
    fastaFile<-system.file("extdata", "myfasta.fa", package="TarSeqQC",
        mustWork=TRUE)
    ## extracting the pileup matrix
    myCounts<-pileupCounts(bed, bamFile, fastaFile)
    head(myCounts)

[Package TarSeqQC version 1.24.0 Index]