readPileup: Import samtools 'pileup' files.

Description Usage Arguments Value Author(s) References Examples

Description

Import files created by evaluation of samtools' pileup -cv command.

Usage

1
2
3
readPileup(file, ...)
## S4 method for signature 'connection'
readPileup(file, ..., variant=c("SNP", "indel", "all"))

Arguments

file

The file name, or connection, of the pileup output file to be parsed.

...

Additional arguments, passed to methods. For instance, specify variant for the readPileup,character-method.

variant

Type of variant to parse; select one.

Value

readPileup returns a GRanges object.

The value returned by variant="SNP" or variant="all" contains:

space:

The chromosome names (fastq ids) of the reference sequence

position:

The nucleotide position (base 1) of the variant.

referenceBase:

The nucleotide in the reference sequence.

consensusBase;

The consensus nucleotide, as determined by samtools pileup.

consensusQuality:

The phred-scaled consensus quality.

snpQuality:

The phred-scaled SNP quality (probability of the consensus being identical to the reference).

maxMappingQuality:

The root mean square mapping quality of reads overlapping the site.

coverage:

The number of reads covering the site.

The value returned by variant="indel" contains space, position, reference, consensus, consensusQuality, snpQuality, maxMappingQuality, and coverage fields, and:

alleleOne, alleleTwo

The first (typically, in the reference sequence) and second allelic variants.

alleleOneSupport, alleleTwoSupport

The number of reads supporting each allele.

additionalIndels

The number of additional indels present.

Author(s)

Sean Davis

References

http://samtools.sourceforge.net/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
fl <- system.file("extdata", "pileup.txt", package="Rsamtools",
                  mustWork=TRUE)
(res <- readPileup(fl))
xtabs(~referenceBase + consensusBase, mcols(res))[DNA_BASES,]

## Not run: ## uses a pipe, and arguments passed to read.table
## three successive piles of 100 records each
cmd <- "samtools pileup -cvf human_b36_female.fa.gz na19240_3M.bam"
p <- pipe(cmd, "r")
snp <- readPileup(p, nrow=100)  # variant="SNP"
indel <- readPileup(p, nrow=100, variant="indel")
all <- readPileup(p, nrow=100, variant="all")

## End(Not run)

Rsamtools documentation built on Nov. 8, 2020, 8:11 p.m.