Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

readPileup

Import samtools 'pileup' files.


Description

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

Usage

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

Examples

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

Binary alignment (BAM), FASTA, variant call (BCF), and tabix file import

v2.6.0
Artistic-2.0 | file LICENSE
Authors
Martin Morgan, Hervé Pagès, Valerie Obenchain, Nathaniel Hayden
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.